Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/reuixiy/hugo-theme-meme.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--assets/js/back-to-top.js14
-rw-r--r--assets/js/comments.js16
-rw-r--r--assets/js/dark-mode.js30
-rw-r--r--assets/js/instantclick.js618
-rw-r--r--assets/js/main.js10
-rw-r--r--assets/js/multilingual.js20
-rw-r--r--config-examples/en-us/config.toml6
-rw-r--r--config-examples/zh-cn/config.toml6
-rw-r--r--layouts/partials/components/post-share.html9
-rw-r--r--layouts/partials/custom/instantclick.html0
-rw-r--r--layouts/partials/head.html4
-rw-r--r--layouts/partials/script.html14
-rw-r--r--layouts/partials/style.html6
-rw-r--r--layouts/partials/third-party/instantclick.html53
-rw-r--r--layouts/partials/third-party/qrcode-generator.html11
-rw-r--r--theme.toml2
16 files changed, 52 insertions, 767 deletions
diff --git a/assets/js/back-to-top.js b/assets/js/back-to-top.js
index e726bd7..0652809 100644
--- a/assets/js/back-to-top.js
+++ b/assets/js/back-to-top.js
@@ -1,11 +1,7 @@
-function backToTop() {
- const backToTop = document.getElementById('back-to-top');
+const backToTop = document.getElementById('back-to-top');
- if (backToTop !== null) {
- window.addEventListener('scroll', function() {
- window.scrollY > 100 ? backToTop.classList.add('show') : backToTop.classList.remove('show');
- });
- }
+if (backToTop !== null) {
+ window.addEventListener('scroll', function() {
+ window.scrollY > 100 ? backToTop.classList.add('show') : backToTop.classList.remove('show');
+ });
}
-
-backToTop();
diff --git a/assets/js/comments.js b/assets/js/comments.js
index a1adbe6..b89d4b2 100644
--- a/assets/js/comments.js
+++ b/assets/js/comments.js
@@ -1,12 +1,8 @@
-function comments() {
- const commentsToggle = document.getElementById('load-comments');
+const commentsToggle = document.getElementById('load-comments');
- if (commentsToggle !== null) {
- commentsToggle.addEventListener('click', function () {
- loadComments();
- this.style = "display: none";
- });
- }
+if (commentsToggle !== null) {
+ commentsToggle.addEventListener('click', function () {
+ loadComments();
+ this.style = "display: none";
+ });
}
-
-comments();
diff --git a/assets/js/dark-mode.js b/assets/js/dark-mode.js
index cae51c1..bb5ffb2 100644
--- a/assets/js/dark-mode.js
+++ b/assets/js/dark-mode.js
@@ -36,25 +36,21 @@ lightModeMediaQuery.addListener((e) => {
// Theme Switcher
// https://derekkedziora.com/blog/dark-mode
-function themeSwitch() {
- const themeSwitcher = document.getElementById('theme-switcher');
+const themeSwitcher = document.getElementById('theme-switcher');
- themeSwitcher.addEventListener('click', function() {
- const currentMode = document.documentElement.getAttribute('data-theme');
+themeSwitcher.addEventListener('click', function() {
+ const currentMode = document.documentElement.getAttribute('data-theme');
- if (currentMode === 'dark') {
- changeModeMeta('light');
- changeMode('light');
- setMode('light');
- } else {
- changeModeMeta('dark');
- changeMode('dark');
- setMode('dark');
- }
- });
-}
-
-themeSwitch();
+ if (currentMode === 'dark') {
+ changeModeMeta('light');
+ changeMode('light');
+ setMode('light');
+ } else {
+ changeModeMeta('dark');
+ changeMode('dark');
+ setMode('dark');
+ }
+});
// Sync Across Tabs
// https://codepen.io/tevko/pen/GgWYpg
diff --git a/assets/js/instantclick.js b/assets/js/instantclick.js
deleted file mode 100644
index c4d4348..0000000
--- a/assets/js/instantclick.js
+++ /dev/null
@@ -1,618 +0,0 @@
-// Note: This is NOT the latest version on GitHub,
-// it is from http://instantclick.io/v3.1.0/instantclick.js
-// and I edited it by myself (deleted Progress Bar related code).
-
-/* InstantClick 3.1.0 | (C) 2014 Alexandre Dieulot | http://instantclick.io/license */
-
-var InstantClick = function(document, location) {
- // Internal variables
- var $ua = navigator.userAgent,
- $isChromeForIOS = $ua.indexOf(' CriOS/') > -1,
- $hasTouch = 'createTouch' in document,
- $currentLocationWithoutHash,
- $urlToPreload,
- $preloadTimer,
- $lastTouchTimestamp,
-
- // Preloading-related variables
- $history = {},
- $xhr,
- $url = false,
- $title = false,
- $mustRedirect = false,
- $body = false,
- $timing = {},
- $isPreloading = false,
- $isWaitingForCompletion = false,
- $trackedAssets = [],
-
- // Variables defined by public functions
- $useWhitelist,
- $preloadOnMousedown,
- $delayBeforePreload,
- $eventsCallbacks = {
- fetch: [],
- receive: [],
- wait: [],
- change: []
- }
-
-
- ////////// HELPERS //////////
-
-
- function removeHash(url) {
- var index = url.indexOf('#')
- if (index < 0) {
- return url
- }
- return url.substr(0, index)
- }
-
- function getLinkTarget(target) {
- while (target && target.nodeName != 'A') {
- target = target.parentNode
- }
- return target
- }
-
- function isBlacklisted(elem) {
- do {
- if (!elem.hasAttribute) { // Parent of <html>
- break
- }
- if (elem.hasAttribute('data-instant')) {
- return false
- }
- if (elem.hasAttribute('data-no-instant')) {
- return true
- }
- }
- while (elem = elem.parentNode);
- return false
- }
-
- function isWhitelisted(elem) {
- do {
- if (!elem.hasAttribute) { // Parent of <html>
- break
- }
- if (elem.hasAttribute('data-no-instant')) {
- return false
- }
- if (elem.hasAttribute('data-instant')) {
- return true
- }
- }
- while (elem = elem.parentNode);
- return false
- }
-
- function isPreloadable(a) {
- var domain = location.protocol + '//' + location.host
-
- if (a.target // target="_blank" etc.
- || a.hasAttribute('download')
- || a.href.indexOf(domain + '/') != 0 // Another domain, or no href attribute
- || (a.href.indexOf('#') > -1
- && removeHash(a.href) == $currentLocationWithoutHash) // Anchor
- || ($useWhitelist
- ? !isWhitelisted(a)
- : isBlacklisted(a))
- ) {
- return false
- }
- return true
- }
-
- function triggerPageEvent(eventType, arg1, arg2, arg3) {
- var returnValue = false
- for (var i = 0; i < $eventsCallbacks[eventType].length; i++) {
- if (eventType == 'receive') {
- var altered = $eventsCallbacks[eventType][i](arg1, arg2, arg3)
- if (altered) {
- /* Update args for the next iteration of the loop. */
- if ('body' in altered) {
- arg2 = altered.body
- }
- if ('title' in altered) {
- arg3 = altered.title
- }
-
- returnValue = altered
- }
- }
- else {
- $eventsCallbacks[eventType][i](arg1, arg2, arg3)
- }
- }
- return returnValue
- }
-
- function changePage(title, body, newUrl, scrollY) {
- document.documentElement.replaceChild(body, document.body)
- /* We cannot just use `document.body = doc.body`, it causes Safari (tested
- 5.1, 6.0 and Mobile 7.0) to execute script tags directly.
- */
-
- if (newUrl) {
- history.pushState(null, null, newUrl)
-
- var hashIndex = newUrl.indexOf('#'),
- hashElem = hashIndex > -1
- && document.getElementById(newUrl.substr(hashIndex + 1)),
- offset = 0
-
- if (hashElem) {
- while (hashElem.offsetParent) {
- offset += hashElem.offsetTop
-
- hashElem = hashElem.offsetParent
- }
- }
- scrollTo(0, offset)
-
- $currentLocationWithoutHash = removeHash(newUrl)
- }
- else {
- scrollTo(0, scrollY)
- }
-
- if ($isChromeForIOS && document.title == title) {
- /* Chrome for iOS:
- *
- * 1. Removes title on pushState, so the title needs to be set after.
- *
- * 2. Will not set the title if it’s identical when trimmed, so
- * appending a space won't do, but a non-breaking space works.
- */
- document.title = title + String.fromCharCode(160)
- }
- else {
- document.title = title
- }
-
- instantanize()
- triggerPageEvent('change', false)
-
- // Real event, useful for combining userscripts, but only for that so it’s undocumented.
- var userscriptEvent = document.createEvent('HTMLEvents')
- userscriptEvent.initEvent('instantclick:newpage', true, true)
- dispatchEvent(userscriptEvent)
- }
-
- function setPreloadingAsHalted() {
- $isPreloading = false
- $isWaitingForCompletion = false
- }
-
- function removeNoscriptTags(html) {
- /* Must be done on text, not on a node's innerHTML, otherwise strange
- * things happen with implicitly closed elements (see the Noscript test).
- */
- return html.replace(/<noscript[\s\S]+<\/noscript>/gi, '')
- }
-
-
- ////////// EVENT HANDLERS //////////
-
-
- function mousedown(e) {
- if ($lastTouchTimestamp > (+new Date - 500)) {
- return // Otherwise, click doesn’t fire
- }
-
- var a = getLinkTarget(e.target)
-
- if (!a || !isPreloadable(a)) {
- return
- }
-
- preload(a.href)
- }
-
- function mouseover(e) {
- if ($lastTouchTimestamp > (+new Date - 500)) {
- return // Otherwise, click doesn’t fire
- }
-
- var a = getLinkTarget(e.target)
-
- if (!a || !isPreloadable(a)) {
- return
- }
-
- a.addEventListener('mouseout', mouseout)
-
- if (!$delayBeforePreload) {
- preload(a.href)
- }
- else {
- $urlToPreload = a.href
- $preloadTimer = setTimeout(preload, $delayBeforePreload)
- }
- }
-
- function touchstart(e) {
- $lastTouchTimestamp = +new Date
-
- var a = getLinkTarget(e.target)
-
- if (!a || !isPreloadable(a)) {
- return
- }
-
- if ($preloadOnMousedown) {
- a.removeEventListener('mousedown', mousedown)
- }
- else {
- a.removeEventListener('mouseover', mouseover)
- }
- preload(a.href)
- }
-
- function click(e) {
- var a = getLinkTarget(e.target)
-
- if (!a || !isPreloadable(a)) {
- return
- }
-
- if (e.which > 1 || e.metaKey || e.ctrlKey) { // Opening in new tab
- return
- }
- e.preventDefault()
- display(a.href)
- }
-
- function mouseout() {
- if ($preloadTimer) {
- clearTimeout($preloadTimer)
- $preloadTimer = false
- return
- }
-
- if (!$isPreloading || $isWaitingForCompletion) {
- return
- }
- $xhr.abort()
- setPreloadingAsHalted()
- }
-
- function readystatechange() {
- if ($xhr.readyState < 4) {
- return
- }
- if ($xhr.status == 0) {
- /* Request aborted */
- return
- }
-
- $timing.ready = +new Date - $timing.start
-
- if ($xhr.getResponseHeader('Content-Type').match(/\/(x|ht|xht)ml/)) {
- var doc = document.implementation.createHTMLDocument('')
- doc.documentElement.innerHTML = removeNoscriptTags($xhr.responseText)
- $title = doc.title
- $body = doc.body
-
- var alteredOnReceive = triggerPageEvent('receive', $url, $body, $title)
- if (alteredOnReceive) {
- if ('body' in alteredOnReceive) {
- $body = alteredOnReceive.body
- }
- if ('title' in alteredOnReceive) {
- $title = alteredOnReceive.title
- }
- }
-
- var urlWithoutHash = removeHash($url)
- $history[urlWithoutHash] = {
- body: $body,
- title: $title,
- scrollY: urlWithoutHash in $history ? $history[urlWithoutHash].scrollY : 0
- }
-
- var elems = doc.head.children,
- found = 0,
- elem,
- data
-
- for (var i = elems.length - 1; i >= 0; i--) {
- elem = elems[i]
- if (elem.hasAttribute('data-instant-track')) {
- data = elem.getAttribute('href') || elem.getAttribute('src') || elem.innerHTML
- for (var j = $trackedAssets.length - 1; j >= 0; j--) {
- if ($trackedAssets[j] == data) {
- found++
- }
- }
- }
- }
- if (found != $trackedAssets.length) {
- $mustRedirect = true // Assets have changed
- }
- }
- else {
- $mustRedirect = true // Not an HTML document
- }
-
- if ($isWaitingForCompletion) {
- $isWaitingForCompletion = false
- display($url)
- }
- }
-
-
- ////////// MAIN FUNCTIONS //////////
-
-
- function instantanize(isInitializing) {
- document.body.addEventListener('touchstart', touchstart, true)
- if ($preloadOnMousedown) {
- document.body.addEventListener('mousedown', mousedown, true)
- }
- else {
- document.body.addEventListener('mouseover', mouseover, true)
- }
- document.body.addEventListener('click', click, true)
-
- if (!isInitializing) {
- var scripts = document.body.getElementsByTagName('script'),
- script,
- copy,
- parentNode,
- nextSibling
-
- for (i = 0, j = scripts.length; i < j; i++) {
- script = scripts[i]
- if (script.hasAttribute('data-no-instant')) {
- continue
- }
- copy = document.createElement('script')
- if (script.src) {
- copy.src = script.src
- }
- if (script.innerHTML) {
- copy.innerHTML = script.innerHTML
- }
- parentNode = script.parentNode
- nextSibling = script.nextSibling
- parentNode.removeChild(script)
- parentNode.insertBefore(copy, nextSibling)
- }
- }
- }
-
- function preload(url) {
- if (!$preloadOnMousedown
- && 'display' in $timing
- && +new Date - ($timing.start + $timing.display) < 100) {
- /* After a page is displayed, if the user's cursor happens to be above
- a link a mouseover event will be in most browsers triggered
- automatically, and in other browsers it will be triggered when the
- user moves his mouse by 1px.
-
- Here are the behavior I noticed, all on Windows:
- - Safari 5.1: auto-triggers after 0 ms
- - IE 11: auto-triggers after 30-80 ms (depends on page's size?)
- - Firefox: auto-triggers after 10 ms
- - Opera 18: auto-triggers after 10 ms
-
- - Chrome: triggers when cursor moved
- - Opera 12.16: triggers when cursor moved
-
- To remedy to this, we do not start preloading if last display
- occurred less than 100 ms ago. If they happen to click on the link,
- they will be redirected.
- */
-
- return
- }
- if ($preloadTimer) {
- clearTimeout($preloadTimer)
- $preloadTimer = false
- }
-
- if (!url) {
- url = $urlToPreload
- }
-
- if ($isPreloading && (url == $url || $isWaitingForCompletion)) {
- return
- }
- $isPreloading = true
- $isWaitingForCompletion = false
-
- $url = url
- $body = false
- $mustRedirect = false
- $timing = {
- start: +new Date
- }
- triggerPageEvent('fetch')
- $xhr.open('GET', url)
- $xhr.send()
- }
-
- function display(url) {
- if (!('display' in $timing)) {
- $timing.display = +new Date - $timing.start
- }
- if ($preloadTimer || !$isPreloading) {
- /* $preloadTimer:
- Happens when there’s a delay before preloading and that delay
- hasn't expired (preloading didn't kick in).
-
- !$isPreloading:
- A link has been clicked, and preloading hasn’t been initiated.
- It happens with touch devices when a user taps *near* the link,
- Safari/Chrome will trigger mousedown, mouseover, click (and others),
- but when that happens we ignore mousedown/mouseover (otherwise click
- doesn’t fire). Maybe there’s a way to make the click event fire, but
- that’s not worth it as mousedown/over happen just 1ms before click
- in this situation.
-
- It also happens when a user uses his keyboard to navigate (with Tab
- and Return), and possibly in other non-mainstream ways to navigate
- a website.
- */
-
- if ($preloadTimer && $url && $url != url) {
- /* Happens when the user clicks on a link before preloading
- kicks in while another link is already preloading.
- */
-
- location.href = url
- return
- }
-
- preload(url)
- triggerPageEvent('wait')
- $isWaitingForCompletion = true // Must be set *after* calling `preload`
- return
- }
- if ($isWaitingForCompletion) {
- /* The user clicked on a link while a page was preloading. Either on
- the same link or on another link. If it's the same link something
- might have gone wrong (or he could have double clicked, we don’t
- handle that case), so we send him to the page without pjax.
- If it's another link, it hasn't been preloaded, so we redirect the
- user to it.
- */
- location.href = url
- return
- }
- if ($mustRedirect) {
- location.href = $url
- return
- }
- if (!$body) {
- triggerPageEvent('wait')
- $isWaitingForCompletion = true
- return
- }
- $history[$currentLocationWithoutHash].scrollY = pageYOffset
- setPreloadingAsHalted()
- changePage($title, $body, $url)
- }
-
-
- ////////// PUBLIC VARIABLE AND FUNCTIONS //////////
-
- var supported = 'pushState' in history
- && (!$ua.match('Android') || $ua.match('Chrome/'))
- && location.protocol != "file:"
-
- /* The state of Android's AOSP browsers:
-
- 2.3.7: pushState appears to work correctly, but
- `doc.documentElement.innerHTML = body` is buggy.
- See details here: http://stackoverflow.com/q/21918564
- Not an issue anymore, but it may fail where 3.0 do, this needs
- testing again.
-
- 3.0: pushState appears to work correctly (though the URL bar is only
- updated on focus), but
- `document.documentElement.replaceChild(doc.body, document.body)`
- throws DOMException: WRONG_DOCUMENT_ERR.
-
- 4.0.2: Doesn't support pushState.
-
- 4.0.4,
- 4.1.1,
- 4.2,
- 4.3: pushState is here, but it doesn't update the URL bar.
- (Great logic there.)
-
- 4.4: Works correctly. Claims to be 'Chrome/30.0.0.0'.
-
- All androids tested with Android SDK's Emulator.
- Version numbers are from the browser's user agent.
-
- Because of this mess, the only whitelisted browser on Android is Chrome.
- */
-
- function init() {
- if ($currentLocationWithoutHash) {
- /* Already initialized */
- return
- }
- if (!supported) {
- triggerPageEvent('change', true)
- return
- }
- for (var i = arguments.length - 1; i >= 0; i--) {
- var arg = arguments[i]
- if (arg === true) {
- $useWhitelist = true
- }
- else if (arg == 'mousedown') {
- $preloadOnMousedown = true
- }
- else if (typeof arg == 'number') {
- $delayBeforePreload = arg
- }
- }
- $currentLocationWithoutHash = removeHash(location.href)
- $history[$currentLocationWithoutHash] = {
- body: document.body,
- title: document.title,
- scrollY: pageYOffset
- }
-
- var elems = document.head.children,
- elem,
- data
- for (var i = elems.length - 1; i >= 0; i--) {
- elem = elems[i]
- if (elem.hasAttribute('data-instant-track')) {
- data = elem.getAttribute('href') || elem.getAttribute('src') || elem.innerHTML
- /* We can't use just `elem.href` and `elem.src` because we can't
- retrieve `href`s and `src`s from the Ajax response.
- */
- $trackedAssets.push(data)
- }
- }
-
- $xhr = new XMLHttpRequest()
- $xhr.addEventListener('readystatechange', readystatechange)
-
- instantanize(true)
-
- triggerPageEvent('change', true)
-
- addEventListener('popstate', function() {
- var loc = removeHash(location.href)
- if (loc == $currentLocationWithoutHash) {
- return
- }
-
- if (!(loc in $history)) {
- location.href = location.href
- /* Reloads the page while using cache for scripts, styles and images,
- unlike `location.reload()` */
- return
- }
-
- $history[$currentLocationWithoutHash].scrollY = pageYOffset
- $currentLocationWithoutHash = loc
- changePage($history[loc].title, $history[loc].body, false, $history[loc].scrollY)
- })
- }
-
- function on(eventType, callback) {
- $eventsCallbacks[eventType].push(callback)
- }
-
-
- ////////////////////
-
-
- return {
- supported: supported,
- init: init,
- on: on
- }
-
-}(document, location);
diff --git a/assets/js/main.js b/assets/js/main.js
index 433d181..93560d3 100644
--- a/assets/js/main.js
+++ b/assets/js/main.js
@@ -1,10 +1,6 @@
// Wrap `<table>` to make it responsive
// Reference: https://github.com/stone-zeng/stone-zeng.github.io/blob/master/js/script.js
-function wrapTable() {
- document.querySelectorAll('table').forEach((e) => {
- e.outerHTML = `<div class="table-container">${e.outerHTML}</div>`;
- });
-}
-
-wrapTable();
+document.querySelectorAll('table').forEach((e) => {
+ e.outerHTML = `<div class="table-container">${e.outerHTML}</div>`;
+});
diff --git a/assets/js/multilingual.js b/assets/js/multilingual.js
index 09317d5..49378ab 100644
--- a/assets/js/multilingual.js
+++ b/assets/js/multilingual.js
@@ -1,14 +1,10 @@
-function langSwitch() {
- const langSwitcher = document.getElementById('lang-switcher');
- const langs = document.getElementById('langs');
+const langSwitcher = document.getElementById('lang-switcher');
+const langs = document.getElementById('langs');
- langSwitcher.addEventListener('mouseover', function() {
- langs.style = 'display: block';
- });
+langSwitcher.addEventListener('mouseover', function() {
+ langs.style = 'display: block';
+});
- langSwitcher.addEventListener('mouseout', function() {
- langs.style = 'display: none';
- });
-}
-
-langSwitch();
+langSwitcher.addEventListener('mouseout', function() {
+ langs.style = 'display: none';
+});
diff --git a/config-examples/en-us/config.toml b/config-examples/en-us/config.toml
index 5b6f6d1..14b2b89 100644
--- a/config-examples/en-us/config.toml
+++ b/config-examples/en-us/config.toml
@@ -543,12 +543,6 @@ uglyURLs = false
######################################
- # InstantClick
-
- enableInstantClick = true
-
-
- ######################################
# Service Worker
# Note: render only in production
diff --git a/config-examples/zh-cn/config.toml b/config-examples/zh-cn/config.toml
index 18f7d4c..39403e6 100644
--- a/config-examples/zh-cn/config.toml
+++ b/config-examples/zh-cn/config.toml
@@ -497,12 +497,6 @@ uglyURLs = false
######################################
- # InstantClick
-
- enableInstantClick = true
-
-
- ######################################
# Service Worker
# 说明:仅在生产环境(production)下渲染
diff --git a/layouts/partials/components/post-share.html b/layouts/partials/components/post-share.html
index e7aa7f7..99a9636 100644
--- a/layouts/partials/components/post-share.html
+++ b/layouts/partials/components/post-share.html
@@ -103,14 +103,7 @@
{{- $icon | safeHTML -}}
<div id="qrcode-img"></div>
</div>
- <script>
- var typeNumber = 0;
- var errorCorrectionLevel = 'L';
- var qr = qrcode(typeNumber, errorCorrectionLevel);
- qr.addData('{{ .Permalink }}');
- qr.make();
- document.getElementById('qrcode-img').innerHTML = qr.createImgTag();
- </script>
+ {{ partial "third-party/qrcode-generator.html" . }}
</div>
{{ end }}
diff --git a/layouts/partials/custom/instantclick.html b/layouts/partials/custom/instantclick.html
deleted file mode 100644
index e69de29..0000000
--- a/layouts/partials/custom/instantclick.html
+++ /dev/null
diff --git a/layouts/partials/head.html b/layouts/partials/head.html
index d3c4262..bd1b896 100644
--- a/layouts/partials/head.html
+++ b/layouts/partials/head.html
@@ -146,9 +146,5 @@
{{ partial "third-party/google-adsense-auto.html" . }}
{{- end }}
- {{ if and .Site.Params.enablePostShare .Site.Params.shareViaQRCode }}
- {{ partial "third-party/qrcode-generator.html" . }}
- {{ end }}
-
{{ partial "custom/head.html" . }}
</head>
diff --git a/layouts/partials/script.html b/layouts/partials/script.html
index a6b1caf..801822e 100644
--- a/layouts/partials/script.html
+++ b/layouts/partials/script.html
@@ -2,7 +2,6 @@
{{- $backToTop := resources.Get "js/back-to-top.js" | resources.ExecuteAsTemplate "js/back-to-top-rendered.js" . -}}
{{- $darkMode := resources.Get "js/dark-mode.js" | resources.ExecuteAsTemplate "js/dark-mode-rendered.js" . -}}
{{- $lang := resources.Get "js/multilingual.js" | resources.ExecuteAsTemplate "js/multilingual-rendered.js" . -}}
-{{- $instantClick := resources.Get "js/instantclick.js" | resources.ExecuteAsTemplate "js/instantclick-rendered.js" . -}}
{{- $comments := resources.Get "js/comments.js" | resources.ExecuteAsTemplate "js/comments-rendered.js" . -}}
{{- $custom := resources.Get "js/custom.js" | resources.ExecuteAsTemplate "js/custom-rendered.js" . -}}
@@ -20,10 +19,6 @@
{{- .Scratch.Add "script" (slice $lang) -}}
{{- end -}}
-{{- if .Site.Params.enableInstantClick -}}
- {{- .Scratch.Add "script" (slice $instantClick) -}}
-{{- end -}}
-
{{- if and .Site.Params.enableComments (eq hugo.Environment "production") -}}
{{- .Scratch.Add "script" (slice $comments) -}}
{{- end -}}
@@ -34,17 +29,12 @@
{{- if .Site.Params.enableFingerprint -}}
{{- $script := .Scratch.Get "script" | resources.Concat $path | resources.Minify | resources.Fingerprint -}}
- {{- printf `<script src="%s" integrity="%s" data-no-instant></script>` $script.RelPermalink $script.Data.Integrity | safeHTML -}}
+ {{- printf `<script src="%s" integrity="%s"></script>` $script.RelPermalink $script.Data.Integrity | safeHTML -}}
{{- else -}}
{{- $script := .Scratch.Get "script" | resources.Concat $path | resources.Minify -}}
- {{- printf `<script src="%s" data-no-instant></script>` $script.RelPermalink | safeHTML -}}
+ {{- printf `<script src="%s"></script>` $script.RelPermalink | safeHTML -}}
{{- end }}
-{{ if .Site.Params.enableInstantClick }}
- {{ partial "third-party/instantclick.html" . }}
- {{ partial "custom/instantclick.html" . }}
-{{- end -}}
-
{{ if .Site.Params.enableSmoothScroll }}
{{ partial "third-party/smooth-scroll.html" . }}
{{ end }}
diff --git a/layouts/partials/style.html b/layouts/partials/style.html
index da9679e..950521d 100644
--- a/layouts/partials/style.html
+++ b/layouts/partials/style.html
@@ -3,8 +3,8 @@
{{- if .Site.Params.enableFingerprint -}}
{{- $style := resources.Get "scss/main.scss" | resources.ExecuteAsTemplate "styles/main-rendered.scss" . | resources.ToCSS $options | resources.Fingerprint -}}
- {{- printf `<link rel="stylesheet" href="%s" integrity="%s" data-instant-track />` $style.RelPermalink $style.Data.Integrity | safeHTML -}}
+ {{- printf `<link rel="stylesheet" href="%s" integrity="%s" />` $style.RelPermalink $style.Data.Integrity | safeHTML -}}
{{- else -}}
{{- $style := resources.Get "scss/main.scss" | resources.ExecuteAsTemplate "styles/main-rendered.scss" . | resources.ToCSS $options -}}
- {{- printf `<link rel="stylesheet" href="%s" data-instant-track />` $style.RelPermalink | safeHTML -}}
-{{- end -}} \ No newline at end of file
+ {{- printf `<link rel="stylesheet" href="%s" />` $style.RelPermalink | safeHTML -}}
+{{- end -}}
diff --git a/layouts/partials/third-party/instantclick.html b/layouts/partials/third-party/instantclick.html
deleted file mode 100644
index 8a688e3..0000000
--- a/layouts/partials/third-party/instantclick.html
+++ /dev/null
@@ -1,53 +0,0 @@
-<script data-no-instant>InstantClick.init();</script>
-
-<script data-no-instant>
- InstantClick.on('change', function() {
- wrapTable();
-
- {{ if .Site.Params.enableBackToTopAutoHide }}
- backToTop();
- {{ end }}
-
- {{ if and .Site.IsMultiLingual .Site.Params.enableLangToggle }}
- langSwitch();
- {{ end }}
-
- {{ if .Site.Params.enableDarkMode }}
- const userPrefers = localStorage.getItem('theme');
- const darkModeMediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
- const lightModeMediaQuery = window.matchMedia('(prefers-color-scheme: light)');
-
- if (userPrefers === 'dark') {
- changeModeMeta('dark');
- changeMode('dark');
- } else if (userPrefers === 'light') {
- changeModeMeta('light');
- changeMode('light');
- } else if (darkModeMediaQuery.matches) {
- changeModeMeta('dark');
- changeMode('dark');
- } else if (lightModeMediaQuery.matches) {
- changeModeMeta('light');
- changeMode('light');
- }
-
- themeSwitch();
- {{ end -}}
-
- {{ if and .Site.Params.enableComments (eq hugo.Environment "production") }}
- comments();
- {{ end }}
-
- {{ if and .Site.Params.enableGoogleAnalytics (eq hugo.Environment "production") -}}
- {{ if eq .Site.Params.trackingCodeType "gtag" -}}
- gtag('config', '{{ .Site.Params.trackingID }}', {
- 'page_path': location.pathname + location.search
- });
- {{ end -}}
-
- {{ if eq .Site.Params.trackingCodeType "analytics" -}}
- ga('send', 'pageview', location.pathname + location.search);
- {{ end -}}
- {{ end -}}
- });
-</script>
diff --git a/layouts/partials/third-party/qrcode-generator.html b/layouts/partials/third-party/qrcode-generator.html
index 462ee53..e25bec7 100644
--- a/layouts/partials/third-party/qrcode-generator.html
+++ b/layouts/partials/third-party/qrcode-generator.html
@@ -1 +1,10 @@
-<script src="https://cdn.jsdelivr.net/npm/qrcode-generator@1.4.4/qrcode.min.js"></script> \ No newline at end of file
+<script src="https://cdn.jsdelivr.net/npm/qrcode-generator@1.4.4/qrcode.min.js"></script>
+
+<script>
+ var typeNumber = 0;
+ var errorCorrectionLevel = 'L';
+ var qr = qrcode(typeNumber, errorCorrectionLevel);
+ qr.addData('{{ .Permalink }}');
+ qr.make();
+ document.getElementById('qrcode-img').innerHTML = qr.createImgTag();
+</script>
diff --git a/theme.toml b/theme.toml
index 5930b20..982afee 100644
--- a/theme.toml
+++ b/theme.toml
@@ -7,7 +7,7 @@ licenselink = "https://github.com/reuixiy/hugo-theme-meme/blob/master/LICENSE"
description = "MemE is a powerful and highly customizable GoHugo theme for personal blogs."
homepage = "https://github.com/reuixiy/hugo-theme-meme/"
tags = ["Blog", "Minimal", "Clean", "Typography", "Multilingual"]
-features = ["Dark Mode", "InstantClick", "KaTeX", "JSON-LD", "Drop Cap", "PWA", "TOC"]
+features = ["Dark Mode", "MathJax", "KaTeX", "JSON-LD", "Drop Cap", "PWA", "TOC"]
min_version = "0.62.2"
[author]