parameter ที่ต้องใส่เข้าไปคือ
- {string} blogspotURL (require) - url blog ของคุณ
- {string} targetElementId (require) - html id ที่ต้องการให้แสดงผล
- {object} languages - ภาษา ตาม key เลยครับ
- {array} additionalDictionaries - keyword เพิ่มเติม เพิ่มให้ง่ายต่อการค้นหา
simple
/** * blogspot search plugin * by index methodology * url : https://github.com/jittagornp/index-search-javascript * * @author jittagorn pitakmetagoon * create 10/12/2013 */ (function(document, settings) { var script = document.createElement('script'); script.type = 'text/javascript'; script.setAttribute('class', 'ns-blogsearch-script'); script.setAttribute('data-blogspot-url', settings.blogspotURL); script.setAttribute('data-element-id', settings.targetElementId); script.setAttribute('data-slide-search', settings.slideSearch); script.async = true; script.src = 'https://rawgithub.com/jittagornp/index-search-javascript/master/blogspot/blogspot.js'; document.getElementsByTagName('head')[0].appendChild(script); })(document, { //settings blogspotURL: 'http://na5cent.blogspot.com', //url of your blogspot targetElementId: 'mySearch', //target html element id for search box slideSearch : true //for make left slide search });additional
/** * blogspot search plugin * by index methodology * url : https://github.com/jittagornp/index-search-javascript * * @author jittagorn pitakmetagoon * create 10/12/2013 */ (function(document, JSON, settings) { var script = document.createElement('script'); script.type = 'text/javascript'; script.setAttribute('class', 'ns-blogsearch-script'); script.setAttribute('data-blogspot-url', settings.blogspotURL); script.setAttribute('data-element-id', settings.targetElementId); script.setAttribute('data-languages', JSON.stringify(settings.languages || {})); script.setAttribute('data-additionalDictionaries', (settings.additionalDictionaries || []).join(',')); script.setAttribute('data-slide-search', settings.slideSearch); script.async = true; script.src = 'https://rawgithub.com/jittagornp/index-search-javascript/master/blogspot/blogspot.js'; document.getElementsByTagName('head')[0].appendChild(script); })(document, JSON, { //settings blogspotURL: 'http://na5cent.blogspot.com', //url of your blogspot targetElementId: 'mySearch', //target html element id for search box slideSearch : true, //for make left slide search languages: {//language for show in search box SEARCH: 'search', FOUND: 'found', NOT_FOUND: 'not found', POSITIONS: 'positions on', SENTENCES: 'sentences', DO_YOU_MEAN: 'do you mean', CLEAR: 'clear', PLACE_HOLDER : 'search...' }, additionalDictionaries : [ //array of string (keywords) ] });reference : https://github.com/jittagornp/index-search-javascript
ไม่มีความคิดเห็น:
แสดงความคิดเห็น