PageSourceSearch

https://hozehkh.com/Scripts/header-footer.js

js hozehkh.com collected 2026-10-02 16:32:19 UTC 8,754 bytes, 251 lines download raw bytes

1/*          SEARCH FORM          */
2var q = $('#q');
3var loadingImg = $('#loadingImg');
4var loadingSearchResultsImg = $('#loadingSearchResultsImg');
5var googlesearchResultIframe = $('#googlesearchResultIframe');
6var googlesearchDiv = $('#googlesearchDiv');
7
8function submitSearchForm() {
9    if (q.val().length < 3)
10        return;
11    loadingImg.show();
12    loadingSearchResultsImg.show();
13    googlesearchResultIframe.attr('src', '/googlesearchresults.htm?q=' + q.val());
14    googlesearchDiv.fadeIn();
15    loadingImg.hide();
16}
17
18function qKeyDown(event) {
19    if (event.keyCode === 13)
20        submitSearchForm();
21}
22
23$(document).keydown(function (e) {
24    var k = (e.keyCode) ? e.keyCode : e.which;
25    if (k == 191) { // the '/' (slash) key as shortcut for going to search box
26        q.focus();
27        if (document.activeElement == q[0])
28            return false;
29    } else if (e.keyCode == 27 && googlesearchDiv[0].style.display == 'block') {
30        googlesearchDiv.fadeOut();
31    }
32
33    $(q).keypress(function (e) {
34        if (event.keyCode == 13) {
35            event.preventDefault();
36            submitSearchForm();
37        }
38    });
39    googlesearchResultIframe[0].addEventListener("load", function (e) {
40        whenIframeLoaded();
41    });
42});
43
44function whenIframeLoaded() {
45    document.getElementById('loadingSearchResultsImg').style.display = 'none';
46    googlesearchResultIframe[0].focus();
47
48    /// Close search results with ESC key.
49    $(googlesearchResultIframe[0].contentWindow.document).keydown(function (e) {
50        var k = (e.keyCode) ? e.keyCode : e.which;
51        if (e.keyCode == 27) {
52            googlesearchDiv.fadeOut();
53        }
54    });
55}
56/*  end of search form  */
57
58$(document).ready(function () {
59    var dontCloseMegaMenu = false;
60    var dontCloseCategoriesMenu = false;
61    var activeMegaMenu = 'it-services';
62    var chartMegaContainer = $('#chart-mega-container');
63    var itServicesMegaContainer = $('#it-services-mega-container');
64    var categoriesAccordionMenuContainer = $('#categories-accordion-menu-container');
65    document.getElementById('it-services-mega-container').addEventListener('click', megaMenuBodyClick, false);
66    document.getElementById('categories-accordion-menu-container').addEventListener('click', categoriesMenuClick, false);
67
68    document.getElementById('regMenuLnk').addEventListener('click', function (e) {
69        e.preventDefault();
70        let registerMenu = $('#registrationsMenu');
71        registerMenu.slideToggle();
72        let h = $("#registrationsMenuLinks").height();
73        registerMenu.css('top', -(h + 10));
74        dontCloseMegaMenu = !dontCloseMegaMenu;
75    });
76
77    function hideMegaMenu() {
78        if (!dontCloseMegaMenu) {
79            $('.mega-container').fadeOut();
80            document.removeEventListener('click', hideMegaMenu);
81        }
82    }
83
84    function megaMenuBodyClick() {
85        if (event.target == document.getElementById('it-services-mega-container')) {
86            dontCloseMegaMenu = false;
87            hideMegaMenu();
88        }
89    }
90
91    function categoriesMenuClick() {
92        if (event.target == document.getElementById('categories-accordion-menu-container')) {
93            dontCloseCategoriesMenu = false;
94            hideMegaMenu();
95        }
96    }
97
98    $('#otherMenu').on('mouseleave', function () {
99        $(this).fadeOut('slow');
100    });
101
102    $('#registrationsMenu').on('mouseleave', function () {
103        dontCloseMegaMenu = false;
104        $(this).fadeOut('slow');
105    });
106
107    $('#chart-mega-container').on('mouseleave', function () {
108        hideMegaMenu();
109    });
110
111    $('#it-services-mega-container').on('mouseleave', function () {
112        hideMegaMenu();
113    });
114
115    $('#categories-accordion-menu-container').on('mouseleave', function () {
116        hideMegaMenu();
117    });
118
119
120    $('#chart-link').on('click', function () {
121        if (activeMegaMenu == 'chart') {
122            chartMegaContainer.slideToggle();
123        }
124        else {
125            hideMegaMenu();
126            chartMegaContainer.slideDown();
127            activeMegaMenu = 'chart';
128        }
129    });
130
131    document.getElementById('it-services-link').addEventListener('click', function () {
132        if (activeMegaMenu == 'it-services') {
133            itServicesMegaContainer.slideToggle();
134        }
135        else {
136            hideMegaMenu();
137            itServicesMegaContainer.slideDown('fast');
138            activeMegaMenu = 'it-services';
139            document.addEventListener('click', hideMegaMenu);
140        }
141    });
142
143    document.getElementById('categories-link').addEventListener('click', function () {
144        if (activeMegaMenu == 'categories') {
145            categoriesAccordionMenuContainer.slideToggle();
146        }
147        else {
148            hideMegaMenu();
149            categoriesAccordionMenuContainer.slideDown('fast');
150            activeMegaMenu = 'categories';
151            document.addEventListener('click', hideMegaMenu);
152        }
153    });
154
155    $('.mega-icon').on('error', function () {
156        $(this).onerror = "";
157        $(this).attr("src", "/Images/logo-white-128.png");
158        return true;
159    });
160
161    //$('.chart-link').on('mouseover', function () {
162    //var chartId = $(this).data("chartid");
163    //$(document).find('[data-chartid="chart-' + chartId + '"]').slideToggle();
164    //});
165
166    /// moving background for mega menu
167    var root = document.documentElement;
168    document.addEventListener("mousemove", evt => {
169        let x = evt.clientX / innerWidth;
170        let y = evt.clientY / innerHeight;
171
172        root.style.setProperty("--mouse-x", x);
173        root.style.setProperty("--mouse-y", y);
174    });
175
176    /// progress bar at top edge of page
177    //for (let el of document.querySelectorAll("form")) {
178    window.addEventListener("scroll", evt => {
179        let max = root.scrollHeight - window.innerHeight;
180        let scroll = root.scrollTop / max;
181        root.style.setProperty("--scroll", scroll);
182        if (root.scrollTop >= itServicesMegaContainer.height() + 100) {
183            itServicesMegaContainer.fadeOut();
184        }
185    });
186});
187
188/********************************* FOOTER ********************/
189/*     FOR MEGAMENU         */
190$(document).ready(function () {
191    document.getElementById('regMenuFullWidthLnk').addEventListener('click', function (e) {
192        e.preventDefault();
193        let registerMenu = $('#registrationsFullWidthMenu');
194        registerMenu.slideToggle();
195        let h = $("#registrationsMenuFullWidthLinks").height();
196        registerMenu.css('top', -(h + 10));
197    });
198
199    $('#registrationsFullWidthMenu').on('mouseleave', function () {
200        $(this).fadeOut('slow');
201    });
202});
203/*  end of megamenu  */
204
205// لینکهای ثبت نامها پایین صفحه - صفحه اول سابق
206//loadLinks('promptsLinks', 1);
207// لینکهای ثبت نام‌ها در منوی بالای صفحه
208loadLinks('registrationsMenuLinks', 1);
209// لینکهای ثبت نامها پایین صفحه - MegaMenu Full width
210loadLinks('registrationsMenuFullWidthLinks', 1);
211
212function loadLinks(element, location) {
213    // Send an AJAX request
214    $.getJSON("/links-json.aspx?location=" + location,
215        function (data) {
216            // On success, 'data' contains a list of links.
217            $.each(data, function (key, val) {
218
219                // Format the text to display.
220                var a = $('<a />', {
221                    //href: 'javascript:linksClick(this,' + val.fserial + ',"' + val.url + '",' + val.target + ');',
222                    href: '/links-json.aspx?action=go&id=' + val.fserial,
223                    id: "linkLBtn",
224                    target: val.target,
225                    html: val.title
226                });
227
228                // Add a list item for the link.
229                var li = $('<li/>').append(a);
230                li.appendTo($('#' + element));
231                // corrects the html tags (b tag) in links
232                makeDangerous('linkLBtn');
233            });
234        });
235}
236
237/// Increments the hit count of a link and opens it
238function linksClick(element, serial, destination, target) {
239    var linksClickRequest = $.ajax({
240        url: "/links-json.aspx?action=add_hit&id=" + serial,
241        statusCode: {
242            429: function (xhr) {
243                console.log(xhr.responseText);
244                $('#message').html(xhr.responseText);
245                $('#loading').fadeIn('slow').delay(1000).fadeOut('slow');
246            }
247        }
248    }).done(function () {
249        window.open(destination, target);
250    });
251}

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.