PageSourceSearch

https://asemconnectvietnam.gov.vn/assets/js/core.js

js asemconnectvietnam.gov.vn collected 2026-10-02 22:49:09 UTC 6,534 bytes, 286 lines download raw bytes

1/*!
2 * remark v1.0.7 (http://getbootstrapadmin.com/remark)
3 * Copyright 2015 amazingsurge
4 * Licensed under the Themeforest Standard Licenses
5 */
6(function(window, document, $) {
7  'use strict';
8
9  var $doc = $(document);
10
11  // Site
12  // ====
13  $.site = $.site || {};
14
15  $.extend($.site, {
16    _queue: {
17      prepare: [],
18      run: [],
19      complete: []
20    },
21
22    run: function() {
23      var self = this;
24
25      this.dequeue('prepare', function() {
26        self.trigger('before.run', self);
27      });
28
29      this.dequeue('run', function() {
30        self.dequeue('complete', function() {
31          self.trigger('after.run', self);
32        });
33      });
34    },
35
36    dequeue: function(name, done) {
37      var self = this,
38        queue = this.getQueue(name),
39        fn = queue.shift(),
40        next = function() {
41          self.dequeue(name, done);
42        };
43
44      if (fn) {
45        fn.call(this, next);
46      } else if ($.isFunction(done)) {
47        done.call(this);
48      }
49    },
50
51    getQueue: function(name) {
52      if (!$.isArray(this._queue[name])) {
53        this._queue[name] = [];
54      }
55
56      return this._queue[name];
57    },
58
59    extend: function(obj) {
60      $.each(this._queue, function(name, queue) {
61        if ($.isFunction(obj[name])) {
62          queue.push(obj[name]);
63
64          delete obj[name];
65        }
66      });
67
68      $.extend(this, obj);
69
70      return this;
71    },
72
73    trigger: function(name, data, $el) {
74      if (typeof name === 'undefined') return;
75      if (typeof $el === 'undefined') $el = $doc;
76
77      $el.trigger(name + '.site', data);
78    },
79
80    throttle: function(func, wait) {
81      var _now = Date.now || function() {
82        return new Date().getTime();
83      };
84      var context, args, result;
85      var timeout = null;
86      var previous = 0;
87
88      var later = function() {
89        previous = _now();
90        timeout = null;
91        result = func.apply(context, args);
92        context = args = null;
93      };
94
95      return function() {
96        var now = _now();
97        var remaining = wait - (now - previous);
98        context = this;
99        args = arguments;
100        if (remaining <= 0) {
101          clearTimeout(timeout);
102          timeout = null;
103          previous = now;
104          result = func.apply(context, args);
105          context = args = null;
106        } else if (!timeout) {
107          timeout = setTimeout(later, remaining);
108        }
109        return result;
110      };
111    },
112
113    resize: function() {
114      if (document.createEvent) {
115        var ev = document.createEvent('Event');
116        ev.initEvent('resize', true, true);
117        window.dispatchEvent(ev);
118      } else {
119        element = document.documentElement;
120        var event = document.createEventObject();
121        element.fireEvent("onresize", event);
122      }
123    }
124  });
125
126  // Configs
127  // =======
128  $.configs = $.configs || {};
129
130  $.extend($.configs, {
131    data: {},
132    get: function(name) {
133      var callback = function(data, name) {
134        return data[name];
135      }
136
137      var data = this.data;
138
139      for (var i = 0; i < arguments.length; i++) {
140        name = arguments[i];
141
142        data = callback(data, name);
143      }
144
145      return data;
146    },
147
148    set: function(name, value) {
149      this.data[name] = value;
150    },
151
152    extend: function(name, options) {
153      var value = this.get(name);
154      return $.extend(true, value, options);
155    }
156  });
157
158  // Colors
159  // ======
160  $.colors = function(name, level) {
161    if (name === 'primary') {
162      name = $.configs.get('site', 'primaryColor');
163      if (!name) {
164        name = 'red';
165      }
166    }
167
168    if (typeof $.configs.colors[name] !== 'undefined') {
169      if (level && typeof $.configs.colors[name][level] !== 'undefined') {
170        return $.configs.colors[name][level];
171      }
172
173      if (typeof level === 'undefined') {
174        return $.configs.colors[name];
175      }
176    }
177
178    return null;
179  };
180
181  // Components
182  // ==========
183  $.components = $.components || {};
184
185  $.extend($.components, {
186    _components: {},
187
188    register: function(name, obj) {
189      this._components[name] = obj;
190    },
191
192    init: function(name, context, args) {
193      var self = this;
194
195      if (typeof name === 'undefined') {
196        $.each(this._components, function(name) {
197          self.init(name);
198        });
199      } else {
200        context = context || document;
201        args = args || [];
202
203        var obj = this.get(name);
204
205        if (obj) {
206          switch (obj.mode) {
207            case 'default':
208              return this._initDefault(name, context);
209            case 'init':
210              return this._initComponent(name, obj, context, args);
211            case 'api':
212              return this._initApi(name, obj, args);
213            default:
214              this._initApi(name, obj, context, args);
215              this._initComponent(name, obj, context, args);
216              return;
217          }
218        }
219      }
220    },
221
222    /* init alternative, but only or init mode */
223    call: function(name, context) {
224      var args = Array.prototype.slice.call(arguments, 2);
225      var obj = this.get(name);
226
227      context = context || document;
228
229      return this._initComponent(name, obj, context, args);
230    },
231
232    _initDefault: function(name, context) {
233      if (!$.fn[name]) return;
234
235      var defaults = this.getDefaults(name);
236
237      $('[data-plugin=' + name + ']', context).each(function() {
238        var $this = $(this),
239          options = $.extend(true, {}, defaults, $this.data());
240
241        $this[name](options);
242      });
243    },
244
245
246    _initComponent: function(name, obj, context, args) {
247      if ($.isFunction(obj.init)) {
248        obj.init.apply(obj, [context].concat(args));
249      }
250    },
251
252    _initApi: function(name, obj, args) {
253      if (typeof obj.apiCalled === 'undefined' && $.isFunction(obj.api)) {
254        obj.api.apply(obj, args);
255
256        obj.apiCalled = true;
257      }
258    },
259
260
261    getDefaults: function(name) {
262      var component = this.get(name);
263
264      if (component && typeof component.defaults !== "undefined") {
265        return component.defaults;
266      } else {
267        return {};
268      }
269    },
270
271    get: function(name, property) {
272      if (typeof this._components[name] !== "undefined") {
273        if (typeof property !== "undefined") {
274          return this._components[name][property];
275        } else {
276          return this._components[name];
277        }
278      } else {
279        console.warn('component:' + component + ' script is not loaded.');
280
281        return undefined;
282      }
283    }
284  });
285
286})(window, document, 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.