From d6cc383c1adb63b28aba3d53fcfce412e642b9eb Mon Sep 17 00:00:00 2001 From: ChuishenX Date: Fri, 22 Mar 2024 21:37:03 +0800 Subject: [PATCH 01/12] Fixed some bugs Removed Mistypo. Added a new attribute named newWindow --- searchbutton.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/searchbutton.js b/searchbutton.js index a5f25de..3832a42 100644 --- a/searchbutton.js +++ b/searchbutton.js @@ -7,7 +7,8 @@ function searching() { var searches = document.getElementsByTagName('search'); for (var i = 0; i < searches.length; i++) { var type = searches[i].getAttribute('type'); - var content = searches[i].getAttribute('content') + var content = searches[i].getAttribute('content'); + var newWindow = searches[i].getAttribute('newWindow') searchesJson={ baidu: {name: '百度', color: 'blue', url: 'https://www.baidu.com/s?wd=', img: 'https://www.baidu.com/favicon.ico'}, google: {name: 'Google', color: 'green', url: 'https://www.google.com/search?q=', img: 'https://raw.githubusercontent.com/ChuishenX/cdn/main/favicon.ico'}, @@ -17,9 +18,19 @@ function searching() { github: {name: 'GitHub', color: 'black', url: 'https://github.com/search?q=', img: 'https://github.githubassets.com/favicons/favicon.svg'}, yandex: {name: 'Yandex', color: 'crimson', url: 'https://yandex.com/search/?text=', img: 'https://yastatic.net/s3/home-static/_/7c/7ccfee6f1e81b14c5bef535d1ad7b7e0.png'} } + var nW = ""; + if (newWindow == 'false') { + nW = ';" onclick="window.open(`' + searchesJson[type].url + content + '`)"'; + } + else { + nW = ';" onclick="window.open(`' + searchesJson[type].url + content + '`, target=`_self`)"'; + } searches[i].innerHTML = ''; + searches[type].color+ + nW+ + ';" title="使用"'+ + searches[type].name+ + '搜索">'+searchesJson[type].name+'搜索"'+content+'"'; } } //页面加载后运行 From ec52e3a277424ec1f23b32dec4c49593fb77f80f Mon Sep 17 00:00:00 2001 From: ChuishenX Date: Fri, 22 Mar 2024 21:38:59 +0800 Subject: [PATCH 02/12] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6a92610..3a9db82 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ It's very simple. Example: ```html - + ``` It will show us a button. By clicking the button, a new tab will appear, and it will search 12 in Baidu Search Engine. From 296ead19e11a117c6bdbea3b4108c48000d26b4c Mon Sep 17 00:00:00 2001 From: Lafcadia <147896059+Lafcadia@users.noreply.github.com> Date: Sun, 24 Mar 2024 12:47:52 +0800 Subject: [PATCH 03/12] Update searchbutton.js --- searchbutton.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/searchbutton.js b/searchbutton.js index 3832a42..fd3d7e8 100644 --- a/searchbutton.js +++ b/searchbutton.js @@ -26,10 +26,10 @@ function searching() { nW = ';" onclick="window.open(`' + searchesJson[type].url + content + '`, target=`_self`)"'; } searches[i].innerHTML = ''; } } @@ -42,4 +42,4 @@ if (window.onload) { window.onload = function () { searching() } -} \ No newline at end of file +} From 75e0a5d47778a69ce0958232d7b5d9b8c47c1e55 Mon Sep 17 00:00:00 2001 From: Lafcadia <147896059+Lafcadia@users.noreply.github.com> Date: Sun, 24 Mar 2024 13:33:47 +0800 Subject: [PATCH 04/12] Update searchbutton.js --- searchbutton.js | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/searchbutton.js b/searchbutton.js index fd3d7e8..24b2549 100644 --- a/searchbutton.js +++ b/searchbutton.js @@ -1,8 +1,5 @@ -document.getElementsByTagName('head')[0].innerHTML += ''+ - ''+ - ''+ - '.1 {content: ""}'; +document.getElementsByTagName('style')[0].innerHTML += '.searchbutton {box-sizing: content-box; cursor: pointer; padding: 10px 20px 10px; border-radius: 6px; color: white; font-size: 1.1rem;}'+ + '#lunar-child {border-radius:50%; vertical-align: middle;}'; function searching() { var searches = document.getElementsByTagName('search'); for (var i = 0; i < searches.length; i++) { @@ -10,27 +7,30 @@ function searching() { var content = searches[i].getAttribute('content'); var newWindow = searches[i].getAttribute('newWindow') searchesJson={ - baidu: {name: '百度', color: 'blue', url: 'https://www.baidu.com/s?wd=', img: 'https://www.baidu.com/favicon.ico'}, - google: {name: 'Google', color: 'green', url: 'https://www.google.com/search?q=', img: 'https://raw.githubusercontent.com/ChuishenX/cdn/main/favicon.ico'}, - sogou: {name: '搜狗', color: 'magenta', url: 'https://www.sogou.com/web?query=', img: 'https:///www.sogou.com/images/logo/new/favicon.ico?v=4'}, - S360: {name: '360', color: 'lime', url: 'https://www.so.com/s?q=', img: 'https://s2.ssl.qhimg.com/static/121a1737750aa53d.ico'}, - bing: {name: '必应', color: 'gold', url: 'https://cn.bing.com/search?q=', img: 'https://cn.bing.com/sa/simg/favicon-trans-bg-blue-mg.ico'}, - github: {name: 'GitHub', color: 'black', url: 'https://github.com/search?q=', img: 'https://github.githubassets.com/favicons/favicon.svg'}, - yandex: {name: 'Yandex', color: 'crimson', url: 'https://yandex.com/search/?text=', img: 'https://yastatic.net/s3/home-static/_/7c/7ccfee6f1e81b14c5bef535d1ad7b7e0.png'} + baidu: {color: 'blue', url: 'https://www.baidu.com/s?wd=', img: 'https://www.baidu.com/favicon.ico'}, + google: {color: 'green', url: 'https://www.google.com/search?q=', img: 'https://raw.githubusercontent.com/ChuishenX/cdn/main/favicon.ico'}, + sogou: {color: 'magenta', url: 'https://www.sogou.com/web?query=', img: 'https:///www.sogou.com/images/logo/new/favicon.ico?v=4'}, + S360: {color: 'lime', url: 'https://www.so.com/s?q=', img: 'https://s2.ssl.qhimg.com/static/121a1737750aa53d.ico'}, + bing: {color: 'gold', url: 'https://cn.bing.com/search?q=', img: 'https://cn.bing.com/sa/simg/favicon-trans-bg-blue-mg.ico'}, + github: {color: 'black', url: 'https://github.com/search?q=', img: 'https://github.githubassets.com/assets/GitHub-Mark-ea2971cee799.png'}, + yandex: {color: 'crimson', url: 'https://yandex.com/search/?text=', img: 'https://yastatic.net/s3/home-static/_/7c/7ccfee6f1e81b14c5bef535d1ad7b7e0.png'} } var nW = ""; - if (newWindow == 'false') { + if (newWindow == 'true') { nW = ';" onclick="window.open(`' + searchesJson[type].url + content + '`)"'; } else { nW = ';" onclick="window.open(`' + searchesJson[type].url + content + '`, target=`_self`)"'; } - searches[i].innerHTML = ''; + ';" title="'+ + '搜索">'+ + ' 搜索"'+ + content+'"'; } } //页面加载后运行 From 443060d80624a75ec5d053848cd824bb9f151f48 Mon Sep 17 00:00:00 2001 From: Lafcadia <147896059+Lafcadia@users.noreply.github.com> Date: Sun, 24 Mar 2024 13:33:57 +0800 Subject: [PATCH 05/12] Delete search.css --- search.css | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 search.css diff --git a/search.css b/search.css deleted file mode 100644 index 6a4dda5..0000000 --- a/search.css +++ /dev/null @@ -1,9 +0,0 @@ -.search { - box-sizing: content-box; - cursor: pointer; - padding: 10px 20px 10px; - border: 1px solid; - border-radius: 3px; - font: normal normal bold 16px/normal "华文中宋", "楷体", sans-serif; - color: white; -} \ No newline at end of file From e10b5d8f5632090aebcc30d3c6bb11c4b70c4e42 Mon Sep 17 00:00:00 2001 From: ChuishenX Date: Sat, 6 Apr 2024 10:20:42 +0800 Subject: [PATCH 06/12] Create LICENSE --- LICENSE | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..8621d26 --- /dev/null +++ b/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2021-2024 Lafcadia + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file From 473c03961b4b63b17da3624200dc3e1a67711840 Mon Sep 17 00:00:00 2001 From: Zaixu Zheng <147896059+Lafcadia@users.noreply.github.com> Date: Fri, 3 May 2024 21:44:08 +0800 Subject: [PATCH 07/12] Update test.html --- test.html | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test.html b/test.html index c05b2cb..e6ce9d2 100644 --- a/test.html +++ b/test.html @@ -8,7 +8,6 @@ - + - \ No newline at end of file From 34dc83c2572fa7c71b44fadcc8bb7ade398f2528 Mon Sep 17 00:00:00 2001 From: Zaixu Zheng <147896059+Lafcadia@users.noreply.github.com> Date: Fri, 3 May 2024 21:45:44 +0800 Subject: [PATCH 08/12] Update test.html --- test.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test.html b/test.html index e6ce9d2..6136c56 100644 --- a/test.html +++ b/test.html @@ -8,6 +8,6 @@ - + From be16e2b97310ce5e30c908a55a377cc9db4816e2 Mon Sep 17 00:00:00 2001 From: Zaixu Zheng <147896059+Lafcadia@users.noreply.github.com> Date: Fri, 3 May 2024 21:47:22 +0800 Subject: [PATCH 09/12] Update test.html --- test.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test.html b/test.html index 6136c56..40e24c4 100644 --- a/test.html +++ b/test.html @@ -8,6 +8,6 @@ - + From 887dcd9810af9bc0040fa8126a78c4bb854a626e Mon Sep 17 00:00:00 2001 From: Zaixu Zheng <147896059+Lafcadia@users.noreply.github.com> Date: Fri, 3 May 2024 21:50:25 +0800 Subject: [PATCH 10/12] Update README.md --- README.md | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3a9db82..43a54da 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,17 @@ # SearchButton - A HTML tag definition of my search tag. +An HTML tag definition of my search tag. + +## Why? +Because most of us do not want to bother with someone asking stupid questions, we would like to throw him + +**A BIG BUTTON THAT WILL TAKE HIM IMMEDIATELY TO THE SEARCH ENGINE**. + +like this: + +![Search "What is CMD?"](https://github.com/Lafcadia/SearchButton/assets/147896059/98e6dc4c-3c41-4a0c-ae42-ba699000cfde) + +By writing `` ## Usage @@ -12,7 +23,7 @@ Example: ``` -It will show us a button. By clicking the button, a new tab will appear, and it will search 12 in Baidu Search Engine. +It will show us a button. A new tab will appear by clicking the button, and it will search 12 in Baidu Search Engine. It also supports Bing, Yandex, Sogou, 360(S360) and GitHub. From ed8052254538fa03211bbde16eff8f451435c295 Mon Sep 17 00:00:00 2001 From: Percival Zheng <147896059+Lafcadia@users.noreply.github.com> Date: Thu, 18 Jul 2024 11:08:08 +0800 Subject: [PATCH 11/12] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 43a54da..43efe1a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # SearchButton -An HTML tag definition of my search tag. +A definition of my search tag. ## Why? Because most of us do not want to bother with someone asking stupid questions, we would like to throw him From 0e380953cfbcff916644dcd1f36e652b4367ed34 Mon Sep 17 00:00:00 2001 From: Percival Zheng <147896059+Lafcadia@users.noreply.github.com> Date: Thu, 18 Jul 2024 11:10:10 +0800 Subject: [PATCH 12/12] Update searchbutton.js Sogou and 360 are no longer supported --- searchbutton.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/searchbutton.js b/searchbutton.js index 24b2549..7801fac 100644 --- a/searchbutton.js +++ b/searchbutton.js @@ -9,8 +9,8 @@ function searching() { searchesJson={ baidu: {color: 'blue', url: 'https://www.baidu.com/s?wd=', img: 'https://www.baidu.com/favicon.ico'}, google: {color: 'green', url: 'https://www.google.com/search?q=', img: 'https://raw.githubusercontent.com/ChuishenX/cdn/main/favicon.ico'}, - sogou: {color: 'magenta', url: 'https://www.sogou.com/web?query=', img: 'https:///www.sogou.com/images/logo/new/favicon.ico?v=4'}, - S360: {color: 'lime', url: 'https://www.so.com/s?q=', img: 'https://s2.ssl.qhimg.com/static/121a1737750aa53d.ico'}, + // sogou: {color: 'magenta', url: 'https://www.sogou.com/web?query=', img: 'https:///www.sogou.com/images/logo/new/favicon.ico?v=4'}, + // S360: {color: 'lime', url: 'https://www.so.com/s?q=', img: 'https://s2.ssl.qhimg.com/static/121a1737750aa53d.ico'}, bing: {color: 'gold', url: 'https://cn.bing.com/search?q=', img: 'https://cn.bing.com/sa/simg/favicon-trans-bg-blue-mg.ico'}, github: {color: 'black', url: 'https://github.com/search?q=', img: 'https://github.githubassets.com/assets/GitHub-Mark-ea2971cee799.png'}, yandex: {color: 'crimson', url: 'https://yandex.com/search/?text=', img: 'https://yastatic.net/s3/home-static/_/7c/7ccfee6f1e81b14c5bef535d1ad7b7e0.png'}