├── icon.ico ├── Archive.zip ├── AISearchHub.png ├── popup.html ├── popup.js ├── bg.js ├── manifest.json ├── LICENSE ├── style.css ├── README.md ├── index.html ├── .gitignore └── content.js /icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etrobot/AI-Search-Hub/HEAD/icon.ico -------------------------------------------------------------------------------- /Archive.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etrobot/AI-Search-Hub/HEAD/Archive.zip -------------------------------------------------------------------------------- /AISearchHub.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/etrobot/AI-Search-Hub/HEAD/AISearchHub.png -------------------------------------------------------------------------------- /popup.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /popup.js: -------------------------------------------------------------------------------- 1 | document.addEventListener('DOMContentLoaded', function () { 2 | chrome.tabs.create({url: './index.html', selected: true, active: true}); 3 | }); -------------------------------------------------------------------------------- /bg.js: -------------------------------------------------------------------------------- 1 | const iframeHosts = [ 2 | "so.360.com", "devv.ai", "metaso.cn", "www.perplexity.ai", "phind.com" 3 | ]; 4 | 5 | chrome.runtime.onInstalled.addListener(() => { 6 | const RULE = { 7 | id: 1, 8 | condition: { 9 | initiatorDomains: [chrome.runtime.id], 10 | requestDomains: iframeHosts, 11 | resourceTypes: ['sub_frame'], 12 | }, 13 | action: { 14 | type: 'modifyHeaders', 15 | responseHeaders: [ 16 | {header: 'X-Frame-Options', operation: 'remove'}, 17 | {header: 'Frame-Options', operation: 'remove'}, 18 | {header: 'Content-Security-Policy', operation: 'remove'}, 19 | ], 20 | }, 21 | }; 22 | chrome.declarativeNetRequest.updateDynamicRules({ 23 | removeRuleIds: [RULE.id], 24 | addRules: [RULE], 25 | }); 26 | }); -------------------------------------------------------------------------------- /manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "manifest_version": 3, 3 | "name": "AI Search Hub", 4 | "version": "1.0.1", 5 | "author": "Frank Lin", 6 | "icons": { 7 | "128": "AISearchHub.png" 8 | }, 9 | "action": { 10 | "default_popup": "popup.html" 11 | }, 12 | "permissions": ["declarativeNetRequestWithHostAccess", "storage","cookies"], 13 | "host_permissions": [ 14 | "*://*/*" 15 | ], 16 | "minimum_chrome_version": "101", 17 | "background": {"service_worker": "bg.js"}, 18 | "content_scripts": [ 19 | { 20 | "matches": [""], 21 | "js": ["content.js"] 22 | } 23 | ], 24 | "content_security_policy": { 25 | "extension_pages": "script-src 'self'; object-src 'self'; frame-src https://so.360.com https://devv.ai https://metaso.cn https://www.perplexity.ai https://www.phind.com;" 26 | } 27 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Frank Lin 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /style.css: -------------------------------------------------------------------------------- 1 | .autobar{ 2 | color: grey; 3 | text-align: center; 4 | font-size: .875rem; 5 | padding: 0.4rem; 6 | background-color: black; 7 | border-radius: 0.3rem; 8 | margin-top: 0.4rem; 9 | } 10 | 11 | .loader { 12 | float: left; 13 | display: none; 14 | position: relative; 15 | width: 1.5rem; 16 | height: 1.5rem; 17 | border-radius: 2rem; 18 | background: linear-gradient(#eb31b0, #e4c352, #7df8d6); 19 | animation: animate 1s linear infinite; 20 | } 21 | 22 | .loader::before { 23 | border-radius: 2rem; 24 | position: absolute; 25 | content: ""; 26 | background: #000000; 27 | left: 50%; 28 | top: 50%; 29 | transform: translate(-50%, -50%); 30 | width: 80%; 31 | height: 80%; 32 | border: 0 solid white; 33 | } 34 | 35 | @keyframes animate { 36 | from { 37 | transform: rotate(0deg); 38 | } 39 | to { 40 | transform: rotate(360deg); 41 | } 42 | } 43 | 44 | .autoBtn{ 45 | border-radius: 1rem; 46 | color: white; 47 | font-size: .875rem; 48 | padding: .1rem; 49 | } 50 | 51 | .autoBtn[disabled]{ 52 | border-radius: 1rem; 53 | color: grey; 54 | font-size: .875rem; 55 | padding: .1rem; 56 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AI-Search-Hub 2 | 3 | A chrome extension can help user to search on muiltiple AI search engine by oneclick 4 | 5 | ![](https://img2.imgtp.com/2024/03/19/0yLEzteV.jpg) 6 | 7 | How to Use 8 | 9 | To load an unpacked extension in Google Chrome, you can follow these steps: 10 | 11 | 1. Open Google Chrome on your computer. 12 | 2. In the address bar, type `chrome://extensions` and press Enter. This will open the Chrome Extensions page. 13 | 3. Enable the "Developer mode" option. You should find a toggle switch at the top right corner of the Extensions page. If it's already enabled, you can skip this step. 14 | 4. Download or locate the folder containing the unpacked extension on your computer. Make sure the folder contains all the necessary files for the extension, including the manifest file (`manifest.json`), which is required for every extension. 15 | 5. Once you have the folder ready, click on the "Load unpacked" button, which should now be visible on the Extensions page. 16 | 6. A file browser window will appear. Navigate to the folder where your extension is located and select it. Then, click the "Select Folder" button. 17 | 7. Chrome will load the extension, and you should see it listed among your installed extensions on the Extensions page. 18 | 19 | That's it! The unpacked extension should now be loaded in Google Chrome, and you can start using it. Remember to keep the "Developer mode" enabled if you want to load additional unpacked extensions or make changes to the loaded extension. -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | AI Search Hub 8 | 9 | 10 | 20 | 21 | 22 | 23 | 24 |
25 | 26 |
27 | 28 | 29 |
30 |
31 | 32 | 33 | 34 | 35 |
36 |
37 |
38 | 39 |
40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | lerna-debug.log* 8 | .pnpm-debug.log* 9 | 10 | # Diagnostic reports (https://nodejs.org/api/report.html) 11 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 12 | 13 | # Runtime data 14 | pids 15 | *.pid 16 | *.seed 17 | *.pid.lock 18 | 19 | # Directory for instrumented libs generated by jscoverage/JSCover 20 | lib-cov 21 | 22 | # Coverage directory used by tools like istanbul 23 | coverage 24 | *.lcov 25 | 26 | # nyc test coverage 27 | .nyc_output 28 | 29 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 30 | .grunt 31 | 32 | # Bower dependency directory (https://bower.io/) 33 | bower_components 34 | 35 | # node-waf configuration 36 | .lock-wscript 37 | 38 | # Compiled binary addons (https://nodejs.org/api/addons.html) 39 | build/Release 40 | 41 | # Dependency directories 42 | node_modules/ 43 | jspm_packages/ 44 | 45 | # Snowpack dependency directory (https://snowpack.dev/) 46 | web_modules/ 47 | 48 | # TypeScript cache 49 | *.tsbuildinfo 50 | 51 | # Optional npm cache directory 52 | .npm 53 | 54 | # Optional eslint cache 55 | .eslintcache 56 | 57 | # Optional stylelint cache 58 | .stylelintcache 59 | 60 | # Microbundle cache 61 | .rpt2_cache/ 62 | .rts2_cache_cjs/ 63 | .rts2_cache_es/ 64 | .rts2_cache_umd/ 65 | 66 | # Optional REPL history 67 | .node_repl_history 68 | 69 | # Output of 'npm pack' 70 | *.tgz 71 | 72 | # Yarn Integrity file 73 | .yarn-integrity 74 | 75 | # dotenv environment variable files 76 | .env 77 | .env.development.local 78 | .env.test.local 79 | .env.production.local 80 | .env.local 81 | 82 | # parcel-bundler cache (https://parceljs.org/) 83 | .cache 84 | .parcel-cache 85 | 86 | # Next.js build output 87 | .next 88 | out 89 | 90 | # Nuxt.js build / generate output 91 | .nuxt 92 | dist 93 | 94 | # Gatsby files 95 | .cache/ 96 | # Comment in the public line in if your project uses Gatsby and not Next.js 97 | # https://nextjs.org/blog/next-9-1#public-directory-support 98 | # public 99 | 100 | # vuepress build output 101 | .vuepress/dist 102 | 103 | # vuepress v2.x temp and cache directory 104 | .temp 105 | .cache 106 | 107 | # Docusaurus cache and generated files 108 | .docusaurus 109 | 110 | # Serverless directories 111 | .serverless/ 112 | 113 | # FuseBox cache 114 | .fusebox/ 115 | 116 | # DynamoDB Local files 117 | .dynamodb/ 118 | 119 | # TernJS port file 120 | .tern-port 121 | 122 | # Stores VSCode versions used for testing VSCode extensions 123 | .vscode-test 124 | 125 | # yarn v2 126 | .yarn/cache 127 | .yarn/unplugged 128 | .yarn/build-state.yml 129 | .yarn/install-state.gz 130 | .pnp.* 131 | -------------------------------------------------------------------------------- /content.js: -------------------------------------------------------------------------------- 1 | document.addEventListener('DOMContentLoaded', function () { 2 | var defaults = { 3 | dropdown1: "https://metaso.cn/?q=", 4 | dropdown2: "https://so.360.com/?q=", 5 | dropdown3: "https://devv.ai/search/", 6 | dropdown4: "https://www.perplexity.ai/search?q=", 7 | }; 8 | var preSaveSelection; 9 | // New function to determine and set the width class based on the column selection 10 | function setColumnWidth(columnSetting) { 11 | var columnClass = columnSetting === "2" ? "w-1/2" : "w-1/3"; 12 | var searchSites = document.querySelectorAll('.searchsite'); 13 | searchSites.forEach(function(site) { 14 | site.className = "searchsite " + columnClass + " p-1 bg-gray-100"; 15 | }); 16 | } 17 | chrome.storage.local.get(['ai-search-hub'], function(result) { 18 | const stored=result['ai-search-hub'] 19 | if(stored){ 20 | preSaveSelection=stored 21 | }else{ 22 | preSaveSelection=defaults 23 | preSaveSelection.columns = 3; 24 | } 25 | 26 | 27 | function createSearchSite(dropdownId) { 28 | var searchSiteDiv = document.createElement('div'); 29 | searchSiteDiv.className = "searchsite w-1/3 p-1 bg-gray-100"; 30 | 31 | var dropdownDiv = document.createElement('div'); 32 | dropdownDiv.className = "dropdown mb-1"; 33 | 34 | var select = document.createElement('select'); 35 | select.id = dropdownId; 36 | select.className = "urlDropdown w-full py-2 px-3 bg-white border border-gray-300 rounded-md focus:outline-none focus:border-indigo-500"; 37 | console.log(preSaveSelection[dropdownId]) 38 | for (var key in defaults) { 39 | if (defaults.hasOwnProperty(key)) { 40 | var option = document.createElement('option'); 41 | option.value = defaults[key]; 42 | option.textContent = defaults[key]; 43 | if (option.value === preSaveSelection[dropdownId]) { 44 | option.selected = true; 45 | } 46 | select.appendChild(option); 47 | } 48 | } 49 | 50 | dropdownDiv.appendChild(select); 51 | 52 | var iframe = document.createElement('iframe'); 53 | iframe.id = `i-${dropdownId}`; 54 | iframe.className = "w-full border border-gray-300 rounded-md"; 55 | searchSiteDiv.appendChild(dropdownDiv); 56 | searchSiteDiv.appendChild(iframe); 57 | 58 | return searchSiteDiv; 59 | } 60 | 61 | var container = document.querySelector('.searchSitesContainer'); 62 | var count=0 63 | for (var key in defaults) { 64 | if(count>=preSaveSelection.columns){ 65 | break 66 | } 67 | if (defaults.hasOwnProperty(key)) { 68 | var searchSite = createSearchSite(key); 69 | container.appendChild(searchSite); 70 | count+=1 71 | } 72 | } 73 | setColumnWidth(preSaveSelection.columns) 74 | 75 | function saveConfig() { 76 | document.querySelectorAll('.urlDropdown').forEach(function(dropdown) { 77 | var id = dropdown.id; 78 | var url = dropdown.value; 79 | preSaveSelection[id] = url; 80 | }); 81 | var selectedColumn = document.querySelector('input[name="columns"]:checked').value; 82 | preSaveSelection.columns = selectedColumn; 83 | console.log(preSaveSelection); 84 | chrome.storage.local.set({'ai-search-hub': preSaveSelection}, function() { 85 | console.log('Defaults have been saved'); 86 | }); 87 | } 88 | 89 | document.querySelectorAll('.urlDropdown').forEach(function(dropdown) { 90 | dropdown.addEventListener('change', function() { 91 | saveConfig(); 92 | }); 93 | }); 94 | 95 | 96 | // Add event listeners to column radio buttons for change event 97 | document.querySelectorAll('input[name="columns"]').forEach(function(radio) { 98 | radio.checked = preSaveSelection.columns === radio.value; 99 | radio.addEventListener('change', function() { 100 | saveConfig(); 101 | setColumnWidth(this.value); // Update the column width immediately without refreshing 102 | window.location.reload(); 103 | }); 104 | }); 105 | 106 | var searchForm = document.getElementById('searchForm'); 107 | if (searchForm) { 108 | searchForm.addEventListener('submit', function (event) { 109 | event.preventDefault(); 110 | var searchValue = document.getElementById('searchInput').value.trim(); 111 | if (searchValue.length < 4) { 112 | alert("Please enter at least 4 characters") 113 | return 114 | } 115 | var iframes = document.querySelectorAll('iframe'); 116 | var dropdowns = document.querySelectorAll('.urlDropdown'); 117 | iframes.forEach(function (iframe, index) { 118 | var selectedOption = dropdowns[index].value; 119 | iframe.src = selectedOption + encodeURIComponent(searchValue); 120 | }); 121 | 122 | }); 123 | } 124 | }); 125 | }); 126 | --------------------------------------------------------------------------------