Răsfoiți Sursa

CSS, JS 파일 정리

Surplus_Up (2DU) 7 ani în urmă
părinte
comite
5a80eed585

+ 1 - 1
route/login.py

@@ -48,7 +48,7 @@ def login_2(conn):
         return redirect('/user')  
     else:
         oauth_check = 0
-        oauth_content = '<link rel="stylesheet" href="/views/main_css/oauth.css"><hr class=\"main_hr\"><div class="oauth-wrapper"><ul class="oauth-list">'
+        oauth_content = '<hr class=\"main_hr\"><div class="oauth-wrapper"><ul class="oauth-list">'
         oauth_supported = load_oauth('_README')['support']
         for i in range(len(oauth_supported)):
             oauth_data = load_oauth(oauth_supported[i])

+ 15 - 2
route/tool/func.py

@@ -432,8 +432,21 @@ def next_fix(link, num, page, end = 50):
 
 def other2(data):
     data += ['', '''
-        <link rel="stylesheet" href="/views/main_css/main.css">
-        <script src="/views/main_css/main.js"></script>
+        <link rel="stylesheet" href="/views/main_css/css/main.css">
+        <link rel="stylesheet" href="/views/main_css/css/oauth.css">
+        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/default.min.css">
+        <link   rel="stylesheet"
+                href="https://cdn.jsdelivr.net/npm/katex@0.10.1/dist/katex.min.css"
+                integrity="sha384-dbVIfZGuN1Yq7/1Ocstc1lUEm+AT+/rCkibIcC/OmWo5f0EA48Vf8CytHzGrSwbQ"
+                crossorigin="anonymous">
+        <script src="/views/main_css/js/open_foot.js"></script>
+        <script src="/views/main_css/js/folding.js"></script>
+        <script src="/views/main_css/js/topic_load.js"></script>
+        <script src="/views/main_css/js/do_preview.js"></script>
+        <script src="https://cdn.jsdelivr.net/npm/katex@0.10.1/dist/katex.min.js"
+                integrity="sha384-2BKqo+exmr9su6dir+qCw08N2ZKRucY4PrGQPPWU1A7FtlCGjmEGFqXCv5nyM5Ij"
+                crossorigin="anonymous"></script>
+        <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
     ''']
 
     return data

+ 1 - 16
route/tool/set_mark/namu.py

@@ -238,11 +238,7 @@ def middle_parser(data, fol_num, syntax_num, folding_num):
                                                         middle_data_2 = ['python']
 
                                                     if syntax_num == 0:
-                                                        plus_data +=    '''
-                                                                        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/default.min.css">
-                                                                        <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
-                                                                        <script>hljs.initHighlightingOnLoad();</script>
-                                                                        '''
+                                                        plus_data += '<script>hljs.initHighlightingOnLoad();</script>'
 
                                                         syntax_num = 1
 
@@ -481,17 +477,6 @@ def namu(conn, data, title, main_num):
     while 1:
         math = math_re.search(data)
         if math:
-            if first == 0:
-                plus_data += '''
-                    <link   rel="stylesheet"
-                            href="https://cdn.jsdelivr.net/npm/katex@0.10.1/dist/katex.min.css"
-                            integrity="sha384-dbVIfZGuN1Yq7/1Ocstc1lUEm+AT+/rCkibIcC/OmWo5f0EA48Vf8CytHzGrSwbQ"
-                            crossorigin="anonymous">
-                    <script src="https://cdn.jsdelivr.net/npm/katex@0.10.1/dist/katex.min.js"
-                            integrity="sha384-2BKqo+exmr9su6dir+qCw08N2ZKRucY4PrGQPPWU1A7FtlCGjmEGFqXCv5nyM5Ij"
-                            crossorigin="anonymous"></script>
-                '''
-
             math = math.groups()[0]
             
             first += 1

+ 0 - 0
views/main_css/main.css → views/main_css/css/main.css


+ 0 - 0
views/main_css/oauth.css → views/main_css/css/oauth.css


+ 19 - 0
views/main_css/js/do_preview.js

@@ -0,0 +1,19 @@
+function do_preview(name) {
+    var o_data = document.getElementById('content');
+    var p_data = document.getElementById('see_preview');
+
+    var s_data = new FormData();
+    s_data.append('data', o_data.value);
+
+    var url = "/api/w/" + name;
+    
+    var xhr = new XMLHttpRequest();
+    xhr.open("POST", url, true);
+    xhr.send(s_data);
+
+    xhr.onreadystatechange = function() {
+        if(this.readyState === 4 && this.status === 200) {
+            p_data.innerHTML = JSON.parse(this.responseText)['data'];
+        }
+    }
+}

+ 8 - 0
views/main_css/js/folding.js

@@ -0,0 +1,8 @@
+function folding(num) { 
+    var fol = document.getElementById('folding_' + num); 
+    if(fol.style.display === 'inline-block' || fol.style.display === 'block') { 
+        fol.style.display = 'none';
+    } else {
+        fol.style.display = 'block'; 
+    } 
+}

+ 12 - 0
views/main_css/js/open_foot.js

@@ -0,0 +1,12 @@
+function open_foot(name) {
+    var o_data = document.getElementById('c' + name);
+    
+    name = name.replace(/\.([0-9]+)$/, '');
+    var g_data = document.getElementById(name);
+
+    if(o_data.innerHTML === '') {
+        o_data.innerHTML += '<sup><a onclick="open_foot(\'' + name + '\')" href="#' + name + '">(Go)</a></sup> ' + g_data.innerHTML;
+    } else {
+        o_data.innerHTML = '';
+    }
+}

+ 34 - 0
views/main_css/js/topic_load.js

@@ -0,0 +1,34 @@
+function topic_load(name, sub) {
+    function addZero(i) {
+        if(i < 10) {
+            i = "0" + i;
+        }
+        
+        return i;
+    }
+
+    setTimeout(function() {
+        var test = setInterval(function() {
+            var d = new Date();
+            d.setSeconds(d.getSeconds() - 3);
+            
+            var date = d.getFullYear() + '-' + addZero(d.getMonth() + 1) + '-' + addZero(d.getDate());
+            date += ' ' + addZero(d.getHours()) + ':' + addZero(d.getMinutes()) + ':' + addZero(d.getSeconds());
+
+            var url = "/api/topic/" + name + "/sub/" + sub + "?time=" + date;
+            var xhr = new XMLHttpRequest();
+            var doc_data = document.getElementById("plus");
+
+            xhr.open("GET", url, true);
+            xhr.send(null);
+
+            xhr.onreadystatechange = function() {
+                if(this.readyState === 4 && this.status === 200 && this.responseText !== "{}\n") {
+                    doc_data.innerText += '(New)\n\n';
+
+                    clearInterval(test);
+                }
+            }
+        }, 1000)
+    }, 4000);
+}

+ 0 - 76
views/main_css/main.js

@@ -1,76 +0,0 @@
-function open_foot(name) {
-    var o_data = document.getElementById('c' + name);
-    
-    name = name.replace(/\.([0-9]+)$/, '');
-    var g_data = document.getElementById(name);
-
-    if(o_data.innerHTML === '') {
-        o_data.innerHTML += '<sup><a onclick="open_foot(\'' + name + '\')" href="#' + name + '">(Go)</a></sup> ' + g_data.innerHTML;
-    } else {
-        o_data.innerHTML = '';
-    }
-}
-
-function topic_load(name, sub) {
-    function addZero(i) {
-        if(i < 10) {
-            i = "0" + i;
-        }
-        
-        return i;
-    }
-
-    setTimeout(function() {
-        var test = setInterval(function() {
-            var d = new Date();
-            d.setSeconds(d.getSeconds() - 3);
-            
-            var date = d.getFullYear() + '-' + addZero(d.getMonth() + 1) + '-' + addZero(d.getDate());
-            date += ' ' + addZero(d.getHours()) + ':' + addZero(d.getMinutes()) + ':' + addZero(d.getSeconds());
-
-            var url = "/api/topic/" + name + "/sub/" + sub + "?time=" + date;
-            var xhr = new XMLHttpRequest();
-            var doc_data = document.getElementById("plus");
-
-            xhr.open("GET", url, true);
-            xhr.send(null);
-
-            xhr.onreadystatechange = function() {
-                if(this.readyState === 4 && this.status === 200 && this.responseText !== "{}\n") {
-                    doc_data.innerText += '(New)\n\n';
-
-                    clearInterval(test);
-                }
-            }
-        }, 1000)
-    }, 4000);
-}
-
-function folding(num) { 
-    var fol = document.getElementById('folding_' + num); 
-    if(fol.style.display === 'inline-block' || fol.style.display === 'block') { 
-        fol.style.display = 'none';
-    } else {
-        fol.style.display = 'block'; 
-    } 
-}
-
-function do_preview(name) {
-    var o_data = document.getElementById('content');
-    var p_data = document.getElementById('see_preview');
-
-    var s_data = new FormData();
-    s_data.append('data', o_data.value);
-
-    var url = "/api/w/" + name;
-    
-    var xhr = new XMLHttpRequest();
-    xhr.open("POST", url, true);
-    xhr.send(s_data);
-
-    xhr.onreadystatechange = function() {
-        if(this.readyState === 4 && this.status === 200) {
-            p_data.innerHTML = JSON.parse(this.responseText)['data'];
-        }
-    }
-}