1/* ======= FUNCTIONS ======= */ 2 3/* --- LOADERS --- */ 4 5function slideLoaded(obj){ 6 obj.addClass('loaded'); 7 var countImg = $('#FeatImg.home').find('img').length; 8 var loadedImg = $('#FeatImg.home').find('img.loaded').length; 9 if (loadedImg == countImg){ 10 $('#LoaderText > span').html('100%'); 11 $('#Loader, #LoaderText').fadeOut('slow',function(){ 12 $('#MovingParts, .cycle, .cycle_pager').fadeIn('fast', loadTitles()); 13 }); 14 } else { 15 var percentLoaded = loadedImg/countImg * 100; 16 $('#LoaderText > span').html(percentLoaded+'%'); 17 } 18}; 19 20function heroSlideLoaded(obj){ 21 obj.addClass('loaded'); 22 var countImg = $('#HeroCycle').find('img').length; 23 var loadedImg = $('#HeroCycle').find('img.loaded').length; 24 if (loadedImg == countImg){ 25 runHeroSlide(); 26 $('#LoaderText > span').html('100%'); 27 $('#Loader, #LoaderText').fadeOut('slow',function(){ 28 $('#HeroMovingParts').fadeIn('slow',function(){ 29 $('#HeroPager .left, #HeroOverlay').animate({marginLeft: '0'},'slow','easeOutBack'); 30 $('#HeroPager .right').animate({marginRight: '0'},'slow','easeOutBack'); 31 }); 32 }); 33 } else { 34 var percentLoaded = Math.round(loadedImg/countImg * 100); 35 $('#LoaderText > span').html(percentLoaded+'%'); 36 } 37}; 38 39function loadTitles(){ 40 $('.holder').find('h3').delay(500).animate({textIndent: ['0', 'easeOutBack'], opacity: '.999'},'slow'); 41 $('.holder').find('.blue_button').delay(500).animate({marginLeft: ['0', 'easeOutBack'], opacity: '.999'},'slow'); 42 $('.holder').find('h2').delay(500).animate({marginRight: ['0', 'easeOutBack'], opacity: '.999'},'slow'); 43} 44 45function imgLoaded(obj){ 46 obj.fadeIn('slow', function(){ 47 if ($('#ParentTitle').length){ 48 $('#ParentTitle').find('h2').animate({textIndent: ['0', 'easeOutBack'], opacity: '.999'},'slow'); 49 } 50 }); 51} 52 53function logoLoaded(){ 54 $('header').find('.logo').addClass('loaded'); 55} 56 57/* --- TEST FOR MOBILE/TABLET --- */ 58 59function mobileTest(){ 60 mobile = false; 61 62 if ( /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent)){ 63 mobile = true; 64 }; 65 66 if (mobile == true){ 67 $('body').addClass('touch_device'); 68 }; 69}; 70 71/* --- GIVE MAIN HEIGHT --- */ 72 73function mainHeight(){ 74 var cOff = parseInt($('#ContentDS').css('top')); 75 var ch = $('#Content').outerHeight(); 76 var mh = ch+cOff+40; 77 $('#Main').height(mh); 78} 79 80/* --- INSTANTIATE BG SLIDESHOW --- */ 81 82function runBGSlide(){ 83 84 if($('#FeatImg.home').length){ 85 86 oldH2Height = 0; 87 newH2Height = 0; 88 h2 = $('.overlay').find('h2'); 89 90 $('#MovingParts').cycle({ 91 fx: 'fade', 92 timeout: 40000, 93 speed: 3500, 94 fit: 1, 95 width: '100%', 96 pager: '.cycle_pager', 97 prev: '.cycle.prev', 98 next: '.cycle.next', 99 before: function(){ 100 var slide = $(this).find('img'); 101 var subt = slide.attr('data-subt'); 102 var titl = slide.attr('data-titl'); 103 var link = slide.attr('data-link'); 104 var src = slide.attr('data-src'); 105 106 $('.overlay').find('h3').html(subt); 107 h2.find('span').animate({opacity: '0'}, 200, 108 function(){ 109 h2.find('span').html(titl); 110 newH2Height = h2.height(); 111 112 if (oldH2Height != 0){ 113 h2.css('height', oldH2Height); 114 } 115 h2.animate({height: newH2Height}, 650, 'easeOutBack', function(){ 116 h2.css('height','auto'); 117 h2.find('span').animate({opacity: '.999'}, 1000); 118 }); 119 }); 120 121 $('.overlay').find('.blue_button > span').html(link); 122 $('.overlay').find('a').attr('href',src); 123 $('.overlay').find('a').attr('target',"_blank"); 124 125 126 }, 127 after: function(){ 128 oldH2Height = h2.height(); 129 h2.css('height','auto'); 130 } 131 }); 132 } 133} 134 135/* --- INSTANTIATE HERO SLIDESHOW --- */ 136 137function runHeroSlide(){ 138 if($('#HeroCycle').length){ 139 $('#HeroMovingParts').cycle({ 140 fx: 'fade', 141 timeout: 8000, 142 speed: 1000, 143 fit: 1, 144 width: '100%', 145 pager: '#HeroPager .left', 146 before: function(){ 147 slide = $(this); 148 overlay = $('#HeroOverlay'); 149 hw = overlay.outerWidth(); 150 overlay.animate({marginLeft:'-'+hw+'px'},'slow',function(){ 151 var caption = slide.find('.caption').html(); 152 overlay.html(caption); 153 overlay.animate({marginLeft:'0'},'slow','easeOutBack'); 154 mainHeight(); 155 }); 156 $('#HeroPager .right h4').fadeOut('slow',function(){ 157 var mname = slide.find('h5').html(); 158 $('#HeroPager .right h4').html(mname); 159 $('#HeroPager .right h4').fadeIn('slow'); 160 }); 161 } 162 }); 163 } 164} 165 166/* --- FEAT BOX TEXT SIZE --- */ 167 168function featTextSize(){ 169 $('.feat_box').each(function(){ 170 fbw = $(this).width() - 40; 171 var h3fs = fbw/95; 172 var pfs = fbw/130; 173 if (fbw < 206){ 174 $(this).find('h3').css('font-size',h3fs+'em'); 175 $(this).find('p').css('font-size',pfs+'em'); 176 } else { 177 $(this).find('h3').removeAttr('style'); 178 $(this).find('p').removeAttr('style'); 179 } 180 }) 181} 182
183/* --- GET TRACK INFO --- */ 184 185function getTrackInfo(){ 186 187 //console.log('refreshing titles'); 188 //console.info('old = '+old); 189 190 $.getJSON("http://23.21.68.2/admin/services.php?callback=?", 191 {q:'current_track'}, 192 function(data){ 193 var currentTrack = data.TrackInfo.Composer+" â"+data.TrackInfo.Track+"â â <em>"+data.TrackInfo.Album+"</em>Â ["+data.TrackInfo.Duration+"]"; 194 //console.info('new = '+currentTrack); 195 if (currentTrack != old){ 196 $('#Title').animate({opacity: '0'},'slow',function(){ 197 //console.log('updating titles'); 198 var oldW = $('#Title').width(); 199 clearInterval(dotsCounter); 200 if ($('#Dots').length){ 201 $('#Dots').html(''); 202 } 203 $('#Text').html(currentTrack); 204 old = $('#Text').html().replace("&","&"); 205 $('#Title').css('width','auto'); 206 var newW = $('#Title').outerWidth(); 207 $('#Title').css('width',oldW+'px'); 208 $('#Title').animate({width: newW,opacity: '.999'},'fast'); 209 }); 210 } else { 211 //console.log('no change'); 212 } 213 } 214 ); 215} 216 217function updateTrackInfo() { 218 //console.log('refreshing titles'); 219 //console.info('old = '+old); 220 221 $.getJSON("http://23.21.68.2/admin/services.php?callback=?", 222 {q:'current_track_with_art'}, 223 function(data){ 224 var currentTrack = data.TrackInfo.Composer+" â"+data.TrackInfo.Track+"â â <em>"+data.TrackInfo.Album+"</em>Â ["+data.TrackInfo.Duration+"]"; 225 //console.info('new = '+currentTrack); 226 if (currentTrack != old){ 227 $('#Title').animate({opacity: '0'},'slow',function(){ 228 //console.log('updating titles'); 229 var oldW = $('#Title').width(); 230 clearInterval(dotsCounter); 231 if ($('#Dots').length){ 232 $('#Dots').html(''); 233 } 234 $('#Text').html(currentTrack); 235 old = $('#Text').html().replace("&","&"); 236 $('#Title').css('width','auto'); 237 var newW = $('#Title').outerWidth(); 238 $('#Title').css('width',oldW+'px'); 239 $('#Title').animate({width: newW,opacity: '.999'},'fast'); 240 }); 241 if ($('#now_playing').length) { 242 $('#now_playing').animate({opacity:0}
242, 'slow', function(){ 243 var out = "<div id='now_playing'><h3>Now Playing</h3>"; 244 if (typeof data.TrackInfo.CoverArt !== 'undefined' && data.TrackInfo.CoverArt[0] != null) { 245 out += "<div style='float:left; width:15%;margin:5px 15px 0 0;'>"; 246 out += "<img style='border-bottom:none;' src='../NewMusic_files/" + data.TrackInfo.CoverArt[0] + "' />"; 247 out += "</div>"; 248 } 249 out += "<p><strong>" + data.TrackInfo.Track + "</strong> by "; 250 out += data.TrackInfo.Composer + "<br />"; 251 out += "From <em>" + data.TrackInfo.Album + "</em>"; 252 if (data.TrackInfo.Label) { 253 var albumYear = data.TrackInfo.Year ? " " + data.TrackInfo.Year : ""; 254 out += " (" + data.TrackInfo.Label + albumYear + ")<br />"; 255 } else { 256 out += "<br />"; 257 } 258 if (data.TrackInfo.Performers) { 259 out += "Performed by " + data.TrackInfo.Performers + "<br />"; 260 } 261 if (typeof data.TrackInfo.AmazonDetailPage !== 'undefined' && data.TrackInfo.AmazonDetailPage[0] != null) { 262 out += "<a href='../NewMusic_files/" + data.TrackInfo.AmazonDetailPage[0] + "' target='_blank'>Buy on Amazon</a><br />"; 263 } 264 out += "<span id='CS_inline_trigger' data-track_id='" + data.TrackInfo.ID + "'>Listen <span>â¶</span></span></p></div>"; 265 266 $('#now_playing').html(out).animate({opacity:1}, 'fast'); 267 }); 268 } 269 } else { 270 //console.log('no change'); 271 } 272 } 273 ); 274} 275 276/* --- RADIO EVENTS --- */ 277 278function radioLoading(){ 279 $('#Title').animate({width: '70px'},'fast','easeOutBack'); 280 $('#Text').html('Buffering '); 281 $('#PlayPause').css('background-position','3px 26px'); 282 var dots = $('#Dots'); 283 dotsCounter = setInterval(function() { 284 if (dots.html().length == 3){ 285 dots.html(''); 286 } else { 287 dots.append('.') 288 }; 289 }, 400); 290} 291 292function radioPlay(){ 293 $('#Title').animate({opacity: '0'},'fast','easeOutBack',function(){ 294 $('#Text').html('Getting Track Information'); 295 $('#Title').animate({opacity: '.999',width: ['128px','easeOutBack']},'fast',function(){ 296 old = $('#Text').html(); 297 getTrackInfo(); 298 refreshTitles = setInterval(function() { 299 updateTrackInfo(); 300 }, 10000); 301 $('#PlayPause').css('background-position','3px 26px'); 302 }); 303 304 }); 305} 306 307function radioStop(){ 308 clearInterval(dotsCounter); 309 if (typeof refreshTitles != 'undefined'){ 310 clearInterval(refreshTitles); 311 } 312 $('#Dots').html(''); 313 $('#Text').html('Counterstream Radio'); 314 $('#Title').animate({width: '105px',minWidth: '0'},'fast','easeOutBack'); 315 $('#PlayPause').css('background-position','3px -21px'); 316} 317 318function radioTextLinkClick() { 319 $('#PlayPause').click(); 320 if ($('#CS_inline_trigger').html().indexOf('Listen') != -1) { 321 $('#CS_inline_trigger').html('Playing <span id="inlineDots"></span>'); 322 var dots = $('#inlineDots'); 323 dotsCounter = setInterval(function() { 324 if (dots.html().length == 3){ 325 dots.html(''); 326 } else { 327 dots.append('.'); 328 }; 329 }, 400); 330 } else { 331 $('#CS_inline_trigger').html('Listen â¶'); 332 } 333} 334 335/* --- EQUAL BOX HEIGHTS --- */ 336 337function eqlBox(box){ 338 if (box.length){ 339 tallest = 0; 340 total = box.length; 341 i = 0; 342 box.css('height','auto'); 343 box.each(function(){ 344 i++; 345 if ($(this).height() > tallest){ 346 tallest = $(this).height(); 347 }; 348 if (i == total){ 349 box.css('height',tallest); 350 }; 351 }); 352 mainHeight(); 353 }; 354}; 355 356/* --- VERTICAL CENTER SLIDESHOW ELEMENTS --- */ 357 358function vCenter(){ 359 holderHeight = $('.holder').height() * .9; 360 $('.holder').css('line-height',holderHeight+'px'); 361}; 362 363/* --- FORCE DISPLAY HEADER NAV ON RESIZE --- */ 364 365function forceNav(){ 366 if ((ww > 550) && ($('.collapsed').length)){ 367 $('header nav').removeAttr('style'); 368 }; 369}; 370 371/* --- HIDE AND SHOW BLOG CATAGORIES (because masonry is a bloated piece of crap) -- */ 372 373function hideShowCats(cat){ 374 if (cat != "all"){ 375 $('#Grid').find('.feat_box_alt:not(.'+cat+')').animate({ height: '0', width: '0', opacity: '0' }, 'slow', function(){ 376 $(this).removeAttr('style'); 377 $(this).hide(); 378 mainHeight(); 379 }); 380 $('#Grid').find('.feat_box_alt.'+cat).fadeIn('slow', function(){ 381 mainHeight(); 382 }); 383 384 } else { 385 $('#Grid').find('.feat_box_alt:not(.'+cat+')').fadeIn('slow',function(){ 386 mainHeight(); 387 }); 388 389 }; 390}; 391 392/* --- EVENT LISTENERS --- */ 393 394function clickListen(){ 395 396 $('#NavToggle').toggle(function(){ 397 $(this).find('.tg').addClass('hidden'); 398 $(this).find('.eg').addClass('only'); 399 $('header nav').slideDown(); 400 $('header nav').removeClass('collapsed'); 401 $('header nav').addClass('expanded'); 402 }, function(){ 403 $(this).find('.tg').removeClass('hidden'); 404 $(this).find('.eg').removeClass('only'); 405 $('header nav').slideUp(); 406 $('header nav').addClass('collapsed'); 407 $('header nav').removeClass('expanded'); 408 }); 409 410 $('a').click(function(){ 411 if ($('header nav').hasClass('expanded') && !$(this).closest('li').hasClass('about_nav_link')){ 412 $('#NavToggle').click(); 413 }; 414 }); 415 416 $('.filter').click(function(){ 417 $('#DropToggle').click(); 418 $('.filter').removeClass('active'); 419 $(this).addClass('active'); 420 421 var cat = $(this).attr('data-cat'); 422 var pos = $(this).position(); 423 var fw = $(this).width(); 424 var carratDest = fw/2 + pos.left - 10; 425 $('#Carrat').animate({left: carratDest},'fast','easeOutBack'); 426 hideShowCats(cat); 427 }); 428 429 $('#DropToggle').toggle(function(){ 430 $('#Filters').addClass('expanded'); 431 },function(){ 432 $('#Filters').removeClass('expanded'); 433 }); 434 435 $('header nav li').hover(function(){ 436 if(mobile != true && $.support.leadingWhitespace == true){ 437 var linkPos = $(this).position(); 438 var linkMar = parseInt($(this).find('a').css('marginLeft')); 439 var linkW = $(this).find('a').width(); 440 var navPos = $('header nav').position(); 441 var slidePos = linkPos.left + navPos.left + linkMar + 19; 442 $('#Slider').css({left:slidePos+'px', opacity: '.999', width:linkW+'px'}); 443 }; 444 },function(){ 445 $('#Slider').css('opacity','0'); 446 }); 447 448 $('.ajaxable_post').click(function(){ 449 $(this).find('.prop').click(); 450 }); 451 452 $('.about_menu_wrapper div').toggle(function(){ 453 $(this).removeClass('collapsed'); 454 $(this).addClass('expanded'); 455 $('.sub-menu').slideDown(); 456 }, function(){ 457 $(this).removeClass('expanded'); 458 $(this).addClass('collapsed'); 459 $('.sub-menu').slideUp(); 460 }); 461 462 //CS popup player link 463 $('#CS_popup_link').click(function(e){ 464 e.preventDefault(); 465 $('#GUI').fadeOut('slow'); 466 window.open($(this).attr('href'), 'popup_player', 'width=550,height=260,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=ye
466s,resizable=yes,left=120,top=250,screenX=120,screenY=250'); 467 }); 468 469 //text link to start CS player 470 $('#CS_inline_trigger').click(function(){ 471 radioTextLinkClick(); 472 }); 473 474 //more info for CS tracks 475 $('.track_more_trigger').click(function(){ 476 var track_id = $(this).data('track_id'); 477 var more = $(this).next('.track_more'); 478 more.toggle('slow', 'easeOutBack', function(){ 479 $.getJSON('http://23.21.68.2/admin/services.php?callback=?', {q:'track_detail',id:track_id}, function(data){ 480 var coverArt = data.TrackInfo.CoverArt[0] ? '<img src="../NewMusic_files/' + data.TrackInfo.CoverArt[0] + '" />' : ''; 481 var buyLink = data.TrackInfo.AmazonDetailPage[0] ? '<a href="../NewMusic_files/' + data.TrackInfo.AmazonDetailPage[0] + '">Buy on Amazon</a><br />' : ''; 482 var albumLabel = data.TrackInfo.Label ? data.TrackInfo.Label + ' ' : ''; 483 var albumYear = data.TrackInfo.Year ? '(' + albumLabel + data.TrackInfo.Year + ')' : ''; 484 var performers = data.TrackInfo.Performers ? 'Performed by: ' + data.TrackInfo.Performers + '<br />' : ''; 485 var yearComposed = data.TrackInfo.Composed ? 'Work composed: ' + data.TrackInfo.Composed + '<br />' : ''; 486 more.children('.loading').fadeOut('slow', function(){ 487 $(this).next('.inner').html( 488 coverArt + 489 'From: <em>' + data.TrackInfo.Album + '</em> ' + albumYear + '<br />' + 490 performers + 491 yearComposed + 492 buyLink + '<div style="clear:both"></div>' 493 ).animate({height:'auto'}, 'slow').fadeIn(); 494 $(this).parent().animate({height: $(this).next('.inner').height() + 'px'}); 495 }); 496 }); 497 }); 498 }); 499 500 $('.job_desc').click(function(){ 501 var show = $(this).data('show'); 502 $('html, body').animate({ scrollTop: $(show).offset().top - 125 }, 2000); 503 }); 504}; 505 506/* --- RESPONSIVE IFRAMES --- */ 507 508function wrapIframes(){ 509 $("#Content").find('.lower').find('iframe').each(function(){ 510 $(this).attr('height','100%').attr('width','100%'); 511 if ($(this).attr('src').indexOf('soundcloud') == -1) 512 $(this).wrap('<div class="iframe_wrapper" />'); 513 else 514 $(this).wrap('<div class="iframe_wrapper soundcloud" />'); 515 mainHeight(); 516 }); 517} 518 519 520/* --- CREATE AND THEN THANKFULLY DESTROY THE AWFUL DISQUS (AND NOT A MOMENT TOO SOON..) --- */ 521 522function disqusHeight(){ 523 if (($('.post').length) && ($('.single').length)){ // if on single blog view 524 var disqus_shortname = 'newmusicusa'; 525 526 (function() { 527 var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; 528 dsq.src = 'https://newmusicusa.disqus.com/embed.js'; 529 (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); 530 })(); 531 532 checkHeight = setInterval(function() { 533 mainHeight(); 534 }, 3000); 535 536 } else if (($('.post').length) && ($('.grid').length)){ // if on blog landing view 537 if ($.support.leadingWhitespace == true){ 538 $('.ajaxable_post:first-of-type .feat_box_alt').addClass('latest'); 539 }; 540 541 var disqus_shortname = 'newmusicusa'; 542 543 (function () { 544 var s = document.createElement('script'); s.async = true; 545 s.type = 'text/javascript'; 546 s.src = 'https://newmusicusa.disqus.com/count.js'; 547 (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s); 548 }()); 549 550 } else { 551 $('script').each(function(){ 552 if (this.src.indexOf("embed.js") > -1 || this.src.indexOf("count.js") > -1){ 553 $(this).remove(); 554 }; 555 }); 556 if (typeof checkHeight != 'undefined'){ 557 clearInterval(checkHeight); 558 }; 559 }; 560}; 561 562/* --- AJAX POSTS LOAD --- */ 563 564function ajaxPosts(){ 565 if ($('.grid').length){ 566 567 if ($('.post').length){ 568 var pageNum = parseInt($('#pager-info').data('posts_startpage')) + 1; 569 var max = parseInt($('#pager-info').data('posts_maxpages')); 570 var nextLink = $('#pager-info').data('posts_nextlink'); 571 } else if ($('.page').length){ 572 var pageNum = parseInt($('#pager-info').data('mustor_startpage')) + 1; 573 var max = parseInt($('#pager-info').data('mustor_maxpages')); 574 var nextLink = $('#pager-info').data('mustor_nextlink'); 575 }; 576 577 $('#LoadMore').click(function() { 578 579 if(pageNum <= max) { 580 581 $(this).find('#Message').text('Loading Posts'); 582 $(this).find('#Message.ms').text('Loading Musician Stories'); 583 $(this).append('<span id="MoreDots"></div>'); 584 var dots = $(this).find('#MoreDots'); 585 moreDotsCounter = setInterval(function() { 586 if (dots.html().length == 3){ 587 dots.html(''); 588 } else { 589 dots.append('.') 590 }; 591 }, 400); 592 593 $('.ib.last').before('<div id="AjaxPostsWrapper" class="ib"></div>'); 594 595 $('#AjaxPostsWrapper').load(nextLink + ' .ajaxable_post', 596 function(response, status, xhr) { 597 if (status == "error") { 598 $(this).find('#Message').text('Loading failed'); 599 clearInterval(moreDotsCounter); 600 $('#MoreDots').remove(); 601 } 602 603 if ($('.page').length){ 604 var currentFilter = "all"; 605 } else { 606 var currentFilter = $('.filter.active').attr('data-cat'); 607 }; 608
609 if (currentFilter != "all"){ 610 $('#AjaxPostsWrapper').find('.feat_box_alt').css('opacity','0'); 611 $('#AjaxPostsWrapper').find('.feat_box_alt:not(.'+currentFilter+')').css('display','none'); 612 }; 613 var newContent = $('#AjaxPostsWrapper').html(); 614 $('#AjaxPostsWrapper').remove(); 615 $('.ib.last').before(newContent); 616 eqlBox($('.feat_box_alt .lower')); 617 mainHeight(); 618 $('.feat_box_alt').animate({opacity: '.999'},'slow'); 619 620 pageNum++; 621 nextLink = nextLink.replace(/\/page\/[0-9]?/, '/page/'+ pageNum); 622 623 if(pageNum <= max) { 624 $('#LoadMore').find('#Message').text('Load More Posts'); 625 $('#LoadMore').find('#Message.ms').text('Load More Musician Stories'); 626 clearInterval(moreDotsCounter); 627 $('#MoreDots').remove(); 628 } else { 629 $('#LoadMore').addClass('no_more').find('#Message').text('No More Posts to Load'); 630 $('#LoadMore').addClass('no_more').find('#Message.ms').text('No More Musician Stories to Load'); 631 clearInterval(moreDotsCounter); 632 $('#MoreDots').remove(); 633 } 634 } 635 ); 636 } else { 637 $('#LoadMore').addClass('no_more').find('#Message').text('No More Posts to Load'); 638 $('#LoadMore').addClass('no_more').find('#Message.ms').text('No More Musician Stories to Load'); 639 } 640 641 return false; 642 }); 643 } 644} 645 646/* --- NANO SCROLLER... EUGH... --- */ 647 648(function(c,f,g){var j,h,k,l,m;l={paneClass:"pane",sliderClass:"slider",contentClass:"content",iOSNativeScrolling:!1,preventPageScrolling:!1,disableResize:!1,alwaysVisible:!1,flashDelay:1500,sliderMinHeight:20,sliderMaxHeight:null};j="Microsoft Internet Explorer"===f.navigator.appName&&/msie 7./i.test(f.navigator.appVersion)&&f.ActiveXObject;h=null;m=function(){var b,a;b=g.createElement("div");a=b.style;a.position="absolute";a.width="100px";a.height="100px";a.overflow="scroll";a.top="-9999px";g.body.appendChild(b); 649a=b.offsetWidth-b.clientWidth;g.body.removeChild(b);return a};k=function(){function b(a,b){this.el=a;this.options=b;h||(h=m());this.$el=c(this.el);this.doc=c(g);this.win=c(f);this.generate();this.createEvents();this.addEvents();this.reset()}b.prototype.preventScrolling=function(a,b){this.isActive&&("DOMMouseScroll"===a.type?("down"===b&&0<a.originalEvent.detail||"up"===b&&0>a.originalEvent.detail)&&a.preventDefault():"mousewheel"===a.type&&a.originalEvent&&a.originalEvent.wheelDelta&&("down"===b&& 6500>a.originalEvent.wheelDelta||"up"===b&&0<a.originalEvent.wheelDelta)&&a.preventDefault())};b.prototype.updateScrollValues=function(){var a;a=this.content[0];this.maxScrollTop=a.scrollHeight-a.clientHeight;this.contentScrollTop=a.scrollTop;this.maxSliderTop=this.paneHeight-this.sliderHeight;this.sliderTop=this.contentScrollTop*this.maxSliderTop/this.maxScrollTop};b.prototype.createEvents=function(){var a=this;this.events={down:function(b){a.isBeingDragged=!0;a.offsetY=b.pageY-a.slider.offset().top; 651a.pane.addClass("active");a.doc.bind("mousemove",a.events.drag).bind("mouseup",a.events.up);return!1},drag:function(b){a.sliderY=b.pageY-a.$el.offset().top-a.offsetY;a.scroll();a.updateScrollValues();a.contentScrollTop>=a.maxScrollTop?a.$el.trigger("scrollend"):0===a.contentScrollTop&&a.$el.trigger("scrolltop");return!1},up:function(){a.isBeingDragged=!1;a.pane.removeClass("active");a.doc.unbind("mousemove",a.events.drag).unbind("mouseup",a.events.up);return!1},resize:function(){a.reset()},panedown:function(b){a.sliderY= 652(b.offsetY||b.originalEvent.layerY)-0.5*a.sliderHeight;a.scroll();a.events.down(b);return!1},scroll:function(b){a.isBeingDragged||(a.updateScrollValues(),a.sliderY=a.sliderTop,a.slider.css({top:a.sliderTop}),null!=b&&(a.contentScrollTop>=a.maxScrollTop?(a.options.preventPageScrolling&&a.preventScrolling(b,"down"),a.$el.trigger("scrollend")):0===a.contentScrollTop&&(a.options.preventPageScrolling&&a.preventScrolling(b,"up"),a.$el.trigger("scrolltop"))))},wheel:function(b){if(null!=b)return a.sliderY+= 653-b.wheelDeltaY||-b.delta,a.scroll(),!1}}};b.prototype.addEvents=function(){var a;this.removeEvents();a=this.events;this.options.disableResize||this.win.bind("resize",a.resize);this.slider.bind("mousedown",a.down);this.pane.bind("mousedown",a.panedown).bind("mousewheel DOMMouseScroll",a.wheel);this.content.bind("scroll mousewheel DOMMouseScroll touchmove",a.scroll)};b.prototype.removeEvents=function(){var a;a=this.events;this.win.unbind("resize",a.resize);this.slider.unbind();this.pane.unbind();this.content.unbind("scroll mousewheel DOMMouseScroll touchmove",
654a.scroll).unbind("keydown",a.keydown).unbind("keyup",a.keyup)};b.prototype.generate=function(){var a,b,i,c,d;i=this.options;c=i.paneClass;d=i.sliderClass;a=i.contentClass;!this.$el.find(""+c).length&&!this.$el.find(""+d).length&&this.$el.append('<div class="'+c+'"><div class="'+d+'" /></div>');this.content=this.$el.children("."+a);this.content.attr("tabindex",0);this.slider=this.$el.find("."+d);this.pane=this.$el.find("."+c);h&&(b={right:-h},this.$el.addClass("has-scrollbar"));i.iOSNativeScrolling&& 655(null==b&&(b={}),b.WebkitOverflowScrolling="touch");null!=b&&this.content.css(b);i.alwaysVisible&&this.pane.css({opacity:1,visibility:"visible"});return this};b.prototype.restore=function(){this.stopped=!1;this.pane.show();return this.addEvents()};b.prototype.reset=function(){var a,b,c,f,d,g,e;this.$el.find("."+this.options.paneClass).length||this.generate().stop();this.stopped&&this.restore();a=this.content[0];c=a.style;f=c.overflowY;j&&this.content.css({height:this.content.height()});b=a.scrollHeight+ 656h;g=this.pane.outerHeight();e=parseInt(this.pane.css("top"),10);d=parseInt(this.pane.css("bottom"),10);d=g+e+d;e=Math.round(d/b*d);e<this.options.sliderMinHeight?e=this.options.sliderMinHeight:null!=this.options.sliderMaxHeight&&e>this.options.sliderMaxHeight&&(e=this.options.sliderMaxHeight);"scroll"===f&&"scroll"!==c.overflowX&&(e+=h);this.maxSliderTop=d-e;this.contentHeight=b;this.paneHeight=g;this.paneOuterHeight=d;this.sliderHeight=e;this.slider.height(e);this.events.scroll();this.pane.show(); 657this.isActive=!0;this.pane.outerHeight(!0)>=a.scrollHeight&&"scroll"!==f?(this.pane.hide(),this.isActive=!1):this.el.clientHeight===a.scrollHeight&&"scroll"===f?this.slider.hide():this.slider.show();return this};b.prototype.scroll=function(){this.sliderY=Math.max(0,this.sliderY);this.sliderY=Math.min(this.maxSliderTop,this.sliderY);this.content.scrollTop(-1*((this.paneHeight-this.contentHeight+h)*this.sliderY/this.maxSliderTop));this.slider.css({top:this.sliderY});return this};b.prototype.scrollBottom= 658function(a){this.reset();this.content.scrollTop(this.contentHeight-this.content.height()-a).trigger("mousewheel");return this};b.prototype.scrollTop=function(a){this.reset();this.content.scrollTop(+a).trigger("mousewheel");return this};b.prototype.scrollTo=function(a){this.reset();a=c(a).offset().top;a>this.maxSliderTop&&(a/=this.contentHeight,this.sliderY=a*=this.maxSliderTop,this.scroll());return this};b.prototype.stop=function(){this.stopped=!0;this.removeEvents();this.pane.hide();return this}; 659b.prototype.flash=function(){var a=this;this.pane.addClass("flashed");setTimeout(function(){a.pane.removeClass("flashed")},this.options.flashDelay);return this};return b}();c.fn.nanoScroller=function(b){return this.each(function(){var a;if(!(a=this.nanoscroller))a=c.extend({},l),b&&"object"===typeof b&&(a=c.extend(a,b)),this.nanoscroller=a=new k(this,a);if(b&&"object"===typeof b){c.extend(a.options,b);if(b.scrollBottom)return a.scrollBottom(b.scrollBottom);if(b.scrollTop)return a.scrollTop(b.scrollTop); 660if(b.scrollTo)return a.scrollTo(b.scrollTo);if("bottom"===b.scroll)return a.scrollBottom(0);if("top"===b.scroll)return a.scrollTop(0);if(b.scroll&&b.scroll instanceof c)return a.scrollTo(b.scroll);if(b.stop)return a.stop();if(b.flash)return a.flash()}return a.reset()})}})(jQuery,window,document); 661 662/* --- FORM UI, VALIDATION AND SUBMISSION --- */ 663 664 665function clearProducts(radio){ 666 if(radio.attr('name') == "input_1"){ 667 $('input[name="input_11"]').prop('checked', false); 668 $('#Amount input').val(''); 669 } else if (radio.attr('name') == "input_11"){ 670 $('input[name="input_1"]').prop('checked', false); 671 }; 672}; 673 674function donType(option){ 675 donTypeOp = option.val(); 676 if(option.val() == "Public" || option.val() == "Tribute"){ 677 $('.hidden_field').slideDown('slow','easeOutBack'); 678 var a = $('.display_name').text(); 679 if (option.val() == "Tribute"){ 680 $('.display_name').text('Enter the name of the person or organization you would like to associate your contribution with .'); 681 } else { 682 $('.display_name').text(a); 683 }; 684 } else {
685 $('.hidden_field').slideUp('slow','easeOutBack'); 686 }; 687}; 688 689function cleanCC(){ 690 var userCC = $('#CC').val(); 691 var cleanCC = userCC.replace(/[^0-9]/g, ''); 692 $('input[name="input_7.1"]').val(cleanCC); 693}; 694 695function donateForm(){ 696 if ($('#Donate').length){ 697 698 //detect mobile or tablet 699 if(mobile == true || typeof isIE != 'undefined'){ 700 $('#Donate').addClass('mobile'); 701 } 702 703 if($('.confirmed').length){ 704 705 $('#ThankYou').fadeIn(); 706 707 } else { 708 709 //make sure only one type of donation can be submitted 710 $('#Amount input').focus(function(){ 711 $('#AmountSelect').click(); 712 }); 713 714 if(mobile != true){ 715 716 //create drop downs 717 $('.select_wrapper').each(function(){ 718 select = $(this); 719 select.find('option').each(function(){ 720 var label = $(this).html(); 721 var opIndex = $(this).index(); 722 if ($(this).val().length){ 723 select.find('ul').append('<li>'+label+'</li>'); 724 } else { 725 select.find('ul').append('<li style="display: none;">'+label+'</li>'); 726 }; 727 if (($(this).attr('selected') == 'selected') && (opIndex != 0)){ 728 select.find('.selected').addClass('in_use').html(label); 729 }; 730 }); 731 732 }); 733 734 //listen for toggle 735 $('.toggle_select').toggle(function(){ 736 $(this).closest('.select_wrapper').find('.tab_trap').focus(); 737 }, function(){ 738 $(this).closest('.select_wrapper').find('.tab_trap').blur(); 739 }); 740 741 742 743 //listen for select focus/blur and fade in drop downs 744 $('.select_wrapper').find('.tab_trap').focus(function(){ 745 $(this).closest('.select_wrapper').find('.nano').fadeIn('fast', function(){ 746 var notFF = (window.mozInnerScreenX == null); 747 if(notFF) { 748 $('.nano').nanoScroller(); 749 }; 750 }); 751 $(this).addClass('open'); 752 }); 753 754 $('.select_wrapper').find('.tab_trap').blur(function(){ 755 $(this).closest('.select_wrapper').find('.nano').fadeOut('fast'); 756 $(this).removeClass('open'); 757 }); 758 759 //listen for li clicks 760 $('.select_wrapper').find('li').click(function(){ 761 var parentWrapper = $(this).closest('.select_wrapper'); 762 var liIndex = $(this).index(); 763 var liText = $(this).text(); 764 parentWrapper.find('option').eq(liIndex).attr('selected','selected').change(); 765 parentWrapper.find('.selected').addClass('in_use').html(liText); 766 767 var nextFocus = parseInt(parentWrapper.find('.tab_trap').attr('tabindex')) + 1; 768 var skipFocus = nextFocus + 1; 769 if ($('[tabindex='+nextFocus+']').closest('.hidden_field').length && !$('[tabindex='+nextFocus+']').closest('.hidden_field').is(':visible')){ 770 $('[tabindex='+skipFocus+']').focus(); 771 } else { 772 $('[tabindex='+nextFocus+']').focus(); 773 }; 774 parentWrapper.find('select').valid(); 775 }); 776 }; 777 778 function hideLabel(a,b) { 779 $(a).siblings('label').css('color', b); 780 }; 781 782 //fade labels 783 $('input[type=text]').each(function(){ 784 if ($(this).val()){ 785 hideLabel(this, '#fff'); 786 }; 787 788 $(this).focus(function(){ 789 if (!$(this).val()){ 790 hideLabel(this, '#ccc'); 791 }; 792 }); 793 794 $(this).blur(function(){ 795 if(!$(this).val()){ 796 hideLabel(this, '#808080'); 797 }; 798 }); 799 800 $(this).keypress(function(){ 801 hideLabel(this, '#fff'); 802 }); 803 804 $(this).bind('paste', function(e){ 805 hideLabel(this, '#fff'); 806 }); 807 }); 808 809 810 //make clicking hella easier 811 $('.radio_wrapper').click(function(){ 812 $(this).find('input')[0].click(); 813 }); 814 $('.checkbox_wrapper.subscribe').click(function(){ 815 $(this).find('input')[0].click(); 816 }); 817 818 //auto populate billing 819 $('.checkbox_wrapper.billing').click(function(){ 820 $(this).find('input')[0].click(); 821 822 function copyData(origin) { 823 if ($(origin).val().length){ 824 var idLength = origin.length; 825 var input = origin.slice(8,idLength); 826 $('#Billing'+input).val($('#Address'+input).val()).focus().blur(); 827 hideLabel($('#Billing'+input),'#fff'); 828 $('#BillingZip').focus(); 829 }; 830 }; 831 832 $('#AddressCountry').find('option').each(function(){ 833 if ($(this).attr('selected') == 'selected'){ 834 var sel = $(this).index(); 835 var label = $(this).text(); 836 $('#BillingCountry').find('option').eq(sel).attr('selected','selected').change(); 837 $('#BillingCountry').siblings('.styled_select').find('.selected').addClass('in_use').html(label); 838 839 }; 840 }); 841 842 copyData('#AddressSt1'); 843 copyData('#AddressSt2'); 844 copyData('#AddressCity'); 845 copyData('#AddressState'); 846 copyData('#AddressZip'); 847 848 }); 849 850 851 852 853 //validation 854 /* $.getScript(templateDir+"/js/jquery.validate.min.js", function(data, textStatus, jqxhr) { */ 855 856 $('#Donate').fadeIn(); 857 mainHeight(); 858 859 860 $('#Donate').validate({ 861 groups: { 862 name: "input_3.3 input_3.6" 863 }, 864 rules: { 865 input_1: { 866 required: function(){ 867 return $('input[name="input_11"]').prop('checked') == false; 868 } 869 }, 870 input_2: { 871 required: function() { 872 return $('input[name="input_11"]').prop('checked') == true; 873 }, 874 number: true, 875 min: 1 876 }, 877 "input_7.2[]": { 878 required: true 879 }, 880 input_8: {required: true}, 881 "input_3.3": {required: true}, 882 "input_3.6": {required: true}, 883 "input_4.1": {required: true}, 884 "input_4.3": {required: true}, 885 "input_4.4": {required: true}, 886 "input_4.5": {required: true}, 887 "input_6": { 888 required: true, 889 email: true 890 }, 891 cc: { 892 required: true, 893 creditcard: true, 894 minlength: 12 895 }, 896 "input_7.3": { 897 required: true, 898 minlength: 3, 899 maxlength: 4, 900 digits: true 901 }, 902 "input_7.5": {required: true}, 903 "input_10.1": {required: true}, 904 "input_10.3": {required: true}, 905 "input_10.4": {required: true}, 906 "input_10.5": {required: true}, 907 input_12: { 908 required: { 909 depends: function(element){ 910 return donTypeOp == "Public" || "Tribute"; 911 } 912 } 913 } 914 }, 915 errorPlacement: function(error, element) { 916 var name = element.attr("name"); 917 if (name == "input_1") 918 error.insertAfter("#EndDonations"); 919 else if (name == "input_2") 920 error.insertAfter("#EndDonations"); 921 else if (name == "input_8" || name == "input_12") 922 error.insertAfter("#EndDonType"); 923 else if (name == "input_3.3" || name == "input_3.6") 924 error.insertAfter("#EndName"); 925 else if (name == "input_4.1" || name == "input_4.3" || name == "input_4.4" || name == "input_4.5") 926 error.insertAfter("#EndAddress"); 927 else if (name == "input_6") 928 error.insertAfter("#EndEmail"); 929 else if (name == "input_10.1" || name == "input_10.3" || name == "input_10.4" || name == "input_10.5") 930 error.insertAfter("#EndBilling"); 931 else if (name == "cc" || "input_7.2[]" || name == "input_7.3" || name == "input_7.5") 932 error.insertAfter("#EndPayment"); 933 }, 934 messages: { 935 input_1: {required: "Please select a donation amount."}, 936 input_2: { 937 required: "Please enter a donation amount.", 938 number: "Please enter only numbers." 939 }, 940 input_8: {required: "Please select a donation type."}, 941 "input_3.3": {required: "Please enter a name."}, 942 "input_3.6": {required: "Please enter a name."}, 943 "input_4.1": {required: "Please enter a street address."}, 944 "input_4.3": {required: "Please enter a city."}, 945 "input_4.4": {required: "Please enter a state or region."}, 946 "input_4.5": {required: "Please enter a postal or zip code."}, 947 "input_6": { 948 required: "Please enter an email address.", 949 email: "Please enter a valid email address." 950 }, 951 "input_10.1": {required: "Please enter a street address."}, 952 "input_10.3": {required: "Please enter a city."}, 953 "input_10.4": {required: "Please enter a state or region."}, 954 "input_10.5": {required: "Please enter a postal or zip code."}, 955 "input_7.5": {required: "Please enter the cardholder name."}, 956 cc: { 957 required: "Please enter a credit card number.", 958 creditcard: "Please enter a valid credit card number." 959 }, 960 "input_7.2[]": { 961 required: "Please select an expiration date.", 962 }, 963 "input_7.3": { 964 required: "Please enter a CVV number.", 965 minlength: "Please enter a valid CVV number.", 966 maxlength: "Please enter a valid CVV number.", 967 digits: "Please enter a valid CVV number." 968 }, 969 input_12: { 970 required: "Please enter a name." 971 } 972 }, 973 invalidHandler: function(form) { 974 checkHeight = setInterval(function() { 975 mainHeight(); 976 }, 3000); 977 }, 978 submitHandler: function(form){ 979 form.submit(); 980 return false;
981 } 982 }); 983 /* }); */ 984 985 }; 986 987 }; 988}; 989 990/* --- Counterstream Search Form --- */ 991function csSearchForm() { 992 if ($('form#gform_3').length) { 993 994 //detect mobile or tablet 995 if(mobile == true || typeof isIE != 'undefined'){ 996 $('#gform_3').addClass('mobile'); 997 } 998 999 if(mobile != true){ 1000 1001 //create drop downs 1002 $('.select_wrapper').each(function(){ 1003 select = $(this); 1004 select.find('option').each(function(){ 1005 var label = $(this).html(); 1006 var opIndex = $(this).index(); 1007 if ($(this).val().length){ 1008 select.find('ul').append('<li>'+label+'</li>'); 1009 } else { 1010 select.find('ul').append('<li style="display: none;">'+label+'</li>'); 1011 }; 1012 if (($(this).attr('selected') == 'selected') && (opIndex != 0)){ 1013 select.find('.selected').addClass('in_use').html(label); 1014 }; 1015 }); 1016 1017 }); 1018 1019 //listen for toggle 1020 $('.toggle_select').toggle(function(){ 1021 $(this).closest('.select_wrapper').find('.tab_trap').focus(); 1022 }, function(){ 1023 $(this).closest('.select_wrapper').find('.tab_trap').blur(); 1024 }); 1025 1026 1027 1028 //listen for select focus/blur and fade in drop downs 1029 $('.select_wrapper').find('.tab_trap').focus(function(){ 1030 $(this).closest('.select_wrapper').find('.nano').fadeIn('fast', function(){ 1031 var notFF = (window.mozInnerScreenX == null); 1032 if(notFF) { 1033 $('.nano').nanoScroller(); 1034 }; 1035 }); 1036 $(this).addClass('open'); 1037 }); 1038 1039 $('.select_wrapper').find('.tab_trap').blur(function(){ 1040 $(this).closest('.select_wrapper').find('.nano').fadeOut('fast'); 1041 $(this).removeClass('open'); 1042 }); 1043 1044 //listen for li clicks 1045 $('.select_wrapper').find('li').click(function(){ 1046 var parentWrapper = $(this).closest('.select_wrapper'); 1047 var liIndex = $(this).index(); 1048 var liText = $(this).text(); 1049 parentWrapper.find('option').eq(liIndex).attr('selected','selected').change(); 1050 parentWrapper.find('.selected').addClass('in_use').html(liText); 1051 1052 var nextFocus = parseInt(parentWrapper.find('.tab_trap').attr('tabindex')) + 1; 1053 var skipFocus = nextFocus + 1; 1054 if ($('[tabindex='+nextFocus+']').closest('.hidden_field').length && !$('[tabindex='+nextFocus+']').closest('.hidden_field').is(':visible')){ 1055 $('[tabindex='+skipFocus+']').focus(); 1056 } else { 1057 $('[tabindex='+nextFocus+']').focus(); 1058 }; 1059 parentWrapper.find('select').valid(); 1060 }); 1061 }; 1062 } 1063} 1064 1065/* --- PREPARE INLINE IMAGES --- */ 1066 1067function prepInlineImg(){ 1068 $('.wysiwyg').find('img').load(function(){ 1069 $(this).removeAttr('height').removeAttr('width'); 1070 $(this).closest('.wp-caption').removeAttr('style'); 1071 mainHeight(); // Fire again when inline (auto-height) images are loaded 1072 }); 1073} 1074 1075/* --- PARALLAX SCROLL BACKGROUND --- */ 1076 1077/* 1078$(window).scroll(function(){ 1079 var scrollPos = $(this).scrollTop(); 1080 var multiplier = -0.225; 1081 var offSet = scrollPos * multiplier; 1082 $('body').css('background-position', '0 '+offSet+'px'); 1083}) 1084*/ 1085 1086/* --- DJAX --- */ 1087 1088$.fn.djax = function (selector, exceptions) { 1089 1090 if (!history.pushState) { 1091 return $(this); 1092 }; 1093 1094 var self = this, 1095 blockSelector = selector, 1096 excludes = (exceptions && exceptions.length) ? exceptions : [], 1097 djaxing = false; 1098 1099 window.history.replaceState( 1100 { 1101 'url' : window.location.href, 1102 'title' : $('title').text() 1103 }, 1104 $('title').text(), 1105 window.location.href 1106 ); 1107 1108 self.clearDjaxing = function() { 1109 self.djaxing = false; 1110 }; 1111 1112 self.attachClick = function (element, event) { 1113 1114 var link = $(element), 1115 exception = false; 1116 1117 $.each(excludes, function (index, exclusion) { 1118 if (link.attr('href').indexOf(exclusion) !== -1) { 1119 exception = true; 1120 } 1121 if (window.location.href.indexOf(exclusion) !== -1) { 1122 exception = true; 1123 } 1124 }); 1125 1126 if (exception) { 1127 return $(element); 1128 }; 1129 1130 event.preventDefault(); 1131 1132 if (self.djaxing) { 1133 setTimeout(self.clearDjaxing, 1000); 1134 return $(element); 1135 }; 1136 1137 $(window).trigger('djaxClick'); 1138 self.reqUrl = link.attr('href'); 1139 self.triggered = false; 1140 self.navigate(link.attr('href'), true); 1141 }; 1142 1143 self.navigate = function (url, add) { 1144 1145 var blocks = $(blockSelector); 1146 1147 self.djaxing = true; 1148 1149 $.get(url, function (response) { 1150 if (url !== self.reqUrl) { 1151 self.navigate(self.reqUrl, false); 1152 return true; 1153 }; 1154 1155 var result = $('"' + response + '"'), 1156 newBlocks = $(result).find(blockSelector); 1157 1158 if (add) { 1159 window.history.pushState( 1160 { 1161 'url' : url, 1162 'title' : $(result).filter('title').text() 1163 }, 1164 $(result).filter('title').text(), 1165 url 1166 ); 1167 }; 1168 1169 $('title').text($(result).filter('title').text()); 1170 1171 blocks.each(function () { 1172 1173 var id = '"#' + $(this).attr('id') + '"', 1174 newBlock = newBlocks.filter(id), 1175 block = $(this); 1176 1177 if (newBlock.length) { 1178 if (block.html() !== newBlock.html()) { 1179 block.replaceWith(newBlock); 1180 }; 1181 } else { 1182 block.remove(); 1183 }; 1184 1185 }); 1186 1187 $.each(newBlocks, function () { 1188 1189 var newBlock = $(this), 1190 id = '#' + $(this).attr('id'), 1191 $previousSibling; 1192 1193 if (!$(id).length) { 1194 1195 $previousSibling = $(result).find(id).prev(); 1196 1197 if ($previousSibling.length) { 1198 newBlock.insertAfter('#' + $previousSibling.attr('id')); 1199 } else { 1200 newBlock.prependTo('#' + newBlock.parent().attr('id')); 1201 }; 1202 }; 1203 1204 }); 1205 1206 1207 1208 if (!self.triggered) { 1209 $(window).trigger( 1210 'djaxLoad', 1211 [{ 1212 'url' : url, 1213 'title' : $(result).filter('title').text(), 1214 'response' : response 1215 }] 1216 ); 1217 self.triggered = true; 1218 self.djaxing = false;
1219 }; 1220 }); 1221 }; 1222 1223 1224 $(window).bind('popstate', function (event) { 1225 self.triggered = false; 1226 if (event.originalEvent.state) { 1227 self.reqUrl = event.originalEvent.state.url; 1228 self.navigate(event.originalEvent.state.url, false); 1229 }; 1230 }); 1231 1232}; 1233/*end dajax*/ 1234 1235/* --- EASING --- */ 1236 1237 1238$.easing['jswing'] = $.easing['swing']; 1239 1240$.extend( $.easing, 1241{ 1242 def: 'easeOutQuad', 1243 swing: function (x, t, b, c, d) { 1244 //alert(jQuery.easing.default); 1245 return $.easing[$.easing.def](x, t, b, c, d); 1246 }, 1247 easeInQuad: function (x, t, b, c, d) { 1248 return c*(t/=d)*t + b; 1249 }, 1250 easeOutQuad: function (x, t, b, c, d) { 1251 return -c *(t/=d)*(t-2) + b; 1252 }, 1253 easeOutBack: function (x, t, b, c, d, s) { 1254 if (s == undefined) s = 1.70158; 1255 return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b; 1256 } 1257}); 1258 1259/* --- FAQ TABLE --- */ 1260 1261function faqTable(){ 1262 if($('.empty').length){ 1263 var table = $('.chart'); 1264 $('.empty').replaceWith(table); 1265 mainHeight(); 1266 }; 1267}; 1268 1269/* ================ DOCUMENT READY BEGIN ================ */ 1270 1271$(function(){ 1272 1273/* --- SET VARS -- */ 1274 1275ww = $(window).width(); 1276 1277/* --- INSTANTIATE DJAX --- */ 1278 1279$('body').djax('.ajax', ['pdf','doc','admin', 'logo', 'pls', 'wpl', 'cs_popup']); 1280 1281/* --- TEST FOR MOBILE/TABLET --- */ 1282 1283mobileTest(); 1284 1285/* --- DETECT SVG SUPPORT --- */ 1286 1287var svgSupport = (window.SVGAngle) ? true : false; 1288 1289var svgSupportAlt = (document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1")) ? true : false; 1290 1291var ff3x = (/Gecko/i.test(navigator.userAgent) && /rv:1.9/i.test(navigator.userAgent)) ? true : false; 1292 1293var isltIE8 = ($.support.leadingWhitespace) ? true : false; 1294 1295if (svgSupport == false || svgSupportAlt == false || isltIE8 == false || ff3x == true) { 1296 1297 $('.wysiwyg').find('blockquote').each(function(){ 1298 $(this).addClass('svg'); 1299 }); 1300 1301 $('.svg').each(function(){ 1302 var svgBI = $(this).css('background-image'); 1303 if (svgBI.indexOf("svg") > -1){ 1304 if (isltIE8 == false) { 1305 pngBI = svgBI.replace(/.svg/g, '.1x.png'); // serve non-scaling png assets to IE8 1306 } else { 1307 pngBI = svgBI.replace(/.svg/g, '.2x.png'); // serve high-ppi png assets to IE9, Android 2.x, Firefox 3.x etc 1308 }; 1309 $(this).css('background-image',pngBI); 1310 }; 1311 }); 1312 1313 logoLoaded(); 1314}; 1315 1316/* --- INSTATIATE BG SLIDESHOW --- */ 1317 1318runBGSlide(); 1319 1320/* --- VERICAL CENTER SLIDESHOW ELEMENTS --- */ 1321 1322vCenter(); 1323 1324/* --- FAQ TABLE ---*/ 1325 1326faqTable(); 1327 1328/* --- GIVE MAIN HEIGHT --- */ 1329 1330mainHeight(); 1331 1332/* --- PREPARE INLINE IMAGES --- */ 1333 1334prepInlineImg(); 1335 1336/* --- FEAT BOX TEXT SIZE --- */ 1337 1338featTextSize(); 1339 1340/* --- EQUAL BOX HEIGHTS --- */ 1341 1342eqlBox($('.grid_box')); 1343eqlBox($('.feat_box_alt .lower')); 1344 1345/* --- RESPONSIVE IFRAMES --- */ 1346 1347wrapIframes(); 1348 1349/* --- AUTO UPDATE MAIN HEIGHT IF DISQUS --- */ 1350 1351disqusHeight(); 1352 1353/* --- AJAX POSTS LOAD ---*/ 1354 1355ajaxPosts(); 1356 1357/* --- CLICK LISTENERS --- */ 1358 1359$('#BackToTop').click(function(){ // does not work in seperate function as instantiates multiple times 1360 $('#NavToggle').click(); 1361 $('html,body').animate({scrollTop: 0},'fast'); 1362}); 1363 1364clickListen(); 1365 1366/* --- DONATE FORM UI, VALIDATION AND SUBMISSION --- */ 1367 1368donateForm(); 1369 1370/* --- COUNTERSTREAM SEARCH FORM --- */ 1371 1372csSearchForm(); 1373 1374/* --- FUNCTIONS TO RUN ON DJAX OR RESIZE--- */ 1375 1376function run() { 1377 ww = $(window).width(); 1378 vCenter(); 1379 mainHeight(); 1380 featTextSize(); 1381 eqlBox($('.grid_box')); 1382 eqlBox($('.feat_box_alt .lower')); 1383}; 1384 1385/* --- FIRE ON DJAX CLICK --- */ 1386 1387$(window).bind('djaxClick', function(e, data) { 1388 if($('#FeatImg.home').length){ 1389 $('#MovingParts').cycle('stop'); 1390 }; 1391 if($('#HeroCycle').length){ 1392 $('#HeroMovingParts').cycle('stop'); 1393 }; 1394 $('#PageLoader').fadeIn(); 1395}); 1396 1397/* --- FIRE ON DJAX LOAD --- 1398 1399$(window).bind('djaxLoad', function(e, data) { 1400 //console.log('DJAX LOAD'); 1401 _gaq.push(['_trackPageview']); 1402 mobileTest(); 1403 runBGSlide(); 1404 clickListen(); 1405 prepInlineImg(); 1406 faqTable(); 1407 wrapIframes(); 1408 run(); 1409 $('html,body').animate({scrollTop: 0},'fast'); 1410}); 1411*/ 1412 1413/* --- FIRE ON RESIZE --- */ 1414 1415$(window).resize(function(){ 1416 forceNav(); 1417 run(); 1418}); 1419 1420/* === DOCUMENT READY END === */ 1421 1422});
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.