2du 4 ani în urmă
părinte
comite
97f9df77d7
4 a modificat fișierele cu 12 adăugiri și 11 ștergeri
  1. 3 2
      app.py
  2. 2 2
      route/edit.py
  3. 3 3
      views/main_css/js/load_shortcut.js
  4. 4 4
      views/main_css/js/render_onmark.js

+ 3 - 2
app.py

@@ -624,8 +624,9 @@ def edit_revert(name = None):
     return edit_revert_2(conn, name)
 
 @app.route('/edit/<everything:name>', methods = ['POST', 'GET'])
-def edit(name = 'Test'):
-    return edit_2(conn, name)
+@app.route('/edit/<everything:name>/doc_section/<int:section>', methods = ['POST', 'GET'])
+def edit(name = 'Test', section = 0):
+    return edit_2(conn, name, section)
 
 @app.route('/backlink_reset/<everything:name>')
 def edit_backlink_reset(name = 'Test'):

+ 2 - 2
route/edit.py

@@ -1,6 +1,6 @@
 from .tool.func import *
 
-def edit_2(conn, name):
+def edit_2(conn, name, section):
     curs = conn.cursor()
 
     ip = ip_check()
@@ -11,7 +11,7 @@ def edit_2(conn, name):
     doc_ver = curs.fetchall()
     doc_ver = doc_ver[0][0] if doc_ver else '0'
     
-    section = flask.request.args.get('section', '')
+    section = '' if section == 0 else section
     post_ver = flask.request.form.get('ver', '')
     if flask.request.method == 'POST':
         edit_repeat = 'error' if post_ver != doc_ver else 'post'

+ 3 - 3
views/main_css/js/load_shortcut.js

@@ -23,9 +23,9 @@ document.onkeypress = function(e) {
         }
 
         if(window.location.pathname.match(doc_shortcut)) {
-			let doc_href = window.location.pathname.replace(doc_shortcut, '');
-			doc_href = doc_href.replace(/%2Fdoc_from%2F(?:((?!%2F).)+)$/, '');
-			if(shortcut_key_list['w'] === 1) {
+            let doc_href = window.location.pathname.replace(doc_shortcut, '');
+            doc_href = doc_href.replace(/%2Fdoc_from%2F(?:((?!%2F).)+)$/, '');
+            if(shortcut_key_list['w'] === 1) {
                 window.location.pathname = '/w/' + doc_href;
             } else if(shortcut_key_list['e'] === 1) {
                 window.location.pathname = '/edit/' + doc_href;

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

@@ -195,10 +195,10 @@ function do_onmark_heading_render(data, data_js, name_doc, name_include) {
             (toc_n === 1 ? '' : '</div>') +
             '<h' + heading_level + ' class="render_heading_text">' + 
                 '<a href="#toc" id="s-' + heading_level_string_no_end + '">' + heading_level_string + '</a> ' + 
-                heading_data_text + 
+                heading_data_text + ' ' +
                 '<a id="edit_load_' + String(toc_n) + '" ' +
                     'style="font-size: 70%;"' +
-                    'href="/edit/' + do_url_change(name_doc) + '?section=' + String(toc_n) + '">✎</a> ' +
+                    'href="/edit/' + do_url_change(name_doc) + '/doc_section/' + String(toc_n) + '">✎</a> ' +
                 '<a href="javascript:void(0);" ' +
                     'onclick="javascript:do_open_folding(\'' + name_include + 'in_data_' + String(toc_n) + '\', this);"' +
                     'style="font-size: 70%;">' + (heading_data[2] ? '⊕' : '⊖') + '</a>' +
@@ -565,8 +565,8 @@ function do_onmark_macro_render(data, data_js) {
             } else if(x_1 === 'nicovideo') {
                 var video_src = 'https://embed.nicovideo.jp/watch/' + video_code
             } else {
-				var video_src = 'https://tv.naver.com/embed/' + video_code
-			}
+                var video_src = 'https://tv.naver.com/embed/' + video_code
+            }
             
             return '<iframe style="width: ' + video_width + '; height: ' + video_height + ';" src="' + video_src + '" frameborder="0" allowfullscreen></iframe>';
         } else if(x_1 === 'anchor') {