PageSourceSearch

http://mahabadcity.ir/Design/DesktopLayouts/dp-public-07/script.js

js mahabadcity.ir collected 2026-10-02 23:46:08 UTC 9,186 bytes, 219 lines download raw bytes

1// --- scripts added by m.shabani ---
2
3$(document).ready(function() {
4    // uikit sticky dynamic height
5    function reCheckSticky() {
6        $.each($('[data-uk-sticky]').parent('.uk-sticky-placeholder'), function(i,val) {
7            var $instance = $(val);
8            $instance.css('height', $instance.children().outerHeight()); 
9
10            // slider goes under menu
11            if ( $(window).width() > 768 && !$('.dp-cp-topnav.acp-preview').length ) {
12                $('.slider-under-menu').css('margin-top','-'+$('#header-sticky').height()+'px');
13                $('.slider-under-menu').css('min-height',$('#header-sticky').height());
14                $('.slider-under-menu #wowslider-container_quiet .ws_bullets').css('top',$('#header-sticky').height()+5);
15            }
16
17        });
18    };
19    $(window).on('load resize', UIkit.Utils.debounce(reCheckSticky, 200));
20
21    $('#NewsContent .NewsItemStyle > tbody > tr:nth-child(2)').append('<div class="news-info">');
22
23    //	news date convert
24    var months = { '1': 'January', '2': 'February', '3': 'March', '4': 'April', '5': 'May','6': 'June',
25        '7': 'July', '8': 'August', '9': 'September', '10': 'October', '11': 'November','12': 'December'
26    };
27
28    $('[id$=_DetailsDatePanel] b').hide();
29    $("#NewsContent [id$=_DetailsDatePanel] [id$=_DetailsSubmitDate]").each(function() {
30        var date = $(this).text().split('/');
31        $(this).parents('#NewsContentLayout').find('.news-info').append('<div class="news-date">' + date[1] +" "+ months[date[0]] +" "+ date[2] + '</div>');
32        $(this).hide();
33    });
34
35    $('[id$=_DetailsVisitPanel]').each(function() {
36        $(this).parents('#NewsContentLayout').find('.news-info').append(this);
37    })
38
39    // menu sticky fix on logon
40    $("head").append("<style>#header-sticky.uk-active{padding-top:" +
41    $(".dp-cp-topnav.acp-preview").height() + "px}</style>");
42
43    // relate label to input
44    $('.SubHead').each(function() {
45        $(this).wrapInner('<label>').find('label').attr('for',
46        $(this).siblings('td').find('input, select, textarea').attr('id'));
47    });
48
49    // exclude uikit inputs
50    $('.uk-form input').addClass('uk-input');
51
52    // ADD PANEL TO SET CUSTOM CLASS TO MODULE : msh@17/04/98;
53    $('.dp-module-title').each(function() {
54        $(this).contents().filter(function(){return this.nodeType === 8})
55        .replaceWith(function(){return this.data})
56    });
57
58    $('[id$=paneheader] ~* .dp-module-title-text').hide().addClass('@log');
59    $('.dp-module-title-text').each(function() {
60        // get module calss and name 
61        var modText = $(this).parent().find('.dp-module-title-text:contains("cls=")').text(); 
62        var modtype = modText.indexOf('[!cls=') != -1 ? "!" : "";
63        var modStrStart = modText.lastIndexOf('['+modtype+'cls=');
64        var modStrEnd = modText.indexOf(modtype+']') + (modtype+']').length;
65        var modStr = modText.substr(modStrStart,modStrEnd);
66
67        // Create panel dom
68        modText = $(this).html().replace(modStr,'');
69        var modClass = modStr.replace('['+modtype+'cls=','').replace(modtype+']','');
70        var modDom = '<div class="mod-qset uk-panel-box" defcls="'+modClass+'">\
71            <label>Title: <input class="mod-title" value="'+modText+'" type="text"></label>\
72            <label>Class: <input class="mod-calss" value="'+modClass+'" type="text"></label>\
73            <label>Hidden Layout: <input class="mod-type" type="checkbox"></label>\
74            <a class="mod-submit uk-button uk-button-primary" onclick="ModQuickSet($(this))">Apply</a>\
75            <style>.mod-qset label {display:inline-block}</style>\
76        </div>';
77
78        // Check authentication
79        var modParent = $(this).parents('.dp-module-title');
80        if ($(this).hasClass('\@log')) {
81            modParent.append(modDom);
82            modParent.find('.mod-type').prop('checked',modtype != "" ? true : false);
83            
84            $('.mod-title, .mod-calss').on('keyup keypress blur change', function() {
85                $(this).val($(this).val().replace('"','').replace("'",''));
86            });
87        } else {
88            $(this)[0].innerHTML = modText;
89            if (modtype != "" ? true : false) {
90                $(this).hide().parents('[class*=dp-module]').attr('class',
91                function(i,c) { return c.replace(/(^|\s)dp-module\S+/g,'') });
92            }
93        }
94        modParent.parent().addClass(modClass);
95    });
96});
97
98// Save panel settings - must be outside the document ready
99function ModQuickSet(obj) {
100    // Seperate module class and name
101    var modType =  obj.parents('.mod-qset').find('.mod-type').is(':checked') ? '!' : '';
102    var modClass = obj.parents('.mod-qset').find('.mod-calss').attr('value');
103    var modTextNode = obj.parents('.dp-module-title').find('.dp-module-title-text');
104    var modTitle = obj.parents('.mod-qset').find('.mod-title').attr('value');
105    var modSet = modClass.length != "" || modType != "" ? modTitle + '[' + modType + 'cls=' + modClass + modType + ']' : modTitle;
106    modTextNode[0].innerHTML = modSet;
107
108    // Check routing then get tabID
109    var url = window.location.href.toLowerCase();
110    if (url.toLowerCase().indexOf('homepage.aspx') == -1) {
111        var tabId = window.location.href.split('/')[5];
112    } else {
113        var tabId = RegExp('[\?&]'+'tabid'+'=([^&#]*)').exec(url)[1];
114    }
115
116    // Get moduleID
117    var moduleId = modTextNode.parent().attr('data-');
118    
119    // Save panel settings AJAX
120    if (modSet != "") {
121        obj.parents('.mod-qset').find('.mod-submit').append('<i class="fa fa-fw fa-circle-o-notch fa-spin">');
122        $.ajax({
123            url: '/Admin/AdvanceControlPanelEngine.ashx', cache: false, type: 'POST',
124            data: { 'moduleId': moduleId, 'tabId': tabId, 'fid': 'rename', 'mtitle': modSet },
125            success: function () {
126                toastr.success('Update Completed.');
127                obj.parents('.dp-module-title').parent().removeClass( obj.parent().attr('defcls') );
128                obj.parents('.dp-module-title').parent().addClass(modClass);
129                obj.parent().attr('defcls',modClass);
130            },
131            error: function () { toastr.error('Error registering information.') },
132            complete: function () { obj.parents('.mod-qset').find('.mod-submit').find('i').remove() }
133        });
134    } else { toastr.error('Enter at least one of the options.'); }
135}
136
137// menu load script
138(function ($, window, document, undefined) {
139    function Menu(element, options) {
140        this.$element = $(element);
141        this.options = options;
142        this.items = this.options.items;
143        this.init();
144    }
145
146    Menu.prototype = {
147        init: function () {
148            var $ul = $('<ul>').appendTo(this.$element);
149            this.create(this.items, $ul);
150        },
151        create: function (list, $parent) {
152            for(var i=0; i<list.length; i++){
153                var item = list[i];
154                var $li = $("<li>").appendTo($parent);
155                var $link = $("<a href="+ item.tabLink +">"+ item.TabName +"</a>").appendTo($li);
156                if(item.Tabs.length){
157                    $li.addClass('nav-parent');
158                    var $ul = $('<ul class="nav-sub">').appendTo($li);
159                    this.create(item.Tabs, $ul);
160                }
161            }
162        }
163    };
164
165    $.fn.menu = function (options) {
166        if (typeof options == 'string') {
167            var plugin = this.data('menu');
168            if (plugin) {
169                var r = plugin[options].apply(plugin, Array.prototype.slice.call(arguments, 1));
170                if (r) return r
171            }
172            return this
173        }
174
175        options = $.extend({}, $.fn.menu.defaults, options);
176        return this.each(function () {
177            var plugin = $.data(this, 'menu');
178            if (!plugin) {
179                plugin = new Menu(this, options);
180                $.data(this, 'menu', plugin);
181            }
182        });
183    };
184    $.fn.menu.defaults = {items: []};
185})(jQuery, window, document);
186
187// SEARCH
188var searchResult;
189function check(txtSearchID) {
190    var txtSearch = document.getElementById(txtSearchID);
191    if (txtSearch.value == "") {
192        alert(HeaderSearch.Alert(1).value);
193        return true;
194    } else {	
195        document.getElementById("imgLoading").style.visibility = 'visible';
196        HeaderSearch.checkSearch(txtSearch.value,checkSearch_callBack);
197    }
198}
199
200function checkSearch_callBack(res) {
201    document.getElementById("imgLoading").style.visibility = 'hidden';
202    searchResult = res.value;
203        
204    if(searchResult=="true") {
205        HeaderSearch.fn(fn_callback);
206        return false;
207    } else {
208        alert(HeaderSearch.Alert(2).value);
209        return true;
210    }
211}
212
213function fn_callback(res) { this.location = res.value; }
214
215$(function () {
216    $("#main-nav").menu({ items: JSON.parse(jsonMainNav) });
217    $("#main-nav > ul").clone().appendTo('#res-nav > div');
218});
219// END

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.