1var window_width; 2$(document).ready(function() { 3 4 displayAppDownloadPopup(); 5 6 window_width = $(window).width(); 7 8 9 initLazy(); 10 11// doSameHeightSection(); 12 13 removeTitleLine(); 14 15 copyFunction(); 16 17 display_sortcut_box(); 18 19 if(navigator.userAgent.indexOf('Mac') > 0) { 20 $('body').addClass('mac-os'); 21 } 22 23 checkAdsBlocker(); 24 25 $(document).on("click", ".display-highlight",function(e){ 26 e.preventDefault(); 27 28 $.ajax({ 29 type : "POST", 30 url : BASE_URL + 'highlights', 31 success: function (response) { 32 response = $.parseJSON(response); 33 if (response.status == true) { 34 $('#highlight_modal').html(response.html); 35 $('#highlight_modal').modal('show'); 36 setTimeout(function() { 37 highlight_slider(); 38 }, 500); 39 } 40 } 41 }); 42 }); 43 44 $(document).on("click", ".podcast-download",function(e){ 45 e.preventDefault(); 46 var podcast_id = $(this).attr('data-id'); 47 48 if (podcast_id != '') { 49 $.ajax({ 50 type : "POST", 51 url : BASE_URL + 'podcast/download', 52 data : { 53 podcast_id:podcast_id 54 }, 55 success: function (response) { 56 response = $.parseJSON(response); 57 if (response.status == true) { 58 $('.related_podcast_view').html(response.related_view); 59 setTimeout(function() { 60 initPostCarousel(); 61 }, 500); 62 } 63 } 64 }); 65 } else { 66 showMessage('danger', "Something went wrong"); 67 } 68 }); 69 70 $(document).on("click", ".custom_share_btn",function(){ 71// $(".socialicons_container").hide(); 72 $(this).parent('li').find(".socialicons_container").fadeToggle(); 73 }); 74 75 $("#subscribe_email_form").validate({ 76 rules: { 77 email: { 78 required: true, 79 email : true, 80 } 81 }, 82 messages: { 83 email: { 84 required: "Please enter email", 85 email : "Please enter valid email", 86 } 87 }, 88 errorPlacement: function(label, element) { 89 // position error label after generated textarea 90 if ($(element).attr('name') == 'email') { 91 element.parent('form').addClass('form-error'); 92// label.insertAfter(element.next()); 93 } else { 94 element.parent('form').removeClass('form-error'); 95 } 96 } 97 }); 98 99 $(document).on('click','.shortcut_box .cancel_btn',function(e) { 100 e.preventDefault(); 101 var current_time = new Date(); 102 $(this).parents('.shortcut_box').slideUp('slow').remove(); 103 104 localStorage.setItem('sort_cut_skip', 1); 105 localStorage.setItem('sort_cut_skip_time', current_time); 106 }); 107 108 $(document).on('click','.send_email',function(e) { 109 e.preventDefault(); 110 var email = $('#subscribe_email_form .email').val(); 111 112 if ($('#subscribe_email_form').valid()) { 113 $.ajax({ 114 url : BASE_URL + 'videos/mailchimp', 115 data : {email : email}, 116 type : "post", 117 success: function(data){ 118 var response = $.parseJSON(data); 119 if (response.status == true) { 120 showMessage('success', "Subscribed successfully"); 121 $('#subscribe_email_form .email').val(''); 122 } else { 123 showMessage('danger', "Something went wrong"); 124 } 125 } 126 }); 127 } 128 }); 129 130 $("#report_modal").on('show.bs.modal', function(){ 131 $('#report_form [name="message"]').val(""); 132 133 $('.report_block').removeClass('d-none'); 134 $('.report_success_block').addClass('d-none'); 135 }); 136 137 $(document).on('click', ".open_feedback_modal", function(e) { 138 $("#feedback_modal #yes").trigger("click"); 139 $('[name="feedback_message"]').val(""); 140 141 $('.feedback_block').removeClass('d-none'); 142 $('.feedback_success_block').addClass('d-none'); 143 144 $('#feedback_modal').modal('show'); 145 }); 146 147 $(document).on('click', ".add_to_bookmark", function(e) { 148 e.preventDefault(); 149 var $this = $(this); 150 var reference_id = $this.attr('data-reference_id'); 151 var reference_type = $this.attr('data-reference_type'); 152 153 $.ajax({ 154 type:"POST", 155 url: BASE_URL+'page/add-bookmark', 156 data: {reference_id : reference_id, reference_type : reference_type}, 157 success: function(response) { 158 response = $.parseJSON(response); 159 160 if (response.status == true) { 161 showMessage('success', response.message); 162 if (reference_type == 'pin') { 163 $this.parents('.masonary_item').find('.pin_icon').toggleClass('d-none'); 164 $this.parents('ul').find('.bookmark_icon').toggleClass('active'); 165 166 if (response.bookmark == false) { 167// $this.parents('.masonary_item').find('.pin_icon').removeClass('d-none'); 168// $this.parents('.masonary_item').find('.bookmark_icon').removeClass('active'); 169// loadPins(""); 170 } 171 } 172 } else { 173 showMessage('danger', response.message); 174 if (response.redirect_link != undefined){ 175 open_login_model(response.redirect_link); 176 177// window.open(response.redirect_link); 178// location.replace(response.redirect_link); 179 } 180 } 181 } 182 }); 183 }); 184 $("#feedback_form").validate({ 185 rules: { 186 feedback_message: { 187 required: true, 188 feedbackLength : true 189 } 190 }, 191 messages: { 192 feedback_message: { 193 required: "Please enter your feedback" 194 } 195 } 196 }); 197 198 $(document).on('submit', "#feedback_form", function(e) { 199 e.preventDefault(); 200 var $this = $(this); 201 $this.find('button[type="submit"]').attr('disable'); 202 $this.find('button[type="submit"]').html('<i class="fa fa-spinner"></i> Submitting'); 203 204 var form_data = new FormData($('#feedback_form')[0]); 205 $.ajax({ 206 type:"POST", 207 url: BASE_URL+'videos/feedback-message', 208 data: form_data, 209 processData: false, // Important! 210 contentType: false, 211 success: function(response) { 212 response = $.parseJSON(response); 213 if (response.status == true) { 214 $( "#feedback_modal #yes" ).trigger( "click" ); 215 $('[name="feedback_message"]').val(""); 216 217 $('.feedback_block').addClass('d-none'); 218 $('.feedback_success_block').removeClass('d-none'); 219 220// $('#feedback_modal').modal('hide'); 221// showMessage('success', response.message); 222 } else { 223 showMessage('danger', response.message); 224 } 225 226 $this.find('button[type="submit"]').removeAttr('disable'); 227 $this.find('button[type="submit"]').html('Submit'); 228 } 229 }); 230 }); 231 232 $(document).on('submit', "#report_form", function(e) { 233 e.preventDefault(); 234 var $this = $(this); 235 $this.find('button[type="submit"]').attr('disable'); 236 $this.find('button[type="submit"]').html('<i class="fa fa-spinner"></i> Submitting'); 237 238 var form_data = new FormData($('#report_form')[0]); 239 $.ajax({ 240 type:"POST", 241 url: BASE_URL+'videos/video-detail-report', 242 data: form_data, 243 processData: false, // Important! 244 contentType: false, 245 success: function(response) { 246 response = $.parseJSON(response); 247 if (response.status == true) { 248 $('#report_form [name="message"]').val(""); 249 250 $('.report_block').addClass('d-none'); 251 $('.report_success_block').removeClass('d-none'); 252 253// $('#report_modal').modal('hide'); 254// showMessage('success', response.message); 255 } else { 256 showMessage('danger', response.message); 257 } 258 259 $this.find('button[type="submit"]').removeAttr('disable'); 260 $this.find('button[type="submit"]').html('Submit'); 261 } 262 }); 263 }); 264 265 $.validator.addMethod("feedbackLength", function (value, element) { 266 267 var returns = true; 268 if (value.length > 2000) { 269 returns = false;
270 } 271 272 return returns; 273 }, function(params, element) { 274 return $(element).val().length+' characters. Please restrict feedback to 2000 characters.'; 275 }); 276 277 278 $("#report_form").validate({ 279 rules: { 280 message: { 281 required: true, 282 feedbackLength : true 283 } 284 }, 285 messages: { 286 message: { 287 required: "Please enter message" 288 } 289 } 290 }); 291 if (typeof action_btn != "undefined") { 292 var window_width = $(window).width(); 293 if (action_btn == "bookmark") { 294 $(".custome_click_cls .add_to_bookmark").trigger('click'); 295 } else if (action_btn == "play") { 296 if (window_width > 467) { 297 $(".modern_audio_box").animate({bottom : 0}, 500); 298 } else { 299 $(".modern_audio_box").animate({bottom : 0, top : 0}, 500); 300 } 301 $('.maudio .play_btns .play').trigger('click'); 302 } 303 } 304 305 /* 306 if (IS_LOGIN == '0') { 307// localStorage.clear(); 308 var current_time = new Date(); 309 var login_count = localStorage.getItem("login_count"); 310 var login_skip = localStorage.getItem("login_skip"); 311 var login_time = localStorage.getItem("login_time"); 312 313 if (login_count == null){ 314 localStorage.setItem('login_count', 1); 315 } else { 316 login_count = parseInt(login_count) + 1; 317 localStorage.setItem('login_count', login_count); 318 } 319 320 if (login_skip == null) { 321 if (login_count > 3) { 322 $('body').addClass('login-modal'); 323// $(".login_encourage").removeClass("d-none"); 324 } else { 325// $(body).removeClass('login-modal'); 326 } 327 } else if (login_skip == 1 && login_time != null) { 328// var deference = date_differ_in_days('Thu Oct 22 2020 05:20:56 GMT+0530', current_time) 329 var deference = date_differ_in_days(login_time, current_time); 330 if(deference >= 7) { 331 localStorage.clear(); 332 localStorage.setItem('login_count', 1); 333 } 334 } 335 } 336 */ 337 338 $(".login_encourage").on("click", function(){ 339 localStorage.setItem('login_skip', 1); 340 localStorage.setItem('login_time', current_time); 341 $('body').removeClass('login-modal'); 342 }); 343 344 if (window_width < 868) { 345 if ($('.ticker_widget').length > 0) { 346 var marquee_speed = $('.ticker_widget marquee').attr('scrollamount'); 347 if (marquee_speed == 0) { 348 $('.ticker_widget marquee').attr('scrollamount', 4, 0); 349 if ($('#ticker_marquee').length > 0) { 350 document.getElementById('ticker_marquee').start(); 351 } 352 } 353 } 354 } 355 356 $('#show-hidden-ticker').click(function() { 357 $('.hidden-ticker').slideToggle("medium"); 358 $("#show-hidden-ticker").toggleClass("hide"); 359 }); 360 361 $(".mobile_menu_toggle").click(function (e) { 362 $(".sidenav").show(); 363 e.stopPropagation(); 364 }); 365 366 $(".sidenav").click(function (e) { 367 e.stopPropagation(); 368 }); 369 $(".closebtn").click(function () { 370 $(".sidenav").hide(); 371 }); 372 $(document).click(function () { 373 $(".sidenav").hide(); 374 }); 375}); 376 377function removeTitleLine() { 378 $('.line_title').each(function(){ 379 if ($(this).find('span').outerHeight() > 50) { 380 $(this).addClass('without-line'); 381 } else { 382 $(this).removeClass('without-line'); 383 } 384 }); 385} 386 387function display_sortcut_box() { 388 var current_time = new Date(); 389 var sort_cut_skip = localStorage.getItem("sort_cut_skip"); 390 var sort_cut_skip_time = localStorage.getItem("sort_cut_skip_time"); 391 392 if (sort_cut_skip !== null) { 393 var deference = date_differ_in_days(sort_cut_skip_time, current_time); 394 if (deference >= 7) { 395 localStorage.setItem('sort_cut_skip', 0); 396 } else { 397 $('.shortcut_box').remove(); 398 } 399 } 400} 401 402function initLazy() { 403 if ($('.lazy').length > 0) { 404 setTimeout(function(){ 405 $('.lazy').Lazy({ 406 scrollDirection: 'vertical', 407 effect: 'fadeIn', 408 onError: function(element) { 409 console.log('error loading ' + element.data('src')); 410 } 411 }); 412 413// $('.lazy').Lazy({ 414// // your configuration goes here 415// scrollDirection: 'vertical', 416// effect: 'fadeIn', 417// visibleOnly: true, 418// onError: function(element) { 419// console.log('error loading ' + element.data('src')); 420// } 421// }); 422 }, 200); 423 } 424} 425 426 427// related to share button 428var AddThisJSLoaded = false; //AddThis not loaded yet 429var clickedOnShare = false; //share button is not clicked 430//replace with your publisher ID 431//it's in your profile setting 432var AddThisPubID = "ra-5f15b74a66bb697e"; 433var AddThisJS = 434 "//s7.addthis.com/js/300/addthis_widget.js#pubid=" + AddThisPubID; 435 436function share(button) { 437 438 if (navigator.share) { 439 //check if Web Share API is supported by the browser addthis_inline_share_toolbox 440 var url = document.location.href; 441 var title = document.getElementsByTagName("title")[0].innerHTML; 442 var description = document 443 .querySelector(".addthis_inline_share_toolbox[data-description]"); 444 var media = document 445 .querySelector(".addthis_inline_share_toolbox[data-media]"); 446 447 // alert('url :'+url+" titile:"+title+" desc:"+description+" media:"+media); 448 navigator.share({ 449 title: title, 450 text: description, 451 url: url, 452 media: media 453 }); 454 455 } else { 456 if (!AddThisJSLoaded && !clickedOnShare) { 457 //when AddThis not loaded and share button isn't clicked 458 clickedOnShare = true; //share button is clicked 459 showLoading(button); 460 shareByAddThis(button); 461 } else { 462 toggleAddThisButtons(button); 463 } 464 } 465} 466 467function shareByAddThis(button) { 468 var script = document.createElement("script"); 469 script.async = true; 470 script.src = AddThisJS; 471 472 script.onload = function () { 473 clickedOnShare = false; //AddThis JS is loaded 474 addthis.user.ready(function (data) { 475 AddThisJSLoaded = true; //AddThis loaded and ready to use 476 hideLoading(button); 477 showAddThisButtons(button); 478 }); 479 }; 480 481 script.onerror = function () { 482 clickedOnShare = false; //AddThis JS failed to load 483 hideLoading(button); 484 }; 485 486 document.body.appendChild(script); 487} 488 489function showLoading(button) { 490 button.classList.add("loading"); 491} 492 493function hideLoading(button) { 494 button.classList.remove("loading"); 495} 496 497function showAddThisButtons(button) { 498 button.classList.add("showAddThisButtons"); 499} 500 501function toggleAddThisButtons(button) { 502 button.classList.toggle("showAddThisButtons"); 503} 504 505// end related to share button 506 507function showMessage(type, message) { 508 toastr.options = { 509 closeButton: true, 510 debug: true, 511 progressBar: false, 512 positionClass: 'toast-top-right', 513 onclick: null 514 }; 515 516 if (type == 'success') { 517 toastr.success(message, 'Success', {timeOut: 5000}) 518 } 519 if (type == 'danger') { 520 toastr.error(message, 'Error', {timeOut: 5000}) 521 } 522} 523 524function checkAdsBlocker() { 525 if ($('.ads_block').length > 0) { 526 if (!$('.ads_block').is(':visible')) { 527 $('#adblocker_modal').modal('show'); 528 } 529 } 530} 531function date_differ_in_days(start_date, end_date) { 532 var start = new Date(start_date); 533 var end = new Date(end_date); 534 var diff = new Date(end - start); 535 var days = diff/1000/60/60/24; 536 537 return Math.floor(days); 538} 539 540function copyFunction() { 541 document.addEventListener('copy', (event) => { 542 const pagelink = `\n\nRead more at: ${document.location.href}`; 543 var copy_string = document.getSelection().toString().split(/\s+/).slice(0,75).join(" "); 544 event.clipboardData.setData('text', copy_string + pagelink); 545 event.preventDefault(); 546 }); 547} 548 549function doSameHeightSection() { 550 if (window_width > 467) { 551 $('.three_column_style').each(function(){ 552 var section_mx_height = 0; 553 $(this).find('.shadow_box').each(function(){ 554 if ($(this).outerHeight() > section_mx_height) { 555 section_mx_height = $(this).outerHeight(); 556 } 557 }) 558 559 $(this).find('.shadow_box').css('height', section_mx_height+'px'); 560 }); 561 562 $('.seven_five_style').each(function(){ 563 var section_mx_height = 0; 564 $(this).find('.shadow_box').each(function(){ 565 if ($(this).outerHeight() > section_mx_height) { 566 section_mx_height = $(this).outerHeight(); 567 } 568 }) 569 570 $(this).find('.shadow_box').css('height', section_mx_height+'px'); 571 }); 572 } 573} 574 575function open_subscription_model() { 576 $("#subsbscription-modal").modal('show'); 577} 578 579function displayAppDownloadPopup() { 580 // alert($(window).width()); 581 // if ($(window).width() <= 468) { 582 // var now = new Date().valueOf(); 583 // setTimeout(function () { 584 // if (new Date().valueOf() - now > 100) return; 585 // $('.install_app').removeClass('d-none'); 586 // }, 25); 587 // window.location = "themirrority://"; 588 // } 589} 590 591function highlight_slider() { 592 if ($('#highlight_modal .highlights_content').length > 0) { 593 $(".highlight_slider").owlCarousel({ 594 autoplay: false, 595 callbacks: true, 596 dots: true, 597 nav:true, 598 loop: false, 599 margin: 2, 600 responsive: { 601 0: { 602 items: 1 603 }, 604 480: { 605 items: 1 606 }, 607 768: { 608 items: 1, 609 }, 610 900: { 611 items: 1 612 } 613 } 614 }); 615 } 616}
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.