1Startshop.Functions.isFunction = function ($oFunction) { 2 return Object.prototype.toString.call($oFunction) === '[object Function]'; 3}; 4 5Startshop.Functions.isArray = function ($oArray) { 6 return Object.prototype.toString.call($oArray) === '[object Array]'; 7}; 8 9Startshop.Functions.isObject = function ($oObject) { 10 return Object.prototype.toString.call($oObject) === '[object Object]'; 11}; 12 13Startshop.Functions.isEqual = function ($oFirstObject, $oSecondObject) { 14 if (Startshop.Functions.isObject($oFirstObject) && Startshop.Functions.isObject($oSecondObject)) { 15 var $arFirstObjectKeys = Object.keys($oFirstObject); 16 var $arSecondObjectKeys = Object.keys($oSecondObject); 17 18 if ($arFirstObjectKeys.length != $arSecondObjectKeys.length ) return false; 19 20 return !$arFirstObjectKeys.filter(function($sKey){ 21 if (Startshop.Functions.isObject($oFirstObject[$sKey]) || Startshop.Functions.isArray($oFirstObject[$sKey])) { 22 return !Startshop.Functions.isEqual($oFirstObject[$sKey], $oSecondObject[$sKey]); 23 } else { 24 return $oFirstObject[$sKey] !== $oSecondObject[$sKey]; 25 } 26 }).length; 27 } 28 29 return false; 30}; 31 32Startshop.Functions.forEach = function ($oObject, $fCallback) { 33 if (Startshop.Functions.isFunction($fCallback)) { 34 if (Startshop.Functions.isArray($oObject)) { 35 var $iArrayIndex = 0; 36 var $iArrayLength = $oObject.length; 37 38 for ($iArrayIndex = 0; $iArrayIndex < $iArrayLength; $iArrayIndex++) { 39 var $oArrayEntry = $oObject[$iArrayIndex]; 40 41 if ($fCallback($iArrayIndex, $oArrayEntry) == false) 42 break; 43 } 44 } else if (Startshop.Functions.isObject($oObject)) { 45 for (var $sObjectIndex in $oObject) { 46 var $oObjectEntry = $oObject[$sObjectIndex]; 47 48 if ($fCallback($sObjectIndex, $oObjectEntry) == false) 49 break; 50 } 51 } 52 } 53}; 54 55Startshop.Functions.inArray = function ($oNeedle, $oHaystack, $bStrict) { 56 var $bFounded = false; $bStrict = !!$bStrict; 57 58 Startshop.Functions.forEach($oHaystack, function($oKey, $oValue) { 59 if (Startshop.Functions.isObject($oNeedle) || Startshop.Functions.isArray($oNeedle)) { 60 if (Startshop.Functions.isEqual($oNeedle, $oValue)) { 61 $bFounded = true; 62 return false; 63 } 64 } else { 65 if ($bStrict) 66 if ($oValue === $oNeedle) { 67 $bFounded = true; 68 return false; 69 } 70 71 if (!$bStrict) 72 if ($oValue == $oNeedle) { 73 $bFounded = true; 74 return false; 75 } 76 } 77 78 }); 79 80 return $bFounded; 81}; 82 83Startshop.Functions.stringReplace = function ($oReplaceable, $sString) { 84 if (!Startshop.Functions.isObject($oReplaceable)) 85 return $sString; 86 87 Startshop.Functions.forEach($oReplaceable, function ($sKey, $sValue) { 88 $sString = $sString.replace(new RegExp(RegExp.escape($sKey),'g'), $sValue); 89 }); 90 91 return $sString; 92}; 93 94Startshop.Functions.numberFormat = function ( number, decimals, dec_point, thousands_sep ) { 95 var i, j, kw, kd, km; 96 97 if( isNaN(decimals = Math.abs(decimals)) ){ 98 decimals = 2; 99 } 100 if( dec_point == undefined ){ 101 dec_point = ","; 102 } 103 if( thousands_sep == undefined ){ 104 thousands_sep = "."; 105 } 106 107 i = parseInt(number = (+number || 0).toFixed(decimals)) + ""; 108 109 if( (j = i.length) > 3 ){ 110 j = j % 3; 111 } else{ 112 j = 0; 113 } 114 115 km = (j ? i.substr(0, j) + thousands_sep : ""); 116 kw = i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + thousands_sep); 117 kd = (decimals ? dec_point + Math.abs(number - i).toFixed(decimals).replace(/-/, 0).slice(2) : ""); 118 119 return km + kw + kd; 120}; 121 122Startshop.Functions.GetElementSize = function ($oElements) { 123 var $oSize = {}; 124 125 $oSize.Width = 0; 126 $oSize.Height = 0; 127 128 if ($oElements[0] !== undefined) 129 if (this.isFunction($oElements[0].getBoundingClientRect)){ 130 var $oRectangle = $oElements[0].getBoundingClientRect(); 131 $oSize.Width = parseFloat($oRectangle.right - $oRectangle.left); 132 $oSize.Height = parseFloat($oRectangle.bottom - $oRectangle.top); 133 } 134 135 if ($oSize.Width == 0 && $oSize.Height == 0) 136 if ($oElements.css('box-sizing') == 'border-box') { 137 $oSize.Width = parseFloat($oElements.outerWidth(false)); 138 $oSize.Height = parseFloat($oElements.outerHeight(false)); 139 } else { 140 $oSize.Width = parseFloat($oElements.width()); 141 $oSize.Height = parseFloat($oElements.height()); 142 } 143 144 return $oSize; 145} 146 147RegExp.escape = function ($sString) { 148 return $sString.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); 149};
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.