Ver Fonte

다중 블라인드 기능 추가

https://github.com/openNAMU/openNAMU/issues/1997
잉여개발기 (SPDV) há 2 anos atrás
pai
commit
848f43740f

+ 15 - 2
route/api_topic.py

@@ -1,6 +1,6 @@
 from .tool.func import *
 
-def api_topic_thread_make(user_id, date, data, code, color = '', blind = '', add_style = ''):
+def api_topic_thread_make(user_id, date, data, code, color = '', blind = '', add_style = '', admin_check = 1, topic_num = ''):
     if blind == 'O':
         if data == '':
             color_b = 'opennamu_comment_blind'
@@ -12,11 +12,16 @@ def api_topic_thread_make(user_id, date, data, code, color = '', blind = '', add
         color_b = 'opennamu_comment_blind_not'
         class_b = ''
 
+    admin_check_box = ''
+    if admin_check == 1 and topic_num != '':
+        admin_check_box = '<input type="checkbox" class="opennamu_blind_button" id="opennamu_blind_' + topic_num + '_' + code + '">'
+
     return '''
         <span class="''' + class_b + '''">
             <table class="opennamu_comment" style="''' + add_style + '''">
                 <tr>
                     <td class="opennamu_comment_color_''' + color + '''">
+                        ''' + admin_check_box + '''
                         <a href="#thread_shortcut" id="''' + code + '''">#''' + code + '''</a>
                         ''' + user_id + '''
                         <span style="float: right;">''' + date + '''</span>
@@ -196,9 +201,17 @@ def api_topic(topic_num = 1, tool = 'normal', num = '', render = ''):
                                 for_a["id"],
                                 color = color,
                                 blind = for_a["blind"],
-                                add_style = ''
+                                add_style = '',
+                                admin_check = admin if tool == 'normal' else 0,
+                                topic_num = topic_num
                             )
 
+                    if admin == 1 and tool == 'normal':
+                        data_r += '''
+                            <a href="javascript:opennamu_thread_blind();">(''' + load_lang('hide') + ''' | ''' + load_lang('hide_release') + ''')</a>
+                            <hr class="main_hr">
+                        '''
+
                     return flask.jsonify({ "data" : data_r })
             else:
                 return flask.jsonify({})

+ 2 - 1
route/tool/func.py

@@ -1001,7 +1001,7 @@ def wiki_css(data):
     data_css = ''
     data_css_add = ''
 
-    data_css_ver = '187'
+    data_css_ver = '188'
     data_css_ver = '.cache_v' + data_css_ver
 
     if 'main_css' in global_wiki_set:
@@ -1025,6 +1025,7 @@ def wiki_css(data):
         data_css += '<script src="/views/main_css/js/route/editor_sub.js' + data_css_ver + '"></script>'
         data_css += '<script src="/views/main_css/js/route/render.js' + data_css_ver + '"></script>'
         data_css += '<script src="/views/main_css/js/route/topic.js' + data_css_ver + '"></script>'
+        data_css += '<script src="/views/main_css/js/route/topic_sub.js' + data_css_ver + '"></script>'
         
         # Main CSS
         data_css += '<link rel="stylesheet" href="/views/main_css/css/main.css' + data_css_ver + '">'

+ 1 - 1
version.json

@@ -1,6 +1,6 @@
 {
     "beta" : {
-        "r_ver" : "v3.4.6-RC5-dev60",
+        "r_ver" : "v3.4.6-RC5-dev61",
         "c_ver" : "3500373",
         "s_ver" : "3500112"
     }

+ 0 - 3
views/main_css/js/route/render_sub.ts

@@ -1,3 +0,0 @@
-function opennamu_do_footnote() {
-    
-}

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

@@ -1,6 +1,3 @@
-function opennamu_check_new_thread(do_type) {
-    if (do_type === void 0) { do_type = ''; }
-}
 function opennamu_do_remove_blind_thread() {
     var style = document.querySelector('#opennamu_remove_blind');
     if (style !== null) {

+ 0 - 4
views/main_css/js/route/topic.ts

@@ -1,7 +1,3 @@
-function opennamu_check_new_thread(do_type : string = '') {
-    
-}
-
 function opennamu_do_remove_blind_thread() {
     const style = document.querySelector('#opennamu_remove_blind') as HTMLInputElement | null;
     if(style !== null) {

+ 20 - 0
views/main_css/js/route/topic_sub.js

@@ -0,0 +1,20 @@
+"use strict";
+
+function opennamu_thread_blind() {
+    let do_true = 0;
+    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) {
+            fetch("/thread/" + id[0] + '/comment/' + id[1] + '/blind', { method : 'GET' });
+            do_true = 1;
+        }
+    }
+
+    if(do_true === 1) {
+        history.go(0);
+    }
+}