1(function( $ ) { 2 'use strict'; 3 4 /** 5 * All of the code for your public-facing JavaScript source 6 * should reside in this file. 7 * 8 * Note: It has been assumed you will write jQuery code here, so the 9 * $ function reference has been prepared for usage within the scope 10 * of this function. 11 * 12 * This enables you to define handlers, for when the DOM is ready: 13 * 14 * $(function() { 15 * 16 * }); 17 * 18 * When the window is loaded: 19 * 20 * $( window ).load(function() { 21 * 22 * }); 23 * 24 * ...and/or other possibilities. 25 * 26 * Ideally, it is not considered best practise to attach more than a 27 * single DOM-ready or window-load handler for a particular page. 28 * Although scripts in the WordPress core, Plugins and Themes may be 29 * practising this, we should strive to set a better example in our own work. 30 */ 31 32 $('.wdk-order').on('change', function(){ 33 var curr_url = wdk_removeParam('order_by', document.location.toString()); 34 if (curr_url.indexOf('#') == -1) { 35 // Fine 36 } else { 37 // Remove this part related 38 curr_url = curr_url.substr(0, curr_url.indexOf('#')); 39 } 40 41 var del_char = '&'; 42 if (curr_url.indexOf('?') == -1) 43 del_char = '?'; 44 45 document.location = curr_url + del_char + 'order_by=' + $(this).val()+'#results'; 46 }) 47 48 $('.wmvc-view-type a').on('click', function (e) { 49 e.preventDefault(); 50 var curr_url = wdk_removeParam('wmvc_view_type', document.location.toString()); 51 if (curr_url.indexOf('#') == -1) { 52 // Fine 53 } else { 54 // Remove this part related 55 curr_url = curr_url.substr(0, curr_url.indexOf('#')); 56 } 57 58 var del_char = '&'; 59 if (curr_url.indexOf('?') == -1) 60 del_char = '?'; 61 62 document.location = curr_url + del_char + 'wmvc_view_type=' + $(this).attr('data-id')+'#results'; 63 }) 64 65 $('.wdk-categories-tree a.btn-more').on('click', function (e) { 66 e.preventDefault(); 67 $(this).closest('.wdk-categories-tree').find('.category-block').removeClass('wdk-hidden'); 68 $(this).closest('.wdk-col').remove(); 69 }) 70 71 $('.wdk-categories-tree .wdk-categories .wdk-item.wdk-item-toggle').each(function(){ 72 $(this).closest('.wdk-categories').append($(this).detach()); 73 }); 74 75 $('.wdk-categories-tree .wdk-categories a.wdk-link-show-more').off().on('click', function (e) { 76 e.preventDefault(); 77 var btn = $(this).closest('.wdk-item-toggle'); 78 btn.siblings('.wdk-item.more-sub').toggle(); 79 }) 80 81 $('.route_suggestion').off().on('submit', function (e) { 82 e.preventDefault(); 83 window.open("//maps.google.com/maps?saddr="+$(this).find('input[name="route_from"]').val()+"&daddr="+$(this).find('input[name="address"]').val()+"@"+$(this).find('input[name="gps"]').val()+"",'_blank'); 84 return false; 85 }) 86 87 88 89 90})(jQuery); 91 92function wdk_removeParam(key, sourceURL) { 93 var rtn = sourceURL.split("?")[0], 94 param, 95 params_arr = [], 96 queryString = (sourceURL.indexOf("?") !== -1) ? sourceURL.split("?")[1] : ""; 97 if (queryString !== "") { 98 params_arr = queryString.split("&"); 99 for (var i = params_arr.length - 1; i >= 0; i -= 1) { 100 param = params_arr[i].split("=")[0]; 101 if (param === key) { 102 params_arr.splice(i, 1); 103 } 104 } 105 if (params_arr.length) rtn = rtn + "?" + params_arr.join("&"); 106 } 107 return rtn; 108} 109 110function wdk_splitUrl() { 111 var vars = [], 112 hash; 113 var url = document.URL.split('?')[0]; 114 var p = document.URL.split('?')[1]; 115 if (p != undefined) { 116 p = p.split('&'); 117 for (var i = 0; i < p.length; i++) { 118 hash = p[i].split('='); 119 vars.push(hash[1]); 120 vars[hash[0]] = hash[1]; 121 } 122 } 123 vars['url'] = url; 124 return vars; 125};
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.