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 return false; 115 } else { 116 return true; 117 } 118 119 //document.getElementById("aweber-form").submit(); return false; 120 } 121 122 123 function implode( glue, pieces ) { 124 return ( ( pieces instanceof Array ) ? pieces.join ( glue ) : pieces ); 125 } 126 127/* -------------------------------------------------------------------------* 128 * SEARCH IN NAVIGATION 129 * -------------------------------------------------------------------------*/ 130 131 jQuery(document).ready(function() { 132 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>"); 133 jQuery(".navigation-search > a >
133 i").wrap("<span></span>"); 134 jQuery(".navigation-search").mouseover(function() { 135 jQuery("#navigation-search").show(); 136 }); 137 jQuery(".navigation-search").mouseout(function() { 138 jQuery("#navigation-search").hide(); 139 }); 140 }); 141 142/* -------------------------------------------------------------------------* 143 * SUBMIT CONTACT FORM 144 * -------------------------------------------------------------------------*/ 145 jQuery(document).ready(function(jQuery){ 146 var adminUrl = ot.adminUrl; 147 jQuery('#contact-submit').click(function() { 148 if (Validate()==true) { 149 var str = jQuery("#writecomment").serialize(); 150 jQuery.ajax({ 151 url:adminUrl, 152 type:"POST", 153 data:"action=footer_contact_form&"+str, 154 success:function(results) { 155 jQuery(".contact-success-block").css({ 'display': 'block'}); 156 jQuery("#writecomment").css({ 'display': 'none'}); 157 158 159 } 160 }); 161 return false; 162 } else { 163 return false; 164 } 165 }); 166 }); 167/* -------------------------------------------------------------------------* 168 * SUBMIT AWEBER WIDGET FORM 169 * -------------------------------------------------------------------------*/ 170 jQuery(document).ready(function(jQuery){ 171 var adminUrl = ot.adminUrl; 172 jQuery('.aweber-submit').click(function() { 173 var thisForm = jQuery(this).closest(".aweber-form") 174 if (Validate_aweber(thisForm)==true) { 175 var str = thisForm.serialize(); 176 thisForm.parent().parent().find(".aweber-loading").css({ 'display': 'block'}); 177 jQuery.ajax({ 178 url:adminUrl, 179 type:"POST", 180 data:"action=aweber_form&"+str, 181 success:function(results) { 182 if(results){ 183 thisForm.parent().parent().find(".aweber-loading").css({ 'display': 'none'}); 184 thisForm.parent().parent().find(".aweber-fail").css({ 'display': 'block'}); 185 thisForm.parent().parent().find(".aweber-fail p").html(results); 186 } else { 187 thisForm.parent().parent().find(".aweber-form").css({ 'display': 'none'}); 188 thisForm.parent().parent().find(".aweber-success").css({ 'display': 'block'}); 189 thisForm.parent().parent().find(".aweber-loading").css({ 'display': 'none'}); 190 } 191 } 192 }); 193 return false; 194 } 195 return false; 196 }); 197 }); 198 199 200/* -------------------------------------------------------------------------* 201 * ADD CLASS TO COMMENT BUTTON 202 * -------------------------------------------------------------------------*/ 203jQuery(document).ready(function(){ 204 jQuery('#writecomment .form-submit input').addClass('button'); 205 jQuery('.comment-reply-link').addClass('reply-button'); 206 207}); 208 209 210 211 212function removeHash () { 213 var scrollV, scrollH, loc = window.location; 214 if ("pushState" in history) 215 history.pushState("", document.title, loc.pathname + loc.search); 216 else { 217 // Prevent scrolling by storing the page's current scroll offset 218 scrollV = document.body.scrollTop; 219 scrollH = document.body.scrollLeft; 220 221 loc.hash = ""; 222 223 // Restore the scroll offset, should be flicker free 224 document.body.scrollTop = scrollV; 225 document.body.scrollLeft = scrollH; 226 } 227} 228 229/* -------------------------------------------------------------------------* 230 * LIGHTBOX SLIDER 231 * -------------------------------------------------------------------------*/ 232 function OT_lightbox_slider(el,side) { 233 234 if(el.attr('rel')%8==0 && side == "right") { 235 //carousel('right'); 236 } 237 238 if(el.attr('rel')%7==0 && side == "left") { 239 //carousel('left'); 240 } 241 242 } 243 244/* -------------------------------------------------------------------------* 245 * SOCIAL POPOUP WINDOW 246 * -------------------------------------------------------------------------*/ 247 jQuery('.ot-share, .ot-tweet, .ot-pin, .ot-pluss, .ot-link').click(function(event) { 248 var width = 575, 249 height = 400, 250 left = (jQuery(window).width() - width) / 2, 251 top = (jQuery(window).height() - height) / 2, 252 url = this.href, 253 opts = 'status=1' + 254 ',width=' + width + 255 ',height=' + height + 256 ',top=' + top + 257 ',left=' + left; 258 259 window.open(url, 'twitter', opts); 260 261 return false;
262 }); 263 264/* -------------------------------------------------------------------------* 265 * TWITTER BUTTON 266 * -------------------------------------------------------------------------*/ 267 var TWEET_URL = "https://twitter.com/intent/tweet"; 268 269 jQuery(".ot-tweet").each(function() { 270 var elem = jQuery(this), 271 // Use current page URL as default link 272 url = encodeURIComponent(elem.attr("data-url") || document.location.href), 273 // Use page title as default tweet message 274 text = elem.attr("data-text") || document.title, 275 via = elem.attr("data-via") || "", 276 related = encodeURIComponent(elem.attr("data-related")) || "", 277 hashtags = encodeURIComponent(elem.attr("data-hashtags")) || ""; 278 279 // Set href to tweet page 280 elem.attr({ 281 href: TWEET_URL + "?original_referer=" + 282 encodeURIComponent(document.location.href) + 283 "&source=tweetbutton&text=" + text + "&url=" + url + "&via=" + via, 284 target: "_blank" 285 }); 286 287 }); 288 289 /* -------------------------------------------------------------------------* 290 * GALLERY LIGHTBOX 291 * -------------------------------------------------------------------------*/ 292 293 jQuery(".light-show").on("click", function(){ 294 var newWindowWidth = jQuery(window).width(); 295 var galID = jQuery(this).attr('data-id'); 296 var next = parseInt(jQuery(this).find("img").attr('data-id')); 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 345 346 jQuery.each(results.thumbs, function(k,v) { 347 var li = '<a href="javascript:;" rel="'+(k+1)+'" class="gal-thumbs g-thumb" data-nr="'+(k+1)+'"><img src="'+v+'" alt=""/>'; 348 jQuery('#ot-lightbox-thumbs').append(li); 349 350 }); 351 352 353 354 jQuery(".ot-last-image").attr('data-last', results['total']); 355 jQuery(".numbers span.total").html(results['total']); 356 jQuery(".numbers span.current").html(next); 357 jQuery(".ot-gallery-image").attr('data-id', next); 358 if(results['total']>=2) { 359 jQuery(".next-image").attr('data-next', next+1); 360 jQuery(".gallery-full-photo .next").attr('rel', next+1); 361 } else { 362 jQuery(".next-image").attr('data-next', next); 363 jQuery(".gallery-full-photo .next").attr('rel', next); 364 } 365 jQuery(".gallery-full-photo .prev").attr('rel', prev); 366 367 OT_gallery.a_click(ot.adminUrl, ID); 368 369 setTimeout(function(){ 370 jQuery(".gallery-thumbnail-list").css("height", jQuery(".gallery-thumbnail-list").parent().siblings(".column10").children(".gallery-photo").height()); 371 },200); 372 setTimeout(function(){ 373 jQuery(".gallery-thumbnail-list").css("height", jQuery(".gallery-thumbnail-list").parent().siblings(".column10").children(".gallery-photo").height()); 374 },400); 375 setTimeout(function(){ 376 jQuery(".gallery-thumbnail-list").css("height", jQuery(".gallery-thumbn
376ail-list").parent().siblings(".column10").children(".gallery-photo").height()); 377 },1000); 378 setTimeout(function(){ 379 jQuery(".gallery-thumbnail-list").css("height", jQuery(".gallery-thumbnail-list").parent().siblings(".column10").children(".gallery-photo").height()); 380 },2000); 381 382 jQuery(".gallery-thumbnail-list").niceScroll(); 383 } 384 }); 385 386 387 388 }); 389 390 391 } 392 393 394 var type = window.location.hash.replace(/[^a-z]/g, ''); 395 if(type=="gallery") { 396 ot_lightbox_gallery(window.location.hash,1); 397 } 398 399 400 401/* -------------------------------------------------------------------------* 402 * addLoadEvent 403 * -------------------------------------------------------------------------*/ 404 function addLoadEvent(func) { 405 var oldonload = window.onload; 406 if (typeof window.onload != 'function') { 407 window.onload = func; 408 } else { 409 window.onload = function() { 410 if (oldonload) { 411 oldonload(); 412 } 413 func(); 414 } 415 } 416 } 417 418 /*--------------------------------- 419 HIDE WOO EMPTY CART 420 ---------------------------------*/ 421 422 423 if ( $.cookie( "woocommerce_items_in_cart" ) > 0 ) { 424 $('.hide_cart_widget_if_empty').closest('.widget').show(); 425 } else { 426 $('.hide_cart_widget_if_empty').closest('.widget').hide(); 427 } 428 429 jQuery('body').bind('adding_to_cart', function(){ 430 jQuery(this).find('.hide_cart_widget_if_empty').closest('.widget').fadeIn(); 431 }); 432 433})(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.