1$(document).ready(function(){ 2 3 // reCAPTCHA must render after modals are visible (hidden containers break the widget). 4 $('#modal_newsletter').on('shown.bs.modal', function() { 5 renderRecaptchaV2('newsletter_recaptcha_wrapper', { sitekey: RECAPTCHA_SITE_KEY }); 6 }); 7 8 $('#modal_login_register').on('shown.bs.modal', function() { 9 initRegisterRecaptchaContainers(this); 10 }); 11 12 $(window).scroll(function () { 13 if ($(this).scrollTop() === 0) { 14 $('body').removeClass('header-sticky'); 15 } else { 16 $('body').addClass('header-sticky'); 17 } 18 }); 19 20 21 // INIT WYSIWYG EDITOR FOR COMMENT FORM 22 // Emoji Button 23 document.emojiButton = 'fa fa-smile-o' 24 25 // The Emoji selector to input Unicode characters instead of images 26 document.emojiType = 'unicode'; // default: image 27 28 // Relative path to emojis 29 document.emojiSource = '/2020_assets/js/vendor/tam-emoji/img'; 30 31 $('.wysiwyg').summernote({ 32 toolbar: [ 33 ['font', ['bold', 'italic', 'underline', 'clear']], 34 ['para', ['ul', 'ol']], 35 ['insert', ['link']] 36 ], 37 tooltip: false 38 }); 39 40 41 // init Masonry 42 var $grid = $('.masonry-grid').masonry({ 43 "itemSelector":".masonry-grid-item", 44 "columnWidth":".masonry-grid-sizer", 45 "transitionDuration": 0, 46 "percentPosition":true 47 }); 48 // layout Masonry after each image loads 49 $grid.imagesLoaded().progress( function() { 50 $grid.masonry('layout'); 51 }); 52 53 54 // show or hide clearer icon on page load 55 let hasClear = $('.hasclear'); 56 hasClear.each(function(){ 57 var t = $(this); 58 if(t.val() != ''){ 59 t.next('span').show(); 60 } else { 61 t.next('span').hide(); 62 } 63 }); 64 65 // clear icon for form fields 66 hasClear.keyup(function () { 67 var t = $(this); 68 t.next('span').toggle(Boolean(t.val())); 69 }); 70 71 $('.clearer').click(function () { 72 $(this).prev('input').val('').focus(); 73 // ajax to clear session var 74 $.ajax({ 75 url : "/ajax_clear_search.html", 76 type : 'GET', 77 data : {"clear_search":"1"} 78 }); 79 $(this).hide(); 80 }); 81 82// // scroll to target ID for jump links 83// var offsetSize = $("#site_header").outerHeight(true) + 10; 84// $("html, body").animate({scrollTop:$(window.location.hash).offset().top - offsetSize }, 300); 85 86 // SLIDE NAV ON TOGGLE FOR MOBILE 87 $('[data-toggle="slide-collapse"]').on('click', function() { 88 $navMenuCont = $($(this).data('target')); 89 $navMenuCont.toggleClass('show'); 90// $navMenuCont.animate({'width':'toggle'}, 350); 91 }); 92 93 94 // open media player 95 $("a.media-player").click(function(e){ 96 e.preventDefault(); 97 window.open('/media-player', 'winname', 'directories=0,toolbar=0,location=0,status=0,menubar=0,resizable=no,width=422,height=500'); 98 }); 99 100 // show audio players only after document is ready 101 $('.audioPlayer').show(); 102 103 // post user metric on play of fan club reporter audio 104 let fanClubAudioPlayer = $('audio[data-audiotype="fanclub-reporter"]'); 105 fanClubAudioPlayer.on('play', function() { 106 postUserMetric('fan_club_reporter_audios_opened'); 107 }); 108 109 110 111 112 // Add/Remove Friend 113 $("#site_main").on('click', 'a.update-friend', function(e){ 114 e.preventDefault(); 115 $this = $(this); 116 var friend_name = $this.data("username"); 117 var action = $this.data("action"); 118 var style = $this.data("style"); 119 // Does friend_name have content 120 if(friend_name !== ""){ 121 $.ajax({ 122 url:"/add_remove_friend_ajax.html", 123 data: {"action":action,"friend_name":friend_name}, 124 type: "POST", 125 success: function(data){ 126 if(data === "added") { 127 if(style === 'icon') { 128 $this.data("action", "remove").html('<span class="fas fa-user-minus" aria-label="remove friend">'); 129 } else { 130 $this.data("action", "remove").html('Remove Friend'); 131 } 132 } else if(data === "removed") { 133 if(style === 'icon') { 134 $this.data("action", "add").html('<span class="fas fa-user-plus" aria-label="add friend">'); 135 } else { 136 $this.data("action", "add").html('Add Friend'); 137 } 138 } else { 139 alert(data); 140 } 141 } 142 }); 143 } else { 144 alert('No Friend Data Available.'); 145 return false;
146 } 147 }); 148 149 // Select all Msg Threads 150 $('#select_all').on('click', function () { 151 $('table').find(':checkbox').prop('checked', this.checked); 152 }); 153 154 // Delete Msg Thread 155 $("a#delete_pm").click(function(e){ 156 e.preventDefault(); 157 158 $this = $(this); 159 var threads = []; 160 $("input:checkbox[name=delete-pm]:checked").each(function(n){ 161 threads[n] = $(this).data("thread"); 162 }); 163 164 if(threads !== ""){ 165 if (!confirm("Are you sure you want to delete these threads?")) 166 return false; 167 168 $.ajax({ 169 url:"/delete_pm_ajax.html", 170 data: {"threads":threads}, 171 type: "POST", 172 success: function(data){ 173 if(data === "deleted") { 174 $("input:checkbox[name=delete-pm]:checked").each(function(n){ 175 $(this).closest('tr.pm-row').hide(); 176 }); 177 } else { 178 alert(data); 179 } 180 } 181 }); 182 } else { 183 alert('Please select threads to delete.'); 184 return false; 185 } 186 }); 187 188 189 // private message modal open 190 let pmModal = $('#modal_pm'); 191 pmModal.on('show.bs.modal', function(e){ 192 let toUserName = e.relatedTarget.attributes['data-username'].value; 193 $('#privateMsgReplyForm input[name="friend_name_not_search"]').val(toUserName); 194 }); 195 196 // send private message from modal 197 $('#sendPmFromModal').click(function(e){ 198 e.preventDefault(); 199 let formData = $('#privateMsgReplyForm').find('form').serialize(); 200 $.ajax({ 201 url:"/my-account/private-messages", 202 data: formData, 203 type: "POST", 204 success: function(data){ 205 $('#modal_pm').modal('hide'); 206 } 207 }); 208 }); 209 210 211 //**** NEWSLETTER VALIDATION *********************************// 212 $("#newsletter_signup").validate({ 213 errorPlacement: $.noop, 214 submitHandler: function(form){ 215 newsletter_submit(); 216 } 217 }); 218 219 // Newsletter signup 220 function newsletter_submit(){ 221 let newsletterRecaptchaWrapper = $("#newsletter_recaptcha_wrapper"); 222 var email = $("input[name=newsletter_email]").val(); 223 var postal_code = $("input[name=newsletter_postal_code]").val(); 224 var recaptcha = newsletterRecaptchaWrapper.find("textarea[name=g-recaptcha-response]").val(); 225 console.log(recaptcha); 226 $.ajax({ 227 url:"/newletter_signup_ajax.html", 228 type:"POST", 229 data:{"email":email,"postal_code":postal_code,"g-recaptcha-response":recaptcha}, 230 success:function(data){ 231 if(data === 'success'){ 232 $("#newsletter_signup_failure").hide(); 233 $("#newsletter_signup_success").show(); 234 } else { 235 $("#newsletter_signup_success").hide(); 236 $("#newsletter_signup_failure").show(); 237 } 238 } 239 }); 240 } 241 242 // Newsletter modal close 243 let newsletterModal = $('#modal_newsletter'); 244 newsletterModal.on('hide.bs.modal', function(e){ 245 $("#newsletter_signup_failure").hide(); 246 $("#newsletter_signup_success").hide(); 247 $("input[name=newsletter_email]").val(''); 248 $("input[name=newsletter_postal_code]").val(''); 249 var newsletterRecaptchaEl = document.getElementById('newsletter_recaptcha_wrapper'); 250 if (newsletterRecaptchaEl && newsletterRecaptchaEl.hasAttribute('data-recaptcha-widget-id') && typeof grecaptcha !== 'undefined') { 251 grecaptcha.ready(function() { 252 grecaptcha.reset(parseInt(newsletterRecaptchaEl.getAttribute('data-recaptcha-widget-id'), 10)); 253 }); 254 } 255 }); 256 257 258 // Pin modal open 259 let pinModal = $('#modal_pin'); 260 pinModal.on('show.bs.modal', function(e){ 261 if(e.relatedTarget !== undefined) { 262 let pinName = e.relatedTarget.attributes['data-name'].value; 263 let pinClass = e.relatedTarget.attributes['data-class'].value; 264 let pinImage = e.relatedTarget.attributes['data-image'].value; 265 let pinDescription = e.relatedTarget.attributes['data-description'].value; 266 let incrementSpanHtml = e.relatedTarget.attributes['data-incrementSpan'].value; 267 let otherPinsHtml = e.relatedTarget.attributes['data-otherPins'].value;
268 let modalBody = $('#modal_pin').find('.modal-body'); 269 let pinHtml = '<div class="pin-info">'+ 270 '<div class="lg-pin-wrapper mb-3 ' +pinClass+ '">' + 271 '<img src="' + pinImage + '">' + 272 incrementSpanHtml + 273 '</div>' + 274 '<h2 id="modal_pin_label">' + pinName + '</h2>' + 275 '<p class="text-muted text-18">' + pinDescription + '</p>' + 276 otherPinsHtml + 277 '</div>'; 278 279 modalBody.find('.pin-info').remove(); 280 modalBody.append(pinHtml); 281 } 282 }); 283 284 285 // post metric when share buttons are clicked 286 $('.st-custom-button').click(function(){ 287 postUserMetric('shares'); 288 }); 289 290 291 // GENERAL MODAL FOR GENERIC BODY AND TITLE MODAL CONTENT 292 let generalModal = $('#modal_general'); 293 generalModal.on('show.bs.modal', function(e){ 294 let body = e.relatedTarget.attributes['data-body'].value; 295 let title = e.relatedTarget.attributes['data-title'].value; 296 let type = e.relatedTarget.attributes['data-type'].value; 297 298 if(type === 'lyrics'){ 299 let productId = e.relatedTarget.attributes['data-productid'].value; 300 $.ajax({ 301 url: "/post_user_metric_ajax.html", 302 type: "POST", 303 data: {"metric":"lyrics_opened","productId":productId} 304 }); 305 } 306 307 $(this).find('.modal-title').html(title); 308 $(this).find('.modal-body').html(body); 309 310 }); 311 312}); 313 314 315function postUserMetric(metricName){ 316 $.ajax({ 317 url: "/post_user_metric_ajax.html", 318 type: "POST", 319 data: {"metric":metricName} 320 }); 321}
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.