mirror of
https://github.com/dillonzq/LoveIt.git
synced 2024-11-14 02:46:16 +01:00
fix: fix icon css bug
This commit is contained in:
parent
7639927bd5
commit
45c9281131
11 changed files with 26 additions and 20 deletions
|
@ -73,3 +73,9 @@ a {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
i.fas,
|
||||
i.far,
|
||||
i.fab {
|
||||
padding: 0 .2rem;
|
||||
}
|
||||
|
|
|
@ -115,7 +115,7 @@ jQuery(function($) {
|
|||
const headers = document.querySelectorAll('.post-content>h' + num);
|
||||
for (let i = 0; i < headers.length; i++) {
|
||||
const header = headers[i];
|
||||
header.innerHTML = `<a href="#${header.id}" class="headerlink anchor"><i class="iconfont icon-link"></i></a>${header.innerHTML}`;
|
||||
header.innerHTML = `<a href="#${header.id}" class="headerlink"></a>${header.innerHTML}`;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
jQuery(function($){'use strict';var _Blog=window._Blog||{};_Blog.toggleMobileMenu=function(){$('#menu-toggle').on('click',()=>{$('#menu-toggle').toggleClass('active');$('#mobile-menu').toggleClass('active');});};_Blog.toggleTheme=function(){$('.theme-switch').on('click',()=>{$('body').toggleClass('dark-theme');isDark=!isDark;window.localStorage&&window.localStorage.setItem('theme',isDark?'dark':'light');this.echarts();});};_Blog.changeTitle=function(){var currentTitle=document.title;window.onblur=function(){document.title=currentTitle;};window.onfocus=function(){document.title=currentTitle;};};_Blog.dynamicToTop=function(){const min=300;var $toTop=$('#dynamic-to-top');$(window).scroll(function(){var scrollTop=$(window).scrollTop();if(typeof document.body.style.maxHeight==='undefined'){$toTop.css({'position':'absolute','top':scrollTop+$(window).height()-20,});}
|
||||
if(scrollTop>min){(function fadeIn(el,display){display=display||"block";if(el.style.display!==display){el.style.opacity=0;el.style.display=display;(function fade(){var val=parseFloat(el.style.opacity);if(!((val+=.1)>1)){el.style.opacity=val;requestAnimationFrame(fade);}})();}})(document.getElementById('dynamic-to-top'));}else{(function fadeOut(el){if(el.style.display!=="none"){el.style.opacity=1;(function fade(){if((el.style.opacity-=.1)<0){el.style.display="none";}else{requestAnimationFrame(fade);}})();}})(document.getElementById('dynamic-to-top'));}});};_Blog.chroma=function(){const blocks=document.querySelectorAll('.highlight > .chroma');for(let i=0;i<blocks.length;i++){const block=blocks[i];const afterHighLight=block.querySelector('pre.chroma > code');const lang=afterHighLight?afterHighLight.className:'';block.className+=' '+lang;}};_Blog.responsiveTable=function(){const tables=document.querySelectorAll('.post-content table');for(let i=0;i<tables.length;i++){const table=tables[i];const wrapper=document.createElement('div');wrapper.className='table-wrapper';table.parentElement.replaceChild(wrapper,table);wrapper.appendChild(table);}};_Blog._refactorToc=function(toc){const oldTocList=toc.children[0];let newTocList=oldTocList;let temp;while(newTocList.children.length===1&&(temp=newTocList.children[0].children[0]).tagName==='UL'){newTocList=temp;}
|
||||
if(newTocList!==oldTocList)toc.replaceChild(newTocList,oldTocList);};_Blog._linkToc=function(){const links=document.querySelectorAll('#TableOfContents a:first-child');for(let i=0;i<links.length;i++)links[i].className+=' toc-link';for(let num=1;num<=6;num++){const headers=document.querySelectorAll('.post-content>h'+num);for(let i=0;i<headers.length;i++){const header=headers[i];header.innerHTML=`<a href="#${header.id}" class="headerlink anchor"><i class="iconfont icon-link"></i></a>${header.innerHTML}`;}}};_Blog._initToc=function(){const $toc=$('#post-toc');if($toc.length&&$toc.css('display')!=='none'){const SPACING=100;const $footer=$('#post-footer');const minTop=$toc.position().top;;const mainTop=$('main').position().top;const minScrollTop=minTop+mainTop-SPACING;const changeTocState=function(){const scrollTop=$(window).scrollTop();const maxTop=$footer.position().top-$toc.height();const maxScrollTop=maxTop+mainTop-SPACING;const tocState={start:{'position':'absolute','top':minTop,},process:{'position':'fixed','top':SPACING,},end:{'position':'absolute','top':maxTop,}};if(scrollTop<minScrollTop){$toc.css(tocState.start);}else if(scrollTop>maxScrollTop){$toc.css(tocState.end);}else{$toc.css(tocState.process);}};changeTocState();const HEADERFIX=100;const $toclink=$('.toc-link');const $headerlink=$('.headerlink');const $tocLinkLis=$('.post-toc-content li');const activeIndex=function(){const scrollTop=$(window).scrollTop();const headerlinkTop=$.map($headerlink,function(link){return $(link).offset().top;});const headerLinksOffsetForSearch=$.map(headerlinkTop,function(offset){return offset-HEADERFIX;});const searchActiveTocIndex=function(array,target){for(let i=0;i<array.length-1;i++){if(target>array[i]&&target<=array[i+1])return i;}
|
||||
if(newTocList!==oldTocList)toc.replaceChild(newTocList,oldTocList);};_Blog._linkToc=function(){const links=document.querySelectorAll('#TableOfContents a:first-child');for(let i=0;i<links.length;i++)links[i].className+=' toc-link';for(let num=1;num<=6;num++){const headers=document.querySelectorAll('.post-content>h'+num);for(let i=0;i<headers.length;i++){const header=headers[i];header.innerHTML=`<a href="#${header.id}" class="headerlink"></a>${header.innerHTML}`;}}};_Blog._initToc=function(){const $toc=$('#post-toc');if($toc.length&&$toc.css('display')!=='none'){const SPACING=100;const $footer=$('#post-footer');const minTop=$toc.position().top;;const mainTop=$('main').position().top;const minScrollTop=minTop+mainTop-SPACING;const changeTocState=function(){const scrollTop=$(window).scrollTop();const maxTop=$footer.position().top-$toc.height();const maxScrollTop=maxTop+mainTop-SPACING;const tocState={start:{'position':'absolute','top':minTop,},process:{'position':'fixed','top':SPACING,},end:{'position':'absolute','top':maxTop,}};if(scrollTop<minScrollTop){$toc.css(tocState.start);}else if(scrollTop>maxScrollTop){$toc.css(tocState.end);}else{$toc.css(tocState.process);}};changeTocState();const HEADERFIX=100;const $toclink=$('.toc-link');const $headerlink=$('.headerlink');const $tocLinkLis=$('.post-toc-content li');const activeIndex=function(){const scrollTop=$(window).scrollTop();const headerlinkTop=$.map($headerlink,function(link){return $(link).offset().top;});const headerLinksOffsetForSearch=$.map(headerlinkTop,function(offset){return offset-HEADERFIX;});const searchActiveTocIndex=function(array,target){for(let i=0;i<array.length-1;i++){if(target>array[i]&&target<=array[i+1])return i;}
|
||||
if(target>array[array.length-1])return array.length-1;return 0;};const activeTocIndex=searchActiveTocIndex(headerLinksOffsetForSearch,scrollTop);$($toclink).removeClass('active');$($tocLinkLis).removeClass('has-active');if(activeTocIndex!==-1){$($toclink[activeTocIndex]).addClass('active');let ancestor=$toclink[activeTocIndex].parentNode;while(ancestor.tagName!=='NAV'){$(ancestor).addClass('has-active');ancestor=ancestor.parentNode.parentNode;}}};activeIndex();if(!this._initTocOnce){$(window).scroll(changeTocState);$(window).scroll(activeIndex);this._initTocOnce=true;}}};_Blog.toc=function(){const tocContainer=document.getElementById('post-toc');if(tocContainer!==null){const toc=document.getElementById('TableOfContents');if(toc===null){tocContainer.parentNode.removeChild(tocContainer);}else{this._refactorToc(toc);this._linkToc();this._initToc();window.addEventListener("resize",function(){this.setTimeout(_Blog._initToc,0);},false);}}};_Blog.echarts=function(){if(window.echartsMap){for(let i=0;i<echartsArr.length;i++){echartsArr[i].dispose();}
|
||||
echartsArr=[];Object.keys(echartsMap).forEach(function(id){let myChart=echarts.init(document.getElementById(id),window.isDark?'dark':'macarons',{renderer:'svg'});myChart.setOption(echartsMap[id]);echartsArr.push(myChart);});window.addEventListener("resize",function(){this.setTimeout(function(){for(let i=0;i<echartsArr.length;i++){echartsArr[i].resize();}},0);},false);}}
|
||||
_Blog.countdown=function(){if(window.countdownMap){Object.keys(countdownMap).forEach(function(id){$(`#${id}`).countdown(countdownMap[id]['date'],{elapse:true}).on('update.countdown',function(event){$(this).html(event.strftime(countdownMap[id]['pattern']));});});}};_Blog.typeit=function(){if(window.typeitArr){for(let i=0;i<typeitArr.length;i++){const group=typeitArr[i];(function typeone(i){if(i===group.length-1){new TypeIt(`#${group[i]}`,{strings:document.getElementById(`r${group[i]}`).innerHTML,}).go();return;}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -18,7 +18,7 @@
|
|||
</h1>
|
||||
|
||||
<div class="post-meta">
|
||||
<a class="author" href="{{.Site.BaseURL }}" rel="author"><i class="fas fa-user-circle"></i> {{ $author }} </a>
|
||||
<a class="author" href="{{.Site.BaseURL }}" rel="author"><i class="fas fa-user-circle"></i>{{ $author }} </a>
|
||||
{{ T "publish" }}<span class="post-time"> <time datetime={{ $publish_date }}>{{ $publish_date }}</time> </span>
|
||||
{{ with .Params.categories -}}
|
||||
<span class="post-category">
|
||||
|
@ -26,7 +26,7 @@
|
|||
{{ range . }}
|
||||
{{- $name := . -}}
|
||||
{{- with $.Site.GetPage "taxonomy" (printf "categories/%s" $name) | default ($.Site.GetPage "taxonomy" (printf "categories/%s" ($name | urlize))) -}}
|
||||
<i class="far fa-folder"></i> <a href="{{ .Permalink }}">{{ $name }}</a>
|
||||
<i class="far fa-folder"></i><a href="{{ .Permalink }}">{{ $name }}</a>
|
||||
{{ end -}}
|
||||
{{ end }}
|
||||
</span>
|
||||
|
@ -51,7 +51,7 @@
|
|||
{{ with .Params.tags }}
|
||||
<div class="post-tags">
|
||||
{{ range . }}
|
||||
<span class="tag"><a href="{{ "tags/" | absURL }}{{ . | urlize }}/"><i class="fas fa-tag"></i> {{ . }}</a></span>
|
||||
<span class="tag"><a href="{{ "tags/" | absURL }}{{ . | urlize }}/"><i class="fas fa-tag"></i>{{ . }}</a></span>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<footer class="footer">
|
||||
<div class="copyright">
|
||||
<span>{{ (printf (T "powered") `<a href="https://gohugo.io/" target="_blank" rel="external nofollow noopener noreffer">Hugo</a>`) | safeHTML }} | {{ T "theme" }}<a href="https://github.com/dillonzq/LoveIt" target="_blank" rel="external nofollow noopener noreffer">LoveIt <i class="far fa-heart"></i></a></span>
|
||||
<span>{{ (printf (T "powered") `<a href="https://gohugo.io/" target="_blank" rel="external nofollow noopener noreffer">Hugo</a>`) | safeHTML }} | {{ T "theme" }}<a href="https://github.com/dillonzq/LoveIt" target="_blank" rel="external nofollow noopener noreffer">LoveIt<i class="far fa-heart"></i></a></span>
|
||||
<br />
|
||||
<i class="far fa-copyright"></i>
|
||||
<i class="far fa-copyright"></i>
|
||||
{{- with .Site.Params.since -}}
|
||||
<span itemprop="copyrightYear">{{ if lt . now.Year }}{{ . }} - {{ end }}{{ now.Year }}</span>
|
||||
{{- else -}}
|
||||
|
|
|
@ -8,14 +8,14 @@
|
|||
{{ range .Site.Menus.main }}
|
||||
<a class="menu-item{{ if or ($currentPage.IsMenuCurrent "main" .) ($currentPage.HasMenuCurrent "main" .) | or (eq $currentPage.RelPermalink .URL) }} active{{ end }}" href="{{ .URL | absLangURL }}" title="{{ .Title }}">{{ .Name | safeHTML }}</a>
|
||||
{{ end }}
|
||||
<a href="javascript:void(0);" class="theme-switch"><i class="fas fa-adjust fa-rotate-180"></i></a>
|
||||
<a href="javascript:void(0);" class="theme-switch"><i class="fas fa-adjust fa-rotate-180"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<nav class="navbar-mobile">
|
||||
<div class="navbar-container">
|
||||
<div class="navbar-header">
|
||||
<div><a href="javascript:void(0);" class="theme-switch"><i class="fas fa-adjust fa-rotate-180"></i></a> <a href="{{.Site.BaseURL}}">{{ .Site.Title }}</a></div>
|
||||
<div><a href="javascript:void(0);" class="theme-switch"><i class="fas fa-adjust fa-rotate-180"></i></a><a href="{{.Site.BaseURL}}">{{ .Site.Title }}</a></div>
|
||||
<div class="menu-toggle" id="menu-toggle">
|
||||
<span></span><span></span><span></span>
|
||||
</div>
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
{{ with .Params.tags }}
|
||||
{{ range . }}
|
||||
<span class="tag">
|
||||
<a href="{{ "tags/" | absURL }}{{ . | urlize }}/"><i class="fas fa-tag"></i> {{.}} </a>
|
||||
<a href="{{ "tags/" | absURL }}{{ . | urlize }}/"><i class="fas fa-tag"></i>{{.}}</a>
|
||||
</span>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
@ -44,7 +44,7 @@
|
|||
|
||||
<div class="post-nav">
|
||||
{{ if .PrevInSection }}
|
||||
<a href="{{.PrevInSection.Permalink}}" class="prev" rel="prev" title="{{ .PrevInSection.Title}}"><i class="fas fa-angle-left"></i> {{ .PrevInSection.Title}}</a>
|
||||
<a href="{{.PrevInSection.Permalink}}" class="prev" rel="prev" title="{{ .PrevInSection.Title}}"><i class="fas fa-angle-left"></i>{{ .PrevInSection.Title}}</a>
|
||||
{{ end }}
|
||||
{{ if .NextInSection }}
|
||||
<a href="{{.NextInSection.Permalink}}" class="next" rel="next" title="{{.NextInSection.Title}}">{{.NextInSection.Title}} <i class="fas fa-angle-right"></i></a>
|
||||
|
|
|
@ -19,19 +19,19 @@
|
|||
{{ range . }}
|
||||
{{- $name := . -}}
|
||||
{{- with $.Site.GetPage "taxonomy" (printf "categories/%s" $name) | default ($.Site.GetPage "taxonomy" (printf "categories/%s" ($name | urlize))) -}}
|
||||
<i class="far fa-folder"></i> <a href="{{ .Permalink }}">{{ $name }}</a>
|
||||
<i class="far fa-folder"></i><a href="{{ .Permalink }}">{{ $name }}</a>
|
||||
{{ end -}}
|
||||
{{ end }}
|
||||
</span>
|
||||
{{- end }}
|
||||
</div>
|
||||
<div class="post-meta-other">
|
||||
<span class="post-time"><i class="far fa-calendar-alt"></i> <time datetime={{ $publish_date }}>{{ $publish_date }}</time> </span>
|
||||
<i class="fas fa-pencil-alt"></i> {{ T "wordCount" .WordCount }}
|
||||
<i class="far fa-clock"></i> {{ T "readingTime" .ReadingTime }}
|
||||
<span class="post-time"><i class="far fa-calendar-alt"></i><time datetime={{ $publish_date }}>{{ $publish_date }}</time> </span>
|
||||
<i class="fas fa-pencil-alt"></i>{{ T "wordCount" .WordCount }}
|
||||
<i class="far fa-clock"></i>{{ T "readingTime" .ReadingTime }}
|
||||
{{- if eq (getenv "HUGO_ENV") "production" | and .Site.Params.valine.enable | and .Site.Params.valine.visitor -}}
|
||||
<span id="{{ .RelPermalink | relURL }}" class="leancloud_visitors" data-flag-title="{{ .Title }}">
|
||||
<i class="far fa-eye"></i> {{ T "pageviews" | safeHTML }}
|
||||
<i class="far fa-eye"></i>{{ T "pageviews" | safeHTML }}
|
||||
</span>
|
||||
{{- end -}}
|
||||
</div>
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
<h2 class="post-title animated pulse faster">
|
||||
{{ $taxonomy := .Data.Singular }}
|
||||
{{ if eq $taxonomy "category" }}
|
||||
<i class="far fa-folder-open"></i> {{ .Title }}
|
||||
<i class="far fa-folder-open"></i>{{ .Title }}
|
||||
{{ else if eq $taxonomy "tag" }}
|
||||
<i class="fas fa-tag"></i> {{ .Title }}
|
||||
<i class="fas fa-tag"></i>{{ .Title }}
|
||||
{{ else }}
|
||||
{{ printf "%s - %s" (T $taxonomy | default (humanize $taxonomy)) .Title }}
|
||||
{{ end }}
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
<div class="card-item">
|
||||
<div class="categories">
|
||||
<a href="{{ .Permalink }}">
|
||||
<h3><i class="far fa-folder"></i> {{ $term | humanize}}</h3>
|
||||
<h3><i class="far fa-folder"></i>{{ $term | humanize}}</h3>
|
||||
</a>
|
||||
{{ range first 5 $pages }}
|
||||
<article class="archive-item">
|
||||
|
|
Loading…
Reference in a new issue