| <!doctype html> |
| <html lang="{{ .Site.Language.Lang }}" class="no-js"> |
| <head> |
| {{ partial "head.html" . }} |
| <title>{{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{ . }} | {{ end }}{{ .Site.Title }}{{ end }}</title> |
| </head> |
| <body class="td-{{ .Kind }} tags-list"> |
| <header> |
| {{ partial "navbar.html" . }} |
| </header> |
| |
| <div class="container-fluid td-outer"> |
| <div class="td-main"> |
| <div class="row container container-center"> |
| <main class="col-12 col-md-12 col-xl-10 pl-md-4 pr-md-4" role="main"> |
| {{ block "main" . }}{{ end }} |
| </main> |
| <div class="d-none d-xl-block col-xl-2 td-toc d-print-none"> |
| |
| <div class="dn blog-ctn"> |
| {{ partial "tags.html" . }} |
| </div> |
| <div class="dn zh-ctn"> |
| {{ partial "tags-zh.html" . }} |
| </div> |
| </div> |
| |
| </div> |
| </div> |
| {{ partial "footer.html" . }} |
| </div> |
| |
| {{ partial "lightbox.html" . }} |
| {{ partial "sidebar-skywalking.html" . }} |
| {{ partial "scripts.html" . }} |
| </body> |
| <script> |
| $(function () { |
| initTags(); |
| bindClick(); |
| |
| function initTags() { |
| var type = getTye() |
| |
| if(type==='blog'){ |
| $('.blog-ctn').show(); |
| replaceState('blog') |
| }else{ |
| $('.zh-ctn').show(); |
| replaceState('zh') |
| } |
| } |
| |
| function bindClick() { |
| $('.tag-link').on('click', function (e) { |
| e.preventDefault() |
| var type = getQueryValue('type') |
| var url = $(this).attr('href') |
| window.location.href = url + '?type=' + type; |
| }) |
| } |
| |
| function getTye() { |
| var type = getQueryValue('type') |
| if (type) { |
| return type |
| } |
| var oldURL = document.referrer; |
| if (oldURL.indexOf('/blog/') > -1) { |
| return 'blog' |
| } else if (oldURL.indexOf('/zh/') > -1) { |
| return 'zh' |
| } |
| } |
| |
| function replaceState(param) { |
| var newurl = updateQueryStringParameter(window.location.href, 'type', param); |
| window.history.replaceState({ |
| path: newurl |
| }, '', newurl); |
| } |
| |
| function updateQueryStringParameter(uri, key, value) { |
| if (!value) { |
| return uri; |
| } |
| var re = new RegExp("([?&])" + key + "=.*?(&|$)", "i"); |
| var separator = uri.indexOf('?') !== -1 ? "&" : "?"; |
| if (uri.match(re)) { |
| return uri.replace(re, '$1' + key + "=" + value + '$2'); |
| } else { |
| return uri + separator + key + "=" + value; |
| } |
| } |
| |
| function getQueryValue(queryName) { |
| var reg = new RegExp("(^|&)" + queryName + "=([^&]*)(&|$)", "i"); |
| var r = window.location.search.substr(1).match(reg); |
| if (r != null) { |
| return decodeURI(r[2]); |
| } else { |
| return null; |
| } |
| } |
| }) |
| </script> |
| </html> |