Kaynağa Gözat

버그 수정, JS 방식 수정

Surplus_Up (2DU) 6 yıl önce
ebeveyn
işleme
144ec91d2e

+ 1 - 1
route/tool/func.py

@@ -470,7 +470,7 @@ def other2(data):
         data += ['']
 
     req_list = ''
-    main_css_ver = 18
+    main_css_ver = 19
 
     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")):

+ 13 - 15
route/tool/set_mark/namumark.py

@@ -269,7 +269,7 @@ def middle_parser(data, include_num):
                             middle_data_2 = ['python']
 
                         if syntax_num == 0:
-                            plus_data += '<script>hljs.initHighlightingOnLoad();</script>'
+                            plus_data += 'hljs.initHighlightingOnLoad();\n'
 
                             syntax_num = 1
 
@@ -418,7 +418,7 @@ def namumark(conn, data, title, main_num, include_num):
 
     data = '\n' + data + '\n'
     include_num = include_num + '_' if include_num else ''
-    plus_data = '<script>get_link_state("' + include_num + '"); get_file_state("' + include_num + '");</script>'
+    plus_data = 'get_link_state("' + include_num + '");\nget_file_state("' + include_num + '");\n'
 
     backlink = []
     end_data = {}
@@ -440,16 +440,14 @@ def namumark(conn, data, title, main_num, include_num):
             data = math_re.sub('<span id="math_' + str(first) + '"></span>', data, 1)
 
             plus_data += '''
-                <script>
-                    try {
-                        katex.render(
-                            "''' + html.unescape(math).replace('\\', '\\\\').replace('"', '\\"') + '''",
-                            document.getElementById("math_''' + str(first) + '''")
-                        );
-                    } catch {
-                        document.getElementById("math_''' + str(first) + '''").innerHTML = '<span style="color: red;">''' + math.replace('\\', '\\\\') + '''</span>';
-                    }
-                </script>
+                try {
+                    katex.render(
+                        "''' + html.unescape(math).replace('\\', '\\\\').replace('"', '\\"') + '''",
+                        document.getElementById("math_''' + str(first) + '''")
+                    );
+                } catch {
+                    document.getElementById("math_''' + str(first) + '''").innerHTML = '<span style="color: red;">''' + math.replace('\\', '\\\\') + '''</span>';
+                }\n
             '''
         else:
             break
@@ -512,7 +510,7 @@ def namumark(conn, data, title, main_num, include_num):
                 else:
                     break
 
-            plus_data += '<script>load_include("' + include_link + '", "include_' + str(i) + '", ' + str(include_plus_data) + ');</script>'
+            plus_data += 'load_include("' + include_link + '", "include_' + str(i) + '", ' + str(include_plus_data) + ');\n'
         else:
             break
 
@@ -973,7 +971,7 @@ def namumark(conn, data, title, main_num, include_num):
                     main_link = re.sub('#blur', '', main_link)
 
                 backlink += [[title, main_link, 'cat']]
-                category += '<a class="' + include_num + 'link_finder" href="' + tool.url_pas(main_link) + '">' + category_re.sub('', see_link) + '</a> | '
+                category += '<a class="' + include_num + 'link_finder" href="/w/' + tool.url_pas(main_link) + '">' + category_re.sub('', see_link) + '</a> | '
 
                 data = re.sub('\[\[((?:(?!\[\[|\]\]).)+)\]\]', '', data, 1)
             elif re.search('^wiki:', main_link):
@@ -1244,6 +1242,6 @@ def namumark(conn, data, title, main_num, include_num):
     data = re.sub('\n<\/ul>', '</ul>', data)
     data = re.sub('\n', '<br>', data)
 
-    plus_data = '<script>render_html("' + include_num + 'render_contect");</script>' + plus_data
+    plus_data = 'render_html("' + include_num + 'render_contect");\n' + plus_data
 
     return [data, plus_data, backlink]

+ 1 - 1
version.json

@@ -1,6 +1,6 @@
 {
     "master" : {
-        "r_ver" : "v3.1.6-master-33",
+        "r_ver" : "v3.1.6-master-34",
         "c_ver" : "3160032",
         "s_ver" : "7"
     }, "stable" : {

+ 2 - 6
views/main_css/js/load_namumark.js

@@ -64,15 +64,11 @@ function load_include(title, name, p_data) {
                 document.getElementsByClassName(name)[0].id = "not_thing";
             } else {
                 var o_p_data = JSON.parse(this.responseText);
+                
                 var g_data = o_p_data['data'];
-
                 o_data.innerHTML = g_data;
 
-                js_data = o_p_data['js_data'];
-                js_data = js_data.replace(/<script>/g, '');
-                js_data = js_data.replace(/<\/script>/g, '\n');
-
-                eval(js_data);
+                eval(o_p_data['js_data']);
             }
         }
     }

+ 1 - 7
views/main_css/js/load_preview.js

@@ -19,14 +19,8 @@ function load_preview(name) {
     xhr.onreadystatechange = function() {
         if(xhr.readyState === 4 && xhr.status === 200) {
             var o_p_data = JSON.parse(xhr.responseText);
-
             p_data.innerHTML = o_p_data['data'];
-
-            js_data = o_p_data['js_data'];
-            js_data = js_data.replace(/<script>/g, '');
-            js_data = js_data.replace(/<\/script>/g, '\n');
-
-            eval(js_data)
+            eval(o_p_data['js_data'])
         }
     }
 }

+ 4 - 4
views/main_css/js/load_topic.js

@@ -14,7 +14,7 @@ function topic_list_load(topic_num, s_num, where) {
             
             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, '');
+                t_plus_data += t_data[key]['plus_data'];
             }
 
             o_data.innerHTML = n_data;
@@ -43,7 +43,7 @@ function topic_plus_load(topic_num, num) {
                     n_data += t_data[key]['data'];
                     n_num = key;
 
-                    t_plus_data += t_data[key]['plus_data'].replace(/<script>/g, '').replace(/<\/script>/g, '');
+                    t_plus_data += t_data[key]['plus_data'];
                 }
 
                 p_data.innerHTML += n_data;
@@ -90,7 +90,7 @@ function topic_main_load(topic_num, s_num) {
                 n_data += t_data[key]['data'];
                 num = key;
 
-                t_plus_data += t_data[key]['plus_data'].replace(/<script>/g, '').replace(/<\/script>/g, '');
+                t_plus_data += t_data[key]['plus_data'];
             }
 
             o_data.innerHTML = n_data;
@@ -125,7 +125,7 @@ function topic_top_load(topic_num) {
                 n_data += t_data[key]['data'];
                 num = key;
 
-                t_plus_data += t_data[key]['plus_data'].replace(/<script>/g, '').replace(/<\/script>/g, '');
+                t_plus_data += t_data[key]['plus_data'];
             }
 
             o_data.innerHTML = n_data;