1//use anonymous function to prevent scope pollution 2(function (WIN, $) { 3 var kl = {}; 4 5 kl.myAjax=function(pageurl, contentId) { 6 var href = this.href, 7 desireResponse, 8 request = $.ajax({ 9 type: "GET", 10 url: pageurl, 11 data: { 12 target: href 13 } 14 }); 15 request.success(function (resp) { 16 desireResponse = $(resp).find(contentId).children(); 17 18 console.log(desireResponse); 19 $(contentId).html(desireResponse) 20 }); 21 request.error(function (jqXHR, textStatus) { 22 $(container).html(textStatus) 23 }); 24 } 25 26 kl.popupshow = function ($element, $pwrapper, $pcontent) { 27 var pushDom = $element.html() 28 $pwrapper.html(pushDom); 29 $pcontent.css("display", "block"); 30 $(".veil").css("display", "block"); 31 $(".container").css("opacity", "0.2"); 32 } 33 kl.successshow = function () { 34 $(".success").animate({ 35 opacity: 0.2 36 }); 37 } 38 kl.closePopup = function (el) { 39 el.parent().hide(); 40 if($('.results:visible').length==0 && $('.loginwrapper:visible').length==0){ 41 $(".veil").css("display", "none"); 42 $(".container").css("opacity", "1"); 43 } 44 } 45 kl.wordFilter = function (str) { 46 var filterWords = ["fool", "dumb", "shit", "ass", "couch potato","fuck","chut","lund","gaand","chod","bhadwa"]; 47 var rgx = new RegExp(filterWords.join("|"), "gi"); 48 return str.replace(rgx, "****"); 49 } 50 //kl.otherOptions = function ($select) { 51 //console.log($select.val()); 52 //if($select.val()=="Others"){ 53 54 //$select.find('.selectBox').show(); 55 //$select.find('.selectBox').find('input').val(""); 56 //console.log($select.next('.selectBox').find('input').val()); 57 //$select.find('.selectBox input').removeAttr("disabled"); 58 //}else{ 59 // $select.find('.selectBox').hide(); 60 //} 61 //} 62 kl.customSelect = function ($element) { 63 64 var $select = $element.find('select'); 65 if($element.find('.selectWrapper').length===0){ 66 $element.prepend('<span class="selectWrapper"><span class="selectText"></span></span>'); 67 } 68 selectval = $select.val(), 69 $selectTxt = $element.find('.selectText'); 70 $selectWrapper = $element.find('.selectWrapper'); 71 $selectTxt.text(selectval); 72 if($element.find('.otherBox').length>0){ 73 if(selectval=="Others"){ 74 75 $element.find('.otherBox').show(); 76 $element.find('.otherBox').find('input').val(""); 77 //console.log($select.next('.selectBox').find('input').val()); 78 $element.find('.otherBox input').removeAttr("disabled"); 79 }else{ 80 $element.find('.otherBox').hide(); 81 } 82 } 83 //console.log($selectTxt.width()); 84 //trim = function($selectTxt){ 85 var CharCount=$selectTxt.text().length; 86 if(CharCount > 30 && $selectTxt.width()>190){ 87 var shortText=$selectTxt.text().trim().substring(0, 30).split(" ").join(" ") + "...."; // use slice(0, -1) if want truncet last word 88 $selectTxt.text(shortText); 89 } 90 //} 91 //trim($selectTxt); 92 93 //if($selectTxt.height()>$selectWrapper.height()){ 94 //$selectWrapper.append($('<span class="dotted"></span>').text('....')); 95 //}else{ 96 //$selectWrapper.find('.dotted').remove(); 97 //} 98 99 } 100 101 102 103 104 init = function(){ 105 106 /* if (screen.width >= 992 ) { 107 $('#googleads').load('includes/google-static.php'); 108 }else{ 109 $('#googleads').load('includes/google-responsive.php'); 110 }*/ 111 112 var containerHeight=$('.pagecontent').outerHeight(), 113 aboveHeight = $('header').outerHeight(), 114 navHeight = $('.nav').outerHeight(), 115 pagetopHeight = $('.pagetop').outerHeight(), 116 topPos =aboveHeight+navHeight+pagetopHeight, 117 loginPos = $('.loginBox').position() || 0; 118 loginTop = loginPos.top || 0; 119 searchPos = $('.logo').position(); 120 searchTop = searchPos.top; 121 veilHeight = containerHeight-topPos; 122 $('.veil').css({height:veilHeight,top:topPos}); 123 124 $("#messageBox").hide().slideDown(); 125 setTimeout(function(){ 126 $("#messageBox").fadeOut(400).slideUp(1000); 127 }, 3000); 128 129 $(".validate").validate(); 130 $("#regform").validate(); 131 $("#loginform").validate(); 132 133 $('.top-mb').click(function(event) { 134 $(this).toggleClass('openedmenu'); 135 $('.side-nav').removeClass('shownav'); 136 $('.side-mb').removeClass('openedmenu'); 137 $('.navbar ul').toggleClass('shownav'); 138 }); 139 140 $('.side-mb').click(function(event) { 141 $('.side-nav').toggleClass('shownav'); 142 $(this).toggleClass('openedmenu'); 143 $('.top-mb').removeClass('openedmenu'); 144 $('.navbar ul').removeClass('shownav'); 145 }); 146 147 $('body').on('click','.list-items h4', function(e) { 148 $(this).next('.list-content').slideToggle(); 149 }); 150 151 152 var ajax_load = "<img src='images/ajax-loader.gif'> Loading please wait..."; 153 $(".cat-nav a, .alphalist a, #pagination a").each(function () { 154 $(this).click(function (e) { 155 e.preventDefault(); 156 var linkurl = $(this).attr('href'), 157 result = $('#businessList'); 158 159 kl.myAjax(linkurl, '#businessList'); 160 $(document).ajaxStart(function () { 161 $("#businessList").html(ajax_load); 162 }); 163 //$("html").scrollTop(400); 164 document.querySelector('.main-content').scrollIntoView(); 165 //$("#result").html(ajax_load) 166 //.load("job_details.php", "id="+jobId); 167 }) 168 }); 169 170 $(".close").click(function () { 171 kl.closePopup($(this)); 172 }); 173 //Calculate the height of <header> 174 //Use outerHeight() instead of height() if have padding 175 //when scroll 176 $(window).scroll(function () { 177 //if scrolled down more than the header's height 178 if ($(window).scrollTop() > aboveHeight) { 179 // if yes, add "fixed" class to the <nav> 180 // add padding top to the #content 181 //(value is same as the height of the nav) 182 $('.navbar').addClass('fixed').css('top', '0').next().css('padding-top', '60px').fadeIn('fast'); 183 $('.nav-icon').show(); 184 } else { 185 // when scroll up or less than aboveHeight, 186 //remove the "fixed" class, and the padding-top 187 $('.navbar').removeClass('fixed').next().css('padding-top', '0').fadeIn('fast'); 188 $('.nav-icon').hide(); 189 } 190 }); 191 192 193 } 194 195 $(document).ready(function () { 196 init(); 197 }); 198 199 WIN.kl = kl; 200})(window,jQuery);
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.