1$(function() { 2 3 var $document = $(document), 4 selector = '[data-rangeslider]', 5 $inputRange = $(selector); 6 7 form = $('form.yop-poll-forms .block-grid'); 8 9 $('#avatar-gallery li').click(function(){ 10 $('#avatar-gallery .active').removeClass('active'); 11 $(this).addClass('active'); 12 $('#wp-user-avatar').val($(this).find('img').attr('class')); 13 }); 14 15 16 if ($inputRange.length) { 17 $inputRange.rangeslider({ 18 polyfill: false, 19 // Default CSS classes 20 rangeClass: 'rangeslider', 21 fillClass: 'rangeslider__fill', 22 handleClass: 'rangeslider__handle', 23 24 // Callback function 25 onInit: function() {}, 26 27 // Callback function 28 onSlide: function(position, value) {}, 29 30 // Callback function 31 onSlideEnd: function(position, value) { 32 33 var obj; 34 35 if(value <= 33) { 36 obj = $(form).children('li')[0]; 37 }else if(value > 33 && value <= 66) { 38 obj = $(form).children('li')[1]; 39 } else { 40 obj = $(form).children('li')[2]; 41 } 42 43 obj = $(obj).find('input'); 44 $(obj).attr('checked','checked'); 45 $('.yop_poll_vote_button').click(); 46 $('.yop-poll-answers li.yop-poll-li-result').each(function(index){ 47 var width = $(this).find('.pds-feedback-result').text().replace('%',''); 48 $(this).children('.yop-poll-bar').animate({ 49 width: (width/2)+'%' 50 }, 500, function() {}); 51 }); 52 } 53 }); 54 } 55 56 $('.reveal--video').on( 57 'open.zf.reveal', function () { 58 $iframe = $(this).find('iframe'); 59 $iframe.attr('src', $iframe.attr('data-src') ); 60 61 $('body').addClass('reveal-opened'); 62 } 63 ); 64 $('.reveal--video').on( 65 'closed.zf.reveal', function () { 66 $('.reveal--video iframe').attr('src', '' ); 67 68 $('body').removeClass('reveal-opened'); 69 } 70 ); 71 72}); 73 74$(function() { 75 76 $('.sub-menu').on('click', function() { 77 if ($('#hamburger').is(':visible')) { 78 if (!$('nav.show-sub-menu').length) { 79 $('header nav').addClass('show-sub-menu'); 80 81 $(this).parent('li').addClass('active'); 82 $(this).parents('ul').addClass('active'); 83 } 84 } 85 86 $('.sub-menu .back a').on('click', function(e) { 87 $('header nav').removeClass('show-sub-menu'); 88 89 setTimeout(function() { 90 $('header ul, header li').removeClass('active'); 91 }, 500); 92 93 return false; 94 }); 95 }); 96 97 98 $('.nav-wrap > ul > li .sub-menu').on('mouseenter', function() { 99 if (!$('#hamburger').is(':visible')) { 100 $(this).parents('li').addClass('active'); 101 } 102 }); 103 104 $('.nav-wrap > ul > li').on('mouseleave', function() { 105 if (!$('#hamburger').is(':visible')) { 106 $(this).removeClass('active'); 107 } 108 }); 109 110 /* ############## WAIT FOR window.resize EVENT TO FINISH ############## */ 111 var waitForFinalEvent = (function () { 112 var timers = {}; 113 return function (callback, ms, uniqueId) { 114 if (!uniqueId) { 115 uniqueId = "Don't call this twice without a uniqueId"; 116 } 117 if (timers[uniqueId]) { 118 clearTimeout (timers[uniqueId]); 119 } 120 timers[uniqueId] = setTimeout(callback, ms); 121 }; 122 })(); 123 124 125 /* 126 * Trigger .resize 127 */ 128 $(window).resize(function () { 129 // force min-height 130 $('#tagpage .equalize .articlePod').css('min-height','380px'); 131 }); 132 133 // WPPROQUIZ HIGHLIGHT ANSWER SELECTED 134 $('.wpProQuiz_questionListItem').click(function() { 135 // Line below removes the 'quizActiveRadio' class but only for that questions group of answers and it leaves the other answers as they were selected 136 $(this).parent().parent().find('.wpProQuiz_questionListItem').removeClass('quizActiveRadio'); 137 $(this).addClass('quizActiveRadio'); 138 }); 139 140 // FIX WPPROQUIZ TO WRAP LABEL TEXT IN IT'S OWN HTML ELEMENT FOR EASIER STYLING 141 $('.wpProQuiz_questionListItem label').each(function() { 142 var inputItem = $(this).find('input'); 143 144 $(this).find('input').remove(); 145 146 $(this).wrapInner( "<span></span>" ); 147 148 $(this).prepend(inputItem); 149 150 $(this).append('<div class="clear"></div>'); 151 }); 152 153 // WPPROQUIZ CHANGE SUBMIT BUTTON DEFAULT TEXT 154 $('.wpProQuiz_button').attr('value', 'Submit >>'); 155 $('.wpProQuiz_results .wpProQuiz_button').attr('value', 'Take this quiz again?'); 156 157 $('.wpProQuiz_results div:last-child input').remove(); 158 $('.wpProQuiz_results').append('<input class="restartQuiz" type="button" name="restartQuiz" value="Take this quiz again?">'); 159 160 // TO WORK AROUND A WPPROQUIZ BUG DO A PAGE REFRESH TO RESTART THE QUIZ TO AVOID SHOWING THE RESTART BUTTON 161 $('.restartQuiz').on( "click", function() { 162 window.location.reload(); 163 }); 164 165 // DEAL WITH THE RESULTS PAGE FOR BOOLEAN ANSWERS 166 $('.wpProQuiz_button').click(function() { 167 168 var quiz_cat = $('.wpProQuiz_text').text(); 169 170 // ONLY RUN THIS JS IF THIS IS THE BOOLEAN VERSION OF THE QUIZ 171 if(quiz_cat.indexOf('trueFalseQuiz') > -1) { 172 if($('.wpProQuiz_results').is(':visible')) { 173 174 $('.wpProQuiz_listItem').each(function() { 175 176 var question = $.trim($(this).find('.wpProQuiz_question_text p').text()); 177 var answered = $.trim($(this).find('.quizActiveRadio label span').text()); 178 var message = $.trim($(this).find('.wpProQuiz_response .userAnswered p').text()); 179 180 var dataString = "<li class='resultList_item'> <div> <p>" + question + "</p> <p>You said: <strong>" + answered + "</strong> </p> <p>" + message + "</p> </div> </li>"; 181 $('.wpProQuiz_resultsList').append(dataString); 182 183 }); 184 185 } 186 } 187 188 }); 189 190}); 191 192$(function() { 193 if($('.form-item.radio').length > 0) { 194 $('.form-item.radio input').click(function() { 195 var name = $(this).attr('name'); 196 $('input[name="' + name + '"]').removeClass('active'); 197 $(this).addClass('active'); 198 }); 199 } 200}); 201 202$(function() { 203 if($('.form-item.checkbox').length > 0) { 204 $('.form-item.checkbox input').click(function() { 205 $(this).toggleClass('active'); 206 if($(this).hasClass('active')) { 207 $(this).attr('checked','checked'); 208 } 209 else { 210 $(this).removeAttr('checked'); 211 } 212 }); 213 } 214}); 215 216$(function() { 217 218 //Functions for the My Profile Page 219 220 //The accordian style sliders for the avatar and update password 221 var speed = 500; 222 223 $('.my-ra-avatar-update #submit').attr('value','Change avatar >>'); 224 225 if($('.my-ra-update-password .err').length > 0) { 226 ra_profile_slide ('.change', $('.change-password'), '#item-avatar', '#item-password', 0); 227 } 228 229 if($('.ra-accordian').length > 0) { 230 231 $('.change').click(function(){ 232 233 if($(this).hasClass('active')) { 234 $('.change').removeClass('active');
235 $('#item-password').slideUp(speed); 236 $('#item-avatar').slideUp(speed); 237 return false; 238 } 239 240 if($(this).hasClass('change-avatar')) { 241 242 ra_profile_slide ('.change', this, '#item-password', '#item-avatar', speed); 243 244 } 245 else if($(this).hasClass('change-password')) { 246 ra_profile_slide ('.change', this, '#item-avatar', '#item-password', speed); 247 } 248 249 return false; 250 }); 251 } 252 253 $('.ra-accordian-reset').click(function(){ 254 $('.change').removeClass('active'); 255 $('.ra-accordian li').slideUp(speed/2); 256 }); 257 258 function ra_profile_slide (a, el, up, down, speed) { 259 $(a).removeClass('active'); 260 $(el).addClass('active'); 261 262 $(down).slideDown(speed, function(){}); 263 264 $(up).slideUp(speed/2); 265 } 266 267 //Show more comments 268 $('.more-comments').click(function() { 269 ra_show_more(this, '#more-comments', 300); 270 return false; 271 }); 272 273 function ra_show_more(el,target,speed) { 274 if($(el).hasClass('active')){ 275 $(target).slideUp(speed); 276 $(el).removeClass('active').text('See more >>'); 277 } 278 else { 279 $(target).slideDown(speed); 280 $(el).addClass('active').text('See less >>'); 281 } 282 } 283 284 //Could not use ra_show_more due to height calculations 285 $('.more-favourites').click(function() { 286 287 var len = $('#more-favourites .articlePod').length; 288 var height = $('.articlePod:first').height(); 289 290 var window_width_em = 1/16 * $('body').width(); 291 292 if(window_width_em > 40) { 293 if(len > 3) { 294 height = (height * 2) + 20; 295 } 296 } 297 else 298 { 299 height = (height * len) + 40; 300 } 301 302 if($(this).hasClass('active')){ 303 $('#more-favourites').animate({ height: 0 }, speed); 304 $(this).removeClass('active').text('See more >>'); 305 } 306 else { 307 $('#more-favourites').animate({ height: height }, speed); 308 $(this).addClass('active').text('See less >>'); 309 } 310 311 return false; 312 }); 313 314}); 315 316 317$(document).ready(function() { 318 319 $('.hide-until-ready').css('visibility','visible'); 320 321 //COOKIE BAR LINK 322 $('#catapult-cookie-bar a').addClass('button secondary'); 323 324 trackingUtility.main.myFunction(); 325 326 $('.wpProQuiz_content').after('<div class="clear"></div>'); 327 328 // STICKY FOOTER JS 329 var footer = $(".footerRow"); 330 var pos = footer.position(); 331 var height = $(window).height(); 332 var postop = 0; 333 if(pos){postop = pos.top;} 334 335 height = height - postop; 336 height = height - footer.height(); 337 338 // START THE SCREENSHOT CODE FOR THE RELATIONSTICKS RESULTS PAGE 339 var hair; 340 var eyes; 341 var outfit; 342 var scenario; 343 var resolution; 344 var imageSharePath; 345 var hat; 346 var exp1; 347 var exp2; 348 var exp3; 349 350 function generateId(){ 351 352 var relationstickScenarioNames = [ 353 "", 354 "Hats life", 355 "Is it ok?", 356 "First kiss", 357 "Unflattering pic of a friend online", 358 "Friend crush", 359 "My parents dont want me to go out with my girlfriend/boyfriend", 360 "My friends are leaving me out", 361 "My parents new relationship is upsetting me", 362 "My friends are smarter than I am", 363 "Im worried my girlfriend/boyfriend might break up with me" 364 ]; 365 366 hair = $('.manualImageGen .hair').val(); 367 eyes = $('.manualImageGen .eyes').val(); 368 outfit = $('.manualImageGen .outfit').val(); 369 scenario = $('.manualImageGen .scenario').val(); 370 resolution = $('.manualImageGen .resolution').val(); 371 hat = $('.manualImageGen .hat').val(); 372 exp1 = $('.manualImageGen .exp1').val(); 373 exp2 = $('.manualImageGen .exp2').val(); 374 exp3 = $('.manualImageGen .exp3').val(); 375 hasForeground = $('.manualImageGen .hasForeground').val(); 376 hasForeground_res = $('.manualImageGen .hasForeground_res').val(); 377 hasForeground_opt = $('.manualImageGen .hasForeground_opt').val(); 378 hideCharacter_res = $('.manualImageGen .hideCharacter_res').val(); 379 hideCharacter_opt = $('.manualImageGen .hideCharacter_opt').val(); 380 381 imageId = hair+"-"+eyes+"-"+outfit+"-"+scenario+"-"+resolution+"-"+hat+"-"+exp1+"-"+exp2+"-"+exp3+"-"+hasForeground+"-"+hasForeground_res+"-"+hasForeground_opt+"-"+hideCharacter_res+"-"+hideCharacter_opt; 382 383 $.ajax({ 384 type: "POST", 385 url: ajaxurl, 386 data: { 387 'action':'nopriv_ra_addrelationstick',
388 'rstickChoices' : imageId, 389 'rstickName' : scenario >= relationstickScenarioNames.length ? 'Untitled' : relationstickScenarioNames[scenario] 390 } 391 }) 392 .done(function( msg ) { 393 394 queryString = msg; 395 396 imageSharePath = 'http://' + document.domain + '/relationsticks/build/?var=' + queryString; 397 }); 398 399 } 400 401 // DO THE SCREENSHOT ON CLICK 402 $('.screenShot').click(function(){ 403 $('.relationstickSocialIcons').fadeIn(); 404 405 $('.penultRstickBtns').fadeOut(function(){ 406 $('.finalRstickBtns').fadeIn(); 407 408 $('.finalRsticktxt1').fadeOut(0); 409 $('.finalRsticktxt2').fadeIn(0); 410 }); 411 generateId(); 412 return false; 413 }); 414 415 function getParameterByName(name) { 416 name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); 417 var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), 418 results = regex.exec(location.search); 419 //console.log(results); 420 return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); 421 } 422 423 var raQueryString = getParameterByName('var'); 424 425 if(raQueryString) { 426 var qStr = raQueryString; 427 var qResult = qStr.split("-"); 428 429 function updateAng(){ 430 $('.manualImageGen .buildStep').val(7); 431 $('.manualImageGen .hair').val(qResult[2]); 432 $('.manualImageGen .eyes').val(qResult[3]); 433 $('.manualImageGen .outfit').val(qResult[4]); 434 $('.manualImageGen .scenario').val(qResult[5]); 435 $('.manualImageGen .resolution').val(qResult[6]); 436 $('.manualImageGen .hat').val(qResult[7]); 437 $('.manualImageGen .exp1').val(qResult[8]); 438 $('.manualImageGen .exp2').val(qResult[9]); 439 $('.manualImageGen .exp3').val(qResult[10]); 440 $('.manualImageGen .hasForeground').val(qResult[11]); 441 $('.manualImageGen .hasForeground_res').val(qResult[12]); 442 $('.manualImageGen .hasForeground_opt').val(qResult[13]); 443 $('.manualImageGen .hideCharacter_res').val(qResult[14]); 444 $('.manualImageGen .hideCharacter_opt').val(qResult[15]); 445 $(".manualImageGen input").trigger("input"); 446 } 447 setTimeout(function(){ updateAng() }, 50); 448 } 449 450 $('.rstick-not-logged-in').click(function(){ 451 452 hair = $('.manualImageGen .hair').val()+"."; 453 eyes = $('.manualImageGen .eyes').val()+"."; 454 outfit = $('.manualImageGen .outfit').val()+"."; 455 scenario = $('.manualImageGen .scenario').val()+"."; 456 resolution = $('.manualImageGen .resolution').val()+"."; 457 hat = $('.manualImageGen .hat').val()+"."; 458 exp1 = $('.manualImageGen .exp1').val()+"."; 459 exp2 = $('.manualImageGen .exp2').val()+"."; 460 exp3 = $('.manualImageGen .exp3').val()+"."; 461 hasForeground = $('.manualImageGen .hasForeground').val()+"."; 462 hasForeground_res = $('.manualImageGen .hasForeground_res').val()+"."; 463 hasForeground_opt = $('.manualImageGen .hasForeground_opt').val()+"."; 464 hideCharacter_res = $('.manualImageGen .hideCharacter_res').val()+"."; 465 hideCharacter_opt = $('.manualImageGen .hideCharacter_opt').val()+"."; 466 467 cookieChoices = hair+eyes+outfit+scenario+resolution+hat+exp1+exp2+exp3+hasForeground+hasForeground_res+hasForeground_opt+hideCharacter_res+hideCharacter_opt; 468 469 $.cookie('rstick', cookieChoices, { expires: 7, path: '/' }); 470 471 }); 472 473 if($.cookie('rstick') && window.location.pathname == "/relationsticks/build/") 474 { 475 var str = $.cookie('rstick'); 476 var res = str.split("."); 477 478 //console.log(res); 479 480 function cookieAng(){ 481 $('.manualImageGen .buildStep').val(7); 482 $('.manualImageGen .hair').val(res[0]); 483 $('.manualImageGen .eyes').val(res[1]); 484 $('.manualImageGen .outfit').val(res[2]); 485 $('.manualImageGen .scenario').val(res[3]); 486 $('.manualImageGen .resolution').val(res[4]); 487 $('.manualImageGen .hat').val(res[5]); 488 $('.manualImageGen .exp1').val(res[6]); 489 $('.manualImageGen .exp2').val(res[7]); 490 $('.manualImageGen .exp3').val(res[8]); 491 $('.manualImageGen .hasForeground').val(res[9]); 492 $('.manualImageGen .hasForeground_res').val(res[10]); 493 $('.manualImageGen .hasForeground_opt').val(res[11]); 494 $('.manualImageGen .hideCharacter_res').val(res[12]); 495 $('.manualImageGen .hideCharacter_opt').val(res[13]); 496 $(".manualImageGen input").trigger("input"); 497 498 $.removeCookie('rstick', { path: '/' }); 499 } 500 501 setTimeout(function(){ cookieAng() }, 50); 502 } 503 504 // ================================================ SOCIAL STUFF FOR THE RELATIONSTICKS 505 window.fbAsyncInit = function() { 506 FB.init({ 507 appId : '1530679850523862', 508 xfbml : true, 509 version : 'v2.2' 510 }); 511 }; 512 513 function handle_facebookshare(name, link, picture, caption, desc){ 514 FB.ui( 515 { 516 method: 'feed', 517 name: name, 518 link: link, 519 picture: picture, 520 caption: caption, 521 description: desc 522 }, 523 function(response){ 524 if (response && response.post_id) { 525 // alert('Post was published.'); 526 } else { 527 // alert('Post was not published.'); 528 } 529 } 530 ); 531 } 532 533 /* function handle_facebookshare(){ 534 FB.ui({ 535 method: 'share', 536 href: window.location.href 537 }, function(response) { 538 } 539 ) 540 } */ 541 542 function handle_twittershare(link, desc){ 543 var msg = encodeURIComponent(desc); 544 var url = encodeURIComponent(link); 545 var link = 'https://twitter.com/share?text=' + msg + '&url=' + url + '&via=We_RiseAbove'; 546 window.open(link, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600'); 547 } 548 549 function handle_googleshare(link){ 550 var url = encodeURIComponent(link); 551 var link = 'https://plus.google.com/share?url=' + url; 552 window.open(link, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600'); 553 } 554 555 $('.google').click(function(){ 556 googlelink = imageSharePath; 557 handle_googleshare(googlelink); 558 return false;
559 }); 560 561 $('.twitter').click(function(){ 562 twitterlink = window.location.href; 563 twittermessage = $("meta[name='twitter:title']").attr('content'); 564 handle_twittershare(twitterlink, twittermessage); 565 return false; 566 }); 567 568 $('.facebook').click(function(){ 569 name = $("meta[property='og:title']").attr('content'); 570 link = $("meta[property='og:url']").attr('content'); 571 picture = $("meta[property='og:image']").attr('content'); 572 caption = ""; 573 desc = $("meta[property='og:description']").attr('content'); 574 handle_facebookshare(name, link, picture, caption, desc); 575 return false; 576 }); 577 578 if($('.wpProQuiz_button').length > 0) { 579 $('.wpProQuiz_button').each(function(){ 580 $(this).addClass('button'); 581 }); 582 } 583 584}); 585 586$(document).ready(function(){ 587 588 if($('.wpulike').length > 0) { 589 590 $('.wpulike').each(function(){ 591 592 var unlike = $(this).children('.counter').children('a.text'); 593 594 //if 'unlike' we have text that means there can be 2 states 595 //1. I have likes it or 596 //2. I once have liked it but then unliked it 597 598 if(unlike) { 599 switch(unlike.text()){ 600 case 'Unlike': 601 $(unlike) 602 .removeClass('text') 603 .addClass('image favActive') 604 .text(''); 605 break; 606 607 case 'Like Me Again!': 608 $(unlike) 609 .removeClass('text') 610 .addClass('image') 611 .text(''); 612 break; 613 } 614 } else { 615 616 //var usertooltip = $(this).children('.counter').children('a.usertooltip'); 617 //if(usertooltip) {} 618 619 620 $(this).children('.counter').children('a.image'); 621 622 } 623 }); 624 } 625 626 $('.rsRadioButton').click(function(){ 627 $('.rsRadioButton').removeClass('activeChoice'); 628 $(this).addClass('activeChoice'); 629 }); 630 631 var restartQuiz_text = $('.restartQuiz').attr('value') + '>>'; 632 $('.restartQuiz').attr('value', restartQuiz_text); 633 $('.restartQuiz').addClass('button'); 634 635 if($('#catapult-cookie-bar').is(':visible')){ 636 $('body').addClass('has-cookie-bar'); 637 } 638 639 $('#catapultCookie').click(function(){ 640 $('body').removeClass('has-cookie-bar'); 641 }); 642 643 // miss peregrine form 644 if ( $('.peregrine-form').length > 0 ) { 645 $('.peregrine-form .wpcf7-list-item label').each(function(){ 646 $(this).html($(this).html().split(" ").join("")); 647 }); 648 649 $('label[for="per-answer"]') 650 .prependTo("#per-answer"); 651 652 $('.peregrine-form .textfield-wrap label').each(function(){ 653 $(this).after(' '); 654 $(this) 655 .appendTo( $(this).closest('.textfield-wrap').find('.wpcf7-form-control-wrap') ); 656 }); 657 658 $('.wpcf7-form').submit(function(){ 659 $('.wpcf7-submit').prop('disabled','true'); 660 }); 661 662 } 663 // transformers form 664 if ( $('.transformers-form').length > 0 ) { 665 666 var transformersLoader = templateDirUri + '/img/transformers/form-loader.gif'; 667 668 $('.transformers-form .ajax-loader').attr('src', transformersLoader); 669 670 $('.transformers-main__device, .transformers-topbar img').click(function() { 671 $('html, body').animate({ 672 scrollTop: $(".transformers-form").offset().top 673 }, 800); 674 return false; 675 }); 676 677 $('.transformers-form .wpcf7-list-item label').each(function(){ 678 $(this).html($(this).html().split(" ").join("")); 679 }); 680 681 $('label[for="per-answer"]') 682 .prependTo("#per-answer"); 683 684 $('.transformers-form .textfield-wrap label').each(function(){ 685 $(this).after(' '); 686 $(this) 687 .appendTo( $(this).closest('.textfield-wrap').find('.wpcf7-form-control-wrap') ); 688 }); 689 690 $('.wpcf7-form').submit(function(){ 691 $('.wpcf7-submit').prop('disabled','true'); 692 if ( $('.transformers-form .ajax-loader').attr('src') !== transformersLoader ) { 693 // just to make sure new loader is used 694 $('.transformers-form .ajax-loader').attr('src', transformersLoader); 695 } 696 }); 697 698 } 699 700 // pitch-perfect form 701 if ($('.pitch-perfect-form').length > 0) { 702 703 var pitchPerfectLoader = templateDirUri + '/img/pitch-perfect/form-loader.gif'; 704 705 $('.pitch-perfect-form .ajax-loader').attr('src', pitchPerfectLoader); 706 707 $('.pitch-perfect-main__device, .pitch-perfect-topbar img').click(function () { 708 $('html, body').animate({ 709 scrollTop: $(".pitch-perfect-form").offset().top 710 }, 800); 711 return false;
712 }); 713 714 $('.pitch-perfect-form .wpcf7-list-item label').each(function () { 715 $(this).html($(this).html().split(" ").join("")); 716 }); 717 718 $('label[for="per-answer"]') 719 .prependTo("#per-answer"); 720 721 $('.pitch-perfect-form .textfield-wrap label').each(function () { 722 $(this).after(' '); 723 $(this) 724 .appendTo($(this).closest('.textfield-wrap').find('.wpcf7-form-control-wrap')); 725 }); 726 727 $('.wpcf7-form').submit(function () { 728 $('.wpcf7-submit').prop('disabled', 'true'); 729 if ($('.pitch-perfect-form .ajax-loader').attr('src') !== pitchPerfectLoader) { 730 // just to make sure new loader is used 731 $('.pitch-perfect-form .ajax-loader').attr('src', pitchPerfectLoader); 732 } 733 }); 734 735 } 736 737 // Love, Simon form 738 if ($('.love-simon form').length) { 739 var form = $('.love-simon form'); 740 741 document.addEventListener('wpcf7mailsent', function(e) { 742 document.cookie = "thankyou_love-simon=true"; 743 window.location.href = window.location.href; 744 }, false ); 745 } 746 747 if ($('.competition.love-simon .competition-share')) { 748 $('html, body').scrollTop(0); 749 } 750 751 //}); 752 753 // The Darkest Minds 754 if ($('.the-darkest-minds form').length) { 755 756 var form = $('.the-darkest-minds form'); 757 758 document.addEventListener('wpcf7mailsent', function(e) { 759 document.cookie = "thankyou_the-darkest-minds=true"; 760 window.location.href = window.location.href; 761 }, false ); 762 } 763 764 if ($('.competition.the-darkest-minds .competition-share')) { 765 $('html, body').scrollTop(0); 766 } 767 768 $('.competition-cta').on('click', function(e) { 769 e.preventDefault(); 770 771 var formTop = $('.competition-form').offset().top; 772 $('html,body').animate({ 'scrollTop': formTop }, 1000); 773 }); 774 775}); 776 777function pereguineSubmit() { 778 $('.wpcf7-submit').prop("disabled", false); 779} 780function transformersSubmit() { 781 $('.wpcf7-submit').prop("disabled", false); 782} 783function pitchPerfectSubmit() { 784 $('.wpcf7-submit').prop("disabled", false); 785} 786 787//Tracking Utility 788; var trackingUtility = {}; 789; (function ($) { 790 trackingUtility.main = { 791 host: location.host, 792 pathname: location.pathname, 793 794 myFunction: function () { 795 796 var _self = this; 797 798 //$('a').each(function(){ 799 // if($(this).attr('target') == '_blank'){ 800 // $(this).removeAttr('target').addClass('target_blank'); 801 // } 802 //}); 803 804 $('a').click(function(){ 805 806 var href = $(this).attr('href'); 807 var href_index = href.indexOf(_self.host); 808 var target_blank = false; 809 var target_blank_share = false; 810 811 if($(this).attr('target') == '_blank' || $(this).hasClass('target_blank')){ 812 target_blank = true; 813 } 814 815 if($(this).hasClass('ssba_twitter_share') 816 || $(this).hasClass('ssba_google_share') 817 || $(this).hasClass('ssba_facebook_share')) 818 { 819 target_blank_share = true; 820 } 821 822 /* If internal link we'll just return true */ 823 if(href === '#' || href_index > -1){ 824 return true; 825 } 826 827 /* Get the Link description or image alt tag */ 828 var text = $(this).text(); 829 if($(this).children('img').length === 1) { 830 text = $(this).children('img').attr('alt'); 831 } 832 833 try { 834 /* We'll try send the click event to GA*/ 835 var str_this = _self.pathname + ", " + href + ", " + text; 836 ga('send', 'event', 'click', str_this, {useBeacon: true}); 837 } catch (d) {} 838 839 if(target_blank_share == true) 840 { 841 setTimeout(function() { 842 //window.open(href,'_newtab'); 843 }, 500); 844 } 845 846 }); 847 } 848 } 849})(jQuery); 850 851 852function goBack() { 853 window.history.go(-1); 854} 855 856$(document).on('open.fndtn.reveal', '[data-reveal]', function () { 857 var modal = $(this); 858 // alert("I'm open!"); 859}); 860 861 862$( '.modal-reveal' ).on( "click", function(event) { 863 // $( 'body' ).addClass( 'reveal-opened' ); 864} ); 865 866 867// Cookie consent message 868/* 869var cookieMessage = 'We use necessary cookies which are allowed by law for normal website operation. We analyse usage and performance of the site using anonymous cookies and assume you would like us to continue to do so.' + 870 ' <a class="" tabindex="0" target="_blank" href="/cookies-policy">Learn more</a>'; 871 872window.addEventListener("load", function() 873{ 874 window.cookieconsent.initialise( 875 { 876 "window": '<div role="dialog" aria-live="polite" aria-label="cookieconsent" aria-describedby="cookieconsent:desc" class="cc-window {{classes}}" style=""><div class="inny" style="display:block;">{{children}}</div></div>', 877 "container" : "cookie-content", 878 "palette" : { 879 "popup" : { 880 "background": "#464646" 881 882 }, 883 "button" : { 884 "background": "#00d8ff" 885 } 886 }, 887 "content": {
888 header: 'Cookies used on the website!', 889 message: cookieMessage, 890 dismiss: 'Ok, thanks!', 891 link: ' ', 892 href: '', 893 close: '❌', 894 }, 895 "position": 'top' 896 }) 897}); 898*/
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.