|
TABLE
MAKE
CUSTOMIZE
EFFECTS
EFFECTS CYCLE
EFFECTS CYCLES
VIRTUAL BOX
PLUG-IN
GLIDER
|
Custom.Search
Playing with Custom.Prompt you can obtain many interesting things, like these custom search boxes.
You can search on Google, Wikipedia and Yahoo!, and you can decide whether show the results into a new window or into the same. window.addEvent('domready', function() { // IE6 style fix if(Browser.Engine.trident4) new Asset.css('/examples/1.3.1/custom_search/style_ie6.css', {id: 'style_ie6'}); var googleOpts = { content: 'html', text: { confirmButtonText: '', closeButtonText: '', cancelButtonText: '' }, opacify:false, draggable:false, promptType: { startValue: 'search on google...', search: 'google' }, zones: { box: 'box3', head: 'head3', body: 'body3', buttonBox: 'buttonBox3', promptBox: 'promptBox3' }, buttons: { closeButton: 'closeButton3', confirmButton: 'confirmButton3', cancelButton: 'cancelButton3' }, overlay: false, initialize: function() { this.theclose = new Element('div', { 'styles': {'clear': 'both'} }); this.theclose.injectInside(this.closebox); this.input.addEvents({ 'focus': function(event) { event.stop(); this.set('value', ''); }, 'blur': function(event) { event.stop(); if(this.get('value') == '') this.set('value', 'search on google...'); } }); } }; var yahooOpts = $merge(googleOpts, { promptType: { startValue: 'search on yahoo...', search: 'yahoo' }, zones: { box: 'box3', head: 'head3', body: 'body4', buttonBox: 'buttonBox3', promptBox: 'promptBox3' }, initialize: function() { this.theclose = new Element('div', { 'styles': {'clear': 'both'} }); this.theclose.injectInside(this.closebox); this.input.addEvents({ 'focus': function(event) { event.stop(); this.set('value', ''); }, 'blur': function(event) { event.stop(); if(this.get('value') == '') this.set('value', 'search on yahoo...'); } }); } }); var wikipediaOpts = $merge(googleOpts, { promptType: { startValue: 'search on wikipedia...', search: 'wikipedia' }, zones: { box: 'box3', head: 'head3', body: 'body5', buttonBox: 'buttonBox3', promptBox: 'promptBox3' }, initialize: function() { this.theclose = new Element('div', { 'styles': {'clear': 'both'} }); this.theclose.injectInside(this.closebox); this.input.addEvents({ 'focus': function(event) { event.stop(); this.set('value', ''); }, 'blur': function(event) { event.stop(); if(this.get('value') == '') this.set('value', 'search on wikipedia...'); } }); } }); // searches var google = new Custom.Prompt('', '', googleOpts); var yahoo = new Custom.Prompt('', '', yahooOpts); var wikipedia = new Custom.Prompt('', '', wikipediaOpts); // EVENTS $('ok').addEvent('click', function(event) { event.preventDefault(); google.create(); }); $('ok2').addEvent('click', function(event) { event.preventDefault(); wikipedia.create(); }); $('ok3').addEvent('click', function(event) { event.preventDefault(); yahoo.create(); }); }); |