PageSourceSearch

https://www.technocnc.com/wp-content/plugins/yoo-slider/js/gks-helper.js?ver=7.1.2

js technocnc.com collected 2026-10-04 12:21:35 UTC 7,467 bytes, 295 lines download raw bytes

1var _GKS_LAST_GENERATED_ID = 100000;
2function gks_generateId(){
3    return "tmsid_" + (++_GKS_LAST_GENERATED_ID).toString();
4}
5
6var gksUids = [];
7function gks_generateUniqueId() {
8    var uid = new Date().valueOf() + Math.floor(Math.random() * 11);
9    if (jQuery.inArray(uid, gksUids) != -1) {
10        return gks_generateUniqueId();
11    }
12    gksUids.push(uid);
13    return uid;
14}
15
16function gks_showSpinner(message="Loading...") {
17  jQuery("#gks-spinner").css('display', 'block');
18  jQuery("#gks-spinner-message").css('display', 'block');
19  jQuery("#gks-spinner-message").html(message);
20  jQuery("#gks-spinner-background").css('display', 'block');
21}
22
23function gks_hideSpinner() {
24    setTimeout(function(){
25        jQuery("#gks-spinner").css('display', 'none');
26        jQuery("#gks-spinner-message").css('display', 'none');
27        jQuery("#gks-spinner-background").css('display', 'none');
28    }, 1000);
29}
30
31function gks_openMediaUploader( callback, multipleSelection, notSelectedCallback, type ) {
32	'use strict';
33
34    multipleSelection = typeof multipleSelection !== 'undefined' ? multipleSelection : false;
35    var uploader, imgData, json;
36
37	if ( undefined !== uploader ) {
38		uploader.open();
39		return;
40	}
41
42	var params = {
43        frame:    'post',
44        state:    'insert',
45        multiple: multipleSelection
46    };
47	if (typeof type == 'undefined') {
48       type = 'image';
49    }
50    params.library = {
51        type: [ type ]
52    };
53	uploader = wp.media.frames.file_frame = wp.media(params);
54
55    if (typeof notSelectedCallback != 'undefined') {
56        uploader.on('close', function () {
57            var selection = uploader.state('insert').get('selection');
58            if (!selection.length) {
59                notSelectedCallback();
60            }
61        });
62    }
63
64	uploader.on( 'insert', function() {
65        var selections = uploader.state().get( 'selection').toJSON();
66        var picInfos = [];
67
68        for(var sIdx = 0; sIdx < selections.length; sIdx++){
69            var json = selections[sIdx];
70            if ( 0 > jQuery.trim( json.url.length ) ) {
71                continue;
72            }
73
74            var picInfo = {};
75            picInfo.id = json.id;
76            if (json.type == 'image') {
77                picInfo.src = json.sizes.full.url;
78
79                if (json.sizes.medium) {
80                    picInfo.src = json.sizes.full.url;
81                }
82            } else if(json.type == 'video') {
83                picInfo.src = json.url;
84                picInfo.thumb = gksPluginUrl + '/images/general/video_default.jpg';
85                // if (json.thumb.src) {
86                //     picInfo.thumb = json.thumb.src;
87                // } else {
88                //     picInfo.thumb = json.icon;
89                // }
90            }
91            picInfos.push(picInfo);
92        }
93
94        if(multipleSelection){
95            callback(picInfos);
96        }else{
97            callback(picInfos.length > 0 ? picInfos[0] : null);
98        }
99	});
100	uploader.open();
101}
102
103function gks_isJSArray(obj){
104    return (Object.prototype.toString.call( obj ) === '[object Array]')
105}
106
107function gks_truncateIfNeeded(text, maxLength){
108    if(text){
109        if(text.length > 3 && text.length > maxLength - 3){
110            text = text.substring(0,maxLength - 3);
111            text += "..."
112        }
113    }
114    return text;
115}
116
117function gks_loadHref(href, blank){
118    if(!blank){
119        window.location.href = href;
120    }else{
121        window.open(href, '_blank');
122    }
123}
124
125function gks_mgfCloseButtonMarkup(){
126
127    var html = "";
128    html += "<button class='mfp-close'>";
129    html +=     "x"; //"<img class='mfp-close-img'/>";
130    html += "</button>"
131
132    return html;
133}
134
135
136var GksBase64 = {
137
138// private property
139_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
140
141// public method for encoding
142encode : function (input) {
143    var output = "";
144    var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
145    var i = 0;
146
147    if(!input) return output;
148    input = GksBase64._utf8_encode(input);
149
150    while (i < input.length) {
151
152        chr1 = input.charCodeAt(i++);
153        chr2 = input.charCodeAt(i++);
154        chr3 = input.charCodeAt(i++);
155
156        enc1 = chr1 >> 2;
157        enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
158        enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
159        enc4 = chr3 & 63;
160
161        if (isNaN(chr2)) {
162            enc3 = enc4 = 64;
163        } else if (isNaN(chr3)) {
164            enc4 = 64;
165        }
166
167        output = output +
168        this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
169        this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
170
171    }
172
173    return output;
174},
175
176// public method for decoding
177decode : function (input) {
178    var output = "";
179    var chr1, chr2, chr3;
180    var enc1, enc2, enc3, enc4;
181    var i = 0;
182
183    if(!input) return output;
184    input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
185
186    while (i < input.length) {
187
188        enc1 = this._keyStr.indexOf(input.charAt(i++));
189        enc2 = this._keyStr.indexOf(input.charAt(i++));
190        enc3 = this._keyStr.indexOf(input.charAt(i++));
191        enc4 = this._keyStr.indexOf(input.charAt(i++));
192
193        chr1 = (enc1 << 2) | (enc2 >> 4);
194        chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
195        chr3 = ((enc3 & 3) << 6) | enc4;
196
197        output = output + String.fromCharCode(chr1);
198
199        if (enc3 != 64) {
200            output = output + String.fromCharCode(chr2);
201        }
202        if (enc4 != 64) {
203            output = output + String.fromCharCode(chr3);
204        }
205
206    }
207
208    output = GksBase64._utf8_decode(output);
209
210    return output;
211
212},
213
214// private method for UTF-8 encoding
215_utf8_encode : function (string) {
216    string = string.replace(/\r\n/g,"\n");
217    var utftext = "";
218
219    for (var n = 0; n < string.length; n++) {
220
221        var c = string.charCodeAt(n);
222
223        if (c < 128) {
224            utftext += String.fromCharCode(c);
225        }
226        else if((c > 127) && (c < 2048)) {
227            utftext += String.fromCharCode((c >> 6) | 192);
228            utftext += String.fromCharCode((c & 63) | 128);
229        }
230        else {
231            utftext += String.fromCharCode((c >> 12) | 224);
232            utftext += String.fromCharCode(((c >> 6) & 63) | 128);
233            utftext += String.fromCharCode((c & 63) | 128);
234        }
235
236    }
237
238    return utftext;
239},
240
241// private method for UTF-8 decoding
242_utf8_decode : function (utftext) {
243    var string = "";
244    var i = 0;
245    var c = c1 = c2 = 0;
246
247    while ( i < utftext.length ) {
248
249        c = utftext.charCodeAt(i);
250
251        if (c < 128) {
252            string += String.fromCharCode(c);
253            i++;
254        }
255        else if((c > 191) && (c < 224)) {
256            c2 = utftext.charCodeAt(i+1);
257            string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
258            i += 2;
259        }
260        else {
261            c2 = utftext.charCodeAt(i+1);
262            c3 = utftext.charCodeAt(i+2);
263            string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
264            i += 3;
265        }
266
267    }
268
269    return string;
270}
271
272}
273function gks_insertParam(url, key, value)
274{
275    key = encodeURI(key);
276    value = encodeURI(value);
277    var kvp = url.substr(1).split('&');
278    var i = kvp.length;
279    var x;
280    while(i--) {
281        x = kvp[i].split('=');
282
283        if (x[0]==key) {
284            x[1] = value;
285            kvp[i] = x.join('=');
286            break;
287        }
288    }
289
290    if (i<0) {
291        kvp[kvp.length] = [key,value].join('=');
292    }
293
294    return kvp.join('&');
295}

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.