PageSourceSearch

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

js mahabadcity.ir collected 2026-10-02 23:46:03 UTC 23,714 bytes, 613 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  $(window).on('load resize', UIkit.Utils.debounce(reCheckSticky, 200));
19
20  $('#NewsContent .NewsItemStyle > tbody > tr:nth-child(2)').append('<div class="news-info">');
21
22  // news date convert
23  var months = {
24    '۱': 'فروردین',
25    '۲': 'اردیبهشت',
26    '۳': 'خرداد',
27    '۴': 'تیر',
28    '۵': 'مرداد',
29    '۶': 'شهریور',
30    '۷': 'مهر',
31    '۸': 'آبان',
32    '۹': 'آذر',
33    '۰۱': 'فروردین',
34    '۰۲': 'اردیبهشت',
35    '۰۳': 'خرداد',
36    '۰۴': 'تیر',
37    '۰۵': 'مرداد',
38    '۰۶': 'شهریور',
39    '۰۷': 'مهر',
40    '۰۸': 'آبان',
41    '۰۹': 'آذر',
42    '۱۰': 'دی',
43    '۱۱': 'بهمن',
44    '۱۲': 'اسفند',
45  };
46  $('[id$=_DetailsDatePanel] b').hide();
47  $('#NewsContent [id$=_DetailsDatePanel] [id$=_DetailsSubmitDate]').each(function () {
48    var date = $('.DPNewsWrap', this).text().split('/');
49    $(this)
50      .parents('#NewsContentLayout')
51      .find('.news-info')
52      .append('<div class="news-date">' + date[2] + months[date[1]] + date[0] + '</div>');
53    $(this).hide();
54  });
55
56  $('[id$=_DetailsVisitPanel]').each(function () {
57    $(this).parents('#NewsContentLayout').find('.news-info').append(this);
58  });
59
60  // menu sticky fix on logon
61  $('head').append(
62    '<style>#header-sticky.uk-active{padding-top:' + $('.dp-cp-topnav.acp-preview').height() + 'px}</style>'
63  );
64
65  // relate label to input
66  $('.SubHead').each(function () {
67    $(this)
68      .wrapInner('<label>')
69      .find('label')
70      .attr('for', $(this).siblings('td').find('input, select, textarea').attr('id'));
71  });
72
73  // exclude uikit inputs
74  $('.uk-form input').addClass('uk-input');
75
76  // ADD PANEL TO SET CUSTOM CLASS TO MODULE : msh@17/04/98;
77  $('.dp-module-title').each(function () {
78    $(this)
79      .contents()
80      .filter(function () {
81        return this.nodeType === 8;
82      })
83      .replaceWith(function () {
84        return this.data;
85      });
86  });
87
88  // $('[id$=paneheader] ~* .dp-module-title-text').hide().addClass('@log');
89  // $('.dp-module-title-text').each(function() {
90  //     // get module calss and name
91  //     var modText = $(this).parent().find('.dp-module-title-text:contains("cls=")').text();
92  //     var modtype = modText.indexOf('[!cls=') != -1 ? "!" : "";
93  //     var modStrStart = modText.lastIndexOf('['+modtype+'cls=');
94  //     var modStrEnd = modText.indexOf(modtype+']') + (modtype+']').length;
95  //     var modStr = modText.substr(modStrStart,modStrEnd);
96
97  //     // Create panel dom
98  //     modText = $(this).html().replace(modStr,'');
99  //     var modClass = modStr.replace('['+modtype+'cls=','').replace(modtype+']','');
100  //     var modDom = '<div class="mod-qset uk-panel-box" defcls="'+modClass+'">\
101  //         <label>عنوان: <input class="mod-title" value="'+modText+'" type="text"></label>\
102  //         <label>کلاس: <input dir="ltr" class="mod-calss" value="'+modClass+'" type="text"></label>\
103  //         <label>شمایل پنهان: <input class="mod-type" type="checkbox"></label>\
104  //         <a class="mod-submit uk-button uk-button-primary" onclick="ModQuickSet($(this))">ثبت</a>\
105  //         <style>.mod-qset label {display:inline-block}</style>\
106  //     </div>';
107
108  //     // Check authentication
109  //     var modParent = $(this).parents('.dp-module-title');
110  //     if ($(this).hasClass('\@log')) {
111  //         modParent.append(modDom);
112  //         modParent.find('.mod-type').prop('checked',modtype != "" ? true : false);
113
114  //         $('.mod-title, .mod-calss').on('keyup keypress blur change', function() {
115  //             $(this).val($(this).val().replace('"','').replace("'",''));
116  //         });
117  //     } else {
118  //         $(this)[0].innerHTML = modText;
119  //         if (modtype != "" ? true : false) {
120  //             $(this).hide().parents('[class*=dp-module]').attr('class',
121  //             function(i,c) { return c.replace(/(^|\s)dp-module\S+/g,'') });
122  //         }
123  //     }
124  //     modParent.parent().addClass(modClass);
125  // });
126
127  (function () {
128    // ADD MODULE BY PANE BOTTON ~ msh@4/12/98;
129    if ($('[id$=paneheader]')[0]) {
130      var addMdlDOM = '<div id="mdl-modal" class="uk-modal">\n';
131      var mdlList = '',
132        paneList = '';
133      // get modules list
134      $('.dp-cp-modules-box .dp-cp-module-item').each(function (i, e) {
135        var mdlID = $(e).parent().attr('data-defid');
136        var bMdlID = $(e).parent().attr('data-bmoduleid');
137        var ico = $(e).find('i');
138        var engName = ico.attr('class').replace('icon-', '').replace(/-/g, ' ');
139        mdlList +=
140          '\t<li class="active">\n\
141                                <a mdl-id="' +
142          mdlID +
143          '" bmdl-id="' +
144          bMdlID +
145          '" class="add-module-item">\n\
146                                    \t' +
147          ico[0].outerHTML +
148          '\n\
149                                    <p>' +
150          e.textContent.trim() +
151          '</p>\n\
152                                    <span>' +
153          engName +
154          '</span>\n\
155                                \t</a>\n\t</li>\n';
156      });
157      // insert add module button
158      $('[id$=paneheader]').each(function (i, e) {
159        var id = e.parentNode.id;
160        paneList += '\t<option value="' + id + '">' + e.textContent + ' [' + id.split('_')[1] + ']</option>\n';
161        $(e).append(
162          '<a href="#mdl-modal" data-uk-tooltip title="افزودن ماژول"\
163                class="add-module-btn fal fa-plus" data-uk-modal></a>'
164        );
165      });
166      // add module botton handler
167      $('[id$=paneheader] .add-module-btn').each(function (i, e) {
168        $(e).click(function () {
169          var paneID = e.closest('[type=pane]').id;
170          $('#mdl-modal .pane-mdls').html(mdlIDLister('#' + paneID));
171          $('#mdl-modal .pane-mdls option').last().prop('selected', true);
172          $('#mdl-modal .pane-list').val(paneID);
173          $('#mdl-modal .module-search').val('').trigger('keyup');
174          $('#mdl-modal .add-mdl-wrap').slideDown();
175          $('#mdl-modal .mdl-loading').slideUp();
176        });
177      });
178      // create modal dom
179      addMdlDOM +=
180        '<div class="uk-modal-dialog uk-modal-dialog-large">\n\
181                                <a class="uk-modal-close uk-close"></a>\n\
182                                <div class="uk-modal-header">\n\
183                                    \t<button disabled class="add-mdl-btn uk-button uk-button-primary">افزودن ماژول (ها)</button>\n\
184                                    \t<button disabled class="clear-list-btn uk-button uk-button-danger">پاکسازی لیست</button>\n\
185                                    \t<button disabled class="clear-succ-btn uk-button uk-button-success">پاکسازی انجام شده ها</button>\n\
186                                    \t<span class="mdl-loading">درحال بارگذاری <i class="fal fa-circle-notch fa-spin"></i></span>\n\
187                                </div>\n\
188                                <ul class="added-mdls"></ul>\n\
189                                <div class="add-mdl-wrap">\n\
190                                    \t<div class="add-mdl-opt">\n\
191                                        \t\t<label>نام ماژول: <input type="text" class="module-name"></label>\n\
192                                        \t\t<label>ناحیه: <select class="pane-list">\n' +
193        paneList +
194        '</select></label>\n\
195                                        \t\t<label>موقعیت: <select class="pane-mdls"></select></label>\n\
196                                        \t\t<label>افزودن چند ماژول همزمان: <input class="muli-mdls" type="checkbox"></label>\n\
197                                        \t\t<label>جستجو: <input type="text" class="module-search"></label>\n\
198                                    \t</div>\n\
199                                    <ul class="add-module-list">\n' +
200        mdlList +
201        '</ul>\n\
202                                </div>\n\
203                            </div>\n\
204                        </div>';
205      $('body').append(addMdlDOM.replace(/  /g, ' '));
206      // clear modules from list
207      $('#mdl-modal .clear-list-btn').on('click', function () {
208        $('.added-mdls>li').each(function (i, e) {
209          $(e).slideUp(300, function () {
210            $(e).remove();
211          });
212        });
213        btnsMakeActive(false);
214      });
215      $('#mdl-modal .clear-succ-btn').on('click', function () {
216        $('.added-mdls>li.uk-button-success').each(function (i, e) {
217          $(e).slideUp(300, function () {
218            $(e).remove();
219          });
220        });
221        $('#mdl-modal .clear-succ-btn').prop('disabled', true);
222      });
223      // multi modules add checkbox
224      $('#mdl-modal .muli-mdls').on('click', function () {
225        if ($(this).prop('checked')) {
226          localStorage.setItem('add-multi-mdls', true);
227        } else {
228          localStorage.removeItem('add-multi-mdls');
229        }
230      });
231      if (localStorage.getItem('add-multi-mdls')) {
232        $('#mdl-modal .muli-mdls').prop('checked', true);
233      }
234      // check routing then get tabID
235      var url = window.location.href.toLowerCase();
236      if (url.toLowerCase().indexOf('.aspx') == -1) {
237        var tabID = window.location.href.split('/')[5];
238      } else {
239        var tabID = RegExp('[?&]' + 'tabid' + '=([^&#]*)').exec(url)[1];
240      }
241      // add module(s) button
242      $('#mdl-modal .add-mdl-btn').on('click', function () {
243        addListedModules();
244      });
245      function addListedModules() {
246        var sCount = 0,
247          cCount = 0,
248          eCount = 0;
249        $('.added-mdls>li').each(function (i, e) {
250          $('#mdl-modal .add-mdl-wrap').slideUp();
251          $('#mdl-modal .mdl-loading').slideDown();
252          var name = $(e).find('.mdl-name').val(),
253            mpos = $(e).find('.pane-mdls').val(),
254            mdid = $(e).find('[mdl-id]').attr('mdl-id'),
255            bMdID = $(e).find('[bmdl-id]').attr('bmdl-id'),
256            pane = $(e).find('.pane-list').val().split('_')[1];
257          setTimeout(function () {
258            $.ajax({
259              url: '/Admin/AdvanceControlPanelEngine.ashx',
260              cache: false,
261              type: 'POST',
262              data: {
263                fid: 'addnewmodule',
264                panename: pane,
265                name: name,
266                defid: mdid,
267                targetMid: mpos,
268                tabId: tabID,
269                BModuleID: bMdID,
270              },
271              success: function (a) {
272                sCount++;
273                $(e).addClass('uk-button-success');
274                $(e).removeClass('uk-button-danger');
275                $(e).find('.mdl-lst-msg').text('ماژول جدید اضافه شد');
276                if ($('.added-mdls li').length == sCount) {
277                  setTimeout(function () {
278                    window.location.reload();
279                  }, 500);
280                }
281              },
282              error: function (a, b, c) {
283                eCount++;
284                $(e).addClass('uk-button-danger');
285                $(e).removeClass('uk-button-success');
286                $(e).find('.mdl-lst-msg').html(a.responseText);
287              },
288              complete: function () {
289                cCount++;
290                if ($('.added-mdls li').length == cCount) {
291                  $('#mdl-modal .clear-succ-btn').prop('disabled', false);
292                  if (eCount != 0) {
293                    $('#mdl-modal .mdl-loading').slideUp();
294                  }
295                }
296              },
297            });
298          }, 100);
299        });
300      }
301      // module id Lister
302      function mdlIDLister(el) {
303        var dom = '\t<option value="-1">ابتدای ناحیه</option>\n',
304          index = 0,
305          list = {};
306        $(el)
307          .find('[id^=divMinMax_]')
308          .each(function (i, e) {
309            var val = e.id.split('_')[1];
310            if (!list[val]) {
311              index++;
312              list[val] = true;
313              dom += '\t<option value="' + val + '">بعد از ماژول شماره ' + index + '</option>\n';
314            }
315          });
316        return dom;
317      }
318      // list modules positions
319      $('#mdl-modal').on('change', '.pane-list', function () {
320        var p = $(this).parents().eq(1);
321        var m = p.find('.pane-mdls');
322        m.html(mdlIDLister('#' + this.value));
323        if (m.closest('.add-mdl-opt')) {
324          m.find('option').last().prop('selected', true);
325        }
326      });
327      // add module to list
328      $('#mdl-modal .add-module-item').each(function (i, e) {
329        $(e).click(function () {
330          $(e).addClass('clicked');
331          var mdlID = $(e).attr('mdl-id'),
332            bMdlID = $(e).attr('bmdl-id'),
333            modName = $('.module-name').val() != '' ? $('.module-name').val() : $(e).find('p').text(),
334            pane = $('.add-mdl-opt .pane-list').val();
335          $('.added-mdls').append(
336            '<li class="uk-panel-box uk-panel-box-primary">\n\
337                        \t<label mdl-id="' +
338              mdlID +
339              '" bmdl-id="' +
340              bMdlID +
341              '">ماژول "' +
342              $(e).find('p').text() +
343              '", </label>\n\
344                        \t<label>با نام: <input class="mdl-name" type="text" value="' +
345              modName +
346              '">, </label>\n\
347                        \t<label>در: <select class="pane-list">\n' +
348              paneList +
349              '</select>, </label>\n\
350                        \t<label>در موقعیت: <select class="pane-mdls"></select></label>\n\
351                        \t<div class="mdl-lst-msg"></div>\n\
352                        \t<a title="تکثیر" class="mdl-dup-btn fal fa-clone"></a>\n\
353                        \t<a title="خذف از لیست" class="mdl-del-btn fal fa-times"></a>\n\
354                    </li>'
355          );
356          btnsMakeActive(true);
357          $('.added-mdls .pane-list').last().val(pane);
358          $('.added-mdls .pane-mdls')
359            .last()
360            .html(mdlIDLister('#' + pane));
361          $('.added-mdls .pane-mdls').last().val($('.add-mdl-opt .pane-mdls').val());
362          setTimeout(function () {
363            $(e).removeClass('clicked');
364          }, 1000);
365          if (!$('#mdl-modal .muli-mdls').prop('checked')) {
366            addListedModules();
367          }
368        });
369      });
370
371      function btnsMakeActive(b) {
372        $('#mdl-modal .add-mdl-btn').prop('disabled', !b);
373        $('#mdl-modal .clear-list-btn').prop('disabled', !b);
374      }
375      // delete module from list
376      $('#mdl-modal').on('click', '.mdl-del-btn', function () {
377        $(this)
378          .parent()
379          .slideUp(500, function () {
380            $(this).remove();
381            if (!$('.added-mdls *')[0]) {
382              btnsMakeActive(false);
383            }
384          });
385      });
386      // duplicate module in the list
387      $('#mdl-modal').on('click', '.mdl-dup-btn', function () {
388        var p = $(this).parent(),
389          c = p.clone();
390        c.find('.mdl-lst-msg').text('');
391        c.removeClass('uk-button-success uk-button-danger');
392        c.insertAfter(p);
393        $.each(['.pane-list', '.pane-mdls'], function (i, e) {
394          c.find(e).val(p.find(e).val());
395        });
396      });
397      // search module
398      $('.module-search').on('keyup', function () {
399        var key = this.value.trim().toLowerCase();
400        $('.add-module-list li').each(function (i, e) {
401          if (e.textContent.toLowerCase().includes(key)) {
402            $(e).addClass('active');
403          } else {
404            $(e).removeClass('active');
405          }
406        });
407      });
408    }
409  })(); // end pane add module;
410});
411
412// Save panel settings - must be outside the document ready
413function ModQuickSet(obj) {
414  // Seperate module class and name
415  var modType = obj.closest('.mod-qset').find('.mod-type').is(':checked') ? '~' : '';
416  var modClass = obj.closest('.mod-qset').find('.mod-calss').val();
417  var modTextNode = obj.closest('.dp-module-title').find('.dp-module-title-text');
418  var modTitle = obj.closest('.mod-qset').find('.mod-title').val();
419  var modSet =
420    modClass.length != '' || modType != '' ? modTitle + '[' + modType + 'cls=' + modClass + modType + ']' : modTitle;
421  modTextNode[0].innerHTML = modSet;
422
423  // Check routing then get tabID
424  var url = window.location.href.toLowerCase();
425  if (url.toLowerCase().indexOf('homepage.aspx') == -1) {
426    var tabId = window.location.href.split('/')[5];
427  } else {
428    var tabId = RegExp('[?&]' + 'tabid' + '=([^&#]*)').exec(url)[1];
429  }
430
431  // Get moduleID
432  var moduleId = modTextNode.parent().attr('data-');
433
434  // Save panel settings AJAX
435  if (modSet != '') {
436    obj.parents('.mod-qset').find('.mod-submit').append('<i class="fal fa-fw fa-circle-notch fa-spin">');
437    $.ajax({
438      url: '/Admin/AdvanceControlPanelEngine.ashx',
439      cache: false,
440      type: 'POST',
441      data: { moduleId: moduleId, tabId: tabId, fid: 'rename', mtitle: modSet },
442      success: function (e) {
443        toastr.success(e);
444        obj.parents('.dp-module-title').parent().removeClass(obj.parent().attr('defcls'));
445        obj.parents('.dp-module-title').parent().addClass(modClass);
446        obj.parent().attr('defcls', modClass);
447      },
448      error: function (e) {
449        toastr.error(e.responseText);
450      },
451      complete: function () {
452        obj.parents('.mod-qset').find('.mod-submit').find('i').remove();
453      },
454    });
455  } else {
456    toastr.error('حداقل یکی از گزینه ها را وارد کنید');
457  }
458}
459
460// menu load script
461(function ($, window, document, undefined) {
462  function Menu(element, options) {
463    this.$element = $(element);
464    this.options = options;
465    this.items = this.options.items;
466    this.init();
467  }
468
469  Menu.prototype = {
470    init: function () {
471      var $ul = $('<ul>').appendTo(this.$element);
472      this.create(this.items, $ul);
473    },
474    create: function (list, $parent) {
475      for (var i = 0; i < list.length; i++) {
476        var item = list[i];
477        var $li = $('<li>').appendTo($parent);
478        var $link = $('<a href=' + item.tabLink + '>
478' + item.TabName + '</a>').appendTo($li);
479        if (item.Tabs.length) {
480          $li.addClass('nav-parent');
481          var $ul = $('<ul class="nav-sub">').appendTo($li);
482          this.create(item.Tabs, $ul);
483        }
484      }
485    },
486  };
487
488  $.fn.menu = function (options) {
489    if (typeof options == 'string') {
490      var plugin = this.data('menu');
491      if (plugin) {
492        var r = plugin[options].apply(plugin, Array.prototype.slice.call(arguments, 1));
493        if (r) return r;
494      }
495      return this;
496    }
497
498    options = $.extend({}, $.fn.menu.defaults, options);
499    return this.each(function () {
500      var plugin = $.data(this, 'menu');
501      if (!plugin) {
502        plugin = new Menu(this, options);
503        $.data(this, 'menu', plugin);
504      }
505    });
506  };
507  $.fn.menu.defaults = { items: [] };
508})(jQuery, window, document);
509
510// SEARCH
511var searchResult;
512function check(txtSearchID) {
513  var txtSearch = document.getElementById(txtSearchID);
514  if (txtSearch.value == '') {
515    alert(HeaderSearch.Alert(1).value);
516    return true;
517  } else {
518    document.getElementById('imgLoading').style.visibility = 'visible';
519    HeaderSearch.checkSearch(txtSearch.value, checkSearch_callBack);
520  }
521}
522
523function checkSearch_callBack(res) {
524  document.getElementById('imgLoading').style.visibility = 'hidden';
525  searchResult = res.value;
526
527  if (searchResult == 'true') {
528    HeaderSearch.fn(fn_callback);
529    return false;
530  } else {
531    alert(HeaderSearch.Alert(2).value);
532    return true;
533  }
534}
535
536function fn_callback(res) {
537  this.location = res.value;
538}
539
540$(function () {
541  $('#main-nav').menu({ items: JSON.parse(jsonMainNav) });
542  $('#main-nav > ul').clone().appendTo('#res-nav > div');
543});
544
545// function htmlReady() {
546/********* HTML READY *********/
547(function () {
548  // CUSTOM CLASS PANEL : msh@17/04/98;
549  $('.dp-module-title').each(function (i, e) {
550    $(e)
551      .contents()
552      .filter(function () {
553        return this.nodeType === 8;
554      })
555      .replaceWith(function () {
556        return this.data;
557      });
558  });
559
560  $('[id$=paneheader] ~* .dp-module-title-text').hide().addClass('@log');
561  $('.dp-module-title-text').each(function () {
562    // get module calss and name
563    var modText = $(this).parent().find('.dp-module-title-text:contains("cls=")').text();
564    var modtype = modText.indexOf('[~cls=') != -1 ? '~' : '';
565    var modStrStart = modText.lastIndexOf('[' + modtype + 'cls=');
566    var modStrEnd = modText.indexOf(modtype + ']') + (modtype + ']').length;
567    var modStr = modText.substr(modStrStart, modStrEnd);
568
569    // Create panel dom
570    modText = $(this).html().replace(modStr, '');
571    var modClass = modStr.replace('[' + modtype + 'cls=', '').replace(modtype + ']', '');
572    var modDom =
573      '<div class="mod-qset uk-panel-box" defcls="' +
574      modClass +
575      '">\
576            <label>عنوان: <input class="mod-title" value="' +
577      modText +
578      '" type="text"></label>\
579            <label>کلاس: <input dir="ltr" class="mod-calss" value="' +
580      modClass +
581      '" type="text"></label>\
582            <label>شمایل پنهان: <input class="mod-type" type="checkbox"></label>\
583            <a class="mod-submit uk-button uk-button-primary" onclick="ModQuickSet($(this))">ثبت</a>\
584            <style>.mod-qset label {display:inline-block}</style>\
585        </div>';
586
587    // Check authentication
588    var modParent = $(this).parents('.dp-module-title');
589    if ($(this).hasClass('@log')) {
590      modParent.append(modDom);
591      modParent.find('.mod-type').prop('checked', modtype != '' ? true : false);
592
593      $('.mod-title, .mod-calss').on('keyup keypress blur change', function () {
594        $(this).val($(this).val().replace('"', '').replace("'", ''));
595      });
596    } else {
597      $(this)[0].innerHTML = modText;
598      if (modtype != '' ? true : false) {
599        $(this)
600          .hide()
601          .parents('[class*=dp-module]')
602          .attr('class', function (i, c) {
603            return c.replace(/(^|\s)dp-module\S+/g, '');
604          });
605      }
606    }
607    modParent.parent().addClass(modClass);
608  });
609})(); // end of custom class panel
610// } // end of html ready
611
612// END
613// 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.