PageSourceSearch

http://oniks.info/local/templates/oniks/assets/js/functions.js

js oniks.info collected 2026-10-08 14:00:10 UTC 2,425 bytes, 61 lines download raw bytes

1function debounce(a,b,c){var d;return function(){var e=this,f=arguments;clearTimeout(d),d=setTimeout(function(){d=null,c||a.apply(e,f)},b),c&&!d&&a.apply(e,f)}}
2function pluralForm(r,a,n,t){return r=Math.abs(r),5<=(r%=100)&&r<=20?t:1==(r%=10)?a:2<=r&&r<=4?n:t}
3Math.roundStep = function(n,s){return ( (n % s) / s >= 0.5 ) ? parseInt(n) - parseInt(n) % s + s :  parseInt(n) - parseInt(n) % s;}
4function number_format(e,n,t,i){e=(e+"").replace(/[^0-9+\-Ee.]/g,"");var r,a,o,d=isFinite(+e)?+e:0,h=isFinite(+n)?Math.abs(n):0,l=void 0===i?",":i,g=void 0===t?".":t,u="";return 3<(u=(h?(r=d,a=h,o=Math.pow(10,a),""+(Math.round(r*o)/o).toFixed(a)):""+Math.round(d)).split("."))[0].length&&(u[0]=u[0].replace(/\B(?=(?:\d{3})+(?!\d))/g,l)),(u[1]||"").length<h&&(u[1]=u[1]||"",u[1]+=new Array(h-u[1].length+1).join("0")),u.join(g)}
5
6$.fn.extend({
7    toggleText: function(a, b){
8        return this.text(this.text() == b ? a : b);
9    }
10});
11
12$.extend({
13    getUrlVars: function () {
14        var vars = [], hash;
15        var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
16        for(var i = 0; i < hashes.length; i++)
17        {
18            hash = hashes[i].split('=');
19            vars.push(hash[0]);
20            vars[hash[0]] = hash[1];
21        }
22        return vars;
23    },
24    getUrlVar: function (name) {
25        return $.getUrlVars()[name];
26    }
27});
28
29var isMobile = {
30    Android: function () {
31        return navigator.userAgent.match(/Android/i);
32    },
33    BlackBerry: function () {
34        return navigator.userAgent.match(/BlackBerry/i);
35    },
36    iOS: function () {
37        return navigator.userAgent.match(/iPhone|iPad|iPod/i);
38    },
39    Opera: function () {
40        return navigator.userAgent.match(/Opera Mini/i);
41    },
42    Windows: function () {
43        return navigator.userAgent.match(/IEMobile/i);
44    },
45    any: function () {
46        return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
47    }
48}
49
50function getCookie(name) {
51    var matches = document.cookie.match(new RegExp(
52        "(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)"
53    ));
54    return matches ? decodeURIComponent(matches[1]) : undefined;
55}
56
57function setCookie(name, time) {
58    let date = new Date(Date.now() + time);
59        date = date.toUTCString();
60    document.cookie = name + "=Y; path=/; expires=" + date;
61}

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.