1function isNumeric(val) { 2 return ret = parseInt(val); 3} 4function isInt(value) { 5 var x; 6 return isNaN(value) ? !1 : (x = parseFloat(value), (0 | x) === x); 7} 8 9Number.isInteger = Number.isInteger || function(value) { 10 return typeof value === "number" && 11 isFinite(value) && 12 Math.floor(value) === value; 13}; 14 15function equalHeight(group) { 16 tallest = 0; 17 group.each(function() { 18 thisHeight = $(this).height(); 19 if(thisHeight > tallest) { 20 tallest = thisHeight; 21 } 22 }); 23 group.height(tallest); 24} 25 26function dateDiff(date1, date2) { 27 date1 = date1.split("."); 28 date1 = date1[1]+'/'+date1[0]+'/'+date1[2]; 29 30 date2 = date2.split("."); 31 date2 = date2[1]+'/'+date2[0]+'/'+date2[2]; 32 33 date2 = date2.replace(".", "/"); 34 date2 = date2.replace(".", "/"); 35 36 var dtFrom = date1; 37 var dtTo = date2; 38 39 var dt1 = new Date(dtFrom); 40 var dt2 = new Date(dtTo); 41 var diff = dt2.getTime() - dt1.getTime(); 42 var days = diff / (1000 * 60 * 60 * 24); 43 44 //console.log("diff", diff, days, Math.round(days), Math.abs(Math.round(days))); 45 46 return Math.round(days); 47} 48 49Date.prototype.addDays = function(days) { 50 this.setDate(this.getDate() + days); 51 return this; 52 }; 53function projectedDate(date, days) { 54 var currentDate = date; 55 currentDate = currentDate.split("."); 56 currentDate = currentDate[1]+'/'+currentDate[0]+'/'+currentDate[2]; 57 currentDate = new Date(currentDate); 58 59 var projectateDate = currentDate.addDays(days); 60 res = ('0' + projectateDate.getDate()).slice(-2)+'.'+('0' + (projectateDate.getMonth() + 1)).slice(-2) +'.'+projectateDate.getFullYear(); 61 return res; 62} 63 64function addDays(theDate, days) { 65 return new Date(theDate.getTime() + days*24*60*60*1000); 66} 67 68function dump(arr, level) { 69 var dumped_text = ""; 70 if(!level) level = 0; 71 72 //The padding given at the beginning of the line. 73 var level_padding = ""; 74 for(var j=0; j<level+1; j++) level_padding += " "; 75 76 if(typeof(arr) == 'object') { //Array/Hashes/Objects 77 78 for(var item in arr) { 79 var value = arr[item]; 80 81 if(typeof(value) == 'object') { //If it is an array, 82 dumped_text += level_padding + "\"" + item + "\" => array(\n"; 83 dumped_text += dump(value, level+1); 84 dumped_text +=')'+"\n"; 85 } else { 86 dumped_text += level_padding + "'" + item + "' => \"" + value + "\", \n"; 87 88 } 89 } 90 //if (level == 0) { 91 //dumped_text = dumped_text.substring(0, dumped_text.length - 5); 92 //} 93 } else { //Stings/Chars/Numbers etc. 94 dumped_text = "===>"+arr+"<===("+typeof(arr)+")"; 95 } 96 97 return dumped_text; 98} 99 100 101function isEmpty(val) { 102 try { 103 return ((typeof val === "undefined") || (val === "undefined") || (val === null) || (val == null) || (val === "") || (val == "")) ? true : false; 104 } 105 catch (e) { 106 return false; 107 } 108} 109 110 111function changeTimeAgo(time) { 112 let echoTime = null; 113 const timeNow = Date.now() / 1000; 114 const timeSql = new Date(time).getTime() / 1000; 115 116 const deSec = ['ÑекÑнда', 'ÑекÑндÑ', 'ÑекÑнд']; 117 const deMinute = ['минÑÑа', 'минÑÑÑ', 'минÑÑ']; 118 const deHour = ['ÑаÑ', 'ÑаÑа', 'ÑаÑов']; 119 const deDay = ['денÑ', 'днÑ', 'дней']; 120 const deWeek = ['неделÑ', 'недели', 'неделÑ']; 121 const deMonth = ['меÑÑÑ', 'меÑÑÑа', 'меÑÑÑев']; 122 const deYear = ['год', 'года', 'леÑ']; 123 124 const sec = Math.floor(timeNow - timeSql); 125 const minute = Math.floor(sec / 60); 126 const hour = Math.floor(sec / 60 / 60); 127 const day = Math.floor(sec / 60 / 60 / 24); 128 const week = Math.floor(sec / 60 / 60 / 24 / 7);
129 const month = Math.floor(sec / 60 / 60 / 24 / 7 / 4); 130 const year = Math.floor(sec / 60 / 60 / 24 / 7 / 4 / 12); 131 132 if (sec == 0) { 133 echoTime = "ТолÑко ÑÑо"; 134 } 135 if (sec < 60 && sec > 0) { 136 echoTime = sec + ' ' + declensionWord(sec, deSec) + ' назад'; 137 } 138 if (sec >= 60) { 139 echoTime = minute + ' ' + declensionWord(minute, deMinute) + ' назад'; 140 } 141 if (minute >= 60) { 142 echoTime = hour + ' ' + declensionWord(hour, deHour) + ' назад'; 143 } 144 if (hour >= 24) { 145 echoTime = day + ' ' + declensionWord(day, deDay) + ' назад'; 146 } 147 if (day >= 7) { 148 echoTime = week + ' ' + declensionWord(week, deWeek) + ' назад'; 149 } 150 if (week >= 4) { 151 echoTime = month + ' ' + declensionWord(month, deMonth) + ' назад'; 152 } 153 if (month >= 12) { 154 echoTime = year + ' ' + declensionWord(year, deYear) + ' назад'; 155 } 156 157 return echoTime; 158} 159 160function declensionWord(number, suffix) { 161 const keys = [2, 0, 1, 1, 1, 2]; 162 const mod = number % 100; 163 const suffixKey = (mod > 7 && mod < 20) ? 2 : keys[Math.min(mod % 10, 5)]; 164 return suffix[suffixKey]; 165} 166 167 function isset(variable) { 168 try { 169 return (typeof variable !== "undefined") && (variable !== null) && (variable !== "") 170 } 171 catch (e) { 172 console.log("catch isset", e); 173 return false; 174 } 175}
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.