-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
936 lines (489 loc) · 25.5 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
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
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
<!DOCTYPE html>
<html class="theme-next gemini use-motion" lang="zh-Hans">
<head>
<meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<meta name="theme-color" content="#222">
<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />
<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />
<link href="/css/main.css?v=5.1.4" rel="stylesheet" type="text/css" />
<link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=5.1.4">
<link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png?v=5.1.4">
<link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png?v=5.1.4">
<link rel="mask-icon" href="/images/logo.svg?v=5.1.4" color="#222">
<meta name="keywords" content="Hexo, NexT" />
<meta name="description" content="然而无论处于哪种心境当中,我相信,只要想起自己曾经满怀惊奇、兴奋与真诚敲下的那个程序—“Hello,World!”我们就会充满了渴望和力量,因为那是程序员最初的梦想:改变世界。">
<meta property="og:type" content="website">
<meta property="og:title" content="孖">
<meta property="og:url" content="http://yoursite.com/index.html">
<meta property="og:site_name" content="孖">
<meta property="og:description" content="然而无论处于哪种心境当中,我相信,只要想起自己曾经满怀惊奇、兴奋与真诚敲下的那个程序—“Hello,World!”我们就会充满了渴望和力量,因为那是程序员最初的梦想:改变世界。">
<meta property="og:locale" content="zh-Hans">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="孖">
<meta name="twitter:description" content="然而无论处于哪种心境当中,我相信,只要想起自己曾经满怀惊奇、兴奋与真诚敲下的那个程序—“Hello,World!”我们就会充满了渴望和力量,因为那是程序员最初的梦想:改变世界。">
<script type="text/javascript" id="hexo.configurations">
var NexT = window.NexT || {};
var CONFIG = {
root: '/',
scheme: 'Gemini',
version: '5.1.4',
sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
fancybox: true,
tabs: true,
motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
duoshuo: {
userId: '0',
author: '博主'
},
algolia: {
applicationID: '',
apiKey: '',
indexName: '',
hits: {"per_page":10},
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"}
}
};
</script>
<link rel="canonical" href="http://yoursite.com/"/>
<title>孖</title>
</head>
<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">
<div class="container sidebar-position-left
page-home">
<div class="headband"></div>
<header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
<div class="header-inner"><div class="site-brand-wrapper">
<div class="site-meta ">
<div class="custom-logo-site-title">
<a href="/" class="brand" rel="start">
<span class="logo-line-before"><i></i></span>
<span class="site-title">孖</span>
<span class="logo-line-after"><i></i></span>
</a>
</div>
<p class="site-subtitle"></p>
</div>
<div class="site-nav-toggle">
<button>
<span class="btn-bar"></span>
<span class="btn-bar"></span>
<span class="btn-bar"></span>
</button>
</div>
</div>
<nav class="site-nav">
<ul id="menu" class="menu">
<li class="menu-item menu-item-home">
<a href="/" rel="section">
<i class="menu-item-icon fa fa-fw fa-home"></i> <br />
首页
</a>
</li>
<li class="menu-item menu-item-archives">
<a href="/archives/" rel="section">
<i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
归档
</a>
</li>
</ul>
</nav>
</div>
</header>
<main id="main" class="main">
<div class="main-inner">
<div class="content-wrap">
<div id="content" class="content">
<section id="posts" class="posts-expand">
<article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
<div class="post-block">
<link itemprop="mainEntityOfPage" href="http://yoursite.com/2019/05/31/linux基本命令/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="name" content="孖">
<meta itemprop="description" content="">
<meta itemprop="image" content="/images/avatar.gif">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="孖">
</span>
<header class="post-header">
<h1 class="post-title" itemprop="name headline">
<a class="post-title-link" href="/2019/05/31/linux基本命令/" itemprop="url">Linux基本命令</a></h1>
<div class="post-meta">
<span class="post-time">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">发表于</span>
<time title="创建于" itemprop="dateCreated datePublished" datetime="2019-05-31T09:35:14+08:00">
2019-05-31
</time>
</span>
<span class="post-comments-count">
<span class="post-meta-divider">|</span>
<span class="post-meta-item-icon">
<i class="fa fa-comment-o"></i>
</span>
<a href="/2019/05/31/linux基本命令/#comments" itemprop="discussionUrl">
<span class="post-comments-count valine-comment-count" data-xid="/2019/05/31/linux基本命令/" itemprop="commentCount"></span>
</a>
</span>
<span id="/2019/05/31/linux基本命令/" class="leancloud_visitors" data-flag-title="Linux基本命令">
<span class="post-meta-divider">|</span>
<span class="post-meta-item-icon">
<i class="fa fa-eye"></i>
</span>
<span class="post-meta-item-text">阅读次数:</span>
<span class="leancloud-visitors-count"></span>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<h4 id="文件-amp-目录操作"><a href="#文件-amp-目录操作" class="headerlink" title="文件&目录操作"></a>文件&目录操作</h4><h5 id="ls"><a href="#ls" class="headerlink" title="ls"></a>ls</h5><ul>
<li>ls-a查看所有文件,包含隐藏文件</li>
<li>ls-l简写ll,查看详细信息</li>
<li>ls-h文件大小以易读的方式显示</li>
</ul>
<h5 id="cd"><a href="#cd" class="headerlink" title="cd"></a>cd</h5><ul>
<li>cd .. 返回上级目录</li>
<li>cd - 返回上一次所在目录</li>
</ul>
<h5 id="cp"><a href="#cp" class="headerlink" title="cp"></a>cp</h5><ul>
<li>cp -r 复制目录及目录下文件</li>
</ul>
<h5 id="find"><a href="#find" class="headerlink" title="find"></a>find</h5><ul>
<li>find /-name ‘target’ 查询根目录下面文件名为target的文件</li>
</ul>
<h5 id="mkdir"><a href="#mkdir" class="headerlink" title="mkdir"></a>mkdir</h5><ul>
<li>mkdir -p /tmp/test 递归创建目录</li>
</ul>
<h5 id="mv"><a href="#mv" class="headerlink" title="mv"></a>mv</h5><ul>
<li>mv -f source destination 强制移动</li>
</ul>
<h5 id="pwd"><a href="#pwd" class="headerlink" title="pwd"></a>pwd</h5><ul>
<li>pwd 显示当前路径</li>
</ul>
<h5 id="rm"><a href="#rm" class="headerlink" title="rm"></a>rm</h5><ul>
<li>rm -rf/强制删除根目录及目录下的文件</li>
</ul>
<h5 id="touch"><a href="#touch" class="headerlink" title="touch"></a>touch</h5><ul>
<li>touch target 创建 target 文件,若文件存在则改变文件时间戳</li>
</ul>
<h5 id="tree"><a href="#tree" class="headerlink" title="tree"></a>tree</h5><ul>
<li>tree 功能是以树形</li>
</ul>
<h5 id="basename"><a href="#basename" class="headerlink" title="basename"></a>basename</h5><ul>
<li>basename /tmp/1 显示路径</li>
</ul>
<h4 id="查看文件-amp-内容处理"><a href="#查看文件-amp-内容处理" class="headerlink" title="查看文件&内容处理"></a>查看文件&内容处理</h4><h5 id="cat"><a href="#cat" class="headerlink" title="cat"></a>cat</h5><ul>
<li>cat -n 显示行号</li>
<li>cat file1 file2 打开文件1和2</li>
</ul>
<h5 id="more"><a href="#more" class="headerlink" title="more"></a>more</h5><ul>
<li>more file1 逐页显示</li>
</ul>
<h5 id="less"><a href="#less" class="headerlink" title="less"></a>less</h5><ul>
<li>less file1 也是逐页显示,与more方向相反</li>
</ul>
<h5 id="head"><a href="#head" class="headerlink" title="head"></a>head</h5><ul>
<li>head -n file 显示文件头n行</li>
</ul>
<h5 id="tail"><a href="#tail" class="headerlink" title="tail"></a>tail</h5><ul>
<li>tail -n file 显示文件尾n行</li>
<li>tailf file 实时显示文件尾10行,常用于跟踪日志信息</li>
</ul>
<h4 id="vim"><a href="#vim" class="headerlink" title="vim"></a>vim</h4><h5 id="三种模式"><a href="#三种模式" class="headerlink" title="三种模式:"></a>三种模式:</h5><ul>
<li>编辑模式(命令模式)</li>
<li>输入模式</li>
<li><p>末行模式</p>
<ul>
<li><strong>模式的转换</strong></li>
<li>编辑->输入</li>
</ul>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">i: 在当前所在字符的前面,转化为输入模式;</span><br><span class="line">a: 在当前光标所在字符的后面,转为输入模式;</span><br><span class="line">o: 在当前光标所在行的下方,新建一行,并转为输入模式;</span><br></pre></td></tr></table></figure>
</li>
<li><p>打开文件</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"> vim +#: 打开文件,并定位于第#行</span><br><span class="line"> vim +: 打开文件,定位至最后一行</span><br><span class="line">vim +/PATTERN : 打开文件,定位至第一次被PATTERN匹配到的行的行首</span><br></pre></td></tr></table></figure>
</li>
<li><p>关闭文件</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">:q 退出</span><br><span class="line">:wq 保存并退出</span><br><span class="line">:q! 不保存并退出</span><br><span class="line">:w 保存</span><br><span class="line">:w! 强行保存</span><br></pre></td></tr></table></figure>
</li>
<li><p>移动光标(编辑模式)</p>
<ul>
<li>逐字符移动</li>
</ul>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">h: 左</span><br><span class="line">l: 右</span><br><span class="line">j: 下</span><br><span class="line">k: 上</span><br><span class="line">#h: 移动#个字符</span><br></pre></td></tr></table></figure>
</li>
<li><p>以单词为单位移动</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">w:移至下一个单词的词首</span><br><span class="line">e:跳至当前或下一个单词的词尾</span><br><span class="line">b:跳至当前或前一个单词的词首</span><br><span class="line">#w: 移动#个单词</span><br></pre></td></tr></table></figure>
</li>
</ul>
<ul>
<li><p>行内跳转</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">0: 绝对行首</span><br><span class="line">^: 行首的第一个非空白字符</span><br><span class="line">$: 绝对行尾</span><br></pre></td></tr></table></figure>
</li>
<li><p>行间跳转</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">#G:跳转至第#行</span><br><span class="line">gg:第一行</span><br><span class="line">G:最后一行</span><br></pre></td></tr></table></figure>
</li>
<li><p>翻屏</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">ctrl+f:向下翻一屏</span><br><span class="line">ctrl+b:向上翻一屏 </span><br><span class="line">ctrl+d:向上翻一屏</span><br><span class="line">ctrl+u:向上翻一屏 </span><br><span class="line">``` </span><br><span class="line"></span><br><span class="line">* 删除单个字符</span><br></pre></td></tr></table></figure>
<p>x:删除光标所在处的单个字符<br>#x:删除光标所在处及向后的共#个字符</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line">* 删除命令:d</span><br></pre></td></tr></table></figure>
<p>dd: 删除当前光标所在行<br>#dd: 删除包括当前光标所在行在内的#行</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line">* 撤销编辑操作</span><br></pre></td></tr></table></figure>
<p>u:撤销前一次的编辑操作<br>#u:直接撤销最近#次编辑操作<br>连续u命令可撤销此前的n次编辑操作<br>ctrl+r 撤销最近一次撤销操作</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line">查找</span><br></pre></td></tr></table></figure>
<p>/PATTERN<br>?PATTERN<br>n 下一个<br>N 上一个<br><code>`</code></p>
</li>
</ul>
<h5 id="信息显示"><a href="#信息显示" class="headerlink" title="信息显示"></a>信息显示</h5><ul>
<li><p>uname</p>
<ul>
<li>uname -a显示系统全部信息</li>
</ul>
</li>
<li><p>hostname</p>
<ul>
<li>hostname 显示主机名</li>
</ul>
</li>
<li><p>dmesg</p>
<ul>
<li>dmesg 显示开机信息</li>
</ul>
</li>
<li><p>uptime</p>
<ul>
<li>uptime 显示系统运行时间及负载 </li>
</ul>
</li>
<li><p>stat</p>
<ul>
<li>stat 显示文件的状态信息</li>
</ul>
</li>
<li><p>du</p>
<ul>
<li>du -sh 显示路径下所有文件大小</li>
<li>du -sh local 显示路径下local目录文件大小</li>
<li>du -sh * 显示路径下所有目录文件大小</li>
</ul>
</li>
<li><p>df</p>
<ul>
<li>df - h 显示系统磁盘空间的使用情况</li>
</ul>
</li>
<li><p>top</p>
<ul>
<li>top 实时显示系统资源使用情况</li>
</ul>
</li>
<li><p>free</p>
<ul>
<li>free -m 以M为单位查看系统内存</li>
</ul>
</li>
<li><p>cal </p>
<ul>
<li>cal 日历信息</li>
</ul>
</li>
</ul>
<p><a href="https://learnku.com/articles/29137" target="_blank" rel="noopener">more</a></p>
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</div>
</article>
</section>
<nav class="pagination">
<span class="page-number current">1</span><a class="page-number" href="/page/2/">2</a><span class="space">…</span><a class="page-number" href="/page/18/">18</a><a class="extend next" rel="next" href="/page/2/"><i class="fa fa-angle-right"></i></a>
</nav>
</div>
</div>
<div class="sidebar-toggle">
<div class="sidebar-toggle-line-wrap">
<span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
<span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
<span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
</div>
</div>
<aside id="sidebar" class="sidebar">
<div class="sidebar-inner">
<section class="site-overview-wrap sidebar-panel sidebar-panel-active">
<div class="site-overview">
<div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
<p class="site-author-name" itemprop="name">孖</p>
<p class="site-description motion-element" itemprop="description">然而无论处于哪种心境当中,我相信,只要想起自己曾经满怀惊奇、兴奋与真诚敲下的那个程序—“Hello,World!”我们就会充满了渴望和力量,因为那是程序员最初的梦想:改变世界。</p>
</div>
<nav class="site-state motion-element">
<div class="site-state-item site-state-posts">
<a href="/archives/">
<span class="site-state-item-count">18</span>
<span class="site-state-item-name">日志</span>
</a>
</div>
</nav>
</div>
</section>
</div>
</aside>
</div>
</main>
<footer id="footer" class="footer">
<div class="footer-inner">
<div class="copyright">© <span itemprop="copyrightYear">2019</span>
<span class="with-love">
<i class="fa fa-user"></i>
</span>
<span class="author" itemprop="copyrightHolder">孖</span>
</div>
<div class="powered-by">由 <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a> 强力驱动</div>
<span class="post-meta-divider">|</span>
<div class="theme-info">主题 — <a class="theme-link" target="_blank" href="https://github.com/iissnan/hexo-theme-next">NexT.Gemini</a> v5.1.4</div>
</div>
</footer>
<div class="back-to-top">
<i class="fa fa-arrow-up"></i>
</div>
</div>
<script type="text/javascript">
if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
window.Promise = null;
}
</script>
<script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>
<script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
<script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
<script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
<script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
<script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
<script type="text/javascript" src="/lib/three/three.min.js"></script>
<script type="text/javascript" src="/lib/three/canvas_lines.min.js"></script>
<script type="text/javascript" src="/js/src/utils.js?v=5.1.4"></script>
<script type="text/javascript" src="/js/src/motion.js?v=5.1.4"></script>
<script type="text/javascript" src="/js/src/affix.js?v=5.1.4"></script>
<script type="text/javascript" src="/js/src/schemes/pisces.js?v=5.1.4"></script>
<script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.4"></script>
<script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
<script src="//unpkg.com/valine/dist/Valine.min.js"></script>
<script type="text/javascript">
var GUEST = ['nick','mail','link'];
var guest = 'nick,mail';
guest = guest.split(',').filter(item=>{
return GUEST.indexOf(item)>-1;
});
new Valine({
el: '#comments' ,
verify: false,
notify: false,
appId: 'czrDDBbrrWAy026psGygR8wO-gzGzoHsz',
appKey: 'VrE6Sv0VS2nP595yJ7fj0Us5',
placeholder: 'ヾノ≧∀≦)o来啊,快活啊!',
avatar:'mm',
guest_info:guest,
pageSize:'10' || 10,
});
</script>
<script src="https://cdn1.lncld.net/static/js/av-core-mini-0.6.4.js"></script>
<script>AV.initialize("czrDDBbrrWAy026psGygR8wO-gzGzoHsz", "VrE6Sv0VS2nP595yJ7fj0Us5");</script>
<script>
function showTime(Counter) {
var query = new AV.Query(Counter);
var entries = [];
var $visitors = $(".leancloud_visitors");
$visitors.each(function () {
entries.push( $(this).attr("id").trim() );
});
query.containedIn('url', entries);
query.find()
.done(function (results) {
var COUNT_CONTAINER_REF = '.leancloud-visitors-count';
if (results.length === 0) {
$visitors.find(COUNT_CONTAINER_REF).text(0);
return;
}
for (var i = 0; i < results.length; i++) {
var item = results[i];
var url = item.get('url');
var time = item.get('time');
var element = document.getElementById(url);
$(element).find(COUNT_CONTAINER_REF).text(time);
}
for(var i = 0; i < entries.length; i++) {
var url = entries[i];
var element = document.getElementById(url);
var countSpan = $(element).find(COUNT_CONTAINER_REF);
if( countSpan.text() == '') {
countSpan.text(0);
}
}
})
.fail(function (object, error) {
console.log("Error: " + error.code + " " + error.message);
});
}
function addCount(Counter) {
var $visitors = $(".leancloud_visitors");
var url = $visitors.attr('id').trim();
var title = $visitors.attr('data-flag-title').trim();
var query = new AV.Query(Counter);
query.equalTo("url", url);
query.find({
success: function(results) {
if (results.length > 0) {
var counter = results[0];
counter.fetchWhenSave(true);
counter.increment("time");
counter.save(null, {
success: function(counter) {
var $element = $(document.getElementById(url));
$element.find('.leancloud-visitors-count').text(counter.get('time'));
},
error: function(counter, error) {
console.log('Failed to save Visitor num, with error message: ' + error.message);
}
});
} else {
var newcounter = new Counter();
/* Set ACL */
var acl = new AV.ACL();
acl.setPublicReadAccess(true);
acl.setPublicWriteAccess(true);
newcounter.setACL(acl);
/* End Set ACL */
newcounter.set("title", title);
newcounter.set("url", url);
newcounter.set("time", 1);
newcounter.save(null, {
success: function(newcounter) {
var $element = $(document.getElementById(url));
$element.find('.leancloud-visitors-count').text(newcounter.get('time'));
},
error: function(newcounter, error) {
console.log('Failed to create');
}
});
}
},
error: function(error) {
console.log('Error:' + error.code + " " + error.message);
}
});
}
$(function() {
var Counter = AV.Object.extend("Counter");
if ($('.leancloud_visitors').length == 1) {
addCount(Counter);
} else if ($('.post-title-link').length > 1) {
showTime(Counter);
}
});
</script>
</body>
</html>