PageSourceSearch

https://oaokiz.ru/g/libs/lightgallery-proxy-to-hs/lightgallery.proxy.to.hs.js

js oaokiz.ru collected 2026-09-29 18:21:10 UTC 18,996 bytes, 580 lines download raw bytes

1var loader = loader || {}
2loader.import_file = (filename,filetype) => {
3	let head   = document.getElementsByTagName('head')[0];
4	switch (filetype) {
5		case 'js':
6			let script=document.createElement("script");
7			script.type = "text/javascript";
8			script.src = filename + '.' + filetype;
9			script.async = true;
10			head.appendChild(script);
11			break;
12		case 'css': {
13			let stylesheet=document.createElement("link");
14			stylesheet.rel ="stylesheet";
15			stylesheet.type = "text/css";
16			stylesheet.href = filename + '.' + filetype;
17			head.appendChild(stylesheet);
18			break;
19			
20		}
21			
22	}
23};
24
25window.addEventListener("load", (event)=> {
26	if (typeof(window.lightGallery)!='undefined') {
27		return false;
28	} else {
29		loader.import_file('/g/libs/lightgallery/v1.2.0/js/lightgallery-full.min', 'js');
30		loader.import_file('/g/libs/lightgallery/v1.2.0/css/lightgallery.min', 'css');
31	}	
32    
33});
34
35if (typeof(hs)=='undefined') {
36    var hs = {};
37}
38
39(function(){
40    var hsMain = {
41        // default variables
42        align: '',
43        allowHeightReduction: true,
44        allowMultipleInstances: true,
45        allowSimultaneousLoading: false,
46        allowSizeReduction: true,
47        allowWidthReduction: false,
48        anchor: '',
49        autoplay: null,
50        blockRightClick: false,
51        cacheAjax: true,
52        captionEval: null,
53        captionId: null,
54        captionOverlay: {},
55        captionText: null,
56        contentId: null,
57        creditsHref: '',
58        creditsPosition: 'top left',
59        creditsTarget: '_self',
60        dimmingDuration: 50,
61        dimmingGeckoFix: false,
62        dimmingOpacity: 0,
63        dragByHeading: true,
64        dragSensitivity: 5,
65        dynamicallyUpdateAnchors: true,
66        easing: 'easeInQuad',
67        easingClose: this.easing,
68        enableKeyListener: true,
69        expandCursor: 'zoomin.cur',
70        expandDuration: 250,
71        fadeInOut: false,
72        flushImgSize: false,
73        forceAjaxReload: false,
74        fullExpandOpacity: 1,
75        fullExpandPosition: 'bottom right',
76        graphicsDir: '',
77        headingEval: null,
78        headingId: null,
79        headingOverlay: {},
80        headingText: null,
81        height: undefined,
82        lang: {},
83        loadingOpacity: 0.75,
84        maincontentEval: null,
85        maincontentId: null,
86        maincontentText: null,
87        marginBottom: 15,
88        marginLeft: 15,
89        marginRight: 15,
90        marginTop: 15,
91        maxHeight: null,
92        maxWidth: null,
93        minHeight: 200,
94        minWidth: 200,
95        numberOfImagesToPreload: 5,
96        numberPosition: null,
97        objectHeight: null,
98        objectLoadTime: '',
99        objectType: null,
100        objectWidth: null,
101        openerTagNames: ["a"],
102        outlinesDir: 'outlines/',
103        outlineStartOffset: 3,
104        outlineType: '',
105        outlineWhileAnimating: 2,
106        overrides : [
107            'allowSizeReduction',
108            'useBox',
109            'anchor',
110            'align',
111            'targetX',
112            'targetY',
113            'outlineType',
114            'outlineWhileAnimating',
115            'captionId',
116            'captionText',
117            'captionEval',
118            'captionOverlay',
119            'headingId',
120            'headingText',
121            'headingEval',
122            'headingOverlay',
123            'creditsPosition',
124            'dragByHeading',
125            'autoplay',
126            'numberPosition',
127            'transitions',
128            'dimmingOpacity',
129            
130            'width',
131            'height',
132            
133            'contentId',
134            'allowWidthReduction',
135            'allowHeightReduction',
136            'preserveContent',
137            'maincontentId',
138            'maincontentText',
139            'maincontentEval',
140            'objectType',	
141            'cacheAjax',	
142            'objectWidth',
143            'objectHeight',
144            'objectLoadTime',	
145            'swfOptions',
146            'wrapperClassName',
147            'minWidth',
148            'minHeight',
149            'maxWidth',
150            'maxHeight',
151            'pageOrigin',
152            'slideshowGroup',
153            'easing',
154            'easingClose',
155            'fadeInOut',
156            'src'
157        ],
158        padToMinWidth: false,
159        pageOrigin: null,
160        preserveContent: true,
161        restoreCursor: 'zoomout.cur',
162        restoreDuration: 250,
163        showCredits: true,
164        skin: {},
165        slideshowGroup: null,
166        src: undefined,
167        swfOptions: {},
168        targetX: null,
169        targetY: null,
170        thumbnailId: null,
171        transitionDuration: 500,
172        transitions: [],
173        useBox: false,
174        width: undefined,
175        wrapperClassName: null,
176        zIndexCounter: 1001,
177        // /default variables
178        expanders: [],
179        cachedGets: {},
180        close : function(el) {
181            var exp = hs.getExpander(el);
182            if (exp) exp.close();
183            return false;
184        },
185        next: function(el) {
186            var exp = hs.getExpander(el);
187            if (exp) window.lgData[exp.lgUid].goToNextSlide();
188            return false;
189        },
190        previous: function(el) {
191            var exp = hs.getExpander(el);
192            if (exp) window.lgData[exp.lgUid].goToPrevSlide();
193            return false;
194        },
195        getExpander : function (el, expOnly) {
196            if (typeof el == 'number') return hs.expanders[el] || null;
197            return hs.expanders[hs.focusKey] || null;
198        },        
199        registerOverlay: function(obj) {
200            if (typeof obj === 'object') {
201                hs.fakeOverlay = obj;
202            };
203        },        
204        addSlideshow: function(obj) {
205            if (typeof obj === 'object') {
206                hs.fakeSlideshow = obj;
207            };
208        },
209        lgImageSelector: 'a.highslide:not([onclick*=htmlExpand])',
210        expand: function(el, params, custom, type) {
211            if (type == 'html' && !el.hasAttribute('lg-uid')) {
212                params = this.overrideParams(params);
213                var preInitRes = this.lgHtmlPreInit(el, params, custom);
214                if (preInitRes != undefined) return preInitRes;
215                this.lgHtmlInit(el, params, custom);
216                this.addLgEventListeners(el, params, custom, type);
217                el.click();
218            } else {
219                var galleryContainer = this.getGalleryContainer(el);
220            
221                if (galleryContainer && !galleryContainer.hasAttribute('lg-uid')) {
222                    params = this.overrideParams(params);
223                    params.galleryContainer = galleryContainer;
224                    this.lgGalleryPreInit(el, params, custom);
225                    this.lgGalleryInit(el, params, custom);
226                    this.addLgEventListeners(el, params, custom, type);
227                    el.click();
228                } else if (!galleryContainer && !el.hasAttribute('lg-uid')) {
229                    params = this.overrideParams(params);
230                    this.lgImagePreInit(el, params, custom);
231                    this.lgImageInit(el, params, custom);
232                    this.addLgEventListeners(el, params, custom, type);
233                    el.click();
234                };
235            };
236            return false;
237        },
238        htmlExpand: function(el, params, custom) {
239            return hs.expand(el, params, custom, 'html');
240        },
241        fireEvent : function (obj, evt, args) {
242            var exp = hs.getExpander();
243            return exp && exp[evt] ? (exp[evt](exp, args) !== false) : true;
244        },
245        overrideParams: function(params) {
246            params = params || {};
247            
248            for (var i = 0; i < hs.overrides.length; i++) {
249                var name = hs.overrides[i];
250                if (typeof params[name] == 'undefined') params[name] = hs[name];
251            };
252            
253            return params;
254        },
255        getGalleryContainer: function(el) {
256            if (el.matches(this.lgImageSelector) && ( (hs.fakeOverlay.thumbnailId === null) || Object.keys(hs.fakeSlideshow).length )) {
257                var links = document.querySelectorAll(this.lgImageSelector);
258                
259                if (links.length > 1) {
260                    for (var elem1 = links[0].parentElement; elem1 != null; elem1 = elem1.parentElement) {
261                        for (var elem2 = links[links.length-1].parentElement; elem2 != null; elem2 = elem2.parentElement) {
262                            if (elem1 == elem2) {
263                                return elem1;
264                            };
265                        };
266                    };
267                };
268            };
269            return null;
270        },
271        lgGalleryPreInit: function(el, params, custom) {
272            var galleryContainer = params.galleryContainer;
273            
274            for (var link of galleryContainer.querySelectorAll(this.lgImageSelector)) {
275                this.lgSetCaption(link);
276            };
277        },
278        lgGetOptions: function(el, params, custom, optionType) {
279            var lgOptions = {};
280
281            optionType = optionType || 'image';
282
283            if (optionType == 'image') {
284                lgOptions = {
285                    selector: 'this',
286                    hash: false,
287                    share: false,
288                    getCaptionFromTitleOrAlt: false
289                };
290            } else if (optionType == 'gallery') {
291                lgOptions = {
292                    thumbnail: true,
293                    selector: this.lgImageSelector,
294                    hash: false,
295                    share: false,
296                    pause: this.fakeSlideshow.interval ? this.fakeSlideshow.interval : 5000,
297                    autoplayControls: this.fakeSlideshow.useControls ? this.fakeSlideshow.useControls : false,
298                    autoplay: this.autoplay ? this.autoplay : false,
299                    getCaptionFromTitleOrAlt: false
300                };
301            } else if (optionType == 'html') {
302                lgOptions = {
303                    selector: 'this',
304                    hash: false,
305                    share: false,
306                    width: params.width ? (params.width + 'px') : '420px',
307                    height: params.height ? (params.height + 'px') : 'auto',
308                    mode: 'lg-fade',
309                    addClass: (params.objectType == 'iframe' && (!params.height || params.height == 'auto')) ? 'lg-iframe-auto' : 
310                        params.objectType == 'iframe' ? 'lg-iframe' : 'lg-html',
311                    counter: false,
312                    download: false,
313                    zoom: false,
314                    fullScreen: false,
315                    startClass: '',
316                    enableSwipe: false,
317                    enableDrag: false,
318                    speed: 500
319                };
320            };
321
322            if (custom && custom.lgOptions) {
323                lgOptions = Object.assign(lgOptions, custom.lgOptions);
324            };
325
326            return lgOptions;
327        },
328        lgGalleryInit: function(el, params, custom) {
329            var galleryContainer = params.galleryContainer,
330                lgOptions = this.lgGetOptions(el, params, custom, 'gallery');
331            
332            lightGallery(galleryContainer, lgOptions);
333        },
334        lgImagePreInit: function(el, params, custom) {
335            this.lgSetCaption(el);
336        },
337        lgSetCaption: function(el) {
338            if (el.dataset.captionDisable !== 'true') {
339                if ( el.nextElementSibling && el.nextElementSibling.matches('.highslide-caption') ) {
340                    el.dataset.subHtml = el.nextElementSibling.innerHTML;
341                } else if (el.querySelector('img')) {
342                    var img = el.querySelector('img');
343
344                    el.dataset.subHtml = img.getAttribute('longdesc') || el.getAttribute('data-caption') || img.getAttribute('data-caption') || el.getAttribute('title') || img.getAttribute('title') || img.getAttribute('alt');
345                };
346            };
347        },
348        lgImageInit: function(el, params, custom) {
349            var lgOptions = this.lgGetOptions(el, params, custom);
350
351            lightGallery(el, lgOptions);
352        },
353        lgHtmlPreInit: function(el, params, custom) {
354            if (params && params.objectType == 'ajax') {
355                var ajax = new hs.Ajax(el);
356                ajax.src = el.href || params.src;
357                ajax.onLoad = function () {
358                    hs.lgHtmlInit(el, params, custom);
359                    hs.addLgEventListeners(el, params, custom, 'html');
360                    el.click();
361                };
362                ajax.onError = function () { location.href = el.href; };
363                ajax.run();
364                return false;
365            } else if (params && params.objectType == 'iframe') {
366                el.dataset.iframe = true;
367                el.dataset.src = el.href || params.src;
368            } else if (params && params.contentId && document.getElementById(params.contentId)) {
369                el.dataset.subHtml = '#' + params.contentId;
370            } else if ( el.nextElementSibling && el.nextElementSibling.matches('.highslide-maincontent') ) {
371                el.dataset.subHtml = el.nextElementSibling.innerHTML;
372             } else {
373                return true;
374            };
375        },
376        lgHtmlInit: function(el, params, custom) {
377            var lgOptions = this.lgGetOptions(el, params, custom, 'html');
378
379            lightGallery(el, lgOptions);
380        },
381        addLgEventListeners: function(el, params, custom, type) {
382            var lgElem = params.galleryContainer || el;
383            lgElem.addEventListener('onBeforeOpen', function(e) {
384                new hs.Expander(el, params, custom, type);
385            });
386            lgElem.addEventListener('onAferAppendSlide', function(e) {
387                hs.fireEvent(null, 'onBeforeGetCaption');
388                hs.fireEvent(null, 'onBeforeGetContent');
389            });
390            lgElem.addEventListener('onAfterAppendSubHtml', function(e) {
391                hs.fireEvent(null, 'onAfterGetCaption');
392                hs.fireEvent(null, 'onAfterGetContent');
393            });
394            lgElem.addEventListener('onBeforeSlide', function(e) {
395                hs.fireEvent(null, 'onBeforeExpand');
396            });
397            lgElem.addEventListener('onAfterSlide', function(e) {
398                hs.fireEvent(null, 'onAfterExpand');
399            });
400            lgElem.addEventListener('onBeforeClose', function(e) {
401                hs.fireEvent(null, 'onBeforeClose');
402            });
403            lgElem.addEventListener('onCloseAfter', function(e) {
404                hs.fireEvent(null, 'onAfterClose');
405                hs.expanders[hs.focusKey] = null;
406            });
407        },
408        
409        isUnobtrusiveAnchor: function(el) {
410            return;
411        },
412        stripItemFormatter: function(el) {
413            return;
414        },
415        updateAnchors: function(el) {
416            return;
417        }
418    };
419
420    var hsMainKeys = Object.keys(hsMain);
421
422    for (var i = 0; i < hsMainKeys.length; i++) {
423        var hsMainKey = hsMainKeys[i];
424        hs[hsMainKey] = hsMain[hsMainKey];
425    }
426})();
427
428hs.fakeOverlay = hs.fakeOverlay ? hs.fakeOverlay : {};
429hs.fakeSlideshow = hs.fakeSlideshow ? hs.fakeSlideshow : {};
430
431// hs.Ajax object prototype
432hs.Ajax = function (a, content, pre) {
433	this.a = a;
434	this.content = content;
435	this.pre = pre;
436};
437
438hs.Ajax.prototype = {
439run : function () {
440	var xhr;
441	if (!this.src) this.src = hs.getSrc(this.a);
442	if (this.src.match('#')) {
443		var arr = this.src.split('#');
444		this.src = arr[0];
445		this.id = arr[1];
446	}
447	if (hs.cachedGets[this.src]) {
448		this.cachedGet = hs.cachedGets[this.src];
449		if (this.id) this.getElementContent();
450		else this.loadHTML();
451		return;
452	}
453	try { xhr = new XMLHttpRequest(); }
454	catch (e) {
455		try { xhr = new ActiveXObject("Msxml2.XMLHTTP"); }
456		catch (e) {
457			try { xhr = new ActiveXObject("Microsoft.XMLHTTP"); }
458			catch (e) { this.onError(); }
459		}
460	}
461	var pThis = this; 
462	xhr.onreadystatechange = function() {
463		if(pThis.xhr.readyState == 4) {
464			if (pThis.id) pThis.getElementContent();
465			else pThis.loadHTML();
466		}
467	};
468	var src = this.src;
469	this.xhr = xhr;
470	if (hs.forceAjaxReload) 
471		src = src.replace(/$/, (/\?/.test(src) ? '&' : '?') +'dummy='+ (new Date()).getTime());
472	xhr.open('GET', src, true);
473	xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
474	xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
475	xhr.send(null);
476},
477
478getElementContent : function() {
479	var el = document.createElement('iframe');
480	
481	if (window.opera || hs.ie6SSL) el.src = 'about:blank';
482	el.style.position = 'absolute';
483	el.style.top = '-9999px';
484	document.body.appendChild(el);
485	
486	this.iframe = el;
487		
488	this.loadHTML();
489},
490
491loadHTML : function() {
492	var s = this.cachedGet || this.xhr.responseText,
493		regBody;
494	if (this.pre) hs.cachedGets[this.src] = s;
495	if (!hs.ie || hs.uaVersion >= 5.5) {
496		s = s.replace(new RegExp('<link[^>]*>
496', 'gi'), '')
497			.replace(new RegExp('<script[^>]*>.*?</script>', 'gi'), '');
498		if (this.iframe) {
499			var doc = this.iframe.contentDocument;
500			if (!doc && this.iframe.contentWindow) doc = this.iframe.contentWindow.document;
501			if (!doc) { // Opera
502				var pThis = this;
503				setTimeout(function() {	pThis.loadHTML(); }, 25);
504				return;
505			}
506			doc.open();
507			doc.write(s);
508			doc.close();
509			try { s = doc.getElementById(this.id).innerHTML; } catch (e) {
510				try { s = this.iframe.document.getElementById(this.id).innerHTML; } catch (e) {} // opera
511			}
512			document.body.removeChild(this.iframe);
513		} else {
514			regBody = /(<body[^>]*>|<\/body>)/ig;
515			if (regBody.test(s)) s = s.split(regBody)[hs.ieLt9 ? 1 : 2];
516			
517		}
518	}
519	this.a.dataset.subHtml = s;
520	this.onLoad();
521	for (var x in this) this[x] = null;
522}
523};
524
525hs.Expander = function(a, params, custom, contentType) {
526	this.a = a;
527	this.custom = custom;
528	this.contentType = contentType || 'image';
529	this.isHtml = (contentType == 'html');
530	this.isImage = !this.isHtml;
531	
532	hs.continuePreloading = false;
533	this.overlays = [];
534	this.last = hs.last;
535	hs.last = null;
536	var key = this.key = hs.expanders.length;
537	
538	for (var name in params) {
539		this[name] = params[name];
540	};
541	
542	this.lgUid = a.getAttribute('lg-uid') || this.galleryContainer.getAttribute('lg-uid');
543
544	if (!this.src) this.src = a.href;
545	
546
547	// check if already open
548	for (var i = 0; i < hs.expanders.length; i++) {
549		if (hs.expanders[i] && hs.expanders[i].a == a 
550			&& !(this.last && this.transitions[1] == 'crossfade')) {
551			return false;
552		}
553	}
554	
555	hs.expanders[key] = this;
556	hs.focusKey = key;
557	
558	return true;
559};
560
561hs.Expander.prototype = {
562	close: function() {
563		window.lgData[this.lgUid].destroy();
564	},
565	createOverlay: function(el) {
566		return;
567	},
568	focus: function() {
569		return;
570	},
571	moveTo: function(x, y) {
572		return;
573	},
574	reflow: function() {
575		return;
576	},
577	resizeTo: function(w, h) {
578		return;
579	}
580};

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.