1 2 //SET STYLE IN JS 3var UID = { 4 _current: 0, 5 getNew: function(){ 6 this._current++; 7 return this._current; 8 } 9}; 10 11HTMLElement.prototype.pseudoStyle = function(element,prop,value){ 12 13 var _this = this; 14 var _sheetId = "pseudoStyles"; 15 var _head = document.head || document.getElementsByTagName('head')[0]; 16 var _sheet = document.getElementById(_sheetId) || document.createElement('style'); 17 _sheet.id = _sheetId; 18 var className = "pseudoStyle" + UID.getNew(); 19 20 _this.className += " "+className; 21 22 _sheet.innerHTML += " ."+className+":"+element+"{"+prop+":"+value+"}"; 23 _head.appendChild(_sheet); 24 return this; 25}; 26 27//SUM OF ARRAY BJECT PROPERTY 28Array.prototype.sum = function (prop) { 29 var total = 0 30 for ( var i = 0, _len = this.length; i < _len; i++ ) { 31 total += parseInt(this[i][prop]) 32 } 33 return total 34}; 35 36//OBJECT FOREACH 37Object.defineProperty(Object.prototype, 'forEach', { 38 value: function (callback) { 39 40 for(key in this) { 41 42 if(this.hasOwnProperty(key)) { 43 callback(this[key], key, this); 44 } 45 } 46 } 47});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.