diff --git a/README.zh-Hans.md b/README.zh-Hans.md index ff42f44..0702006 100644 --- a/README.zh-Hans.md +++ b/README.zh-Hans.md @@ -9,6 +9,7 @@ [超微浏览器下载及使用技巧](https://uwebzh.netlify.app/zh/) (Mirrors: [gitlab](https://jamesfengcao.gitlab.io/uweb/zh/) [repo](https://repo.or.cz/uweb.git/blob_plain/HEAD:/zh/index.html) [codeberg](https://jamesfengcao.codeberg.page/zh/) [netlify](https://uwebzh.netlify.app/zh/) [stormkit](https://uweb.stormkit.dev/zh/) [surge](https://uweb.surge.sh/zh/) [github](https://torappinfo.github.io/uweb/zh/) [torapp](https://torapp.eu.org) [epizy](http://uweb.epizy.com/) [pages](https://muweb.pages.dev/zh/) [render](https://uweb.onrender.com) [bitbucket](https://torappinfo.bitbucket.io/zh/) [vercel](https://uweb.vercel.app/zh/)) +- 国内可以直接使用newbing/chatgpt - 微:不到200K。 - 威:支持使用js脚本、url服务、shell命令、内部功能链接定制菜单/(新)按钮/手势; 远程数据皆可成网站。html5应用增强,可匹配本地应用。 - 便捷:图书(pdf/djvu)/txt/词典(mdict,kiwix)/命令行/APP/webapp(web extensions)可作为搜索引擎使用。 diff --git a/en/_posts/index.xml b/en/_posts/index.xml index 5185266..51ced82 100644 --- a/en/_posts/index.xml +++ b/en/_posts/index.xml @@ -5,7 +5,19 @@ /en/_posts/ Recent content in _posts on uweb browser: unlimited power Hugo -- gohugo.io - Tue, 21 Mar 2023 00:00:00 +0000 + Sat, 01 Apr 2023 00:00:00 +0000 + + Offline resources + /en/offlinecache/ + Sat, 01 Apr 2023 00:00:00 +0000 + + /en/offlinecache/ + Offline resources locate in the folder "sitecache". With the option "use offline resources" enabled, the corresponding files in "sitecache/[domain name]/[full path including filename, the url path part]" are loaded first before reaching the network. +bingChat UI Install bingChat UI ai.html for censored area (bingChat UI) +The default proxy "mybing2.xn--xyza.top" needs "bing.com" cookies to establish chat. So copy the cookie before accessing the above UI. +Click to install link menu to copy "bing. + + Links /en/links/ @@ -92,17 +104,6 @@ home5.html, home6.mht(or .html or .search), home7.mht(or .html or .search), ... The command line could be a ".js", ".sh" or other executable with arguments. Ex. ":!s g keyword" could invoke "s.js" executable with the whole string as arguments ("s.sh" or "s" if file exists, here "g" as google search engine); ":! g keyword" would invoke the file ".js" or ".sh" as executable. - - Offline resources - /en/offlinecache/ - Fri, 25 Nov 2022 00:00:00 +0000 - - /en/offlinecache/ - Click to install url service that extracts web apps to the folder "sitecache/local/": support web extensions (.crx for chrome & .xpi for firefox). -Offline resources locate in the folder "sitecache". With the option "use offline resources" enabled, the corresponding files in "sitecache/[domain name]/[full path including filename, the url path part]" are loaded first before reaching the network. -PWAs (Progresssive Web Applications) and some web extensions (.crx for chrome & .xpi for firefox) are just packaged websites. - - Make any url as website /en/url2site/ diff --git a/en/index.html b/en/index.html index b5e2872..59dd1d4 100644 --- a/en/index.html +++ b/en/index.html @@ -95,6 +95,12 @@ +
  • + + Offline resources + +
  • +
  • Links @@ -131,12 +137,6 @@
  • -
  • - - Offline resources - -
  • -
  • Make any url as website diff --git a/en/index.xml b/en/index.xml index 3aeda4f..1b0f88e 100644 --- a/en/index.xml +++ b/en/index.xml @@ -5,7 +5,19 @@ /en/ Recent content on uweb browser: unlimited power Hugo -- gohugo.io - Tue, 21 Mar 2023 00:00:00 +0000 + Sat, 01 Apr 2023 00:00:00 +0000 + + Offline resources + /en/offlinecache/ + Sat, 01 Apr 2023 00:00:00 +0000 + + /en/offlinecache/ + Offline resources locate in the folder "sitecache". With the option "use offline resources" enabled, the corresponding files in "sitecache/[domain name]/[full path including filename, the url path part]" are loaded first before reaching the network. +bingChat UI Install bingChat UI ai.html for censored area (bingChat UI) +The default proxy "mybing2.xn--xyza.top" needs "bing.com" cookies to establish chat. So copy the cookie before accessing the above UI. +Click to install link menu to copy "bing. + + Links /en/links/ @@ -138,17 +150,6 @@ home5.html, home6.mht(or .html or .search), home7.mht(or .html or .search), ... The command line could be a ".js", ".sh" or other executable with arguments. Ex. ":!s g keyword" could invoke "s.js" executable with the whole string as arguments ("s.sh" or "s" if file exists, here "g" as google search engine); ":! g keyword" would invoke the file ".js" or ".sh" as executable. - - Offline resources - /en/offlinecache/ - Fri, 25 Nov 2022 00:00:00 +0000 - - /en/offlinecache/ - Click to install url service that extracts web apps to the folder "sitecache/local/": support web extensions (.crx for chrome & .xpi for firefox). -Offline resources locate in the folder "sitecache". With the option "use offline resources" enabled, the corresponding files in "sitecache/[domain name]/[full path including filename, the url path part]" are loaded first before reaching the network. -PWAs (Progresssive Web Applications) and some web extensions (.crx for chrome & .xpi for firefox) are just packaged websites. - - Make any url as website /en/url2site/ diff --git a/en/offlinecache/index.html b/en/offlinecache/index.html index d062182..2c21a01 100644 --- a/en/offlinecache/index.html +++ b/en/offlinecache/index.html @@ -47,11 +47,15 @@
    -

    Click to install url service that extracts web apps to the folder "sitecache/local/": support web extensions (.crx for chrome & .xpi for firefox).

    -

    Offline resources locate in the folder "sitecache". With the option "use offline resources" enabled, the corresponding files in "sitecache/[domain name]/[full path including filename, the url path part]" are loaded first before reaching the network.

    -

    PWAs (Progresssive Web Applications) and some web extensions (.crx for chrome & .xpi for firefox) are just packaged websites. Ex. the "kiwix" extension can be extracted to the folder "sitecache/local/kiwix"1, then the kiwix extension can be accessed via url "https://local/kiwix/www/index.html" in the browser.

    +

    Offline resources locate in the folder "sitecache". With the option "use offline resources" enabled, the corresponding files in "sitecache/[domain name]/[full path including filename, the url path part]" are loaded first before reaching the network.

    +

    bingChat UI

    +

    Install bingChat UI ai.html for censored area (bingChat UI)

    +

    The default proxy "mybing2.xn--xyza.top" needs "bing.com" cookies to establish chat. So copy the cookie before accessing the above UI.
    +Click to install link menu to copy "bing.com" cookies to "mybing2.xn--xyza.top"

    Serverless local sites

    +

    Click to install url service that extracts web apps to the folder "sitecache/local/": support web extensions (.crx for chrome & .xpi for firefox).

    Any folder under "sitecache" can be visited as a local site. Urls with search queries can be dynamically processed by the js/wasm code in the local file.

    +

    PWAs (Progresssive Web Applications) and some web extensions (.crx for chrome & .xpi for firefox) are just packaged websites. Ex. the "kiwix" extension can be extracted to the folder "sitecache/local/kiwix"1, then the kiwix extension can be accessed via url "https://local/kiwix/www/index.html" in the browser.


      @@ -62,8 +66,8 @@
    -

    Last Modified: 25 November 2022
    -generate PDF for custom paper size
    +

    Last Modified: 1 April 2023
    +add base in bing.html

    
     

    diff --git a/en/searchurl/bingAI/bing.html b/en/searchurl/bingAI/bing.html new file mode 100644 index 0000000..9e54a52 --- /dev/null +++ b/en/searchurl/bingAI/bing.html @@ -0,0 +1,73 @@ + + + + + + + NewBingGoGo + + + + + + +
    +
    +
    + + +
    + + +
    + +
    +
    +
    +
    + +
    +
    +
    +

    chat with bing

    +
    +
    +
    +

    More

    +

    Creative

    +
    +
    +

    More

    +

    Balanced

    +
    +
    +

    More

    +

    Precise

    +
    +
    +
    +
    +
    +
    + I am ready to chat +
    +
    + 0 / 0 +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + diff --git a/en/searchurl/bingAI/css/bing.css b/en/searchurl/bingAI/css/bing.css new file mode 100644 index 0000000..8fce324 --- /dev/null +++ b/en/searchurl/bingAI/css/bing.css @@ -0,0 +1,595 @@ +/* 头部分 */ + +#head { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 4rem; + display: flex; + align-items: center; + justify-content: space-between; + backdrop-filter: blur(10px); + background-color: #ffffff78; + z-index: 99; +} + +#head-img-div { + height: 100%; + display: flex; + justify-content: flex-start; + align-items: center; +} + +#head-img-div>img { + height: 100%; +} + +#head-img-div-h2-img>* { + margin: 0; +} + +#head-li-div { + margin-right: 2rem; +} + + +/* 背景*/ + +#background { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + z-index: -1; + background: repeating-linear-gradient(359deg, rgb(182 196 255) 0%, rgb(207 225 255 / 78%) 100%); + transition: filter 1s; +} + +#background.a { + filter: hue-rotate(10deg); +} + +#background.b { + filter: hue-rotate(-5deg); +} + +#background.c { + filter: hue-rotate(-20deg); +} + + +/* 尾部分 */ + +#tail { + position: fixed; + left: 0; + bottom: 0; + width: 100%; + height: 7rem; + display: flex; + justify-content: center; + backdrop-filter: blur(10px); + background-color: #ffffff78; + flex-direction: column-reverse; + align-items: center; + z-index: 99; +} + +#SearchSuggestions { + position: fixed; + top: -3rem; + display: flex; + flex-wrap: nowrap; + flex-direction: row; + justify-content: center; + align-items: center; + width: 100%; + transition: opacity 0.2s +} + +#SearchSuggestions>a { + backdrop-filter: blur(10px); + background-color: #ffffff82; + border-radius: 2rem; + padding: 0.5rem; + font-size: 0.9rem; + margin: 0.2rem; + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; + transition: flex 0.5s; +} + +#SearchSuggestions>a:hover { + cursor: pointer; + background-color: #ffffff; + flex: none; +} + +#tail-in { + display: flex; + width: 80%; + align-items: center; + justify-content: center; + height: 80%; +} + + +#restart:hover , +#restartNewChat:hover +{ + background-color: #ffffff; + cursor: pointer; +} + +#restart , +#restartNewChat +{ + border: 0; + border-radius: 1.5rem; + background-color: #ffffff9e; + height: 100%; + font-size: 0.8rem; + transition: all 0.5s; + overflow: hidden; + white-space: normal; +} + +#restart { + width: 0; + margin: 0; + padding: 0; + opacity: 0; +} + +body:has(.my) #restart { + width: 5rem; + margin-right: 0.5rem; + padding: 0; + opacity: 1; +} + +#restartNewChat{ + width: 5rem; + margin-right: 0.5rem; +} + +#restartNewChat.onShow{ + width: 0; + margin: 0; + padding: 0; + opacity: 0; +} + +#send { + border: 0; + margin: 0 1rem 1rem 0; + border-radius: 2rem; + background-color: #005fff38; + height: 1.8rem; + font-size: 0.8rem; + cursor: pointer; + min-width: 3rem; + transition: all 0.5s; +} + +#send:hover { + background-color: #005fff80; +} + +#input { + border: none; + resize: none; + outline: none; + width: 100%; + background-color: #ffffff00; + margin: 1rem 0 1rem 1rem; + height: -webkit-fill-available; +} + +#input:focus-visible { + border: 0; +} + +#input-div { + border-radius: 1.5rem; + flex: 1; + height: 100%; + background-color: #ffffff; + margin: 0 0; + display: flex; + flex-direction: row; + align-items: flex-end; + transition: all 0.5s; +} + + +/* 页面部分 */ +body { + overflow-x: hidden; +} + +#body-top { + height: 20vh; + width: 100%; +} + +#body-bottom { + height: 15rem; + width: 100%; +} + + +/* 聊天选项部分 */ + +#chatTypeDiv { + display: flex; + flex-direction: row; + justify-content: center; + align-items: center; + flex-wrap: nowrap; + margin-bottom: 7rem; + transition: all 0.5s; +} + +#chatTypeDiv>.chatTypeChose { + background-color: #ffffffcc; + border-radius: 2rem; + width: 9rem; + height: 4rem; + margin: 1rem 0.3rem; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + border: 0.5rem solid #ffffffcc; + cursor: pointer; +} + +#chatTypeDiv>.chatTypeChose>p { + margin: 0; + text-align: center; +} + +#chatTypeDiv>.chatTypeChose>h3 { + margin: 0; + text-align: center; +} + +#chatTypeChoseCreate.Chose { + background-color: #904887; + color: white; + cursor: default; +} + +#chatTypeChoseBalance.Chose { + background-color: #2870EA; + color: white; + cursor: default; +} + +#chatTypeChoseAccurate.Chose { + background-color: #006880; + color: white; + cursor: default; +} + + +/* 聊天部分,在页面内 */ +@keyframes acceptMeaaage { + from { + margin-top: 1em; + margin-left: -4em; + opacity: 0; + } + + to {} +} + +@keyframes sendMeaaage { + from { + margin-top: 1em; + margin-right: -4em; + opacity: 0; + } + + to {} +} + +.bing, +.my { + margin-bottom: 2rem; +} + +.bing { + display: grid; + justify-items: start; +} + +.bing>* { + animation: acceptMeaaage 0.5s; +} + +.my>* { + animation: sendMeaaage 0.5s; +} + +.my { + text-align: right; + font-size: 1.3rem; +} + +.InternalSearchQuery, +.InternalLoaderMessage { + margin-left: 1rem; + font-size: 1rem; +} + +.InternalSearchQuery>p, +.InternalLoaderMessage>p { + margin: 0; + margin-bottom: 1rem; +} + +.adaptiveCardsFatherDIV, +.my>.bobo { + display: inline-block; + background-color: #ffffff; + border-radius: 1rem; + padding: 1rem 1rem; + max-width: 85vw; + margin-bottom: 1rem; + text-align: left; +} + +.adaptiveCardsFatherDIV .throttling { + text-align: end; + font-size: 0.4rem; + margin-top: 0.5rem; + margin-bottom: -0.8rem; + border-top: 1px solid #0000005c; +} + +.bing>.sourceAttributions { + font-size: 0.9rem; + max-width: 85vw; + margin: 0; + margin-bottom: 1rem; + display: inline-flex; + flex-direction: row; + flex-wrap: nowrap; + align-items: center; + background-color: #ffffff57; + border-radius: 2rem; + padding: 0.5rem; +} + +.bing:has(.sourceAttributions) .adaptiveCardsFatherDIV { + margin-bottom: 1em; +} + + +.bing>.sourceAttributions>a { + display: inline-block; + background-color: #ffffff73; + border-radius: 1rem; + padding: 0.5rem; + text-overflow: ellipsis; + overflow: hidden; + white-space: nowrap; + margin: 0.1rem; + color: #000000; + text-decoration: none; + transition: flex 0.5s; +} + +.bing>.sourceAttributions>a:hover { + background-color: #ffffffb3; + flex: none; +} + + +/* 上标 */ + +#chat .superscript { + display: inline-block; + vertical-align: super; + border: 0.1rem solid #0969da; + border-radius: 1em; + min-width: 1em; + text-align: center; + line-height: 1em; + font-size: small; + color: #0969da; +} + +#chat .superscript:hover { + background-color: #00000024; +} + +/*暂时不知道如何解析的渲染卡片请求*/ +.RenderCardRequest { + border-radius: 1em; + background-color: white; + overflow: auto; + padding: 1em; + width: 85vw; + max-width: 1100px; +} + +.RenderCardRequest>iframe { + min-width: 768px; + width: 100%; + height: 602px; + border: 0; +} + + + +/* 画图部分 */ + +.GenerateContentQuery { + background-color: #ffffff; + border-radius: 1rem; + max-width: 85%; + margin-bottom: 1rem; + text-align: center; + font-size: 1rem; + padding: 1rem; + overflow: hidden; + display: inline-table; +} + +.GenerateContentQuery>img { + max-width: 24%; + margin: 0.5%; + transition: all 0.8s; + cursor: pointer; +} + +.GenerateContentQuery>img:hover { + margin: 0.2% 0.8% 0.8% 0.2%; + box-shadow: #0000007a 2px 3px 5px 0px; + transition: all 0.3s; +} + + +/* 错误部分 */ + +#chat .error { + text-align: center; + color: red; +} + +.NoPower { + text-align: center; + color: #ff6d00; + cursor: pointer; + margin: 1rem; + text-decoration: underline; +} + + +/* 用于适配不同设备 */ + + +/* pc */ + +:root { + font-size: 1rem; +} + +div.markdown-body { + font-size: 1rem; + overflow: auto; +} + + +/* 窄窗口 */ +@media screen and (max-width:550px) { + + #tail-in:has(#input:focus-visible) #restart, + #tail-in:has(#input:hover) #restart, + #tail-in:has(#input:focus-visible) #restartNewChat, + #tail-in:has(#input:hover) #restartNewChat { + width: 0; + margin: 0; + padding: 0; + opacity: 0; + } + + .GenerateContentQuery>img { + max-width: 49%; + width: 49%; + } + + #tail-in { + width: 90%; + } + + .bing>.sourceAttributions { + flex-wrap: wrap; + } +} + +/*手机 css*/ + +@media screen and (orientation:portrait) and (max-device-width:800px) and (max-device-height:1000px) { + :root { + font-size: 2rem; + } + + div.markdown-body { + font-size: 1rem; + } + + .InternalSearchQuery, + .InternalLoaderMessage { + width: 90%; + } + + .InternalSearchQuery>p, + .InternalLoaderMessage>p { + font-size: 1rem; + } + + .bing>.sourceAttributions { + max-width: 88vw; + flex-wrap: wrap; + } + + .adaptiveCardsFatherDIV, + .my>.bobo { + max-width: 88vw; + } + + #tail-in { + width: 90%; + } + + #restart { + font-size: 1em; + } + + #input { + font-size: 1em; + } + + .GenerateContentQuery>img { + max-width: 49%; + width: 49%; + } + + #tail-in:has(#input:focus-visible) #restart, + #tail-in:has(#input:hover) #restart, + #tail-in:has(#input:focus-visible) #restartNewChat, + #tail-in:has(#input:hover) #restartNewChat { + width: 0; + margin: 0; + padding: 0; + opacity: 0; + } + + /* 聊天部分,在页面内 */ + @keyframes acceptMeaaage { + from { + margin-top: 1em; + margin-left: 0em; + opacity: 0; + } + + to {} + } + + @keyframes sendMeaaage { + from { + margin-top: 1em; + margin-right: 0em; + opacity: 0; + } + + to {} + } +} \ No newline at end of file diff --git a/en/searchurl/bingAI/js/ChatMessages.js b/en/searchurl/bingAI/js/ChatMessages.js new file mode 100644 index 0000000..fe8baa8 --- /dev/null +++ b/en/searchurl/bingAI/js/ChatMessages.js @@ -0,0 +1,65 @@ +let bingProposes = [ + '教我一个新单词', + '我需要有关家庭作业的帮助', + '我想学习一项新技能', + '最深的海洋是哪个?', + '一年有多少小时?', + "宇宙是如何开始的?", + "寻找非虚构作品", + '火烈鸟为何为粉色?', + '有什么新闻?', + '让我大笑', + '给我看鼓舞人心的名言', + '世界上最小的哺乳动物是什么?', + '向我显示食谱', + '最深的海洋是哪个?', + '为什么人类需要睡眠?', + '教我有关登月的信息', + '我想学习一项新技能', + '如何创建预算?', + '给我说个笑话', + '全息影像的工作原理是什么?', + '如何设定可实现的目标?', + '金字塔是如何建成的?', + '激励我!', + '宇宙是如何开始的?', + '如何制作蛋糕?' +]; + +let bingmMessages = [ + '好的,我已清理好板子,可以重新开始了。我可以帮助你探索什么?', + '明白了,我已经抹去了过去,专注于现在。我们现在应该探索什么?', + '重新开始总是很棒。问我任何问题!', + '好了,我已经为新的对话重置了我的大脑。你现在想聊些什么?', + '很好,让我们来更改主题。你在想什么?', + '谢谢你帮我理清头绪! 我现在能帮你做什么?', + '没问题,很高兴你喜欢上一次对话。让我们转到一个新主题。你想要了解有关哪些内容的详细信息?', + '谢谢你! 知道你什么时候准备好继续前进总是很有帮助的。我现在能为你回答什么问题?', + '当然,我已准备好进行新的挑战。我现在可以为你做什么?' +] + +let StartMessage = bingmMessages[0]; +let Proposes = [bingProposes[0],bingProposes[1],bingProposes[2]]; +/** +获取建议消息 +*/ +function nextStartProposes(){ + Proposes[0] = bingProposes[Math.floor(Math.random() * bingProposes.length)]; + Proposes[1] = bingProposes[Math.floor(Math.random() * bingProposes.length)]; + Proposes[2] = bingProposes[Math.floor(Math.random() * bingProposes.length)]; + return Proposes; +} +/* +获取bing的第一条消息 +*/ +function nextStartMessage(){ + return StartMessage = bingmMessages[Math.floor(Math.random() * bingmMessages.length)]; +} + +function getStartMessage(){ + return StartMessage; +} + +function getStartProposes(){ + return Proposes; +} \ No newline at end of file diff --git a/en/searchurl/bingAI/js/GetSet.js b/en/searchurl/bingAI/js/GetSet.js new file mode 100644 index 0000000..90b196e --- /dev/null +++ b/en/searchurl/bingAI/js/GetSet.js @@ -0,0 +1,39 @@ +async function setMagicUrl(url) { + localStorage.setItem('GoGoUrl',url); +} + +async function getMagicUrl() { + let v = localStorage.GoGoUrl; + if(v) return v; + return "https://mybing2.xn--xyza.top/"; +} + +// ture:开启使用魔法聊天|false:关闭使用魔法聊天|'repeat':开启聊天复用 +async function setChatHubWithMagic(user) { + localStorage.setItem('ChatHubWithMagic',user); +} +// ture|false|'repeat' +async function getChatHubWithMagic() { + let v = localStorage.ChatHubWithMagic; + if (v) return v; + return true; +} + +//设置上次创建的聊天 +async function setLastChatJson(json) { + localStorage.setItem('LastChatJson',json); +} + +//获取上次创建的聊天 +async function getLastChatJson() { + return localStorage.LastChatJson; +} + +//获取上次聊天聊到的消息id次数 +async function getLastChatInvocationId(){ + return localStorage.LastChatInvocationId; +} +//设置上次聊天聊到的消息id次数 +async function setLastInvocationId(invocationId){ + return localStorage.setItem('LastChatInvocationId',invocationId); +} diff --git a/en/searchurl/bingAI/js/bing.js b/en/searchurl/bingAI/js/bing.js new file mode 100644 index 0000000..b40110e --- /dev/null +++ b/en/searchurl/bingAI/js/bing.js @@ -0,0 +1,343 @@ +var chat = document.getElementById('chat'); +var searchSuggestions = document.getElementById('SearchSuggestions'); +searchSuggestions.style.opacity = 1; +var chatTypeDiv = document.getElementById('chatTypeDiv'); +var docTitle = document.getElementById('docTitle'); +var restart_button = document.getElementById('restart'); +var input_text = document.getElementById('input'); +var send_button = document.getElementById('send'); +let restartNewChat = document.getElementById('restartNewChat'); +var thisChatType; + +reSetStartChatMessage(); + +//(string) +function addMyChat(message) { + let bobo = document.createElement('div'); + bobo.style.whiteSpace = 'pre-wrap'; + bobo.innerText = message; + bobo.classList.add('bobo'); + bobo.classList.add('markdown-body'); + let go = document.createElement('div'); + go.classList.add('my'); + go.appendChild(bobo); + chat.appendChild(go); +} + +//(string) +function addError(message) { + let go = document.createElement('div'); + go.classList.add('error'); + go.innerHTML = message; + chat.appendChild(go); +} + +//尝试获取聊天权限按钮 +function addNoPower() { + let go = document.createElement('div'); + go.classList.add('NoPower'); + go.innerHTML = '点击尝试申请加入候补名单获取NewBing聊天权限'; + chat.appendChild(go); + go.onclick = () => { + if (go.geting) { + return; + } + go.geting = true; + go.innerHTML = '正在请求申请加入候补名单..'; + getPower().then((rett) => { + if (rett.ok == true) { + go.innerHTML = '请求成功!请刷新页面重试,如果无权限使用请等待几天后重试。' + return; + } + go.innerHTML = '发生错误:' + rett.message; + }); + } +} + +let onMessageIsOKClose = false; +//(json) +function onMessage(json, returnMessage) { + if (json.type == "close") { + isSpeakingFinish(); + if (!onMessageIsOKClose) { + addError("聊天异常中断了!可能是网络问题。"); + } + return; + } + if (json.type == 'error') { + addError("连接发生错误:" + json.mess); + return; + } + onMessageIsOKClose = false + if (json.type == 3) { + onMessageIsOKClose = true; + returnMessage.getCatWebSocket().close(1000, 'ok'); + } else if (json.type == 1) { + porserArguments(json.arguments); + } else if (json.type == 2) { + porserType2Item(json.item); + } else { + console.log(JSON.stringify(json)); + } +} + + +//页面逻辑 + + +//回车键发送 ctrl+回车换行 +input_text.addEventListener('keydown', (event) => { + if (event.key === 'Enter' && !event.altKey) { + event.preventDefault(); + //调用发送消息的函数 + send_button.onclick(); + } else if (event.key === 'Enter' && event.altKey) { + event.preventDefault(); + // 插入换行符 + input_text.value += "\n"; + } +}); + + +//全局变量 +var talk; +var returnMessage; +var isSpeaking = false; + + +/**重置聊天框和聊天建议到初始状态 */ +function reSetStartChatMessage(type) { + getChatHubWithMagic().then(async a => { + let t = 0; + if (a == 'repeat') { + t = await getLastChatInvocationId(); + } + chat.innerHTML = ` +
    +
    +
    + ${nextStartMessage(type)} +
    +
    + ${t} / 0 +
    +
    +
    + `; + if(t>1){ + restartNewChat.classList.remove('onShow'); + }else{ + restartNewChat.classList.add('onShow'); + } + }); + searchSuggestions.innerHTML = ''; + let prs = nextStartProposes(); + prs.forEach((s) => { + let a = document.createElement('a'); + a.innerHTML = s; + a.onclick = (even) => { + if (searchSuggestions.style.opacity >= 1) { + send(even.target.innerHTML); + } + } + searchSuggestions.appendChild(a); + }); + docTitle.innerText = 'NewBingGoGo:聊天啦啦啦啦'; +} + +/**正在创建聊天 */ +function isAskingToMagic() { + isSpeaking = true; + send_button.value = '施法中.'; + searchSuggestions.innerHTML = ''; +} + +/**bing正在回复 */ +function isSpeakingStart(chatWithMagic, sendText) { + isSpeaking = true; + + if (sendText) { + docTitle.innerText = sendText; + } + send_button.value = '响应中.'; + searchSuggestions.innerHTML = ''; +} + +/**bing回复结束 */ +function isSpeakingFinish() { + isSpeaking = false; + send_button.value = 'submit'; +} + +function send(text) { + if (isSpeaking) { + return; + } + chatTypeDiv.style.opacity = 0; + addMyChat(text); + if (!talk) { + isAskingToMagic(); + createChat(thisChatType).then((r) => { + if (!r.ok) { + addError(r.message); + if (r.type == 'NoPower') { + addNoPower(); + } + isSpeakingFinish(); + return; + } + talk = r.obj; + isSpeakingStart(); + r = talk.sendMessage(text, onMessage); + if (!r.ok) { + isSpeakingFinish(); + addError(r.message); + return; + } + returnMessage = r.obj; + isSpeakingStart(r.chatWithMagic, text); + }); + return; + } else { + isSpeakingStart(); + let r = talk.sendMessage(text, onMessage) + if (!r.ok) { + isSpeakingFinish(); + addError(r.message); + return; + } + returnMessage = r.obj; + isSpeakingStart(r.chatWithMagic, text); + } +} + +send_button.onclick = () => { + if (isSpeaking) { + return; + } + let text = input_text.value; + input_text.value = ''; + input_update_input_text_sstyle_show_update({ target: input_text }); + if (!text) { + alert('什么都没有输入呀!'); + return; + } + send(text); +}; + +restart_button.onclick = () => { + onMessageIsOKClose = true; + if (returnMessage) { + returnMessage.getCatWebSocket().close(1000, 'ok'); + returnMessage = undefined; + } + talk = undefined; + isSpeakingFinish(); + reSetStartChatMessage(); + chatTypeDiv.style.opacity = 1; +}; + + + +//滚动到底部显示收聊天建议 + +// 定义一个函数处理滚动事件 +function handleScroll() { + // 获取文档的高度和滚动距离 + var docHeight = document.body.scrollHeight; + var scrollPos = window.pageYOffset; + // 如果滚动到底部,显示元素,否则隐藏元素 + if (scrollPos + window.innerHeight >= docHeight - 50) { + searchSuggestions.style.opacity = 1; + } else { + searchSuggestions.style.opacity = 0; + } +} +// 添加滚动事件监听器 +window.addEventListener("scroll", handleScroll); + + + + +//选择聊天类型,创造力,平衡,精准 +let backgroundDIV = document.getElementById('background'); +let chatTypeChoseCreate = document.getElementById('chatTypeChoseCreate'); +let chatTypeChoseBalance = document.getElementById('chatTypeChoseBalance'); +let chatTypeChoseAccurate = document.getElementById('chatTypeChoseAccurate'); +//默认平衡 +thisChatType = chatTypes.balance; +chatTypeChoseCreate.onclick = () => { + if (chatTypeDiv.style.opacity == 0) { + return; + } + chatTypeChoseCreate.classList.add('Chose'); + chatTypeChoseBalance.classList.remove('Chose'); + chatTypeChoseAccurate.classList.remove('Chose'); + thisChatType = chatTypes.create; + backgroundDIV.className = 'a'; + reSetStartChatMessage('create'); +} +chatTypeChoseBalance.onclick = () => { + if (chatTypeDiv.style.opacity == 0) { + return; + } + chatTypeChoseCreate.classList.remove('Chose'); + chatTypeChoseBalance.classList.add('Chose'); + chatTypeChoseAccurate.classList.remove('Chose'); + thisChatType = chatTypes.balance; + backgroundDIV.className = 'b'; + reSetStartChatMessage('balance'); +} +chatTypeChoseAccurate.onclick = () => { + if (chatTypeDiv.style.opacity == 0) { + return; + } + chatTypeChoseCreate.classList.remove('Chose'); + chatTypeChoseBalance.classList.remove('Chose'); + chatTypeChoseAccurate.classList.add('Chose'); + thisChatType = chatTypes.accurate; + backgroundDIV.className = 'c'; + reSetStartChatMessage('accurate'); +} + + +// "resourceTypes": [ +// "main_frame", +// "sub_frame", +// "stylesheet", +// "script", +// "image", +// "font", +// "object", +// "xmlhttprequest", +// "ping", +// "csp_report", +// "media", +// "websocket", +// "webtransport", +// "webbundle", +// "other" +// ] + + +//发送按钮出现逻辑 +function input_update_input_text_sstyle_show_update(v) { + if (v.target.value) { + send_button.style.opacity = 1; + } else { + send_button.style.opacity = 0; + } +} +input_text.addEventListener("input", input_update_input_text_sstyle_show_update); +input_update_input_text_sstyle_show_update({ target: input_text }); + + +//开始新聊天按钮逻辑,仅在聊天复用 +restartNewChat.onclick = async () => { + await setLastChatJson(null); + await setLastInvocationId(1); + restart_button.onclick(); +} + + + diff --git a/en/searchurl/bingAI/js/bingChatHub.js b/en/searchurl/bingAI/js/bingChatHub.js new file mode 100644 index 0000000..a13f2c8 --- /dev/null +++ b/en/searchurl/bingAI/js/bingChatHub.js @@ -0,0 +1,483 @@ +var expUrl = new RegExp('^(https?://)([-a-zA-z0-9]+\\.)+([-a-zA-z0-9]+)+\\S*$'); +function timeString() { + var d = new Date(); + var year = d.getFullYear(); + var month = (d.getMonth() + 1).toString().padStart(2, "0"); + var date = d.getDate().toString().padStart(2, "0"); + var hour = d.getHours().toString().padStart(2, "0"); + var minute = d.getMinutes().toString().padStart(2, "0"); + var second = d.getSeconds().toString().padStart(2, "0"); + var offset = "+08:00"; // 你可以根据需要修改这个值 + var s = year + "-" + month + "-" + date + "T" + hour + ":" + minute + ":" + second + offset; + return s; +} + +function getUuidNojian() { + return URL.createObjectURL(new Blob()).split('/')[3].replace(/-/g, ''); +} + +function getUuid() { + return URL.createObjectURL(new Blob()).split('/')[3]; +} + +//聊天选项 +let chatTypes = { + //更有创造力选项 + create: [ + "nlu_direct_response_filter", + "deepleo", + "disable_emoji_spoken_text", + "responsible_ai_policy_235", + "enablemm", + "h3imaginative", + "clgalileo", + "gencontentv3", + "telmet", + "jbfv2", + "c2b47e4f", + "dv3sugg" + ], + //balance 平衡模式选项 + balance: [ + "nlu_direct_response_filter", + "deepleo", + "disable_emoji_spoken_text", + "responsible_ai_policy_235", + "enablemm", + "galileo", + "telmet", + "jbfv2", + "c2b47e4f", + "dv3sugg" + ], + //精准选项 + accurate: [ + "nlu_direct_response_filter", + "deepleo", + "disable_emoji_spoken_text", + "responsible_ai_policy_235", + "enablemm", + "h3precise", + "telmet", + "jbfv2", + "c2b47e4f", + "dv3sugg", + "clgalileo" + ] +} + +//接收消息类型 +let allowedMessageTypes = [ + "Chat", + "InternalSearchQuery", + "InternalSearchResult", + "Disengaged", + "InternalLoaderMessage", + "RenderCardRequest", + "AdsQuery", + "SemanticSerp", + "GenerateContentQuery", + "SearchQuery" +] + +//切片id,也不知道是啥意思,反正官网的更新了 +let sliceIds = [ + "semserpsup3", + "styleqnatg", + "lgintsuppcf", + "sydpayajax", + "toneexp", + "327telmet", + "325contents0", + "324jbfv2", + "303hubcancls0", + "321jobsgndv0", + "328throt", + "328postclss0" +] + +class SendMessageManager { + //(会话id,客户端id,签名id,是否是开始) + //(string,string,string,boolena) + constructor(conversationId, clientId, conversationSignature,invocationId) { + this.startTime = timeString(); + this.invocationId = invocationId==undefined?1:invocationId; + this.conversationId = conversationId; + this.clientId = clientId; + this.conversationSignature = conversationSignature; + this.optionsSets = chatTypes.balance; + } + + //chatTypes中的一种 + setChatType(chatType) { + this.optionsSets = chatType; + } + + //发送json数据 + sendJson(chatWebSocket, json) { + let go = JSON.stringify(json) + '\u001e'; + chatWebSocket.send(go); + console.log('发送', go) + } + //获取用于发送的握手数据 + //(WebSocket) + sendShakeHandsJson(chatWebSocket) { + this.sendJson(chatWebSocket, { + "protocol": "json", + "version": 1 + }); + } + //获取用于发送的聊天数据 + //(WebSocket,sreing) + sendChatMessage(chatWebSocket, chat) { + let pos = getStartProposes(); + let previousMessages = [{ + "text": getStartMessage(), + "author": "bot", + "adaptiveCards": [], + "suggestedResponses": [{ + "text": pos[0], + "contentOrigin": "DeepLeo", + "messageType": "Suggestion", + "messageId": getUuid(), + "offense": "Unknown" + }, { + "text": pos[1], + "contentOrigin": "DeepLeo", + "messageType": "Suggestion", + "messageId": getUuid(), + "offense": "Unknown" + }, { + "text": pos[2], + "contentOrigin": "DeepLeo", + "messageType": "Suggestion", + "messageId": getUuid(), + "offense": "Unknown" + }], + "messageId": getUuid(), + "messageType": "Chat" + }]; + let json = { + "arguments": [{ + "source": "cib", + "optionsSets": this.optionsSets, + "allowedMessageTypes": allowedMessageTypes, + "sliceIds": sliceIds, + "verbosity": "verbose", + "traceId": getUuidNojian(), + "isStartOfSession": (this.invocationId <= 1) ? true : false, + "message": { + "locale": "zh-CN", + "market": "zh-CN", + "region": "US", + "location": "lat:47.639557;long:-122.128159;re=1000m;", + "locationHints": [ + { + "Center": { + "Latitude": 30.474109798833613, + "Longitude": 114.39626256171093 + }, + "RegionType": 2, + "SourceType": 11 + }, + { + "country": "United States", + "state": "California", + "city": "Los Angeles", + "zipcode": "90060", + "timezoneoffset": -8, + "dma": 803, + "countryConfidence": 8, + "cityConfidence": 5, + "Center": { + "Latitude": 33.9757, + "Longitude": -118.2564 + }, + "RegionType": 2, + "SourceType": 1 + } + ], + "timestamp": this.startTime, + "author": "user", + "inputMethod": "Keyboard", + "text": chat, + "messageType": "Chat" + }, + "conversationSignature": this.conversationSignature, + "participant": { + "id": this.clientId + }, + "conversationId": this.conversationId, + "previousMessages": (this.invocationId <= 1) ? previousMessages : undefined + }], + "invocationId": this.invocationId.toString(), + "target": "chat", + "type": 4 + }; + this.sendJson(chatWebSocket, json); + this.invocationId++; + setLastInvocationId(this.invocationId); + } +} + + + + + +//处理返回消息的类 +class ReturnMessage { + //(WebSocket,function:可以不传) + constructor(catWebSocket, lisin) { + this.catWebSocket = catWebSocket; + this.onMessage = [(v) => { + //console.log(JSON.stringify(v)) + }]; + if ((typeof lisin) == 'function') { + this.regOnMessage(lisin); + } + catWebSocket.onmessage = (mess) => { + //console.log('收到', mess.data); + let sss = mess.data.split('\u001e'); + for (let i = 0; i < sss.length; i++) { + if (sss[i] == '') { + continue; + } + for (let j in this.onMessage) { + if ((typeof this.onMessage[j]) == 'function') { + try { + this.onMessage[j](JSON.parse(sss[i]), this); + } catch (e) { + console.warn(e) + } + } + } + } + } + catWebSocket.onclose = (mess) => { + for (let i in this.onMessage) { + if ((typeof this.onMessage[i]) == 'function') { + try { + this.onMessage[i]({ + type: 'close', + mess: '连接关闭' + }, this); + } catch (e) { + console.warn(e) + } + } + } + } + catWebSocket.onerror = (mess) => { + console.log(mess); + for (let i in this.onMessage) { + if ((typeof this.onMessage[i]) == 'function') { + try { + this.onMessage[i]({ + type: 'error', + mess: mess + }, this); + } catch (e) { + console.warn(e) + } + } + } + } + } + /* + 获取消息WebSocket + */ + getCatWebSocket() { + return this.catWebSocket; + } + /** + * 注册收到消息监听器 + */ + //(function(json,ReturnMessage)) + regOnMessage(theFun) { + this.onMessage[this.onMessage.length] = theFun; + } +} +//处理聊天的类 +class Chat { + //theChatType chatTypes变量中的其中一个 + //invocationId 可以不传 + //(string,ture|false|'repeat',string,string,string,theChatType,int|undefined) + constructor(magicUrl, chatWithMagic, charID, clientId, conversationSignature, theChatType,invocationId) { + this.magicUrl = magicUrl; + this.chatWithMagic = chatWithMagic; + this.sendMessageManager = new SendMessageManager(charID, clientId, conversationSignature,invocationId); + if (theChatType) { + this.sendMessageManager.setChatType(theChatType); + } + } + /** + * 返回 + { + ok:true|false, + message:显示消息, + obj:ReturnMessage对象 + } + 当ok等于false时,不返回ReturnMessage + * 参数 消息string,当收到消息的函数,当关闭时函数 + */ + //(string,function:可以不传) + sendMessage(message, onMessage) { + try { + let restsrstUrl = 'wss://sydney.bing.com/sydney/ChatHub'; + if (this.chatWithMagic==true) { + restsrstUrl = URLTrue(this.magicUrl.replace('http', 'ws'), "ChatHub"); + } + let chatWebSocket = new WebSocket(restsrstUrl); + chatWebSocket.onopen = () => { + this.sendMessageManager.sendShakeHandsJson(chatWebSocket); + this.sendMessageManager.sendChatMessage(chatWebSocket, message); + } + return { + ok: true, + message: 'ok', + obj: new ReturnMessage(chatWebSocket, onMessage), + chatWithMagic: this.chatWithMagic==true?true:false + }; + } catch (e) { + console.warn(e) + return { + ok: false, + message: "发生错误,可能是网络连接错误:" + e.message + }; + } + } +} + +/*** + * 补齐url + */ +function URLTrue(magicUrl, thiePath) { + let url = magicUrl; + if (!url.endsWith('/')) { + url = url + '/'; + } + url = url + thiePath; + return url; +} + +//获取newbing权限 +async function getPower() { + //设置cookies到魔法链接 + let magicUrl = await getMagicUrl(); + if (!magicUrl) { + return { + ok: false, + message: "需要设置魔法链接才能获取权限哦!" + }; + } + if (!expUrl.test(magicUrl)) { + return { + ok: false, + message: "魔法链接不正确!请修改魔法链接。" + }; + } + await copyCookies(magicUrl); + + try { + await fetch(URLTrue(magicUrl, 'bingcopilotwaitlist')); + return { + ok: true, + message: "ok" + }; + } catch (e) { + console.warn(e); + return { + ok: false, + message: "发生错误,可能是魔法链接无法链接:" + e.message + }; + } +} + + +async function copyCookies(magicUrl) {} + +//创建一个新对话 +/** + 返回结构,如果ok等于false则无chat对象 + { + ok:true|false, + message:显示消息, + obj:Cat对象 + } + */ +async function createChat(theChatType) { + //设置cookies到魔法链接 + let chatWithMagic = await getChatHubWithMagic(); + let magicUrl = await getMagicUrl(); + if (!magicUrl) { + return { + ok: false, + message: "需要设置魔法链接才能聊天哦!" + }; + } + if (!expUrl.test(magicUrl)) { + return { + ok: false, + message: "魔法链接不正确!请修改魔法链接。" + }; + } + let restartNewChat = document.getElementById('restartNewChat'); + if(chatWithMagic=='repeat'){//如果是聊天复用 + restartNewChat.classList.remove('onShow'); + let resjson = await getLastChatJson(); + if(resjson){//如果没有上次聊天或上次聊天已经失效就不返回,继续走创建聊天流程 + let invocationId = await getLastChatInvocationId(); + if(!invocationId){ + invocationId = 1; + } + return { + ok: true, + message: 'ok', + obj: new Chat(magicUrl, chatWithMagic, resjson.conversationId, resjson.clientId, resjson.conversationSignature, theChatType,invocationId) + }; + } + } + try { + await copyCookies(magicUrl); + let res = await fetch(URLTrue(magicUrl, 'Create')); + let resjson = await res.json(); + if (!resjson.result) { + console.warn(resjson); + return { + ok: false, + message: "未知错误!" + }; + } + if (resjson.result.value != 'Success') { + let type = resjson.result.value; + let mess = resjson.result.message; + if (resjson.result.value == 'UnauthorizedRequest') { + type = 'NoLogin' + mess = '首先你需要在bing登录微软账号!请前往 https://cn.bing.com/ 登录微软账号。'; + } else if (resjson.result.value == 'Forbidden') { + type = 'NoPower' + mess = '你还没有获得NewBing的使用权限'; + } + console.warn(resjson); + return { + ok: false, + type: type, + message: mess + }; + } + //保存成功的聊天 + setLastChatJson(resjson); + return { + ok: true, + message: 'ok', + obj: new Chat(magicUrl, chatWithMagic, resjson.conversationId, resjson.clientId, resjson.conversationSignature, theChatType) + }; + } catch (e) { + console.warn(e); + return { + ok: false, + message: "发生错误,可能是魔法链接无法链接:" + e.message + }; + } + +} diff --git a/en/searchurl/bingAI/js/parserReturn.js b/en/searchurl/bingAI/js/parserReturn.js new file mode 100644 index 0000000..16f85f4 --- /dev/null +++ b/en/searchurl/bingAI/js/parserReturn.js @@ -0,0 +1,395 @@ +/** +(id,元素的tag,父元素,创建时顺便添加的class:可以多个) +获取一个指定id的元素如果没用就在服元素创建这个元素 +*/ +function getByID(id, tag, father) { + let t = document.getElementById(id); + if (!t) { + t = document.createElement(tag); + t.id = id; + for (let i = 3; i < arguments.length; i++) { + if (arguments[i]) { + t.classList.add(arguments[i]); + } + } + father.appendChild(t); + } + return t; +} +function getByClass(className, tag, father) { + let t = father.getElementsByClassName(className)[0]; + if (!t) { + t = document.createElement(tag); + t.classList.add(className); + for (let i = 3; i < arguments.length; i++) { + if (arguments[i]) { + t.classList.add(arguments[i]); + } + } + father.appendChild(t); + } + return t; +} + +function test(test) { + porserArguments(test.arguments); +} + +var throttling = { + "maxNumUserMessagesInConversation": 0, + "numUserMessagesInConversation": 0 +}; + +//解析type2的item +function porserType2Item(item){ + let chatDiv = document.getElementById('chat'); + if(item.result){ + if(item.result.value=='Success'){ + + }else if (item.result.value == 'Throttled') { + addError(item.result.message); + addError('24消息请求数达到了限制!'); + } + } + if (item.throttling) { + throttling = item.throttling; + } + if (item.messages) { + let nextFather = getByID(item.requestId, 'div', chatDiv, 'bing'); + porserMessages(item.messages, nextFather); + } + +} +/** + * 解析arguments + * 解析聊天消息,将消息添加到页面 + * **/ +function porserArguments(argumentss) { + for (let i = 0; i < argumentss.length; i++) { + porserType2Item(argumentss[i]); + } +} + +/* +解析messages +*/ +function porserMessages(messages, father) { + for (let i = 0; i < messages.length; i++) { + let message = messages[i]; + if(message.author=='user'){ + continue;//不解析用户的消息 + } + + //解析adaptiveCards 也就是聊天消息部分 下面类型的都是带有adaptiveCards的 + if (!message.messageType && message.adaptiveCards) {//如果是正常的聊天 + let adaptiveCardsFatherDIV = getByID(message.messageId, 'div', father, 'adaptiveCardsFatherDIV'); + porserAdaptiveCards(message.adaptiveCards, adaptiveCardsFatherDIV); + + //解析sourceAttributions 也就是引用链接部分 + if (message.sourceAttributions) { + if (message.sourceAttributions.length > 0) { + let sourceAttributionsDIV = getByID(message.messageId + 'sourceAttributions', 'div', father, 'sourceAttributions'); + porserSourceAttributions(message.sourceAttributions, sourceAttributionsDIV); + } + } + //解析suggestedResponses 建议发送的消息,聊天建议 + if (message.suggestedResponses) { + porserSuggestedResponses(message.suggestedResponses); + } + + } else if (message.messageType == 'InternalSearchQuery') { //如果是收索消息 + let div = getByID(message.messageId, 'div', father, 'InternalSearchQuery'); + porserLineTextBlocks(message.text, div); + + } else if (message.messageType == 'InternalLoaderMessage') { //如果是加载消息 + let div = getByID(message.messageId, 'div', father, 'InternalLoaderMessage'); + porserLineTextBlocks(message.text, div); + + } else if (message.messageType == 'GenerateContentQuery') {//如果是生成内容查询 + let div = getByID(message.messageId, 'div', father, 'GenerateContentQuery'); + generateContentQuery(message, div); + + }else if (message.messageType == 'RenderCardRequest'){//渲染卡片请求,目前不知道有什么用 + renderCardRequest(message, father); + + }else if(message.contentOrigin == 'TurnLimiter'){ + addError(message.text); + addError('聊天被限制了,试试开始新主题?'); + } else { + console.log('发现一个另类message', JSON.stringify(message)); + } + + } +} + +/* +解析渲染卡片请求,暂时不知道如何解析这个请求,就先判断里面有没有内容吧!没有就不显示。 +*/ +function renderCardRequest(message,father){ + if(father[message.messageId+'renderCardRequest']){//防止解析多次 + return; + } + father[message.messageId+'renderCardRequest'] = true; + + let url = 'https://www.bing.com/search?' + let theUrls = new URLSearchParams(); + theUrls.append("showselans",1); + theUrls.append("q",message.text); + theUrls.append("iframeid",message.messageId); + let src = url+theUrls.toString(); + + fetch(src).then(async (ret)=>{ + let html = await ret.text(); + // b_poleContent pc设备 || b_ans b_imgans 移动设备 + if(html.indexOf('class="b_poleContent"')>=0 || html.indexOf('class="b_ans')>=0){ + let div = getByID(message.messageId, 'div', father, 'RenderCardRequest'); + div.innerHTML = ``; + } + }); +} + + +/* +解析generateContentQuery生成内容查询,目前是只有图片 +*/ +function generateContentQuery(message, father) { + if(message.contentType=="IMAGE"){ + if(father.runed){//防止生成多次 + return; + } + father.runed = true; + generateContentQueryImg(message, father); + }else{ + console.log('发现一个另类generateContentQuery', JSON.stringify(message)); + } +} + +/** + * 解析图片生成目前是只有图片 + */ +function generateContentQueryImg(message, father){ + getMagicUrl().then(async magicUrl => { + if (!magicUrl) { + addError("魔法链接不正确!无法加载图片"); + return; + } + if (!expUrl.test(magicUrl)) { + addError("魔法链接不正确!无法加载图片") + return; + } + let theUrls = new URLSearchParams(); + theUrls.append('re', '1'); + theUrls.append('showselective', '1'); + theUrls.append('sude', '1'); + theUrls.append('kseed', '7500'); + theUrls.append('SFX', '2'); + theUrls.append('q', message.text); + theUrls.append('iframeid', message.requestId); + let theUrl = URLTrue(magicUrl,"AiDraw/Create?") + theUrls.toString(); + + try{ + father.innerHTML = `正在生成${message.text}的图片.`; + let html = (await (await fetch(theUrl)).text()); + let urr = new RegExp('"/(images/create/async/results/(\\S*))"').exec(html); + if(!urr || !urr[1]){ + urr = new RegExp('class="gil_err_mt">([^<>]*)').exec(html); + if(urr || urr[1]){ + father.innerHTML = `${urr[1]}` + return; + } + console.log(html); + addError("请求图片返回不正确的页面,无法加载图片。"); + return; + } + let ur = urr[1]; + let imgPageHtmlUrl = URLTrue(magicUrl,ur); + let count = 0; + let run = async ()=>{ + father.innerHTML = `正在生成${message.text}的图片.${count}`; + if(count>20){ + addError("请求图片超时!"); + return; + } + count++; + let imgPageHtml; + try{ + imgPageHtml = (await (await fetch(imgPageHtmlUrl)).text()); + }catch(e){ + console.error(e); + } + if(!imgPageHtml){ + setTimeout(run,3000); + return; + } + let div = document.createElement("div"); + div.innerHTML = imgPageHtml; + let imgs = div.getElementsByTagName("img"); + let theUrls = new URLSearchParams(); + theUrls.append('createmessage',message.text); + father.innerHTML = ''; + for(let el=0;el{ + window.open('GeneratePicture/img.html?'+theUrls.toString(), '_blank'); + } + father.appendChild(img); + } + div.remove(); + } + setTimeout(run,3000); + + }catch(e){ + console.error(e); + addError("请求图片失败:"+e); + } + }); +} + +/* +解析adaptiveCards 聊天消息部分 +*/ +function porserAdaptiveCards(adaptiveCards, father) { + for (let i = 0; i < adaptiveCards.length; i++) { + let adaptiveCard = adaptiveCards[i]; + if (adaptiveCard.type == 'AdaptiveCard') { + porserbody(adaptiveCard.body, father); + } else { + console.log('发现一个不是AdaptiveCard的adaptiveCard', JSON.stringify(adaptiveCard)); + } + } + +} +/** +解析body adaptiveCards[].body这个部分 + */ +function porserbody(bodys, father) { + for (let i = 0; i < bodys.length; i++) { + let body = bodys[i]; + if (body.type == 'TextBlock') { + porserTextBlock(body, father); + }else { + console.log('发现一个不是TextBlock的body', JSON.stringify(body)); + } + } +} + + + +/** +补全代码块,如果文本中有~~~开头却没有~~~结束则在最后补一个~~~,防止内容生成时闪烁 +*/ +function completeCodeBlock(makerdown){ + let to = function(regA,regB,add,makerdown){ + let falst = true; + let arrs = makerdown.split('\n'); + for(let i=0;i<=arrs.length;i++){ + if(falst){ + if(regA.test(arrs[i])){ + falst = false; + } + }else{ + if(regB.test(arrs[i])){ + falst = true; + } + } + } + if(!falst){ + makerdown = makerdown+add; + } + return makerdown; + } + let out = to( + new RegExp('^~~~.*$'), + new RegExp('^~~~( *)$'), + '\n~~~', + to( + new RegExp('^```.*$'), + new RegExp('^```( *)$'), + '\n```', + makerdown + ) + ); + // console.log(out); + return out; +} + +renderMathInElementOptions ={ + delimiters: [ + {left: "$$", right: "$$", display: true}, + {left: '$', right: '$', display: false}, + {left: "\\(", right: "\\)", display: false}, + {left: "\\begin{equation}", right: "\\end{equation}", display: true}, + {left: "\\begin{align}", right: "\\end{align}", display: true}, + {left: "\\begin{alignat}", right: "\\end{alignat}", display: true}, + {left: "\\begin{gather}", right: "\\end{gather}", display: true}, + {left: "\\begin{CD}", right: "\\end{CD}", display: true}, + {left: "\\[", right: "\\]", display: true} + ], + throwOnError: false +} +/* +解析TextBlock body.type==TextBlock +*/ +function porserTextBlock(body, father) { + if (!body.size) { + let div = getByClass('textBlock', 'div', father, 'markdown-body'); + div.innerHTML = marked.marked(completeCodeBlock(body.text)); + renderMathInElement(div,renderMathInElementOptions); + let aaas = div.getElementsByTagName('a'); + //将超链接在新页面打开 + for(let i=0;i${inline}

    `; +} + +/*** +解析sourceAttributions 聊天消息引用链接部分 + */ +function porserSourceAttributions(sourceAttributions, father) { + let html = ''; + for (let i = 0; i < sourceAttributions.length; i++) { + let sourceAttribution = sourceAttributions[i]; + html = html + `${sourceAttribution.providerDisplayName}`; + } + father.innerHTML = html; +} +/*** +解析suggestedResponses 建议发送的消息,聊天建议 + */ +function porserSuggestedResponses(suggestedResponses) { + var searchSuggestions = document.getElementById('SearchSuggestions'); + searchSuggestions.innerHTML = ''; + for (let i = 0; i < suggestedResponses.length; i++) { + let a = document.createElement('a'); + a.innerHTML = suggestedResponses[i].text; + a.onclick = (even) => { + if(searchSuggestions.style.opacity>=1){ + send(even.target.innerHTML); + } + } + searchSuggestions.appendChild(a); + } +} diff --git a/en/searchurl/sitejs/www.bing.com.js b/en/searchurl/sitejs/www.bing.com.js index d5eb170..c5853a8 100644 --- a/en/searchurl/sitejs/www.bing.com.js +++ b/en/searchurl/sitejs/www.bing.com.js @@ -2,7 +2,7 @@ const oFetch = window.fetch; window.fetch = function(url,options){ if("https://www.bing.com/turing/conversation/create"==url){ - url = "https://mybing1.xn--xyza.top/Create"; + url = "https://mybing2.xn--xyza.top/Create"; options = { headers:{}, }; diff --git a/en/sitemap.xml b/en/sitemap.xml index ce5aaf5..f54634b 100644 --- a/en/sitemap.xml +++ b/en/sitemap.xml @@ -3,7 +3,7 @@ xmlns:xhtml="http://www.w3.org/1999/xhtml"> /en/_posts/ - 2023-04-01T15:05:21+08:00 + 2023-04-01T21:06:06+08:00 + + /en/offlinecache/ + 2023-04-01T21:06:06+08:00 + + + + /en/ + 2023-04-01T21:06:06+08:00 + + /en/links/ 2023-04-01T08:54:03+08:00 @@ -27,19 +53,6 @@ hreflang="en" href="/en/links/" /> - - /en/ - 2023-04-01T15:05:21+08:00 - - /en/tags/adblock/ 2023-04-01T15:05:21+08:00 @@ -163,19 +176,6 @@ /en/acmd/ 2023-02-18T14:12:02+08:00 - - /en/offlinecache/ - 2022-11-25T23:31:51+08:00 - - /en/url2site/ 2023-03-29T07:19:36+08:00 diff --git a/sitemap.xml b/sitemap.xml index c0a0bcd..400d84a 100644 --- a/sitemap.xml +++ b/sitemap.xml @@ -4,14 +4,14 @@ en/sitemap.xml - 2023-04-01T15:05:21+08:00 + 2023-04-01T21:06:06+08:00 zh/sitemap.xml - 2023-04-01T15:13:09+08:00 + 2023-04-01T20:51:06+08:00 diff --git a/zh/_posts/index.xml b/zh/_posts/index.xml index b7a0fa0..21b4671 100644 --- a/zh/_posts/index.xml +++ b/zh/_posts/index.xml @@ -12,7 +12,15 @@ Sat, 04 Mar 2023 00:00:00 +0000 /zh/tips/ - 目录配置及使用外部文件管理器 + 免魔法直接使用newbing (chatgpt) +方法1: bingChat自带魔法直接界面 +方法2: 可以采用超级书签/直接界面+脚本+hosts。 +其中超级书签固定bingchat入口。 +脚本重定向api至魔法师. +hosts防污染。 +bingChat能够正常使用时保存为超级书签 (长按底部右箭头按钮),下次再次需要使用时恢复即可 (按设置按钮然后点击超级书签链接)。 +修仙小说里面有一种异能,叫做“成功可以复制”,只要成功一次,就能无限复制。超微浏览器中这种异能叫&quot;超级书签&quot;。成功使用newbing时保存,需要时就可以无限恢复。 +目录配置及使用外部文件管理器 超微浏览器可以将配置目录或子目录符号链接至任意外部公共目录。安装有定制termux的用户也可以使用移动设备自带或第三方文件管理器管理超微内部指定目录。具体配置可见Shell command mode。 准确显示PC网页: PC模式 + 勾选选项&quot;宽屏显示&quot; + 全局脚本&quot;强制缩放&quot;。 @@ -209,7 +217,6 @@ wireless 网页全屏 点击安装Cookie延期,地址栏内删除特殊字符,站内搜索,seedr离线下载等 点击安装离线下载(pcloud,furk,微云等) -酷安扫描 uweb浏览器中长按书签按钮可弹出常用链接菜单,这些链接定义在文件&quot;default.link&quot;中,改动过的文件清后台重启动后生效。每行格式如下: [菜单名]:[url][空格][javascript脚本] 其中空格及之后的脚本为可选项。url及之后的脚本支持&quot;%u&quot;,&quot;%s&quot;等替换。 diff --git a/zh/index.xml b/zh/index.xml index de6b4d7..8529f95 100644 --- a/zh/index.xml +++ b/zh/index.xml @@ -12,7 +12,15 @@ Sat, 04 Mar 2023 00:00:00 +0000 /zh/tips/ - 目录配置及使用外部文件管理器 + 免魔法直接使用newbing (chatgpt) +方法1: bingChat自带魔法直接界面 +方法2: 可以采用超级书签/直接界面+脚本+hosts。 +其中超级书签固定bingchat入口。 +脚本重定向api至魔法师. +hosts防污染。 +bingChat能够正常使用时保存为超级书签 (长按底部右箭头按钮),下次再次需要使用时恢复即可 (按设置按钮然后点击超级书签链接)。 +修仙小说里面有一种异能,叫做“成功可以复制”,只要成功一次,就能无限复制。超微浏览器中这种异能叫&quot;超级书签&quot;。成功使用newbing时保存,需要时就可以无限恢复。 +目录配置及使用外部文件管理器 超微浏览器可以将配置目录或子目录符号链接至任意外部公共目录。安装有定制termux的用户也可以使用移动设备自带或第三方文件管理器管理超微内部指定目录。具体配置可见Shell command mode。 准确显示PC网页: PC模式 + 勾选选项&quot;宽屏显示&quot; + 全局脚本&quot;强制缩放&quot;。 @@ -386,7 +394,6 @@ wireless 网页全屏 点击安装Cookie延期,地址栏内删除特殊字符,站内搜索,seedr离线下载等 点击安装离线下载(pcloud,furk,微云等) -酷安扫描 uweb浏览器中长按书签按钮可弹出常用链接菜单,这些链接定义在文件&quot;default.link&quot;中,改动过的文件清后台重启动后生效。每行格式如下: [菜单名]:[url][空格][javascript脚本] 其中空格及之后的脚本为可选项。url及之后的脚本支持&quot;%u&quot;,&quot;%s&quot;等替换。 @@ -862,7 +869,7 @@ Amazon appstore Downloads 超微浏览器下载及使用技巧 (Mirrors: gitlab repo codeberg netlify stormkit surge github torapp epizy pages render bitbucket vercel) -微:不到200K。 威:支持使用js脚本、url服务、shell命令、内部功能链接定制菜单/(新)按钮/手势; 远程数据皆可成网站。html5应用增强,可匹配本地应用。 便捷:图书(pdf/djvu)/txt/词典(mdict,kiwix)/命令行/APP/webapp(web extensions)可作为搜索引擎使用。 快:手机越慢,脚本插件越多越明显。 高效:最少的操作,在线服务全自动(参看常用链接网页)。 极致优化:最少存储写操作,比如浏览器转到后台前配置变化如恢复成原样则无写操作。 地址栏支持命令行 (&quot;!&quot;, 物理键盘支持更佳) 指定域名: 用户定义JS/CSS/HTML/显示前源码预处理 截屏 软件功能 输出自定义页面大小PDF、矢量图长截屏、朗读、文本重排、嗅探、比价、翻译、视频解析、离线保存、阅读模式(推荐与脚本激活模式配合)、网址重定向至国内、多帐号切换、网盘离线下载、文件管理、webdav/http空间备份/恢复任何指定文件集、智能翻页、目录文件传送、网站独立设置(ua,禁用脚本,无图,激活脚本)、行编辑器、代码编辑器(支持120多种语言,语法高亮、错误提示、自动提示、直接运行测试、其它网页上直接测试)。通过安装html5应用可预览/阅读本地或在线任意格式文件(pdf,djvu,epub,mdx/mdd,docx等)。 +国内可以直接使用newbing/chatgpt 微:不到200K。 威:支持使用js脚本、url服务、shell命令、内部功能链接定制菜单/(新)按钮/手势; 远程数据皆可成网站。html5应用增强,可匹配本地应用。 便捷:图书(pdf/djvu)/txt/词典(mdict,kiwix)/命令行/APP/webapp(web extensions)可作为搜索引擎使用。 快:手机越慢,脚本插件越多越明显。 高效:最少的操作,在线服务全自动(参看常用链接网页)。 极致优化:最少存储写操作,比如浏览器转到后台前配置变化如恢复成原样则无写操作。 地址栏支持命令行 (&quot;!&quot;, 物理键盘支持更佳) 指定域名: 用户定义JS/CSS/HTML/显示前源码预处理 截屏 软件功能 输出自定义页面大小PDF、矢量图长截屏、朗读、文本重排、嗅探、比价、翻译、视频解析、离线保存、阅读模式(推荐与脚本激活模式配合)、网址重定向至国内、多帐号切换、网盘离线下载、文件管理、webdav/http空间备份/恢复任何指定文件集、智能翻页、目录文件传送、网站独立设置(ua,禁用脚本,无图,激活脚本)、行编辑器、代码编辑器(支持120多种语言,语法高亮、错误提示、自动提示、直接运行测试、其它网页上直接测试)。通过安装html5应用可预览/阅读本地或在线任意格式文件(pdf,djvu,epub,mdx/mdd,docx等)。 修仙小说里面有一种异能,叫做“成功可以复制”,只要成功一次,就能无限复制。超微浏览器中这种异能叫&quot;超级书签&quot;。成功使用时保存,需要时就可以无限恢复。(比如newbing/chatGPT的直接使用) 小书签(bookmarklet)再也不用手工输入,直接将小书签网站加入书签即可。运行时长按出菜单后选择“在新窗口中打开”,小书签将作用于最后一个窗口。 独创不良信息绝杀:阻止指定根域名的一切子域名、孙域名...,不良信息一网打尽。 支持根域名前缀、网址路径正则表达式。 diff --git a/zh/links/index.html b/zh/links/index.html index 80ed412..9520264 100644 --- a/zh/links/index.html +++ b/zh/links/index.html @@ -57,7 +57,6 @@

    网页全屏

    点击安装Cookie延期,地址栏内删除特殊字符,站内搜索,seedr离线下载等
    点击安装离线下载(pcloud,furk,微云等)

    -

    酷安扫描

    uweb浏览器中长按书签按钮可弹出常用链接菜单,这些链接定义在文件"default.link"中,改动过的文件清后台重启动后生效。每行格式如下:
    [菜单名]:[url][空格][javascript脚本]
    其中空格及之后的脚本为可选项。url及之后的脚本支持"%u","%s"等替换
    @@ -249,8 +248,8 @@ use "i:0mi:92Host;209.216.230.240::https://news.ycombinator.com" to vi -

    Last Modified: 20 March 2023
    -supports hosts
    +

    Last Modified: 1 April 2023
    +add base in bing.html

    
     

    diff --git a/zh/readme/index.html b/zh/readme/index.html index 06a2923..da68120 100644 --- a/zh/readme/index.html +++ b/zh/readme/index.html @@ -55,6 +55,7 @@

    超微浏览器下载及使用技巧
    (Mirrors: gitlab repo codeberg netlify stormkit surge github torapp epizy pages render bitbucket vercel)

      +
    • 国内可以直接使用newbing/chatgpt
    • 微:不到200K。
    • 威:支持使用js脚本、url服务、shell命令、内部功能链接定制菜单/(新)按钮/手势; 远程数据皆可成网站。html5应用增强,可匹配本地应用。
    • 便捷:图书(pdf/djvu)/txt/词典(mdict,kiwix)/命令行/APP/webapp(web extensions)可作为搜索引擎使用。
    • @@ -84,7 +85,7 @@

      Last Modified: 1 April 2023
      -use [ipv6] in hosts
      +add base in bing.html

      
       

      diff --git a/zh/sitemap.xml b/zh/sitemap.xml index e01183a..94c0867 100644 --- a/zh/sitemap.xml +++ b/zh/sitemap.xml @@ -3,7 +3,7 @@ xmlns:xhtml="http://www.w3.org/1999/xhtml"> /zh/_posts/ - 2023-03-29T15:53:11+08:00 + 2023-04-01T20:51:06+08:00 /zh/ - 2023-04-01T15:13:09+08:00 + 2023-04-01T20:51:06+08:00 /zh/tips/ - 2023-03-23T22:39:21+08:00 + 2023-04-01T20:51:06+08:00 2022-09-24T14:06:03+08:00 /zh/links/ - 2023-03-20T06:58:58+08:00 + 2023-04-01T20:19:51+08:00 2023-01-28T09:50:00+08:00 /zh/readme/ - 2023-04-01T15:13:09+08:00 + 2023-04-01T20:29:08+08:00 /zh/unlist/ - 2023-04-01T15:13:09+08:00 + 2023-04-01T20:29:08+08:00
    -

    目录配置及使用外部文件管理器
    +

    免魔法直接使用newbing (chatgpt)

    +
      +
    • +

      方法1: bingChat自带魔法直接界面

      +
    • +
    • +

      方法2: 可以采用超级书签/直接界面+脚本+hosts。
      +其中超级书签固定bingchat入口。
      +脚本重定向api至魔法师.
      +hosts防污染。

      +

      bingChat能够正常使用时保存为超级书签 (长按底部右箭头按钮),下次再次需要使用时恢复即可 (按设置按钮然后点击超级书签链接)。
      +修仙小说里面有一种异能,叫做“成功可以复制”,只要成功一次,就能无限复制。超微浏览器中这种异能叫"超级书签"。成功使用newbing时保存,需要时就可以无限恢复。

      +
    • +
    +

    目录配置及使用外部文件管理器
    超微浏览器可以将配置目录或子目录符号链接至任意外部公共目录。安装有定制termux的用户也可以使用移动设备自带或第三方文件管理器管理超微内部指定目录。具体配置可见Shell command mode

    准确显示PC网页:
    PC模式 + 勾选选项"宽屏显示" + 全局脚本"强制缩放"。

    @@ -64,8 +78,8 @@ UA为非默认时,点击PC按钮将恢复UA为默认,同时触发不保存UA 配置文件列表中直接点击文件名即可编辑。

    -

    Last Modified: 23 March 2023
    -add option https to func.html
    +

    Last Modified: 1 April 2023
    +add base in bing.html

    
     

    diff --git a/zh/unlist/index.xml b/zh/unlist/index.xml index 64e0f9f..79d32d0 100644 --- a/zh/unlist/index.xml +++ b/zh/unlist/index.xml @@ -17,7 +17,7 @@ Amazon appstore Downloads 超微浏览器下载及使用技巧 (Mirrors: gitlab repo codeberg netlify stormkit surge github torapp epizy pages render bitbucket vercel) -微:不到200K。 威:支持使用js脚本、url服务、shell命令、内部功能链接定制菜单/(新)按钮/手势; 远程数据皆可成网站。html5应用增强,可匹配本地应用。 便捷:图书(pdf/djvu)/txt/词典(mdict,kiwix)/命令行/APP/webapp(web extensions)可作为搜索引擎使用。 快:手机越慢,脚本插件越多越明显。 高效:最少的操作,在线服务全自动(参看常用链接网页)。 极致优化:最少存储写操作,比如浏览器转到后台前配置变化如恢复成原样则无写操作。 地址栏支持命令行 (&quot;!&quot;, 物理键盘支持更佳) 指定域名: 用户定义JS/CSS/HTML/显示前源码预处理 截屏 软件功能 输出自定义页面大小PDF、矢量图长截屏、朗读、文本重排、嗅探、比价、翻译、视频解析、离线保存、阅读模式(推荐与脚本激活模式配合)、网址重定向至国内、多帐号切换、网盘离线下载、文件管理、webdav/http空间备份/恢复任何指定文件集、智能翻页、目录文件传送、网站独立设置(ua,禁用脚本,无图,激活脚本)、行编辑器、代码编辑器(支持120多种语言,语法高亮、错误提示、自动提示、直接运行测试、其它网页上直接测试)。通过安装html5应用可预览/阅读本地或在线任意格式文件(pdf,djvu,epub,mdx/mdd,docx等)。 +国内可以直接使用newbing/chatgpt 微:不到200K。 威:支持使用js脚本、url服务、shell命令、内部功能链接定制菜单/(新)按钮/手势; 远程数据皆可成网站。html5应用增强,可匹配本地应用。 便捷:图书(pdf/djvu)/txt/词典(mdict,kiwix)/命令行/APP/webapp(web extensions)可作为搜索引擎使用。 快:手机越慢,脚本插件越多越明显。 高效:最少的操作,在线服务全自动(参看常用链接网页)。 极致优化:最少存储写操作,比如浏览器转到后台前配置变化如恢复成原样则无写操作。 地址栏支持命令行 (&quot;!&quot;, 物理键盘支持更佳) 指定域名: 用户定义JS/CSS/HTML/显示前源码预处理 截屏 软件功能 输出自定义页面大小PDF、矢量图长截屏、朗读、文本重排、嗅探、比价、翻译、视频解析、离线保存、阅读模式(推荐与脚本激活模式配合)、网址重定向至国内、多帐号切换、网盘离线下载、文件管理、webdav/http空间备份/恢复任何指定文件集、智能翻页、目录文件传送、网站独立设置(ua,禁用脚本,无图,激活脚本)、行编辑器、代码编辑器(支持120多种语言,语法高亮、错误提示、自动提示、直接运行测试、其它网页上直接测试)。通过安装html5应用可预览/阅读本地或在线任意格式文件(pdf,djvu,epub,mdx/mdd,docx等)。 修仙小说里面有一种异能,叫做“成功可以复制”,只要成功一次,就能无限复制。超微浏览器中这种异能叫&quot;超级书签&quot;。成功使用时保存,需要时就可以无限恢复。(比如newbing/chatGPT的直接使用) 小书签(bookmarklet)再也不用手工输入,直接将小书签网站加入书签即可。运行时长按出菜单后选择“在新窗口中打开”,小书签将作用于最后一个窗口。 独创不良信息绝杀:阻止指定根域名的一切子域名、孙域名...,不良信息一网打尽。 支持根域名前缀、网址路径正则表达式。