Просмотр исходного кода

하위 호환성 때문에 다시 변경

Surplus_Up (2DU) 6 лет назад
Родитель
Сommit
7b785016e5

+ 1 - 1
route/list_please.py

@@ -14,7 +14,7 @@ def list_please_2(conn):
     curs.execute(db_change("select distinct title from back where type = 'no' order by title asc limit ?, 50"), [sql_num])
     data_list = curs.fetchall()
     for data in data_list:
-        div += '<li><a class="not_thing" href="/w/' + url_pas(data[0]) + '">' + data[0] + '</a></li>'
+        div += '<li><a id="not_thing" href="/w/' + url_pas(data[0]) + '">' + data[0] + '</a></li>'
 
     div += '</ul>' + next_fix('/please?num=', num, data_list)
 

+ 1 - 1
route/search_deep.py

@@ -21,7 +21,7 @@ def search_deep_2(conn, name):
     if curs.fetchall():
         link_id = ''
     else:
-        link_id = 'class="not_thing"'
+        link_id = 'id="not_thing"'
 
     div =   '''
             <ul>

+ 1 - 1
route/tool/func.py

@@ -620,7 +620,7 @@ def ip_pas(raw_ip, type_d = 0):
             if curs.fetchall():
                 ip = '<a href="/w/' + url_pas('user:' + raw_ip) + '">' + raw_ip + '</a>'
             else:
-                ip = '<a class="not_thing" href="/w/' + url_pas('user:' + raw_ip) + '">' + raw_ip + '</a>'
+                ip = '<a id="not_thing" href="/w/' + url_pas('user:' + raw_ip) + '">' + raw_ip + '</a>'
 
             if admin_check('all', None, raw_ip) == 1:
                 ip = '<b>' + ip + '</b>'

+ 3 - 3
route/tool/set_mark/namumark.py

@@ -533,7 +533,7 @@ def namumark(conn, data, title, main_num, include_num):
 
                 plus_data += '<script>load_include("' + include_link + '", "include_' + str(i) + '", ' + str(include_plus_data) + ');</script>'
             else:
-                data = include_re.sub('<a class="not_thing" href="/w/' + tool.url_pas(include_link) + '">[' + include_link + ']</a>', data, 1)
+                data = include_re.sub('<a id="not_thing" href="/w/' + tool.url_pas(include_link) + '">[' + include_link + ']</a>', data, 1)
         else:
             break
 
@@ -972,7 +972,7 @@ def namumark(conn, data, title, main_num, include_num):
                 else:
                     data = re.sub(
                         '\[\[((?:(?!\[\[|\]\]).)+)\]\]',
-                        '<a class="not_thing" href="/upload?name=' + tool.url_pas(file_name) + '">' + file_alt + '</a>',
+                        '<a id="not_thing" href="/upload?name=' + tool.url_pas(file_name) + '">' + file_alt + '</a>',
                         data,
                         1
                     )
@@ -1053,7 +1053,7 @@ def namumark(conn, data, title, main_num, include_num):
                         if main_link != '':
                             curs.execute(tool.db_change("select title from data where title = ?"), [main_link])
                             if not curs.fetchall():
-                                link_id = 'class="not_thing"'
+                                link_id = 'id="not_thing"'
 
                                 backlink += [[title, main_link, 'no']]
                             else:

+ 1 - 1
views/main_css/css/main.css

@@ -6,7 +6,7 @@ input { width: 100%; -webkit-box-sizing: border-box; -moz-box-sizing: border-box
 table { border-collapse: collapse; }
 td { border: 1px solid; padding: 5px; }
 a { text-decoration: none; }
-.not_thing { color: red; }
+#not_thing { color: red; }
 #inside, #out_link, #open { color: green; }
 #out_link::before { background: green; color: white; content: "E"; }
 input[type="checkbox"] { width: auto; }

+ 30 - 26
views/main_css/js/render_namumark.js

@@ -14,24 +14,23 @@ function render_namumark(target) {
 
     function get_link_state(link_data) {            
         var xhr = new XMLHttpRequest();
-        xhr.open("GET", "/api/w/" + encodeURI(link_data[0]) + "?exist=1", true);
+        xhr.open("GET", "/api/w/" + encodeURIComponent(link_data[0]) + "?exist=1", true);
         xhr.send(null);
         
         xhr.onreadystatechange = function() {
             if(this.readyState === 4 && this.status === 200) {
                 if(JSON.parse(this.responseText)['exist'] !== '1') {
-                    document.getElementById(link_data[1]).className = "not_thing";
+                    document.getElementsByClassName(link_data[1])[0].id = "not_thing";
                 } else {
-                    document.getElementById(link_data[1]).className = "";
+                    document.getElementsByClassName(link_data[1])[0].id = "";
                 }
             } else {
-                document.getElementById(link_data[1]).className = "not_thing";
+                document.getElementsByClassName(link_data[1])[0].id = "not_thing";
             }
         }
     }
 
     var data = '\n' + document.getElementById(target).innerHTML + '\n';
-    var nowiki_list = [];
 
     var mid_num = 0;
     var mid_stack = 0;
@@ -39,29 +38,31 @@ function render_namumark(target) {
     var html_number = 0;
     data = data.replace(/(?:{{{(?:((?:(?! |{{{|}}}|&lt;).)*) ?)|(}}}))/g, function(all, in_data) {
         if(all === '}}}') {
-            if(!mid_list[mid_num]) {
+            if(mid_stack > 0) {
+                mid_stack -= 1;
+            }
+
+            if(mid_stack > 0) {
                 return all;
             } else {
-                if(mid_stack > 0) {
-                    mid_stack -= 1;
+                if(mid_num > 0) {
+                    mid_num -= 1;
                 }
 
-                if(mid_stack > 0) {
-                    return all;
+                if(!mid_list[mid_num]) {
+                    var return_data = '';
+                } else if(mid_list[mid_num] === 'pre') {
+                    var return_data = '</code></pre>';
                 } else {
-                    if(mid_num > 0) {
-                        mid_num -= 1;
-                    }
-
-                    if(mid_list[mid_num] === 'pre') {
-                        var return_data = '</code></pre>';
-                    } else {
-                        var return_data = '</' + mid_list[mid_num] + '>';
-                    }
+                    var return_data = '</' + mid_list[mid_num] + '>';
+                }
 
+                if(return_data !== '') {
                     mid_list.splice(mid_num, 1);
 
                     return return_data;
+                } else {
+                    return all;
                 }
             }
         } else {
@@ -157,9 +158,10 @@ function render_namumark(target) {
     });
 
     var nowiki_num = 0;
+    var nowiki_list = {};
     data = data.replace(/<code>((?:(?!<\/code>).)+)<\/code>/gm, function(all, in_data) {
         nowiki_num += 1;
-        nowiki_list.push(['nowiki_' + String(nowiki_num), in_data]);
+        nowiki_list['nowiki_' + String(nowiki_num)] = in_data;
 
         return '<span id="nowiki_' + String(nowiki_num) + '"></span>';
     });
@@ -200,20 +202,22 @@ function render_namumark(target) {
                 link_list.push([front_data, 'link_' + String(link_num)]);
                 link_num += 1;
 
-                return '<a id="link_' + String(link_num - 1) + '" href="/w/' + encodeURI(front_data) + '">' + back_name + '</a>'; 
+                return '<a class="link_' + String(link_num - 1) + '" href="/w/' + encodeURIComponent(front_data) + '">' + back_name + '</a>'; 
             });   
         } else {
             if(in_data.match(/^(?:category|분류):/i)) {
-                category += '<a href="' + encodeURI(in_data) + '">' + in_data + '</a> | ';
+                category += '<a href="' + encodeURIComponent(in_data) + '">' + in_data + '</a> | ';
 
                 return '';
             } else if(in_data.match(/^(?:file|파일):/i)) {
 
+            } else if(in_data.match(/^http(?:s)?:\/\//i)) {
+                return '<a id="link_' + String(link_num - 1) + '" href="/w/' + encodeURIComponent(in_data) + '">' + in_data + '</a>'; 
             } else {
                 link_list.push([in_data, 'link_' + String(link_num)]);
                 link_num += 1;
 
-                return '<a id="link_' + String(link_num - 1) + '" href="/w/' + encodeURI(in_data) + '">' + in_data + '</a>'; 
+                return '<a class="link_' + String(link_num - 1) + '" href="/w/' + encodeURIComponent(in_data) + '">' + in_data + '</a>'; 
             }
         }
     });
@@ -406,10 +410,10 @@ function render_namumark(target) {
         data += ref_data + '</ul>';
     }
 
-    i = 0;
+    i = 1;
     while(1) {
-        if(nowiki_list[i]) {
-            data = data.replace('<span id="' + nowiki_list[i][0] + '"></span>', '<code>' + nowiki_list[i][1] + '</code>');
+        if(nowiki_list['nowiki_' + String(i)]) {
+            data = data.replace('<span id="nowiki_' + String(i) + '"></span>', '<code>' + nowiki_list['nowiki_' + String(i)] + '</code>');
 
             i += 1;
         } else {