1(function($) { 2 "use strict"; 3/* ================================= 4=== STICKY HEADER ==== 5=================================== */ 6jQuery(window).on('load', function() { 7 // Enable Hover for Bootstrap Nav Dropdowns 8 jQuery('.mg-search-box').hover(function() { 9 jQuery(this).addClass('open'); 10 }, function() { 11 jQuery(this).removeClass('open'); 12 }); 13}); 14 15// nolist_crowsel 16$('.widget-order-slider').each(function(index) { 17 18 $(this).find('.nolist_crowsel').addClass('nolist_crowsel-'+index); 19 const sld_dure = $(this).find('.sld-dure').val(); 20 function nolist_crowsel() { 21 const nolist_crowsel = new Swiper('.nolist_crowsel-'+index, { 22 direction: 'horizontal', 23 slidesPerView: 1, 24 loop: true, 25 autoplay: { 26 delay: sld_dure, 27 }, 28 // If we need pagination 29 pagination: { 30 el: '.swiper-pagination', 31 }, 32 // Navigation arrows 33 navigation: { 34 nextEl: '.swiper-button-next', 35 prevEl: '.swiper-button-prev', 36 }, 37 // And if we need scrollbar 38 scrollbar: { 39 el: '.swiper-scrollbar', 40 }, 41 breakpoints: { 42 640: { 43 slidesPerView: 1, 44 spaceBetween: 0, 45 }, 46 768: { 47 slidesPerView: 3, 48 spaceBetween: 10, 49 }, 50 1024: { 51 slidesPerView: 4, 52 spaceBetween: 30, 53 }, 54 } 55 }); 56 } 57 nolist_crowsel(); 58}); 59 60// no_gutter crousel 61$('.4-column-full').each(function(index) { 62 63 $(this).find('.no_gutter_crousel').addClass('no_gutter_crousel-'+index); 64 const sld_dure = $(this).find('.sld-dure').val(); 65 function no_gutter() { 66 const no_gutter_crousel = new Swiper('.no_gutter_crousel-'+index, { 67 direction: 'horizontal', 68 slidesPerView: 1, 69 loop: true, 70 autoplay: { 71 delay: sld_dure, 72 }, 73 // If we need pagination 74 pagination: { 75 el: '.swiper-pagination', 76 }, 77 // Navigation arrows 78 navigation: { 79 nextEl: '.swiper-button-next', 80 prevEl: '.swiper-button-prev', 81 }, 82 // And if we need scrollbar 83 scrollbar: { 84 el: '.swiper-scrollbar', 85 }, 86 breakpoints: { 87 640: { 88 slidesPerView: 1, 89 spaceBetween: 0, 90 }, 91 768: { 92 slidesPerView: 3, 93 spaceBetween: 0, 94 }, 95 1024: { 96 slidesPerView: 4, 97 spaceBetween: 0, 98 }, 99 } 100 }); 101 } 102 no_gutter(); 103}); 104 105function homefeatured() { 106 const featuredcat = new Swiper('.featuredcat', { 107 direction: 'horizontal', 108 slidesPerView: 3, 109 loop: true, 110 autoplay: { 111 delay: 3000, 112 }, 113 114 // If we need pagination 115 pagination: { 116 el: '.swiper-pagination', 117 }, 118 119 // Navigation arrows 120 navigation: { 121 nextEl: '.swiper-button-next', 122 prevEl: '.swiper-button-prev', 123 }, 124 125 // And if we need scrollbar 126 scrollbar: { 127 el: '.swiper-scrollbar', 128 }, 129}); 130} 131homefeatured(); 132 133// post crousel 134$('.post-slider-widget').each(function(index) { 135 136 $(this).find('.postcrousel').addClass('postcrousel-'+index); 137 const sld_dure = $(this).find('.sld-dure').val(); 138 function postcrousel() { 139 const postcrousel = new Swiper('.postcrousel-'+index, { 140 direction: 'horizontal', 141 slidesPerView: 1, 142 loop: true, 143 autoplay: { 144 delay: sld_dure, 145 }, 146 // If we need pagination 147 pagination: { 148 el: '.swiper-pagination', 149 }, 150 // Navigation arrows 151 navigation: { 152 nextEl: '.swiper-button-next', 153 prevEl: '.swiper-button-prev', 154 }, 155 // And if we need scrollbar 156 scrollbar: { 157 el: '.swiper-scrollbar', 158 }, 159 }); 160 } 161 postcrousel(); 162 163}); 164 165 // editorchoice post 166const elementExists = document.querySelector('.editorchoice') !== null; 167if (elementExists) { 168 169 function editorchoice() {
170 var autoplay = document.querySelector('.editorchoice').getAttribute('auto'); 171 const featuredcat = new Swiper('.editorchoice', { 172 direction: 'horizontal', 173 slidesPerView: 1, 174 loop: true, 175 176 autoplay: autoplay 177 ? { 178 delay: 3000, 179 } 180 : false, 181 // If we need pagination 182 pagination: { 183 el: '.swiper-pagination', 184 }, 185 // Navigation arrows 186 navigation: { 187 nextEl: '.swiper-button-next', 188 prevEl: '.swiper-button-prev', 189 }, 190 // And if we need scrollbar 191 scrollbar: { 192 el: '.swiper-scrollbar', 193 }, 194 breakpoints: { 195 640: { 196 slidesPerView: 1, 197 spaceBetween: 0, 198 }, 199 768: { 200 slidesPerView: 2, 201 spaceBetween: 10, 202 }, 203 1024: { 204 slidesPerView: 4, 205 spaceBetween: 10, 206 }, 207 } 208 }); 209 } 210 editorchoice(); 211} else { 212 console.log("The element with class 'my-element' does not exist."); 213} 214 215// realatedpost 216function realatedpost() { 217 const realatedpost = new Swiper('.realatedpost', { 218 direction: 'horizontal', 219 slidesPerView: 1, 220 loop: true, 221 autoplay: { 222 delay: 3000, 223 }, 224 // If we need pagination 225 pagination: { 226 el: '.swiper-pagination', 227 }, 228 // Navigation arrows 229 navigation: { 230 nextEl: '.swiper-button-next', 231 prevEl: '.swiper-button-prev', 232 }, 233 // And if we need scrollbar 234 scrollbar: { 235 el: '.swiper-scrollbar', 236 }, 237 breakpoints: { 238 640: { 239 slidesPerView: 1, 240 spaceBetween: 0, 241 }, 242 768: { 243 slidesPerView: 3, 244 spaceBetween: 10, 245 }, 246 1024: { 247 slidesPerView: 3, 248 spaceBetween: 30, 249 }, 250 } 251 }); 252} 253realatedpost(); 254// realatedpost 255 256 257// colmnthree crousel 258$('.design-slider-widget').each(function(index) { 259 260 $(this).find('.colmnthree').addClass('colmnthree-'+index); 261 const sld_dure = $(this).find('.sld-dure').val(); 262 function colmnthree() { 263 const colmnthree = new Swiper('.colmnthree-'+index, { 264 direction: 'horizontal', 265 slidesPerView: 1, 266 loop: true, 267 autoplay: { 268 delay: sld_dure, 269 }, 270 // If we need pagination 271 pagination: { 272 el: '.swiper-pagination', 273 }, 274 // Navigation arrows 275 navigation: { 276 nextEl: '.swiper-button-next', 277 prevEl: '.swiper-button-prev', 278 }, 279 // And if we need scrollbar 280 scrollbar: { 281 el: '.swiper-scrollbar', 282 }, 283 breakpoints: { 284 640: { 285 slidesPerView: 1, 286 spaceBetween: 0, 287 }, 288 768: { 289 slidesPerView: 3, 290 spaceBetween: 10, 291 }, 292 1024: { 293 slidesPerView: 3, 294 spaceBetween: 30, 295 }, 296 } 297 }); 298 } 299 colmnthree(); 300}); 301 302// end colmnthree crousel 303 304function colmntwo() { 305 const colmntwo = new Swiper('.colmntwo', { 306 direction: 'horizontal', 307 slidesPerView: 1, 308 loop: true, 309 autoplay: { 310 delay: 3000, 311 }, 312 // If we need pagination 313 pagination: { 314 el: '.swiper-pagination', 315 }, 316 // Navigation arrows 317 navigation: { 318 nextEl: '.swiper-button-next', 319 prevEl: '.swiper-button-prev', 320 }, 321 // And if we need scrollbar 322 scrollbar: { 323 el: '.swiper-scrollbar', 324 }, 325 breakpoints: { 326 640: { 327 slidesPerView: 1, 328 spaceBetween: 0, 329 }, 330 768: { 331 slidesPerView: 2, 332 spaceBetween: 10, 333 }, 334 1024: { 335 slidesPerView: 2, 336 spaceBetween: 30, 337 }, 338 } 339 }); 340} 341colmntwo(); 342/* ================================= 343=== SCROLL TOP ==== 344=================================== */ 345jQuery(".ta_upscr").hide(); 346function taupr() { 347 jQuery(window).on('scroll', function() { 348 if ($(this).scrollTop() > 500) { 349 $('.ta_upscr').fadeIn(); 350 } else { 351 $('.ta_upscr').fadeOut(); 352 } 353 }); 354 $('a.ta_upscr').on('click', function() { 355 $('body,html').animate({ 356 scrollTop: 0 357 }, 800); 358 return false; 359 }); 360} 361taupr(); 362/* ================================= 363=== Share Toggle ==== 364=================================== */
365jQuery('.mg-share-toggle').on('click', function() { 366 jQuery(this).next().toggleClass('mg-share-active'); 367}); 368 369function marquee() { 370 jQuery('.marquee').marquee({ 371 speed: $(".mg-latest-news-slider" ).attr('hotNewsSpeed'), 372 direction: $(".mg-latest-news-slider" ).attr('hotNewsDirection'), 373 delayBeforeStart: 0, 374 duplicated: true, 375 pauseOnHover: true, 376 startVisible: true 377 }); 378} 379marquee(); 380 381// gridslider crousel 382function gridslider() { 383 const gridslider = new Swiper('.gridslider', { 384 direction: 'horizontal', 385 slidesPerView: 1, 386 loop: true, 387 autoplay: { 388 delay: 3000, 389 }, 390 // If we need pagination 391 pagination: { 392 el: '.swiper-pagination', 393 }, 394 // Navigation arrows 395 navigation: { 396 nextEl: '.swiper-button-next', 397 prevEl: '.swiper-button-prev', 398 }, 399 // And if we need scrollbar 400 scrollbar: { 401 el: '.swiper-scrollbar', 402 }, 403 }); 404} 405gridslider(); 406 407/* ================================= 408=== Video Post ==== 409=================================== */ 410 411 412 413$( ".tab-pane" ).each(function() { 414 415 var $this = $(this); 416 417 $this.find('.vid_btn').click(function(){ 418 var $this_btn = $(this); 419 if( $this_btn.find('.icon').hasClass('fa-play')){ 420 421 $this.find('.youtube-video')[0].contentWindow.postMessage('{"event":"command","func":"' + 'playVideo' + '","args":""}', '*'); 422 $this_btn.removeClass('play-video').addClass('pause-video'); 423 $this.find(".inner").removeClass('play-video').addClass('pause-video'); 424 $this_btn.find(".icon").removeClass('fa-play').addClass('fa-pause'); 425 $this.find('.vid_btn').mouseover(function() { 426 $this.find('.pause-video .stroke-dotted').css("stroke","white"); 427 }).mouseout(function() { 428 $this.find('.pause-video .stroke-dotted').css("stroke","transparent"); 429 }); 430 431 }else{ 432 433 $this.find('.youtube-video')[0].contentWindow.postMessage('{"event":"command","func":"' + 'pauseVideo' + '","args":""}', '*'); 434 $this_btn.removeClass('pause-video').addClass('play-video'); 435 $this_btn.find(".icon").removeClass('fa-pause').addClass('fa-play'); 436 $this.find(".inner").removeClass('pause-video').addClass('play-video'); 437 438 439 } 440 441 }); 442 443}); 444 445function extractVideoId(url) { 446 var pattern = /(?:youtube(?:-nocookie)?\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/; 447 var match = url.match(pattern); 448 if (match && match[1]) { 449 return match[1]; 450 } 451 return null; 452} 453 454$('.editorchoice ').find( ".vid_btn" ).each(function() { 455 456 var $this = $(this); 457 var src = $this.parent().find('.youtube-video').attr('src'); 458 459 const searchUrl = "youtube"; 460 if (src.includes(searchUrl)) { 461 var videoId = extractVideoId(src); 462 src = `https://www.youtube.com/embed/${videoId}?enablejsapi=1&version=3&playerapiid=ytplayer` 463 } 464 var src = $this.parent().find('.youtube-video').attr('src', src); 465 466 $this.click(function(){ 467 var $this_btn = $(this); 468 var parent = $this_btn.parent(); 469 var src = parent.find('.youtube-video').attr('src'); 470 471 const mainString = src; 472 const searchString = "youtube"; 473 474 if (mainString.includes(searchString)) { 475 var videoId = extractVideoId(src); 476 src = `https://www.youtube.com/embed/${videoId}?enablejsapi=1&version=3&playerapiid=ytplayer` 477 } 478 var vid_popup = document.createElement("div"); 479 var vid_popup_span = document.createElement("span"); 480 var vid_popup_iframe = document.createElement("iframe"); 481 vid_popup.classList = "popup"; 482 vid_popup_span.classList = "close-button"; 483 vid_popup_span.innerHTML = "×"; 484 vid_popup_iframe.setAttribute('width', 800); 485 vid_popup_iframe.setAttribute('height', 450); 486 vid_popup_iframe.setAttribute('src', src); 487 vid_popup_iframe.setAttribute('frameborder', 0); 488 vid_popup_iframe.setAttribute('allowfullscreen', ""); 489 vid_popup_iframe.setAttribute('autoplay', "allow"); 490 vid_popup_iframe.classList = "pop-frame"; 491 vid_popup.append(vid_popup_span); 492 vid_popup.append(vid_popup_iframe); 493 494 $('#page').append(vid_popup); 495 $('#page').find('.popup .pop-frame')[0].contentWindow.postMessage('{"event":"command","func":"' + 'playVideo' + '","args":""}', '*'); 496 $('#page').find('.popup .close-button').click(function(){ 497 $(this).parent().remove(); 498 }) 499 500 501 }); 502}); 503 504})(jQuery); 505/***** Dark/Light Mode *****/ 506jQuery(function($) { 507 /*Click on dark mode icon. Add dark mode classes and wrappers. 508 Store user preference through sessions*/ 509 $('.newsup-button').click(function() { 510 //Show either moon or sun 511 var $this = $(this); 512 if ($('.newsup-button').hasClass('active')) { 513 514 $('.newsup-button').removeClass('active'); 515 } else { 516 $('.newsup-button').addClass('active'); 517 } 518 //If dark mode is selected 519 if ($('.newsup-button').hasClass('active')) { 520 //Add dark mode class to the body 521 $('body').addClass('dark'); 522 var dark_color = $this.attr('dark-color'); 523 $('body .site-title a').css("color", dark_color); 524 $('body .site-description').css("color", dark_color); 525 } else { 526 $('body').removeClass('dark'); 527 var color = '#' + $this.attr('light-color'); 528 $('body .site-title a').css("color", color); 529 $('body .site-description').css("color", color); 530 var element = document.getElementById("black-css"); 531 if (element) { 532 element.remove(); 533 } 534 535 } 536 }) 537}); 538 539jQuery(function() { 540 541 /* ---------------------------------------------- /* 542 * Load More top 543 /* ---------------------------------------------- */ 544 545 let currentPage = 1; 546 jQuery( 'body' ).on( 547 'click', 548 '#load-more', 549 function(e) { 550 var $this = jQuery(this); 551 currentPage++; // Do currentPage + 1, because we want to load the next page 552 let contenType = $this.parent().attr('id'); 553 var data = { 554 action: 'load_more_btn', 555 paged: currentPage, 556 contenType: contenType, 557 }; 558 559 jQuery.ajax( 560 { 561 type: 'POST', 562 url: load_more_ajax_obj.ajax_url, 563 dataType: 'json', 564 data: data, 565 success: function (response) { 566 console.log(response['due_post']); 567 $this.parent().remove(); 568 var div = document.createElement("div"); 569 var load_a = document.createElement("button"); 570 load_a.setAttribute("id", "load-more"); 571 load_a.setAttribute("class", "btn btn-theme"); 572 load_a.innerHTML = "Load more"; 573 574 div.appendChild(load_a);
575 // console.log(div); 576 // console.log(response['html']); 577 if(contenType == 'gridContent'){ 578 jQuery('#grid').append(response['html']); 579 if(response['due_post'] > 0){ 580 div.setAttribute("id", "gridContent"); 581 div.setAttribute("class", "col-md-12 mg-post-pagination"); 582 jQuery('#grid').append(div); 583 } 584 }else{ 585 // alert(type); 586 jQuery( 'body' ).find('.align_cls .mg-posts-sec .mg-posts-sec-inner').append(response['html']); 587 if(response['due_post'] > 0){ 588 div.setAttribute("id", "alignContent"); 589 div.setAttribute("class", "col-md-12 mg-post-pagination"); 590 jQuery( 'body' ).find('.align_cls .mg-posts-sec .mg-posts-sec-inner').append(div); 591 592 } 593 } 594 595 // let observer1 = lozad('.lozad', { 596 // threshold: 0.1, // ratio of element convergence 597 // enableAutoReload: true // it will reload the new image when validating attributes changes 598 // }); 599 // observer1.observe(); 600 601 }, 602 complete: function() { 603 // Sticksy.hardRefreshAll(); 604 }, 605 error: function(errorThrown){ 606 console.log(errorThrown); 607 }, 608 } 609 610 ); 611 612 } 613 ); 614});
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.