From 634c52b9deef1d0cbc781a73fcdc9d508ada7eaa Mon Sep 17 00:00:00 2001
From: xamgore <xamgore@ya.ru>
Date: Sat, 9 Jul 2016 12:44:26 +0300
Subject: [PATCH] Move auxiliary functions to main js module

---
 media/js/config.js                   | 10 ++++++++++
 media/js/discipline/editStructure.js | 10 +---------
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/media/js/config.js b/media/js/config.js
index 2626a555d..281d0427b 100644
--- a/media/js/config.js
+++ b/media/js/config.js
@@ -11,6 +11,16 @@ $.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;
 
diff --git a/media/js/discipline/editStructure.js b/media/js/discipline/editStructure.js
index 4a41aa5e9..a73436b0f 100644
--- a/media/js/discipline/editStructure.js
+++ b/media/js/discipline/editStructure.js
@@ -22,15 +22,7 @@ $(document).ready(function () {
                 sum += parseInt(0 + ( asText ? $(this).text() : $(this).val() ))
             });
             return sum;
-        },
-
-        turnOn: function () {
-            return $(this).prop('disabled', false)
-        },
-
-        turnOff: function () {
-            return $(this).prop('disabled', true)
-        },
+        }
     });
 
 
-- 
GitLab