├── README.md ├── Readme_images ├── 1.png ├── 2.png ├── 3.png ├── 4.png ├── 5.png ├── 6.png ├── 7.png ├── 8.png └── 9.png └── newBingHelper ├── background.js ├── content.js ├── icon.png ├── icon.psd ├── manifest.json ├── popup.html └── popup.js /README.md: -------------------------------------------------------------------------------- 1 | ## Hi!这是我的第一个浏览器插件——newBing小助手 2 | 3 | 很荣幸的介绍,这是我跟GPT-4模型共同完成的第二个作品,也是第一个插件作品。GPT-4是幕后“写手”,我只是代码的搬运工和裁缝,掌声送给GPT👏! 4 | 5 | 6 | 7 | 下载地址:[https://github.com/lipeng0820/newBingHelper/releases/download/master/newBingHelper.zip](https://github.com/lipeng0820/newBingHelper/releases/download/master/newBingHelper.zip) 8 | 9 | ### 安装方法 10 | 11 | 1、点击上面的地址下载到本地 12 | 13 | 2、解压缩 newBingHelper.zip 文件 14 | 15 | 3、打开Edge浏览器(newBing不支持 Chrome,除非你有其他插件解决这个问题) 16 | 17 | 4、点击右上角“···”选择”扩展“ 18 | 19 | 20 | 21 | 5、选择“管理扩展” 22 | 23 | 24 | 25 | 6、打开左侧“扩展”中的“开发人员模式” 26 | 27 | 28 | 29 | 7、选择“加载解压缩的扩展” 30 | 31 | 32 | 33 | 8、选择刚刚解压缩的newBingHelper文件夹 34 | 35 | 36 | 37 | 9、然后就可以在“扩展”菜单中,看到了newBing小助手了,点击后面的「小眼睛」可以把扩展放在菜单栏中。 38 | 39 | 40 | 41 | ### 使用方法 42 | 43 | 44 | 45 | 插件非常简单,其实没有什么可说明的,但是讲一下这个软件都做了什么吧。 46 | 47 | 1、「Hi!newBing 小助手」按钮 48 | 49 | 点击这个按钮,会默认调用我提前配置好的原本Bing菜单中设置“国家与地区”(美国)和设置“显示语言(简体中文)”的两个URL地址,然后执行第三个地址,跳转到www.bing.com/new 50 | 51 | 2、「更新Bing设置信息」按钮 52 | 53 | 防止未来对应的地区选择和语言选择地址会变,点击这个按钮会去跟去对应的ID序列去抓新的URL地址,如果ID也会变…那就只能等失效了再来我的Github看看了。 54 | 55 | 语言默认是中文,看不懂中文可以去 newBingHelper文件夹里找到popup.js文件。末尾处我给大家留了几个常用语言选项,将5026.1改为对应的数字即可。 56 | 57 | 58 | 59 | 3、「清理Cookies(非必要不使用)」 60 | 61 | 非必要不使用!非必要不使用!非必要不使用!重要的事情说八百遍! 62 | 63 | 只有反复尝试、持续几分钟、确认也开了代理,还是™无效的时候,再来试试这里。它清理的只是*.bing.com对应的Cookies 64 | 65 | ### 听我说 66 | 67 | 这个软件实测下来偶尔也有反应迟钝和小失灵的时候,一般上来可以先「更新Bing设置信息」然后去点「Hi newBing小助手」,通常使用一次能管很长一段时间,只要你不在手机和电脑端频繁切换通常用不到小助手。猜测是不是Edge移动端会把定位地址发给微软,然后自动改你的地址。 68 | 69 | 没有效果时可以尝试在呼叫小助手和更新Bing信息之间反复重试几次。 70 | 71 | **如果遇到“Sorry, looks like your network settings are preventing access to this feature”提示,参考以下做法:** 72 | 73 | 实测这是由于你所使用的节点被OpenAI屏蔽导致的,你可以去访问ChatGPT的网站试试,也会收到屏蔽提示。没啥好办法,换节点吧。 74 | 75 | 76 | 有问题留言我,我们一起改进。 77 | -------------------------------------------------------------------------------- /Readme_images/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lipeng0820/newBingHelper/e198570700caefb2fc96a18cf7349412dc662192/Readme_images/1.png -------------------------------------------------------------------------------- /Readme_images/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lipeng0820/newBingHelper/e198570700caefb2fc96a18cf7349412dc662192/Readme_images/2.png -------------------------------------------------------------------------------- /Readme_images/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lipeng0820/newBingHelper/e198570700caefb2fc96a18cf7349412dc662192/Readme_images/3.png -------------------------------------------------------------------------------- /Readme_images/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lipeng0820/newBingHelper/e198570700caefb2fc96a18cf7349412dc662192/Readme_images/4.png -------------------------------------------------------------------------------- /Readme_images/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lipeng0820/newBingHelper/e198570700caefb2fc96a18cf7349412dc662192/Readme_images/5.png -------------------------------------------------------------------------------- /Readme_images/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lipeng0820/newBingHelper/e198570700caefb2fc96a18cf7349412dc662192/Readme_images/6.png -------------------------------------------------------------------------------- /Readme_images/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lipeng0820/newBingHelper/e198570700caefb2fc96a18cf7349412dc662192/Readme_images/7.png -------------------------------------------------------------------------------- /Readme_images/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lipeng0820/newBingHelper/e198570700caefb2fc96a18cf7349412dc662192/Readme_images/8.png -------------------------------------------------------------------------------- /Readme_images/9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lipeng0820/newBingHelper/e198570700caefb2fc96a18cf7349412dc662192/Readme_images/9.png -------------------------------------------------------------------------------- /newBingHelper/background.js: -------------------------------------------------------------------------------- 1 | chrome.runtime.onMessage.addListener((request, sender, sendResponse) => { 2 | if (request.action === "callNewBingHelper") { 3 | chrome.storage.local.get(['nBh_region', 'nBh_language'], (result) => { 4 | const nBh_region = result.nBh_region || "https://www.bing.com/account/action?scope=web&cc=us&FORM=W5WA&uid=E2313290&sid=145E3F849DBD68661CFA2D589C936941&ru=%2f%3fform%3dREDIRERR&settingpage=1"; 5 | const nBh_language = result.nBh_language || "https://www.bing.com/account/action?scope=web&setlang=zh-Hans&FORM=W5WA&uid=E2313290&sid=145E3F849DBD68661CFA2D589C936941&ru=%2f%3fform%3dREDIRERR%26cc%3dus&settingpage=1&ntb=1"; 6 | 7 | Promise.all([ 8 | fetch(nBh_region), 9 | fetch(nBh_language) 10 | ]).then(() => { 11 | chrome.tabs.update({ url: "https://chat.bing.com" }); 12 | }); 13 | }); 14 | } 15 | }); 16 | -------------------------------------------------------------------------------- /newBingHelper/content.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /newBingHelper/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lipeng0820/newBingHelper/e198570700caefb2fc96a18cf7349412dc662192/newBingHelper/icon.png -------------------------------------------------------------------------------- /newBingHelper/icon.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lipeng0820/newBingHelper/e198570700caefb2fc96a18cf7349412dc662192/newBingHelper/icon.psd -------------------------------------------------------------------------------- /newBingHelper/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "manifest_version": 2, 3 | "name": "newBing小助手 by @lipeng0820", 4 | "version": "0.0.3", 5 | "description": "帮助用户快速修改Bing搜索的国家/地区和语言设置", 6 | "permissions": [ 7 | "activeTab", 8 | "https://*.bing.com/*", 9 | "webRequest", 10 | "webRequestBlocking", 11 | "storage", 12 | "cookies" 13 | ], 14 | "browser_action": { 15 | "default_icon": "icon.png", 16 | "default_popup": "popup.html" 17 | }, 18 | "content_scripts": [ 19 | { 20 | "matches": ["https://*.bing.com/*"], 21 | "js": ["content.js"] 22 | } 23 | ], 24 | "icons": { 25 | "48": "icon.png" 26 | }, 27 | "background": { 28 | "scripts": ["background.js"], 29 | "persistent": true 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /newBingHelper/popup.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 29 | 30 | 31 |
32 | 33 |
34 | 35 |
36 | 37 |
38 |
正在使用lipeng0820的默认值,建议更新
39 |
40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /newBingHelper/popup.js: -------------------------------------------------------------------------------- 1 | document.addEventListener('DOMContentLoaded', () => { 2 | chrome.storage.local.get('lastUpdate', (result) => { 3 | const lastUpdate = result.lastUpdate; 4 | if (lastUpdate) { 5 | document.getElementById('status-bar').textContent = `上次更新时间为 ${lastUpdate}`; 6 | } 7 | }); 8 | }); 9 | 10 | document.getElementById("callHelper").addEventListener("click", () => { 11 | chrome.runtime.sendMessage({ action: "callNewBingHelper" }); 12 | }); 13 | 14 | document.getElementById("updateSettings").addEventListener("click", () => { 15 | updateBingSettings(); 16 | }); 17 | 18 | document.getElementById("clearCookies").addEventListener("click", () => { 19 | clearBingCookies(); 20 | }); 21 | 22 | 23 | function updateBingSettings() { 24 | fetch('https://www.bing.com/account/general') 25 | .then(response => response.text()) 26 | .then(htmlString => { 27 | const nBh_region = extractUsaHrefById(htmlString); 28 | const nBh_language = extractSimplifiedChineseHref(htmlString); 29 | chrome.storage.local.set({nBh_region: nBh_region, nBh_language: nBh_language, lastUpdate: new Date().toLocaleString()}, () => { 30 | const currentDate = new Date().toLocaleString(); 31 | document.getElementById("status-bar").innerText = `更新成功,修改时间为 ${currentDate}`; 32 | }); 33 | }); 34 | } 35 | 36 | function clearBingCookies() { 37 | const bingCookieUrls = [ 38 | 'https://www.bing.com', 39 | 'https://cn.bing.com', 40 | 'https://global.bing.com', 41 | 'https://www.bing.com.au', 42 | 'https://www.bing.com.br', 43 | 'https://www.bing.com.cn', 44 | 'https://www.bing.com.es', 45 | 'https://www.bing.com.fr', 46 | 'https://www.bing.de', 47 | 'https://www.bing.it', 48 | 'https://www.bing.nl', 49 | 'https://www.bing.ru', 50 | 'https://www.bing.co.jp', 51 | 'https://www.bing.co.kr', 52 | 'https://www.bing.co.uk' 53 | ]; 54 | 55 | bingCookieUrls.forEach(url => { 56 | chrome.cookies.getAll({url: url}, cookies => { 57 | cookies.forEach(cookie => { 58 | chrome.cookies.remove({url: url, name: cookie.name}); 59 | }); 60 | }); 61 | }); 62 | 63 | document.getElementById("status-bar").innerText = "清除Cookies成功"; 64 | } 65 | 66 | function extractUsaHrefById(htmlString) { 67 | const parser = new DOMParser(); 68 | const html = parser.parseFromString(htmlString, 'text/html'); 69 | const usaLink = html.querySelector('a[href][h="ID=SERP,5194.1"]'); //设置在哪个地区意义不大,默认美国就好,UK 5192.1 ;JP 5183.1 70 | return usaLink ? usaLink.href : ''; 71 | } 72 | 73 | function extractSimplifiedChineseHref(htmlString) { 74 | const parser = new DOMParser(); 75 | const html = parser.parseFromString(htmlString, 'text/html'); 76 | const simplifiedChineseLink = html.querySelector('a[href][h="ID=SERP,5026.1"]'); //繁体 5035.1 ;日语 5028.1 ; 法语 5024.1 77 | return simplifiedChineseLink ? simplifiedChineseLink.href : ''; 78 | } 79 | --------------------------------------------------------------------------------