1jQuery.fn.nextInArray = function (element) { 2 var nextId = 0; 3 for (var i = 0; i < this.length; i++) { 4 if (this[i] == element) { 5 nextId = i + 1; 6 break; 7 } 8 } 9 if (nextId > this.length - 1) nextId = 0; 10 return this[nextId]; 11}; 12jQuery.fn.clearForm = function () { 13 return this.each(function () { 14 var type = this.type, 15 tag = this.tagName.toLowerCase(); 16 if (tag == 'form') return jQuery(':input', this).clearForm(); 17 if (type == 'text' || type == 'password' || tag == 'textarea') this.value = ''; 18 else if (type == 'checkbox' || type == 'radio') this.checked = false; 19 else if (tag == 'select') this.selectedIndex = -1; 20 }); 21}; 22jQuery.fn.tagName = function () { 23 return this.get(0).tagName; 24}; 25jQuery.fn.exists = function () { 26 return jQuery(this).length > 0 ? true : false; 27}; 28function isNumber(val) { 29 return /^\d+/.test(val); 30} 31function pushDataToParam(data, pref) { 32 pref = pref ? pref : ''; 33 var res = []; 34 for (var key in data) { 35 var name = pref && pref != '' ? pref + '[' + key + ']' : key; 36 if (typeof data[key] === 'array' || typeof data[key] === 'object') { 37 res = jQuery.merge(res, pushDataToParam(data[key], name)); 38 } else { 39 res.push(name + '=' + data[key]); 40 } 41 } 42 return res; 43} 44jQuery.fn.serializeAnythingGmp = function (addData) { 45 var toReturn = []; 46 var els = jQuery(this).find(':input').get(); 47 jQuery.each(els, function () { 48 if (this.name && !this.disabled && (this.checked || /select|textarea/i.test(this.nodeName) || /text|hidden|password/i.test(this.type))) { 49 var val = jQuery(this).val(); 50 toReturn.push(encodeURIComponent(this.name) + '=' + encodeURIComponent(val)); 51 } 52 }); 53 if (typeof addData != 'undefined') { 54 toReturn = jQuery.merge(toReturn, pushDataToParam(addData)); 55 } 56 return toReturn.join('&').replace(/%20/g, '+'); 57}; 58jQuery.fn.serializeAssoc = function () { 59 var data = []; 60 jQuery.each(this.serializeArray(), function (key, obj) { 61 var a = obj.name.match(/(.*?)\[(.*?)\]/); 62 if (a !== null) { 63 var subName = a[1]; 64 var subKey = a[2]; 65 if (!data[subName]) data[subName] = []; 66 if (data[subName][subKey]) { 67 if (jQuery.isArray(data[subName][subKey])) { 68 data[subName][subKey].push(obj.value); 69 } else { 70 data[subName][subKey] = []; 71 data[subName][subKey].push(obj.value); 72 } 73 } else { 74 data[subName][subKey] = obj.value; 75 } 76 } else { 77 if (data[obj.name]) { 78 if (jQuery.isArray(data[obj.name])) { 79 data[obj.name].push(obj.value); 80 } else { 81 data[obj.name] = []; 82 data[obj.name].push(obj.value); 83 } 84 } else { 85 data[obj.name] = obj.value; 86 } 87 } 88 }); 89 return data; 90}; 91function str_replace(haystack, needle, replacement) { 92 var temp = haystack.split(needle); 93 return temp.join(replacement); 94} 95/** 96 * @see php html::nameToClassId($name) method 97 **/ 98function nameToClassId(name) { 99 return str_replace(str_replace(name, ']', ''), '[', ''); 100} 101function strpos(haystack, needle, offset) { 102 var i = haystack.indexOf(needle, offset); // returns -1 103 return i >= 0 ? i : false; 104} 105function extend(Child, Parent) { 106 var F = function () {}; 107 F.prototype = Parent.prototype; 108 Child.prototype = new F(); 109 Child.prototype.constructor = Child; 110 Child.superclass = Parent.prototype; 111} 112function toeRedirect(url) { 113 document.location.href = url; 114} 115function toeReload(url) { 116 if (url) toeRedirect(url); 117 document.location.reload(); 118} 119jQuery.fn.toeRebuildSelect = function (data, useIdAsValue, val) { 120 if (jQuery(this).tagName() == 'SELECT' && typeof data == 'object') { 121 if (jQuery(data).length > 0) { 122 if (typeof val == 'undefined') val = false; 123 if (jQuery(this).children('option').length) { 124 jQuery(this).children('option').remove(); 125 } 126 if (typeof useIdAsValue == 'undefined') useIdAsValue = false; 127 var selected = ''; 128 for (var id in data) { 129 selected = ''; 130 if (val && ((useIdAsValue && id == val) || data[id] == val)) selected = 'selected'; 131 jQuery(this).append('<option value="' + (useIdAsValue ? id : data[id]) + '" ' + selected + '>
131' + data[id] + '</option>'); 132 } 133 } 134 } 135}; 136/** 137 * We will not use just jQUery.inArray because it is work incorrect for objects 138 * @return mixed - key that was found element or -1 if not 139 */ 140function toeInArray(needle, haystack) { 141 if (typeof haystack == 'object') { 142 for (var k in haystack) { 143 if (haystack[k] == needle) return k; 144 } 145 } else if (typeof haystack == 'array') { 146 return jQuery.inArray(needle, haystack); 147 } 148 return -1; 149} 150jQuery.fn.setReadonly = function () { 151 jQuery(this).addClass('toeReadonly').attr('readonly', 'readonly'); 152}; 153jQuery.fn.unsetReadonly = function () { 154 jQuery(this).removeClass('toeReadonly').removeAttr('readonly', 'readonly'); 155}; 156jQuery.fn.getClassId = function (pref, test) { 157 var classId = jQuery(this).attr('class'); 158 classId = classId.substr(strpos(classId, pref + '_')); 159 if (strpos(classId, ' ')) classId = classId.substr(0, strpos(classId, ' ')); 160 classId = classId.split('_'); 161 classId = classId[1]; 162 return classId; 163}; 164function toeTextIncDec(textFieldId, inc) { 165 var value = parseInt(jQuery('#' + textFieldId).val()); 166 if (isNaN(value)) value = 0; 167 if (!(inc < 0 && value < 1)) { 168 value += inc; 169 } 170 jQuery('#' + textFieldId).val(value); 171} 172 173/** 174 * Make first letter of string in upper case 175 * @param str string - string to convert 176 * @return string converted string - first letter in upper case 177 */ 178function toeStrFirstUp(str) { 179 str += ''; 180 var f = str.charAt(0).toUpperCase(); 181 return f + str.substr(1); 182} 183function URLToArray(url) { 184 var request = {}; 185 186 if (typeof url != 'string') { 187 url = url[0]; 188 } 189 190 var pairs = url.substring(url.indexOf('?') + 1).split('&'); 191 for (var i = 0; i < pairs.length; i++) { 192 if (!pairs[i]) continue; 193 var pair = pairs[i].split('='); 194 request[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]); 195 } 196 return request; 197} 198function ArrayToURL(array) { 199 var pairs = []; 200 for (var key in array) if (array.hasOwnProperty(key)) pairs.push(encodeURIComponent(key) + '=' + encodeURIComponent(array[key])); 201 return pairs.join('&'); 202} 203function parseStr(str, array) { 204 // http://kevin.vanzonneveld.net 205 // + original by: Cagri Ekin 206 // + improved by: Michael White (http://getsprink.com) 207 // + tweaked by: Jack 208 // + bugfixed by: Onno Marsman 209 // + reimplemented by: stag019 210 // + bugfixed by: Brett Zamir (http://brett-zamir.me) 211 // + bugfixed by: stag019 212 // + input by: Dreamer 213 // + bugfixed by: Brett Zamir (http://brett-zamir.me) 214 // + bugfixed by: MIO_KODUKI (http://mio-koduki.blogspot.com/) 215 // + input by: Zaide (http://zaidesthings.com/) 216 // + input by: David Pesta (http://davidpesta.com/) 217 // + input by: jeicquest 218 // + improved by: Brett Zamir (http://brett-zamir.me) 219 // % note 1: When no argument is specified, will put variables in global scope. 220 // % note 1: When a particular argument has been passed, and the returned value is different parse_str of PHP. For example, a=b=c&d====c 221 // * example 1: var arr = {}; 222 // * example 1: parse_str('first=foo&second=bar', arr); 223 // * results 1: arr == { first: 'foo', second: 'bar' } 224 // * example 2: var arr = {}; 225 // * example 2: parse_str('str_a=Jack+and+Jill+didn%27t+see+the+well.', arr); 226 // * results 2: arr == { str_a: "Jack and Jill didn't see the well." } 227 // * example 3: var abc = {3:'a'}; 228 // * example 3: parse_str('abc[a][b]["c"]=def&abc[q]=t+5'); 229 // * results 3: JSON.stringify(abc) === '{"3":"a","a":{"b":{"c":"def"}},"q":"t 5"}'; 230 var strArr = String(str).replace(/^&/, '').replace(/&$/, '').split('&'), 231 sal = strArr.length, 232 i, 233 j, 234 ct, 235 p, 236 lastObj, 237 obj, 238 lastIter, 239 undef, 240 chr, 241 tmp, 242 key, 243 value, 244 postLeftBracketPos, 245 keys, 246 keysLen, 247 fixStr = function (str) { 248 return decodeURIComponent(str.replace(/\+/g, '%20')); 249 }; 250 // Comented by Alexey Bolotov 251 /* 252 if (!array) { 253 array = this.window; 254 }*/ 255 if (!array) { 256 array = {}; 257 } 258 259 for (i = 0; i < sal; i++) { 260 tmp = strArr[i].split('='); 261 key = fixStr(tmp[0]); 262 value = tmp.length < 2 ? '' : fixStr(tmp[1]); 263 264 while (key.charAt(0) === ' ') { 265 key = key.slice(1); 266 } 267 if (key.indexOf('\x00') > -1) { 268 key = key.slice(0, key.indexOf('\x00')); 269 } 270 if (key && key.charAt(0) !== '[') { 271 keys = []; 272 postLeftBracketPos = 0; 273 for (j = 0; j < key.length; j++) { 274 if (key.charAt(j) === '[' && !postLeftBracketPos) { 275 postLeftBracketPos = j + 1; 276 } else if (key.charAt(j) === ']') { 277 if (postLeftBracketPos) { 278 if (!keys.length) { 279 keys.push(key.slice(0, postLeftBracketPos - 1)); 280 } 281 keys.push(key.substr(postLeftBracketPos, j - postLeftBracketPos)); 282 postLeftBracketPos = 0; 283 if (key.charAt(j + 1) !== '[') { 284 break; 285 } 286 } 287 } 288 } 289 if (!keys.length) { 290 keys = [key]; 291 } 292 for (j = 0; j < keys[0].length; j++) {
293 chr = keys[0].charAt(j); 294 if (chr === ' ' || chr === '.' || chr === '[') { 295 keys[0] = keys[0].substr(0, j) + '_' + keys[0].substr(j + 1); 296 } 297 if (chr === '[') { 298 break; 299 } 300 } 301 302 obj = array; 303 for (j = 0, keysLen = keys.length; j < keysLen; j++) { 304 key = keys[j].replace(/^['"]/, '').replace(/['"]$/, ''); 305 lastIter = j !== keys.length - 1; 306 lastObj = obj; 307 if ((key !== '' && key !== ' ') || j === 0) { 308 if (obj[key] === undef) { 309 obj[key] = {}; 310 } 311 obj = obj[key]; 312 } else { 313 // To insert new dimension 314 ct = -1; 315 for (p in obj) { 316 if (obj.hasOwnProperty(p)) { 317 if (+p > ct && p.match(/^\d+$/g)) { 318 ct = +p; 319 } 320 } 321 } 322 key = ct + 1; 323 } 324 } 325 lastObj[key] = value; 326 } 327 } 328 return array; 329} 330 331function toeListableGmp(params) { 332 this.params = jQuery.extend({}, params); 333 this.table = jQuery(this.params.table); 334 this.paging = jQuery(this.params.paging); 335 this.perPage = this.params.perPage; 336 this.list = this.params.list; 337 this.count = this.params.count; 338 this.page = this.params.page; 339 this.pagingCallback = this.params.pagingCallback; 340 var self = this; 341 342 this.draw = function (list, count) { 343 this.table.find('tr').not('.gmpExample, .gmpTblHeader').remove(); 344 var exampleRow = this.table.find('.gmpExample'); 345 for (var i in list) { 346 var newRow = exampleRow.clone(); 347 for (var key in list[i]) { 348 var element = newRow.find('.' + key); 349 if (element.length) { 350 var valueTo = element.attr('valueTo'); 351 if (valueTo) { 352 var newValue = list[i][key]; 353 var prevValue = element.attr(valueTo); 354 if (prevValue) newValue = prevValue + ' ' + newValue; 355 element.attr(valueTo, newValue); 356 } else element.html(list[i][key]); 357 } 358 } 359 newRow.removeClass('gmpExample').show(); 360 this.table.append(newRow); 361 } 362 if (this.paging) { 363 this.paging.html(''); 364 if (count && count > list.length && this.perPage) { 365 for (var i = 1; i <= Math.ceil(count / this.perPage); i++) { 366 var newPageId = i - 1, 367 newElement = newPageId == this.page ? jQuery('<b/>') : jQuery('<a/>'); 368 if (newPageId != this.page) { 369 newElement.attr('href', '#' + newPageId).click(function () { 370 if (self.pagingCallback && typeof self.pagingCallback == 'function') { 371 self.pagingCallback(parseInt(jQuery(this).attr('href').replace('#', ''))); 372 return false; 373 } 374 }); 375 } 376 newElement.addClass('toePagingElement').html(i); 377 this.paging.append(newElement); 378 if (i % 20 == 0 && i) this.paging.append('<br />'); 379 } 380 } 381 } 382 }; 383 if (this.list) this.draw(this.list, this.count); 384} 385 386function setCookieGmp(c_name, value, exdays) { 387 var exdate = new Date(); 388 exdate.setDate(exdate.getDate() + exdays); 389 var value_prepared = ''; 390 if (typeof value == 'array' || typeof value == 'object') { 391 value_prepared = '_JSON:' + JSON.stringify(value); 392 } else { 393 value_prepared = value; 394 } 395 var c_value = escape(value_prepared) + (exdays == null ? '' : '; expires=' + exdate.toUTCString()) + '; path=/'; 396 document.cookie = c_name + '=' + c_value; 397} 398 399function getCookieGmp(name) { 400 var parts = document.cookie.split(name + '='); 401 if (parts.length == 2) { 402 var value = unescape(parts.pop().split(';').shift()); 403 if (value.indexOf('_JSON:') === 0) { 404 value = JSON.parse(value.split('_JSON:').pop()); 405 } 406 return value; 407 } 408 return null; 409} 410 411function delCookieGmp(name) { 412 document.cookie = name + '=; expires=Thu, 01 Jan 1970 00:00:01 GMT;'; 413} 414 415function callUserFuncArray(cb, parameters) { 416 // http://kevin.vanzonneveld.net 417 // + original by: Thiago Mata (http://thiagomata.blog.com) 418 // + revised by: Jon Hohle 419 // + improved by: Brett Zamir (http://brett-zamir.me) 420 // + improved by: Diplom@t (http://difane.com/) 421 // + improved by: Brett Zamir (http://brett-zamir.me) 422 // * example 1: call_user_func_array('isNaN', ['a']); 423 // * returns 1: true 424 // * example 2: call_user_func_array('isNaN', [1]); 425 // * returns 2: false 426 var func; 427 428 if (typeof cb === 'string') { 429 func = typeof this[cb] === 'function' ? this[cb] : (func = new Function(null, 'return ' + cb)()); 430 } else if (Object.prototype.toString.call(cb) === '[object Array]') { 431 func = typeof cb[0] == 'string' ? eval(cb[0] + "['" + cb[1] + "']") : (func = cb[0][cb[1]]); 432 } else if (typeof cb === 'function') { 433 func = cb; 434 } 435 436 if (typeof func !== 'function') { 437 throw new Error(func + ' is not a valid function'); 438 } 439 440 return typeof cb[0] === 'string' ? func.apply(eval(cb[0]), parameters) : typeof cb[0] !== 'object' ? func.apply(null, parameters) : func.apply(cb[0], parameters); 441} 442jQuery.fn.zoom = function (level) { 443 jQuery(this).data('zoom', level); 444 return jQuery(this).css({ 445 /* 'zoom': level // Didn't worked correctly for mobiles 446 ,*/ '-moz-transform': 'scale(' + level + ')', 447 '-moz-transform-origin': 'center center', 448 '-o-transform': 'scale(' + level + ')', 449 '-o-transform-origin': 'center center', 450 '-webkit-transform': 'scale(' + level + ')', 451 '-webkit-transform-origin': 'center center', 452 transform: 'scale(' + level + ')', 453 'transform-origin': 'center center', 454 }); 455}; 456jQuery.fn.rotate = function (deg) { 457 return jQuery(this).css({ 458 '-moz-transform': 'rotate(' + deg + 'deg)', 459 '-webkit-transform': 'rotate(' + deg + 'deg)', 460 '-o-transform': 'rotate(' + deg + 'deg)', 461 '-ms-transform': 'rotate(' + deg + 'deg)', 462 transform: 'rotate(' + deg + 'deg)', 463 }); 464}; 465jQuery.fn.scrollWidth = function () { 466 var inner = document.createElement('p'); 467 inner.style.width = '100%'; 468 inner.style.height = '200px'; 469 470 var outer = document.createElement('div'); 471 outer.style.position = 'absolute'; 472 outer.style.top = '0px'; 473 outer.style.left = '0px'; 474 outer.style.visibility = 'hidden'; 475 outer.style.width = '200px'; 476 outer.style.height = '150px'; 477 outer.style.overflow = 'hidden'; 478 outer.appendChild(inner); 479 480 document.body.appendChild(outer); 481 var w1 = inner.offsetWidth; 482 outer.style.overflow = 'scroll'; 483 var w2 = inner.offsetWidth; 484 if (w1 == w2) w2 = outer.clientWidth; 485 486 document.body.removeChild(outer); 487 488 return w1 - w2; 489}; 490/** 491 * Retrive worgmpess attach ID from image, using img classes 492 * @param {htmlObj} img Image to get ID from 493 */ 494function toeGetImgAttachId(img) { 495 var classesStr = jQuery(img).attr('class'), 496 aid = 0; 497 if (classesStr && classesStr != '') { 498 var matches = classesStr.match(/wp-image-(\d+)/); 499 if (matches && matches[1]) { 500 aid = parseInt(matches[1]); 501 } 502 } 503 return aid;
504} 505function toeGetHashParams() { 506 var hashArr = window.location.hash.split('#'), 507 res = []; 508 for (var i in hashArr) { 509 if (hashArr[i] && hashArr[i] != '') { 510 res.push(hashArr[i]); 511 } 512 } 513 return res; 514} 515/*Replace text in DOM functions*/ 516// Reusable generic function 517function traverseElement(el, regex, textReplacerFunc, to) { 518 // script and style elements are left alone 519 if (!/^(script|style)$/.test(el.tagName)) { 520 var child = el.lastChild; 521 while (child) { 522 if (child.nodeType == 1) { 523 traverseElement(child, regex, textReplacerFunc, to); 524 } else if (child.nodeType == 3) { 525 textReplacerFunc(child, regex, to); 526 } 527 child = child.previousSibling; 528 } 529 } 530} 531 532// This function does the replacing for every matched piece of text 533// and can be customized to do what you like 534function textReplacerFunc(textNode, regex, to) { 535 textNode.data = textNode.data.replace(regex, to); 536} 537 538// The main function 539function replaceWords(html, words) { 540 var container = document.createElement('div'); 541 container.innerHTML = html; 542 543 // Replace the words one at a time to ensure each one gets matched 544 for (var replace in words) { 545 traverseElement(container, new RegExp(replace, 'g'), textReplacerFunc, words[replace]); 546 } 547 return container.innerHTML; 548} 549/*****/ 550function toeSelectText(element) { 551 var doc = document, 552 text = jQuery(element).get(0), 553 range, 554 selection; 555 if (doc.body.createTextRange) { 556 //ms 557 range = doc.body.createTextRange(); 558 range.moveToElementText(text); 559 range.select(); 560 } else if (window.getSelection) { 561 //all others 562 selection = window.getSelection(); 563 range = doc.createRange(); 564 range.selectNodeContents(text); 565 selection.removeAllRanges(); 566 selection.addRange(range); 567 } 568} 569jQuery.fn.animationDuration = function (seconds, isMili) { 570 if (isMili) { 571 seconds = parseFloat(seconds) / 1000; 572 } 573 var secondsStr = seconds + 's'; 574 return jQuery(this).css({ 575 'webkit-animation-duration': secondsStr, 576 '-moz-animation-duration': secondsStr, 577 '-o-animation-duration': secondsStr, 578 'animation-duration': secondsStr, 579 }); 580}; 581/** 582 * Convert Date string (in common - mm/dd/yyyy) - to miliseconds 583 * @param {string} strDate date string 584 * @return {int} miliseconds 585 */ 586function gmpStrToMs(strDate) { 587 var dateHours = strDate.split(' '); 588 if (dateHours.length == 2) { 589 strDate = dateHours[0] + ' '; 590 var hms = dateHours[1].split(':'); 591 592 for (var i = 0; i < 3; i++) { 593 strDate += hms[i] ? hms[i] : '00'; 594 if (i < 2) strDate += ':'; 595 } 596 } 597 var date = new Date(str_replace(strDate, '-', '/')), 598 res = 0; 599 if (date) { 600 res = date.getTime(); 601 } 602 return res; 603} 604function twoArraysContainSameValue(arr1, arr2) { 605 return arr2.some(function (v) { 606 return arr1.indexOf(v) >= 0; 607 }); 608} 609// Simulates PHP's date function 610Date.prototype.format = function (e) { 611 var t = ''; 612 var n = Date.replaceChars; 613 for (var r = 0; r < e.length; r++) { 614 var i = e.charAt(r); 615 if (r - 1 >= 0 && e.charAt(r - 1) == '\\') { 616 t += i; 617 } else if (n[i]) { 618 t += n[i].call(this); 619 } else if (i != '\\') { 620 t += i; 621 } 622 } 623 return t; 624}; 625Date.replaceChars = { 626 shortMonths: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], 627 longMonths: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], 628 shortDays: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], 629 longDays: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], 630 d: function () { 631 return (this.getDate() < 10 ? '0' : '') + this.getDate(); 632 }, 633 D: function () { 634 return Date.replaceChars.shortDays[this.getDay()]; 635 }, 636 j: function () { 637 return this.getDate(); 638 }, 639 l: function () { 640 return Date.replaceChars.longDays[this.getDay()]; 641 }, 642 N: function () { 643 return this.getDay() + 1; 644 }, 645 S: function () { 646 return this.getDate() % 10 == 1 && this.getDate() != 11 ? 'st' : this.getDate() % 10 == 2 && this.getDate() != 12 ? 'nd' : this.getDate() % 10 == 3 && this.getDate() != 13 ? 'rd' : 'th'; 647 }, 648 w: function () { 649 return this.getDay(); 650 }, 651 z: function () { 652 var e = new Date(this.getFullYear(), 0, 1); 653 return Math.ceil((this - e) / 864e5); 654 }, 655 W: function () { 656 var e = new Date(this.getFullYear(), 0, 1); 657 return Math.ceil(((this - e) / 864e5 + e.getDay() + 1) / 7); 658 }, 659 F: function () { 660 return Date.replaceChars.longMonths[this.getMonth()];
661 }, 662 m: function () { 663 return (this.getMonth() < 9 ? '0' : '') + (this.getMonth() + 1); 664 }, 665 M: function () { 666 return Date.replaceChars.shortMonths[this.getMonth()]; 667 }, 668 n: function () { 669 return this.getMonth() + 1; 670 }, 671 t: function () { 672 var e = new Date(); 673 return new Date(e.getFullYear(), e.getMonth(), 0).getDate(); 674 }, 675 L: function () { 676 var e = this.getFullYear(); 677 return e % 400 == 0 || (e % 100 != 0 && e % 4 == 0); 678 }, 679 o: function () { 680 var e = new Date(this.valueOf()); 681 e.setDate(e.getDate() - ((this.getDay() + 6) % 7) + 3); 682 return e.getFullYear(); 683 }, 684 Y: function () { 685 return this.getFullYear(); 686 }, 687 y: function () { 688 return ('' + this.getFullYear()).substr(2); 689 }, 690 a: function () { 691 return this.getHours() < 12 ? 'am' : 'pm'; 692 }, 693 A: function () { 694 return this.getHours() < 12 ? 'AM' : 'PM'; 695 }, 696 B: function () { 697 return Math.floor(((((this.getUTCHours() + 1) % 24) + this.getUTCMinutes() / 60 + this.getUTCSeconds() / 3600) * 1e3) / 24); 698 }, 699 g: function () { 700 return this.getHours() % 12 || 12; 701 }, 702 G: function () { 703 return this.getHours(); 704 }, 705 h: function () { 706 return ((this.getHours() % 12 || 12) < 10 ? '0' : '') + (this.getHours() % 12 || 12); 707 }, 708 H: function () { 709 return (this.getHours() < 10 ? '0' : '') + this.getHours(); 710 }, 711 i: function () { 712 return (this.getMinutes() < 10 ? '0' : '') + this.getMinutes(); 713 }, 714 s: function () { 715 return (this.getSeconds() < 10 ? '0' : '') + this.getSeconds(); 716 }, 717 u: function () { 718 var e = this.getMilliseconds(); 719 return (e < 10 ? '00' : e < 100 ? '0' : '') + e; 720 }, 721 e: function () { 722 return 'Not Yet Supported'; 723 }, 724 I: function () { 725 var e = null; 726 for (var t = 0; t < 12; ++t) { 727 var n = new Date(this.getFullYear(), t, 1); 728 var r = n.getTimezoneOffset(); 729 if (e === null) e = r; 730 else if (r < e) { 731 e = r; 732 break; 733 } else if (r > e) break; 734 } 735 return (this.getTimezoneOffset() == e) | 0; 736 }, 737 O: function () { 738 return (-this.getTimezoneOffset() < 0 ? '-' : '+') + (Math.abs(this.getTimezoneOffset() / 60) < 10 ? '0' : '') + Math.abs(this.getTimezoneOffset() / 60) + '00'; 739 }, 740 P: function () { 741 return (-this.getTimezoneOffset() < 0 ? '-' : '+') + (Math.abs(this.getTimezoneOffset() / 60) < 10 ? '0' : '') + Math.abs(this.getTimezoneOffset() / 60) + ':00'; 742 }, 743 T: function () { 744 var e = this.getMonth(); 745 this.setMonth(0); 746 var t = this.toTimeString().replace(/^.+ \(?([^\)]+)\)?$/, '$1'); 747 this.setMonth(e); 748 return t; 749 }, 750 Z: function () { 751 return -this.getTimezoneOffset() * 60; 752 }, 753 c: function () { 754 return this.format('Y-m-d\\TH:i:sP'); 755 }, 756 r: function () { 757 return this.toString(); 758 }, 759 U: function () { 760 return this.getTime() / 1e3; 761 }, 762};
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.