六、网页分析

1、网页标题

标题是SEO作用是最大的,标题可以标识网页的主要内容

intitle:+关键字 查找标题中带有关键字的网页可以查看别人的标题

总结:标题不能太短也不能太长,一定要包含最相关的关键字

2、meta关键字与描述

不要滥用,填几个最关键的 最好组合关键字成一句话。

由于滥用,所以搜索引擎不是很看重这一点

3、headings

关键字

这一点比较重要,尽量包含关键字

4、正文

让文字醒目,加粗,链接等

关键字的紧密程度,例如新概念3 > 新概念第3课

总结:尽量多,而且不影响人的阅读

5、图片

最好不多,因为搜索引擎无法读取图片上的文字,只读取描述。

如上,title是鼠标悬停时出现的提示,alt是图片不正常显示时会出现这段文字。

6、导航

JavaScript、Java Applet 、Flash 做出的菜单对搜索引擎不友好

检验是否使用以上工具做的:工具选项 1.关掉“启用JavaScript”后刷新就看不到了。2.关掉“启用Java”后刷新就看不到了。3.悬停右键会有关于flash的对话框,以及源代码提醒安装flash的代码。

解决方案:保留好看的flash菜单,然后在网页底部做链接的菜单,这样搜索引擎就能继续爬行。

七、搜索引擎提交

1、搜索引擎关系图

https://www.bruceclay.com/searchenginerelationshipchart/

根据关系图分析,提交到Yahoo 、 MSN 、 Google 、 DMOZ黄页则基本涵盖所有引擎。

2、Google

Google Submit

Google提交

只提交域名就可以,即提交首页

3、Yahoo

也分中英文,首先查看一下你的网页是否被收录

现在好像和bing合并了,如果搜索有结果,代表收录了,就不用提交了。

4、Yahoo黄页

首先查看一下你的网页是否被收录

查看同类网站提交的类别

5、dmoz黄页

www.dmoz.org 已无法访问

6、音云导航

首先查看一下你的网页是否被收录

提交地址:https://dh.voiceclouds.cn/contribute

八、域名 链接 其他

1、域名挑选

·国际顶级域名包括

1
.com.org .net .biz .info .mobi …

·国家顶级域名

1
.cn.us .ca .uk …

·其他域名

1
2
3
.tv.io .ws .vc …

.jobs.pro …

好域名的理由

· google 看到google就想到搜索引擎

1
2
3
ebay想到电子商务

Youtube.com视频

· Business.com

· Wikipedia.org

· Megaupload.com

· Apple.com

· G.cn

怎样找域名

·首先域名不可以带数字,横格(-)

·尽量有描述性 好记 相关

·域名一定要brandable,可以做成一个品牌

·找域名对域名的洞察是一种综合能力

找域名的人一定要懂英语因为懂英语思路才开阔

chinanetcn.com xja9-168.com这样的域名 一开始就失败了

现在找到完美的域名已经不大可能了

好域名是点点滴滴优势的积累

但是你找到的要使用的域名一定要有它的理由

·98%的.com域名都被注册了

2、找域名的思路

参考及购买域名:http://gyuming.com/ 免费查看

3、域名与优化

·域名中包含关键字 将会大大提升排名

1
例如发卡网站,fakame.com 就很有优势

·一网站多域名 提供多种渠道被找到

1
比如g.cn会跳转到google.cn 北京谷翔信息技术有限公司

·如果你的域名常被拼错

1
2
3
就把拼错的也注册下来

比如gogle.com就会跳到google.com 谷歌早就想到了

·最好把不同域名下的同一网站 放在ip不同的服务器上托管,多服务器被收录。参考站群服务器。

·把同一网站的不同域名进行不同关键字的优化

4、链接

链接的重要性

1
2
3
4
5
6
7
8
9
10
11
·总体来说指向你网页的链接越多

对搜索引擎排名来说 排名越高

·指向你链接的链接文字也非常重要,越相关越好

·带有指向你的链接的网页

它的流行度越高 排名越高

对你的网页排名越有好处

反向链接的查找

·link:+URL 查找指向这个域名或网页的反向链接的来源

·link survey 工具 (antsoft.com官方掉线了)

1
查看来源网页的结构,然后建造自己的网站。类似比较有好处。

5、frame框架

对搜索引擎不友好

解决方案:在之间加一段描述description。

用来对有些不认识<frameset>浏览器的描述。中间的内容应该替换为含有关键字、网站链接的本页描述,有利于搜索引擎爬取。 <p>6、flash</p> <p>“关键字”filetype:文件类型 查找关键字相关的flash</p> <p>例:”电视”filetype:swf</p> <p>工具:Search Engine SDK 免费下载,可抽取flash当中的文字、链接</p> <p>7、动态网页</p> <p>URL中的? &#x3D; &amp;对搜索引擎不友好</p> <p>避免 ? &#x3D; &amp;</p> <p>·一个这样的URL网址</p> <p><a target="_blank" rel="noopener" href="http://www.nide.com/index.asp?page=1.asp&inpage=1.htm">http://www.nide.com/index.asp?page=1.asp&amp;inpage=1.htm</a></p> <p>可转换为</p> <p><a target="_blank" rel="noopener" href="http://www.nide.com/index.asp/page/1.asp/inpage/1.htm">http://www.nide.com/index.asp/page/1.asp/inpage/1.htm</a></p> <p>·长的URL转为短的URL</p> <p><a target="_blank" rel="noopener" href="http://www.nide.com/index.asp?page=1.asp&inpage=1.htm">http://www.nide.com/index.asp?page=1.asp&amp;inpage=1.htm</a></p> <p>可转换为</p> <p><a target="_blank" rel="noopener" href="http://www.nide.com/index.asp/1748102735">http://www.nide.com/index.asp/1748102735</a></p> <p>很多后台都有内容管理系统,动态转换为静态网页。</p> <p>8、CSS的好处</p> <p>用CSS的好处</p> <p>·CSS是层叠样式表是网页系统美观设计的未来</p> <p>·一个网页用的flash导航javascript图片太多的话,对搜索引擎排名不太友好</p> <p>·用CSS要比不用CSS 整体对搜索引擎要友好</p> <p>·大大的降低文档的大小和增强页面的载入速度</p> <p>·使代码更有条理 利于网页外观的系统化更新改进</p> <p>·对打印机友好</p> <p>·对搜索引擎爬虫友好</p> <p>小问题:版本比较新的CSS规则,老版本浏览器可能不一定支持</p> <p>9、Robot.txt</p> <p>·是一个文件 来告诉搜索引擎爬虫 这个网站内容不愿意被爬行到的内容</p> <p>例如:图片,密码保护的内容,敏感的内容等。</p> <p>样本:</p> <figure class="highlight plaintext"><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">#Disallowdirectory /tupian/ #注释</span><br><span class="line">user-agent:*</span><br><span class="line">Disallow:/tupian/ #该文件夹不能被爬行</span><br><span class="line">Disallow:/*.png$ #根目录下png类型的文件不能被爬行</span><br></pre></td></tr></table></figure> <p>把这个文件另存为robot.txt 然后放在网站根目录</p> <p>10、代码检验</p> <p><a target="_blank" rel="noopener" href="http://www.w3.org/">http://www.w3.org</a></p> <p>定义未来网络的方向标准等。</p> <p><a target="_blank" rel="noopener" href="https://validator.w3.org/checklink">https://validator.w3.org/checklink</a><br>检验网页代码是否符合W3标准</p> <h1 id="九、结尾"><a href="#九、结尾" class="headerlink" title="九、结尾"></a>九、结尾</h1><p>耐心是SEO的关键</p> </article> <div class="article-footer"> <section id="license"> <div class="header"><span>License</span></div> <div class="body"><p>本文采用 <a target="_blank" rel="noopener" href="https://creativecommons.org/licenses/by-nc-sa/4.0/">署名-非商业性使用-相同方式共享 4.0 国际</a> 许可协议,转载请注明出处。</p> </div> </section> </div> <div class="related-wrap" id="read-next"><section class="body"><div class="item" id="prev"><div class="note">Newer</div><a href="/2024/12/22/24%E5%B9%B4TCGA%20GDC%202.0%E7%95%8C%E9%9D%A2%E4%BB%8B%E7%BB%8D%E5%8F%8A%E6%95%B0%E6%8D%AE%E4%B8%8B%E8%BD%BD%E6%95%99%E7%A8%8B/">24年TCGA GDC 2.0界面介绍及数据下载教程</a></div><div class="item" id="next"><div class="note">Older</div><a href="/2024/12/22/TCGARNAseq%E5%B7%AE%E5%BC%82%E5%88%86%E6%9E%90%E7%81%AB%E5%B1%B1%E5%9B%BE/">TCGARNAseq差异分析火山图</a></div></section></div> <footer class="page-footer footnote"><hr><div class="text"><p>本站由 <a href="/">xiehs211</a> 使用 <a target="_blank" rel="noopener" href="https://github.com/xaoxuu/hexo-theme-stellar/tree/1.33.1">Stellar 1.33.1</a> 主题创建。<br>本博客所有文章除特别声明外,均采用 <a target="_blank" rel="noopener" href="https://creativecommons.org/licenses/by-nc-sa/4.0/">CC BY-NC-SA 4.0</a> 许可协议,转载请注明出处。</p> </div></footer> <div class="main-mask" onclick="sidebar.dismiss()"></div></div><aside class="l_right"> <div class="widgets"> <widget class="widget-wrapper toc" id="data-toc" collapse="false"><div class="widget-header dis-select"><span class="name">On This Page</span><a class="cap-action" onclick="sidebar.toggleTOC()" ><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 6h11m-11 6h11m-11 6h11M4 6h1v4m-1 0h2m0 8H4c0-1 2-2 2-3s-1-1.5-2-1"/></svg></a></div><div class="widget-body"><ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#%E5%85%AD%E3%80%81%E7%BD%91%E9%A1%B5%E5%88%86%E6%9E%90"><span class="toc-text">六、网页分析</span></a></li><li class="toc-item toc-level-1"><a class="toc-link"><span class="toc-text">关键字</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E4%B8%83%E3%80%81%E6%90%9C%E7%B4%A2%E5%BC%95%E6%93%8E%E6%8F%90%E4%BA%A4"><span class="toc-text">七、搜索引擎提交</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E5%85%AB%E3%80%81%E5%9F%9F%E5%90%8D-%E9%93%BE%E6%8E%A5-%E5%85%B6%E4%BB%96"><span class="toc-text">八、域名 链接 其他</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E4%B9%9D%E3%80%81%E7%BB%93%E5%B0%BE"><span class="toc-text">九、结尾</span></a></li></ol></div><div class="widget-footer"><a class="top" onclick="util.scrollTop()"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><!-- Icon from Solar by 480 Design - https://creativecommons.org/licenses/by/4.0/ --><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-width="1.5"><path stroke-linejoin="round" d="m9 15.5l3-3l3 3m-6-4l3-3l3 3"/><path d="M7 3.338A9.95 9.95 0 0 1 12 2c5.523 0 10 4.477 10 10s-4.477 10-10 10S2 17.523 2 12c0-1.821.487-3.53 1.338-5"/></g></svg><span>Scroll to Top</span></a></div></widget> </div></aside><div class='float-panel'> <button type='button' style='display:none' class='laptop-only rightbar-toggle mobile' onclick='sidebar.rightbar()'> <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 6h11m-11 6h11m-11 6h11M4 6h1v4m-1 0h2m0 8H4c0-1 2-2 2-3s-1-1.5-2-1"/></svg> </button> <button type='button' style='display:none' class='mobile-only leftbar-toggle mobile' onclick='sidebar.leftbar()'> <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-width="1.5"><path d="M2 11c0-3.771 0-5.657 1.172-6.828C4.343 3 6.229 3 10 3h4c3.771 0 5.657 0 6.828 1.172C22 5.343 22 7.229 22 11v2c0 3.771 0 5.657-1.172 6.828C19.657 21 17.771 21 14 21h-4c-3.771 0-5.657 0-6.828-1.172C2 18.657 2 16.771 2 13z"/><path id="sep" stroke-linecap="round" d="M5.5 10h6m-5 4h4m4.5 7V3"/></g></svg> </button> </div> </div><div class="scripts"> <script type="text/javascript"> window.canonical = {"originalHost":null,"officialHosts":["localhost"],"encoded":""}; const ctx = { date_suffix: { just: `Just`, min: `minutes ago`, hour: `hours ago`, day: `days ago`, }, root : `/`, tag_plugins: { chat: Object.assign({"api":"https://siteinfo.listentothewind.cn/api/v1"}), } }; // required plugins (only load if needs) if (`local_search`) { ctx.search = {}; ctx.search.service = `local_search`; if (ctx.search.service == 'local_search') { let service_obj = Object.assign({}, `{"field":"all","path":"/search.json","content":true,"skip_search":null,"sort":"-date"}`); ctx.search[ctx.search.service] = service_obj; } } const def = { avatar: `https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.12/avatar/round/3442075.svg`, cover: `https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.12/cover/76b86c0226ffd.svg`, loading: `https://api.iconify.design/eos-icons:three-dots-loading.svg?color=%231cd0fd`, }; const deps = { jquery: `https://gcore.jsdelivr.net/npm/jquery@3.7/dist/jquery.min.js`, marked: `https://gcore.jsdelivr.net/npm/marked@13.0/lib/marked.umd.min.js`, lazyload: `/%5Bobject%20Object%5D` } </script> <script type="text/javascript"> function RunItem() { this.list = []; // 存放回调函数 this.start = () => { for (var i = 0; i < this.list.length; i++) { this.list[i].run(); } }; this.push = (fn, name, setRequestAnimationFrame = true) => { let myfn = fn if (setRequestAnimationFrame) { myfn = () => { utils.requestAnimationFrame(fn) } } var f = new Item(myfn, name); this.list.push(f); }; this.remove = (name) => { for (let index = 0; index < this.list.length; index++) { const e = this.list[index]; if (e.name == name) { this.list.splice(index, 1); } } } // 构造一个可以run的对象 function Item(fn, name) { // 函数名称 this.name = name || fn.name; // run方法 this.run = () => { try { fn() } catch (error) { console.log(error); } }; } } const utils = { // 懒加载 css https://github.com/filamentgroup/loadCSS css: (href, before, media, attributes) => { var doc = window.document; var ss = doc.createElement("link"); var ref; if (before) { ref = before; } else { var refs = (doc.body || doc.getElementsByTagName("head")[0]).childNodes; ref = refs[refs.length - 1]; } var sheets = doc.styleSheets; if (attributes) { for (var attributeName in attributes) { if (attributes.hasOwnProperty(attributeName)) { ss.setAttribute(attributeName, attributes[attributeName]); } } } ss.rel = "stylesheet"; ss.href = href; ss.media = "only x"; function ready(cb) { if (doc.body) { return cb(); } setTimeout(function () { ready(cb); }); } ready(function () { ref.parentNode.insertBefore(ss, before ? ref : ref.nextSibling); }); var onloadcssdefined = function (cb) { var resolvedHref = ss.href; var i = sheets.length; while (i--) { if (sheets[i].href === resolvedHref) { return cb(); } } setTimeout(function () { onloadcssdefined(cb); }); }; function loadCB() { if (ss.addEventListener) { ss.removeEventListener("load", loadCB); } ss.media = media || "all"; } if (ss.addEventListener) { ss.addEventListener("load", loadCB); } ss.onloadcssdefined = onloadcssdefined; onloadcssdefined(loadCB); return ss; }, js: (src, opt) => new Promise((resolve, reject) => { var script = document.createElement('script'); if (src.startsWith('/')) { src = ctx.root + src.substring(1); } script.src = src; if (opt) { for (let key of Object.keys(opt)) { script[key] = opt[key] } } else { // 默认异步,如果需要同步,第二个参数传入 {} 即可 script.async = true } script.onerror = reject script.onload = script.onreadystatechange = function () { const loadState = this.readyState if (loadState && loadState !== 'loaded' && loadState !== 'complete') return script.onload = script.onreadystatechange = null resolve() } document.head.appendChild(script) }), jq: (fn) => { if (typeof jQuery === 'undefined') { utils.js(deps.jquery).then(fn) } else { fn() } }, onLoading: (el) => { if (el) { $(el).append('<div class="loading-wrap"><svg xmlns="http://www.w3.org/2000/svg" width="2em" height="2em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-width="2"><path stroke-dasharray="60" stroke-dashoffset="60" stroke-opacity=".3" d="M12 3C16.9706 3 21 7.02944 21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3Z"><animate fill="freeze" attributeName="stroke-dashoffset" dur="1.3s" values="60;0"/></path><path stroke-dasharray="15" stroke-dashoffset="15" d="M12 3C16.9706 3 21 7.02944 21 12"><animate fill="freeze" attributeName="stroke-dashoffset" dur="0.3s" values="15;0"/><animateTransform attributeName="transform" dur="1.5s" repeatCount="indefinite" type="rotate" values="0 12 12;360 12 12"/></path></g></svg></div>'); } }, onLoadSuccess: (el) => { if (el) { $(el).find('.loading-wrap').remove(); } }, onLoadFailure: (el) => { if (el) { $(el).find('.loading-wrap svg').remove(); $(el).find('.loading-wrap').append('<svg xmlns="http://www.w3.org/2000/svg" width="2em" height="2em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path stroke-dasharray="60" stroke-dashoffset="60" d="M12 3L21 20H3L12 3Z"><animate fill="freeze" attributeName="stroke-dashoffset" dur="0.5s" values="60;0"/></path><path stroke-dasharray="6" stroke-dashoffset="6" d="M12 10V14"><animate fill="freeze" attributeName="stroke-dashoffset" begin="0.6s" dur="0.2s" values="6;0"/></path></g><circle cx="12" cy="17" r="1" fill="currentColor" fill-opacity="0"><animate fill="freeze" attributeName="fill-opacity" begin="0.8s" dur="0.4s" values="0;1"/></circle></svg>'); $(el).find('.loading-wrap').addClass('error'); } }, request: (el, url, callback, onFailure) => { const maxRetry = 3; let retryCount = 0; return new Promise((resolve, reject) => { const load = () => { utils.onLoading?.(el); let timedOut = false; const timeout = setTimeout(() => { timedOut = true; console.warn('[request] 超时:', url); if (++retryCount >= maxRetry) { utils.onLoadFailure?.(el); onFailure?.(); reject('请求超时'); } else { setTimeout(load, 1000); } }, 5000); fetch(url).then(resp => { if (timedOut) return; clearTimeout(timeout); if (!resp.ok) throw new Error('响应失败'); return resp; }).then(data => { if (timedOut) return; utils.onLoadSuccess?.(el); callback(data); resolve(data); }).catch(err => { clearTimeout(timeout); console.warn('[request] 错误:', err); if (++retryCount >= maxRetry) { utils.onLoadFailure?.(el); onFailure?.(); reject(err); } else { setTimeout(load, 1000); } }); }; load(); }); }, requestWithoutLoading: (url, options = {}, maxRetry = 2, timeout = 5000) => { return new Promise((resolve, reject) => { let retryCount = 0; const tryRequest = () => { let timedOut = false; const timer = setTimeout(() => { timedOut = true; if (++retryCount > maxRetry) reject('timeout'); else tryRequest(); }, timeout); fetch(url, options) .then(resp => { clearTimeout(timer); if (!resp.ok) throw new Error('bad response'); resolve(resp); }) .catch(err => { clearTimeout(timer); if (++retryCount > maxRetry) reject(err); else setTimeout(tryRequest, 500); }); }; tryRequest(); }); }, /********************** requestAnimationFrame ********************************/ // 1、requestAnimationFrame 会把每一帧中的所有 DOM 操作集中起来,在一次重绘或回流中就完成,并且重绘或回流的时间间隔紧紧跟随浏览器的刷新频率,一般来说,这个频率为每秒60帧。 // 2、在隐藏或不可见的元素中,requestAnimationFrame 将不会进行重绘或回流,这当然就意味着更少的的 cpu,gpu 和内存使用量。 requestAnimationFrame: (fn) => { if (!window.requestAnimationFrame) { window.requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame; } window.requestAnimationFrame(fn) }, dark: {}, }; // utils.dark.mode 当前模式 dark or light // utils.dark.toggle() 暗黑模式触发器 // utils.dark.push(callBack[,"callBackName"]) 传入触发器回调函数 utils.dark.method = { toggle: new RunItem(), }; utils.dark = Object.assign(utils.dark, { push: utils.dark.method.toggle.push, }); </script> <script> const sidebar = { leftbar: () => { if (l_body) { l_body.toggleAttribute('leftbar'); l_body.removeAttribute('rightbar'); } }, rightbar: () => { if (l_body) { l_body.toggleAttribute('rightbar'); l_body.removeAttribute('leftbar'); } }, dismiss: () => { if (l_body) { l_body.removeAttribute('leftbar'); l_body.removeAttribute('rightbar'); } }, toggleTOC: () => { document.querySelector('#data-toc').classList.toggle('collapse'); } } </script> <script type="text/javascript"> (() => { const tagSwitchers = document.querySelectorAll('.tag-subtree.parent-tag > a > .tag-switcher-wrapper') for (const tagSwitcher of tagSwitchers) { tagSwitcher.addEventListener('click', (e) => { const parent = e.target.closest('.tag-subtree.parent-tag') parent.classList.toggle('expanded') e.preventDefault() }) } // Get active tag from query string, then activate it. const urlParams = new URLSearchParams(window.location.search) const activeTag = urlParams.get('tag') if (activeTag) { let tag = document.querySelector(`.tag-subtree[data-tag="${activeTag}"]`) if (tag) { tag.querySelector('a').classList.add('active') while (tag) { tag.classList.add('expanded') tag = tag.parentElement.closest('.tag-subtree.parent-tag') } } } })() </script> <script async src="https://gcore.jsdelivr.net/npm/vanilla-lazyload@19.1/dist/lazyload.min.js"></script> <script> // https://www.npmjs.com/package/vanilla-lazyload // Set the options globally // to make LazyLoad self-initialize window.lazyLoadOptions = { elements_selector: ".lazy", callback_loaded: (el) => { el.classList.add('loaded'); const wrapper = el.closest('.lazy-box'); const icon = wrapper?.querySelector('.lazy-icon'); if (icon) icon.remove(); } }; // Listen to the initialization event // and get the instance of LazyLoad window.addEventListener( "LazyLoad::Initialized", function (event) { window.lazyLoadInstance = event.detail.instance; }, false ); document.addEventListener('DOMContentLoaded', function () { window.lazyLoadInstance?.update(); }); window.wrapLazyloadImages = (container) => { if (typeof container === 'string') { container = document.querySelector(container); } if (!container) return; const images = container.querySelectorAll('img'); images.forEach((img) => { if (img.classList.contains('lazy')) return; const src = img.getAttribute('src'); if (!src) return; const wrapper = document.createElement('div'); wrapper.className = 'lazy-box'; const newImg = img.cloneNode(); newImg.removeAttribute('src'); newImg.setAttribute('data-src', src); newImg.classList.add('lazy'); const icon = document.createElement('div'); icon.className = 'lazy-icon'; if (def.loading) { icon.style.backgroundImage = `url("${def.loading}")`; } wrapper.appendChild(newImg); wrapper.appendChild(icon); img.replaceWith(wrapper); }); // 通知 LazyLoad 更新 if (window.lazyLoadInstance?.update) { window.lazyLoadInstance.update(); } } </script> <!-- required --> <script src="/js/main.js?v=1.33.1" defer></script> <script type="text/javascript"> const applyTheme = (theme) => { if (theme === 'auto') { document.documentElement.removeAttribute('data-theme') } else { document.documentElement.setAttribute('data-theme', theme) } // applyThemeToGiscus(theme) } // FIXME: 这会导致无法使用 preferred_color_scheme 以外的主题 const applyThemeToGiscus = (theme) => { // theme = theme === 'auto' ? 'preferred_color_scheme' : theme const cmt = document.getElementById('giscus') if (cmt) { // This works before giscus load. cmt.setAttribute('data-theme', theme) } const iframe = document.querySelector('#comments > section.giscus > iframe') if (iframe) { // This works after giscus loaded. const src = iframe.src const newSrc = src.replace(/theme=[\w]+/, `theme=${theme}`) iframe.src = newSrc } } const switchTheme = () => { // light -> dark -> auto -> light -> ... const currentTheme = document.documentElement.getAttribute('data-theme') let newTheme; switch (currentTheme) { case 'light': newTheme = 'dark' break case 'dark': newTheme = 'auto' break default: newTheme = 'light' } applyTheme(newTheme) window.localStorage.setItem('Stellar.theme', newTheme) utils.dark.mode = newTheme === 'auto' ? (window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light") : newTheme; utils.dark.method.toggle.start(); const messages = { light: `Switched to Light Mode`, dark: `Switched to Dark Mode`, auto: `Switched to Auto Mode`, } hud?.toast?.(messages[newTheme]) } (() => { // Apply user's preferred theme, if any. const theme = window.localStorage.getItem('Stellar.theme') if (theme !== null) { applyTheme(theme) } else { utils.dark.mode = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"; } utils.dark.method.toggle.start(); })() </script> <!-- optional --> <script defer> window.addEventListener('DOMContentLoaded', (event) => { ctx.services = Object.assign({}, JSON.parse(`{"mdrender":{"js":"/js/services/mdrender.js"},"siteinfo":{"js":"/js/services/siteinfo.js","api":null},"ghinfo":{"js":"/js/services/ghinfo.js"},"rating":{"js":"/js/services/rating.js","api":"https://star-vote.xaox.cc/api/rating"},"vote":{"js":"/js/services/vote.js","api":"https://star-vote.xaox.cc/api/vote"},"sites":{"js":"/js/services/sites.js"},"friends":{"js":"/js/services/friends.js"},"friends_and_posts":{"js":"/js/services/friends_and_posts.js"},"timeline":{"js":"/js/services/timeline.js"},"fcircle":{"js":"/js/services/fcircle.js"},"weibo":{"js":"/js/services/weibo.js"},"memos":{"js":"/js/services/memos.js"},"voice":{"js":"/js/plugins/voice.js"},"video":{"js":"/js/plugins/video.js"},"download-file":{"js":"/js/plugins/download-file.js"},"twikoo":{"js":"/js/services/twikoo_latest_comment.js"},"waline":{"js":"/js/services/waline_latest_comment.js"},"artalk":{"js":"/js/services/artalk_latest_comment.js"},"giscus":{"js":"/js/services/giscus_latest_comment.js"},"contributors":{"edit_this_page":{"_posts/":null,"wiki/stellar/":"https://github.com/xaoxuu/hexo-theme-stellar-docs/blob/main/"},"js":"/js/services/contributors.js"}}`)); for (let id of Object.keys(ctx.services)) { const js = ctx.services[id].js; if (id == 'siteinfo') { ctx.cardlinks = document.querySelectorAll('a.link-card[cardlink]'); if (ctx.cardlinks?.length > 0) { utils.js(js, { defer: true }).then(function () { setCardLink(ctx.cardlinks); }); } } else if (id == 'voice') { ctx.voiceAudios = document.querySelectorAll('.voice>audio'); if (ctx.voiceAudios?.length > 0) { utils.js(js, { defer: true }).then(function () { createVoiceDom(ctx.voiceAudios); }); } } else if (id == 'video') { ctx.videos = document.querySelectorAll('.video>video'); if (ctx.videos?.length > 0) { utils.js(js, { defer: true }).then(function () { videoEvents(ctx.videos); }); } } else if (id == 'download-file') { ctx.files = document.querySelectorAll('.file'); if (ctx.files?.length > 0) { utils.js(js, { defer: true }).then(function () { downloadFileEvent(ctx.files); }); } } else { const els = document.getElementsByClassName(`ds-${id}`); if (els?.length > 0) { utils.jq(() => { if (id == 'timeline' || 'memos' || 'marked') { utils.js(deps.marked).then(function () { utils.js(js, { defer: true }); }); } else { utils.js(js, { defer: true }); } }); } } } // chat iphone time let phoneTimes = document.querySelectorAll('.chat .status-bar .time'); if (phoneTimes.length > 0) { NowTime(); var date = new Date(); var sec = date.getSeconds(); var firstAdjustInterval = setInterval(firstAdjustTime, 1000 * (60 - sec)); } function firstAdjustTime() { NowTime(); clearInterval(firstAdjustInterval); setInterval(NowTime, 1000 * 60); } function NowTime() { for (let i = 0; i < phoneTimes.length; ++i) { var timeSpan = phoneTimes[i]; var date = new Date(); var hour = date.getHours(); var min = date.getMinutes(); timeSpan.innerHTML = check(hour) + ":" + check(min); } }; function check(val) { if (val < 10) { return ("0" + val); } return (val); } // chat quote const chat_quote_obverser = new IntersectionObserver((entries, observer) => { entries.filter((entry) => { return entry.isIntersecting }).sort((a, b) => a.intersectionRect.y !== b.intersectionRect.y ? a.intersectionRect.y - b.intersectionRect.y : a.intersectionRect.x - b.intersectionRect.x).forEach((entry, index) => { observer.unobserve(entry.target); setTimeout(() => { entry.target.classList.add('quote-blink'); setTimeout(() => { entry.target.classList.remove('quote-blink'); }, 1000); }, Math.max(100, 16) * (index + 1)); }); }); var chatQuotes = document.querySelectorAll(".chat .talk .quote"); chatQuotes.forEach((quote) => { quote.addEventListener('click', function () { var chatCellDom = document.getElementById("quote-" + quote.getAttribute("quotedCellTag")); if (chatCellDom) { var chatDiv = chatCellDom.parentElement; var mid = chatDiv.clientHeight / 2; var offsetTop = chatCellDom.offsetTop; if (offsetTop > mid - chatCellDom.clientHeight / 2) { chatDiv.scrollTo({ top: chatCellDom.offsetTop - mid + chatCellDom.clientHeight / 2, behavior: "smooth" }); } else { chatDiv.scrollTo({ top: 0, behavior: "smooth" }); } chat_quote_obverser.observe(chatCellDom); } }); }); }); </script> <script> window.addEventListener('DOMContentLoaded', (event) => { ctx.search = { path: `/search.json`, } utils.js('/js/search/local-search.js', { defer: true }); }); </script><script> window.FPConfig = { delay: 0, ignoreKeywords: [], maxRPS: 5, hoverDelay: 25 }; </script> <script defer src="https://gcore.jsdelivr.net/npm/flying-pages@2/flying-pages.min.js"></script><script> ctx.fancybox = { selector: `.timenode p>img`, css: `https://gcore.jsdelivr.net/npm/@fancyapps/ui@5.0/dist/fancybox/fancybox.css`, js: `https://gcore.jsdelivr.net/npm/@fancyapps/ui@5.0/dist/fancybox/fancybox.umd.js` }; var selector = '[data-fancybox]:not(.error), .with-fancybox .atk-content img:not([atk-emoticon])'; if (ctx.fancybox.selector) { selector += `, ${ctx.fancybox.selector}` } var needFancybox = document.querySelectorAll(selector).length !== 0; if (!needFancybox) { const memos = document.getElementsByClassName('ds-memos'); if (memos != undefined && memos.length > 0) { needFancybox = true; } const fancybox = document.getElementsByClassName('with-fancybox'); if (fancybox != undefined && fancybox.length > 0) { needFancybox = true; } } if (needFancybox) { utils.css(ctx.fancybox.css); utils.js(ctx.fancybox.js, { defer: true }).then(function () { Fancybox.bind(selector, { hideScrollbar: false, Thumbs: { autoStart: false, }, caption: (fancybox, slide) => { return slide.triggerEl.alt || slide.triggerEl.dataset.caption || null } }); }) } </script> <script> window.addEventListener('DOMContentLoaded', (event) => { const swiper_api = document.getElementById('swiper-api'); if (swiper_api != undefined) { utils.css(`https://unpkg.com/swiper@10.3/swiper-bundle.min.css`); utils.js(`https://unpkg.com/swiper@10.3/swiper-bundle.min.js`, { defer: true }).then(function () { const effect = swiper_api.getAttribute('effect') || ''; var swiper = new Swiper('.swiper#swiper-api', { slidesPerView: 'auto', spaceBetween: 8, centeredSlides: true, effect: effect, rewind: true, pagination: { el: '.swiper-pagination', clickable: true, }, navigation: { nextEl: '.swiper-button-next', prevEl: '.swiper-button-prev', }, }); }) } }); </script> <script> document.addEventListener('DOMContentLoaded', function () { window.codeElements = document.querySelectorAll('.code'); if (window.codeElements.length > 0) { ctx.copycode = { default_text: `Copy`, success_text: `Copied`, toast: `复制成功`, }; utils.js('/js/plugins/copycode.js'); } }); </script> <!-- inject --> </div></body></html>