Skip to content
This repository has been archived by the owner on Feb 2, 2023. It is now read-only.

Commit

Permalink
Initialize Project.
Browse files Browse the repository at this point in the history
Initialize Project.
  • Loading branch information
opensug committed Feb 2, 2023
0 parents commit 21cc0af
Show file tree
Hide file tree
Showing 4 changed files with 149 additions and 0 deletions.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2011 openSug(GIT.IO/&&)

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.
127 changes: 127 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
# openSug.js
Simply reference a section of openSug.js to get a search box with "search box prompts" to make your search easier!
Please browse the configuration page and examples : [here](https://www.opensug.org/ "https://www.opensug.org/")

Browser support: IE6+, Firefox, Chrome/Chromium, Safari, Opera, Edge...

Provide the replacement result source, The default is to use **Baidu** result source.
## Example
### Simple
input type: only text or search.

action: baiduSug = 1 or true : Automatic submission, baiduSug = 2 or false : Manual submission.
```ini
// [search]Attayo.jp
<input type="text" attayo="1 | true" ...
<input type="text" attayo="2 | false" ...

// [search]Baidu.com
<input type="text" baiduSug="1 | true" ...
<input type="text" baiduSug="2 | false" ...

// [search]Google.com
<input type="text" google="1 | true" ...
<input type="text" google="2 | false" ...

// [search]So.com
<input type="text" haoso="1 | true" ...
<input type="text" haoso="2 | false" ...

// [dictionary]Iciba.com
<input type="text" iciba="1 | true" ...
<input type="text" iciba="2 | false" ...

// [music]Kugou.com
<input type="text" kugou="1 | true" ...
<input type="text" kugou="2 | false" ...

// [search]Yahoo.com
<input type="text" yahoo="1 | true" ...
<input type="text" yahoo="2 | false" ...

// [search]Yandex.ru
<input type="text" yandex="1 | true" ...
<input type="text" yandex="2 | false" ...

// [video]Youku.com
<input type="text" youku="1 | true" ...
<input type="text" youku="2 | false" ...

// [shopping]Taobao.com
<input type="text" taobao="1 | true" ...
<input type="text" taobao="2 | false" ...

// [video]MGTV.com
<input type="text" mgtv="1 | true" ...
<input type="text" mgtv="2 | false" ...

// [search]SM.cn
<input type="text" sm="1 | true" ...
<input type="text" sm="2 | false" ...

// [topic]Weibo.com
<input type="text" weibo="1 | true" ...
<input type="text" weibo="2 | false" ...

// [search]Rambler.ru
<input type="text" rambler="1 | true" ...
<input type="text" rambler="2 | false" ...

// [eBook]Zongheng.com
<input type="text" book="1 | true" ...
<input type="text" book="2 | false" ...

// [Software]QQ.com
<input type="text" soft="1 | true" ...
<input type="text" soft="2 | false" ...

// [search]Naver.com
<input type="text" naver="1 | true" ...
<input type="text" naver="2 | false" ...

// [Car]Sina.com.cn
<input type="text" car="1 | true" ...
<input type="text" car="2 | false" ...

// [Car]Netease.com
<input type="text" car2="1 | true" ...
<input type="text" car2="2 | false" ...

// [map]Qunar.com
<input type="text" qunar="1 | true" ...
<input type="text" qunar="2 | false" ...

// [jobs]Lagou.com
<input type="text" lagou="1 | true" ...
<input type="text" lagou="2 | false" ...

```
### Advanced
```JavaScript
typeof(BaiduSuggestion)!="undefined"&&(BaiduSuggestion)instanceof(Object)&&typeof(BaiduSuggestion)=="object"&&BaiduSuggestion.id("inputObj")?BaiduSuggestion.bind("inputObj", { // Input ID
XOffset: "-4", // Proposal frame position X offset, unit px.
YOffset: "-5", // Prompt box position vertical Y offset, unit px.
width: "", // Prompt box width, unit px.
fontColor: "#FF0000", // Prompt text color.
fontColorHI: "#0000FF", // Prompt box highlight text color when selected.
fontSize: "14px", // font size
fontFamily: "Georgia", // Text fontFamily.
borderColor: "#008000", // Prompt box border color.
bgcolor: "", // Background Color
bgcolorHI: "#FF6600", // Prompt box highlights the selected color.
sugSubmit: true, // Whether to submit the form when the entry in the prompt box is selected.
radius: "4px", // CSS : border-radius
shadow: "0 16px 10px #00000080",// CSS : box-shadow
padding: "", // padding
source:"attayo | baidu | car | car2 | google | haoso | iciba | kugou | lagou | mgtv | naver | qunar | rambler | sm | soft | taobao | weibo | yahoo | yandex | youku | [customize]" // customize = https://{URL}/?{query}=, Default Baidu.
}, function(Callback){
console.log('eg:https://{YouURL}/?conut_update='+ Callback);
}
):"";
```

**Note**: Introduce Javascript files in web pages. Javascript code should be added as far as possible behind the tag in the web page.

**Note**: If the source page is encoded in UTF-8, be sure to set the charset="gbk" attribute in the script tag, otherwise the search hint will be garbled.

[openSug.js](//git.io/&& "https://opensug.github.io/js/opensug.js:88366ea100183396862e6143b09245dda184c95d")
1 change: 1 addition & 0 deletions opensug.js

Large diffs are not rendered by default.

Binary file added opensug.js.sig
Binary file not shown.

0 comments on commit 21cc0af

Please sign in to comment.