فهرست منبع

topic 관련 JS 통합

Surplus_Up (2DU) 6 سال پیش
والد
کامیت
530dab7807

+ 1 - 1
route/tool/func.py

@@ -470,7 +470,7 @@ def other2(data):
         data += ['']
 
     req_list = ''
-    main_css_ver = 15
+    main_css_ver = 16
 
     if not 'main_css_load' in flask.session or not 'main_css_ver' in flask.session or flask.session['main_css_ver'] != main_css_ver:
         for i_data in os.listdir(os.path.join("views", "main_css", "css")):

+ 138 - 0
views/main_css/js/load_topic.js

@@ -0,0 +1,138 @@
+function topic_list_load(topic_num, s_num, where) {
+    var o_data = document.getElementById(where);
+    var url = "/api/thread/" + String(topic_num) + "?render=1&num=" + String(s_num);
+    var n_data = "";
+
+    var xhr = new XMLHttpRequest();
+    xhr.open("GET", url, true);
+    xhr.send(null);
+
+    xhr.onreadystatechange = function() {
+        if(this.readyState === 4 && this.status === 200) {
+            var t_data = JSON.parse(this.responseText);
+            var t_plus_data = '';
+            
+            for(key in t_data) {
+                n_data += t_data[key]['data'];
+                t_plus_data += t_data[key]['plus_data'].replace(/<script>/g, '').replace(/<\/script>/g, '');
+            }
+
+            o_data.innerHTML = n_data;
+            eval(t_plus_data);
+        }
+    }
+}
+
+function topic_plus_load(topic_num, num) {
+    var test = setInterval(function() {
+        var url = "/api/thread/" + String(topic_num) + "?num=" + num + "&render=1";
+        var p_data = document.getElementById("plus_topic");
+        var n_data = '';
+        var n_num = 1;
+
+        var xhr = new XMLHttpRequest();
+        xhr.open("GET", url, true);
+        xhr.send(null);
+
+        xhr.onreadystatechange = function() {
+            if(this.readyState === 4 && this.status === 200 && this.responseText !== '{}\n') {
+                var t_data = JSON.parse(this.responseText);
+                var t_plus_data = '';
+
+                for(key in t_data) {
+                    n_data += t_data[key]['data'];
+                    n_num = key;
+
+                    t_plus_data += t_data[key]['plus_data'].replace(/<script>/g, '').replace(/<\/script>/g, '');
+                }
+
+                p_data.innerHTML += n_data;
+                eval(t_plus_data);
+
+                // https://programmingsummaries.tistory.com/379
+                var options = {
+                    body: '#' + n_num
+                }
+
+                var notification = new Notification("openNAMU", options);
+
+                setTimeout(function () {
+                    notification.close();
+                }, 5000);
+
+                topic_plus_load(topic_num, String(Number(num) + 1));
+                clearInterval(test);
+            }
+        }
+    }, 2000);
+}
+
+function topic_main_load(topic_num, s_num) {
+    var o_data = document.getElementById('main_topic');
+    if(s_num) {
+        var url = "/api/thread/" + String(topic_num) + "?render=1&num=" + s_num;
+    } else {
+        var url = "/api/thread/" + String(topic_num) + "?render=1";
+    }
+    var n_data = "";
+    var num = 1;
+
+    var xhr = new XMLHttpRequest();
+    xhr.open("GET", url, true);
+    xhr.send(null);
+
+    xhr.onreadystatechange = function() {
+        if(xhr.readyState === 4 && xhr.status === 200) {
+            var t_data = JSON.parse(xhr.responseText);
+            var t_plus_data = '';
+
+            for(var key in t_data) {
+                n_data += t_data[key]['data'];
+                num = key;
+
+                t_plus_data += t_data[key]['plus_data'].replace(/<script>/g, '').replace(/<\/script>/g, '');
+            }
+
+            o_data.innerHTML = n_data;
+            eval(t_plus_data);
+            if(window.location.search === "?where=bottom") {
+                document.getElementById(num).focus();
+            }
+            
+            if(!s_num) {
+                topic_plus_load(topic_num, String(Number(num) + 1));
+            }
+        }
+    }
+}
+
+function topic_top_load(topic_num) {
+    var o_data = document.getElementById('top_topic');
+    var url = "/api/thread/" + String(topic_num) + "?top=1&render=1";
+    var n_data = "";
+    var num = 1;
+
+    var xhr = new XMLHttpRequest();
+    xhr.open("GET", url, true);
+    xhr.send(null);
+
+    xhr.onreadystatechange = function() {
+        if(this.readyState === 4 && this.status === 200) {
+            var t_data = JSON.parse(this.responseText);
+            var t_plus_data = '';
+
+            for(var key in t_data) {
+                n_data += t_data[key]['data'];
+                num = key;
+
+                t_plus_data += t_data[key]['plus_data'].replace(/<script>/g, '').replace(/<\/script>/g, '');
+            }
+
+            o_data.innerHTML = n_data;
+            eval(t_plus_data);
+
+            topic_main_load(topic_num, null);
+        }
+    }
+
+}

+ 0 - 25
views/main_css/js/topic_list_load.js

@@ -1,25 +0,0 @@
-function topic_list_load(topic_num, s_num, where) {
-    var o_data = document.getElementById(where);
-    var url = "/api/thread/" + String(topic_num) + "?render=1&num=" + String(s_num);
-    var n_data = "";
-
-    var xhr = new XMLHttpRequest();
-    xhr.open("GET", url, true);
-    xhr.send(null);
-
-    xhr.onreadystatechange = function() {
-        if(this.readyState === 4 && this.status === 200) {
-            var t_data = JSON.parse(this.responseText);
-            var t_plus_data = '';
-            
-            for(key in t_data) {
-                n_data += t_data[key]['data'];
-                t_plus_data += t_data[key]['plus_data'].replace(/<script>/g, '').replace(/<\/script>/g, '');
-            }
-
-            o_data.innerHTML = n_data;
-            eval(t_plus_data);
-        }
-    }
-
-}

+ 0 - 43
views/main_css/js/topic_main_load.js

@@ -1,43 +0,0 @@
-function topic_main_load(topic_num, s_num) {
-    var o_data = document.getElementById('main_topic');
-    if(s_num) {
-        var url = "/api/thread/" + String(topic_num) + "?render=1&num=" + s_num;
-    } else {
-        var url = "/api/thread/" + String(topic_num) + "?render=1";
-    }
-    var url_2 = "/api/markup";
-    var n_data = "";
-    var num = 1;
-
-    var xhr = new XMLHttpRequest();
-    xhr.open("GET", url, true);
-    xhr.send(null);
-
-    var xhr_2 = new XMLHttpRequest();
-    xhr_2.open("GET", url_2, true);
-    xhr_2.send(null);
-
-    xhr.onreadystatechange = function() {
-        if(xhr.readyState === 4 && xhr.status === 200) {
-            var t_data = JSON.parse(xhr.responseText);
-            var t_plus_data = '';
-
-            for(var key in t_data) {
-                n_data += t_data[key]['data'];
-                num = key;
-
-                t_plus_data += t_data[key]['plus_data'].replace(/<script>/g, '').replace(/<\/script>/g, '');
-            }
-
-            o_data.innerHTML = n_data;
-            eval(t_plus_data);
-            if(window.location.search === "?where=bottom") {
-                document.getElementById(num).focus();
-            }
-            
-            if(!s_num) {
-                topic_plus_load(topic_num, String(Number(num) + 1));
-            }
-        }
-    }
-}

+ 0 - 48
views/main_css/js/topic_plus_load.js

@@ -1,48 +0,0 @@
-function topic_plus_load(topic_num, num) {
-    var test = setInterval(function() {
-        var url = "/api/thread/" + String(topic_num) + "?num=" + num + "&render=1";
-        var p_data = document.getElementById("plus_topic");
-        var n_data = '';
-        var n_num = 1;
-        var url_2 = "/api/markup";
-
-        var xhr = new XMLHttpRequest();
-        xhr.open("GET", url, true);
-        xhr.send(null);
-
-        var xhr_2 = new XMLHttpRequest();
-        xhr_2.open("GET", url_2, true);
-        xhr_2.send(null);
-
-        xhr.onreadystatechange = function() {
-            if(this.readyState === 4 && this.status === 200 && this.responseText !== '{}\n') {
-                var t_data = JSON.parse(this.responseText);
-                var t_plus_data = '';
-
-                for(key in t_data) {
-                    n_data += t_data[key]['data'];
-                    n_num = key;
-
-                    t_plus_data += t_data[key]['plus_data'].replace(/<script>/g, '').replace(/<\/script>/g, '');
-                }
-
-                p_data.innerHTML += n_data;
-                eval(t_plus_data);
-
-                // https://programmingsummaries.tistory.com/379
-                var options = {
-                    body: '#' + n_num
-                }
-
-                var notification = new Notification("openNAMU", options);
-
-                setTimeout(function () {
-                    notification.close();
-                }, 5000);
-
-                topic_plus_load(topic_num, String(Number(num) + 1));
-                clearInterval(test);
-            }
-        }
-    }, 2000);
-}

+ 0 - 30
views/main_css/js/topic_top_load.js

@@ -1,30 +0,0 @@
-function topic_top_load(topic_num) {
-    var o_data = document.getElementById('top_topic');
-    var url = "/api/thread/" + String(topic_num) + "?top=1&render=1";
-    var n_data = "";
-    var num = 1;
-
-    var xhr = new XMLHttpRequest();
-    xhr.open("GET", url, true);
-    xhr.send(null);
-
-    xhr.onreadystatechange = function() {
-        if(this.readyState === 4 && this.status === 200) {
-            var t_data = JSON.parse(this.responseText);
-            var t_plus_data = '';
-
-            for(var key in t_data) {
-                n_data += t_data[key]['data'];
-                num = key;
-
-                t_plus_data += t_data[key]['plus_data'].replace(/<script>/g, '').replace(/<\/script>/g, '');
-            }
-
-            o_data.innerHTML = n_data;
-            eval(t_plus_data);
-
-            topic_main_load(topic_num, null);
-        }
-    }
-
-}