From ba24a09f243227688910afdd98bfd1b2fc9fe3ae Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 9 Feb 2015 04:34:57 -0800 Subject: [PATCH] Use api.github to get Configurations - Make api.github the default source for configurations - Remove configurations from the configurator - Continuation and enhancements --- Marlin/configurator/css/configurator.css | 70 ++++- Marlin/configurator/index.html | 21 +- Marlin/configurator/js/configurator.js | 340 +++++++++++++---------- 3 files changed, 273 insertions(+), 158 deletions(-) diff --git a/Marlin/configurator/css/configurator.css b/Marlin/configurator/css/configurator.css index ca2f3f866..620311475 100644 --- a/Marlin/configurator/css/configurator.css +++ b/Marlin/configurator/css/configurator.css @@ -2,7 +2,7 @@ /* Styles for Marlin Configurator */ body { margin: 0; padding: 0; background: #56A; color: #FFC; font-family: sans-serif; } - +fieldset { height: 16.1em; overflow: auto; margin-top: 10px; } #main { max-width: 1000px; margin: 0 auto; } #main { padding: 0 4%; width: 92%; } #main { font-family: monospace; } @@ -19,10 +19,23 @@ h1, #message { text-align: center; } img { display: none; } label, input, select, textarea { display: block; float: left; margin: 1px 0; } label.newline, textarea, fieldset { clear: both; } -label { width: 130px; height: 1em; padding: 10px 480px 10px 1em; margin-right: -470px; text-align: right; } +label { + width: 140px; /* label area */ + height: 1em; + padding: 10px 460px 10px 1em; + margin-right: -450px; + text-align: right; + } input[type="text"], select { margin: 0.75em 0 0; } input[type="checkbox"], input[type="radio"], input[type="file"] { margin: 1em 0 0; } -#config_form { display: block; background: #DDD; padding: 20px; color: #000; position: relative; } +#config_form { + display: block; + background: #EEE; + padding: 6px 20px 20px; + color: #000; + position: relative; + } + /*#config_text, #config_adv_text { font-family: "Andale mono", monospace; clear: both; }*/ #config_text, #config_adv_text { height: 25em; @@ -32,6 +45,8 @@ input[type="checkbox"], input[type="radio"], input[type="file"] { margin: 1em 0 overflow: auto; background-color: #FFF; color: #000; + font-family: "Fira Mono"; + font-size: small; } input[type="checkbox"], input[type="radio"].enabler { margin-left: 1em; } input:disabled { color: #BBB; } @@ -39,31 +54,35 @@ input:disabled { color: #BBB; } h1, h2, h3, h4, h5, h6 { clear: both; } h2 { margin: 0; padding: 1em 0 0; } -ul.tabs { display: inline; list-style: none; } +ul.tabs { padding: 0; list-style: none; } ul.tabs li { display: inline; } ul.tabs li a, ul.tabs li a.active:hover, ul.tabs li a.active:active { display: block; float: left; - background: #666; + background: #1E4059; color: #CCC; - font-size: 150%; + font-size: 110%; border-radius: 0.25em 0.25em 0 0; margin: 0 4px 0 0; - padding: 2px 4px; + padding: 2px 8px; text-decoration: none; + font-family: georgia,"times new roman",times; } ul.tabs li a.active:link, ul.tabs li a.active:visited { background: #DDD; - color: #900; + color: #06F; cursor: default; + margin-top: -4px; + padding-bottom: 4px; + padding-top: 4px; } ul.tabs li a:hover, ul.tabs li a:active { - background: #777; - color: #DDD; + background: #000; + color: #FFF; } fieldset { display: none; border: 1px solid #AAA; border-radius: 1em; } @@ -117,4 +136,33 @@ fieldset legend { display: none; } bottom: -10px; left: 20px; } -#tooltip>strong { color: #00B; } \ No newline at end of file +#tooltip>strong { color: #00B; } + +span.disclose { + float: right; + margin-top: -10px; + width: 0; + height: 0; + cursor: pointer; + border-left: 8px solid transparent; + border-right: 8px solid transparent; + border-top: 10px solid #000; + } +span.disclose.closed { + margin: -14px 4px 0 0; + border-top: 8px solid transparent; + border-bottom: 8px solid transparent; + border-right: 10px solid #000; + } +span.disclose.almost { + -ms-transform: rotate(45deg); /* IE 9 */ + -webkit-transform: rotate(45deg); /* Chrome, Safari, Opera */ + transform: rotate(45deg); + } +span.disclose.closed.almost { + -ms-transform: rotate(315deg); /* IE 9 */ + -webkit-transform: rotate(315deg); /* Chrome, Safari, Opera */ + transform: rotate(315deg); + } +#tipson { float: right; font-weight: bold; font-size: 100%; font-family: helvetica; } +#tipson input { float: none; display: inline; } diff --git a/Marlin/configurator/index.html b/Marlin/configurator/index.html index 5e8b20517..46f862bf1 100644 --- a/Marlin/configurator/index.html +++ b/Marlin/configurator/index.html @@ -3,6 +3,7 @@ Marlin Configurator + @@ -26,6 +27,8 @@
+
?
+
Machine @@ -64,13 +67,25 @@ - +
-

Marlin/Configuration.h

+
+ Hot Ends +
+ +
+ Heated Bed +
+ +
+ More… +
+ +

Marlin/Configuration.h


-        

Marlin/Configuration_adv.h

+

Marlin/Configuration_adv.h


 
         
diff --git a/Marlin/configurator/js/configurator.js b/Marlin/configurator/js/configurator.js index 126308d21..1675013a0 100644 --- a/Marlin/configurator/js/configurator.js +++ b/Marlin/configurator/js/configurator.js @@ -16,9 +16,9 @@ $(function(){ -var marlin_config = 'config'; +var marlin_config = 'https://api.github.com/repos/MarlinFirmware/Marlin/contents/Marlin'; -// Extend String +// Extend builtins String.prototype.lpad = function(len, chr) { if (chr === undefined) { chr = ' '; } var s = this+'', need = len - s.length; @@ -29,7 +29,13 @@ String.prototype.prePad = function(len, chr) { return len ? this.lpad(len, chr) String.prototype.zeroPad = function(len) { return this.prePad(len, '0'); }; String.prototype.toHTML = function() { return jQuery('
').text(this).html(); }; String.prototype.regEsc = function() { return this.replace(/[.?*+^$[\]\\(){}|-]/g, "\\$&"); } -String.prototype.lineCount = function() { var len = this.split(/\r?\n|\r/).length; return len > 0 ? len - 1 : len; }; +String.prototype.lineCount = function() { var len = this.split(/\r?\n|\r/).length; return len > 0 ? len - 1 : 0; }; +String.prototype.toLabel = function() { return this.replace(/_/g, ' ').toTitleCase(); } +String.prototype.toTitleCase = function() { return this.replace(/([A-Z])(\w+)/gi, function(m,p1,p2) { return p1.toUpperCase() + p2.toLowerCase(); }); } +Number.prototype.limit = function(m1, m2) { + if (m2 == null) return this > m1 ? m1 : this; + return this < m1 ? m1 : this > m2 ? m2 : this; +}; /** * selectField.addOptions takes an array or keyed object @@ -56,9 +62,11 @@ var configuratorApp = (function(){ boards_file = 'boards.h', config_file = 'Configuration.h', config_adv_file = 'Configuration_adv.h', + $form = $('#config_form'), $tooltip = $('#tooltip'), $config = $('#config_text'), $config_adv = $('#config_adv_text'), + define_list = [[],[]], boards_list = {}, therms_list = {}, total_config_lines, @@ -74,32 +82,11 @@ var configuratorApp = (function(){ init: function() { self = this; // a 'this' for use when 'this' is something else - // Set up the form + // Set up the form, creating fields and fieldsets as-needed this.initConfigForm(); - // Make tabs for the fieldsets - var $fset = $('#config_form fieldset'); - var $tabs = $('