app/assets/javascripts/app.js in appjs-rails-1.0.5 vs app/assets/javascripts/app.js in appjs-rails-1.0.6

- old
+ new

@@ -82,23 +82,23 @@ _uuid: function(){ return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4(); }, _bootstrap: { inputDownCounter: function(){ - jInputs = $('[class*="js-input-down-counter-"]'); + var jInputs = $('[class*="js-input-down-counter-"]'); - for(var i=0; i< jInputs.length; i++){ + for(var i = 0; i < jInputs.length; i++){ if (!$(jInputs[i]).hasClass('js-used-input-down-counter')) { var maxNameLength = undefined; $(jInputs[i]).attr('class').split(' ').map(function(item){ if(!item.indexOf('js-input-down-counter-')){ maxNameLength = item.split('-').last(); } }) - jInputGroup = $('<div class="input-group"></div>'); + var jInputGroup = $('<div class="input-group"></div>'); jInputGroup.insertBefore($(jInputs[i])); jInputGroup.append($(jInputs[i])); $('<span class="text-muted input-group-addon add-on" style="background: #fff">0</span>').insertAfter($(jInputs[i])) var usedChar = maxNameLength - parseInt($(jInputs[i]).val().length); @@ -115,25 +115,28 @@ $(jInputs[i]).addClass('js-used-input-down-counter'); } } }, showIcons: function(){ - styles = document.styleSheets; - result = [] - - for (i=0; i< styles.length; i++) { - style = styles[i]; - for(j=0; j< style.cssRules.length; j++) { - if(style.cssRules[j].cssText.match('glyphicon-.*::')) { - result.push(style.cssRules[j].cssText.match("(glyphicon-.*)::.*")[1]) + var styles = document.styleSheets; + var result = [] + for (var i = 0; i < styles.length; i++) { + var style = styles[i]; + if (style.cssRules != null) { + for(var j=0; j < style.cssRules.length; j++) { + if(style.cssRules[j].cssText.match('glyphicon-.*::')) { + result.push(style.cssRules[j].cssText.match("(glyphicon-.*)::.*")[1]) + } } } } for(i=0; i<result.length; i++){ $('#page-wrapper').append("<div class='col-lg-3'><span style='font-size: 30px' class='glyphicon " + result[i] + "'></span> " + result[i] + "</div>") } + }, + icon: function(subname) { + return $("<span class='glyphicon glyphicon-" + subname + "'></span>") } } - } })();