1(function($) { 2 "use strict"; 3 4/* -------------------------------------------------------------------------* 5 * GET BASE URL 6 * -------------------------------------------------------------------------*/ 7 8function getBaseURL() { 9 var url = location.href; // entire url including querystring - also: window.location.href; 10 var baseURL = url.substring(0, url.indexOf('/', 14)); 11 12 13 if (baseURL.indexOf('http://localhost') != -1) { 14 // Base Url for localhost 15 var url = location.href; // window.location.href; 16 var pathname = location.pathname; // window.location.pathname; 17 var index1 = url.indexOf(pathname); 18 var index2 = url.indexOf("/", index1 + 1); 19 var baseLocalUrl = url.substr(0, index2); 20 21 return baseLocalUrl + "/"; 22 } 23 else { 24 // Root Url for domain name 25 return baseURL; 26 } 27 28} 29 30/* -------------------------------------------------------------------------* 31 * CONTACT FORM EMAIL VALIDATION 32 * -------------------------------------------------------------------------*/ 33 34 function Validate() { 35 var errors = ""; 36 var reason_name = ""; 37 var reason_mail = ""; 38 var reason_message = ""; 39 40 reason_name += validateName(document.getElementById('writecomment').u_name); 41 reason_mail += validateEmail(document.getElementById('writecomment').email); 42 reason_message += validateMessage(document.getElementById('writecomment').message); 43 44 45 if (reason_name != "") { 46 jQuery("#contact-name-error .ot-error-text").text(reason_name); 47 jQuery(".contact-form-user input").addClass("error"); 48 jQuery("#contact-name-error").fadeIn(1000); 49 errors = "Error"; 50 } else { 51 jQuery(".comment-form-user input").removeClass("error"); 52 jQuery("#contact-name-error").css({ 'display': 'none'}); 53 } 54 55 56 if (reason_mail != "") { 57 jQuery("#contact-mail-error .ot-error-text").text(reason_mail); 58 jQuery(".contact-form-email input").addClass("error"); 59 jQuery("#contact-mail-error").fadeIn(1000); 60 errors = "Error"; 61 } else { 62 jQuery(".contact-form-email input").removeClass("error"); 63 jQuery("#contact-mail-error").css({ 'display': 'none'}); 64 } 65 66 if (reason_message != "") { 67 jQuery("#contact-message-error .ot-error-text").text(reason_message); 68 jQuery(".contact-form-message textarea").addClass("error"); 69 jQuery("#contact-message-error").fadeIn(1000); 70 errors = "Error"; 71 } else { 72 jQuery(".contact-form-message textarea").removeClass("error"); 73 jQuery("#contact-message-error").css({ 'display': 'none'}); 74 } 75 76 if (errors != ""){ 77 return false; 78 } else { 79 return true; 80 } 81 82 //document.getElementById("writecomment").submit(); return false; 83 } 84 85/* -------------------------------------------------------------------------* 86 * AWEBER WIDGET VALIDATION 87 * -------------------------------------------------------------------------*/ 88 89 function Validate_aweber(thisForm) { 90 var errors = ""; 91 var reason_name = ""; 92 var reason_mail = ""; 93 94 reason_name += valName(thisForm.find('.u_name').val()); 95 reason_mail += valEmail(thisForm.find('.email').val()); 96 97 98 if (reason_name != "") { 99 thisForm.parent().parent().find(".aweber-fail").css({ 'display': 'block'}); 100 errors = "Error"; 101 } else { 102 thisForm.parent().parent().find(".aweber-fail").css({ 'display': 'none'}); 103 } 104 105 if (reason_mail != "") { 106 thisForm.parent().parent().find(".aweber-fail").css({ 'display': 'block'}); 107 errors = "Error"; 108 } else { 109 thisForm.parent().parent().find(".aweber-fail").css({ 'display': 'none'}); 110 } 111 112 113 if (errors != ""){ 114 refreshMegamenu(); 115 return false; 116 } else { 117 return true; 118 } 119 120 //document.getElementById("aweber-form").submit(); return false; 121 } 122 123 124 function implode( glue, pieces ) { 125 return ( ( pieces instanceof Array ) ? pieces.join ( glue ) : pieces ); 126 } 127 128/* -------------------------------------------------------------------------* 129 * SEARCH IN NAVIGATION 130 * -------------------------------------------------------------------------*/ 131 132 jQuery(document).ready(function() { 133 jQuery(".navigation-search").append("<ul id=\"navigation-search\" style=\"display: none;\"><li><form method=\"get\" action=\"\" name=\"searchform\" ><input type=\"text\" class=\"search\" placeholder=\"Search here \" name=\"s\" id=\"s\"/><input type=\"submit\" class=\"submit\" /></form></li></ul>"); 134 jQuery(".navigation-search > a >
134 i").wrap("<span></span>"); 135 jQuery(".navigation-search").mouseover(function() { 136 jQuery("#navigation-search").show(); 137 }); 138 jQuery(".navigation-search").mouseout(function() { 139 jQuery("#navigation-search").hide(); 140 }); 141 }); 142 143/* -------------------------------------------------------------------------* 144 * SUBMIT CONTACT FORM 145 * -------------------------------------------------------------------------*/ 146 jQuery(document).ready(function(jQuery){ 147 var adminUrl = ot.adminUrl; 148 jQuery('#contact-submit').click(function() { 149 if (Validate()==true) { 150 var str = jQuery("#writecomment").serialize(); 151 jQuery.ajax({ 152 url:adminUrl, 153 type:"POST", 154 data:"action=footer_contact_form&"+(str), 155 success:function(results) { 156 jQuery(".contact-success-block").css({ 'display': 'block'}); 157 jQuery("#writecomment").css({ 'display': 'none'}); 158 } 159 }); 160 return false; 161 } else { 162 return false; 163 } 164 }); 165 }); 166/* -------------------------------------------------------------------------* 167 * SUBMIT AWEBER WIDGET FORM 168 * -------------------------------------------------------------------------*/ 169 jQuery(document).ready(function(jQuery){ 170 var adminUrl = ot.adminUrl; 171 jQuery('.aweber-submit').click(function() { 172 var thisForm = jQuery(this).closest(".aweber-form") 173 if (Validate_aweber(thisForm)==true) { 174 var str = thisForm.serialize(); 175 thisForm.parent().parent().find(".aweber-loading").css({ 'display': 'block'}); 176 jQuery.ajax({ 177 url:adminUrl, 178 type:"POST", 179 data:"action=aweber_form&"+str, 180 success:function(results) { 181 if(results){ 182 thisForm.parent().parent().find(".aweber-loading").css({ 'display': 'none'}); 183 thisForm.parent().parent().find(".aweber-fail").css({ 'display': 'block'}); 184 thisForm.parent().parent().find(".aweber-fail .response").html(results); 185 } else { 186 thisForm.parent().parent().find(".aweber-form").css({ 'display': 'none'}); 187 thisForm.parent().parent().find(".aweber-success").css({ 'display': 'block'}); 188 thisForm.parent().parent().find(".aweber-loading").css({ 'display': 'none'}); 189 } 190 } 191 }); 192 return false; 193 } 194 return false; 195 }); 196 }); 197 198 199/* -------------------------------------------------------------------------* 200 * ADD CLASS TO COMMENT BUTTON 201 * -------------------------------------------------------------------------*/ 202jQuery(document).ready(function(){ 203 jQuery('#writecomment .form-submit input').addClass('button'); 204 jQuery('.comment-reply-link').addClass('read-more-link'); 205 206}); 207 208 209 210 211function removeHash () { 212 var scrollV, scrollH, loc = window.location; 213 if ("pushState" in history) 214 history.pushState("", document.title, loc.pathname + loc.search); 215 else { 216 // Prevent scrolling by storing the page's current scroll offset 217 scrollV = document.body.scrollTop; 218 scrollH = document.body.scrollLeft; 219 220 loc.hash = ""; 221 222 // Restore the scroll offset, should be flicker free 223 document.body.scrollTop = scrollV; 224 document.body.scrollLeft = scrollH; 225 } 226} 227 228/* -------------------------------------------------------------------------* 229 * LIGHTBOX SLIDER 230 * -------------------------------------------------------------------------*/ 231 function OT_lightbox_slider(el,side) { 232 233 if(el.attr('rel')%8==0 && side == "right") { 234 //carousel('right'); 235 } 236 237 if(el.attr('rel')%7==0 && side == "left") { 238 //carousel('left'); 239 } 240 241 } 242 243/* -------------------------------------------------------------------------* 244 * SOCIAL POPOUP WINDOW 245 * -------------------------------------------------------------------------*/ 246 jQuery('.ot-share, .ot-tweet, .ot-pin, .ot-pluss, .ot-link').click(function(event) { 247 var width = 575, 248 height = 400, 249 left = (jQuery(window).width() - width) / 2, 250 top = (jQuery(window).height() - height) / 2, 251 url = this.href, 252 opts = 'status=1' + 253 ',width=' + width + 254 ',height=' + height + 255 ',top=' + top + 256 ',left=' + left; 257 258 window.open(url, 'twitter', opts); 259 260 return false;
261 }); 262 263/* -------------------------------------------------------------------------* 264 * TWITTER BUTTON 265 * -------------------------------------------------------------------------*/ 266 var TWEET_URL = "https://twitter.com/intent/tweet"; 267 268 jQuery(".ot-tweet").each(function() { 269 var elem = jQuery(this), 270 // Use current page URL as default link 271 url = encodeURIComponent(elem.attr("data-url") || document.location.href), 272 // Use page title as default tweet message 273 text = elem.attr("data-text") || document.title, 274 via = elem.attr("data-via") || "", 275 related = encodeURIComponent(elem.attr("data-related")) || "", 276 hashtags = encodeURIComponent(elem.attr("data-hashtags")) || ""; 277 278 // Set href to tweet page 279 elem.attr({ 280 href: TWEET_URL + "?original_referer=" + 281 encodeURIComponent(document.location.href) + 282 "&source=tweetbutton&text=" + text + "&url=" + url + "&via=" + via, 283 target: "_blank" 284 }); 285 286 }); 287 288 /* -------------------------------------------------------------------------* 289 * GALLERY LIGHTBOX 290 * -------------------------------------------------------------------------*/ 291 292 jQuery(".light-show").on("click", function(){ 293 var newWindowWidth = jQuery(window).width(); 294 var galID = jQuery(this).attr('data-id'); 295 var next = parseInt(jQuery(this).find("img").attr('data-id')); 296 297 if(newWindowWidth >= 767) { 298 if(!next) { 299 next=1; 300 } 301 302 ot_lightbox_gallery(galID,next); 303 304 return false; 305 } 306 307 308 }); 309 310 function ot_lightbox_gallery(galID,next) { 311 jQuery("h2.light-title").html("Loading.."); 312 jQuery(".lightbox").css('display', 'block'); 313 jQuery(".lightcontent-loading").fadeIn('slow'); 314 jQuery(".lightcontent").css('display', 'none'); 315 316 jQuery('.lightcontent').load(ot.themeUrl+'/includes/_lightbox-gallery.php', function() { 317 window.location.hash = galID; 318 319 320 var prev = next-1; 321 322 var ID = galID.replace(/[^0-9]/g, ''); 323 324 jQuery(".ot-slide-item").attr('id',ID); 325 jQuery.ajax({ 326 url:ot.adminUrl, 327 type:"POST", 328 data:"action=OT_lightbox_gallery&gallery_id="+ID+"&next_image="+next, 329 dataType: 'json', 330 success:function(results) { 331 332 jQuery(".ot-gallery-image").attr("src", results['next']); 333 jQuery(".ot-gallery-image").css("max-height", jQuery(window).height()+"px"); 334 335 jQuery(".ot-gallery-image").load(function(){ 336 jQuery(".lightcontent-loading").css('display', 'none'); 337 jQuery("body").css('overflow', 'hidden'); 338 jQuery(".lightbox .lightcontent").delay(200).fadeIn('slow'); 339 jQuery("h2.light-title").html(""); 340 jQuery("h2.ot-light-title").html(results['title']); 341 jQuery("#ot-lightbox-content").html(results['content']); 342 jQuery(".ot-gallery-image").attr('alt', results['title']); 343 344 setTimeout(function() { 345 jQuery(".lightbox .photo-gallery-thumbs > div").owlCarousel({ 346 items : 4, 347 autoplay : false, 348 nav : false, 349 lazyload : false, 350 dots : false, 351 margin : 4, 352 responsive:{ 353 0:{ 354 items: 4 355 }, 356 400:{ 357 items: 6 358 }, 359 700:{ 360 items: 12 361 } 362 } 363 }); },300) 364 365 366 }); 367 368 jQuery.each(results.thumbs, function(k,v) { 369 //var li = '<li rel="'+(k+1)+'" data-nr="'+(k+1)+'"><a href="javascript:;" rel="'+(k+1)+'" class="gal-thumbs g-thumb" data-nr="'+(k+1)+'"><img src="'+v+'" alt=""/></a></li>'; 370 var li = '<a href="javascript:;" rel="'+(k+1)+'" class="gal-thumbs g-thumb" data-nr="'+(k+1)+'"><img src="'+v+'" alt="" width="80px" height="80px"/></a>'; 371 jQuery('#ot-lightbox-thumbs').append(li); 372 373 }); 374 375 376 jQuery(".ot-last-image").attr('data-last', results['total']); 377 jQuery(".numbers span.total").html(results['total']); 378 jQuery("#ot-gal-cat").html(results['cat']); 379 jQuery("#ot-gal-cat").attr("style", "color:"+results['color']+";"); 380 jQuery("#ot-gal-cat").attr("href", results['cat_url']); 381 382 jQuery(".ot-gallery-image").attr('data-id', next); 383 if(results['total']>=2) { 384 jQuery(".next-image").attr('data-next', next+1); 385 jQuery(".gallery-full-photo .next").attr('rel', next+1); 386 } else { 387 jQuery(".next-image").attr('data-next', next); 388 jQuery(".gallery-full-photo .next").attr('rel', next); 389 } 390 jQuery(".gallery-full-photo .prev").attr('rel', prev); 391 392 OT_gallery.a_click(ot.adminUrl, ID); 393 394 395 396 } 397 }); 398 399 400 401 }); 402 403 404 } 405 406 407 var type = window.location.hash.replace(/[^a-z]/g, ''); 408 if(type=="gallery") { 409 ot_lightbox_gallery(window.location.hash,1); 410 411 } 412 413 414 415/* -------------------------------------------------------------------------* 416 * addLoadEvent 417 * -------------------------------------------------------------------------*/ 418 function addLoadEvent(func) { 419 var oldonload = window.onload; 420 if (typeof window.onload != 'function') { 421 window.onload = func; 422 } else { 423 window.onload = function() { 424 if (oldonload) { 425 oldonload(); 426 } 427 func(); 428 } 429 } 430 } 431 432 /*--------------------------------- 433 HIDE WOO EMPTY CART 434 ---------------------------------*/ 435 436 437 if ( $.cookie( "woocommerce_items_in_cart" ) > 0 ) { 438 $('.hide_cart_widget_if_empty').closest('.widget, .panel').show(); 439 } else { 440 $('.hide_cart_widget_if_empty').closest('.widget, .panel').hide(); 441 } 442 443 jQuery('body').bind('adding_to_cart', function(){ 444 jQuery(this).find('.hide_cart_widget_if_empty').closest('.widget, .panel').fadeIn(); 445 }); 446 447})(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.