Coder Social home page Coder Social logo

opensug / js Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 25 KB

Simply reference a section of openSug.js to get a search box with "search box prompts" to make your search easier!

Home Page: https://opensug.github.io/js/

License: MIT License

attayo baidusuggestion car google haoso iciba kugou lagou mgtv naver

js's Introduction

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

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.

// [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

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

js's People

Contributors

opensug avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.