PageSourceSearch

https://www.ulsturch.mn/static/webs/ulsturch/js/core.js?v=1

js ulsturch.mn collected 2026-10-02 19:07:35 UTC 7,796 bytes, 185 lines download raw bytes

1const $sodon = {
2    get: function (url, callback) {
3    },
4    getJson: function (url, formId, callback) {
5        const headers = new Headers();
6        headers.append('Accept', 'application/json');
7        let params = ``;
8        if (formId !== undefined && formId !== null && typeof formId === 'string' && typeof formId !== 'function') {
9            const formEl = document.getElementById(formId);
10            if (formEl === null) {
11                console.log('Алдаа гарлаа: form element олдсонгүй!');
12                return;
13            }
14            params = new URLSearchParams(new FormData(formEl)).toString();
15            params = `?` + params;
16        }
17
18        fetch(url + params, {
19            method: 'GET',
20            headers: headers
21        })
22            .then(response => response.json())
23            .then((response) => {
24                if (formId !== undefined && formId !== null && typeof formId === 'function') {
25                    formId(response);
26                } else if (callback !== undefined && callback !== null && typeof callback === 'function') {
27                    callback(response);
28                }
29            })
30            .catch(error => console.error('Алдаа гарлаа: ' + error.message));
31    },
32    getJson2: function (url, data, callback) {
33        const headers = new Headers();
34        headers.append('Accept', 'application/json');
35        fetch(url, {
36            method: 'GET',
37            headers: headers,
38            body: JSON.stringify(data)
39        })
40            .then(response => response.json())
41            .then((response) => {
42                if (callback !== undefined && callback !== null && typeof callback === 'function')
43                    callback(response);
44            })
45            .catch(error => console.error('Алдаа гарлаа: ' + error.message));
46    },
47    post: function (url, callback) {
48    },
49
50    /**
51     * form дамжуулдаг post request-д ашигладаг.
52     * (url, formId, callback)
53     * (url, formId)
54     * (url, callback)
55     */
56    postJson: function (url, formId, callback, callbackError) {
57        const headers = new Headers();
58        headers.append('Accept', 'application/json');
59        const config = {
60            method: 'POST',
61            headers: headers
62        };
63        if (formId !== undefined && formId !== null && typeof formId === 'string' && typeof formId !== 'function') {
64            const formEl = document.getElementById(formId);
65            if (formEl === null) {
66                console.log('Алдаа гарлаа: form element олдсонгүй!');
67                return;
68            }
69            config.body = new FormData(formEl);
70        }
71        fetch(url, config)
72            .then(response => response.json())
73            .then((response) => {
74                if (formId !== undefined && formId !== null && typeof formId === 'function') {
75                    formId(response);
76                } else if (callback !== undefined && callback !== null && typeof callback === 'function') {
77                    callback(response);
78                }
79            })
80            .catch(error => {
81                console.log('Алдаа гарлаа: ' + error.message);
82                if (callbackError !== undefined && callbackError !== null && typeof callbackError === 'function')
83                    callbackError(error);
84            });
85    },
86    postJson2: function (url, data, callback, callbackError) {
87        const headers = new Headers();
88        headers.append('Accept', 'application/json');
89        headers.append('Content-Type', 'application/json');
90        fetch(url, {
91            method: 'POST',
92            headers: headers,
93            body: JSON.stringify(data)
94        })
95            .then(response => response.json())
96            .then((response) => {
97                if (callback !== undefined && callback !== null && typeof callback === 'function')
98                    callback(response);
99            })
100            .catch(error => {
101                console.log('Алдаа гарлаа: ' + error.message);
102                if (callbackError !== undefined && callbackError !== null && typeof callbackError === 'function')
103                    callbackError(error);
104            });
105    },
106    numberFormat: function (number, decimals, dec_point, thousands_sep) {
107        // http://kevin.vanzonneveld.net/techblog/article/javascript_equivalent_for_phps_number_format/
108        number = (number + '').replace(/[^0-9+\-Ee.]/g, '');
109        var n = !isFinite(+number) ? 0 : +number,
110            prec = !isFinite(+decimals) ? 0 : Math.abs(decimals),
111            sep = (typeof thousands_sep === 'undefined') ? ',' : thousands_sep,
112            dec = (typeof dec_point === 'undefined') ? '.' : dec_point,
113            s = '',
114            toFixedFix = function (n, prec) {
115                var k = Math.pow(10, prec);
116                return '' + Math.round(n * k) / k;
117            };
118        // Fix for IE parseFloat(0.55).toFixed(0) = 0;
119        s = (prec ? toFixedFix(n, prec) : '' + Math.round(n)).split('.');
120        if (s[0].length > 3) {
121            s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep);
122        }
123        if ((s[1] || '').length < prec) {
124            s[1] = s[1] || '';
125            s[1] += new Array(prec - s[1].length + 1).join('0');
126        }
127        return s.join(dec);
128    },
129    deNumberFormat: function (value) {
130        value = value.replace(/,/g, '');
131        return parseInt(value);
132    },
133    deFloatNumberFormat: function (value) {
134        value = value.replace(/,/g, '');
135        return parseFloat(value);
136    }
137}
138
139class Tab_interaction {
140    length = 0;
141    current = 0;
142    element = null;
143
144    constructor(element) {
145        if (element)
146            this.element = element;
147        if (this.element !== null && this.element !== undefined) {
148            if (document.querySelector(this.element)) {
149                document.querySelector(this.element).querySelectorAll('.tab-button').forEach((el, i) => {
150                    el.setAttribute("data-index", i);
151                    this.length++
152                });
153            } else
154                console.error("Couldn't find element with matching id");
155        } else {
156            console.error('You must specify an element with id');
157        }
158    }
159
160    click(that, callback) {
161        if (this.element && document.querySelector(this.element)) {
162            document.querySelector(this.element).querySelectorAll('.tab-button').forEach((el, i) => {
163                el.classList.remove("active");
164            });
165            document.querySelector(this.element).querySelectorAll('.tab-item').forEach((el, i) => {
166                el.classList.remove("open");
167                if (that.getAttribute("data-index") === i.toString())
168                    el.classList.add("open");
169            });
170            that.classList.add("active");
171            if (callback !== undefined && typeof callback === "function")
172                callback();
173        }
174    }
175}
176
177/* мэдээний хажуу талд зураг оруулахад зай авна*/
178document.addEventListener("DOMContentLoaded", () => {
179    document.getElementById("articleText").querySelectorAll("img").forEach(item => {
180        if (item.style.float !== "" && item.style.float === "left")
181            item.style.marginRight = 20 + 'px'
182        if (item.style.float !== "" && item.style.float === "right")
183            item.style.marginLeft = 20 + 'px'
184    })
185})

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.