1<!doctype html> 2 3 4 5 6 7 8<html class="theme-next mist use-motion"> 9<head> 10 <meta charset="UTF-8"/> 11<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> 12<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/> 13 14 15 16<meta http-equiv="Cache-Control" content="no-transform" /> 17<meta http-equiv="Cache-Control" content="no-siteapp" /> 18 19 20 21 22 23 24 25 26 27 28 29 30 <link href="/vendors/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css"/> 31 32 33 34 35 <link href="//fonts.googleapis.com/css?family=Lato:300,400,700,400italic&subset=latin,latin-ext" rel="stylesheet" type="text/css"> 36 37 38 39<link href="/vendors/font-awesome/css/font-awesome.min.css?v=4.4.0" rel="stylesheet" type="text/css" /> 40 41<link href="/css/main.css?v=0.5.0" rel="stylesheet" type="text/css" /> 42 43 44 <meta name="keywords" content="Webå端, 西é£å客, Hexoå客" /> 45 46 47 48 49 50 <link rel="alternate" href="/atom.xml" title="西é£å端" type="application/atom+xml" /> 51 52 53 54 55 <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=0.5.0" /> 56 57 58 59 60 61 62<meta name="description" content="卿¢¦æ³é¢åï¼ä¸å齿¯åå£ã"> 63<meta property="og:type" content="website"> 64<meta property="og:title" content="æ ç¾"> 65<meta property="og:url" content="http://xifengxx.github.io/tags/index.html"> 66<meta property="og:site_name" content="西é£å端"> 67<meta property="og:description" content="卿¢¦æ³é¢åï¼ä¸å齿¯åå£ã"> 68<meta property="og:updated_time" content="2016-04-06T15:52:10.000Z"> 69<meta name="twitter:card" content="summary"> 70<meta name="twitter:title" content="æ ç¾"> 71<meta name="twitter:description" content="卿¢¦æ³é¢åï¼ä¸å齿¯åå£ã"> 72 73 74
75<script type="text/javascript" id="hexo.configuration"> 76 var NexT = window.NexT || {}; 77 var CONFIG = { 78 scheme: 'Mist', 79 sidebar: {"position":"left","display":"post"}, 80 fancybox: true, 81 motion: true, 82 duoshuo: { 83 userId: 0, 84 author: 'å主' 85 } 86 }; 87</script>
87 88 89 <title> 90 91 92 93 æ ç¾ | 西é£å端 94 95</title> 96</head> 97 98<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans"> 99 100 101 102 103 104
104<script type="text/javascript"> 105 var _hmt = _hmt || []; 106 (function() { 107 var hm = document.createElement("script"); 108 hm.src = "//hm.baidu.com/hm.js?1e199d27279271fc384c64d64d900b77"; 109 var s = document.getElementsByTagName("script")[0]; 110 s.parentNode.insertBefore(hm, s); 111 })(); 112 </script>
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 <div class="container one-collumn sidebar-position-left "> 127 <div class="headband"></div> 128 129 <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader"> 130 <div class="header-inner"><div class="site-meta "> 131 132 133 <div class="custom-logo-site-title"> 134 <a href="/" class="brand" rel="start"> 135 <span class="logo-line-before"><i></i></span> 136 <span class="site-title">西é£å端</span> 137 <span class="logo-line-after"><i></i></span> 138 </a> 139 </div> 140 <p class="site-subtitle">Webå端å¦ä¹ å客ã</p> 141</div> 142 143<div class="site-nav-toggle"> 144 <button> 145 <span class="btn-bar"></span> 146 <span class="btn-bar"></span> 147 <span class="btn-bar"></span> 148 </button> 149</div> 150 151<nav class="site-nav"> 152 153 154 155 <ul id="menu" class="menu"> 156 157 158 <li class="menu-item menu-item-home"> 159 <a href="/" rel="section"> 160 161 é¦é¡µ 162 </a> 163 </li> 164 165 166 <li class="menu-item menu-item-categories"> 167 <a href="/categories" rel="section"> 168 169 åç±» 170 </a> 171 </li> 172 173 174 <li class="menu-item menu-item-archives"> 175 <a href="/archives" rel="section"> 176 177 彿¡£ 178 </a> 179 </li> 180 181 182 <li class="menu-item menu-item-tags"> 183 <a href="/tags" rel="section"> 184 185 æ ç¾ 186 </a> 187 </li> 188 189 190 <li class="menu-item menu-item-webdemo"> 191 <a href="https://xifengxx.github.io/web-demo/" rel="section"> 192 193 å端ä½åDemo 194 </a> 195 </li> 196 197 198 <li class="menu-item menu-item-nec"> 199 <a href="/course-notes" rel="section"> 200 201 å端微ä¸ä¸ 202 </a> 203 </li> 204 205 206 <li class="menu-item menu-item-about"> 207 <a href="/about" rel="section"> 208 209 å ³äº 210 </a> 211 </li> 212 213 214 215 <li class="menu-item menu-item-search"> 216 217 <a href="#" class="popup-trigger"> 218 219 220 æç´¢ 221 </a> 222 </li> 223 224 </ul> 225 226 227 228 <div class="site-search"> 229 230 <div class="popup"> 231 <span class="search-icon fa fa-search"></span> 232 <input type="text" id="local-search-input"> 233 <div id="local-search-result"></div> 234 <span class="popup-btn-close">close</span> 235</div> 236 237 238 </div> 239 240</nav> 241 242 </div> 243 </header> 244 245 <main id="main" class="main"> 246 <div class="main-inner"> 247 <div class="content-wrap"> 248 <div id="content" class="content"> 249 250 251 <div id="posts" class="posts-expand"> 252 253 254 <div class="tag-cloud"> 255 <div class="tag-cloud-title"> 256 ç®åå ±è®¡ 60 个æ ç¾ 257 </div> 258 <div class="tag-cloud-tags"> 259 <a href="/tags/Ajax/" style="font-size: 15.6px; color: #a7a7a7">Ajax</a> <a href="/tags/BEM/" style="font-size: 12px; color: #ccc">BEM</a> <a href="/tags/Bootstrap/" style="font-size: 26.4px; color: #363636">Bootstrap</a> <a href="/tags/CROS/" style="font-size: 12px; color: #ccc">CROS</a> <a href="/tags/CSS/" style="font-size: 12px; color: #ccc">CSS</a> <a href="/tags/CSS3/" style="font-size: 15.6px; color: #a7a7a7">CSS3</a> <a href="/tags/CSSå¨ç»/" style="font-size: 12px; color: #ccc">CSSå¨ç»</a> <a href="/tags/Canvas/" style="font-size: 15.6px; color: #a7a7a7">Canvas</a> <a href="/tags/Canvasç»å¾/" style="font-size: 12px; color: #ccc">Canvasç»å¾</a> <a href="/tags/DOMäºä»¶/" style="font-size: 12px; color: #ccc">DOMäºä»¶</a> <a href="/tags/DOMæ¢ç´¢/" style="font-size: 12px; color: #ccc">DOMæ¢ç´¢</a> <a href="/tags/Firework/" style="font-size: 12px; color: #ccc">Firework</a> <a href="/tags/Flexå¸å±/" style="font-size: 12px; color: #ccc">Flexå¸å±</a> <a href="/tags/FullPage-js/" style="font-size: 12px; color: #ccc">FullPage.js</a> <a href="/tags/Github-Pages/" style="font-size: 12px; color: #ccc">Github Pages</a> <a href="/tags/Git宿/" style="font-size: 12px; color: #ccc">Git宿</a> <a href="/tags/Gulp/" style="font-size: 12px; color: #ccc">Gulp</a> <a href="/tags/HTML/" style="font-size: 12px; color: #ccc">HTML</a> <a href="/tags/HTML5/" style="font-size: 12px; color: #ccc">HTML5</a> <a href="/tags/HTML5åå¨/" style="font-size: 12px; color: #ccc">HTML5åå¨</a> <a href="/tags/HTML5离线åºç¨/" style="font-size: 12px; color: #ccc">HTML5离线åºç¨</a> <a href="/tags/HTML5é³ä¹/" style="font-size: 12px; color: #ccc">HTML5é³ä¹</a> <a href="/tags/HTTP/" style="font-size: 12px; color: #ccc">HTTP</a> <a href="/tags/Hexo/" style="font-size: 22.8px; color: #5c5c5c">Hexo</a> <a href="/tags/JSå计æ¶/" style="font-size: 12px; color: #ccc">JSå计æ¶</a> <a href="/tags/JSæä»¶/" style="font-size: 12px; color: #ccc">JSæä»¶</a> <a href="/tags/JSè¿å¨æ¡æ¶/" style="font-size: 12px; color: #ccc">JSè¿å¨æ¡æ¶</a> <a href="/tags/JavaScript/" style="font-size: 22.8px; color: #5c5c5c">JavaScript</a> <a href="/tags/MVCæ¡æ¶/" style="font-size: 12px; color: #ccc">MVCæ¡æ¶</a> <a href="/tags/PSåå¾/" style="font-size: 12px; color: #ccc">PSåå¾</a> <a href="/tags/Photoshop/" style="font-size: 12px; color: #ccc">Photoshop</a> <a href="/tags/Regexp/" style="font-size: 12px; color: #ccc">Regexp</a> <a href="/tags/Sublime/" style="font-size: 12px; color: #ccc">Sublime</a> <a href="/tags/Web-App/" style="font-size: 12px; color: #ccc">Web App</a> <a href="/tags/Webå端/" style="font-size: 12px; color: #ccc">Webå端</a> <a href="/tags/Webåç«¯å®æ/" style="font-size: 19.2px; color: #818181">Webåç«¯å®æ</a> <a href="/tags/Webå端å¼å/" style="font-size: 12px; color: #ccc">Webå端å¼å</a> <a href="/tags/Webè§å£/" style="font-size: 12px; color: #ccc">Webè§å£</a> <a href="/tags/jQuery-Mobile/" style="font-size: 12px; color: #ccc">jQuery Mobile</a>
259 <a href="/tags/jQueryå¦ä¹ ç¬è®°/" style="font-size: 30px; color: #111">jQueryå¦ä¹ ç¬è®°</a> <a href="/tags/jQueryæä»¶/" style="font-size: 22.8px; color: #5c5c5c">jQueryæä»¶</a> <a href="/tags/linuxå½ä»¤/" style="font-size: 12px; color: #ccc">linuxå½ä»¤</a> <a href="/tags/requestAnimationFrame/" style="font-size: 12px; color: #ccc">requestAnimationFrame</a> <a href="/tags/wordpressæç¨/" style="font-size: 12px; color: #ccc">wordpressæç¨</a> <a href="/tags/ä¿¡æ¯æ»å¨/" style="font-size: 12px; color: #ccc">ä¿¡æ¯æ»å¨</a> <a href="/tags/åè®¡æ¶æ¶é/" style="font-size: 12px; color: #ccc">åè®¡æ¶æ¶é</a> <a href="/tags/å ¨å±åæ¢/" style="font-size: 12px; color: #ccc">å ¨å±åæ¢</a> <a href="/tags/å类导èªèå/" style="font-size: 12px; color: #ccc">å类导èªèå</a> <a href="/tags/åç«¯å·¥å ·/" style="font-size: 12px; color: #ccc">åç«¯å·¥å ·</a> <a href="/tags/åç«¯æ¶æ/" style="font-size: 12px; color: #ccc">åç«¯æ¶æ</a> <a href="/tags/ååºå¼å¸å±/" style="font-size: 12px; color: #ccc">ååºå¼å¸å±</a> <a href="/tags/å¾çæ ¼å¼/" style="font-size: 12px; color: #ccc">å¾çæ ¼å¼</a> <a href="/tags/å¹»ç¯çç¹æ/" style="font-size: 12px; color: #ccc">å¹»ç¯çç¹æ</a> <a href="/tags/æé®ç¹æ/" style="font-size: 12px; color: #ccc">æé®ç¹æ</a> <a href="/tags/ç叿µå¸å±/" style="font-size: 12px; color: #ccc">ç叿µå¸å±</a> <a href="/tags/ç½ç«å¸å±/" style="font-size: 12px; color: #ccc">ç½ç«å¸å±</a> <a href="/tags/ç½ç«æ§è½/" style="font-size: 12px; color: #ccc">ç½ç«æ§è½</a> <a href="/tags/ç½é¡µå®ä½å¯¼èª/" style="font-size: 12px; color: #ccc">ç½é¡µå®ä½å¯¼èª</a> <a href="/tags/ç½é¡µç¹æ/" style="font-size: 12px; color: #ccc">ç½é¡µç¹æ</a> <a href="/tags/页é¢å¸å±/" style="font-size: 12px; color: #ccc">页é¢å¸å±</a> 260 </div> 261 </div> 262 263 </div> 264 265 266 </div> 267 268 269 270 271 272 </div> 273 274 275 276 <div class="sidebar-toggle"> 277 <div class="sidebar-toggle-line-wrap"> 278 <span class="sidebar-toggle-line sidebar-toggle-line-first"></span> 279 <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span> 280 <span class="sidebar-toggle-line sidebar-toggle-line-last"></span> 281 </div> 282 </div> 283 284 <aside id="sidebar" class="sidebar"> 285 <div class="sidebar-inner"> 286 287 288 289 290 291 <section class="site-overview sidebar-panel sidebar-panel-active "> 292 <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person"> 293 <img class="site-author-image" itemprop="image" 294 src="/uploads/avatar.png" 295 alt="xifengxx" /> 296 <p class="site-author-name" itemprop="name">xifengxx</p> 297 <p class="site-description motion-element" itemprop="description">卿¢¦æ³é¢åï¼ä¸å齿¯åå£ã</p> 298 </div> 299 <nav class="site-state motion-element"> 300 <div class="site-state-item site-state-posts"> 301 <a href="/archives"> 302 <span class="site-state-item-count">75</span> 303 <span class="site-state-item-name">æ¥å¿</span> 304 </a> 305 </div> 306 307 308 <div class="site-state-item site-state-categories"> 309 <a href="/categories"> 310 <span class="site-state-item-count">31</span> 311 <span class="site-state-item-name">åç±»</span> 312 </a> 313 </div> 314 315 316 317 <div class="site-state-item site-state-tags"> 318 <a href="/tags"> 319 <span class="site-state-item-count">60</span> 320 <span class="site-state-item-name">æ ç¾</span> 321 </a> 322 </div> 323 324 325 </nav> 326 327 328 <div class="feed-link motion-element"> 329 <a href="/atom.xml" rel="alternate"> 330 <i class="fa fa-rss"></i> 331 RSS 332 </a> 333 </div> 334 335 336 <div class="links-of-author motion-element"> 337 338 339 <span class="links-of-author-item"> 340 <a href="https://github.com/xifengxx" target="_blank"> 341 342 <i class="fa fa-github"></i> 343 344 GitHub 345 </a> 346 </span> 347
348 <span class="links-of-author-item"> 349 <a href="http://weibo.com/xifengxx" target="_blank"> 350 351 <i class="fa fa-weibo"></i> 352 353 Weibo 354 </a> 355 </span> 356 357 <span class="links-of-author-item"> 358 <a href="/uploads/wechat.jpg" target="_blank"> 359 360 <i class="fa fa-wechat"></i> 361 362 Weixin 363 </a> 364 </span> 365 366 367 </div> 368 369 370 371 <div class="cc-license motion-element" itemprop="license"> 372 <a href="http://creativecommons.org/licenses/by-nc-sa/4.0" class="cc-opacity" target="_blank"> 373 <img src="/images/cc-by-nc-sa.svg" alt="Creative Commons" /> 374 </a> 375 </div> 376 377 378 379 <div class="links-of-blogroll motion-element"> 380 381 <div class="links-of-blogroll-title">åæ é¾æ¥</div> 382 <ul class="links-of-blogroll-list"> 383 384 <li class="links-of-blogroll-item"> 385 <a href="http://www.xifengxx.com/" target="_blank">西é£å客</a> 386 </li> 387 388 </ul> 389 390 </div> 391 392 </section> 393 394 395 396 </div> 397 </aside> 398 399 400 401 </div> 402 </main> 403 404 <footer id="footer" class="footer"> 405 <div class="footer-inner"> 406 <div class="copyright" > 407 408 © 2015 - 409 <span itemprop="copyrightYear">2016</span> 410 <span class="with-love"> 411 <i class="fa fa-heart"></i> 412 </span> 413 <span class="author" itemprop="copyrightHolder">xifengxx</span> 414</div> 415 416<div class="powered-by"> 417 ç± <a class="theme-link" href="http://hexo.io">Hexo</a> 强åé©±å¨ 418</div> 419 420<div class="theme-info"> 421 ä¸»é¢ - 422 <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next"> 423 NexT.Mist 424 </a> 425</div> 426 427 428 429 </div> 430 </footer> 431 432 <div class="back-to-top"> 433 <i class="fa fa-arrow-up"></i> 434 </div> 435 </div> 436 437 438 439 440 441 442 443 444
445<script type="text/javascript"> 446 if (Object.prototype.toString.call(window.Promise) !== '[object Function]') { 447 window.Promise = null; 448 } 449</script>
449 450 451 452
452<script type="text/javascript" src="/vendors/jquery/index.js?v=2.1.3"></script>
452 453 454
454<script type="text/javascript" src="/vendors/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
454 455 456
456<script type="text/javascript" src="/vendors/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
456 457 458
458<script type="text/javascript" src="/vendors/velocity/velocity.min.js"></script>
458 459 460
460<script type="text/javascript" src="/vendors/velocity/velocity.ui.min.js"></script>
460 461 462
462<script type="text/javascript" src="/vendors/fancybox/source/jquery.fancybox.pack.js"></script>
462 463 464 465 466 467 468
468<script type="text/javascript" src="/js/src/utils.js?v=0.5.0"></script>
468 469 470
470<script type="text/javascript" src="/js/src/motion.js?v=0.5.0"></script>
470 471 472 473 474 475 476 477 478 479 480 481 482
482<script type="text/javascript" src="/js/src/bootstrap.js?v=0.5.0"></script>
482 483 484 485 486 487 488 489 490 491 492
492<script type="text/javascript"> 493 var duoshuoQuery = {short_name:"417131853"}; 494 (function() { 495 var ds = document.createElement('script'); 496 ds.type = 'text/javascript';ds.async = true; 497 ds.id = 'duoshuo-script'; 498 ds.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//static.duoshuo.com/embed.js'; 499 ds.charset = 'UTF-8'; 500 (document.getElementsByTagName('head')[0] 501 || document.getElementsByTagName('body')[0]).appendChild(ds); 502 })(); 503 </script>
503 504 505 506 507 508 509 510 511 512 513 514 515
515<script type="text/javascript"> 516 // Popup Window; 517 var isfetched = false; 518 // Search DB path; 519 var search_path = "search.xml"; 520 if (search_path.length == 0) { 521 search_path = "search.xml"; 522 } 523 var path = "/" + search_path; 524 // monitor main search box; 525 526 function proceedsearch() { 527 $("body").append('<div class="popoverlay">').css('overflow', 'hidden'); 528 $('.popup').toggle(); 529 530 } 531 // search function; 532 var searchFunc = function(path, search_id, content_id) { 533 'use strict'; 534 $.ajax({ 535 url: path, 536 dataType: "xml", 537 async: true, 538 success: function( xmlResponse ) { 539 // get the contents from search data 540 isfetched = true; 541 $('.popup').detach().appendTo('.header-inner'); 542 var datas = $( "entry", xmlResponse ).map(function() { 543 return { 544 title: $( "title", this ).text(), 545 content: $("content",this).text(), 546 url: $( "url" , this).text() 547 }; 548 }).get(); 549 var $input = document.getElementById(search_id); 550 var $resultContent = document.getElementById(content_id); 551 $input.addEventListener('input', function(){ 552 var matchcounts = 0; 553 var str='<ul class=\"search-result-list\">'; 554 var keywords = this.value.trim().toLowerCase().split(/[\s\-]+/); 555 $resultContent.innerHTML = ""; 556 if (this.value.trim().length > 1) { 557 // perform local searching 558 datas.forEach(function(data) { 559 var isMatch = true; 560 var content_index = []; 561 var data_title = data.title.trim().toLowerCase(); 562 var data_content = data.content.trim().replace(/<[^>]+>/g,"").toLowerCase(); 563 var data_url = data.url; 564 var index_title = -1; 565 var index_content = -1; 566 var first_occur = -1; 567 // only match artiles with not empty titles and contents 568 if(data_title != '' && data_content != '') { 569 keywords.forEach(function(keyword, i) { 570 index_title = data_title.indexOf(keyword); 571 index_content = data_content.indexOf(keyword); 572 if( index_title < 0 && index_content < 0 ){ 573 isMatch = false; 574 } else { 575 if (index_content < 0) { 576 index_content = 0; 577 } 578 if (i == 0) { 579 first_occur = index_content; 580 } 581 } 582 }); 583 } 584 // show search results 585 if (isMatch) { 586 matchcounts += 1; 587 str += "<li><a href='"+ data_url +"' class='search-result-title'>"+ data_title +"</a>"; 588 var content = data.content.trim().replace(/<[^>]+>/g,""); 589 if (first_occur >= 0) { 590 // cut out 100 characters 591 var start = first_occur - 20; 592 var end = first_occur + 80; 593 if(start < 0){ 594 start = 0; 595 } 596 if(start == 0){ 597 end = 50; 598 } 599 if(end > content.length){ 600 end = content.length; 601 } 602 var match_content = content.substring(start, end); 603 // highlight all keywords 604 keywords.forEach(function(keyword){ 605 var regS = new RegExp(keyword, "gi"); 606 match_content = match_content.replace(regS, "<b class=\"search-keyword\">"+keyword+"</b>"); 607 }); 608 609 str += "<p class=\"search-result\">" + match_content +"...</p>" 610 } 611 str += "</li>"; 612 } 613 })}; 614 str += "</ul>"; 615 if (matchcounts == 0) { str = '<div id="no-result"><i class="fa fa-frown-o fa-5x" /></div>' } 616 if (keywords == "") { str = '<div id="no-result"><i class="fa fa-search fa-5x" /></div>' } 617 $resultContent.innerHTML = str; 618 }); 619 proceedsearch(); 620 } 621 });} 622 623 // handle and trigger popup window; 624 $('.popup-trigger').mousedown(function(e) { 625 e.stopPropagation(); 626 if (isfetched == false) { 627 searchFunc(path, 'local-search-input', 'local-search-result'); 628 } else { 629 proceedsearch(); 630 }; 631 632 }); 633 634 $('.popup-btn-close').click(function(e){ 635 $('.popup').hide(); 636 $(".popoverlay").remove(); 637 $('body').css('overflow', ''); 638 }); 639 $('.popup').click(function(e){ 640 e.stopPropagation(); 641 }); 642 </script>
642 643 644 645 646 647 648 649
649<script src="https://cdn1.lncld.net/static/js/av-core-mini-0.6.1.js"></script>
649 650
650<script>AV.initialize("Kkljw3izeaB5Fa8P2HwSjqWq-gzGzoHsz", "JSwiiCRKO0LaKbGHyelnr6jY");</script>
650 651
651<script> 652 function showTime(Counter) { 653 var query = new AV.Query(Counter); 654 var entries = []; 655 var $visitors = $(".leancloud_visitors"); 656 657 $visitors.each(function () { 658 entries.push( $(this).attr("id").trim() ); 659 }); 660 661 query.containedIn('url', entries); 662 query.find() 663 .done(function (results) { 664 var COUNT_CONTAINER_REF = '.leancloud-visitors-count'; 665 666 if (results.length === 0) { 667 $visitors.find(COUNT_CONTAINER_REF).text(0); 668 return; 669 } 670 671 for (var i = 0; i < results.length; i++) { 672 var item = results[i]; 673 var url = item.get('url'); 674 var time = item.get('time'); 675 var element = document.getElementById(url); 676 677 $(element).find(COUNT_CONTAINER_REF).text(time); 678 } 679 }) 680 .fail(function (object, error) { 681 console.log("Error: " + error.code + " " + error.message); 682 }); 683 } 684 685 function addCount(Counter) { 686 var $visitors = $(".leancloud_visitors"); 687 var url = $visitors.attr('id').trim(); 688 var title = $visitors.attr('data-flag-title').trim(); 689 var query = new AV.Query(Counter); 690 691 query.equalTo("url", url); 692 query.find({ 693 success: function(results) { 694 if (results.length > 0) { 695 var counter = results[0]; 696 counter.fetchWhenSave(true); 697 counter.increment("time"); 698 counter.save(null, { 699 success: function(counter) { 700 var $element = $(document.getElementById(url)); 701 $element.find('.leancloud-visitors-count').text(counter.get('time')); 702 }, 703 error: function(counter, error) { 704 console.log('Failed to save Visitor num, with error message: ' + error.message); 705 } 706 }); 707 } else { 708 var newcounter = new Counter(); 709 newcounter.set("title", title); 710 newcounter.set("url", url); 711 newcounter.set("time", 1); 712 newcounter.save(null, { 713 success: function(newcounter) { 714 var $element = $(document.getElementById(url)); 715 $element.find('.leancloud-visitors-count').text(newcounter.get('time')); 716 }, 717 error: function(newcounter, error) { 718 console.log('Failed to create'); 719 } 720 }); 721 } 722 }, 723 error: function(error) { 724 console.log('Error:' + error.code + " " + error.message); 725 } 726 }); 727 } 728 729 $(function() { 730 var Counter = AV.Object.extend("Counter"); 731 if ($('.leancloud_visitors').length == 1) { 732 addCount(Counter); 733 } else if ($('.post-title-link').length > 1) { 734 showTime(Counter); 735 } 736 }); 737 </script>
737 738 739 740 741 742 743</body> 744</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.