1<!DOCTYPE html> 2 3 4 5 6<html class="theme-next mist" lang="zh-Hans"> 7<head><meta name="generator" content="Hexo 3.9.0"> 8 <meta charset="UTF-8"> 9<meta http-equiv="X-UA-Compatible" content="IE=edge"> 10<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> 11<meta name="theme-color" content="#222"> 12 13 14 15 16 17 18 19 20 21<meta http-equiv="Cache-Control" content="no-transform"> 22<meta http-equiv="Cache-Control" content="no-siteapp"> 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css"> 42 43 44 45 46 47 48 49<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css"> 50 51<link href="/css/main.css?v=5.1.4" rel="stylesheet" type="text/css"> 52 53 54 <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=5.1.4"> 55 56 57 <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png?v=5.1.4"> 58 59 60 <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png?v=5.1.4"> 61 62 63 <link rel="mask-icon" href="/images/logo.svg?v=5.1.4" color="#222"> 64 65 66 67 68 69 <meta name="keywords" content="Hexo, NexT"> 70 71 72 73 74 75 <link rel="alternate" href="/atom.xml" title="èåå¹³" type="application/atom+xml"> 76 77 78 79 80 81 82<meta name="description" content="Android, Java"> 83<meta name="keywords" content="æ»´æ»´åå"> 84<meta property="og:type" content="website"> 85<meta property="og:title" content="èåå¹³"> 86<meta property="og:url" content="http://wjploop.github.io/archives/index.html"> 87<meta property="og:site_name" content="èåå¹³"> 88<meta property="og:description" content="Android, Java"> 89<meta property="og:locale" content="zh-Hans"> 90<meta name="twitter:card" content="summary"> 91<meta name="twitter:title" content="èåå¹³"> 92<meta name="twitter:description" content="Android, Java"> 93 94 95
96<script type="text/javascript" id="hexo.configurations"> 97 var NexT = window.NexT || {}; 98 var CONFIG = { 99 root: '/', 100 scheme: 'Mist', 101 version: '5.1.4', 102 sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false}, 103 fancybox: true, 104 tabs: true, 105 motion: {"enable":false,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}}, 106 duoshuo: { 107 userId: '0', 108 author: 'å主' 109 }, 110 algolia: { 111 applicationID: '', 112 apiKey: '', 113 indexName: '', 114 hits: {"per_page":10}, 115 labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"} 116 } 117 }; 118</script>
118 119 120 121 122 <link rel="canonical" href="http://wjploop.github.io/archives/"> 123 124 125 126 127 128 <title>彿¡£ | èåå¹³</title> 129 130 131 132 133 134 135
135<script type="text/javascript"> 136 var _hmt = _hmt || []; 137 (function() { 138 var hm = document.createElement("script"); 139 hm.src = "https://hm.baidu.com/hm.js?478e3d64eb01e301d525f47d26394d76"; 140 var s = document.getElementsByTagName("script")[0]; 141 s.parentNode.insertBefore(hm, s); 142 })(); 143 </script>
143 144 145 146 147 148</head> 149 150<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans"> 151 152 153 154 155 156 157 <div class="container sidebar-position-left page-archive"> 158 <div class="headband"></div> 159 160 <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader"> 161 <div class="header-inner"><div class="site-brand-wrapper"> 162 <div class="site-meta "> 163 164 165 <div class="custom-logo-site-title"> 166 <a href="/" class="brand" rel="start"> 167 <span class="logo-line-before"><i></i></span> 168 <span class="site-title">èåå¹³</span> 169 <span class="logo-line-after"><i></i></span> 170 </a> 171 </div> 172 173 <p class="site-subtitle">没æ³å¥½çä¸ä¸ªå¯æ é¢</p> 174 175 </div> 176 177 <div class="site-nav-toggle"> 178 <button> 179 <span class="btn-bar"></span> 180 <span class="btn-bar"></span> 181 <span class="btn-bar"></span> 182 </button> 183 </div> 184</div> 185 186<nav class="site-nav"> 187 188 189 190 <ul id="menu" class="menu"> 191 192 193 <li class="menu-item menu-item-home"> 194 <a href="/" rel="section"> 195 196 <i class="menu-item-icon fa fa-fw fa-home"></i> <br> 197 198 é¦é¡µ 199 </a> 200 </li> 201 202 203 <li class="menu-item menu-item-archives"> 204 <a href="/archives/" rel="section"> 205 206 <i class="menu-item-icon fa fa-fw fa-archive"></i> <br> 207 208 彿¡£ 209 </a> 210 </li> 211 212 213 <li class="menu-item menu-item-tags"> 214 <a href="/tags/" rel="section"> 215 216 <i class="menu-item-icon fa fa-fw fa-tags"></i> <br> 217 218 æ ç¾ 219 </a> 220 </li> 221 222 223 <li class="menu-item menu-item-categories"> 224 <a href="/categories/" rel="section"> 225 226 <i class="menu-item-icon fa fa-fw fa-th"></i> <br> 227 228 åç±» 229 </a> 230 </li> 231 232 233 <li class="menu-item menu-item-about"> 234 <a href="/about/" rel="section"> 235 236 <i class="menu-item-icon fa fa-fw fa-user"></i> <br> 237 238 å ³äº 239 </a> 240 </li> 241 242 243 244 <li class="menu-item menu-item-search"> 245 246 <a href="javascript:;" class="popup-trigger"> 247 248 249 <i class="menu-item-icon fa fa-search fa-fw"></i> <br> 250 251 æç´¢ 252 </a> 253 </li> 254 255 </ul> 256 257 258 259 <div class="site-search"> 260 261 <div class="popup search-popup local-search-popup"> 262 <div class="local-search-header clearfix"> 263 <span class="search-icon"> 264 <i class="fa fa-search"></i> 265 </span> 266 <span class="popup-btn-close"> 267 <i class="fa fa-times-circle"></i> 268 </span> 269 <div class="local-search-input-wrapper"> 270 <input autocomplete="off" placeholder="æç´¢..." spellcheck="false" type="text" id="local-search-input"> 271 </div> 272 </div> 273 <div id="local-search-result"></div> 274</div> 275 276 277 278 </div> 279 280</nav> 281 282 283 284 </div> 285 </header> 286 287 <main id="main" class="main"> 288 <div class="main-inner"> 289 <div class="content-wrap"> 290 <div id="content" class="content"> 291 292 293 294 295 296 <div class="post-block archive"> 297 <div id="posts" class="posts-collapse"> 298 <span class="archive-move-on"></span> 299 300 <span class="archive-page-counter"> 301 302 303 304 305 OK! ç®åå ±è®¡ 50 ç¯æ¥å¿ã ç»§ç»åªåã 306 </span> 307 308 309 310 311 312 313 314 315 316 <div class="collection-title"> 317 <h1 class="archive-year" id="archive-year-2022">2022</h1> 318 </div> 319 320 321 322 323 324 <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article"> 325 <header class="post-header"> 326 327 <h2 class="post-title"> 328 329 <a class="post-title-link" href="/2022/06/15/误å 两è¡ä»£ç å¼åçæµéViewé®é¢/" itemprop="url"> 330 331 <span itemprop="name">误å 两è¡ä»£ç å¼åçæµéViewé®é¢</span> 332 333 </a> 334 335 </h2> 336 337 <div class="post-meta"> 338 <time class="post-time" itemprop="dateCreated" datetime="2022-06-15T20:15:49+08:00" content="2022-06-15"> 339 06-15 340 </time> 341 </div> 342 343 </header> 344 </article> 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article"> 360 <header class="post-header"> 361 362 <h2 class="post-title"> 363 364 <a class="post-title-link" href="/2022/04/06/å¹³éçæè§/" itemprop="url"> 365
366 <span itemprop="name">å¹³éçæè§</span> 367 368 </a> 369 370 </h2> 371 372 <div class="post-meta"> 373 <time class="post-time" itemprop="dateCreated" datetime="2022-04-06T11:13:42+08:00" content="2022-04-06"> 374 04-06 375 </time> 376 </div> 377 378 </header> 379 </article> 380 381 382 383 384 385 386 387 388 389 390 391 <div class="collection-title"> 392 <h1 class="archive-year" id="archive-year-2021">2021</h1> 393 </div> 394 395 396 397 398 399 <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article"> 400 <header class="post-header"> 401 402 <h2 class="post-title"> 403 404 <a class="post-title-link" href="/2021/09/10/dart弿¥ç¼ç¨ï¼Isolateåäºä»¶å¾ªç¯ï¼è¯ï¼/" itemprop="url"> 405 406 <span itemprop="name">dart弿¥ç¼ç¨ï¼Isolateåäºä»¶å¾ªç¯ï¼è¯ï¼</span> 407 408 </a> 409 410 </h2> 411 412 <div class="post-meta"> 413 <time class="post-time" itemprop="dateCreated" datetime="2021-09-10T15:21:53+08:00" content="2021-09-10"> 414 09-10 415 </time> 416 </div> 417 418 </header> 419 </article> 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article"> 435 <header class="post-header"> 436 437 <h2 class="post-title"> 438 439 <a class="post-title-link" href="/2021/08/28/è°è°å¯¹å£°æå¼æ¡æ¶ççè§£/" itemprop="url"> 440 441 <span itemprop="name">è°è°å¯¹å£°æå¼æ¡æ¶ççè§£</span> 442 443 </a> 444 445 </h2> 446 447 <div class="post-meta"> 448 <time class="post-time" itemprop="dateCreated" datetime="2021-08-28T16:58:51+08:00" content="2021-08-28"> 449 08-28 450 </time> 451 </div> 452 453 </header> 454 </article> 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article"> 470 <header class="post-header"> 471 472 <h2 class="post-title"> 473 474 <a class="post-title-link" href="/2021/08/02/è¿½ãæ°ä¸çºªç¦é³æå£«ãååäºä¸ä¸ªå¥æªç梦â/" itemprop="url"> 475 476 <span itemprop="name">è¿½ãæ°ä¸çºªç¦é³æå£«ãååäºä¸ä¸ªå¥æªç梦â</span> 477 478 </a> 479 480 </h2> 481 482 <div class="post-meta"> 483 <time class="post-time" itemprop="dateCreated" datetime="2021-08-02T10:57:15+08:00" content="2021-08-02"> 484 08-02 485 </time> 486 </div> 487 488 </header> 489 </article> 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article"> 505 <header class="post-header"> 506 507 <h2 class="post-title"> 508 509 <a class="post-title-link" href="/2021/07/28/OKHttp-ææ¡£ç¯/" itemprop="url"> 510 511 <span itemprop="name">OKHttp ææ¡£ç¯</span> 512 513 </a> 514 515 </h2> 516 517 <div class="post-meta"> 518 <time class="post-time" itemprop="dateCreated" datetime="2021-07-28T14:03:07+08:00" content="2021-07-28"> 519 07-28 520 </time> 521 </div> 522 523 </header> 524 </article> 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article"> 540 <header class="post-header"> 541 542 <h2 class="post-title"> 543 544 <a class="post-title-link" href="/2021/07/10/SAM-conversion æ¯ä»ä¹/" itemprop="url"> 545 546 <span itemprop="name">SAM-conversion æ¯ä»ä¹</span> 547 548 </a> 549 550 </h2> 551 552 <div class="post-meta"> 553 <time class="post-time" itemprop="dateCreated" datetime="2021-07-10T15:08:41+08:00" content="2021-07-10"> 554 07-10 555 </time> 556 </div> 557 558 </header> 559 </article> 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article"> 575 <header class="post-header"> 576 577 <h2 class="post-title"> 578
579 <a class="post-title-link" href="/2021/07/10/Retrofit/" itemprop="url"> 580 581 <span itemprop="name">Retrofit</span> 582 583 </a> 584 585 </h2> 586 587 <div class="post-meta"> 588 <time class="post-time" itemprop="dateCreated" datetime="2021-07-10T15:08:41+08:00" content="2021-07-10"> 589 07-10 590 </time> 591 </div> 592 593 </header> 594 </article> 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article"> 610 <header class="post-header"> 611 612 <h2 class="post-title"> 613 614 <a class="post-title-link" href="/2021/07/07/SparseArray-vs-HashMap/" itemprop="url"> 615 616 <span itemprop="name">SparseArray vs HashMap</span> 617 618 </a> 619 620 </h2> 621 622 <div class="post-meta"> 623 <time class="post-time" itemprop="dateCreated" datetime="2021-07-07T16:18:29+08:00" content="2021-07-07"> 624 07-07 625 </time> 626 </div> 627 628 </header> 629 </article> 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article"> 645 <header class="post-header"> 646 647 <h2 class="post-title"> 648 649 <a class="post-title-link" href="/2021/06/19/å ³äºå¹¶å/" itemprop="url"> 650 651 <span itemprop="name">å ³äºå¹¶å</span> 652 653 </a> 654 655 </h2> 656 657 <div class="post-meta"> 658 <time class="post-time" itemprop="dateCreated" datetime="2021-06-19T15:50:13+08:00" content="2021-06-19"> 659 06-19 660 </time> 661 </div> 662 663 </header> 664 </article> 665 666 667 668 669 670 </div> 671 </div> 672 673 674 675 676 677 <nav class="pagination"> 678 <span class="page-number current">1</span><a class="page-number" href="/archives/page/2/">2</a><span class="space">…</span><a class="page-number" href="/archives/page/5/">5</a><a class="extend next" rel="next" href="/archives/page/2/"><i class="fa fa-angle-right"></i></a> 679 </nav> 680 681 682 683 684 </div> 685 686 687 688 689 690 </div> 691 692 693 694 <div class="sidebar-toggle"> 695 <div class="sidebar-toggle-line-wrap"> 696 <span class="sidebar-toggle-line sidebar-toggle-line-first"></span> 697 <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span> 698 <span class="sidebar-toggle-line sidebar-toggle-line-last"></span> 699 </div> 700 </div> 701 702 <aside id="sidebar" class="sidebar"> 703 704 <div class="sidebar-inner"> 705 706 707 708 709 710 <section class="site-overview-wrap sidebar-panel sidebar-panel-active"> 711 <div class="site-overview"> 712 <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person"> 713 714 <img class="site-author-image" itemprop="image" src="/images/avatar.jpeg" alt="èåå¹³"> 715 716 <p class="site-author-name" itemprop="name">èåå¹³</p> 717 <p class="site-description motion-element" itemprop="description">Android, Java</p> 718 </div> 719 720 <nav class="site-state motion-element"> 721 722 723 <div class="site-state-item site-state-posts"> 724 725 <a href="/archives/"> 726 727 <span class="site-state-item-count">50</span> 728 <span class="site-state-item-name">æ¥å¿</span> 729 </a> 730 </div> 731 732 733 734 735 736 <div class="site-state-item site-state-categories"> 737 <a href="/categories/index.html"> 738 <span class="site-state-item-count">3</span> 739 <span class="site-state-item-name">åç±»</span> 740 </a> 741 </div> 742 743 744 745 746 747 <div class="site-state-item site-state-tags"> 748 <a href="/tags/index.html"> 749 <span class="site-state-item-count">18</span>
750 <span class="site-state-item-name">æ ç¾</span> 751 </a> 752 </div> 753 754 755 </nav> 756 757 758 <div class="feed-link motion-element"> 759 <a href="/atom.xml" rel="alternate"> 760 <i class="fa fa-rss"></i> 761 RSS 762 </a> 763 </div> 764 765 766 767 <div class="links-of-author motion-element"> 768 769 <span class="links-of-author-item"> 770 <a href="https://github.com/wjploop" target="_blank" title="GitHub"> 771 GitHub</a> 772 </span> 773 774 <span class="links-of-author-item"> 775 <a href="mailto:[email protected]" target="_blank" title="E-Mail"> 776 E-Mail</a> 777 </span> 778 779 <span class="links-of-author-item"> 780 <a href="https://plus.google.com/wjploop" target="_blank" title="Google"> 781 Google</a> 782 </span> 783 784 </div> 785 786 787 788 789 790 791 792 793 794 795 </div> 796 </section> 797 798 799 800 801 802 </div> 803 </aside> 804 805 806 807 </div> 808 </main> 809 810 <footer id="footer" class="footer"> 811 <div class="footer-inner"> 812 <div class="copyright">© <span itemprop="copyrightYear">2023</span> 813 <span class="with-love"> 814 <i class="fa fa-user"></i> 815 </span> 816 <span class="author" itemprop="copyrightHolder">èåå¹³</span> 817 818 819 <span class="post-meta-divider">|</span> 820 <span class="post-meta-item-icon"> 821 <i class="fa fa-area-chart"></i> 822 </span> 823 824 <span class="post-meta-item-text">Site words total count:</span> 825 826 <span title="Site words total count">60.6k</span> 827 828</div> 829 830 831 <div class="powered-by">ç± <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a> 强å驱å¨</div> 832 833 834 835 <span class="post-meta-divider">|</span> 836 837 838 839 <div class="theme-info">ä¸»é¢ — <a class="theme-link" target="_blank" href="https://github.com/iissnan/hexo-theme-next">NexT.Mist</a> v5.1.4</div> 840 841 842 843 844 845<div class="busuanzi-count"> 846
846<script async src="https://dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>
846 847 848 849 <span class="site-uv"> 850 <i class="fa fa-user"></i> 851 <span class="busuanzi-value" id="busuanzi_value_site_uv"></span> 852 853 </span> 854 855 856 857 <span class="site-pv"> 858 <i class="fa fa-eye"></i> 859 <span class="busuanzi-value" id="busuanzi_value_site_pv"></span> 860 861 </span> 862 863</div> 864 865 866 867 868 869 870 871 872 873 </div> 874 </footer> 875 876 877 <div class="back-to-top"> 878 <i class="fa fa-arrow-up"></i> 879 880 </div> 881 882 883 884 885 </div> 886 887 888
889<script type="text/javascript"> 890 if (Object.prototype.toString.call(window.Promise) !== '[object Function]') { 891 window.Promise = null; 892 } 893</script>
893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918
918<script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>
918 919 920 921 922 923
923<script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
923 924 925 926 927 928
928<script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
928 929 930 931 932 933
933<script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
933 934 935 936 937 938
938<script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
938 939 940 941 942 943
943<script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
943 944 945 946 947 948 949 950
950<script type="text/javascript" src="/js/src/utils.js?v=5.1.4"></script>
950 951 952
952<script type="text/javascript" src="/js/src/motion.js?v=5.1.4"></script>
952 953 954 955 956 957 958 959 960 961 962 963 964
964<script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.4"></script>
964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999
999<script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
999 1000
1000<script src="//unpkg.com/valine/dist/Valine.min.js"></script>
1000 1001 1002
1002<script type="text/javascript"> 1003 var GUEST = ['nick','mail','link']; 1004 var guest = 'nick,'; 1005 guest = guest.split(',').filter(item=>{ 1006 return GUEST.indexOf(item)>-1; 1007 }); 1008 new Valine({ 1009 el: '#comments' , 1010 verify: false, 1011 notify: false, 1012 appId: 'VipNTLR7JbL6sNRHDHVjzSIo-gzGzoHsz', 1013 appKey: 'cIR7F3k3JyRsMwF8Lto5UtT7', 1014 placeholder: '说ç¹ä»ä¹ï¼', 1015 avatar:'mm', 1016 guest_info:guest, 1017 pageSize:'10' || 10, 1018 }); 1019 </script>
1019 1020 1021 1022 1023 1024 1025
1025<script type="text/javascript"> 1026 // Popup Window; 1027 var isfetched = false; 1028 var isXml = true; 1029 // Search DB path; 1030 var search_path = "search.xml"; 1031 if (search_path.length === 0) { 1032 search_path = "search.xml"; 1033 } else if (/json$/i.test(search_path)) { 1034 isXml = false; 1035 } 1036 var path = "/" + search_path; 1037 // monitor main search box; 1038 1039 var onPopupClose = function (e) { 1040 $('.popup').hide(); 1041 $('#local-search-input').val(''); 1042 $('.search-result-list').remove(); 1043 $('#no-result').remove(); 1044 $(".local-search-pop-overlay").remove(); 1045 $('body').css('overflow', ''); 1046 } 1047 1048 function proceedsearch() { 1049 $("body") 1050 .append('<div class="search-popup-overlay local-search-pop-overlay"></div>') 1051 .css('overflow', 'hidden'); 1052 $('.search-popup-overlay').click(onPopupClose); 1053 $('.popup').toggle(); 1054 var $localSearchInput = $('#local-search-input'); 1055 $localSearchInput.attr("autocapitalize", "none"); 1056 $localSearchInput.attr("autocorrect", "off"); 1057 $localSearchInput.focus(); 1058 } 1059 1060 // search function; 1061 var searchFunc = function(path, search_id, content_id) { 1062 'use strict'; 1063 1064 // start loading animation 1065 $("body") 1066 .append('<div class="search-popup-overlay local-search-pop-overlay">' + 1067 '<div id="search-loading-icon">' + 1068 '<i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>' + 1069 '</div>' + 1070 '</div>') 1071 .css('overflow', 'hidden'); 1072 $("#search-loading-icon").css('margin', '20% auto 0 auto').css('text-align', 'center'); 1073 1074 $.ajax({ 1075 url: path, 1076 dataType: isXml ? "xml" : "json", 1077 async: true, 1078 success: function(res) { 1079 // get the contents from search data 1080 isfetched = true; 1081 $('.popup').detach().appendTo('.header-inner'); 1082 var datas = isXml ? $("entry", res).map(function() { 1083 return { 1084 title: $("title", this).text(), 1085 content: $("content",this).text(), 1086 url: $("url" , this).text() 1087 }; 1088 }).get() : res; 1089 var input = document.getElementById(search_id); 1090 var resultContent = document.getElementById(content_id); 1091 var inputEventFunction = function() { 1092 var searchText = input.value.trim().toLowerCase(); 1093 var keywords = searchText.split(/[\s\-]+/); 1094 if (keywords.length > 1) { 1095 keywords.push(searchText); 1096 } 1097 var resultItems = []; 1098 if (searchText.length > 0) { 1099 // perform local searching 1100 datas.forEach(function(data) { 1101 var isMatch = false; 1102 var hitCount = 0; 1103 var searchTextCount = 0; 1104 var title = data.title.trim(); 1105 var titleInLowerCase = title.toLowerCase(); 1106 var content = data.content.trim().replace(/<[^>]+>/g,""); 1107 var contentInLowerCase = content.toLowerCase(); 1108 var articleUrl = decodeURIComponent(data.url); 1109 var indexOfTitle = []; 1110 var indexOfContent = []; 1111 // only match articles with not empty titles 1112 if(title != '') { 1113 keywords.forEach(function(keyword) { 1114 function getIndexByWord(word, text, caseSensitive) { 1115 var wordLen = word.length; 1116 if (wordLen === 0) { 1117 return []; 1118 } 1119 var startPosition = 0, position = [], index = []; 1120 if (!caseSensitive) { 1121 text = text.toLowerCase(); 1122 word = word.toLowerCase(); 1123 } 1124 while ((position = text.indexOf(word, startPosition)) > -1) { 1125 index.push({position: position, word: word}); 1126 startPosition = position + wordLen; 1127 } 1128 return index; 1129 } 1130 1131 indexOfTitle = indexOfTitle.concat(getIndexByWord(keyword, titleInLowerCase, false)); 1132 indexOfContent = indexOfContent.concat(getIndexByWord(keyword, contentInLowerCase, false)); 1133 }); 1134 if (indexOfTitle.length > 0 || indexOfContent.length > 0) { 1135 isMatch = true; 1136 hitCount = indexOfTitle.length + indexOfContent.length; 1137 } 1138 } 1139 1140 // show search results 1141 1142 if (isMatch) { 1143 // sort index by position of keyword 1144 1145 [indexOfTitle, indexOfContent].forEach(function (index) { 1146 index.sort(function (itemLeft, itemRight) { 1147 if (itemRight.position !== itemLeft.position) { 1148 return itemRight.position - itemLeft.position; 1149 } else { 1150 return itemLeft.word.length - itemRight.word.length; 1151 } 1152 }); 1153 }); 1154 1155 // merge hits into slices 1156 1157 function mergeIntoSlice(text, start, end, index) { 1158 var item = index[index.length - 1]; 1159 var position = item.position; 1160 var word = item.word; 1161 var hits = []; 1162 var searchTextCountInSlice = 0; 1163 while (position + word.length <= end && index.length != 0) { 1164 if (word === searchText) { 1165 searchTextCountInSlice++; 1166 } 1167 hits.push({position: position, length: word.length}); 1168 var wordEnd = position + word.length; 1169 1170 // move to next position of hit 1171 1172 index.pop(); 1173 while (index.length != 0) { 1174 item = index[index.length - 1]; 1175 position = item.position; 1176 word = item.word; 1177 if (wordEnd > position) { 1178 index.pop(); 1179 } else { 1180 break; 1181 } 1182 } 1183 } 1184 searchTextCount += searchTextCountInSlice; 1185 return { 1186 hits: hits, 1187 start: start, 1188 end: end, 1189 searchTextCount: searchTextCountInSlice 1190 }; 1191 } 1192 1193 var slicesOfTitle = []; 1194 if (indexOfTitle.length != 0) { 1195 slicesOfTitle.push(mergeIntoSlice(title, 0, title.length, indexOfTitle)); 1196 } 1197 1198 var slicesOfContent = []; 1199 while (indexOfContent.length != 0) { 1200 var item = indexOfContent[indexOfContent.length - 1]; 1201 var position = item.position; 1202 var word = item.word; 1203 // cut out 100 characters 1204 var start = position - 20; 1205 var end = position + 80; 1206 if(start < 0){ 1207 start = 0; 1208 } 1209 if (end < position + word.length) { 1210 end = position + word.length; 1211 } 1212 if(end > content.length){ 1213 end = content.length; 1214 } 1215 slicesOfContent.push(mergeIntoSlice(content, start, end, indexOfContent)); 1216 } 1217
1218 // sort slices in content by search text's count and hits' count 1219 1220 slicesOfContent.sort(function (sliceLeft, sliceRight) { 1221 if (sliceLeft.searchTextCount !== sliceRight.searchTextCount) { 1222 return sliceRight.searchTextCount - sliceLeft.searchTextCount; 1223 } else if (sliceLeft.hits.length !== sliceRight.hits.length) { 1224 return sliceRight.hits.length - sliceLeft.hits.length; 1225 } else { 1226 return sliceLeft.start - sliceRight.start; 1227 } 1228 }); 1229 1230 // select top N slices in content 1231 1232 var upperBound = parseInt('1'); 1233 if (upperBound >= 0) { 1234 slicesOfContent = slicesOfContent.slice(0, upperBound); 1235 } 1236 1237 // highlight title and content 1238 1239 function highlightKeyword(text, slice) { 1240 var result = ''; 1241 var prevEnd = slice.start; 1242 slice.hits.forEach(function (hit) { 1243 result += text.substring(prevEnd, hit.position); 1244 var end = hit.position + hit.length; 1245 result += '<b class="search-keyword">' + text.substring(hit.position, end) + '</b>'; 1246 prevEnd = end; 1247 }); 1248 result += text.substring(prevEnd, slice.end); 1249 return result; 1250 } 1251 1252 var resultItem = ''; 1253 1254 if (slicesOfTitle.length != 0) { 1255 resultItem += "<li><a href='" + articleUrl + "' class='search-result-title'>" + highlightKeyword(title, slicesOfTitle[0]) + "</a>"; 1256 } else { 1257 resultItem += "<li><a href='" + articleUrl + "' class='search-result-title'>" + title + "</a>"; 1258 } 1259 1260 slicesOfContent.forEach(function (slice) { 1261 resultItem += "<a href='" + articleUrl + "'>" + 1262 "<p class=\"search-result\">" + highlightKeyword(content, slice) + 1263 "...</p>" + "</a>"; 1264 }); 1265 1266 resultItem += "</li>"; 1267 resultItems.push({ 1268 item: resultItem, 1269 searchTextCount: searchTextCount, 1270 hitCount: hitCount, 1271 id: resultItems.length 1272 }); 1273 } 1274 }) 1275 }; 1276 if (keywords.length === 1 && keywords[0] === "") { 1277 resultContent.innerHTML = '<div id="no-result"><i class="fa fa-search fa-5x" /></div>' 1278 } else if (resultItems.length === 0) { 1279 resultContent.innerHTML = '<div id="no-result"><i class="fa fa-frown-o fa-5x" /></div>' 1280 } else { 1281 resultItems.sort(function (resultLeft, resultRight) { 1282 if (resultLeft.searchTextCount !== resultRight.searchTextCount) { 1283 return resultRight.searchTextCount - resultLeft.searchTextCount; 1284 } else if (resultLeft.hitCount !== resultRight.hitCount) { 1285 return resultRight.hitCount - resultLeft.hitCount; 1286 } else { 1287 return resultRight.id - resultLeft.id; 1288 } 1289 }); 1290 var searchResultList = '<ul class=\"search-result-list\">'; 1291 resultItems.forEach(function (result) { 1292 searchResultList += result.item; 1293 }) 1294 searchResultList += "</ul>"; 1295 resultContent.innerHTML = searchResultList; 1296 } 1297 } 1298 1299 if ('auto' === 'auto') { 1300 input.addEventListener('input', inputEventFunction); 1301 } else { 1302 $('.search-icon').click(inputEventFunction); 1303 input.addEventListener('keypress', function (event) { 1304 if (event.keyCode === 13) { 1305 inputEventFunction(); 1306 } 1307 }); 1308 } 1309 1310 // remove loading animation 1311 $(".local-search-pop-overlay").remove(); 1312 $('body').css('overflow', ''); 1313 1314 proceedsearch(); 1315 } 1316 }); 1317 } 1318 1319 // handle and trigger popup window; 1320 $('.popup-trigger').click(function(e) { 1321 e.stopPropagation(); 1322 if (isfetched === false) { 1323 searchFunc(path, 'local-search-input', 'local-search-result'); 1324 } else { 1325 proceedsearch(); 1326 }; 1327 }); 1328 1329 $('.popup-btn-close').click(onPopupClose); 1330 $('.popup').click(function(e){ 1331 e.stopPropagation(); 1332 }); 1333 $(document).on('keyup', function (event) { 1334 var shouldDismissSearchPopup = event.which === 27 && 1335 $('.search-popup').is(':visible'); 1336 if (shouldDismissSearchPopup) { 1337 onPopupClose(); 1338 } 1339 }); 1340 </script>
1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 <link rel="stylesheet" href="/lib/needsharebutton/needsharebutton.css"> 1356 1357 1358 1359
1359<script src="/lib/needsharebutton/needsharebutton.js"></script>
1359 1360 1361
1361<script> 1362 1363 1364 </script>
1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374</body> 1375</html>
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.