Ver Fonte

Merge pull request #2142 from openNAMU/dev

편집 필터, 토론 일부 개선
잉여개발기 há 2 anos atrás
pai
commit
3bb42cffec
5 ficheiros alterados com 52 adições e 19 exclusões
  1. 9 16
      route/filter_all_add.py
  2. 1 1
      route/tool/func.py
  3. 2 1
      route/topic.py
  4. 1 1
      version.json
  5. 39 0
      views/main_css/js/route/topic.js

+ 9 - 16
route/filter_all_add.py

@@ -25,8 +25,11 @@ def filter_all_add(tool, name = None):
                 
                 admin_check(conn, None, tool + ' edit')
             elif tool == 'edit_filter':
-                sec = flask.request.form.get('second', '0')
-                end = 'X' if sec == '0' else sec
+                day = flask.request.form.get('day', '0')
+                end = 'X' if day == '0' else day
+                if end != 'X':
+                    end = re.sub(r'[^0-9]', '', end)
+                    end = str(int(number_check(end)) * 24 * 60 * 60)
 
                 content = flask.request.form.get('content', 'test')
                 try:
@@ -150,27 +153,17 @@ def filter_all_add(tool, name = None):
                 if exist:
                     textarea = exist[0][0]
                     time_data = '' if exist[0][1] == 'X' else exist[0][1]
+                    if time_data != '':
+                        time_data = re.sub(r'[^0-9]', '', time_data)
+                        time_data = str(int(int(number_check(time_data)) / (24 * 60 * 60)))
                 else:
                     textarea = ''
                     time_data = ''
 
-                insert_data = ''
-                if stat == '':
-                    t_data = [
-                        ['86400', get_lang(conn, '1_day')],
-                        ['432000', get_lang(conn, '5_day')],
-                        ['2592000', get_lang(conn, '30_day')],
-                        ['15552000', get_lang(conn, '180_day')],
-                        ['31104000', get_lang(conn, '360_day')],
-                        ['0', get_lang(conn, 'limitless')]
-                    ]
-                    insert_data += ''.join(['<a href="javascript:opennamu_insert_v(\'second\', \'' + for_a[0] + '\')">(' + for_a[1] + ')</a> ' for for_a in t_data])
-
                 title = get_lang(conn, 'edit_filter_add')
                 form_data = '''
-                    ''' + insert_data + '''
                     <hr class="main_hr">
-                    <input placeholder="''' + get_lang(conn, 'second') + '''" id="second" name="second" type="text" value="''' + html.escape(time_data) + '''">
+                    <input placeholder="''' + get_lang(conn, 'day') + '''" name="day" type="text" value="''' + html.escape(time_data) + '''">
                     <hr class="main_hr">
                     <input placeholder="''' + get_lang(conn, 'regex') + '''" name="content" value="''' + html.escape(textarea) + '''" type="text">
                 '''

+ 1 - 1
route/tool/func.py

@@ -1043,7 +1043,7 @@ def skin_check(conn, set_n = 0):
         return skin
     
 def cache_v():
-    return '.cache_v232'
+    return '.cache_v233'
 
 def wiki_css(data):
     global global_wiki_set

+ 2 - 1
route/topic.py

@@ -150,7 +150,8 @@ def topic(topic_num = 0, do_type = '', doc_name = 'Test'):
                         opennamu_get_thread("''' + topic_num + '''");
                     </script>
 
-                    <a href="javascript:opennamu_thread_blind();">(''' + get_lang(conn, 'hide') + ''' | ''' + get_lang(conn, 'hide_release') + ''')</a>
+                    <a href="javascript:opennamu_thread_blind();">(''' + get_lang(conn, 'hide') + ''' | ''' + get_lang(conn, 'hide_release') + ''')</a> 
+                    <a href="javascript:opennamu_thread_delete();">(''' + get_lang(conn, 'delete') + ''')</a>
                     <a href="/thread/''' + topic_num + '/tool">(' + get_lang(conn, 'topic_tool') + ''')</a>
                     <hr class="main_hr">
                     

+ 1 - 1
version.json

@@ -1,6 +1,6 @@
 {
     "beta" : {
-        "r_ver" : "v3.5.0-dev77",
+        "r_ver" : "v3.5.0-dev78",
         "c_ver" : "3500376",
         "s_ver" : "3500113"
     }

+ 39 - 0
views/main_css/js/route/topic.js

@@ -15,6 +15,45 @@ function opennamu_do_remove_blind_thread() {
     }
 }
 
+function opennamu_thread_delete() {
+    let lang_data = new FormData();
+    lang_data.append('data', 'delete');
+
+    fetch('/api/lang', {
+        method : 'post',
+        body : lang_data,
+    }).then(function(res) {
+        return res.json();
+    }).then(function(lang) {
+        lang = lang["data"];
+
+        let check_list = [];
+        let check_list_str = '';
+        for(let for_a = 0; for_a < document.getElementsByClassName("opennamu_blind_button").length; for_a++) {
+            let id = document.getElementsByClassName("opennamu_blind_button")[for_a].id;
+            id = id.replace(/^opennamu_blind_/, '');
+            id = id.split('_');
+    
+            let checked = document.getElementsByClassName("opennamu_blind_button")[for_a].checked;
+            if(checked) {
+                check_list.push([id[0], id[1]]);
+                check_list_str += '#' + id[1] + ' ';
+            }
+        }
+
+        let check = confirm(check_list_str + lang[0]);
+        if(check === true) {
+            for(let for_a = 0; for_a < check_list.length; for_a++) {
+                fetch("/thread/" + check_list[for_a][0] + '/comment/' + check_list[for_a][1] + '/delete', { method : 'POST' });
+            }
+
+            if(check_list.length > 0) {
+                history.go(0);
+            }
+        }
+    });
+}
+
 function opennamu_thread_blind() {
     let do_true = 0;
     for(let for_a = 0; for_a < document.getElementsByClassName("opennamu_blind_button").length; for_a++) {