/** @deprecated */ var g_URLdir = '/~dev_rating/'; var URLdir = g_URLdir; var g_SitePath = 'http://mmcs.sfedu.ru/rating'; var SitePath = g_SitePath; // Далее юзаем глобальные переменные с префиксом "g" // Common.js $.postJSON = function (url, data, callback) { return $.post(url, data, callback, 'json'); }; $.fn.extend({ turnOn: function () { return $(this).prop('disabled', false) }, turnOff: function () { return $(this).prop('disabled', true) }, }); var Auth = (function () { var allowRequest = true; return { signIn: function (login, pass) { if (!allowRequest) return; allowRequest = false; var self = this; this.onDeprecate(); return $.postJSON(URLdir + 'handler/sign/in', { 'login': login, 'password': pass, }).always(_ => { allowRequest = true; self.onAllow(); }); }, onAllow: function () { }, onDeprecate: function () { } } })(); var Watcher = (function () { var timer = 0; return function (ms, callback) { clearTimeout(timer); timer = setTimeout(callback, ms); }; })(); Element.prototype.hasClass = function (className) { return new RegExp(' ' + className + ' ').test(' ' + this.className + ' '); }; Element.prototype.addClass = function (className) { if (!this.hasClass(className)) { this.className += ' ' + className; } }; Element.prototype.removeClass = function (className) { var newClass = ' ' + this.className.replace(/[\t\r\n]/g, ' ') + ' '; if (this.hasClass(className)) { while (newClass.indexOf(' ' + className + ' ') >= 0) { newClass = newClass.replace(' ' + className + ' ', ' '); } this.className = newClass.replace(/^\s+|\s+$/g, ' '); } }; Element.prototype.toggleClass = function (className) { var newClass = ' ' + this.className.replace(/[\t\r\n]/g, " ") + ' '; if (this.hasClass(className)) { while (newClass.indexOf(" " + className + " ") >= 0) { newClass = newClass.replace(" " + className + " ", " "); } this.className = newClass.replace(/^\s+|\s+$/g, ' '); } else { this.className += ' ' + className; } };