PageSourceSearch

https://ugto.mx/modules/mod_universal_ajaxlivesearch/cache/477/eba52e1af18a1a8126f1351f4bf3a863.js

js ugto.mx collected 2026-09-24 09:03:11 UTC 30,862 bytes, 825 lines download raw bytes

1(function(){dojo.require('dojo.uacss');
2
3dojo.declare("AJAXSearchBase", null, {
4  constructor: function(args) {
5    dojo.mixin(this,args);
6    this.list = new Array(); // the search result array
7    this.selected = 0;   //the actual selected search result
8    this.pluginCounter = new Array();
9    this.timeStamp = 0; // the latest timestamp
10    this.categoryChooserVisible = 0; // Is the category chooser visible? 0:No 1:Yes
11    this.resultsVisible = 0; // Are the results visible? 0:No 1:Yes
12    this.fadeInResult=1; // At first time the results should come up with fade-in effect
13    if(this.voicesearch == 1) dojo.attr(this.textBox, "x-webkit-speech", "");
14    if(dojo.isIE <= 7){
15      var w = dojo.position(this.textBox.parentNode).w-dojo.style(this.textBox, 'paddingLeft')-dojo.style(this.textBox, 'paddingRight');
16      dojo.style(this.textBox, 'width', (w-1)+'px');
17    }
18
19    this.searchBoxContainer = dojo.query(".offlajn-ajax-search-container", this.node)[0];
20
21	  if(this.catChooser){
22      this.categoryChooser = dojo.query(".category-chooser", this.searchForm)[0];
23      dojo.place(this.searchCategories,dojo.body());
24      this.searchCategoriesList = dojo.query(".search-categories-inner div", this.searchCategories);
25    }
26
27	  if(this.catChooser){
28      dojo.connect(this.categoryChooser,'onclick',this,'showCategoryChooser');
29      dojo.connect(this.categoryChooser, "onclick", this, "stopCategoryChooserEventBubble");
30    }
31
32    dojo.attr(this.textBox, "value", this.searchBoxCaption);
33    dojo.addClass(this.textBox, "search-caption-on");
34    this.suggestBox.value= ""
35
36    if(this.searchResult){
37      dojo.connect(this.textBox,'oninput',this,'type');
38      dojo.connect(this.textBox,'onkeyup',this,'type');
39      dojo.connect(this.textBox,'oncompositionupdate',this,'type'); //Japanese support
40    }
41
42	  dojo.connect(this.textBox,'onfocus',this,'textBoxFocus');
43	  dojo.connect(this.textBox,'onblur',this,'textBoxBlur');
44	  dojo.connect(this.textBox,'onwebkitspeechchange',this,'soundEnd');
45
46    //if suggestion
47	  if(this.keywordSuggestion=="1"){
48      dojo.connect(this.textBox,'onkeyup',this,'suggest');
49    }
50    dojo.connect(this.suggestBox,'onfocus',this,'suggestBoxFocus');
51    dojo.connect(this.suggestBox, "onclick", this, "stopEventBubble");
52
53	  dojo.connect(this.closeButton,'onclick',this,'closeResults');
54	  dojo.connect(this.searchButton,'onclick',this,'loadResult');
55
56    dojo.connect(this.textBox, "onclick", this, "stopInputEventBubble");
57
58	  if(this.catChooser)
59    dojo.forEach(this.searchCategoriesList, function(entry, i){
60      dojo.connect(entry, "onclick", this, "categorySelection");
61      dojo.connect(entry, "onclick", this, "stopEventBubble");
62    },this);
63	  dojo.connect(window,'onresize',this,'onResize');
64
65  },
66
67  stopEventBubble: function(e){
68    e.stopPropagation();
69  },
70
71  stopInputEventBubble: function(e){
72    this.dummyCloseResult = 1;
73  },
74
75  stopCategoryChooserEventBubble: function(e){
76    this.dummyHideCategory = 1;
77  },
78
79  loadResult : function(e){
80    if(this.targetsearch == 3) {
81      e.stopPropagation();
82    } else {
83      if(this.textBox.value.length >=this.minChars){
84        this.searchForm.submit();
85      }
86    }
87  },
88
89  type: function(evt, force){
90    if (window.event) {
91      if (window.event.type == 'keyup' && window.event.keyCode != 13) return;
92      this.keycode = window.event.keyCode;
93      this.ktype = window.event.type;
94    } else if (evt) {
95      if (evt.type == 'keyup' && evt.which != 13) return;
96      this.keycode = evt.which;
97      this.ktype = evt.type;
98    }
99    if (this.ktype == 'input') this.keycode = 48;
100    clearTimeout(this.t);
101    this.t = setTimeout(dojo.hitch(this, function() {
102      if(((this.targetsearch == 3 && this.keycode==13) || (this.keycode>40 || this.keycode==13) || this.keycode==32 || this.keycode==8 || this.keycode==0 || this.ktype=="click") && this.textBox.value.length >=this.minChars || force==1){
103       var categories = new Array();
104        dojo.forEach(this.searchCategoriesList, function(entry, i){
105          if (dojo.hasClass(entry, "selected"))
106            categories.push(dojo.attr(entry,"id").match(/\d+/)[0]);
107        });
108        dojo.style(this.closeButton, "visibility", "visible");
109        dojo.style(this.textBox,"paddingRight","52px");
110        dojo.addClass(this.closeButton, "search-area-loading");
111        dojo.xhrGet({
112            url : this.searchFormUrl,
113            content: { option: "com_universal_ajax_live_search", lang: this.lang, module_id : this.moduleId, search_exp: this.textBox.value, 'categ[]' : categories, dojo_preventCache: new Date().getTime() },
114            handleAs:"text",
115            preventCache : false,
116            load: dojo.hitch(this,'processResult'),
117            error: function(e){
118              console.log('Error: '+e);
119            }
120        });
121      }
122    }), this.keypressWait);
123  },
124
125  suggest: function(evt){
126    if (window.event) {
127      this.keycode = window.event.keyCode;
128      this.ktype = window.event.type;
129    } else if (evt) {
130      this.keycode = evt.which;
131      this.ktype = evt.type;
132    }
133    if((this.keycode>40 || this.keycode==32 || this.keycode==8 || this.keycode==0 || this.ktype=="click") && this.textBox.value.length >=2 || this.keycode==46 || this.keycode==8 ){
134      dojo.xhrGet({
135          url : this.searchFormUrl,
136          content: { option: "com_universal_ajax_live_search", format: "raw", search_exp: this.textBox.value, suggest: 1, dojo_preventCache : new Date().getTime() },
137          handleAs:"text",
138          preventCache : false,
139          load: dojo.hitch(this,'processSuggestion'),
140          error: function(e){
141            console.log('Error: '+e);
142          }
143      });
144    }else if(this.keycode==39 && this.getCaret(this.textBox)==this.textBox.value.length && this.suggestBox.value!= ""){
145      this.textBox.value+= this.suggestBox.value.substr(this.textBox.value.length);
146      this.type(evt,1);
147    }
148  },
149
150  suggestBoxFocus : function(evt){
151    this.textBox.focus();
152  },
153
154  getCaret: function (el) {
155    if (el.selectionStart) {
156      return el.selectionStart;
157    } else if (document.selection) {
158      el.focus();
159
160      var r = document.selection.createRange();
161      if (r == null) {
162        return 0;
163      }
164
165      var re = el.createTextRange(),
166          rc = re.duplicate();
167      re.moveToBookmark(r.getBookmark());
168      rc.setEndPoint('EndToStart', re);
169
170      return rc.text.length;
171    }
172    return 0;
173  },
174
175  saveSuggestion : function(evt){
176    dojo.xhrGet({
177        url : this.searchFormUrl,
178        content: { option: "com_universal_ajax_live_search", format: "raw", search_exp: this.textBox.value, savesuggest:1, dojo_preventCache : new Date().getTime() },
179        handleAs:"text",
180        preventCache : false
181    });
182    if(this.linktarget != '1') { //check if target is _blank or not
183      setTimeout(dojo.hitch(this, function(ct) {
184        if(!ct)
185          document.location.href = dojo.attr(this.list[this.selected-1],"href");
186        else
187          document.location.href = ct.href;
188      },evt?evt.currentTarget:null),200);
189    }
190  },
191
192  processSuggestion : function(d,xhr){
193    try{
194      var data = eval('('+d+')');
195    }catch(err){
196      alert('SuggestionError: '+d); return;
197    }
198    if (data[0])
199      this.suggestBox.value= this.textBox.value + data[0].suggestion.toLowerCase().substr(this.textBox.value.length);
200    else
201      this.suggestBox.value= "";
202  },
203
204   changeText: function(e) {
205    this.textBox.value = e.currentTarget.innerHTML;
206  },
207
208  textBoxFocus : function(){
209    if (this.catChooser) this.hideCategoryChooser();
210    dojo.addClass(this.searchBoxContainer,"active");
211    if(dojo.hasClass(this.textBox, "search-caption-on")){
212      dojo.attr(this.textBox, "value", "");
213      dojo.removeClass(this.textBox, "search-caption-on");
214    }
215    dojo.addClass(this.node,"active");
216  },
217
218  soundEnd : function(e) {
219    this.textBoxFocus();
220    dojo.attr(this.textBox, "value", e.results[0].utterance);
221    this.type(e,1);
222  },
223
224
225  textBoxBlur : function(){
226    if(dojo.hasClass(this.searchBoxContainer, "active") && !this.resultsVisible){
227      dojo.removeClass(this.searchBoxContainer,"active");
228    }
229    if (this.textBox.value.length==0){
230      dojo.attr(this.textBox, "value", this.searchBoxCaption);
231      dojo.addClass(this.textBox, "search-caption-on");
232      this.suggestBox.value= ""
233    }
234    if(dojo.hasClass(this.node, "active")) dojo.removeClass(this.node,"active");
235  },
236
237  showCategoryChooser : function(evt){
238    if(!this.categoryChooserVisible){
239      this.textBox.blur();
240      if(dojo.style(this.closeButton, "visibility")== "visible"){ //remove results if the were
241        dojo.attr(this.textBox, "value", "");
242        this.closeResults();
243      }
244
245      if(this.categoryFx && this.categoryFx.status() == "playing"){
246        this.categoryFx.stop();
247      }
248      this.categoryChooserVisible = 1;
249      this.textBoxPosition = dojo.position(this.textBox, true);
250
251      var left = this.getCategoryLeftPosition();
252
253      dojo.style(this.searchCategories,{
254        left: left+'px',
255        top: (this.textBoxPosition.y+this.textBoxPosition.h-10+this.categoryChooserTopCorrection)+'px',
256        visibility : 'visible',
257        opacity : '0'
258      });
259      this.categoryFx = dojo.animateProperty({node: this.searchCategories, properties: {opacity : 1, top: { end:this.textBoxPosition.y+this.textBoxPosition.h+this.categoryChooserTopCorrection, units:"px" }}, duration: 200}).play();
260      dojo.addClass(this.categoryChooser,"opened");
261      this.hideCategories = dojo.connect(dojo.body(),'onclick',this,'hideCategoryChooser');
262    }else{
263      this.hideCategoryChooser();
264    }
265  },
266
267  hideCategoryChooser : function(evt){
268    if(this.dummyHideCategory == 1){
269      this.dummyHideCategory = 0;
270      return;
271    }
272    dojo.disconnect(this.hideCategories);
273    if(this.categoryFx && this.categoryFx.status() == "playing"){
274      this.categoryFx.stop();
275    }
276    this.categoryFx = dojo.animateProperty({
277        node: this.searchCategories,
278        properties: {opacity : 0},
279        onEnd: function(){
280          dojo.style(this.node,{visibility : 'hidden'})},
281        duration: 200
282        }).play();
283    dojo.removeClass(this.categoryChooser,"opened");
284    this.categoryChooserVisible = 0;
285  },
286
287  categorySelection: function(evt){
288    var node = evt.currentTarget;
289    if(dojo.hasClass(node, "selected"))
290      dojo.removeClass(node, "selected")
291    else
292      dojo.addClass(node, "selected");
293
294  }
295
296});
297
298dojo.copyTouch = function(sourceObj, targetObj){
299    targetObj.screenX = sourceObj.screenX;
300    targetObj.screenY = sourceObj.screenY;
301    targetObj.identifier = sourceObj.identifier;
302};
303
304/*The drop-style searches base*/
305dojo.declare("AJAXSearchDropBase", AJAXSearchBase, {
306  constructor: function(args) {
307    dojo.mixin(this,args);
308    this.categoryChooserTopCorrection = 0;
309
310    this.searchResults = dojo.create("div", {id: "search-results"+this.id}, dojo.body());
311    this.searchResultsMoovable = dojo.create("div", {id: "search-results-moovable"+this.id}, this.searchResults);
312    this.searchResultsInner = dojo.create("div", {id: "search-results-inner"+this.id}, this.searchResultsMoovable);
313
314    this.touch = {screenX: 0, screenY: 0, identifier: ''};
315    dojo.connect(this.searchResults, "onclick", this, "stopEventBubble");
316
317    dojo.connect(document, "onclick", this, "closeResults");
318	  dojo.connect(this.textBox,'onkeypress',this,'arrowNavigation');
319  },
320
321  onResize: function(){
322    this.textBoxPos = dojo.position(this.searchForm.parentNode, true);
323    var left = this.textBoxPos.x;
324    if (this.resultAlign==1){ // if search result aligned to right
325      left+=this.textBoxPos.w-this.searchRsWidth;
326    }
327    dojo.style(this.searchResults,{
328      left: left+'px',
329      top: this.textBoxPos.y+this.textBoxPos.h+this.resultboxTopOffset+'px'
330    });
331    if(this.dynamicResult=="1"){
332      dojo.style(this.searchResults,{
333        left: left+'px',
334        top: this.textBoxPos.y+this.textBoxPos.h+this.resultboxTopOffset+'px',
335        width : this.textBoxPos.w+'px'
336      });
337      dojo.style(this.searchResultsInner,{
338        width : this.textBoxPos.w+'px'
339      });
340
341      if(dojo.query(".no-result", this.searchResults).length>0)
342      dojo.style(dojo.query(".no-result", this.searchResults)[0],{
343        width : this.textBoxPos.w+'px'
344      });
345
346      dojo.forEach(dojo.query(".result-element", this.searchResults), function(entry, i){
347        dojo.style(entry,{
348          width : this.textBoxPos.w+'px'
349        });
350
351        var span = dojo.query("span", entry);
352        dojo.style(span[0],{
353          width : (this.textBoxPos.w-17)+'px'
354        });
355
356        if(this.showIntroText == 1 && span[1]) {
357            dojo.style(span[1],{
358              width : (this.textBoxPos.w-17)+'px'
359            });
360        }
361
362        if(dojo.hasClass(entry, "result-products")){
363          dojo.style(span[0],{
364            width : (this.textBoxPos.w-12-this.searchImageWidth-17)+'px'
365          });
366          if(this.showIntroText == 1 && span[1]) {
367            dojo.style(span[1],{
368              width : (this.textBoxPos.w-12-this.searchImageWidth-17)+'px'
369            });
370          }
371        }
372
373      },this);
374      this.searchRsWidth = this.textBoxPos.w;
375    }
376  },
377
378  processResult : function(d,xhr){
379    d = d.match(/startofofflajnsearchresult(.+)endofofflajnsearchresult/)[1];
380    try{
381      var data = eval('('+d+')');
382    }catch(err){
383      alert('Error: '+d); return;
384    }
385    // timestamp check if this is the latest search
386    var regexp = /.*&dojo_preventCache=(\d+)/i;
387    var result = xhr.url.match(regexp);
388    if (result[1]){
389      if (result[1]>this.timeStamp){
390        this.timeStamp = result[1];
391      }else{
392        dojo.removeClass(this.closeButton, "search-area-loading");
393        dojo.style(this.closeButton, "visibility", "visible");
394        dojo.style(this.textBox,"paddingRight","52px");
395        return;
396      }
397    }
398
399    dojo.attr(this.searchResultsInner, { innerHTML: "" });
400    this.list=[];
401    this.pluginCounter=[];
402    this.selected = 0;
403    this.onResize();
404
405    if(data.length!=0 && !data.nores){
406      this.paginationBand = new Array();
407      var actualPlugin = 0;
408      for(var i in data){
409        this.paginationBand[actualPlugin] = new Array;
410        var pluginResults = data[i];
411        var pluginNameDiv = dojo.create("div", {'class': "plugin-title"}, this.searchResultsInner);
412        if (actualPlugin==0){
413          dojo.addClass(pluginNameDiv, 'first');
414        }
415        /*Adding plugin title*/
416        dojo.create("div", {'class': "plugin-title-inner", innerHTML: i+" ("+pluginResults.length+")"}, pluginNameDiv);
417
418        /*Generate pagination*/
419        this.generatePagination(pluginNameDiv,pluginResults.length,actualPlugin);
420        this.pluginCounter.push(pluginResults.length);
421
422        /*Generate resultList*/
423        this.generateResultList(pluginResults, actualPlugin);
424
425        actualPlugin++;
426      }
427      /*Set the selected item to 0 (it is invisible)*/
428      this.selectItem(0);
429    }
430
431    this.tags="";
432
433    if(this.searchResultsInner.childNodes.length){
434      this.innerHeight = dojo.marginBox(this.searchResultsInner).h;
435    } else if (data.nores && data.nores[0] && data.nores[0].tag && (data.nores.length>1 || this.textBox.value!=data.nores[0].tag)) { /* No results but keywords found. */
436      var pluginNameDiv = dojo.create("div", {'class': "plugin-title first suggest"}, this.searchResultsInner);
437      dojo.create("div", {'class': "plugin-title-inner", innerHTML: this.stext}, pluginNameDiv);
438      dojo.create("div", {'class': "ajax-clear"}, pluginNameDiv);
439      for (var j=0;j<data.nores.length-1;j++) {
440        if (this.textBox.value!=data.nores[j].tag)
441          this.tags += "<a class='sugg-keyword'>"+data.nores[j].tag+"</a>, ";
442      }
443      this.tags += "<a class='sugg-keyword'>"+data.nores[j].tag+"</a>";
444
445      dojo.create("div", {'class': "no-result-suggest", innerHTML: '<span>'+this.tags+'</span>'}, this.searchResultsInner);
446      dojo.query("a[class=sugg-keyword]").connect("onclick", this,  "changeText");
447      dojo.query("a[class=sugg-keyword]").connect("onclick", this,  "type");
448      this.innerHeight = dojo.marginBox(this.searchResultsInner).h;
449    }else{ /* No result for the keyword */
450      var pluginNameDiv = dojo.create("div", {'class': "plugin-title first"}, this.searchResultsInner);
451      dojo.create("div", {'class': "plugin-title-inner", innerHTML: this.noResultsTitle}, pluginNameDiv);
452      dojo.create("div", {'class': "ajax-clear"}, pluginNameDiv);
453      dojo.create("div", {'class': "no-result", innerHTML: '<span>'+this.noResults+'</span>'}, this.searchResultsInner);
454      this.innerHeight = dojo.marginBox(this.searchResultsInner).h;
455    }
456    dojo.removeClass(this.closeButton, "search-area-loading");
457    this.onResize();
458    this.animateResult();
459  },
460
461  /*Generate pagination*/
462  generatePagination : function(pluginNameDiv, dataLength, actualPlugin){
463    this.paginationBand[actualPlugin].paginators= new Array();
464    if (dataLength>this.productsPerPlugin){ //not generate if there is just 1 page
465      var pagination = dojo.create("div", {'class': "pagination "+"paginator-"+actualPlugin}, pluginNameDiv);
466      var pageNumber = Math.floor(dataLength/this.productsPerPlugin+0.99999);  // 0.99999 constant because: 1.00001 must round to 2, 2.00001 to 3, etc..
467      for(var num=0;num < pageNumber; num++){
468        var paginatorElement = dojo.create("div", {'class': "pager"}, pagination);
469        paginatorElement.parentPlugin = actualPlugin;
470        paginatorElement.page = num;
471
472     	  dojo.connect(paginatorElement,'onclick',this,'moovePage'); // coonect an event to paginators
473
474        if (num==0){
475          dojo.addClass(paginatorElement, 'active');
476          this.paginationBand[actualPlugin].activePaginator = paginatorElement;
477        }
478
479        this.paginationBand[actualPlugin].paginators.push(paginatorElement); //adding the paginators to the band to adding active class when arrows are in use
480      }
481    }
482    dojo.create("div", {'class': "ajax-clear"}, pluginNameDiv);
483  },
484
485  /*Generate resultList*/
486  generateResultList : function(pluginResults, actualPlugin){
487
488    var pageContainer = dojo.create("div", {'class': "page-container"}, this.searchResultsInner);
489    var pageBand = dojo.create("div", {'class': "page-band "+"page-band-"+actualPlugin}, pageContainer);
490    this.paginationBand[actualPlugin].band = pageBand;
491    pageBand.currentPage=0;
492    pageBand.maxPage = Math.floor(pluginResults.length/this.productsPerPlugin+0.99999);
493    pageBand.plugin = actualPlugin;
494    //connect the mouse scroller
495    if(this.enableScroll==1){
496      dojo.connect(pageBand, (!dojo.isMozilla ? "onmousewheel" : "DOMMouseScroll"), this, "scrollResultList");
497  	  dojo.connect(pageBand, "ontouchstart", this, "touchStart");
498  	  dojo.connect(pageBand, "ontouchend", this, "touchEnd");
499  	  dojo.connect(pageBand, "ontouchmove", dojo.stopEvent);
500    }
501    var page = null;
502
503    for(var j=0;j<pluginResults.length;j++){
504      if (j%this.productsPerPlugin==0){ // 2 is the count to show
505        page = dojo.create("div", {'class': "page-element list"+Math.floor(j/this.productsPerPlugin)}, pageBand);
506      }
507      var atag = null;
508      var introText="";
509      if (this.showIntroText==1 && pluginResults[j].text){
510        introText = '<span class="small-desc">'+pluginResults[j].text+'</span>';
511      }
512      if(pluginResults[j].product_img){ //Virtuemart products
513        atag = dojo.create("a", {'class': "result-element result-products", innerHTML: pluginResults[j].product_img+'<span>'+pluginResults[j].title+'</span>'+introText, href:pluginResults[j].href, target: (this.linktarget=="1" ? '_blank' : '') }, page);
514      }else{  // Other search results
515        atag = dojo.create("a", {'class': "result-element", 'oncl
515ick':"return false;", innerHTML: '<span>'+pluginResults[j].title+'</span>'+introText, href:pluginResults[j].href}, page);
516      }
517
518      // SUGGESTION
519      dojo.connect(atag,'onclick',this,'saveSuggestion');
520
521      atag.plugin=actualPlugin;
522      atag.item=j;
523
524      this.list.push(atag);
525      dojo.create("div", {'class': "ajax-clear"}, atag);
526    }
527    if(pluginResults.length<this.productsPerPlugin){
528      dojo.style(pageContainer, "height", dojo.marginBox(pageBand).h +"px");
529    }
530    if(pluginResults.length>=this.seemoreAfter && this.seemoreEnabled){
531    var seemorediv = dojo.create("div", {'id':"seemore",'class': "seemore", innerHTML: '<span>'+this.seeMoreResults+'</span>'}, this.searchResultsInner);
532    dojo.connect(seemorediv,'onclick',this,'loadResult');
533    dojo.removeClass(this.searchResultsInner, "withoutseemore");
534    //dojo.style(this.searchResultsInner,"paddingBottom","0px");
535    }else{
536    dojo.addClass(this.searchResultsInner, "withoutseemore");
537     //dojo.style(this.searchResultsInner,"paddingBottom","10px");
538    }
539  },
540
541  moovePage : function(event){
542    var pager = event.target;
543    var band = this.paginationBand[pager.parentPlugin].band;
544    dojo.removeClass(this.paginationBand[pager.parentPlugin].activePaginator,"active");
545    dojo.addClass(pager, "active");
546    this.paginationBand[pager.parentPlugin].activePaginator = pager;
547
548    if(band.actFx && band.actFx.status() == "playing"){
549      band.actFx.stop();
550    }
551    band.actFx = dojo.animateProperty({node: band, properties: {left: -pager.page*this.searchRsWidth}, duration: 500}).play();
552    this.textBox.focus();
553  },
554
555  scrollPluginResults : function(band, page){
556    if(band.actFx && band.actFx.status() == "playing"){
557      band.actFx.stop();
558    }
559    band.actFx = dojo.animateProperty({node: band, properties: {left: -page*this.searchRsWidth}, duration: 250}).play();
560    band.currentPage=page;
561  },
562
563  animateResult : function(){
564    if(this.actFx && this.actFx.status() == "playing"){
565      this.actFx.stop();
566    }
567    this.resultsVisible = 1;
568    dojo.style(this.searchResults, "visibility", "visible");
569    if(this.innerHeight){
570      this.actFx = this.getResultBoxAnimation();
571    } else{ // No results found
572      this.actFx = dojo.animateProperty({
573          node: this.searchResultsMoovable,
574          properties: {
575              height: 0
576          },
577          duration: 500,
578          onEnd : dojo.hitch(this,'removeResults')
579          }).play();
580    }
581    dojo.style(this.closeButton, "visibility", "visible");
582    dojo.style(this.textBox,"paddingRight","52px");
583  },
584
585  closeResults : function(e){
586  dojo.style(this.textBox,"paddingRight","30px");
587    if(e && e.button && e.button > 0) return;
588    if(this.dummyCloseResult == 1){
589      this.dummyCloseResult = 0;
590      return;
591    }
592    if(this.actFx && this.actFx.status() == "playing"){
593      if(dojo.hasClass(this.textBox, "search-caption-on"))
594        return;
595      this.actFx.stop();
596    }
597    this.actFx = this.getCloseResultBoxAnimation();
598    dojo.style(this.closeButton, "visibility", "hidden");
599    dojo.style(this.textBox,"paddingRight","30px");
600    dojo.attr(this.textBox, "value", this.searchBoxCaption);
601    dojo.addClass(this.textBox, "search-caption-on");
602    this.suggestBox.value= ""
603
604  },
605
606  removeResults: function(){
607    this.fadeInResult=1;
608    dojo.attr(this.searchResultsInner, { innerHTML: "" });
609    if(this.searchResultsInner.childNodes.length){
610      this.innerHeight = dojo.marginBox(this.searchResultsInner).h;
611    }else{
612      this.innerHeight=0;
613    }
614    dojo.style(this.searchResults, "visibility", "hidden");
615    this.resultsVisible=0;
616    if(dojo.hasClass(this.searchBoxContainer, "active") && !this.resultsVisible){
617      dojo.removeClass(this.searchBoxContainer,"active");
618    }
619  },
620
621  /*keyCodes:
622    UP: 38
623    DOWN: 40
624    ENTER: 13*/
625
626  arrowNavigation: function(evt){
627    if(evt.keyCode==27){ //blur if esc pressed
628      this.textBox.blur();
629      if(dojo.style(this.closeButton, "visibility")== "visible"){ //remove results if the were
630        dojo.attr(this.textBox, "value", "");
631        this.closeResults();
632      }
633    }
634    if(this.list.length){
635      if(evt.keyCode==38){
636        this.selectItem(this.selected-1);
637      }else if (evt.keyCode==40){
638        this.selectItem(this.selected+1);
639      }else if (evt.keyCode==13){
640        if(this.selected==0){
641          this.loadResult();
642        }else{
643          this.saveSuggestion();
644          // Here was the href loading
645        }
646      }
647
648      if(this.selected>0){
649        var actPlugin = this.list[this.selected-1].plugin;
650        var actPluginItem = this.list[this.selected-1].item;
651        var band = this.paginationBand[actPlugin].band;
652        var pgNumber = Math.floor(actPluginItem/this.productsPerPlugin);
653        if(this.paginationBand[actPlugin].activePaginator){
654          dojo.removeClass(this.paginationBand[actPlugin].activePaginator,"active");
655
656          this.scrollPluginResults(band,pgNumber);
657          var pager = this.paginationBand[actPlugin].paginators[pgNumber];
658          dojo.addClass(pager, "active");
659          this.paginationBand[actPlugin].activePaginator = pager;
660        }
661      }
662
663    }else if(evt.keyCode==13){
664    	this.loadResult();
665    }
666  },
667  //scrolling the results
668  scrollResultList : function(evt){
669    var scroll = evt[(!dojo.isMozilla ? "wheelDelta" : "detail")] * (!dojo.isMozilla ? 1 : -1);
670    var band = evt.currentTarget;
671    if (band.maxPage>1){
672      var actPlugin = band.plugin;
673      dojo.removeClass(this.paginationBand[actPlugin].activePaginator,"active");
674      var pgNumber = band.currentPage;
675      if(scroll<0 && pgNumber<band.maxPage-1){
676        pgNumber++;
677      }else if(scroll<0 && pgNumber>=band.maxPage-1){
678        pgNumber=0;
679      }else if(scroll>0 && pgNumber>0){
680        pgNumber--;
681      }else if(scroll>0 && pgNumber<=0){
682        pgNumber=band.maxPage-1;
683      }
684      this.scrollPluginResults(band,pgNumber);
685      var pager = this.paginationBand[actPlugin].paginators[pgNumber];
686      dojo.addClass(pager, "active");
687      this.paginationBand[actPlugin].activePaginator = pager;
688      dojo.stopEvent(evt);
689    }
690  },
691
692  selectItem : function(num){
693    if(num>=this.list.length+1){
694      num-=this.list.length+1;
695    }
696    if(num<0){
697      num+=this.list.length+1;
698    }
699    if(this.list[this.selected-1]){
700      dojo.removeClass(this.list[this.selected-1], "selected-element");
701    }
702    if(this.list[num-1]){
703      dojo.addClass(this.list[num-1], "selected-element");
704    }
705    this.selected=num;
706  },
707
708  post_to_url: function(path, params, method) {
709    method = method || "post"; // Set method to post by default, if not specified.
710
711    // The rest of this code assumes you are not using a library.
712    // It can be made less wordy if you use one.
713    var form = document.createElement("form");
714    form.setAttribute("method", method);
715    form.setAttribute("action", path);
716
717    for(var key in params) {
718        var hiddenField = document.createElement("input");
719        hiddenField.setAttribute("type", "hidden");
720        hiddenField.setAttribute("name", key);
721        hiddenField.setAttribute("value", params[key]);
722
723        form.appendChild(hiddenField);
724    }
725
726    document.body.appendChild(form);
727    form.submit();
728  },
729
730  /*TOUCH Evenets*/
731  touchStart: function(e){
732    dojo.copyTouch(e.changedTouches[0], this.touch);
733  },
734
735  touchEnd: function(e){
736    if(this.touch.identifier == e.changedTouches[0].identifier){
737      var dist = Math.sqrt(Math.pow(e.changedTouches[0].screenX-this.touch.screenX, 2) + Math.pow(e.changedTouches[0].screenY-this.touch.screenY, 2));
738      if(dist > 80){
739        var deg = Math.asin((e.changedTouches[0].screenY-this.touch.screenY)/dist)*180/Math.PI;
740        if(deg < 45 && deg > -45){ //horizontal
741          var scroll = e.changedTouches[0].screenX-this.touch.screenX;
742            this.paginateTouch(e,scroll);
743        }
744      }
745    }
746  },
747
748  paginateTouch: function(evt, direction){
749    var band = evt.currentTarget;
750    if (band.maxPage>1){
751      var actPlugin = band.plugin;
752      dojo.removeClass(this.paginationBand[actPlugin].activePaginator,"active");
753      var pgNumber = band.currentPage;
754      if(direction<0 && pgNumber<band.maxPage-1){
755        pgNumber++;
756      }else if(direction<0 && pgNumber>=band.maxPage-1){
757        pgNumber=0;
758      }else if(direction>0 && pgNumber>0){
759        pgNumber--;
760      }else if(direction>0 && pgNumber<=0){
761        pgNumber=band.maxPage-1;
762      }
763      this.scrollPluginResults(band,pgNumber);
764      var pager = this.paginationBand[actPlugin].paginators[pgNumber];
765      dojo.addClass(pager, "active");
766      this.paginationBand[actPlugin].activePaginator = pager;
767      dojo.stopEvent(evt);
768    }
769  }
770
771});
772var AJAXSearch = {};
773
774dojo.declare("AJAXSearchelegant", AJAXSearchDropBase, {
775  constructor: function(args) {
776    this.resultboxTopOffset = 0;
777  },
778  
779  closeResults : function(e){
780  dojo.style(this.textBox,"paddingRight","39px");
781    if(e && e.button && e.button > 0) return;
782    if(this.dummyCloseResult == 1){
783      this.dummyCloseResult = 0;
784      return;
785    }
786    if(this.actFx && this.actFx.status() == "playing"){
787      if(dojo.hasClass(this.textBox, "search-caption-on"))
788        return;
789      this.actFx.stop();
790    }
791    this.actFx = this.getCloseResultBoxAnimation();
792    dojo.style(this.closeButton, "visibility", "hidden");
793   // dojo.style(this.textBox,"paddingRight","30px");
794    dojo.attr(this.textBox, "value", this.searchBoxCaption);
795    dojo.addClass(this.textBox, "search-caption-on");
796    this.suggestBox.value= ""
797    
798  },  
799  
800  getResultBoxAnimation: function(){
801    return dojo.animateProperty({
802      node: this.searchResultsMoovable, 
803      properties: {
804        height: {start: dojo.style(this.searchResultsMoovable, 'height'), end: this.innerHeight}
805      }, 
806      duration: 500
807    }).play();
808  },
809  
810  getCloseResultBoxAnimation: function(){
811    return dojo.animateProperty({
812      node: this.searchResultsMoovable, 
813      properties: {
814        height: 0
815      }, 
816      duration: 500, 
817      onEnd : dojo.hitch(this,'removeResults')
818    }).play();
819  },
820  
821  getCategoryLeftPosition: function(){
822    return this.textBoxPosition.x;
823  }
824});
825})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.