Close section tag, add String.prototype.lineCount

This commit is contained in:
Scott Lahteine 2015-02-07 00:46:14 -08:00
parent 4bb72f9480
commit 12a3975341
2 changed files with 8 additions and 16 deletions

View File

@ -73,6 +73,6 @@
<br class="clear" /> <br class="clear" />
</form> </form>
<section> </section>
</body> </body>
</html> </html>

View File

@ -25,18 +25,10 @@ String.prototype.lpad = function(len, chr) {
if (need > 0) { s = new Array(need+1).join(chr) + s; } if (need > 0) { s = new Array(need+1).join(chr) + s; }
return s; return s;
}; };
String.prototype.prePad = function(len, chr) { return len ? this.lpad(len, chr) : this; };
String.prototype.prePad = function(len, chr) { String.prototype.zeroPad = function(len) { return this.prePad(len, '0'); };
return len ? this.lpad(len, chr) : this; String.prototype.regEsc = function() { return this.replace(/[.?*+^$[\]\\(){}|-]/g, "\\$&"); }
}; String.prototype.lineCount = function() { return this.split(/\r?\n|\r/).length; };
String.prototype.zeroPad = function(len) {
return len ? this.prePad(len, '0') : this;
};
String.prototype.regEsc = function() {
return this.replace(/[.?*+^$[\]\\(){}|-]/g, "\\$&");
}
/** /**
* selectField.addOptions takes an array or keyed object * selectField.addOptions takes an array or keyed object
@ -226,7 +218,7 @@ var configuratorApp = (function(){
case config_file: case config_file:
if (has_boards) { if (has_boards) {
$config.text(txt); $config.text(txt);
total_config_lines = txt.split(/\r?\n|\r/).length; total_config_lines = txt.lineCount();
this.initThermistorsFromText(txt); this.initThermistorsFromText(txt);
this.purgeDefineInfo(false); this.purgeDefineInfo(false);
this.refreshConfigForm(); this.refreshConfigForm();
@ -240,7 +232,7 @@ var configuratorApp = (function(){
case config_adv_file: case config_adv_file:
if (has_config) { if (has_config) {
$config_adv.text(txt); $config_adv.text(txt);
total_config_adv_lines = txt.split(/\r?\n|\r/).length; total_config_adv_lines = txt.lineCount();
this.purgeDefineInfo(true); this.purgeDefineInfo(true);
this.refreshConfigForm(); this.refreshConfigForm();
this.setMessage(config_adv_file+' loaded successfully.'); this.setMessage(config_adv_file+' loaded successfully.');
@ -635,7 +627,7 @@ var configuratorApp = (function(){
*/ */
getLineInText: function(line, txt) { getLineInText: function(line, txt) {
var pos = txt.indexOf(line); var pos = txt.indexOf(line);
return (pos < 0) ? pos : txt.substr(0, pos).replace(/[^\n]+/g, '').length; return (pos < 0) ? pos : txt.substr(0, pos).lineCount();
}, },
log: function(o,l) { log: function(o,l) {