1 2 3 4var breakingStart = true; // autostart breaking news 5var breakingSpeed = 40; // breaking msg speed 6 7 8var blankPX = ot.imageUrl+"px.gif"; 9var breakingScroll = 0; 10var breakingOffset = 0; 11var elementsToClone = true; 12var theCount = 0; 13 14if (window.devicePixelRatio >= 2) { 15 var enableCuffon = false; 16} 17 18jQuery(document).ready(function($) { 19 20 if(enableCuffon){ 21 jQuery('body').addClass('withcuffon'); 22 } 23 24 jQuery("body").append("<div class='themobile-top'><a href='#' class='mobile-menu-toggle'><span class='icon-text'>☰</span> Menú principal</a></div>"); 25 26 jQuery(".mobile-menu-toggle").click(function (){ 27 jQuery("body").toggleClass("mobile-menu-enabled"); 28 return false; 29 }); 30 31 start(); 32 33 jQuery('.breaking-message').mouseover(function (){ 34 breakingStart = false; 35 jQuery('.breaking-line ul').stop(true); 36 }).mouseout(function (){ 37 breakingStart = true; 38 start(); 39 }); 40 41 42 jQuery("img.setborder").each(function() { 43 var link = jQuery(this).attr("href"); 44 45 jQuery(this).parent().css("margin", "0").css("padding", jQuery(this).css("padding")).css("float", jQuery(this).css("float")); 46 jQuery(this).parent().find(".gallery-title").css("width", "100%").css("display","block"); 47 if(jQuery(this).css("position") == "absolute"){ 48 //jQuery(this).parent().css("position", "absolute"); 49 jQuery(this).css("position", "relative"); 50 } 51 jQuery(this).css("margin", "0px").css("padding", "0px").css("float", "none").css("position", "relative"); 52 }); 53 54 jQuery(".relative-block").each(function (index){ 55 jQuery(this).css("height", jQuery(".footer-content").height()+"px"); 56 }); 57 58 jQuery(".panel-content .title-top a.tabbed-panel").click(function (){ 59 var thatitle = jQuery(this).attr("title"); 60 var thalink = jQuery(this).attr("href").split("#"); 61 jQuery(this).parent().parent().parent().children("h3").html(jQuery(this).attr("title")); 62 jQuery(this).parent().parent().parent().children(".panel-content").hide(); 63 jQuery(this).parent().parent().parent().children("."+thalink[1]).show(); 64 return false; 65 }); 66 67 jQuery(".gallery-navi-right").click(function (){ 68 var thiscount = parseInt(jQuery(this).parent().find("ul li").size())-1; 69 var thisindex = parseInt(jQuery(this).parent().find("ul li.active").index()); 70 var thisnext = (thisindex >= thiscount)?(0):(thisindex+1); 71 72 jQuery(this).parent().find("ul li.active").addClass("current"); 73 jQuery(this).parent().find("ul li.current").removeClass("active"); 74 jQuery(this).parent().find("ul li").eq(thisnext).addClass("active"); 75 jQuery(this).parent().find("ul li.current").removeClass("current"); 76 return false; 77 }); 78 79 jQuery(".gallery-navi-left").click(function (){ 80 var thiscount = parseInt(jQuery(this).parent().find("ul li").size())-1; 81 var thisindex = parseInt(jQuery(this).parent().find("ul li.active").index()); 82 var thisnext = (thisindex <= 0)?(thiscount):(thisindex-1); 83 84 jQuery(this).parent().find("ul li.active").addClass("current"); 85 jQuery(this).parent().find("ul li.current").removeClass("active"); 86 jQuery(this).parent().find("ul li").eq(thisnext).addClass("active"); 87 jQuery(this).parent().find("ul li.current").removeClass("current"); 88 return false; 89 }); 90 91 jQuery('.main-menu.isfloatable').each(function (index){ 92 jQuery(this).clone().appendTo('.header').addClass('this-floating'); 93 }); 94 95 var menuPadding = 0; 96 var paddingTo = 13; 97 98 jQuery(".search-box input[type=text]").focus(function (){ 99 menuPadding = parseInt(jQuery(".main-menu-ul > li a").css("padding-right")); 100 jQuery(".main-menu-ul > li > a").css("padding-left", paddingTo+"px").css("padding-right", paddingTo+"px"); 101 }).blur(function (){ 102 jQuery(".main-menu-ul > li > a").css("padding-left", menuPadding+"px").css("padding-right", menuPadding+"px"); 103 }); 104 105 var theFontSize = 13; 106 107 jQuery("a[href=#change-font-size]").click(function (){ 108 if(jQuery(this).attr("rel") == "up"){ 109 theFontSize = (theFontSize < 30)?theFontSize+2:theFontSize; 110 }else 111 if(jQuery(this).attr("rel") == "down"){ 112 theFontSize = (theFontSize > 13)?theFontSize-2:theFontSize; 113 } 114 115 jQuery(".changable-content, .changable-content p").css("font-size", theFontSize+"px"); 116 return false; 117 }); 118 119 var theLineSpace = 150; 120 121 jQuery("a[href=#change-line-space]").click(function (){ 122 if(jQuery(this).attr("rel") == "up"){ 123 theLineSpace = (theLineSpace < 300)?theLineSpace+20:theLineSpace; 124 }else 125 if(jQuery(this).attr("rel") == "down"){ 126 theLineSpace = (theLineSpace > 150)?theLineSpace-20:theLineSpace; 127 } 128 129 jQuery(".changable-content, .changable-content p").css("line-height", theLineSpace+"%"); 130 return false; 131 }); 132 133 134 jQuery(".article-main-content .youtube-video a").click(function (){ 135 var videoID = jQuery(this).attr("href").split("#");
136 var videoWidth = parseInt(jQuery(this).parent().parent().css("width")); 137 var videoHeight = Math.ceil(videoWidth*(0.56)+1); 138 139 jQuery(this).hide(); 140 jQuery(this).parent().append('<iframe width="'+videoWidth+'" height="'+videoHeight+'" src="http://www.youtube.com/embed/'+(videoID[1])+'?rel=0&autoplay=1" frameborder="0" allowfullscreen></iframe>'); 141 return false; 142 }); 143 144 jQuery(".tabbed-block .tabbed-header a").click(function (){ 145 jQuery(".tabbed-block .tabbed-header a").removeClass("active"); 146 147 jQuery(".tabbed-block .tabbed-body > div.active").removeClass("active"); 148 jQuery(".tabbed-block .tabbed-body > div").eq(jQuery(this).index()).addClass("active"); 149 150 jQuery(this).toggleClass("active"); 151 return false; 152 }); 153 154 jQuery(".destroy-button").click(function (){ 155 jQuery(this).parent().fadeOut('fast'); 156 return false; 157 }); 158 159 jQuery(".accordion-block > div > a").click(function (){ 160 if(jQuery(this).parent().hasClass("active")){ 161 jQuery(this).parent().toggleClass('active'); 162 return false; 163 } 164 jQuery(this).parent().parent().children().removeClass('active'); 165 jQuery(this).parent().toggleClass('active'); 166 return false; 167 }); 168 169 var thewidth = 0; 170 171 jQuery(".photo-line-arrow-right").click(function (){ 172 var thecount = (jQuery(".actual-photo-line ul li").size())-1; 173 console.log((thecount*(parseInt(jQuery(".actual-photo-line ul li").css("width"))+parseInt(jQuery(".actual-photo-line ul li").css("margin-right")))+parseInt(jQuery(".actual-photo-line").css("width")))); 174 if((thecount*(parseInt(jQuery(".actual-photo-line ul li").css("width"))+parseInt(jQuery(".actual-photo-line ul li").css("margin-right")))) < Math.abs(thewidth)+parseInt(jQuery(".actual-photo-line").css("width")))return false; 175 thewidth = thewidth-(parseInt(jQuery(".actual-photo-line ul li").css("width"))+parseInt(jQuery(".actual-photo-line ul li").css("margin-right"))); 176 jQuery(this).parent().find(".actual-photo-line ul").css("left", thewidth+"px"); 177 return false; 178 }); 179 180 jQuery(".photo-line-arrow-left").click(function (){ 181 if(thewidth >= 0)return false; 182 thewidth = thewidth+(parseInt(jQuery(".actual-photo-line ul li").css("width"))+parseInt(jQuery(".actual-photo-line ul li").css("margin-right"))); 183 jQuery(this).parent().find(".actual-photo-line ul").css("left", thewidth+"px"); 184 return false; 185 }); 186 187 jQuery(".lightbox").click(function () { 188 jQuery(".lightbox").css('overflow', 'hidden'); 189 jQuery("body").css('overflow', 'auto'); 190 jQuery(".lightbox .lightcontent").fadeOut('fast'); 191 jQuery(".lightbox").fadeOut('slow'); 192 }).children().click(function(e) { 193 return false; 194 }); 195 196}); 197 198 199function lightboxclose(){ 200 jQuery(".lightbox").css('overflow', 'hidden'); 201 jQuery(".lightbox .lightcontent").fadeOut('fast'); 202 jQuery(".lightbox").fadeOut('slow'); 203 jQuery("body").css('overflow', 'auto'); 204} 205 206/*jQuery(document).scroll(function() { 207 var position = jQuery(window).scrollTop(); 208 var pos = jQuery(".main-menu.isfloatable").position(); 209 if(position <= (pos.top+20)) { 210 jQuery(".this-floating").hide(); 211 }else{ 212 jQuery(".this-floating").show(); 213 } 214});*/ 215 216function start() { 217 if(jQuery('.breaking-line ul').size() > 0){ 218 if(!breakingStart)return false; 219 var theBreakingMargin = parseInt(jQuery('.breaking-line ul li').css("margin-right")); 220 if(elementsToClone){ 221 var theBreakingWidth = parseInt(jQuery('.breaking-line').css("width")); 222 theCount = (jQuery('.breaking-line ul > li').size()*(theBreakingWidth+theBreakingMargin)); 223 jQuery('.breaking-line ul li').clone().appendTo('.breaking-line ul'); 224 elementsToClone = false; 225 } 226 var theNumber = theCount+breakingOffset; 227 if(Math.abs(theNumber) <= (Math.abs(breakingScroll))){ 228 cloneBreakingLine(); 229 } 230 breakingScroll = breakingScroll-1; 231 jQuery('.breaking-line ul').animate({left: breakingScroll+'px'}, breakingSpeed, 'linear', function(){ start(); }); 232 } 233} 234 235function cloneBreakingLine(){ 236 breakingScroll = 0; 237 jQuery('.breaking-line ul').css("left", "0px"); 238} 239 240function printArticle() { 241 var html = jQuery(".changable-content").html(); 242 var htmltitle = jQuery(".article-big-header h2").html(); 243 if(jQuery(".the-article-content .article-photo img").size() > 0){var htmlphoto = "<img src='"+jQuery(".the-article-content .article-photo img").attr("src")+"' alt='' style='max-width: 600px;'/>";}else{var htmlphoto = "";} 244 if(jQuery(".header-logo .logo-img").size() > 0){var htmllogo = jQuery(".header-logo .logo-img").css("background-image");var logotext = false;}else{var htmllogo = jQuery(".header-logo").html();var logotext = true;} 245 var htmlcopy = jQuery(".footer-copy .left").html(); 246 var htmlauthor = jQuery(".article-author .article-user strong").html(); 247 var htmldate = jQuery(".article-author .article-date strong").html(); 248 249 if(htmllogo != "none" && htmllogo != "" && logotext == false){
250 var htmllogo = htmllogo.split("url("); 251 var htmllogo = htmllogo[1].split(")"); 252 var htmllogo = "<img src='"+htmllogo[0]+"' style='max-width:100%;height:auto;' />"; 253 } 254 255 top.consoleRef=window.open('','articleprint', 256 'width=680,height=800' 257 +',menubar=0' 258 +',toolbar=1' 259 +',status=0' 260 +',scrollbars=1' 261 +',resizable=1'); 262 top.consoleRef.document.writeln( 263 '<html><head><title>'+jQuery(document).attr('title')+'</title><link type="text/css" rel="stylesheet" href="'+ot.cssUrl+'reset.css" /><link type="text/css" rel="stylesheet" href="'+ot.cssUrl+'print.css?'+Date()+'" /><link type="text/css" rel="stylesheet" href="'+ot.cssUrl+'shortcode.css?'+Date()+'" /></head>' 264 +'<body onLoad="self.focus()"><div class="wrapper">' 265 +htmllogo 266 +'<h2>'+htmltitle+'</h2>' 267 +'<div class="smallinfo"><strong>'+htmlauthor+'</strong><span>'+htmldate+'</span><a href="'+jQuery(location).attr('href')+'">'+jQuery(location).attr('href')+'</a></div>' 268 +'<div class="article-main-content">'+htmlphoto+''+html+'</div>' 269 +htmlcopy 270 +'</div></body></html>' 271 ); 272 top.consoleRef.document.close(); 273} 274 275 276 277/* -------------------------------------------------------------------------* 278 * COMMENT SWITCHER 279 * -------------------------------------------------------------------------*/ 280 281if(window.location.hash.substring(1) == "comments" || window.location.hash.substring(1).indexOf("comment") != -1) { 282 jQuery('#section-article').css('display','none'); 283 jQuery('#section-comments').css('display','block'); 284 jQuery('.tab-article').removeClass("active"); 285 jQuery('.tab-comments').addClass("active"); 286} else { 287 jQuery('#section-comments').css('display','none'); 288 jQuery('#section-article').css('display','block'); 289 jQuery('.tab-comments').removeClass("active"); 290 jQuery('.tab-article').addClass("active"); 291} 292 293jQuery(".tab-article").click(function() { 294 window.location.hash = this.hash; 295 jQuery('#section-comments').css('display','none'); 296 jQuery('#section-article').css('display','block'); 297 jQuery('.tab-comments').removeClass("active"); 298 jQuery('.tab-article').addClass("active"); 299 return false; 300}); 301jQuery(".tab-comments").click(function() { 302 window.location.hash = this.hash; 303 jQuery('#section-article').css('display','none'); 304 jQuery('#section-comments').css('display','block'); 305 jQuery('.tab-article').removeClass("active"); 306 jQuery('.tab-comments').addClass("active"); 307 return false; 308}); 309 310 311/* -------------------------------------------------------------------------* 312 * GET BASE URL 313 * -------------------------------------------------------------------------*/ 314 315function getBaseURL() { 316 var url = location.href; // entire url including querystring - also: window.location.href; 317 var baseURL = url.substring(0, url.indexOf('/', 14)); 318 319 320 if (baseURL.indexOf('http://localhost') != -1) { 321 // Base Url for localhost 322 var url = location.href; // window.location.href; 323 var pathname = location.pathname; // window.location.pathname; 324 var index1 = url.indexOf(pathname); 325 var index2 = url.indexOf("/", index1 + 1); 326 var baseLocalUrl = url.substr(0, index2); 327 328 return baseLocalUrl + "/"; 329 } 330 else { 331 // Root Url for domain name 332 return baseURL; 333 } 334 335} 336/* -------------------------------------------------------------------------* 337 * CONTACT FORM EMAIL VALIDATION 338 * -------------------------------------------------------------------------*/ 339 340 function Validate() { 341 342 var errors = ""; 343 var reason_name = ""; 344 var reason_mail = ""; 345 var reason_message = ""; 346 347 reason_name += validateName(document.getElementById('writecomment').u_name); 348 reason_mail += validateEmail(document.getElementById('writecomment').email); 349 reason_message += validateMessage(document.getElementById('writecomment').message); 350 351 352 if (reason_name != "") { 353 jQuery("#contact-name-error").text(reason_name).fadeIn(1000); 354 jQuery(".comment-form-author input").addClass("error"); 355 jQuery("#contact-name-error").css({ 'display': 'block'});
356 errors = "Error"; 357 } else { 358 jQuery(".comment-form-author input").removeClass("error"); 359 jQuery("#contact-name-error").css({ 'display': 'none'}); 360 } 361 362 363 if (reason_mail != "") { 364 jQuery("#contact-mail-error").text(reason_mail).fadeIn(1000); 365 jQuery(".comment-form-email input").addClass("error"); 366 jQuery("#contact-mail-error").css({ 'display': 'block'}); 367 errors = "Error"; 368 } else { 369 jQuery(".comment-form-email input").removeClass("error"); 370 jQuery("#contact-mail-error").css({ 'display': 'none'}); 371 } 372 373 if (reason_message != "") { 374 jQuery("#contact-message-error").text(reason_message).fadeIn(1000); 375 jQuery(".comment-form-text textarea").addClass("error"); 376 jQuery("#contact-message-error").css({ 'display': 'block'}); 377 errors = "Error"; 378 } else { 379 jQuery(".comment-form-text textarea").removeClass("error"); 380 jQuery("#contact-message-error").css({ 'display': 'none'}); 381 } 382 383 if (errors != ""){ 384 return false; 385 } else { 386 return true; 387 } 388 389 //document.getElementById("writecomment").submit(); return false; 390 } 391 392/* -------------------------------------------------------------------------* 393 * AWEBER WIDGET VALIDATION 394 * -------------------------------------------------------------------------*/ 395 396 function Validate_aweber() { 397 var errors = ""; 398 var reason_name = ""; 399 var reason_mail = ""; 400 401 402 reason_name += validateName(document.getElementById('aweber-form').u_name); 403 reason_mail += validateEmail(document.getElementById('aweber-form').email); 404 405 406 if (reason_name != "") { 407 jQuery("#aweber-fail").css({ 'display': 'block'}); 408 errors = "Error"; 409 } else { 410 jQuery("#aweber-fail").css({ 'display': 'none'}); 411 } 412 413 if (reason_mail != "") { 414 jQuery("#aweber-fail").css({ 'display': 'block'}); 415 errors = "Error"; 416 } else { 417 jQuery("#aweber-fail").css({ 'display': 'none'}); 418 } 419 420 421 if (errors != ""){ 422 return false; 423 } else { 424 return true; 425 } 426 427 //document.getElementById("aweber-form").submit(); return false; 428 } 429 430 431 function implode( glue, pieces ) { 432 return ( ( pieces instanceof Array ) ? pieces.join ( glue ) : pieces ); 433 } 434 435/* -------------------------------------------------------------------------* 436 * SEARCH IN NAVIGATION 437 * -------------------------------------------------------------------------*/ 438 439 jQuery(document).ready(function() { 440 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>"); 441 jQuery(".navigation-search > a > i").wrap("<span></span>"); 442 jQuery(".navigation-search").mouseover(function() { 443 jQuery("#navigation-search").show(); 444 }); 445 jQuery(".navigation-search").mouseout(function() { 446 jQuery("#navigation-search").hide(); 447 }); 448 }); 449 450/* -------------------------------------------------------------------------* 451 * SUBMIT CONTACT FORM 452 * -------------------------------------------------------------------------*/ 453 jQuery(document).ready(function(jQuery){ 454 var adminUrl = ot.adminUrl; 455 jQuery('#contact-submit').click(function() { 456 if (Validate()==true) { 457 var str = jQuery("#writecomment").serialize(); 458 jQuery.ajax({ 459 url:adminUrl, 460 type:"POST", 461 data:"action=footer_contact_form&"+str, 462 success:function(results) { 463 jQuery(".contact-success-block").css({ 'display': 'block'}); 464 jQuery("#writecomment").css({ 'display': 'none'}); 465 466 } 467 }); 468 } 469 }); 470 }); 471/* -------------------------------------------------------------------------* 472 * SUBMIT AWEBER WIDGET FORM 473 * -------------------------------------------------------------------------*/ 474 jQuery(document).ready(function(jQuery){ 475 var adminUrl = ot.adminUrl; 476 jQuery('#aweber-submit').click(function() { 477 if (Validate_aweber()==true) { 478 var str = jQuery("#aweber-form").serialize(); 479 jQuery("#aweber-loading").css({ 'display': 'block'});
480 jQuery.ajax({ 481 url:adminUrl, 482 type:"POST", 483 data:"action=aweber_form&"+str, 484 success:function(results) { 485 if(results){ 486 jQuery("#aweber-loading").css({ 'display': 'none'}); 487 jQuery("#aweber-fail").css({ 'display': 'block'}); 488 jQuery("#aweber-fail span.ot-text").html(results); 489 } else { 490 jQuery("#aweber-form").css({ 'display': 'none'}); 491 jQuery("#aweber-success").css({ 'display': 'block'}); 492 jQuery("#aweber-loading").css({ 'display': 'none'}); 493 } 494 } 495 }); 496 } 497 }); 498 }); 499 500 501/* -------------------------------------------------------------------------* 502 * ADD CLASS TO COMMENT BUTTON 503 * -------------------------------------------------------------------------*/ 504jQuery(document).ready(function(){ 505 jQuery('#writecomment .form-submit input').addClass('button-blue'); 506 jQuery('.comment-reply-link').addClass('icon-link'); 507 508}); 509 510 511 512/* -------------------------------------------------------------------------* 513 * GALLERY CATEGORY 514 * -------------------------------------------------------------------------*/ 515 /*jQuery(function() { 516 517 // cache container 518 var jQuerycontainer = jQuery('#gallery-full'); 519 var galleryCat = ot.galleryCat; 520 521 jQuery(window).load(function(){ 522 jQuerycontainer.isotope({ 523 resizable: false, 524 masonry: { columnWidth: jQuerycontainer.width() / 12 } 525 }); 526 527 jQuery(window).smartresize(function(){ 528 jQuerycontainer.isotope({ 529 masonry: { columnWidth: jQuerycontainer.width() / 12 } 530 }); 531 }); 532 }); 533 534 if(galleryCat) { 535 // initialize isotope 536 jQuerycontainer.isotope({ 537 filter: "."+galleryCat 538 }); 539 540 var jQueryoptionSet = jQuery('#gallery-categories a'); 541 jQueryoptionSet.each(function(index) { 542 jQuery(this).removeClass('active'); 543 if(jQuery(this).attr("data-option")=="."+galleryCat) { 544 jQuery(this).addClass('active'); 545 } 546 }); 547 } 548 549 550 551 // filter items when filter link is clicked 552 jQuery('#gallery-categories a').click(function(){ 553 var jQuerythis = jQuery(this); 554 555 var jQueryoptionSet = jQuerythis.parents('#gallery-categories'); 556 jQueryoptionSet.find('.active').removeClass('active'); 557 jQuerythis.addClass('active'); 558 559 560 var selector = jQuerythis.attr('data-option'); 561 jQuerycontainer.isotope({ 562 filter: selector 563 }); 564 return false; 565 }); 566 567 jQuery(window).load(function(){ 568 jQuery('#gallery-full').isotope( 'reloadItems' ).isotope({ sortBy: 'original-order' }); 569 }); 570 */ 571 572 /* infinitescroll */ 573 574 575 /*jQuerycontainer.infinitescroll({ 576 navSelector : '.gallery-navi', // selector for the paged navigation 577 nextSelector : '.gallery-navi a.next', // selector for the NEXT link (to page 2) 578 itemSelector : '#gallery-full .gallery-image', // selector for all items you'll retrieve 579 animate : true, 580 loading: { 581 finishedMsg: 'No more pages to load.', 582 img: ot.imageUrl+'loading.gif' 583 } 584 }, 585 function(newElements) { 586 jQuery(newElements).imagesLoaded(function(){ 587 588 //portfolio image load 589 jQuery( ".gallery-image",newElements ).each(function() { 590 jQuery(".gallery-image").fadeIn('slow'); 591 jQuery(".waiter-portfolio").removeClass("loading").addClass("loaded"); 592 593 }); 594 jQuerycontainer.isotope('insert', jQuery(newElements)); 595 596 }); 597 598 599 } 600 ); 601 602 });*/ 603 604 605 606function removeHash () { 607 var scrollV, scrollH, loc = window.location; 608 if ("pushState" in history) 609 history.pushState("", document.title, loc.pathname + loc.search); 610 else { 611 // Prevent scrolling by storing the page's current scroll offset 612 scrollV = document.body.scrollTop; 613 scrollH = document.body.scrollLeft; 614 615 loc.hash = ""; 616 617 // Restore the scroll offset, should be flicker free 618 document.body.scrollTop = scrollV; 619 document.body.scrollLeft = scrollH; 620 } 621} 622 623/* -------------------------------------------------------------------------* 624 * LIGHTBOX SLIDER 625 * -------------------------------------------------------------------------*/ 626 function OT_lightbox_slider(el,side) { 627 628 if(el.attr('rel')%8==0 && side == "right") { 629 //carousel('right'); 630 } 631 632 if(el.attr('rel')%7==0 && side == "left") { 633 //carousel('left'); 634 } 635 636 } 637
638/* -------------------------------------------------------------------------* 639 * SOCIAL POPOUP WINDOW 640 * -------------------------------------------------------------------------*/ 641 jQuery('.ot-share, .ot-tweet, .ot-pin, .ot-pluss, .ot-link').click(function(event) { 642 var width = 575, 643 height = 400, 644 left = (jQuery(window).width() - width) / 2, 645 top = (jQuery(window).height() - height) / 2, 646 url = this.href, 647 opts = 'status=1' + 648 ',width=' + width + 649 ',height=' + height + 650 ',top=' + top + 651 ',left=' + left; 652 653 window.open(url, 'twitter', opts); 654 655 return false; 656 }); 657 658/* -------------------------------------------------------------------------* 659 * TWITTER BUTTON 660 * -------------------------------------------------------------------------*/ 661 var API_URL = "https://public.newsharecounts.com/count.json?url=", 662 TWEET_URL = "https://twitter.com/intent/tweet"; 663 664 jQuery(".ot-tweet").each(function() { 665 var elem = jQuery(this), 666 // Use current page URL as default link 667 url = encodeURIComponent(elem.attr("data-url") || document.location.href), 668 // Use page title as default tweet message 669 text = elem.attr("data-text") || document.title, 670 via = elem.attr("data-via") || "", 671 related = encodeURIComponent(elem.attr("data-related")) || "", 672 hashtags = encodeURIComponent(elem.attr("data-hashtags")) || ""; 673 674 // Set href to tweet page 675 elem.attr({ 676 href: TWEET_URL + "?hashtags=" + hashtags + "&original_referer=" + 677 encodeURIComponent(document.location.href) + "&related=" + related + 678 "&source=tweetbutton&text=" + text + "&url=" + url + "&via=" + via, 679 target: "_blank" 680 }); 681 682 // Get count and set it as the inner HTML of .count 683 jQuery.getJSON(API_URL + url, function(data) { 684 elem.parent().find("span.count").html(data.count); 685 }); 686 }); 687 688/* -------------------------------------------------------------------------* 689 * PINIT BUTTON 690 * -------------------------------------------------------------------------*/ 691 var API_URL = "https://api.pinterest.com/v1/urls/count.json"; 692 693 jQuery(".ot-pin").each(function() { 694 var elem = jQuery(this), 695 // Use current page URL as default link 696 url = (elem.attr("data-url") || document.location.href); 697 698 // Get count and set it as the inner HTML of .count 699 jQuery.getJSON(API_URL + "?callback=?&url=" + url, function(data) { 700 elem.parent().find("span.count").html(data.count); 701 }); 702 }); 703 704/* -------------------------------------------------------------------------* 705 * LINKEDIN BUTTON 706 * -------------------------------------------------------------------------*/ 707 var API_URL = "https://www.linkedin.com/countserv/count/share"; 708 709 jQuery(".ot-link").each(function() { 710 var elem = jQuery(this), 711 // Use current page URL as default link 712 url = (elem.attr("data-url") || document.location.href); 713 714 // Get count and set it as the inner HTML of .count 715 jQuery.getJSON(API_URL + "?callback=?&url=" + url, function(data) { 716 elem.parent().find("span.count").html(data.count); 717 }); 718 }); 719 720 /* -------------------------------------------------------------------------* 721 * FACEBOOK SHARE 722 * -------------------------------------------------------------------------*/ 723function fbShare() { 724 jQuery(".ot-share").each(function() { 725 var button = jQuery(this); 726 var link = jQuery(this).attr('data-url'); 727 if(!link) { 728 link = document.URL; 729 } 730 731 jQuery.ajax({ 732 url:ot.adminUrl, 733 type:"POST", 734 data:"action=OT_customFShare&link="+link, 735 success:function(results) { 736 button.parent().find('span.count').html(results); 737 button.parent('div.soc-button-facebook').find('span.count').html(results); 738 } 739 740 741 }); 742 }); 743 744} 745 746addLoadEvent(fbShare); 747/* -------------------------------------------------------------------------* 748 * GALLERY LIGHTBOX 749 * -------------------------------------------------------------------------*/ 750 751jQuery(".light-show").on("click", function(){ 752 753 var galID = jQuery(this).attr('data-id');
754 var next = parseInt(jQuery(this).find("img").attr('data-id')); 755 756 if(!next) { 757 next=1; 758 } 759 760 ot_lightbox_gallery(galID,next); 761 return false; 762}); 763 764function ot_lightbox_gallery(galID,next) { 765 766 jQuery("h2.light-title").html("Loading.."); 767 jQuery(".lightbox").css('display', 'block'); 768 jQuery(".lightcontent-loading").fadeIn('slow'); 769 jQuery(".lightcontent").css('display', 'none'); 770 771 jQuery('.lightcontent').load(ot.themeUrl+'/includes/_lightbox-gallery.php', function() { 772 window.location.hash = galID; 773 774 775 var prev = next-1; 776 777 778 ID = galID.replace(/[^0-9]/g, ''); 779 jQuery(".ot-slide-item").attr('id',ID); 780 jQuery.ajax({ 781 url:ot.adminUrl, 782 type:"POST", 783 data:"action=OT_lightbox_gallery&gallery_id="+ID+"&next_image="+next, 784 dataType: 'json', 785 success:function(results) { 786 787 jQuery(".gallery-image").attr("src", results['next']); 788 jQuery(".gallery-image").css("max-height", jQuery(window).height()-300+"px"); 789 790 jQuery(".gallery-image").load(function(){ 791 jQuery(".lightcontent-loading").css('display', 'none'); 792 jQuery("body").css('overflow', 'hidden'); 793 jQuery(".lightbox .lightcontent").delay(200).fadeIn('slow'); 794 jQuery("h2.light-title").html(results['title']); 795 jQuery("#ot-lightbox-content").html(results['content']); 796 jQuery(".gallery-image").attr('alt', results['title']); 797 }); 798 799 jQuery.each(results.thumbs, function(k,v) { 800 var li = '<li data-nr="'+(k+1)+'"><a href="javascript:;" rel="'+(k+1)+'" class="gal-thumbs"><img src="'+v+'" alt="" class="setborder" width="70" height="50"/></a></li>'; 801 jQuery('#ot-lightbox-thumbs').append(li); 802 803 }); 804 805 jQuery(".ot-last-image").attr('data-last', results['total']); 806 jQuery(".gallery-image").attr('data-id', next); 807 if(results['total']>=2) { 808 jQuery(".next-image").attr('data-next', next+1); 809 jQuery(".gallery-full-photo .next").attr('rel', next+1); 810 } else { 811 jQuery(".next-image").attr('data-next', next); 812 jQuery(".gallery-full-photo .next").attr('rel', next); 813 } 814 jQuery(".gallery-full-photo .prev").attr('rel', prev); 815 816 OT_gallery_click(ot.adminUrl, ID); 817 818 819 } 820 }); 821 822 }); 823 824} 825 826 827 var type = window.location.hash.replace(/[^a-z]/g, ''); 828 if(type=="gallery") { 829 ot_lightbox_gallery(window.location.hash,1); 830 } 831 832 833 834 835 836/* -------------------------------------------------------------------------* 837 * addLoadEvent 838 * -------------------------------------------------------------------------*/ 839 function addLoadEvent(func) { 840 var oldonload = window.onload; 841 if (typeof window.onload != 'function') { 842 window.onload = func; 843 } else { 844 window.onload = function() { 845 if (oldonload) { 846 oldonload(); 847 } 848 func(); 849 } 850 } 851 }
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.