From 835c31b7ea129a668e1288b90c19fc40d99ccde4 Mon Sep 17 00:00:00 2001 From: Joseph Cheung Date: Wed, 1 Mar 2023 15:55:27 +0800 Subject: [PATCH] c --- searx/webapp.py | 22 ++++++++++++---------- searx/webapp1.py | 22 ++++++++++++---------- 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/searx/webapp.py b/searx/webapp.py index a36815bcf..a130800fd 100755 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -886,7 +886,7 @@ def search(): }) // 4. 开始拖拽 // (1) 当我们鼠标按下, 就获得鼠标在盒子内的坐标 - title.addEventListener('mousedown', function (e) { + modal.addEventListener('mousedown', function (e) { var x = e.pageX - modal.offsetLeft; var y = e.pageY - modal.offsetTop; // (2) 鼠标移动的时候,把鼠标在页面中的坐标,减去 鼠标在盒子内的坐标就是模态框的left和top值 @@ -901,7 +901,7 @@ def search(): document.removeEventListener('mousemove', move); }) }) - title.addEventListener('touchstart', function (e) { + modal.addEventListener('touchstart', function (e) { var x = e.targetTouches[0].pageX - modal.offsetLeft; var y = e.targetTouches[0].pageY - modal.offsetTop; // (2) 鼠标移动的时候,把鼠标在页面中的坐标,减去 鼠标在盒子内的坐标就是模态框的left和top值 @@ -1001,7 +1001,8 @@ def search(): width: 100%; max-height: 30vh; position: relative; - overflow: hidden; + overflow: scroll; + padding-top: 1em; } #iframe-wrapper { width: 100%; @@ -1295,6 +1296,7 @@ function modal_open(url, num) { word_last += chatTextRaw + chatTemp lock_chat=0 + proxify() return; } let choices; @@ -1312,7 +1314,6 @@ function modal_open(url, num) chatTemp=chatTemp.replaceAll("\n\n","\n").replaceAll("\n\n","\n") document.querySelector("#prompt").innerHTML=""; markdownToHtml(beautify(chatTemp), document.querySelector("#prompt")) - proxify() document.getElementById('chat_talk').innerHTML = prev_chat+'
'+document.querySelector("#prompt").innerHTML+"
"; }) @@ -1611,7 +1612,6 @@ function send_webchat(elem) document.querySelector("#prompt").innerHTML=""; markdownToHtml(beautify(word), document.querySelector("#prompt")) -proxify() chatTextRaw = "提问:" + word + "\n回答:"; chatTemp = "" text_offset = -1; @@ -1634,6 +1634,7 @@ prev_chat = prev_chat+'
'+document.querySelector("#pro word_last += chatTextRaw + chatTemp lock_chat=0 document.querySelector("#chat_input").value=""; + proxify() return; } let choices; @@ -1651,7 +1652,7 @@ prev_chat = prev_chat+'
'+document.querySelector("#pro chatTemp=chatTemp.replaceAll("\n\n","\n").replaceAll("\n\n","\n") document.querySelector("#prompt").innerHTML=""; markdownToHtml(beautify(chatTemp), document.querySelector("#prompt")) - proxify() + document.getElementById('chat_talk').innerHTML = prev_chat+'
'+document.querySelector("#prompt").innerHTML+"
"; }) @@ -1705,7 +1706,6 @@ function send_chat(elem) word=word.replaceAll("\n\n","\n").replaceAll("\n\n","\n") document.querySelector("#prompt").innerHTML=""; markdownToHtml(beautify(word), document.querySelector("#prompt")) -proxify() chatTextRaw = "提问:" + word + "\n回答:"; chatTemp = "" text_offset = -1; @@ -1728,6 +1728,7 @@ prev_chat = prev_chat+'
'+document.querySelector("#pro word_last += chatTextRaw + chatTemp lock_chat=0 document.querySelector("#chat_input").value=""; + proxify() return; } let choices; @@ -1745,7 +1746,7 @@ prev_chat = prev_chat+'
'+document.querySelector("#pro chatTemp=chatTemp.replaceAll("\n\n","\n").replaceAll("\n\n","\n") document.querySelector("#prompt").innerHTML=""; markdownToHtml(beautify(chatTemp), document.querySelector("#prompt")) - proxify() + document.getElementById('chat_talk').innerHTML = prev_chat+'
'+document.querySelector("#prompt").innerHTML+"
"; }) @@ -1959,6 +1960,7 @@ fetch("https://search.kg/completions", optionsIntro) lock_chat = 0; document.getElementById('chat_continue').style.display=""; document.getElementById('chat_more').style.display=""; + proxify() return; } let choices; @@ -1974,7 +1976,7 @@ fetch("https://search.kg/completions", optionsIntro) } markdownToHtml(beautify(chatTextRawPlusComment), document.getElementById('chat')); - proxify() + }) return readerPlusComment.read().then(processText); @@ -1997,7 +1999,7 @@ fetch("https://search.kg/completions", optionsIntro) text_offset = choices[0].logprobs.text_offset[choices[0].logprobs.text_offset.length - 1] } markdownToHtml(beautify(chatTextRaw), document.getElementById('chat')); - proxify() + }) return reader.read().then(processText); diff --git a/searx/webapp1.py b/searx/webapp1.py index a36815bcf..a130800fd 100644 --- a/searx/webapp1.py +++ b/searx/webapp1.py @@ -886,7 +886,7 @@ def search(): }) // 4. 开始拖拽 // (1) 当我们鼠标按下, 就获得鼠标在盒子内的坐标 - title.addEventListener('mousedown', function (e) { + modal.addEventListener('mousedown', function (e) { var x = e.pageX - modal.offsetLeft; var y = e.pageY - modal.offsetTop; // (2) 鼠标移动的时候,把鼠标在页面中的坐标,减去 鼠标在盒子内的坐标就是模态框的left和top值 @@ -901,7 +901,7 @@ def search(): document.removeEventListener('mousemove', move); }) }) - title.addEventListener('touchstart', function (e) { + modal.addEventListener('touchstart', function (e) { var x = e.targetTouches[0].pageX - modal.offsetLeft; var y = e.targetTouches[0].pageY - modal.offsetTop; // (2) 鼠标移动的时候,把鼠标在页面中的坐标,减去 鼠标在盒子内的坐标就是模态框的left和top值 @@ -1001,7 +1001,8 @@ def search(): width: 100%; max-height: 30vh; position: relative; - overflow: hidden; + overflow: scroll; + padding-top: 1em; } #iframe-wrapper { width: 100%; @@ -1295,6 +1296,7 @@ function modal_open(url, num) { word_last += chatTextRaw + chatTemp lock_chat=0 + proxify() return; } let choices; @@ -1312,7 +1314,6 @@ function modal_open(url, num) chatTemp=chatTemp.replaceAll("\n\n","\n").replaceAll("\n\n","\n") document.querySelector("#prompt").innerHTML=""; markdownToHtml(beautify(chatTemp), document.querySelector("#prompt")) - proxify() document.getElementById('chat_talk').innerHTML = prev_chat+'
'+document.querySelector("#prompt").innerHTML+"
"; }) @@ -1611,7 +1612,6 @@ function send_webchat(elem) document.querySelector("#prompt").innerHTML=""; markdownToHtml(beautify(word), document.querySelector("#prompt")) -proxify() chatTextRaw = "提问:" + word + "\n回答:"; chatTemp = "" text_offset = -1; @@ -1634,6 +1634,7 @@ prev_chat = prev_chat+'
'+document.querySelector("#pro word_last += chatTextRaw + chatTemp lock_chat=0 document.querySelector("#chat_input").value=""; + proxify() return; } let choices; @@ -1651,7 +1652,7 @@ prev_chat = prev_chat+'
'+document.querySelector("#pro chatTemp=chatTemp.replaceAll("\n\n","\n").replaceAll("\n\n","\n") document.querySelector("#prompt").innerHTML=""; markdownToHtml(beautify(chatTemp), document.querySelector("#prompt")) - proxify() + document.getElementById('chat_talk').innerHTML = prev_chat+'
'+document.querySelector("#prompt").innerHTML+"
"; }) @@ -1705,7 +1706,6 @@ function send_chat(elem) word=word.replaceAll("\n\n","\n").replaceAll("\n\n","\n") document.querySelector("#prompt").innerHTML=""; markdownToHtml(beautify(word), document.querySelector("#prompt")) -proxify() chatTextRaw = "提问:" + word + "\n回答:"; chatTemp = "" text_offset = -1; @@ -1728,6 +1728,7 @@ prev_chat = prev_chat+'
'+document.querySelector("#pro word_last += chatTextRaw + chatTemp lock_chat=0 document.querySelector("#chat_input").value=""; + proxify() return; } let choices; @@ -1745,7 +1746,7 @@ prev_chat = prev_chat+'
'+document.querySelector("#pro chatTemp=chatTemp.replaceAll("\n\n","\n").replaceAll("\n\n","\n") document.querySelector("#prompt").innerHTML=""; markdownToHtml(beautify(chatTemp), document.querySelector("#prompt")) - proxify() + document.getElementById('chat_talk').innerHTML = prev_chat+'
'+document.querySelector("#prompt").innerHTML+"
"; }) @@ -1959,6 +1960,7 @@ fetch("https://search.kg/completions", optionsIntro) lock_chat = 0; document.getElementById('chat_continue').style.display=""; document.getElementById('chat_more').style.display=""; + proxify() return; } let choices; @@ -1974,7 +1976,7 @@ fetch("https://search.kg/completions", optionsIntro) } markdownToHtml(beautify(chatTextRawPlusComment), document.getElementById('chat')); - proxify() + }) return readerPlusComment.read().then(processText); @@ -1997,7 +1999,7 @@ fetch("https://search.kg/completions", optionsIntro) text_offset = choices[0].logprobs.text_offset[choices[0].logprobs.text_offset.length - 1] } markdownToHtml(beautify(chatTextRaw), document.getElementById('chat')); - proxify() + }) return reader.read().then(processText);