1 2if (getQueryVariable('allow-secure') !== "") { 3 var dtExpiresYear = new Date(); dtExpiresYear.setFullYear(dtExpiresYear.getFullYear() + 1); 4 CookieSet('Forums-Allow-Secure', "true", dtExpiresYear); 5} 6 7if (window.location.href.indexOf('http://www.keithandthegirl.com/forums/f24/') === 0) { 8 //KATGuh redirect 9 window.location.href = "http://www.keithandthegirl.com/katguh"; 10} else if ( 11 window.location.href.indexOf('https://www.keithandthegirl.com/forums/') === 0 && 12 document.URL.indexOf('keithandthegirl.com/forums/login.php') === -1 && 13 (CookieGet('Forums-Allow-Secure') === null || CookieGet('Forums-Allow-Secure') === "") 14 ) { 15 //Non-secure redirect. Forums aren't setup to handle secure browsing. Images don't load correctly. 16 //Michael Khalili 2023-10-23 commented out the redirect to non-secure below because chrome was forcing a redirect to secure, causing a redirect loop. 17 //window.location.href = window.location.href.replace("https://", "http://"); 18} 19 20 21 22jQuery(document).ready(function () { 23 /* extend the sidepanel down to the bottom so the background extends */ 24 sidepanelSizing(); 25 26 jQuery(window).resize(function () { 27 sidepanelSizing(); 28 }); 29 30 vipInit(); 31 32 /* placed on ready to keep the page from jumping after the page has loaded */ 33 forumsVipBadgeShow(); 34 35 toggleSet(); 36 37 onairDisplay(); 38 39 votingFuckery(); 40}); 41 42jQuery(window).load(function () { 43 headerLatestEpisodeDisplay(); 44 sidepanelFacebookLikebox(); 45 sidepanelTwitterButtons(); 46 forumsYouTubePlayListPreviewEmbed(); 47 forumsStyle(); 48 49 alertCounterUpdate(); 50 //alertMonthly(); 51 52 jQuery('.SelectAll').focus(function () { 53 this.select(); 54 }); 55 jQuery('.SelectAll').click(function () { 56 this.select(); 57 }); 58 59 forumsNewThreadPopulateJson(); 60}); 61 62function sidepanelSizing() { 63 /* wait a second until the page rerenders 64 Only force a min if the two objects are side by size (have the same top value) 65 */ 66 if (jQuery('.fw-sidepanel').length > '0') { 67 if (jQuery('.fw-sidepanel').offset().top == jQuery('.fw-body-content').offset().top) { 68 setTimeout("jQuery('.fw-sidepanel').css('min-height', jQuery('.fw-body-content').height() + 80);", 2000); 69 } else { 70 setTimeout("jQuery('.fw-sidepanel').css('min-height', '0px');", 2000); 71 } 72 } 73} 74 75//Toggle display of elements 76function toggleSet() { 77 jQuery('.toggle-action').click(function () { 78 jQuery(this).closest('.toggle-parent').children('.toggle-element').slideToggle(); 79 return false; 80 }); 81} 82 83//display the onair inpage alert if we're broadcasting 84var onairShotCurrent = 2; 85var onairShot = new Array(); 86function onairDisplay() { 87 if (jQuery('.fw-onair').length > '0') { 88 var cacheBust = new Date().getTime(); 89 jQuery.get('/Api/On-Air/default.ashx?time=' + cacheBust, 90 function (data) { 91 if (jQuery(data).find('OnAir').text() == 1) { 92 //if this is the homepage, swap out the video with the ustream live feed. 93 if (jQuery('.fw-page-home').length) { 94 //jQuery('.hero.video.youtube').css('display', 'none'); 95 //jQuery('.hero.video.ustream').css('display', 'block'); 96 } 97 //if this is the marathon page, swap out the pending content with the real info. 98 if (jQuery('.fw-page-howtolisten.marathon').length) { 99 jQuery('.fw-page-howtolisten.marathon .not-started').css('display', 'none'); 100 jQuery('.fw-page-howtolisten.marathon .started').css('display', 'block'); 101 } 102 //add the inpage html 103 jQuery('.fw-body-wrapper').prepend(jQuery(data).find('OnairInpageAlert').text()); 104 105 jQuery('.onairInpage .collapse-bar, .onairInpage .joinus').click(function () { 106 onairInpageAlertToggle(); 107 }); 108 109 //set the initial state to hide if the reader has requested it before OR if the onair querystring is set to off 110 if (CookieGet('OnairInpageAlert-State') == 'hide' || getQueryVariable('onair') == 'off') { 111 onairInpageAlertSwitch('hide'); 112 } 113 114 //hard code the rotating pictures 115 onairShot[0] = "/images/on-air/video-still-chemda.jpg"; 116 onairShot[1] = "/images/on-air/video-still-keith.jpg"; 117 onairShot[2] = "/images/on-air/video-still-room.jpg"; 118 119 //set the rotation script. 120 setInterval(function () { 121 onairShotCurrent++; 122 if (onairShotCurrent > onairShot.length - 1) { 123 onairShotCurrent = 0; 124 } 125 jQuery('.onairInpage .shot').attr('src', onairShot[onairShotCurrent]); 126 }, 3000); 127 128 129 //add the onair tag to the header and make it clickable 130 //jQuery('.fw-header-photo-tagline, .fw-header-title').addClass('onair');
131 //jQuery('.fw.header-photo-tagline.onair').click(function () { window.location = '/live/how-to-listen.aspx' }); 132 //jQuery('.fw-header-title.onair').attr('href', '/live/how-to-listen.aspx'); 133 134 135 //jQuery('.fw-header-photo-tagline').css('display', 'none'); 136 //jQuery('.fw-onair').removeClass('fw-onair-hidden'); /* don't make it visible, just remove the hidden tag */ 137 //onairThrob(); 138 } 139 }); 140 } 141} 142 143function onairInpageAlertToggle() { 144 if (jQuery('.onairInpage .details-opened').css('display') == 'block') { 145 onairInpageAlertSwitch('hide'); 146 } else { 147 onairInpageAlertSwitch('show'); 148 } 149} 150function onairInpageAlertSwitch(state) { 151 var dtExpiresYear = new Date(); dtExpiresYear.setFullYear(dtExpiresYear.getFullYear() + 1); 152 CookieSet('OnairInpageAlert-State', state, dtExpiresYear); 153 if (state == 'hide') { 154 jQuery('.onairInpage .details-opened').css('display', 'none'); 155 jQuery('.onairInpage .details-closed').css('display', 'block'); 156 jQuery('.onairInpage .collapse-bar').addClass('closed'); 157 } else { 158 jQuery('.onairInpage .details-opened').css('display', 'block'); 159 jQuery('.onairInpage .details-closed').css('display', 'none'); 160 jQuery('.onairInpage .collapse-bar').removeClass('closed'); 161 } 162} 163 164 165 166function delayedActionClick(objLink) { 167 setTimeout('window.location = "' + jQuery(objLink).attr('href') + '"', 1000); 168 return false; 169} 170 171 172//fade the onair in and out. use settimeout outside the fade to avoid recursion 173function onairThrob(actionFadeIn) { 174 if (actionFadeIn) { 175 setTimeout("onairThrob(false)", 1200); 176 jQuery('.fw-header-onair-button-glow, .fw-sidepanel-onair-glow').fadeIn(1000); 177 } else { 178 setTimeout("onairThrob(true)", 1200); 179 jQuery('.fw-header-onair-button-glow, .fw-sidepanel-onair-glow').fadeOut(1000); 180 } 181} 182 183function sidepanelFacebookLikebox() { 184 jQuery('.fw-sidepanel-follow-facebook-likebox-inner').html('<iframe src="//www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Fkeithandthegirl&width=250&height=290&show_faces=true&colorscheme=light&stream=false&border_color=%23ffffff&header=true&appId=252063208174336" scrolling="no" frameborder="0" style="border: none; overflow: hidden; width: 250px; height: 290px;" allowtransparency="true"></iframe>'); 185} 186 187function sidepanelTwitterButtons() { 188 jQuery('.fw-sidepanel-follow-twitter').html('<a href="https://twitter.com/KeithandTheGirl" class="twitter-follow-button" data-show-count="false" data-size="large">Follow @KeithandTheGirl</a>' 189 + '<a href="https://twitter.com/KeithMalley" class="twitter-follow-button" data-show-count="false" data-size="large">Follow @KeithMalley</a>' 190 + '<a href="https://twitter.com/Chemda" class="twitter-follow-button" data-show-count="false" data-size="large">Follow @Chemda</a>' 191 + '<script>!function (d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (!d.getElementById(id)) { js = d.createElement(s); js.id = id; js.src = "//platform.twitter.com/widgets.js"; fjs.parentNode.insertBefore(js, fjs); } }(document, "script", "twitter-wjs");</script>'); 192} 193 194function headerLatestEpisodeDisplay() { 195 jQuery.get('/api/show/latest-episode.ashx', function (data) { 196 jQuery('.fw-header-super-episode-title').text(jQuery(data).find('Number').text() + ': ' + jQuery(data).find('Title').text()); 197 jQuery('.fw-header-super-episode-title').attr("href", "http://www.keithandthegirl.com" + (jQuery(data).find('ShowUrl').text())); 198 }); 199} 200 201function webplayerStandalonePlayEpisode(showNumber) { 202 if (showNumber != '') { 203 window.open('/webplayer-recent-episodes.aspx?play=' + showNumber, 'katg_webplayer', 'height=540, width=320, scrollbars=no, status=0'); 204 } else { 205 window.open('/webplayer-recent-episodes.aspx?play=auto', 'katg_webplayer', 'height=540, width=320, scrollbars=no, status=0'); 206 } 207 208} 209function getQueryVariable(variable) { 210 var query = window.location.search.substring(1); 211 var vars = query.split('&'); 212 for (var i = 0; i < vars.length; i++) { 213 var pair = vars[i].split('='); 214 if (decodeURIComponent(pair[0]) == variable) { 215 return decodeURIComponent(pair[1]); 216 } 217 }
218 console.log('Query variable %s not found', variable); 219 return ''; 220} 221 222/* media element init */ 223function initMediaElement() { 224 jQuery('.lazymediaelement .loading').css('display', 'block'); 225 jQuery('.lazymediaelement').waypoint(function (direction) { 226 jQuery(this).children('video, audio').mediaelementplayer({ 227 plugins: ['flash', 'silverlight'], 228 success: function (media) { 229 //Only execute the play code once. 230 media.katgPlayedOnce = false; 231 232 media.addEventListener('canplay', function () { 233 this.katgPlayedOnce = true; 234 jQuery('.masterloading').css('display', 'none'); 235 }, false); 236 237 media.addEventListener('play', function () { 238 if (this.katgPlayedOnce == false) { 239 jQuery('.masterloading').css('display', 'block'); 240 eval(jQuery(this).data('gaplay')); 241 console.log(jQuery(this).data('gaplay')); 242 } 243 }, false); 244 } 245 }); 246 jQuery(this).children('.loading').css('display', 'none'); 247 }, { 248 triggerOnce: true, 249 offset: '200%' 250 }); 251 jQuery('.wp-audio-shortcode').mediaelementplayer({ 252 plugins: ['flash', 'silverlight'], 253 success: function (media) { 254 //Only execute the play code once. 255 media.katgPlayedOnce = false; 256 257 media.addEventListener('canplay', function () { 258 this.katgPlayedOnce = true; 259 jQuery('.masterloading').css('display', 'none'); 260 }, false); 261 262 media.addEventListener('play', function () { 263 if (this.katgPlayedOnce == false) { 264 jQuery('.masterloading').css('display', 'block'); 265 eval(jQuery(this).data('gaplay')); 266 console.log(jQuery(this).data('gaplay')); 267 } 268 }, false); 269 } 270 }); 271} 272 273/* alert */ 274function alertCounterUpdate() { 275 var intCountMonth = CookieGet('KatgAlertCounter-Month'); 276 var intCountAllTime = CookieGet('KatgAlertCounter-AllTime'); 277 278 if (intCountMonth == null) { intCountMonth = 0; } 279 if (intCountAllTime == null) { intCountAllTime = 0; } 280 intCountMonth++; intCountAllTime++; 281 var dtExpiresMonth = new Date((new Date()).getFullYear(), (new Date()).getMonth() + 1, 1); 282 var dtExpiresYear = new Date(); dtExpiresYear.setFullYear(dtExpiresYear.getFullYear() + 1); 283 CookieSet('KatgAlertCounter-Month', intCountMonth, dtExpiresMonth); 284 CookieSet('KatgAlertCounter-AllTime', intCountAllTime, dtExpiresYear); 285} 286 287function alertMonthly() { 288 if (CookieGet('KatgAlertCounter-Month') >= 4 289 && CookieGet('KatgAlertMonthly-Delayed') == null 290 && CookieGet('KatgAlertVipMember') == null 291 && CookieGet('KatgPopupVipMember') == null) { 292 293 if (document.location.pathname.toLowerCase().indexOf('/vip') == -1 294 && document.location.pathname.toLowerCase().indexOf('/store') == -1) { 295 296 jQuery(document).ready(function () { 297 jQuery.getScript('/App_Web/jQuery/plugins/jQuery.fancybox/source/jquery.fancybox.pack.js', function () { 298 jQuery('head').append('<link rel="stylesheet" href="/App_Web/jQuery/plugins/jQuery.fancybox/source/jquery.fancybox.css" type="text/css" />'); 299 300 jQuery.fancybox.open([ 301 { 302 href: 'https://www.keithandthegirl.com/vip/alerts/youtube-previews.php' 303 } 304 ], { 305 maxWidth: "500px", 306 maxHeight: "450px", 307 autoResize: true, 308 autoCenter: true, 309 type: "iframe" 310 }); 311 312 }); 313 CookieSet('KatgAlertMonthly-Delayed', "true", new Date((new Date()).getFullYear(), (new Date()).getMonth() + 1, 1)); 314 }); 315 } 316 } 317} 318 319/*Cookie functions from Tabber control 320http://www.barelyfitz.com/projects/tabber/example-cookies.html 321*/ 322function CookieSet(name, value, expires, path, domain, secure) { 323 document.cookie = name + "=" + escape(value) + 324 ((expires) ? "; expires=" + expires.toUTCString() : "") + 325 ((path) ? "; path=" + path : "; path=/") + 326 ((domain) ? "; domain=" + domain : "") + 327 ((secure) ? "; secure" : ""); 328} 329 330function CookieGet(name) { 331 var dc = document.cookie;
332 var prefix = name + "="; 333 var begin = dc.indexOf("; " + prefix); 334 if (begin == -1) { 335 begin = dc.indexOf(prefix); 336 if (begin != 0) return null; 337 } else { 338 begin += 2; 339 } 340 var end = document.cookie.indexOf(";", begin); 341 if (end == -1) { 342 end = dc.length; 343 } 344 return unescape(dc.substring(begin + prefix.length, end)); 345} 346function CookieDelete(name, path, domain) { 347 if (getCookie(name)) { 348 document.cookie = name + "=" + 349 ((path) ? "; path=" + path : "") + 350 ((domain) ? "; domain=" + domain : "") + 351 "; expires=Thu, 01-Jan-70 00:00:01 GMT"; 352 } 353} 354 355 356/* forums */ 357//put the videos into the forums 358function forumsYouTubePlayListPreviewEmbed() { 359 //do the objects exist that need to be populated? 360 361 if (jQuery('.fw-pages-forums .youtube-playlist-preview').length > 0) { 362 //grab the data 363 jQuery.ajax({ 364 dataType: "json", 365 url: "https://www.keithandthegirl.com/Api/v2/youtube/embed/", 366 success: function (data) { 367 jQuery('.fw-pages-forums .youtube-playlist-preview .video').each(function (index) { 368 jQuery(this).html('<iframe width="400" height="225" frameborder="0" src="' + data[index].YouTubeEmbedUrl + '" allowfullscreen></iframe>'); 369 }); 370 //the addition of these videos causes the page to jump position 371 //scroll to the hash in case the hash scroll has already happened 372 scrollToHash(); 373 } 374 }); 375 } 376 377} 378 379 380 381 382 383 384/* VIP functions */ 385function vipInit() { 386 // 387 //generic form 388 // 389 //reset any alerted field when it has focus 390 jQuery('.field-error').focus(function () { 391 jQuery(this).removeClass('field-error'); 392 }); 393 394 // 395 //FAQ Frequently Asked Questions 396 // 397 //Hide all answers after page loads 398 jQuery(".answer").slideUp(200); 399 400 jQuery(".question a").click(function () { 401 jQuery(this).parent().next(".answer").slideToggle(500); 402 return false; 403 }); 404 //collapse all messages 405 jQuery(".collapse-all").click(function () { 406 jQuery(".answer").slideUp(600); 407 return false; 408 }); 409 //expand all messages 410 jQuery(".expand-all").click(function () { 411 jQuery(".answer").slideDown(500); 412 return false; 413 }); 414 415 //Setup page 416 if (jQuery('.fw-vip-signup-checkout').length) { 417 setInterval('vipCheckoutShowTotal();', 1000); 418 } 419 420 // 421 //billing upgrade 422 // 423 jQuery(".fw-pages-vip-account-billing-subscription .subscription-plan-wrapper .button.upgrade").click(function () { 424 jQuery(".fw-pages-vip-account-billing-subscription .plan-change-modal #input-upgrade").val(jQuery(this).data('plancode')); 425 jQuery(".fw-pages-vip-account-billing-subscription .plan-change-modal .plan-name").text(jQuery(this).data('planname')); 426 jQuery('#modalPlanChange').modal('show'); 427 return false; 428 }); 429 430 //video purchase 431 jQuery(".vip-video-purchase-select").click(function () { 432 //what is being purchased? 433 jQuery(".vip-video-purchase-confirm #input-purchase").val(jQuery(this).data('purchase')); 434 435 //set the showid and title. If there is no data-showid or data-showtitle, it'll just be blank 436 jQuery(".vip-video-purchase-confirm #input-showid").val(jQuery(this).data('showid')); 437 jQuery(".vip-video-purchase-confirm .show-title").text(jQuery(this).data('showtitle')); 438 439 //set the package name. 440 jQuery(".vip-video-purchase-confirm .package-name").text(jQuery(this).data('package')); 441 442 //Display the cost. This is only cosmetic. For security, true price will be calculated on the server side. 443 //However, pass the cost to the server so it could make sure the correct cost was displayed to the customer. 444 jQuery(".vip-video-purchase-confirm .cost").text('$' + jQuery(this).data('cost')); 445 jQuery(".vip-video-purchase-confirm #input-cost").val('$' + jQuery(this).data('cost'));
446 447 //Make the correct messages appear for the type of purchase 448 jQuery(".vip-video-purchase-confirm .msg").css('display', 'none'); 449 jQuery(".vip-video-purchase-confirm .msg." + jQuery(this).data('class')).css('display', 'list-item'); 450 451 //reset then hide the billing button/info if the cost is 0. 452 jQuery(".vip-video-purchase-confirm li.billing").css('display', 'list-item'); 453 jQuery(".vip-video-purchase-confirm .button-billing").css('display', 'block'); 454 jQuery(".vip-video-purchase-confirm .msg.free").css('display', 'none'); 455 456 //hide the billing info if the item costs $0. set this last so the .msg.free will have the correct visibility. 457 if (jQuery(this).data('cost') == 0) { 458 jQuery(".vip-video-purchase-confirm li.billing").css('display', 'none'); 459 jQuery(".vip-video-purchase-confirm .button-billing").css('display', 'none'); 460 jQuery(".vip-video-purchase-confirm .msg.free").css('display', 'list-item'); 461 } 462 463 464 jQuery('#modalVipVideoPurchaseConfirm').modal('show'); 465 return false; 466 }); 467 468 469 //series page. show preivew or full episode from thumbnails 470 jQuery('.show .video .images .playoverlay.play').click(function () { 471 var showId = jQuery(this).closest('.video').data('showid'); 472 var number = jQuery(this).closest('.video').data('number'); 473 474 if (jQuery(this).data("action") == 'youtube') { 475 var code = jQuery(this).data('code'); 476 477 //clear out any other player and rename the div in case jwplayer previously added _wrapper 478 jQuery("#display-" + showId + "_wrapper").attr("id", "display-" + showId); 479 jQuery("#display-" + showId).html(""); 480 jQuery("#display-" + showId).attr("style", "") 481 jQuery("#video-high-quality-message-" + showId).css("display", "none"); 482 483 jQuery("#display-" + showId).html('<div class="video-container"><iframe width="560" height="315" src="https://www.youtube.com/embed/' + code + '?rel=0&autoplay=1" frameborder="0" allowfullscreen></iframe></div>'); 484 485 } else if (jQuery(this).data("action") == 'jwplayer') { 486 var amazon = jQuery(this).data('amazon'); 487 var template = jQuery(this).data('template'); 488 489 //clear out any other player. 490 jQuery("#display-" + showId + "_wrapper").attr("id", "display-" + showId); 491 jQuery("#display-" + showId).html(""); 492 jQuery("#display-" + showId).attr("style", "") 493 jQuery("#video-high-quality-message-" + showId).css("display", "block"); 494 495 jwplayer("display-" + showId).setup({ 496 playlist: [{ 497 image: "https://www.keithandthegirl.com/vip/download/" + amazon + "video/" + number + "/" + template + "-video.jpg", 498 sources: [{ 499 file: "https://www.keithandthegirl.com/vip/download/" + amazon + "video/" + number + "/" + template + ".m3u8" 500 }], 501 primary: "flash" 502 }], 503 width: "100%", 504 autostart: true, 505 aspectratio: "9:5", 506 ga: { 507 idstring: template 508 }, 509 abouttext: "Keith and The Girl", 510 aboutlink: "http://www.keithandthegirl.com" 511 }).onSetupError(function (event) { }); 512 } 513 514 }); 515 516 517 //show a password when the checkbox is selected. 518 jQuery('.password-show').change(function () { 519 var pswd = jQuery('#account_password').val(); 520 521 if (this.checked) { 522 if (jQuery('#account_password').attr('type') == 'text') { 523 return; 524 } 525 } else { 526 if (jQuery('#account_password').attr('type') == 'password') { 527 return; 528 } 529 } 530 //switch 531 jQuery('#account_password').attr('id', 'account_password_tmp'); 532 jQuery('#account_password_hidden').attr('id', 'account_password'); 533 jQuery('#account_password_tmp').attr('id', 'account_password_hidden'); 534 535 jQuery('#account_password').attr('name', jQuery('#account_password_hidden').attr('name')); 536 jQuery('#account_password_hidden').attr('name', 'hidden'); 537 538 jQuery('#account_password_hidden').css('display', 'none'); 539 jQuery('#account_password').css('display', 'block'); 540 541 //set the values 542 jQuery('#account_password_hidden').val(''); 543 jQuery('#account_password').val(pswd); 544 545 //reactivate the password meter 546 if (jQuery('#account_password').length) { 547 jQuery('#account_password').pwstrength({ 548 label: '.pwstrength-message', 549 classes: ['pw-very-weak', 'pw-weak', 'pw-mediocre', 'pw-strong', 'pw-very-strong'], 550 texts: ['At least 8 charactors', 'Weak', 'Moderate', 'Good', 'Good'] 551 }); 552 } 553 554 });
555} 556 557 558 559function vipRecurlyDomBefore(form) { 560 //Change the "coupon code" language 561 jQuery(form).find('.subscription .coupon .coupon_code div.placeholder').html('Gift code'); 562 jQuery(form).find('.contact_info .full_name').insertAfter(jQuery(form).find('.billing_info .payment_method')); 563 564 //Use different content for the package info when it's the trial 565 if (jQuery(form).find('.with_trial').html() !== '') { 566 jQuery(form).find('.with_trial .plan').html(jQuery('.trial-cost').html()); 567 } 568 569} 570 571function vipCheckoutShowTotal() { 572 if (jQuery('.recurly.subscribe .coupon .discount').text() == '') { 573 jQuery('.recurly.subscribe .due_now').css('display', 'none'); 574 } else { 575 jQuery('.recurly.subscribe .due_now').css('display', 'block'); 576 } 577 578} 579 580function forumsVipBadgeShow() { 581 if (jQuery('.fw-pages-forums-badge-vip').length > 0) { 582 //collect all the usernames form this page. 583 var $usernames = new Array(); 584 jQuery('.fw-pages-forums-badge-vip').each(function () { 585 if (jQuery(this).parent().parent().find('.bigusername').text() != '') { 586 $usernames.push(jQuery(this).parent().parent().find('.bigusername').text()); 587 } 588 }); 589 590 //profile page badge 591 var profileUserName; 592 profileUserName = jQuery('.fw-pages-forums-badge-vip').parents().find('#username_box h1').text().replace("(Offline)", "").replace("(Online)", ""); 593 profileUserName = jQuery.trim(profileUserName); 594 595 if (profileUserName != '') { 596 $usernames.push(profileUserName); 597 } 598 599 //main /forums page greeting the user 600 var greetingModule = jQuery('#collapseobj_module_9').html(); 601 602 if (greetingModule !== undefined) { 603 var greetingPhrase = greetingModule.match(/Welcome back <strong>([^\<]*)/gi); 604 var username = greetingPhrase[0].replace("Welcome back <strong>", ""); 605 $usernames.push(username); 606 } 607 608 //grab the data 609 jQuery.ajax({ 610 dataType: "json", 611 type: "POST", 612 data: { usernames: $usernames.join() }, 613 url: "https://www.keithandthegirl.com/Api/v2/Vip/Badge/", 614 success: function (data) { 615 if (data.success) { 616 //Loop through each of the returned details and set the class to display the badges 617 for (var i = 0; i < data.details.length; i++) { 618 if (data.details[i].plancode !== '') { 619 //go through all the usernames and turn on the badge for those that match. 620 jQuery('.fw-pages-forums-badge-vip').each(function() { 621 if (jQuery(this).parent().parent().find('.bigusername').text().toLocaleLowerCase() === data.details[i].username.toLocaleLowerCase()) { 622 jQuery(this).addClass('on'); 623 jQuery(this).addClass(data.details[i].plancode); 624 } 625 }); 626 //profile or main greeting page badge 627 if (jQuery('#collapseobj_module_9 .fw-pages-forums-badge-vip').length || profileUserName.toLocaleLowerCase() === data.details[i].username.toLocaleLowerCase()) { 628 jQuery('.fw-pages-forums-badge-vip').addClass('on'); 629 jQuery('.fw-pages-forums-badge-vip').addClass(data.details[i].plancode); 630 } 631 632 } 633 } 634 //the addition of these pictures causes the page to jump position 635 //scroll to the hash in case the hash scroll has already happened 636 scrollToHash(); 637 } 638 } 639 }); 640 } 641} 642 643function forumsStyle() { 644 //fix the VBSEO from overlapping on firefox and conflicting styles on chrome. 645 jQuery('#vbseo-likes').parent().children('table').first().width('775px'); 646} 647 648function forumsNewThreadPopulate() { 649 if (getQueryVariable('do') == 'newthread') { 650 if (getQueryVariable('title') != '') { 651 jQuery('input[name="subject"]').val(getQueryVariable('title')); 652 } 653 if (getQueryVariable('message') != '') { 654 655 if (vB_Editor['vB_Editor_001'].wysiwyg_mode == 1) { 656 jQuery('#vB_Editor_001_cmd_switchmode').click(); 657 setTimeout("vB_Editor['vB_Editor_001'].insert_text(getQueryVariable('message'));", 2000); 658 setTimeout("jQuery('#vB_Editor_001_cmd_switchmode').click();", 2000); 659 } else { 660 vB_Editor['vB_Editor_001'].insert_text(getQueryVariable('message')); 661 } 662 663 if (getQueryVariable('auto') == 'submit') { 664 setTimeout(function () { 665 jQuery.ajax({ 666 dataType: "json", 667 url: "/Api/v2/tools/remoteip/", 668 success: function (data) { 669 if (data.remoteip == '199.193.118.203') {
670 jQuery('#vB_Editor_001_save').click(); 671 } 672 } 673 }); 674 }, 8000); 675 } 676 } 677 } 678} 679 680function forumsNewThreadPopulateJson() { 681 if (getQueryVariable('do') == 'newthread') { 682 //The url can't handle the long query string information. 683 //The show details for a new thread needs to be requested via 684 //secondary call with JSON formatted info. That'll give us unlimited 685 //length of show description and guest info. 686 687 if (getQueryVariable('showid') != '') { 688 689 jQuery.ajax({ 690 dataType: "json", 691 url: "/Api/forums/show-details/?showid=" + getQueryVariable('showid'), 692 success: function (data) { 693 console.log(data); 694 695 if (data.error) { 696 // 697 }else{ 698 //set the title 699 jQuery('input[name="subject"]').val(data.forumTitle); 700 701 //set the message body. 702 703 //since this is done with a timeout, put the var into a global. 704 window.autoForumPostMessage = data.forumMessage; 705 706 //This process forces the textbox to be in text mode (not wysiwyg). 707 if (vB_Editor['vB_Editor_001'].wysiwyg_mode == 1) { 708 jQuery('#vB_Editor_001_cmd_switchmode').click(); 709 setTimeout("vB_Editor['vB_Editor_001'].insert_text(window.autoForumPostMessage);", 2000); 710 setTimeout("jQuery('#vB_Editor_001_cmd_switchmode').click();", 2000); 711 } else { 712 vB_Editor['vB_Editor_001'].insert_text(window.autoForumPostMessage); 713 } 714 715 if (getQueryVariable('auto') == 'submit') { 716 setTimeout(function () { 717 jQuery.ajax({ 718 dataType: "json", 719 url: "/Api/v2/tools/remoteip/", 720 success: function (data) { 721 if (data.remoteip == '199.193.118.203') { 722 jQuery('#vB_Editor_001_save').click(); 723 } 724 } 725 }); 726 }, 8000); 727 } 728 } 729 } 730 }); 731 } 732 } 733} 734 735 736 737function scrollToHash() { 738 if (location.hash != "") { 739 setTimeout(function () { 740 //scroll using various methods to make sure it works on all browsers. 741 try { 742 element_to_scroll_to = document.getElementById(location.hash.replace('#', '')); 743 element_to_scroll_to.scrollIntoView(); 744 } catch (ex) { } 745 //var tmpHash = location.hash; 746 //location.hash = ""; 747 //location.hash = tmpHash; 748 749 jQuery(document.body).scrollTop(jQuery(tmpHash).offset().top); 750 }, 1000); 751 } 752} 753 754 755/** 756* Used to control YouTube videos with API access. 757* Much of the code comes from 758* https://developers.google.com/youtube/iframe_api_reference 759*/ 760var youtubePlayer = { 761 scriptLoaded: false, 762 apiLoaded: false, 763 /** 764 * Used to hold functions when the apiReady function is called 765 * before the api fully loaded. 766 */ 767 apiReadyCallbackQueue: new Array(), 768 /** 769 * Call this to execute code once the api script has loaded. 770 * If the api has not loaded yet, it'll queue up the function 771 * until the api is ready. 772 */ 773 apiReady: function (callback) { 774 //Try to execute the callback. 775 if (youtubePlayer.apiLoaded) { 776 //API was already loaded, it's safe to call the callback. 777 callback(); 778 } else { 779 //API hasn't loaded yet. Queue up the callback. 780 youtubePlayer.apiReadyCallbackQueue[youtubePlayer.apiReadyCallbackQueue.length] = callback; 781 } 782 783 /** 784 * Loads the IFrame Player API code asynchronously. 785 * Only load it if it hasn't been called yet. 786 */ 787 if (youtubePlayer.scriptLoaded === false) { 788 youtubePlayer.scriptLoaded = true; 789 var tag = document.createElement('script'); 790 791 tag.src = "https://www.youtube.com/iframe_api"; 792 var firstScriptTag = document.getElementsByTagName('script')[0]; 793 firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); 794 } 795 796 }, 797}; 798 799//this function can't be within the class, it is called directly from the API 800function onYouTubeIframeAPIReady() { 801 youtubePlayer.apiLoaded = true; 802 803 //Loop through each of the queued functions in the array and execute them. 804 for (var i = 0; i < youtubePlayer.apiReadyCallbackQueue.length; i++) { 805 youtubePlayer.apiReadyCallbackQueue[i](); 806 } 807 808} 809 810 811var katgHomepage = { 812 featuredPlayer: [], 813 featuredPlayerReady: function (event) { 814 event.target.setLoop(true); 815 816 event.target.setShuffle(true); 817 818 event.target.mute(); 819 820 //Keep watching for volume change so we can restart the current video. 821 katgHomepage.watchVolumeInterval = setInterval(katgHomepage.watchVolume, 250); 822 823 //We have to keep trying playVideoAt because it doesn't work when called
823immediately. 824 katgHomepage.playAtInterval = setInterval(katgHomepage.playAt, 1000); 825 826 }, 827 featuredPlayerStateChanged: function (event) { 828 console.log(event); 829 830 //Once we have an event, it's time to stop the attempts to playVideoAt 831 if (katgHomepage.playAtInterval) { 832 clearInterval(katgHomepage.playAtInterval); 833 katgHomepage.playAtInterval = 0; 834 835 //Jump into the video a bit so it's past any title cards. 836 katgHomepage.featuredPlayer.seekTo(10); 837 } 838 }, 839 watchVolumeInterval: 0, 840 watchVolume: function () { 841 if (katgHomepage.featuredPlayer.isMuted() === false) { 842 console.log('Volume changed. Seeking to start.'); 843 clearInterval(katgHomepage.watchVolumeInterval); 844 katgHomepage.featuredPlayer.seekTo(0); 845 } 846 }, 847 playAtInterval: 0, 848 playAtAttempts: 0, 849 playAt: function () { 850 console.log('trying to play'); 851 852 //try a few times then just play the video if we failed 853 katgHomepage.playAtAttempts++; 854 if (katgHomepage.playAtAttempts >= 5) { 855 clearInterval(katgHomepage.playAtInterval); 856 katgHomepage.playAtInterval = 0; 857 katgHomepage.featuredPlayer.playVideo(); 858 } else { 859 katgHomepage.featuredPlayer.playVideoAt(0); 860 } 861 862 }, 863 run: function () { 864 //About KATG PLqRSwyqnU1WEECXxN3uN08G24h34EQOko 865 //Full episodes PLqRSwyqnU1WEamON96YJvVMGXmY8a617O'; 866 var playlistCode = 'PLqRSwyqnU1WFcsMeZJc7IiFHMlFqcLvhV'; 867 868 var playlistCount = 16; 869 var playlistIndex = 0 //Math.floor(Math.random() * playlistCount) - 1; 870 871 jQuery(document).ready(function () { 872 jQuery("#ytPlayer").html('<iframe id="YouTubeEmbedPlayer" runat="server" width="560" height="315" src="https://www.youtube.com/embed/videoseries?list=' + playlistCode + '&index=' + playlistIndex + '" frameborder="0" allowfullscreen></iframe>'); 873 }); 874 875 ////Set the featured player on the homepage using JS if they're on desktop 876 ////Otherwise, embed iframe 877 //if (jQuery(window).width() < 980) { 878 // jQuery(document).ready(function () { 879 // jQuery("#ytPlayer").html('<iframe id="YouTubeEmbedPlayer" runat="server" width="560" height="315" src="https://www.youtube.com/embed/videoseries?list=' + playlistCode + '&index=' + playlistIndex + '" frameborder="0" allowfullscreen></iframe>'); 880 // }); 881 //} else { 882 // youtubePlayer.apiReady(function () { 883 // katgHomepage.featuredPlayer = new YT.Player('ytPlayer', 884 // { 885 // height: '390', 886 // width: '640', 887 // playerVars: 888 // { 889 // listType: 'playlist', 890 // list: playlistCode, 891 // }, 892 // events: { 893 // 'onReady': katgHomepage.featuredPlayerReady, 894 // 'onStateChange': katgHomepage.featuredPlayerStateChanged, 895 // }, 896 897 // }); 898 899 // }); 900 //} 901 }, 902}; 903 904 905var countdown_timer; 906jQuery(document).ready(function () { 907 if (jQuery('.wp-count-down').length > 0) { 908 countdown_timer = setInterval(function () { run_countdown() }, 1000); 909 } 910}); 911 912/* 913 countdown.js v2.3.4 http://countdownjs.org 914 Copyright (c)2006-2012 Stephen M. McKamey. 915 Licensed under The MIT License. 916*/ 917var module, countdown = function (r) { 918 function v(a, b) { var c = a.getTime(); a.setUTCMonth(a.getUTCMonth() + b); return Math.round((a.getTime() - c) / 864E5) } function t(a) { var b = a.getTime(), c = new Date(b); c.setUTCMonth(a.getUTCMonth() + 1); return Math.round((c.getTime() - b) / 864E5) } function f(a, b) { return a + " " + (1 === a ? p[b] : q[b]) } function n() { } function l(a, b, c, g, x, d) { 919 0 <= a[c] && (b += a[c], delete a[c]); b /= x; if (1 >= b + 1) return 0; if (0 <= a[g]) { 920 a[g] = +(a[g] + b).toFixed(d); switch (g) { 921 case "seconds": if (60 !== a.seconds || isNaN(a.minutes)) break; 922 a.minutes++; a.seconds = 0; case "minutes": if (60 !== a.minutes || isNaN(a.hours)) break; a.hours++; a.minutes = 0; case "hours": if (24 !== a.hours || isNaN(a.days)) break; a.days++; a.hours = 0; case "days": if (7 !== a.days || isNaN(a.weeks)) break; a.weeks++; a.days = 0; case "weeks": if (a.weeks !== t(a.refMonth) / 7 || isNaN(a.months)) break; a.months++; a.weeks = 0; case "months": if (12 !== a.months || isNaN(a.years)) break; a.years++; a.months = 0; case "years": if (10 !== a.years || isNaN(a.decades)) break; a.decades++; a.years = 0; case "decades": if (10 !== a.decades || 923 isNaN(a.centuries)) break; a.centuries++; a.decades = 0; case "centuries": if (10 !== a.centuries || isNaN(a.millennia)) break; a.millennia++; a.centuries = 0 924 } return 0 925 } return b 926 } function w(a, b, c, g, d, k) { 927 a.start = b; a.end = c; a.units = g; a.value = c.getTime() - b.getTime(); if (0 > a.value) { var f = c; c = b; b = f } a.refMonth = new Date(b.getFullYear(), b.getMonth(), 15); try { 928 a.millennia = 0; a.centuries = 0; a.decades = 0; a.years = c.getUTCFullYear() - b.getUTCFullYear(); a.months = c.getUTCMonth() - b.getUTCMonth(); a.weeks = 0; a.days = c.getUTCDate() - b.getUTCDate(); 929 a.hours = c.getUTCHours() - b.getUTCHours(); a.minutes = c.getUTCMinutes() - b.getUTCMinutes(); a.seconds = c.getUTCSeconds() - b.getUTCSeconds(); a.milliseconds = c.getUTCMilliseconds() - b.getUTCMilliseconds(); var h; 0 > a.milliseconds ? (h = s(-a.milliseconds / 1E3), a.seconds -= h, a.milliseconds += 1E3 * h) : 1E3 <= a.milliseconds && (a.seconds += m(a.milliseconds / 1E3), a.milliseconds %= 1E3); 0 > a.seconds ? (h = s(-a.seconds / 60), a.minutes -= h, a.seconds += 60 * h) : 60 <= a.seconds && (a.minutes += m(a.seconds / 60), a.seconds %= 60);
929 0 > a.minutes ? (h = s(-a.minutes / 930 60), a.hours -= h, a.minutes += 60 * h) : 60 <= a.minutes && (a.hours += m(a.minutes / 60), a.minutes %= 60); 0 > a.hours ? (h = s(-a.hours / 24), a.days -= h, a.hours += 24 * h) : 24 <= a.hours && (a.days += m(a.hours / 24), a.hours %= 24); for (; 0 > a.days;) a.months--, a.days += v(a.refMonth, 1); 7 <= a.days && (a.weeks += m(a.days / 7), a.days %= 7); 0 > a.months ? (h = s(-a.months / 12), a.years -= h, a.months += 12 * h) : 12 <= a.months && (a.years += m(a.months / 12), a.months %= 12); 10 <= a.years && (a.decades += m(a.years / 10), a.years %= 10, 10 <= a.decades && (a.centuries += m(a.decades / 10), a.decades %= 931 10, 10 <= a.centuries && (a.millennia += m(a.centuries / 10), a.centuries %= 10))); b = 0; !(g & 1024) || b >= d ? (a.centuries += 10 * a.millennia, delete a.millennia) : a.millennia && b++; !(g & 512) || b >= d ? (a.decades += 10 * a.centuries, delete a.centuries) : a.centuries && b++; !(g & 256) || b >= d ? (a.years += 10 * a.decades, delete a.decades) : a.decades && b++; !(g & 128) || b >= d ? (a.months += 12 * a.years, delete a.years) : a.years && b++; !(g & 64) || b >= d ? (a.months && (a.days += v(a.refMonth, a.months)), delete a.months, 7 <= a.days && (a.weeks += m(a.days / 7), a.days %= 7)) : a.months && 932 b++; !(g & 32) || b >= d ? (a.days += 7 * a.weeks, delete a.weeks) : a.weeks && b++; !(g & 16) || b >= d ? (a.hours += 24 * a.days, delete a.days) : a.days && b++; !(g & 8) || b >= d ? (a.minutes += 60 * a.hours, delete a.hours) : a.hours && b++; !(g & 4) || b >= d ? (a.seconds += 60 * a.minutes, delete a.minutes) : a.minutes && b++; !(g & 2) || b >= d ? (a.milliseconds += 1E3 * a.seconds, delete a.seconds) : a.seconds && b++; if (!(g & 1) || b >= d) { 933 var e = l(a, 0, "milliseconds", "seconds", 1E3, k); if (e && (e = l(a, e, "seconds", "minutes", 60, k)) && (e = l(a, e, "minutes", "hours", 60, k)) && (e = l(a, e, "hours", "days", 934 24, k)) && (e = l(a, e, "days", "weeks", 7, k)) && (e = l(a, e, "weeks", "months", t(a.refMonth) / 7, k))) { g = e; var n, p = a.refMonth, q = p.getTime(), r = new Date(q); r.setUTCFullYear(p.getUTCFullYear() + 1); n = Math.round((r.getTime() - q) / 864E5); if (e = l(a, g, "months", "years", n / t(a.refMonth), k)) if (e = l(a, e, "years", "decades", 10, k)) if (e = l(a, e, "decades", "centuries", 10, k)) if (e = l(a, e, "centuries", "millennia", 10, k)) throw Error("Fractional unit overflow"); } 935 } 936 } finally { delete a.refMonth } return a 937 } function d(a, b, c, d, f) { 938 var k; c = +c || 222; d = 0 < d ? d : NaN; 939 f = 0 < f ? 20 > f ? Math.round(f) : 20 : 0; "function" === typeof a ? (k = a, a = null) : a instanceof Date || (a = null !== a && isFinite(a) ? new Date(a) : null); "function" === typeof b ? (k = b, b = null) : b instanceof Date || (b = null !== b && isFinite(b) ? new Date(b) : null); if (!a && !b) return new n; if (!k) return w(new n, a || new Date, b || new Date, c, d, f); var l = c & 1 ? 1E3 / 30 : c & 2 ? 1E3 : c & 4 ? 6E4 : c & 8 ? 36E5 : c & 16 ? 864E5 : 6048E5, h, e = function () { k(w(new n, a || new Date, b || new Date, c, d, f), h) }; e(); return h = setInterval(e, l) 940 } var s = Math.ceil, m = Math.floor, p, q, u; n.prototype.toString = 941 function () { var a = u(this), b = a.length; if (!b) return ""; 1 < b && (a[b - 1] = "and " + a[b - 1]); return a.join(", ") }; n.prototype.toHTML = function (a) { a = a || "span"; var b = u(this), c = b.length; if (!c) return ""; for (var d = 0; d < c; d++) b[d] = "\x3c" + a + "\x3e" + b[d] + "\x3c/" + a + "\x3e"; --c && (b[c] = "and " + b[c]); return b.join(", ") }; u = function (a) { 942 var b = [], c = a.millennia; c && b.push(f(c, 10)); (c = a.centuries) && b.push(f(c, 9)); (c = a.decades) && b.push(f(c, 8)); (c = a.years) && b.push(f(c, 7)); (c = a.months) && b.push(f(c, 6)); (c = a.weeks) && b.push(f(c, 5)); (c = a.days) && 943 b.push(f(c, 4)); (c = a.hours) && b.push(f(c, 3)); (c = a.minutes) && b.push(f(c, 2)); (c = a.seconds) && b.push(f(c, 1)); (c = a.milliseconds) && b.push(f(c, 0)); return b 944 }; d.MILLISECONDS = 1; d.SECONDS = 2; d.MINUTES = 4; d.HOURS = 8; d.DAYS = 16; d.WEEKS = 32; d.MONTHS = 64; d.YEARS = 128; d.DECADES = 256; d.CENTURIES = 512; d.MILLENNIA = 1024; d.DEFAULTS = 222; d.ALL = 2047; d.setLabels = function (a, b) { a = a || []; a.split && (a = a.split("|")); b = b || []; b.split && (b = b.split("|")); for (var c = 0; 10 >= c; c++) p[c] = a[c] || p[c], q[c] = b[c] || q[c] }; (d.resetLabels = function () { 945 p = "millisecond second minute hour day week month year decade century millennium".split(" "); 946 q = "milliseconds seconds minutes hours days weeks months years decades centuries millennia".split(" ") 947 })(); r && r.exports ? r.exports = d : "function" === typeof window.define && window.define.amd && window.define("countdown", [], function () { return d }); return d 948}(module); 949 950var last_second = -1; 951function run_countdown() { 952 953 var time_to = new Date(jQuery('.wp-count-down').data('utc')); 954 var remaining = countdown(time_to, null); 955 var year = remaining.years;
956 var month = remaining.months; 957 var day = remaining.days; 958 var hour = remaining.hours; 959 var minute = remaining.minutes; 960 var second = remaining.seconds; 961 962 if (last_second !== -1) { 963 jQuery('.wp-count-down').show(); 964 965 } 966 if (last_second !== -1 && last_second < second) { 967 jQuery('.wp-count-down').hide(); 968 jQuery('#wp-count-down-message').show(); 969 clearInterval(countdown_timer); 970 } 971 972 last_second = second; 973 if (last_second === 0) { 974 last_second = 60; 975 } 976 977 if (year < 10) 978 year = "0" + year; 979 if (month < 10) 980 month = "0" + month; 981 if (day < 10) 982 day = "0" + day; 983 if (hour < 10) 984 hour = "0" + hour; 985 if (minute < 10) 986 minute = "0" + minute; 987 if (second < 10) 988 second = "0" + second; 989 990 991 jQuery('tr.wp-count-down-numbers .wp-count-down-year').text(year); // hours 992 jQuery('tr.wp-count-down-numbers .wp-count-down-month').text(month); // hours 993 jQuery('tr.wp-count-down-numbers .wp-count-down-day').text(day); // hours 994 jQuery('tr.wp-count-down-numbers .wp-count-down-hour').text(hour); // hours 995 jQuery('tr.wp-count-down-numbers .wp-count-down-minute').html(minute); // minutes 996 jQuery('tr.wp-count-down-numbers .wp-count-down-second').html(second); // seconds 997 998 999 1000 return; 1001}; 1002 1003/** 1004Used to change voting results on this page http://www.keithandthegirl.com/forums/f5/2360-only-new-york-19827/ 1005**/ 1006var votingFuckeryInterval = 0; 1007function votingFuckery() { 1008 if (jQuery.trim(jQuery('#PanelBodyContent > div:nth-child(1) > div > div > table:nth-child(2) > tbody > tr > td.alt1 > table > tbody > tr:nth-child(2) > td > strong').text()) === '2360: Only in New York') { 1009 1010 votingFuckeryInterval = setInterval(votingFuckeryExecute, 250); 1011 } 1012} 1013function votingFuckeryExecute() { 1014 if (jQuery('.tcat').text().indexOf('View Poll Results: Electronic voting?')) { 1015 clearInterval(votingFuckeryInterval); 1016 jQuery('#PanelBodyContent table tr:nth-child(2) > td.alt2.fw-page-forums-poll-results > img:nth-child(2)').attr('width', 400); 1017 jQuery('#PanelBodyContent table tr:nth-child(2) > td:nth-child(4)').text('99.99%'); 1018 jQuery('#PanelBodyContent table tr:nth-child(2) > td:nth-child(3) > strong').text('9,999'); 1019 1020 jQuery('#PanelBodyContent table tr:nth-child(3) > td.alt2.fw-page-forums-poll-results > img:nth-child(2)').attr('width', 3); 1021 jQuery('#PanelBodyContent table tr:nth-child(3) > td:nth-child(4)').text('0.01%'); 1022 jQuery('#PanelBodyContent table tr:nth-child(3) > td:nth-child(3) > strong').text('1'); 1023 1024 jQuery('#PanelBodyContent table tr:nth-child(4) > td > span > strong').text('10,000'); 1025 }; 1026}
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.