PageSourceSearch

https://epant.gr/plugins/system/t4/themes/base/js/base.js?c8d838d99f068de81271c9c715afc03d

js epant.gr collected 2026-10-02 03:43:36 UTC 9,277 bytes, 250 lines download raw bytes

1jQuery(document).ready(function($) {
2   
3    /**
4     *monitor the element scroll to add class into body for style effect later
5     */
6    $(window).ready(function() {
7        if (
8            "IntersectionObserver" in window &&
9            "IntersectionObserverEntry" in window &&
10            "intersectionRatio" in window.IntersectionObserverEntry.prototype
11        ) {
12            var options = {
13                root: null,
14                rootMargin: '0px',
15                threshold: 0
16            };
17            var sections = document.querySelectorAll(".t4-section");
18            var maxIdx = 0;
19            var sticky = document.querySelectorAll(".t4-sticky");
20
21            function isValid(el) {
22                return el.offsetTop < window.innerHeight && el.offsetTop + el.offsetHeight < window.innerHeight + 200;
23            }
24
25            function doChange(changes, observer) {
26                changes.forEach( function(change){
27                    var clientRect = change.boundingClientRect,
28                        target = change.target;
29
30                    if (clientRect.top <= -clientRect.height) {
31                        document.body.setAttribute('data-top-' + target.id, 'over');
32                        document.body.classList.add('top-away');
33
34                    } else {
35                        document.body.setAttribute('data-top-' + target.id, 'under');
36                        document.body.classList.remove('top-away');
37                    }
38
39                })
40            }
41
42            var observer = new IntersectionObserver(doChange, options);
43
44            for(var i=0; i<sections.length; i++) {
45                var el = sections[i];
46                if (isValid(el)) {
47                    el.idx = i;
48                    observer.observe(el);
49                } else {
50                    maxIdx = i - 1;
51                    break;
52                }
53            }
54            var top = 0;
55            var zindex = 300;
56            for(var i=0; i<sticky.length; i++) {
57                var elSk = sticky[i];
58                top += elSk.offsetHeight;
59                if(typeof sticky[i+1] != 'undefined'){
60                    $(elSk).css({'z-index':zindex});
61                    zindex -= 1;
62                    $(sticky[i+1]).css({top:top,'z-index':zindex});
63                }
64                
65            }
66            // monitor not at top
67            var options2 = {
68                root: null,
69                rootMargin: '0px',
70                threshold: 0
71            };
72            function doChange2(changes) {
73                var clientRect = changes[0].boundingClientRect;
74                if (clientRect.top <= -100) {
75                    document.body.classList.add('not-at-top');
76                } else {
77                    document.body.classList.remove('not-at-top');
78                }
79            }
80            var observer2 = new IntersectionObserver(doChange2, options2);
81            var anchorEl = $('<a name="top-anchor">').prependTo('.t4-content-inner');
82            if(anchorEl.get(0)) observer2.observe(anchorEl.get(0));
83
84        }
85    });
86    
87    //check anchor link on menu scroll smoothly
88    $(document).on('click', 'a[href^="#"]', function (event) {
89        event.preventDefault();
90        if($(this).data('slide')) return;
91        if(['tab'].indexOf($(this).data('toggle')) > -1) return;
92        if(['tab'].indexOf($(this).attr('data-bs-toggle')) > -1) return;
93        var el = '';
94        if($($.attr(this, 'href')).length){
95            var el = $.attr(this, 'href');
96        }else if($('[name="' + $.attr(this, 'href').substr(1) + '"]').length){
97            var el = '[name="' + $.attr(this, 'href').substr(1) + '"]';
98        }else{
99            return;
100        }
101        if($('body').hasClass('has-offcanvas--visible')){
102            $('.js-offcanvas-close').trigger('click');
103        }
104        $('html, body').animate({
105            scrollTop: $(el).offset().top
106        }, 500);
107    });
108
109    $('li.nav-item.dropdown').on('hidden.bs.dropdown', function(e) {
110        $(this).find('.show').removeClass('show');
111    });
112
113    /**
114     * Back-to-top action: scroll back to top
115     */
116    $('body').on('click','#back-to-top',function() {
117        $('html').animate({
118            scrollTop : 0
119        }, {
120            duration: 500,
121            start: () => {
122                $('html').css('scroll-behavior', 'auto')
123            },
124            complete: () => {
125                $('html').css('scroll-behavior', '');
126            }
127        });
128        return false;
129    });
130    
131    $(document).find('.t4-content').on("scroll",function (event) {
132        var scroll = $('.t4-content').scrollTop();
133        localStorage.setItem("page_scroll", scroll);
134       
135    });
136});
137// Add missing Mootools when Bootstrap is loaded
138(function($)
139{
140    $(document).ready(function(){
141        var bootstrapLoaded = (typeof $().carousel == 'function');
142        var mootoolsLoaded = (typeof MooTools != 'undefined');
143        if (bootstrapLoaded && mootoolsLoaded) {
144            Element.implement({
145                hide: function () {
146                    return this;
147                },
148                show: function (v) {
149                    return this;
150                },
151                slide: function (v) {
152                    return this;
153                }
154            });
155        }
156    });
157    function refreshCurrentPage () {
158        var page = window.location.href;
159        var cur  = localStorage.getItem('page');
160        if(cur == page){
161            return true;
162        }
163        return false;
164    }
165    
166
167    window.onload = function () {
168        var check  = refreshCurrentPage();
169        localStorage.setItem("page",window.location.href);
170        if(document.getElementsByClassName("t4-content").length){
171            if (check) {
172                var match = localStorage.getItem("page_scroll");
173                document.getElementsByClassName("t4-content")[0].scrollTop = match;
174            }else{
175                document.getElementsByClassName("t4-content")[0].scrollTop = 0;
176            }
177        }
178    }
179    //add version to js
180    var Joomla = window.Joomla || {};
181    Joomla.version = $('html').hasClass('j4') ? "4" : "3";
182    if(Joomla.version == 3){
183        /**
184         * Render messages send via JSON
185         * Used by some javascripts such as validate.js
186         * PLEASE NOTE: do NOT use user supplied input in messages as potential HTML markup is NOT sanitized!
187         *
188         * @param   {object}  messages    JavaScript object containing the messages to render. Example:
189         *                              var messages = {
190         *                                  "message": ["Message one", "Message two"],
191         *                                  "error": ["Error one", "Error two"]
192         *                              };
193         * @return  {void}
194         */
195        Joomla.renderMessages = function( messages ) {
196            Joomla.removeMessages();
197
198            var messageContainer = document.getElementById( 'system-message-container' ),
199                type, typeMessages, messagesBox, title, titleWrapper, i, messageWrapper, alertClass;
200
201            for ( type in messages ) {
202                if ( !messages.hasOwnProperty( type ) ) { continue; }
203                // Array of messages of this type
204                typeMessages = messages[ type ];
205
206                // Create the alert box
207                messagesBox = document.createElement( 'div' );
208
209                // Message class
210                alertClass = (type === 'notice') ? 'alert-info' : 'alert-' + type;
211                alertClass = (type === 'message') ? 'alert-success' : alertClass;
212                alertClass = (type === 'error') ? 'alert-error alert-danger' : alertClass;
213
214                messagesBox.className = 'alert ' + alertClass;
215
216                // Close button
217                var buttonWrapper = document.createElement( 'button' );
218                buttonWrapper.setAttribute('type', 'button');
219                if($('body').hasClass('loaded-bs5')){
220                    buttonWrapper.setAttribute('data-bs-dismiss', 'alert');
221                }else{
222                    buttonWrapper.setAttribute('data-dismiss', 'alert');
223                }
224                buttonWrapper.className = 'close';
225                buttonWrapper.innerHTML = '×';
226                messagesBox.appendChild( buttonWrapper );
227
228                // Title
229                title = Joomla.JText._( type );
230
231                // Skip titles with untranslated strings
232                if ( typeof title != 'undefined' ) {
233                    titleWrapper = document.createElement( 'h4' );
234                    titleWrapper.className = 'alert-heading';
235                    titleWrapper.innerHTML = Joomla.JText._( type );
236                    messagesBox.appendChild( titleWrapper );
237                }
238
239                // Add messages to the message box
240                for ( i = typeMessages.length - 1; i >= 0; i-- ) {
241                    messageWrapper = document.createElement( 'div' );
242                    messageWrapper.innerHTML = typeMessages[ i ];
243                    messagesBox.appendChild( messageWrapper );
244                }
245
246                messageContainer.appendChild( messagesBox );
247            }
248        };
249    }
250})(jQuery);

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.