PageSourceSearch

https://maaeen.com/wp-content/plugins/demo-expiration/js/demo-expiration.js

js maaeen.com collected 2026-09-28 23:22:17 UTC 7,698 bytes, 170 lines download raw bytes

1jQuery(document).ready(function($) {
2    // ----------------------------------------------------------------
3    // HELPER: Start countdown, then redirect
4    // ----------------------------------------------------------------
5    function startAfterExpiryCountdown(displayTime, redirectUrl, timerSelector, overlaySelector, popupSelector) {
6        var counter = displayTime;
7        var interval = setInterval(function() {
8            $(timerSelector).text(counter + " seconds remaining");
9            counter--;
10            if (counter < 0) {
11                clearInterval(interval);
12                // Hide everything
13                $(overlaySelector).fadeOut();
14                $(popupSelector).fadeOut();
15                if (redirectUrl) {
16                    window.location.href = redirectUrl;
17                }
18            }
19        }, 1000);
20    }
21
22    // ----------------------------------------------------------------
23    // DEMO EXPIRATION LOGIC
24    // ----------------------------------------------------------------
25    // 1. Check if Demo is enabled
26    // 2. If the date is in the future => show countdown
27    // 3. If in the past => show "expired" popup
28    if (expirationConfig.demoEnabled === 'enabled' && expirationConfig.demoExpirationDate) {
29        var demoExpTime = new Date(expirationConfig.demoExpirationDate).getTime();
30        if (!isNaN(demoExpTime)) {
31            var now = new Date().getTime();
32
33            // If future => show a countdown
34            if (demoExpTime > now) {
35                $('#demo-expiration-popup').fadeIn();
36                var demoInterval = setInterval(function() {
37                    now = new Date().getTime();
38                    var distance = demoExpTime - now;
39                    if (distance <= 0) {
40                        clearInterval(demoInterval);
41                        $('#demo-expiration-popup').fadeOut();
42                        $('#demo-expiration-overlay').fadeIn();
43                        $('#demo-expiration-popup-expired').fadeIn();
44
45                        startAfterExpiryCountdown(
46                            expirationConfig.demoPopupTime,
47                            expirationConfig.demoRedirectUrl,
48                            '#demo-expiration-popup-timer',
49                            '#demo-expiration-overlay',
50                            '#demo-expiration-popup-expired'
51                        );
52                    } else {
53                        var days    = Math.floor(distance / (1000 * 60 * 60 * 24));
54                        var hours   = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
55                        var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
56                        var seconds = Math.floor((distance % (1000 * 60)) / 1000);
57
58                        $('#demo-expiration-timer').text(
59                            days + " Days " + hours + " Hrs " + minutes + " Min " + seconds + " Sec remaining"
60                        );
61                    }
62                }, 1000);
63            } else {
64                // Already expired
65                $('#demo-expiration-overlay').fadeIn();
66                $('#demo-expiration-popup-expired').fadeIn();
67                startAfterExpiryCountdown(
68                    expirationConfig.demoPopupTime,
69                    expirationConfig.demoRedirectUrl,
70                    '#demo-expiration-popup-timer',
71                    '#demo-expiration-overlay',
72                    '#demo-expiration-popup-expired'
73                );
74            }
75        }
76    }
77
78    // Close button for Demo
79    jQuery(document).ready(function($) {
80      $('#demo-expiration-close').on('click', function() {
81        // Hide the popup and overlay on click
82        $('#demo-expiration-popup, #demo-expiration-overlay, #demo-expiration-popup-expired').fadeOut();
83      });
84    });
85
86
87    // ----------------------------------------------------------------
88    // SERVER EXPIRATION LOGIC
89    // ----------------------------------------------------------------
90    if (expirationConfig.serverDomainType === 'server' || expirationConfig.serverDomainType === 'both') {
91        var serverDate = new Date(expirationConfig.serverDate).getTime();
92        if (!isNaN(serverDate)) {
93            var nowS = new Date().getTime();
94
95            // Already expired => show immediately
96            if (nowS >= serverDate) {
97                $('#server-expiration-overlay').fadeIn();
98                $('#server-expiration-popup').fadeIn();
99                startAfterExpiryCountdown(
100                    expirationConfig.serverPopupTime,
101                    expirationConfig.serverRedirectUrl,
102                    '#server-expiration-timer',
103                    '#server-expiration-overlay',
104                    '#server-expiration-popup'
105                );
106            } else {
107                // Poll until the date/time is reached
108                var serverInterval = setInterval(function() {
109                    nowS = new Date().getTime();
110                    if (nowS >= serverDate) {
111                        clearInterval(serverInterval);
112                        $('#server-expiration-overlay').fadeIn();
113                        $('#server-expiration-popup').fadeIn();
114                        startAfterExpiryCountdown(
115                            expirationConfig.serverPopupTime,
116                            expirationConfig.serverRedirectUrl,
117                            '#server-expiration-timer',
118                            '#server-expiration-overlay',
119                            '#server-expiration-popup'
120                        );
121                    }
122                }, 1000);
123            }
124        }
125    }
126
127   
128
129    // ----------------------------------------------------------------
130    // DOMAIN EXPIRATION LOGIC
131    // ----------------------------------------------------------------
132    if (expirationConfig.serverDomainType === 'domain' || expirationConfig.serverDomainType === 'both') {
133        var domainDate = new Date(expirationConfig.domainDate).getTime();
134        if (!isNaN(domainDate)) {
135            var nowD = new Date().getTime();
136
137            // Already expired => show immediately
138            if (nowD >= domainDate) {
139                $('#domain-expiration-overlay').fadeIn();
140                $('#domain-expiration-popup').fadeIn();
141                startAfterExpiryCountdown(
142                    expirationConfig.domainPopupTime,
143                    expirationConfig.domainRedirectUrl,
144                    '#domain-expiration-timer',
145                    '#domain-expiration-overlay',
146                    '#domain-expiration-popup'
147                );
148            } else {
149                // Poll until the date/time is reached
150                var domainInterval = setInterval(function() {
151                    nowD = new Date().getTime();
152                    if (nowD >= domainDate) {
153                        clearInterval(domainInterval);
154                        $('#domain-expiration-overlay').fadeIn();
155                        $('#domain-expiration-popup').fadeIn();
156                        startAfterExpiryCountdown(
157                            expirationConfig.domainPopupTime,
158                            expirationConfig.domainRedirectUrl,
159                            '#domain-expiration-timer',
160                            '#domain-expiration-overlay',
161                            '#domain-expiration-popup'
162                        );
163                    }
164                }, 1000);
165            }
166        }
167    }
168
169    
170});

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.