1// Avoid `console` errors in browsers that lack a console. 2(function() { 3 var method; 4 var noop = function () {}; 5 var methods = [ 6 'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error', 7 'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log', 8 'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd', 9 'timeStamp', 'trace', 'warn' 10 ]; 11 var length = methods.length; 12 var console = (window.console = window.console || {}); 13 14 while (length--) { 15 method = methods[length]; 16 17 // Only stub undefined methods. 18 if (!console[method]) { 19 console[method] = noop; 20 } 21 } 22}()); 23// Place any jQuery/helper plugins in here. 24// tooltip ***/ 25$(function () { 26 $('[data-toggle="tooltip"]').tooltip() 27}) 28// range slider ***/ 29// $("#priceRange").slider({}); 30// custom drop down list ***/ 31function tamingselect() 32{ 33 if(!document.getElementById && !document.createTextNode){return;} 34 35// Classes for the link and the visible dropdown 36 var ts_selectclass='turnintodropdown_demo2'; // class to identify selects 37 var ts_listclass='turnintoselect_demo2'; // class to identify ULs 38 var ts_boxclass='dropcontainer_demo2'; // parent element 39 var ts_triggeron='activetrigger_demo2'; // class for the active trigger link 40 var ts_triggeroff='trigger_demo2'; // class for the inactive trigger link 41 var ts_dropdownclosed='dropdownhidden_demo2'; // closed dropdown 42 var ts_dropdownopen='dropdownvisible_demo2'; // open dropdown 43/* 44 Turn all selects into DOM dropdowns 45*/ 46 var count=0; 47 var toreplace=new Array(); 48 var sels=document.getElementsByTagName('select'); 49 for(var i=0;i<sels.length;i++){ 50 if (ts_check(sels[i],ts_selectclass)) 51 { 52 var hiddenfield=document.createElement('input'); 53 hiddenfield.name=sels[i].name; 54 hiddenfield.type='hidden'; 55 hiddenfield.id=sels[i].id; 56 hiddenfield.value=sels[i].options[0].value; 57 sels[i].parentNode.insertBefore(hiddenfield,sels[i]) 58 var trigger=document.createElement('a'); 59 ts_addclass(trigger,ts_triggeroff); 60 trigger.href='#'; 61 trigger.onclick=function(){ 62 ts_swapclass(this,ts_triggeroff,ts_triggeron) 63 ts_swapclass(this.parentNode.getElementsByTagName('ul')[0],ts_dropdownclosed,ts_dropdownopen); 64 return false; 65 } 66 trigger.appendChild(document.createTextNode(sels[i].options[0].text)); 67 sels[i].parentNode.insertBefore(trigger,sels[i]); 68 var replaceUL=document.createElement('ul'); 69 for(var j=0;j<sels[i].getElementsByTagName('option').length;j++) 70 { 71 var newli=document.createElement('li'); 72 var newa=document.createElement('a'); 73 newli.v=sels[i].getElementsByTagName('option')[j].value; 74 newli.elm=hiddenfield; 75 newli.istrigger=trigger; 76 newa.href='#'; 77 newa.appendChild(document.createTextNode( 78 sels[i].getElementsByTagName('option')[j].text)); 79 newli.onclick=function(){ 80 this.elm.value=this.v; 81 ts_swapclass(this.istrigger,ts_triggeron,ts_triggeroff); 82 ts_swapclass(this.parentNode,ts_dropdownopen,ts_dropdownclosed) 83 this.istrigger.firstChild.nodeValue=this.firstChild.firstChild.nodeValue; 84 return false; 85 } 86 newli.appendChild(newa); 87 replaceUL.appendChild(newli); 88 } 89 ts_addclass(replaceUL,ts_dropdownclosed); 90 var div=document.createElement('div'); 91 div.appendChild(replaceUL); 92 ts_addclass(div,ts_boxclass); 93 sels[i].parentNode.insertBefore(div,sels[i]) 94 toreplace[count]=sels[i]; 95 count++; 96 } 97 } 98/* 99 Turn all ULs with the class defined above into dropdown navigations 100*/ 101 var uls=document.getElementsByTagName('ul'); 102 for(var i=0;i<uls.length;i++) 103 { 104 if(ts_check(uls[i],ts_listclass)) 105 { 106 var newform=document.createElement('form'); 107 var newselect=document.createElement('select'); 108 for(j=0;j<uls[i].getElementsByTagName('a').length;j++) 109 { 110 var newopt=document.createElement('option'); 111 newopt.value=uls[i].getElementsByTagName('a')[j].href; 112 newopt.appendChild(document.createTextNode(uls[i].getElementsByTagName('a')[j].innerHTML)); 113 newselect.appendChild(newopt); 114 } 115 newselect.onchange=function() 116 { 117 window.location=this.options[this.selectedIndex].value; 118 } 119 newform.appendChild(newselect); 120 uls[i].parentNode.insertBefore(newform,uls[i]); 121 toreplace[count]=uls[i]; 122 count++; 123 } 124 } 125 for(i=0;i<count;i++){ 126 toreplace[i].parentNode.removeChild(toreplace[i]); 127 } 128 function ts_check(o,c) 129 { 130 return new RegExp('\\b'+c+'\\b').test(o.className); 131 } 132 function ts_swapclass(o,c1,c2) 133 { 134 var cn=o.className 135 o.className=!ts_check(o,c1)?cn.replace(c2,c1):cn.replace(c1,c2); 136 } 137 function ts_addclass(o,c) 138 { 139 if(!ts_check(o,c)){o.className+=o.className==''?c:' '+c;} 140 } 141} 142window.onload=function() 143{ 144 tamingselect(); 145 // add more functions if necessary 146}
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.