PageSourceSearch

https://elderecho.com/wp-content/plugins/led-lib/includes/media/js/admin/led_modal_loading.js?ver=1.1.6

js elderecho.com collected 2026-10-02 05:48:20 UTC 3,752 bytes, 128 lines download raw bytes

1/**
2 * Clase utilizada para modal cargando en el backend
3 * @param {string} selectorParent	Selector que contendra el modal 
4 */
5var ledModalLoading = function (selectorParent, template) {
6	this.template = template,
7		this.selectorParent = selectorParent,
8		this.$selectorParent = jQuery(selectorParent),
9		this.id = 'ledModalLoading',
10		this.selector = '#' + this.id,
11		this.$selector = null,
12		this.animationTime = 0,
13		this.html = '',
14		this.htmlLoading = '',
15		this.init = function () {
16			this.setTemplate();
17			this.render();
18			this.refreshSelector();
19		},
20		this.setTemplate = function () {
21			switch (this.template) {
22				case 'circle':
23					this.htmlLoading = '<i class="fa fa-spin fa-spinner"></i>';
24					break;
25				case 'lefebvre':
26				default:
27					this.htmlLoading = '<div class="preloader-holder"></div>';
28			}
29			this.refreshRender();
30		},
31		this.setId = function (id) {
32			if (id) {
33				this.id = id;
34			}
35			this.selector = '#' + this.id,
36				this.refreshRender();
37		},
38		this.setAnimationTime = function (time) {
39			if (time) {
40				this.animationTime = time;
41			}
42		},
43		this.getStyleModal = function () {
44			var style = '';
45			style += 'display: none;';
46			style += 'width: 100%;';
47			style += 'height: 100%;';
48			style += 'z-index: 9999;';
49			style += 'position: fixed;';
50			style += 'top: 0px;';
51			style += 'background-color: rgba(23,28,50, 0.8);';
52			style += 'color: rgba(0, 0, 0, 0.4);';
53			return style;
54		},
55		this.getStyleLoading = function () {
56			var style = '';
57			style += 'position: relative;';
58			style += 'top: 50%;';
59			style += 'transform: translateY(-50%);';
60			style += 'text-align: center;';
61			style += 'width: 100px;';
62			style += 'left: calc( 50% - 50px );';
63			style += 'color: white;';
64			style += 'font-size: 80px;';
65			return style;
66		},
67		this.loadHtml = function () {
68			this.html = '';
69			this.html += '<div id="' + this.id + '" style="' + this.getStyleModal() + '">';
70			this.html += '<div style="' + this.getStyleLoading() + '" >' + this.htmlLoading + '</div>';
71			this.html += '</div>';
72		},
73		this.setHtml = function (html) {
74			this.html = html;
75		},
76		this.setHtmlLoading = function (html) {
77			this.htmlLoading = html;
78			this.refreshRender();
79		},
80		this.isLoaded = function () {
81			if (jQuery(this.selectorParent + ' ' + this.selector).length > 0) {
82				return true;
83			}
84			return false;
85		},
86		this.render = function () {
87			if (!this.isLoaded()) {
88				this.loadHtml();
89				this.$selectorParent.append(this.html);
90			}
91		},
92		this.refreshRender = function () {
93			jQuery(this.selectorParent).find(this.selector).remove();
94			this.loadHtml();
95			jQuery(this.selectorParent).append(this.html);
96			this.refreshSelector();
97		},
98		this.refreshSelector = function () {
99			this.$selector = jQuery(selectorParent + ' ' + this.selector);
100		},
101
102		this.show = function (duration, complete) {
103			if (typeof (duration) === 'undefined') duration = this.animationTime;
104
105			this.$selector.fadeIn(duration, complete);
106		},
107		this.hide = function (duration, complete) {
108			if (typeof (duration) === 'undefined') duration = this.animationTime;
109			this.$selector.fadeOut(duration, complete);
110		},
111		this.remove = function () {
112			this.$selector.remove();
113		},
114		this.css = function (propertyName, value) {
115			this.$selector.css(propertyName, value);
116		},
117		// Evitar que el spinner se quede tras darle a la flechita hacia atrás
118		window.addEventListener("pageshow", function (event) { 
119			var historyTraversal = event.persisted ||
120				(typeof window.performance != "undefined" &&
121					window.performance.navigation.type === 2);
122			if (historyTraversal) {
123				var aux = this.document.querySelectorAll('#ledModalLoading');
124				aux.forEach(function (e) { e.style.display = 'none' });
125			}
126		}),
127		this.init();
128};

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.