1(function($){ 2 $(document).ready(function(){ 3 // ä¾§æ èååå§ç¶æè®¾ç½® 4 if(theme.minNav != '1')trigger_resizable(true); 5 // 主é¢ç¶æ 6 switch_mode(); 7 // æç´¢æ¨¡å 8 intoSearch(); 9 // ç²æ§é¡µè 10 stickFooter(); 11 // ç½ååæç¤º 12 if(isPC()){ $('[data-toggle="tooltip"]').tooltip({trigger: 'hover'}); }else{ $('.qr-img[data-toggle="tooltip"]').tooltip({trigger: 'hover'}); } 13 // åå§åtabæ»å 14 intoSlider(); 15 // åå§åtheiaStickySidebar 16 $('.sidebar').theiaStickySidebar({ 17 additionalMarginTop: 90, 18 additionalMarginBottom: 20 19 }); 20 // åå§å游客èªå®ä¹æ°æ® 21 /*if(theme.isCustomize == '1'){ 22 intoSites(false); 23 intoSites(true); 24 }*/ 25 }); 26 $(".panel-body.single img").each(function(i) { 27 if (!this.parentNode.href) { 28 if(theme.lazyload) 29 $(this).wrap("<a href='" + $(this).data('src') + "' data-fancybox='fancybox' data-caption='" + this.alt + "'></a>") 30 else 31 $(this).wrap("<a href='" + this.src + "' data-fancybox='fancybox' data-caption='" + this.alt + "'></a>") 32 } 33 }) 34 // Enable/Disable Resizable Event 35 var wid = 0; 36 $(window).resize(function() { 37 clearTimeout(wid); 38 wid = setTimeout(go_resize, 200); 39 }); 40 function go_resize() { 41 stickFooter(); 42 //if(theme.minNav != '1'){ 43 trigger_resizable(false); 44 //} 45 } 46 // count-aæ°åå¨ç» 47 $('.count-a').each(function () { 48 $(this).prop('Counter', 0).animate({ 49 Counter: $(this).text() 50 }, { 51 duration: 1000, 52 easing: 'swing', 53 step: function (now) { 54 $(this).text(Math.ceil(now)); 55 } 56 }); 57 }); 58 $(document).on('click', "a[target!='_blank']", function() { 59 if( theme.loading=='1' && $(this).attr('href') && $(this).attr('href').indexOf("#") != 0 && $(this).attr('href').indexOf("java") != 0 && !$(this).data('fancybox') && !$(this).data('commentid') && !$(this).hasClass('nofx') ){ 60 var load = $('<div id="load-loading"></div>'); 61 $("body").prepend(load); 62 load.animate({opacity:'1'},200,'swing').delay(2000).hide(300,function(){ load.remove() }); 63 } 64 }); 65 // ç¹èµ 66 $(".btn-like").click(function() { 67 var t = $(this); 68 if(t.data('action') == "post_like"){ 69 if (t.hasClass('liked')) { 70 showAlert(JSON.parse('{"status":3,"msg":"æ¨å·²ç»èµè¿äº!"}')); 71 } else { 72 var icop = t.children('.flex-column'); 73 t.addClass('liked'); 74 $.ajax({
75 type : 'POST', 76 url : theme.ajaxurl, 77 data : { 78 action: t.data('action'), 79 post_id: t.data("id"), 80 ticket: t.data("ticket") 81 }, 82 success : function( data ){ 83 $am = $('<i class="iconfont icon-heart" style="color: #f12345;transform: scale(1) translateY(0);position: absolute;transition: .6s;opacity: 1;"></i>'); 84 icop.prepend($am); 85 showAlert(JSON.parse('{"status":1,"msg":"谢谢ç¹èµ!"}')); 86 $('.like-count').html(data); 87 $am.addClass('home-like-hide'); 88 }, 89 error:function(){ 90 showAlert(JSON.parse('{"status":4,"msg":"ç½ç»é误 --."}')); 91 } 92 }); 93 } 94 }else{ 95 if (t.hasClass('disabled')) 96 return false; 97 var _delete = 0; 98 var id = t.data("id"); 99 if (t.hasClass('liked')) { 100 _delete = 1; 101 } 102 t.addClass('disabled'); 103 $.ajax({
104 type : 'POST', 105 url : theme.ajaxurl, 106 data : { 107 action: t.data("action"), 108 post_id: t.data("id"), 109 post_type: t.data("post_type"), 110 delete: _delete, 111 ticket: t.data("ticket") 112 }, 113 success : function( data ){ 114 t.removeClass('disabled'); 115 if(data.status==1){ 116 $('.star-count-'+id).html(data.count); 117 if(_delete==1){ 118 t.removeClass('liked'); 119 t.find('.star-ico').removeClass('icon-collection').addClass('icon-collection-line'); 120 } 121 else{ 122 t.addClass('liked'); 123 t.find('.star-ico').removeClass('icon-collection-line').addClass('icon-collection'); 124 } 125 ioPopupTips(data.status, data.msg); 126 return false; 127 } 128 ioPopupTips(data.status, data.msg); 129 }, 130 error:function(){ 131 t.removeClass('disabled'); 132 ioPopupTips(4, "ç½ç»é误 --."); 133 } 134 }); 135 136 } 137 return false; 138 }); 139 // å¡çç¹èµ 140 $(document).on('click', '.home-like', function() { 141 if ($(this).hasClass('liked')) { 142 showAlert(JSON.parse('{"status":3,"msg":"æ¨å·²ç»èµè¿äº!"}')); 143 } else { 144 var icop = $(this); 145 var id = $(this).data("id"); 146 $(this).addClass('liked'); 147 $.ajax({
148 type : 'POST', 149 url : theme.ajaxurl, 150 data : { 151 action: "post_like", 152 post_id: id 153 }, 154 success : function( data ){ 155 $am = $('<i class="iconfont icon-heart" style="color: #f12345;transform: scale(1) translateY(0);position: absolute;transition: .6s;opacity: 1;"></i>'); 156 icop.prepend($am); 157 showAlert(JSON.parse('{"status":1,"msg":"谢谢ç¹èµ!"}')); 158 $(".home-like-"+id).html(data); 159 $am.addClass('home-like-hide'); 160 }, 161 error:function(){ 162 showAlert(JSON.parse('{"status":4,"msg":"ç½ç»é误 --."}')); 163 } 164 }); 165 } 166 return false; 167 }); 168 //æªå¼å¯è¯¦æ 页计ç®è®¿å®¢æ¹æ³ 169 $(document).on('click', '.url-card a.is-views[data-id]', function() { 170 $.ajax({ 171 type:"GET", 172 url:theme.ajaxurl, 173 data:{ 174 action:'io_postviews', 175 postviews_id:$(this).data('id'), 176 }, 177 cache:false, 178 }); 179 }); 180 // appä¸è½½ç»è®¡ 181 var clipboard = new ClipboardJS('a.down_count', { 182 text: $(document).on('click','a.down_count', function(e) { 183 var mm = $(e.target).data('clipboard-text'); 184 $.ajax({
185 type:"POST", 186 url:theme.ajaxurl, 187 data: $(this).data(), 188 success : function( data ){ 189 $('.down-count-text').html(data); 190 } 191 }); 192 if( mm ){ 193 return mm; 194 } 195 }) 196 }); 197 clipboard.on("success",function (e) { 198 alert("ç½çå¯ç å·²å¤å¶ï¼ç¹âç¡®å®âè¿å ¥ä¸è½½é¡µé¢ã"); 199 }); 200 201 //å¤é´æ¨¡å¼ 202 /*$(document).on('click', '.switch-dark-mode', function(event) { 203 event.preventDefault(); 204 $.ajax({ 205 url: theme.ajaxurl, 206 type: 'POST', 207 dataType: 'html', 208 data: { 209 mode_toggle: $('body').hasClass('io-black-mode') === true ? 1 : 0, 210 action: 'switch_dark_mode', 211 }, 212 }) 213 .done(function(response) { 214 $('body').toggleClass('io-black-mode '+theme.defaultclass); 215 switch_mode(); 216 $("#"+ $('.switch-dark-mode').attr('aria-describedby')).remove(); 217 //$('.switch-dark-mode').removeAttr('aria-describedby'); 218 }) 219 });*/ 220 function switch_mode(){ 221 if($('body').hasClass('io-black-mode')){ 222 if($(".switch-dark-mode").attr("data-original-title")) 223 $(".switch-dark-mode").attr("data-original-title","æ¥é´æ¨¡å¼"); 224 else 225 $(".switch-dark-mode").attr("title","æ¥é´æ¨¡å¼"); 226 $(".mode-ico").removeClass("icon-night"); 227 $(".mode-ico").addClass("icon-light"); 228 } 229 else{ 230 if($(".switch-dark-mode").attr("data-original-title")) 231 $(".switch-dark-mode").attr("data-original-title","å¤é´æ¨¡å¼"); 232 else 233 $(".switch-dark-mode").attr("title","å¤é´æ¨¡å¼"); 234 $(".mode-ico").removeClass("icon-light"); 235 $(".mode-ico").addClass("icon-night"); 236 } 237 } 238 //è¿åé¡¶é¨ 239 $(window).scroll(function () { 240 if ($(this).scrollTop() >= 50) { 241 $('#go-to-up').fadeIn(200); 242 $('.big-header-banner').addClass('header-bg'); 243 } else { 244 $('#go-to-up').fadeOut(200); 245 $('.big-header-banner').removeClass('header-bg'); 246 } 247 }); 248 $('.go-up').click(function () { 249 $('body,html').animate({ 250 scrollTop: 0 251 }, 500); 252 return false; 253 }); 254 255 256 //æ»åèå 257 $('.slider_menu').children("ul").children("li").not(".anchor").hover(function() { 258 $(this).addClass("hover"), 259 //$('li.anchor').css({ 260 // transform: "scale(1.05)", 261 //}), 262 toTarget($(this).parent(),true,true) 263 }, function() { 264 //$('li.anchor').css({ 265 // transform: "scale(1)", 266 //}), 267 $(this).removeClass("hover") 268 }); 269 $('.slider_menu').mouseleave(function(e) { 270 var menu = $(this).children("ul"); 271 window.setTimeout(function() { 272 toTarget(menu,true,true) 273 }, 50) 274 }) ; 275 function intoSlider() { 276 $(".slider_menu[sliderTab]").each(function() { 277 if(!$(this).hasClass('into')){ 278 var menu = $(this).children("ul"); 279 menu.prepend('<li class="anchor" style="position:absolute;width:0;height:28px"></li>'); 280 var target = menu.find('.active').parent(); 281 if(0 < target.length){ 282 menu.children(".anchor").css({ 283 left: target.position().left + target.scrollLeft() + "px", 284 width: target.outerWidth() + "px", 285 height: target.height() + "px", 286 opacity: "1" 287 }) 288 } 289 $(this).addClass('into'); 290 } 291 }) 292 } 293 //ç²æ§é¡µè 294 function stickFooter() { 295 $('.main-footer').attr('style', ''); 296 if($('.main-footer').hasClass('text-xs')) 297 { 298 var win_height = jQuery(window).height(), 299 footer_height = $('.main-footer').outerHeight(true), 300 main_content_height = $('.main-footer').position().top + footer_height ; 301 if(win_height > main_content_height - parseInt($('.main-footer').css('marginTop'), 10)) 302 { 303 $('.main-footer').css({ 304 marginTop: win_height - main_content_height 305 }); 306 } 307 } 308 } 309 310 311 $('#sidebar-switch').on('click',function(){ 312 $('#sidebar').removeClass('mini-sidebar'); 313 //221024: è°æ´å·¦å¯¼èªå±å¼æ¶,ç¹å»å¾æ éå®å®ä½å¤±æ 314 //$('.sidebar-nav .change-href').attr('href','javascript:;'); 315 316 }); 317 318 // Trigger Resizable Function 319 var isMin = false, 320 isMobileMin = false; 321 function trigger_resizable( isNoAnim ) { 322 if( (theme.minNav == '1' && !isMin && 767.98<$(window).width() )||(!isMin && 767.98<$(window).width() && $(window).width()<1024) ){ 323 //$('#mini-button').removeAttr('checked'); 324 $('#mini-button').prop('checked', false); 325 trigger_lsm_mini(isNoAnim); 326 isMin = true; 327 if(isMobileMin){ 328 $('#sidebar').addClass('mini-sidebar'); 329 $('.sidebar-nav .change-href').each(function(){$(this).attr('href',$(this).data('change'))}); 330 isMobileMin = false; 331 } 332 } 333 else if( ( theme.minNav != '1')&&((isMin && $(window).width()>=1024) || ( isMobileMin && !isMin && $(window).width()>=1024 ) ) ){ 334 $('#mini-button').prop('checked', true); 335 trigger_lsm_mini(isNoAnim); 336 isMin = false; 337 if(isMobileMin){ 338 isMobileMin = false; 339 } 340 } 341 else if($(window).width() < 767.98 && $('#sidebar').hasClass('mini-sidebar')){ 342 $('#sidebar').removeClass('mini-sidebar'); 343 //221024: è°æ´å·¦å¯¼èªå±å¼æ¶,ç¹å»å¾æ éå®å®ä½å¤±æ 344 //$('.sidebar-nav .change-href').attr('href','javascript:;'); 345 isMobileMin = true; 346 isMin = false; 347 } 348 } 349 // sidebar-menu-inneræ¶ç¼©å±å¼ 350 $('.sidebar-menu-inner a').on('click',function(){//.sidebar-menu-inner a //.has-sub a 351 352 //console.log('--->>>'+$(this).find('span').text()); 353 if (!$('.sidebar-nav').hasClass('mini-sidebar')) {//èåæ æ²¡ææå°å 354 $(this).parent("li").siblings("li.sidebar-item").children('ul').slideUp(200); 355 if ($(this).next().css('display') == "none") { //å±å¼ 356 //å±å¼æªå±å¼ 357 // $('.sidebar-item').children('ul').slideUp(300); 358 $(this).next('ul').slideDown(200);
359 $(this).parent('li').addClass('sidebar-show').siblings('li').removeClass('sidebar-show'); 360 }else{ //æ¶ç¼© 361 //æ¶ç¼©å·²å±å¼ 362 $(this).next('ul').slideUp(200); 363 //$('.sidebar-item.sidebar-show').removeClass('sidebar-show'); 364 $(this).parent('li').removeClass('sidebar-show'); 365 } 366 } 367 }); 368 //èåæ æå°å 369 $('#mini-button').on('click',function(){ 370 trigger_lsm_mini(false); 371 372 }); 373 function trigger_lsm_mini(isNoAnim){ 374 if ($('.header-mini-btn input[type="checkbox"]').prop("checked")) { 375 $('.sidebar-nav').removeClass('mini-sidebar'); 376 //221024: è°æ´å·¦å¯¼èªå±å¼æ¶,ç¹å»å¾æ éå®å®ä½å¤±æ 377 //$('.sidebar-nav .change-href').attr('href','javascript:;'); 378 $('.sidebar-menu ul ul').css("display", "none"); 379 if(isNoAnim){ 380 $('.sidebar-nav').removeClass('animate-nav'); 381 $('.sidebar-nav').width(220); 382 } 383 else{ 384 $('.sidebar-nav').addClass('animate-nav'); 385 $('.sidebar-nav').stop().animate({width: 170},200); 386 } 387 }else{ 388 $('.sidebar-item.sidebar-show').removeClass('sidebar-show'); 389 $('.sidebar-menu ul').removeAttr('style'); 390 $('.sidebar-nav').addClass('mini-sidebar'); 391 $('.sidebar-nav .change-href').each(function(){$(this).attr('href',$(this).data('change'))}); 392 if(isNoAnim){ 393 $('.sidebar-nav').removeClass('animate-nav'); 394 $('.sidebar-nav').width(60); 395 } 396 else{ 397 $('.sidebar-nav').addClass('animate-nav'); 398 $('.sidebar-nav').stop().animate({width: 60},200); 399 } 400 } 401 //$('.sidebar-nav').css("transition","width .3s"); 402 } 403 //æ¾ç¤º2çº§æ¬æµ®èå 404 $(document).on('mouseover','.mini-sidebar .sidebar-menu ul:first>li,.mini-sidebar .flex-bottom ul:first>li',function(){ 405 var offset = 2; 406 if($(this).parents('.flex-bottom').length!=0) 407 offset = -3; 408 $(".sidebar-popup.second").length == 0 && ($("body").append("<div class='second sidebar-popup sidebar-menu-inner text-sm'><div></div></div>")); 409 $(".sidebar-popup.second>div").html($(this).html()); 410 $(".sidebar-popup.second").show(); 411 var top = $(this).offset().top - $(window).scrollTop() + offset; 412 var d = $(window).height() - $(".sidebar-popup.second>div").height(); 413 if(d - top <= 0 ){ 414 top = d >= 0 ? d - 8 : 0; 415 } 416 $(".sidebar-popup.second").stop().animate({"top":top}, 50); 417 }); 418 //éèæ¬æµ®èå颿¿ 419 $(document).on('mouseleave','.mini-sidebar .sidebar-menu ul:first, .mini-sidebar .slimScrollBar,.second.sidebar-popup',function(){ 420 $(".sidebar-popup.second").hide(); 421 }); 422 //常驻2çº§æ¬æµ®èå颿¿ 423 $(document).on('mouseover','.mini-sidebar .slimScrollBar,.second.sidebar-popup',function(){ 424 $(".sidebar-popup.second").show(); 425 }); 426 427 $(document).on('click', '.ajax-cm-home .ajax-cm', function(event) { 428 event.preventDefault(); 429 var t = $(this); 430 var id = t.data('id'); 431 var box = $(t.attr('href')).children('.site-list'); 432 //console.log(box.children('.url-card').length); 433 if( box.children('.url-card').length==0 ){ 434 t.addClass('disabled'); 435 $.ajax({
436 url: theme.ajaxurl, 437 type: 'POST', 438 dataType: 'html', 439 data : { 440 action: t.data('action'), 441 term_id: id, 442 }, 443 cache: true, 444 }) 445 .done(function(response) { 446 if (response.trim()) { 447 var url = $(response); 448 box.html(url); 449 if(isPC()) url.find('[data-toggle="tooltip"]').tooltip({ trigger: 'hover' }); 450 } else { 451 } 452 t.removeClass('disabled'); 453 }) 454 .fail(function() { 455 t.removeClass('disabled'); 456 }) 457 } 458 }); 459 460 //é¦é¡µtab模å¼è¯·æ±å 容 461 $(document).on('click', '.ajax-list a', function(event) { 462 event.preventDefault(); 463 loadAjax( $(this), $(this).parents('.ajax-list') , '.'+$(this).data('target')); 464 }); 465 466 $(document).on('click', '.ajax-list-home a', function(event) { 467 event.preventDefault(); 468 loadAjax( $(this), $(this).parents('.ajax-list-home'), '.ajax-'+$(this).parents('.ajax-list-home').data('id') ); 469 }); 470 471 function loadAjax(t,parent,body){ 472 if( !t.hasClass('active') ){ 473 parent.find('a').removeClass('active'); 474 t.addClass('active'); 475 if($(body).children(".ajax-loading").length == 0) 476 $(body).append('<div class="ajax-loading text-center rounded" style="position:absolute;display:flex;left:0;width:100%;top:-1rem;bottom:.5rem;background:rgba(125,125,125,.5)"><div class="col align-self-center"><i class="iconfont icon-loading icon-spin icon-2x"></i></div></div>'); 477 $.ajax({
478 url: theme.ajaxurl, 479 type: 'POST', 480 dataType: 'html', 481 data : t.data(), 482 cache: true, 483 }) 484 .done(function(response) { 485 if (response.trim()) { 486 $(body).html(''); 487 $(body).append(response); 488 //if(theme.lazyload == '1') { 489 // $(body+" img.lazy").lazyload(); 490 //} 491 var url = $(body).children('#ajax-cat-url').data('url'); 492 if(url) 493 t.parents('.d-flex.flex-fill.flex-tab').children('.btn-move.tab-move').show().attr('href', url); 494 else 495 t.parents('.d-flex.flex-fill.flex-tab').children('.btn-move.tab-move').hide(); 496 if(isPC()) $('.ajax-url [data-toggle="tooltip"]').tooltip({ trigger: 'hover' }); 497 } else { 498 $('.ajax-loading').remove(); 499 } 500 }) 501 .fail(function() { 502 $('.ajax-loading').remove(); 503 }) 504 } 505 } 506 507 // èªå®ä¹æ¨¡å----------------- 508 $(".add-link-form").on("submit", function() { 509 var siteName = $(".site-add-name").val() 510 , siteUrl = $(".site-add-url").val(); 511 addSiteList({ 512 id: +new Date, 513 name: siteName, 514 url: siteUrl 515 }); 516 this.reset(); 517 this.querySelector("input").focus(); 518 $(this).find(".btn-close-fm").click(); 519 }); 520 var isEdit = false; 521 $('.customize-menu .btn-edit').click(function () { 522 if(isEdit){ 523 $('.url-card .remove-site,#add-site').hide(); 524 $('.url-card .remove-site,.add-custom-site').hide(); 525 $('.url-card .remove-cm-site').hide(); 526 $('.customize-sites').removeClass('edit'); 527 ioSortable(); 528 $('.customize-menu .btn-edit').html("ç¼è¾"); 529 }else{ 530 $('.url-card .remove-site,#add-site').show(); 531 $('.url-card .remove-site,.add-custom-site').show(); 532 $('.url-card .remove-cm-site').show(); 533 $('.customize-sites').addClass('edit'); 534 ioSortable(); 535 $('.customize-menu .btn-edit').html("ç¡®å®"); 536 } 537 isEdit = !isEdit; 538 }); 539 function addSiteList(site){ 540 var sites = getItem("myLinks"); 541 //夿æ¯å¦éå¤ 542 for (var i = 0; i < sites.length; i++) { 543 if(sites[i].url==site.url) 544 { 545 showAlert(JSON.parse('{"status":4,"msg":"该ç½åå·²ç»åå¨äº --."}')); 546 return; 547 } 548 } 549 sites.unshift(site); 550 setItem(sites,"myLinks"); 551 } 552 function getItem(key) { 553 var a = window.localStorage.getItem(key); 554 return a ? a = JSON.parse(a) : []; 555 } 556 function setItem(sites,key) { 557 window.localStorage.setItem(key, JSON.stringify(sites)); 558 } 559 function intoSites(isLive) { 560 var sites = getItem( isLive ? "livelists" : "myLinks" ); 561 if(sites.length && !isLive && !$("#add-site")[0]){ 562 $(".customize_nothing.custom-site").children(".nothing").html('<a href="javascript:;" class="add-new-custom-site" data-action="add_custom_urls" data-term_name="æç导èª" data-urls="'+Base64.encode(JSON.stringify( sites ))+'" >æ¨å·²ç»å½ï¼æ£æµå°æ¨ç设å¤ä¸ææ°æ®ï¼ç¹å»<strong style="color:#db2323">忥尿å¡å¨</strong>ã</a>'); 563 return; 564 } 565 if (sites.length) { 566 for (var i = 0; i < sites.length; i++) { 567 addSite(sites[i],isLive,false); 568 } 569 } 570 } 571 function removeSite() { 572 var id = $(this).data("id"), 573 sites = getItem("myLinks"); 574 for (var i = 0; i < sites.length; i++){ 575 if ( parseInt(sites[i].id) === parseInt(id)) { 576 console.log(sites[i].id, id); 577 sites.splice(i, 1); 578 break; 579 } 580 } 581 setItem(sites,"myLinks"); 582 $(this).parent().remove(); 583 } 584 function removeLiveSite() { 585 var id = $(this).data("id"), 586 sites = getItem("livelists"); 587 for (var i = 0; i < sites.length; i++){ 588 if ( parseInt(sites[i].id) === parseInt(id)) { 589 console.log(sites[i].id, id); 590 sites.splice(i, 1); 591 break; 592 } 593 } 594 setItem(sites,"livelists"); 595 $(this).parent().remove(); 596 } 597 $(document).on('click', '.add-new-custom-site', function(event) { 598 var t = $(this); 599 $.ajax({
600 url: theme.ajaxurl, 601 type: 'POST', 602 dataType: 'json', 603 data : t.data(), 604 }) 605 .done(function(response) { 606 showAlert(response); 607 }) 608 .fail(function() { 609 showAlert(JSON.parse('{"status":4,"msg":"ç½ç»é误 --."}')); 610 }) 611 }); 612 $(".add-custom-site-form").on("submit", function() { 613 var t = $(this); 614 var tt = this; 615 var url = t.find("input[name=url]").val(); 616 var name = t.find("input[name=url_name]").val(); 617 var term_id = t.find('input:radio:checked').val(); 618 var term_name = t.find('input[name=term_name]').val(); 619 if(term_name=='' && term_id==undefined){ 620 showAlert(JSON.parse('{"status":3,"msg":"为ä»ä¹ä¸éåç±»"}')); 621 return false; 622 } 623 $.ajax({ 624 url: theme.ajaxurl, 625 type: 'POST', 626 dataType: 'json', 627 data : t.serialize()+"&action=add_custom_url", 628 }) 629 .done(function(response) { 630 if(response.status !=1){ 631 showAlert(response); 632 return; 633 } 634 var url_f,matches = url.match(/^(?:https?:\/\/)?((?:[-A-Za-z0-9]+\.)+[A-Za-z]{2,6})/); 635 if (!matches || matches.length < 2) url_f=url; 636 else { 637 url_f=matches[0]; 638 if(theme.urlformat == '1') 639 url_f = matches[1]; 640 } 641 var id = response.id; 642 var newSite = $('<div id="url-'+id+'" class="url-card sortable col-6 '+theme.classColumns+' col-xxl-10a">'+ 643 '<div class="url-body mini"><a href="'+url+'" target="_blank" class="card new-site mb-3 site-'+id+'" data-id="'+id+'" data-url="'+url+'" data-toggle="tooltip" data-placement="bottom" title="'+name+'" rel="external nofollow">'+ 644 '<div class="card-body" style="padding:0.4rem 0.5rem;">'+ 645 '<div class="url-content d-flex align-items-center">'+ 646 '<div class="url-img rounded-circle mr-2 d-flex align-items-center justify-content-center">'+ 647 '<img src="' + theme.icourl + url_f + theme.icopng + '">'+ 648 '</div>'+ 649 '<div class="url-info flex-fill">'+ 650 '<div class="text-sm overflowClip_1">'+ 651 '<strong>'+name+'</strong>'+ 652 '</div>'+ 653 '</div>'+ 654 '</div>'+ 655 '</div>'+ 656 '</a></div>' + 657 '<a href="javascript:;" class="text-center remove-cm-site" data-action="delete_custom_url" data-id="'+id+'"><i class="iconfont icon-close-circle"></i></a>'+ 658 '</div>'); 659 $(".add-custom-site[data-term_id="+term_id+"]").before(newSite); 660 tt.reset(); 661 tt.querySelector("input").focus(); 662 t.find(".btn-close-fm").click(); 663 showAlert(JSON.parse('{"status":1,"msg":"æ·»å æåã"}')); 664 }) 665 .fail(function() { 666 showAlert(JSON.parse('{"status":4,"msg":"ç½ç»é误 --."}')); 667 return; 668 }) 669 }); 670 $(document).on("click",'.url-card .remove-cm-site', function(event){ 671 var t = $(this); 672 t.addClass('disabled'); 673 $.ajax({
674 url: theme.ajaxurl, 675 type: 'POST', 676 dataType: 'json', 677 data : t.data(), 678 }) 679 .done(function(response) { 680 if(response.status == 1){ 681 t.parent().remove(); 682 } 683 t.removeClass('disabled'); 684 showAlert(response); 685 }) 686 .fail(function() { 687 t.removeClass('disabled'); 688 showAlert(JSON.parse('{"status":4,"msg":"ç½ç»é误 --."}')); 689 }) 690 }); 691 function ioSortable() { 692 if($('.customize-sites').hasClass('edit')){ 693 if(isPC()) $('.customize-sites .new-site[data-toggle="tooltip"]').tooltip('disable'); 694 //$('.customize-sites').find('a').attr('href','javascript:void(0)'); 695 $('.customize-sites .site-list').sortable({ 696 items: '.sortable', 697 containment: ".main-content", 698 //'placeholder': "ui-state-highlight", 699 update : function(e, ui) { 700 $('.customize-sites .site-list').sortable('disable'); 701 var term_id = $(this).data('term_id'); 702 var order = $(this).sortable('serialize'); 703 704 705 var queryData = { "action": "update_custom_url_order", "term_id" : term_id, "order" : order }; 706 $.ajax({
707 url: theme.ajaxurl, 708 type: 'POST', 709 data: queryData, 710 cache: false, 711 dataType: "json", 712 success: function(data){ 713 if(data.status != 1){ 714 showAlert(data); 715 } 716 $('.customize-sites .site-list').sortable('enable'); 717 }, 718 error: function(html){ 719 $('.customize-sites .site-list').sortable('enable'); 720 showAlert(JSON.parse('{"status":4,"msg":"ç½ç»é误 --."}')); 721 } 722 }); 723 724 } 725 }); 726 }else{ 727 if(isPC()) $('.customize-sites .new-site[data-toggle="tooltip"]').tooltip('enable'); 728 //$('.customize-sites').find('a').attr('href',$(this).data('url')); 729 $( ".customize-sites .site-list" ).sortable( "destroy" ); 730 } 731 732 } 733 734 $("input[name=term_name]").focus(function(){ 735 var this_input = $("input[name=term_id]"); 736 this_input.prop('checked', false); 737 }); 738 $('.form_custom_term_id').on("click", function(event){ 739 $("input[name=term_name]").val(""); 740 }); 741 $(document).on('click', '.url-card a.card', function(event) { 742 var site = { 743 id: $(this).data("id"), 744 name: $(this).find("strong").html(), 745 url: $(this).data("url") 746 }; 747 if(site.url==="") 748 return; 749 var liveList = getItem("livelists"); 750 var isNew = true; 751 for (var i = 0; i < liveList.length; i++){ 752 if (liveList[i].name === site.name) { 753 isNew = false; 754 } 755 } 756 if(isNew){ 757 var maxSite = theme.customizemax; 758 if(liveList.length > maxSite-1){ 759 $(".my-click-list .site-"+liveList[maxSite-1].id).parent().remove(); 760 liveList.splice(maxSite-1, 1); 761 } 762 addSite(site,true,true); 763 liveList.unshift(site); 764 setItem(liveList,"livelists"); 765 } 766 }); 767 // æç´¢æ¨¡å ----------------------- 768 769 function intoSearch() { 770 // 设置é»è®¤æç´¢ç±»å为ç¾åº¦æç´¢ 771 if(!window.localStorage.getItem("searchlist") && !window.localStorage.getItem("searchlistmenu")) { 772 window.localStorage.setItem("searchlist", "type-baidu"); 773 window.localStorage.setItem("searchlistmenu", "search"); 774 } 775 776 if(window.localStorage.getItem("searchlist")){ 777 $(".hide-type-list input#"+window.localStorage.getItem("searchlist")).prop('checked', true); 778 $(".hide-type-list input#m_"+window.localStorage.getItem("searchlist")).prop('checked', true); 779 } 780 if(window.localStorage.getItem("searchlistmenu")){ 781 $('.s-type-list.big label').removeClass('active'); 782 $(".s-type-list [data-id="+window.localStorage.getItem("searchlistmenu")+"]").addClass('active'); 783 } 784 toTarget($(".s-type-list.big"),false,false); 785 $('.hide-type-list .s-current').removeClass("s-current"); 786 $('.hide-type-list input:radio[name="type"]:checked').parents(".search-group").addClass("s-current"); 787 $('.hide-type-list input:radio[name="type2"]:checked').parents(".search-group").addClass("s-current"); 788 789 $(".super-search-fm").attr("action",$('.hide-type-list input:radio:checked').val()); 790 $(".search-key").attr("placeholder",$('.hide-type-list input:radio:checked').data("placeholder")); 791 if(window.localStorage.getItem("searchlist")=='type-zhannei'){ 792 $(".search-key").attr("zhannei","true"); 793 } 794 } 795 796 797 $(document).on('click', '.s-type-list label', function(event) { 798 //event.preventDefault(); 799 $('.s-type-list.big label').removeClass('active'); 800 $(this).addClass('active'); 801 window.localStorage.setItem("searchlistmenu", $(this).data("id")); 802 var parent = $(this).parents(".s-search"); 803 parent.find('.search-group').removeClass("s-current"); 804 parent.find('#'+$(this).attr("for")).parents(".search-group").addClass("s-current"); 805 toTarget($(this).parents(".s-type-list"),false,false); 806 });
807 $('.hide-type-list .search-group input').on('click', function() { 808 var parent = $(this).parents(".s-search"); 809 window.localStorage.setItem("searchlist", $(this).attr("id").replace("m_","")); 810 parent.children(".super-search-fm").attr("action",$(this).val()); 811 parent.find(".search-key").attr("placeholder",$(this).data("placeholder")); 812 813 if($(this).attr('id')=="type-zhannei" || $(this).attr('id')=="m_type-zhannei") 814 parent.find(".search-key").attr("zhannei","true"); 815 else 816 parent.find(".search-key").attr("zhannei",""); 817 818 parent.find(".search-key").select(); 819 parent.find(".search-key").focus(); 820 }); 821 $(document).on("submit", ".super-search-fm", function() { 822 var key = encodeURIComponent($(this).find(".search-key").val()) 823 if(key == "") 824 return false; 825 else{ 826 window.open( $(this).attr("action") + key); 827 return false; 828 } 829 }); 830 function getSmartTipsGoogle(value,parents) { 831 $.ajax({
832 type: "GET", 833 url: "//suggestqueries.google.com/complete/search?client=firefox&callback=iowenHot", 834 async: true, 835 data: { q: value }, 836 dataType: "jsonp", 837 jsonp: "callback", 838 success: function(res) { 839 var list = parents.children(".search-smart-tips"); 840 list.children("ul").text(""); 841 tipsList = res[1].length; 842 if (tipsList) { 843 for (var i = 0; i < tipsList; i++) { 844 list.children("ul").append("<li>" + res[1][i] + "</li>"); 845 list.find("li").eq(i).click(function() { 846 var keyword = $(this).html(); 847 parents.find(".smart-tips.search-key").val(keyword); 848 parents.children(".super-search-fm").submit(); 849 list.slideUp(200); 850 }); 851 }; 852 list.slideDown(200); 853 } else { 854 list.slideUp(200) 855 } 856 }, 857 error: function(res) { 858 tipsList = 0; 859 } 860 }) 861 } 862 function getSmartTipsBaidu(value,parents) { 863 $.ajax({
864 type: "GET", 865 url: "//sp0.baidu.com/5a1Fazu8AA54nxGko9WTAnF6hhy/su?cb=iowenHot", 866 async: true, 867 data: { wd: value }, 868 dataType: "jsonp", 869 jsonp: "cb", 870 success: function(res) { 871 var list = parents.children(".search-smart-tips"); 872 list.children("ul").text(""); 873 tipsList = res.s.length; 874 if (tipsList) { 875 for (var i = 0; i < tipsList; i++) { 876 list.children("ul").append("<li>" + res.s[i] + "</li>"); 877 list.find("li").eq(i).click(function() { 878 var keyword = $(this).html(); 879 parents.find(".smart-tips.search-key").val(keyword); 880 parents.children(".super-search-fm").submit(); 881 list.slideUp(200); 882 }); 883 }; 884 list.slideDown(200); 885 } else { 886 list.slideUp(200) 887 } 888 }, 889 error: function(res) { 890 tipsList = 0; 891 } 892 }) 893 } 894 var listIndex = -1; 895 var parent; 896 var tipsList = 0; 897 var isZhannei = false; 898 $(document).on("blur", ".smart-tips.search-key", function() { 899 parent = ''; 900 $(".search-smart-tips").delay(150).slideUp(200) 901 }); 902 $(document).on("focus", ".smart-tips.search-key", function() { 903 isZhannei = $(this).attr('zhannei')!=''?true:false; 904 parent = $(this).parents('#search'); 905 if ($(this).val() && !isZhannei) { 906 switch(theme.hotWords) { 907 case "baidu": 908 getSmartTipsBaidu($(this).val(),parent) 909 break; 910 case "google": 911 getSmartTipsGoogle($(this).val(),parent) 912 break; 913 default: 914 } 915 } 916 }); 917 $(document).on("keyup", ".smart-tips.search-key", function(e) { 918 isZhannei = $(this).attr('zhannei')!=''?true:false; 919 parent = $(this).parents('#search'); 920 if ($(this).val()) { 921 if (e.keyCode == 38 || e.keyCode == 40 || isZhannei) { 922 return 923 } 924 switch(theme.hotWords) { 925 case "baidu": 926 getSmartTipsBaidu($(this).val(),parent) 927 break; 928 case "google": 929 getSmartTipsGoogle($(this).val(),parent) 930 break; 931 default: 932 } 933 listIndex = -1; 934 } else { 935 $(".search-smart-tips").slideUp(200) 936 } 937 }); 938 $(document).on("keydown", ".smart-tips.search-key", function(e) { 939 parent = $(this).parents('#search'); 940 if (e.keyCode === 40) { 941 listIndex === (tipsList - 1) ? listIndex = 0 : listIndex++; 942 parent.find(".search-smart-tips ul li").eq(listIndex).addClass("current").siblings().removeClass("current"); 943 var hotValue = parent.find(".search-smart-tips ul li").eq(listIndex).html(); 944 parent.find(".smart-tips.search-key").val(hotValue) 945 } 946 if (e.keyCode === 38) { 947 if (e.preventDefault) { 948 e.preventDefault() 949 } 950 if (e.returnValue) { 951 e.returnValue = false 952 } 953 listIndex === 0 || listIndex === -1 ? listIndex = (tipsList - 1) : listIndex--; 954 parent.find(".search-smart-tips ul li").eq(listIndex).addClass("current").siblings().removeClass("current"); 955 var hotValue = parent.find(".search-smart-tips ul li").eq(listIndex).html(); 956 parent.find(".smart-tips.search-key").val(hotValue) 957 } 958 }); 959 $('.nav-login-user.dropdown').hover(function(){ 960 if(!$(this).hasClass('show')) 961 $(this).children('a').click(); 962 },function(){ 963 //$(this).removeClass('show'); 964 //$(this).children('a').attr('aria-expanded',false); 965 //$(this).children('.dropdown-menu').removeClass('show'); 966 });
967 $('#add-new-sites-modal').on('show.bs.modal', function (event) { 968 var button = $(event.relatedTarget); 969 var modal = $(this); 970 modal.find('[name="term_id"]').val( button.data('terms_id') ); 971 modal.find('[name="url"]').val( button.data('new_url') ); 972 modal.find('[name="url_name"]').val(''); 973 modal.find('[name="url_summary"]').removeClass('is-invalid').val(''); 974 button.data('new_url',''); 975 var _url = modal.find('[name="url"]').val(); 976 if(_url!=''){ 977 getUrlInfo(_url,modal); 978 urlStartValue = _url; 979 } 980 }); 981 var urlStartValue = ''; 982 $('#modal-new-url').on('blur',function(){ 983 var t = $(this); 984 if(t.val()!=''){ 985 if(isURL(t.val())){ 986 if(urlStartValue!=t.val()){ 987 urlStartValue = t.val(); 988 getUrlInfo(t.val(),$('.add_new_sites_modal')); 989 } 990 }else{ 991 showAlert(JSON.parse('{"status":4,"msg":"URL æ æï¼"}')); 992 } 993 } 994 }); 995 $('#modal-new-url-summary').on('blur',function(){ 996 var t = $(this); 997 if(t.val()!=''){ 998 t.removeClass('is-invalid'); 999 } 1000 }); 1001})(jQuery); 1002function isURL(URL){ 1003 var str=URL; 1004 var Expression=/http(s)?:\/\/([\w-]+\.)+[\w-]+(\/[\w- .\/?%&=]*)?/; 1005 var objExp=new RegExp(Expression); 1006 if(objExp.test(str)==true){ 1007 return true; 1008 }else{ 1009 return false; 1010 } 1011} 1012function isPC() { 1013 let u = navigator.userAgent; 1014 let Agents = ["Android", "iPhone", "webOS", "BlackBerry", "SymbianOS", "Windows Phone", "iPad", "iPod"]; 1015 let flag = true; 1016 for (let i = 0; i < Agents.length; i++) { 1017 if (u.indexOf(Agents[i]) > 0) { 1018 flag = false; 1019 break; 1020 } 1021 } 1022 return flag; 1023} 1024function chack_name(str){ 1025 //var pattern = RegExp(/[( )(\ )(\~)(\!)(\@)(\#)(\$)(\%)(\^)(\&)(\*)(\()(\))(\-)(\_)(\+)(\=)(\[)(\])(\{)(\})(\|)(\\)(\;)(\:)(\')(\")(\,)(\.)(\/)(\<)(\>)(\»)(\«)(\â)(\â)(\?)(\)]+/); 1026 var pattern = RegExp(/[( )(\ )(\~)(\!)(\@)(\#)(\$)(\%)(\^)(\*)(\()(\))(\+)(\=)(\[)(\])(\{)(\})(\\)(\;)(\:)(\')(\")(\,)(\.)(\/)(\<)(\>)(\»)(\«)(\â)(\â)(\?)(\)]+/); 1027 if (pattern.test(str)){ 1028 return true; 1029 } 1030 return false; 1031} 1032function showAlert(data) { 1033 var title,alert,ico; 1034 switch(data.status) { 1035 case 1: 1036 title = 'æå'; 1037 alert='success'; 1038 ico='icon-adopt'; 1039 break; 1040 case 2: 1041 title = 'ä¿¡æ¯'; 1042 alert='info'; 1043 ico='icon-tishi'; 1044 break; 1045 case 3: 1046 title = 'è¦å'; 1047 alert='warning'; 1048 ico='icon-warning'; 1049 break; 1050 case 4: 1051 title = 'é误'; 1052 alert='danger'; 1053 ico='icon-close-circle'; 1054 break; 1055 default: 1056 } 1057 var msg = data.msg; 1058 if(!$('#alert_placeholder').hasClass('text-sm')){ 1059 $('body').append('<div id="alert_placeholder" class="text-sm" style="position: fixed;bottom: 10px;right: 10px;z-index: 2000;text-align: right;text-align: -webkit-right"></div>') 1060 } 1061 $html = $('<div class="alert-body" style="display:none;"><div class="alert alert-'+alert+' text-lg pr-4 pr-md-5" style="text-align:initial"><i class="iconfont '+ico+' icon-lg" style="vertical-align: middle;margin-right: 10px"></i><span style="vertical-align:middle">'+title+'</span><br><span class="text-md" style="margin-left:30px;vertical-align:middle">'+msg+'</span></div></div>'); 1062 $('#alert_placeholder').append( $html );//prepend 1063 $html.show(200).delay(3500).hide(300, function(){ $(this).remove() }); 1064} 1065function toTarget(menu, padding, isMult) { 1066 var slider = menu.children(".anchor"); 1067 var target = menu.children(".hover").first() ; 1068 if (target && 0 < target.length){ 1069 } 1070 else{ 1071 if(isMult) 1072 target = menu.find('.active').parent(); 1073 else 1074 target = menu.find('.active'); 1075 } 1076 if(0 < target.length){ 1077 if(padding) 1078 slider.css({ 1079 left: target.position().left + target.scrollLeft() + "px", 1080 width: target.outerWidth() + "px", 1081 opacity: "1" 1082 }); 1083 else 1084 slider.css({ 1085 left: target.position().left + target.scrollLeft() + (target.outerWidth()/4) + "px", 1086 width: target.outerWidth()/2 + "px", 1087 opacity: "1" 1088 }); 1089 } 1090 else{ 1091 slider.css({ 1092 opacity: "0" 1093 }) 1094 } 1095} 1096var ioadindex = 0; 1097function loadingShow(parent = "body"){ 1098 if($('.load-loading')[0]){
1099 ioadindex ++; 1100 return $('.load-loading'); 1101 } 1102 var load = $('<div class="load-loading" style="display:none"><div class="bg"></div><div class="rounded-lg bg-light" style="z-index:1"><div class="spinner-border m-4" role="status"><span class="sr-only">Loading...</span></div></div></div>'); 1103 $(parent).prepend(load); 1104 load.fadeIn(200); 1105 return load; 1106} 1107function loadingHid(load){ 1108 if(ioadindex>0) 1109 ioadindex--; 1110 else{ 1111 ioadindex = 0; 1112 load.fadeOut(300,function(){ load.remove() }); 1113 } 1114} 1115function ioPopupTips(type, msg, callBack) { 1116 var ico = ''; 1117 switch(type) { 1118 case 1: 1119 ico='icon-adopt'; 1120 break; 1121 case 2: 1122 ico='icon-tishi'; 1123 break; 1124 case 3: 1125 ico='icon-warning'; 1126 break; 1127 case 4: 1128 ico='icon-close-circle'; 1129 break; 1130 default: 1131 } 1132 var c = type==1 ? 'tips-success' : 'tips-error'; 1133 var html = '<section class="io-bomb '+c+' io-bomb-sm io-bomb-open">'+ 1134 '<div class="io-bomb-overlay"></div>'+ 1135 '<div class="io-bomb-body text-center">'+ 1136 '<div class="io-bomb-content bg-white px-5"><i class="iconfont '+ico+' icon-8x"></i>'+ 1137 '<p class="text-md mt-3">'+msg+'</p>'+ 1138 '</div>'+ 1139 '</div>'+ 1140 '</section>'; 1141 var tips = $(html); 1142 $('body').addClass('modal-open').append(tips); 1143 setTimeout(function(){ 1144 $('body').removeClass('modal-open'); 1145 if ($.isFunction(callBack)) callBack(true); 1146 tips.removeClass('io-bomb-open').addClass('io-bomb-close'); 1147 setTimeout(function(){ 1148 tips.removeClass('io-bomb-close'); 1149 setTimeout(function(){ 1150 tips.remove(); 1151 }, 200); 1152 },400); 1153 },2000); 1154} 1155function ioPopup(type, html, maskStyle, btnCallBack) { 1156 var maskStyle = maskStyle ? 'style="' + maskStyle + '"' : ''; 1157 var size = ''; 1158 if( type == 'big' ){ 1159 size = 'io-bomb-lg'; 1160 }else if( type == 'no-padding' ){ 1161 size = 'io-bomb-nopd'; 1162 }else if( type == 'cover' ){ 1163 size = 'io-bomb-cover io-bomb-nopd'; 1164 }else if( type == 'full' ){ 1165 size = 'io-bomb-xl'; 1166 }else if( type == 'small' ){ 1167 size = 'io-bomb-sm'; 1168 }else if( type == 'confirm' ){ 1169 size = 'io-bomb-md'; 1170 } 1171 var template = '\ 1172 <div class="io-bomb ' + size + ' io-bomb-open">\ 1173 <div class="io-bomb-overlay" ' + maskStyle + '></div>\ 1174 <div class="io-bomb-body text-center">\ 1175 <div class="io-bomb-content bg-white">\ 1176 '+html+'\ 1177 </div>\ 1178 <div class="btn-close-bomb mt-2">\ 1179 <i class="iconfont icon-close-circle"></i>\ 1180 </div>\ 1181 </div>\ 1182 </div>\ 1183 '; 1184 var popup = $(template); 1185 $('body').addClass('modal-open').append(popup); 1186 var close = function(){ 1187 $('body').removeClass('modal-open'); 1188 $(popup).removeClass('io-bomb-open').addClass('io-bomb-close'); 1189 setTimeout(function(){ 1190 $(popup).removeClass('io-bomb-close'); 1191 setTimeout(function(){ 1192 popup.remove(); 1193 }, 200); 1194 },600); 1195 } 1196 $(popup).on('click touchstart', '.btn-close-bomb i, .io-bomb-overlay', function(event) { 1197 event.preventDefault(); 1198 if ($.isFunction(btnCallBack)) btnCallBack(true); 1199 close(); 1200 }); 1201 return popup; 1202} 1203function ioConfirm(message, btnCallBack) { 1204 var template = '\ 1205 <div class="io-bomb io-bomb-confirm io-bomb-open">\ 1206 <div class="io-bomb-overlay"></div>\ 1207 <div class="io-bomb-body">\ 1208 <div class="io-bomb-content bg-white">\ 1209 '+message+'\ 1210 <div class="text-center mt-3">\ 1211 <button class="btn btn-danger mx-2" onclick="_onclick(true);">ç¡®å®</button>\ 1212 <button class="btn btn-light mx-2" onclick="_onclick(false);">åæ¶</button>\ 1213 </div>\ 1214 </div>\ 1215 </div>\ 1216 </div>\ 1217 '; 1218 var popup = $(template); 1219 $('body').addClass('modal-open').append(popup); 1220 _onclick = function (r) { 1221 close(); 1222 if ($.isFunction(btnCallBack)) btnCallBack(r); 1223 }; 1224 var close = function(){ 1225 $('body').removeClass('modal-open'); 1226 $(popup).removeClass('io-bomb-open').addClass('io-bomb-close'); 1227 setTimeout(function(){ 1228 $(popup).removeClass('io-bomb-close'); 1229 setTimeout(function(){ 1230 popup.remove(); 1231 }, 200); 1232 }
1232,600); 1233 } 1234 return popup; 1235} 1236 1237/** 1238 * Minified by jsDelivr using Terser v5.3.5. 1239 * Original file: /npm/[email protected]/base64.js 1240 * 1241 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files 1242 */ 1243!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):function(){const r=e.Base64,o=t();o.noConflict=()=>(e.Base64=r,o),e.Meteor&&(Base64=o),e.Base64=o}()}("undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:this,(function(){"use strict";const e="3.6.0",t="function"==typeof atob,r="function"==typeof btoa,o="function"==typeof Buffer,n="function"==typeof TextDecoder?new TextDecoder:void 0,a="function"==typeof TextEncoder?new TextEncoder:void 0,f=[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="],i=(e=>{let t={};return e.forEach(((e,r)=>t[e]=r)),t})(f),c=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,u=String.fromCharCode.bind(String),s="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):(e,t=(e=>e))=>new Uint8Array(Array.prototype.slice.call(e,0).map(t)),d=e=>e.replace(/[+\/]/g,(e=>"+"==e?"-":"_")).replace(/=+$/m,""),l=e=>e.replace(/[^A-Za-z0-9\+\/]/g,""),h=e=>{let t,r,o,n,a="";const i=e.length%3;for(let i=0;i<e.length;){if((r=e.charCodeAt(i++))>255||(o=e.charCodeAt(i++))>255||(n=e.charCodeAt(i++))>255)throw new TypeError("invalid character found");t=r<<16|o<<8|n,a+=f[t>>18&63]+f[t>>12&63]+f[t>>6&63]+f[63&t]}return i?a.slice(0,i-3)+"===".substring(i):a},p=r?e=>btoa(e):o?e=>Buffer.from(e,"binary").toString("base64"):h,y=o?e=>Buffer.from(e).toString("base64"):e=>{let t=[];for(let r=0,o=e.length;r<o;r+=4096)t.push(u.apply(null,e.subarray(r,r+4096)));return p(t.join(""))},A=(e,t=!1)=>t?d(y(e)):y(e),b=e=>{if(e.length<2)return(t=e.charCodeAt(0))<128?e:t<2048?u(192|t>>>6)+u(128|63&t):u(224|t>>>12&15)+u(128|t>>>6&63)+u(128|63&t);var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return u(240|t>>>18&7)+u(128|t>>>12&63)+u(128|t>>>6&63)+u(128|63&t)},g=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,B=e=>e.replace(g,b),x=o?e=>Buffer.from(e,"utf8").toString("base64"):a?e=>y(a.encode(e)):e=>p(B(e)),C=(e,t=!1)=>t?d(x(e)):x(e),m=e=>C(e,!0),U=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,F=e=>{switch(e.length){case 4:var t=((7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3))-65536;return u(55296+(t>>>10))+u(56320+(1023&t));case 3:return u((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return u((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},w=e=>e.replace(U,F),S=e=>{if(e=e.replace(/\s+/g,""),!c.test(e))throw new TypeError("malformed base64.");e+="==".slice(2-(3&e.length));let t,r,o,n="";for(let a=0;a<e.length;)t=i[e.charAt(a++)]<<18|i[e.charAt(a++)]<<12|(r=i[e.charAt(a++)])<<6|(o=i[e.charAt(a++)]),n+=64===r?u(t>>16&255):64===o?u(t>>16&255,t>>8&255):u(t>>16&255,t>>8&255,255&t);return n},E=t?e=>atob(l(e)):o?e=>Buffer.from(e,"base64").toString("binary"):S,v=o?e=>s(Buffer.from(e,"base64")):e=>s(E(e),(e=>e.charCodeAt(0))),D=e=>v(z(e)),R=o?e=>Buffer.from(e,"base64").toString("utf8"):n?e=>n.decode(v(e)):e=>w(E(e)),z=e=>l(e.replace(/[-_]/g,(e=>"-"==e?"+":"/"))),T=e=>R(z(e)),Z=e=>({value:e,enumerable:!1,writable:!0,configurable:!0}),j=function(){const e=(e,t)=>Object.defineProperty(String.prototype,e,Z(t));e("fromBase64",(function(){return T(this)})),e("toBase64",(function(e){return C(this,e)})),e("toBase64URI",(function(){return C(this,!0)})),e("toBase64URL",(function(){return C(this,!0)})),e("toUint8Array",(function(){return D(this)}))},I=function(){const e=(e,t)=>Object.defineProperty(Uint8Array.prototype,e,Z(t));e("toBase64",(function(e){return A(this,e)})),e("toBase64URI",(function(){return A(this,!0)})),e("toBase64URL",(function(){return A(this,!0)}))},O={version:e,VERSION:"3.6.0",atob:E,atobPolyfill:S,btoa:p,btoaPolyfill:h,fromBase64:T,toBase64:C,encode:C,encodeURI:m,encodeURL:m,utob:B,btou:w,decode:T,isValid:e=>{if("string"!=typeof e)return!1;const t=e.replace(/\s+/g,"").replace(/=+$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(t)||!/[^\s0-9a-zA-Z\-_]/.test(t)},fromUint8Array:A,toUint8Array:D,extendString:j,extendUint8Array:I,extendBuiltins:()=>{j(),I()},Base64:{}};return Object.keys(O).forEach((e=>O.Base64[e]=O[e])),O})); 1244/** 1245 * Chrome Bookmarks Converter 1246 * v1.0.0 1247 * 1248 * Convert a standard exported Google Chrome bookmarks HTML file into a JavaScript oject structure. 1249 * 1250 * Dependencies: jQuery (latest). 1251 * 1252 * @summary Use JavaScript to convert an exported Chrome bookmarks HTML file. Export the results to JSON. 1253 * @author Jason Snelders <[email protected]> 1254 * 1255 * Created at : 2019-11-14 22:34:00 1256 * Last modified : 2019-11-14 22:34:00 1257 */ 1258function ChromBookmarkConverter(){this.bookmarks={folders:[]},this.stripUnneededTags=function(a){return a=a.replace(/<p>/gi,""),a=a.replace(/<P>/gi,""),a=a.replace(/<dt>/gi,""),a=a.replace(/<DT>/gi,"")},this.processChromeBookmarksContent=function(a){var c,b=this;a=this.stripUnneededTags(a),c=$.parseHTML(a),$.each(c,function(a,c){if("DL"==c.tagName){var d={type:"folder",title:"æªå½å",items:[]};b.bookmarks.folders.push(d),b.processDL(c,1,d)}})},this.processDL=function(a,b,c){var d=this,e=0,f={},g={type:"folder",title:"",add_date:"",last_modified:"",items:[]},h={},i=$(a),j=!1;$.each(i.children(),function(a,i){var k,l,m,n,o,p,q,r,s;e+=1,k=b+"."+e,1==j&&i.tagName.toLowerCase()!="DL".toLowerCase()&&(j=!1,console.log("h3",f),g.items.push(f)),i.tagName.toLowerCase()=="DL".toLowerCase()&&(g={type:"folder",title:f.title,add_date:f.add_date,last_modified:f.last_modified,items:[]},1==j&&(j=!1),d.bookmarks.folders.push(g),d.processDL(i,k,g)),i.tagName.toLowerCase()=="H3".toLowerCase()&&(l=$(i),m=l.text()?l.text():"æªå½å",n=l.attr("add_date"),o=l.attr("last_modified"),f={type:"header",title:m,add_date:n,last_modified:o},j=!0),"a"==i.tagName.toLowerCase()&&isURL($(i).attr("href"))&&""!=$(i).text()&&(p=$(i),q=p.text(),r=p.attr("href"),s=p.attr("add_date"),p.attr("icon"),h={type:"link",title:q,href:r,add_date:s},c.items.push(h))})}}
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.