Skip to content

Commit

Permalink
Site updated: 2021-04-02 15:56:41
Browse files Browse the repository at this point in the history
  • Loading branch information
祁耀博 committed Apr 2, 2021
1 parent ffca03e commit 29cb2d7
Show file tree
Hide file tree
Showing 10 changed files with 756 additions and 39 deletions.
105 changes: 99 additions & 6 deletions 2021/04/01/blog搭建/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@

<script id="hexo-configurations">
var NexT = window.NexT || {};
var CONFIG = {"hostname":"example.com","root":"/","scheme":"Gemini","version":"7.8.0","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":false,"show_result":false,"style":null},"back2top":{"enable":true,"sidebar":false,"scrollpercent":false},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"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"}},"localsearch":{"enable":false,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}}};
var CONFIG = {"hostname":"yaoboqi.github.io","root":"/","scheme":"Gemini","version":"7.8.0","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":false,"show_result":false,"style":null},"back2top":{"enable":true,"sidebar":false,"scrollpercent":false},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"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"}},"localsearch":{"enable":false,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}}};
</script>

<meta name="description" content="1、Node.js安装 https:&#x2F;&#x2F;nodejs.org&#x2F;zh-cn&#x2F;2、Git安装 https:&#x2F;&#x2F;git-scm.com&#x2F;3、hexo安装 https:&#x2F;&#x2F;hexo.io&#x2F;zh-cn&#x2F;4、主题-next https:&#x2F;&#x2F;hexo.io&#x2F;themes&#x2F; 常用命令新建网站1$ hexo init 新建文章1$ hexo new &quot;post title with whitespace">
<meta property="og:type" content="article">
<meta property="og:title" content="环境搭建">
<meta property="og:url" content="http://example.com/2021/04/01/blog%E6%90%AD%E5%BB%BA/index.html">
<meta property="og:url" content="https://yaoboqi.github.io/2021/04/01/blog%E6%90%AD%E5%BB%BA/index.html">
<meta property="og:site_name" content="比太阳耀眼">
<meta property="og:description" content="1、Node.js安装 https:&#x2F;&#x2F;nodejs.org&#x2F;zh-cn&#x2F;2、Git安装 https:&#x2F;&#x2F;git-scm.com&#x2F;3、hexo安装 https:&#x2F;&#x2F;hexo.io&#x2F;zh-cn&#x2F;4、主题-next https:&#x2F;&#x2F;hexo.io&#x2F;themes&#x2F; 常用命令新建网站1$ hexo init 新建文章1$ hexo new &quot;post title with whitespace">
<meta property="og:locale" content="zh_CN">
Expand All @@ -33,7 +33,7 @@
<meta property="article:tag" content="php,mysql,nginx">
<meta name="twitter:card" content="summary">

<link rel="canonical" href="http://example.com/2021/04/01/blog%E6%90%AD%E5%BB%BA/">
<link rel="canonical" href="https://yaoboqi.github.io/2021/04/01/blog%E6%90%AD%E5%BB%BA/">


<script id="page-configurations">
Expand Down Expand Up @@ -152,7 +152,7 @@ <h1 class="site-title">比太阳耀眼</h1>


<article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
<link itemprop="mainEntityOfPage" href="http://example.com/2021/04/01/blog%E6%90%AD%E5%BB%BA/">
<link itemprop="mainEntityOfPage" href="https://yaoboqi.github.io/2021/04/01/blog%E6%90%AD%E5%BB%BA/">

<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="image" content="/images/bjtp.jpeg">
Expand Down Expand Up @@ -180,6 +180,13 @@ <h1 class="post-title" itemprop="name headline">
</span>


<span id="/2021/04/01/blog%E6%90%AD%E5%BB%BA/" class="post-meta-item leancloud_visitors" data-flag-title="环境搭建" title="阅读次数">
<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>
Expand Down Expand Up @@ -220,7 +227,7 @@ <h2 id="部署插件"><a href="#部署插件" class="headerlink" title="部署



<footer class="post-footer">
<footer class="post-footer">



Expand Down Expand Up @@ -338,7 +345,7 @@ <h2 id="部署插件"><a href="#部署插件" class="headerlink" title="部署
<span class="with-love">
<i class="fa fa-heart"></i>
</span>
<span class="author" itemprop="copyrightHolder">Yao Bo</span>
<span class="author" itemprop="copyrightHolder">yaobo</span>
</div>
<div class="powered-by"><a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> & <a href="https://theme-next.org/" class="theme-link" rel="noopener" target="_blank">NexT.Gemini</a> 强力驱动
</div>
Expand All @@ -350,6 +357,92 @@ <h2 id="部署插件"><a href="#部署插件" class="headerlink" title="部署



<script>
(function() {
function leancloudSelector(url) {
url = encodeURI(url);
return document.getElementById(url).querySelector('.leancloud-visitors-count');
}

function addCount(Counter) {
var visitors = document.querySelector('.leancloud_visitors');
var url = decodeURI(visitors.id);
var title = visitors.dataset.flagTitle;

Counter('get', '/classes/Counter?where=' + encodeURIComponent(JSON.stringify({ url })))
.then(response => response.json())
.then(({ results }) => {
if (results.length > 0) {
var counter = results[0];
leancloudSelector(url).innerText = counter.time + 1;
Counter('put', '/classes/Counter/' + counter.objectId, { time: { '__op': 'Increment', 'amount': 1 } })
.catch(error => {
console.error('Failed to save visitor count', error);
});
} else {
leancloudSelector(url).innerText = 'Counter not initialized! More info at console err msg.';
console.error('ATTENTION! LeanCloud counter has security bug, see how to solve it here: https://github.com/theme-next/hexo-leancloud-counter-security. \n However, you can still use LeanCloud without security, by setting `security` option to `false`.');

}
})
.catch(error => {
console.error('LeanCloud Counter Error', error);
});
}

function showTime(Counter) {
var visitors = document.querySelectorAll('.leancloud_visitors');
var entries = [...visitors].map(element => {
return decodeURI(element.id);
});

Counter('get', '/classes/Counter?where=' + encodeURIComponent(JSON.stringify({ url: { '$in': entries } })))
.then(response => response.json())
.then(({ results }) => {
for (let url of entries) {
let target = results.find(item => item.url === url);
leancloudSelector(url).innerText = target ? target.time : 0;
}
})
.catch(error => {
console.error('LeanCloud Counter Error', error);
});
}

let { app_id, app_key, server_url } = {"enable":true,"app_id":"OJvfMmDUwuGB7kg6AHi9MTpK-MdYXbMMI","app_key":"GxfLNM81lu9bXyVcdM28hBd9","server_url":null,"security":true,"betterPerformance":false};
function fetchData(api_server) {
var Counter = (method, url, data) => {
return fetch(`${api_server}/1.1${url}`, {
method,
headers: {
'X-LC-Id' : app_id,
'X-LC-Key' : app_key,
'Content-Type': 'application/json',
},
body: JSON.stringify(data)
});
};
if (CONFIG.page.isPost) {
if (CONFIG.hostname !== location.hostname) return;
addCount(Counter);
} else if (document.querySelectorAll('.post-title-link').length >= 1) {
showTime(Counter);
}
}

let api_server = app_id.slice(-9) !== '-MdYXbMMI' ? server_url : `https://${app_id.slice(0, 8).toLowerCase()}.api.lncldglobal.com`;

if (api_server) {
fetchData(api_server);
} else {
fetch('https://app-router.leancloud.cn/2/route?appId=' + app_id)
.then(response => response.json())
.then(({ api_server }) => {
fetchData('https://' + api_server);
});
}
})();
</script>


</div>
Expand Down
105 changes: 99 additions & 6 deletions 2021/04/01/hello-world/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@

<script id="hexo-configurations">
var NexT = window.NexT || {};
var CONFIG = {"hostname":"example.com","root":"/","scheme":"Gemini","version":"7.8.0","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":false,"show_result":false,"style":null},"back2top":{"enable":true,"sidebar":false,"scrollpercent":false},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"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"}},"localsearch":{"enable":false,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}}};
var CONFIG = {"hostname":"yaoboqi.github.io","root":"/","scheme":"Gemini","version":"7.8.0","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":false,"show_result":false,"style":null},"back2top":{"enable":true,"sidebar":false,"scrollpercent":false},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"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"}},"localsearch":{"enable":false,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}}};
</script>

<meta name="description" content="Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub. Quick">
<meta property="og:type" content="article">
<meta property="og:title" content="Hello World">
<meta property="og:url" content="http://example.com/2021/04/01/hello-world/index.html">
<meta property="og:url" content="https://yaoboqi.github.io/2021/04/01/hello-world/index.html">
<meta property="og:site_name" content="比太阳耀眼">
<meta property="og:description" content="Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub. Quick">
<meta property="og:locale" content="zh_CN">
Expand All @@ -33,7 +33,7 @@
<meta property="article:tag" content="php,mysql,nginx">
<meta name="twitter:card" content="summary">

<link rel="canonical" href="http://example.com/2021/04/01/hello-world/">
<link rel="canonical" href="https://yaoboqi.github.io/2021/04/01/hello-world/">


<script id="page-configurations">
Expand Down Expand Up @@ -152,7 +152,7 @@ <h1 class="site-title">比太阳耀眼</h1>


<article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
<link itemprop="mainEntityOfPage" href="http://example.com/2021/04/01/hello-world/">
<link itemprop="mainEntityOfPage" href="https://yaoboqi.github.io/2021/04/01/hello-world/">

<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="image" content="/images/bjtp.jpeg">
Expand All @@ -179,6 +179,13 @@ <h1 class="post-title" itemprop="name headline">
</span>


<span id="/2021/04/01/hello-world/" class="post-meta-item leancloud_visitors" data-flag-title="Hello World" title="阅读次数">
<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>
Expand Down Expand Up @@ -209,7 +216,7 @@ <h3 id="Deploy-to-remote-sites"><a href="#Deploy-to-remote-sites" class="headerl



<footer class="post-footer">
<footer class="post-footer">



Expand Down Expand Up @@ -327,7 +334,7 @@ <h3 id="Deploy-to-remote-sites"><a href="#Deploy-to-remote-sites" class="headerl
<span class="with-love">
<i class="fa fa-heart"></i>
</span>
<span class="author" itemprop="copyrightHolder">Yao Bo</span>
<span class="author" itemprop="copyrightHolder">yaobo</span>
</div>
<div class="powered-by"><a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> & <a href="https://theme-next.org/" class="theme-link" rel="noopener" target="_blank">NexT.Gemini</a> 强力驱动
</div>
Expand All @@ -339,6 +346,92 @@ <h3 id="Deploy-to-remote-sites"><a href="#Deploy-to-remote-sites" class="headerl



<script>
(function() {
function leancloudSelector(url) {
url = encodeURI(url);
return document.getElementById(url).querySelector('.leancloud-visitors-count');
}

function addCount(Counter) {
var visitors = document.querySelector('.leancloud_visitors');
var url = decodeURI(visitors.id);
var title = visitors.dataset.flagTitle;

Counter('get', '/classes/Counter?where=' + encodeURIComponent(JSON.stringify({ url })))
.then(response => response.json())
.then(({ results }) => {
if (results.length > 0) {
var counter = results[0];
leancloudSelector(url).innerText = counter.time + 1;
Counter('put', '/classes/Counter/' + counter.objectId, { time: { '__op': 'Increment', 'amount': 1 } })
.catch(error => {
console.error('Failed to save visitor count', error);
});
} else {
leancloudSelector(url).innerText = 'Counter not initialized! More info at console err msg.';
console.error('ATTENTION! LeanCloud counter has security bug, see how to solve it here: https://github.com/theme-next/hexo-leancloud-counter-security. \n However, you can still use LeanCloud without security, by setting `security` option to `false`.');

}
})
.catch(error => {
console.error('LeanCloud Counter Error', error);
});
}

function showTime(Counter) {
var visitors = document.querySelectorAll('.leancloud_visitors');
var entries = [...visitors].map(element => {
return decodeURI(element.id);
});

Counter('get', '/classes/Counter?where=' + encodeURIComponent(JSON.stringify({ url: { '$in': entries } })))
.then(response => response.json())
.then(({ results }) => {
for (let url of entries) {
let target = results.find(item => item.url === url);
leancloudSelector(url).innerText = target ? target.time : 0;
}
})
.catch(error => {
console.error('LeanCloud Counter Error', error);
});
}

let { app_id, app_key, server_url } = {"enable":true,"app_id":"OJvfMmDUwuGB7kg6AHi9MTpK-MdYXbMMI","app_key":"GxfLNM81lu9bXyVcdM28hBd9","server_url":null,"security":true,"betterPerformance":false};
function fetchData(api_server) {
var Counter = (method, url, data) => {
return fetch(`${api_server}/1.1${url}`, {
method,
headers: {
'X-LC-Id' : app_id,
'X-LC-Key' : app_key,
'Content-Type': 'application/json',
},
body: JSON.stringify(data)
});
};
if (CONFIG.page.isPost) {
if (CONFIG.hostname !== location.hostname) return;
addCount(Counter);
} else if (document.querySelectorAll('.post-title-link').length >= 1) {
showTime(Counter);
}
}

let api_server = app_id.slice(-9) !== '-MdYXbMMI' ? server_url : `https://${app_id.slice(0, 8).toLowerCase()}.api.lncldglobal.com`;

if (api_server) {
fetchData(api_server);
} else {
fetch('https://app-router.leancloud.cn/2/route?appId=' + app_id)
.then(response => response.json())
.then(({ api_server }) => {
fetchData('https://' + api_server);
});
}
})();
</script>


</div>
Expand Down
Loading

0 comments on commit 29cb2d7

Please sign in to comment.