mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-07-17 19:25:32 -04:00
remove utteranc.es for now
This commit is contained in:
@@ -12,9 +12,7 @@ Personal website of [@jakejarvis](https://github.com/jakejarvis), created and de
|
|||||||
- [Hugo Extended](https://github.com/gohugoio/hugo)
|
- [Hugo Extended](https://github.com/gohugoio/hugo)
|
||||||
- [Netlify](https://www.netlify.com/)
|
- [Netlify](https://www.netlify.com/)
|
||||||
- [Simple Analytics](https://referral.simpleanalytics.com/jake-jarvis) (referral link)
|
- [Simple Analytics](https://referral.simpleanalytics.com/jake-jarvis) (referral link)
|
||||||
- [utteranc.es](https://utteranc.es/)
|
- [...and more.](https://jarv.is/uses/)
|
||||||
- [Twemoji](https://twemoji.twitter.com/)
|
|
||||||
- [...and much more.](https://jarv.is/uses/)
|
|
||||||
|
|
||||||
I keep an ongoing list of [blog post ideas](https://github.com/jakejarvis/jarv.is/issues/1) and [coding to-dos](https://github.com/jakejarvis/jarv.is/issues/11) as issues in this repo.
|
I keep an ongoing list of [blog post ideas](https://github.com/jakejarvis/jarv.is/issues/1) and [coding to-dos](https://github.com/jakejarvis/jarv.is/issues/11) as issues in this repo.
|
||||||
|
|
||||||
|
@@ -1,72 +1,34 @@
|
|||||||
/* jshint esversion: 6, indent: 2, browser: true, quotmark: single */
|
/* jshint esversion: 6, indent: 2, browser: true, quotmark: single */
|
||||||
|
|
||||||
// inspired by https://codepen.io/kevinpowell/pen/EMdjOV
|
/*! Dark Mode Switcheroo | MIT License | jrvs.io/bWMz */
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
// lightbulb toggle re-appears now that we know user has JS enabled
|
// improve variable mangling
|
||||||
const toggle = document.querySelector('button#dark-mode-toggle');
|
const win = window;
|
||||||
toggle.style.visibility = 'visible';
|
const doc = win.document;
|
||||||
|
const bod = doc.body;
|
||||||
|
const cls = bod.classList;
|
||||||
|
const sto = localStorage;
|
||||||
|
|
||||||
// check for preset `dark_mode_pref` in localStorage
|
// check for preset `dark_mode_pref` in localStorage
|
||||||
let pref = localStorage.getItem('dark_mode_pref');
|
const pref_key = 'dark_mode_pref';
|
||||||
|
let pref = sto.getItem(pref_key);
|
||||||
|
|
||||||
// keep track of current state (light by default)
|
// keep track of current state (light by default)
|
||||||
let dark = false;
|
let dark = false;
|
||||||
|
|
||||||
// load utteranc.es with proper theme and dynamically switch it
|
|
||||||
let utterancesLoaded = false;
|
|
||||||
const setUtterancesTheme = function(theme) {
|
|
||||||
const container = document.querySelector('div#comments');
|
|
||||||
|
|
||||||
// don't do any of this if we're not on a page with comments enabled
|
|
||||||
if (container) {
|
|
||||||
if (!utterancesLoaded) {
|
|
||||||
const script = document.createElement('script');
|
|
||||||
script.type = 'text/javascript';
|
|
||||||
script.async = true;
|
|
||||||
script.defer = true;
|
|
||||||
script.src = 'https://utteranc.es/client.js';
|
|
||||||
script.crossOrigin = 'anonymous';
|
|
||||||
script.setAttribute('data-repo', '{{ .Site.Params.github | safeJS }}');
|
|
||||||
script.setAttribute('data-label', 'comments');
|
|
||||||
script.setAttribute('data-issue-term', 'og:title');
|
|
||||||
script.setAttribute('data-theme', theme);
|
|
||||||
container.appendChild(script);
|
|
||||||
|
|
||||||
utterancesLoaded = true;
|
|
||||||
} else {
|
|
||||||
const frame = document.querySelector('iframe.utterances-frame');
|
|
||||||
|
|
||||||
// be extra sure frame exists
|
|
||||||
if (frame) {
|
|
||||||
// https://github.com/utterance/utterances/blob/4d9823c6c4f9a58365f06e2aa76c51b8cf5d5478/src/configuration-component.ts#L160
|
|
||||||
frame.contentWindow.postMessage({
|
|
||||||
type: 'set-theme',
|
|
||||||
theme: theme
|
|
||||||
}, 'https://utteranc.es');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const activateDarkMode = function() {
|
const activateDarkMode = function() {
|
||||||
document.body.classList.remove('light');
|
cls.remove('light');
|
||||||
document.body.classList.add('dark');
|
cls.add('dark');
|
||||||
|
|
||||||
dark = true;
|
dark = true;
|
||||||
|
|
||||||
setUtterancesTheme('github-dark');
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const activateLightMode = function() {
|
const activateLightMode = function() {
|
||||||
document.body.classList.remove('dark');
|
cls.remove('dark');
|
||||||
document.body.classList.add('light');
|
cls.add('light');
|
||||||
|
|
||||||
dark = false;
|
dark = false;
|
||||||
|
|
||||||
setUtterancesTheme('github-light');
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// if user already explicitly toggled in the past, restore their preference.
|
// if user already explicitly toggled in the past, restore their preference.
|
||||||
@@ -77,7 +39,7 @@
|
|||||||
if (!pref) {
|
if (!pref) {
|
||||||
// check for OS dark mode setting and switch accordingly
|
// check for OS dark mode setting and switch accordingly
|
||||||
// https://gist.github.com/Gioni06/eb5b28343bcf5793a70f6703004cf333#file-darkmode-js-L47
|
// https://gist.github.com/Gioni06/eb5b28343bcf5793a70f6703004cf333#file-darkmode-js-L47
|
||||||
if (window.matchMedia('(prefers-color-scheme: dark)').matches)
|
if (win.matchMedia('(prefers-color-scheme: dark)').matches)
|
||||||
activateDarkMode();
|
activateDarkMode();
|
||||||
else
|
else
|
||||||
activateLightMode();
|
activateLightMode();
|
||||||
@@ -85,19 +47,27 @@
|
|||||||
// real-time switching if supported by OS/browser
|
// real-time switching if supported by OS/browser
|
||||||
// TODO: stop listening when the parent condition becomes false,
|
// TODO: stop listening when the parent condition becomes false,
|
||||||
// right now these keep listening even if pref is set.
|
// right now these keep listening even if pref is set.
|
||||||
window.matchMedia('(prefers-color-scheme: dark)').addListener(function(e) { if (e.matches) activateDarkMode(); });
|
win.matchMedia('(prefers-color-scheme: dark)').addListener(function(e) { if (e.matches) activateDarkMode(); });
|
||||||
window.matchMedia('(prefers-color-scheme: light)').addListener(function(e) { if (e.matches) activateLightMode(); });
|
win.matchMedia('(prefers-color-scheme: light)').addListener(function(e) { if (e.matches) activateLightMode(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
// handle lightbulb click
|
const toggle = doc.querySelector('.dark-mode-toggle');
|
||||||
toggle.addEventListener('click', function() {
|
|
||||||
// switch to the opposite theme & save preference in local storage
|
// don't freak out if page happens not to have a toggle button
|
||||||
if (!dark) {
|
if (toggle) {
|
||||||
activateDarkMode();
|
// lightbulb toggle re-appears now that we know user has JS enabled
|
||||||
localStorage.setItem('dark_mode_pref', 'true');
|
toggle.style.visibility = 'visible';
|
||||||
} else {
|
|
||||||
activateLightMode();
|
// handle lightbulb click
|
||||||
localStorage.setItem('dark_mode_pref', 'false');
|
toggle.addEventListener('click', function() {
|
||||||
}
|
// switch to the opposite theme & save preference in local storage
|
||||||
}, true);
|
if (!dark) {
|
||||||
|
activateDarkMode();
|
||||||
|
sto.setItem(pref_key, 'true');
|
||||||
|
} else {
|
||||||
|
activateLightMode();
|
||||||
|
sto.setItem(pref_key, 'false');
|
||||||
|
}
|
||||||
|
}, true);
|
||||||
|
}
|
||||||
})();
|
})();
|
||||||
|
@@ -159,7 +159,7 @@ body {
|
|||||||
&.light {
|
&.light {
|
||||||
background-color: $color-light-background;
|
background-color: $color-light-background;
|
||||||
|
|
||||||
button#dark-mode-toggle {
|
button.dark-mode-toggle {
|
||||||
background-image: url($icon-bulb-on);
|
background-image: url($icon-bulb-on);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -167,7 +167,7 @@ body {
|
|||||||
&.dark {
|
&.dark {
|
||||||
background-color: $color-dark-background;
|
background-color: $color-dark-background;
|
||||||
|
|
||||||
button#dark-mode-toggle {
|
button.dark-mode-toggle {
|
||||||
background-image: url($icon-bulb-off);
|
background-image: url($icon-bulb-off);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -108,7 +108,7 @@ header {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Dark mode toggle
|
// Dark mode toggle
|
||||||
button#dark-mode-toggle {
|
button.dark-mode-toggle {
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
background-size: 100% 100%;
|
background-size: 100% 100%;
|
||||||
display: block;
|
display: block;
|
||||||
@@ -164,7 +164,7 @@ header {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Dark mode toggle
|
// Dark mode toggle
|
||||||
button#dark-mode-toggle {
|
button.dark-mode-toggle {
|
||||||
// TODO: figure out need for weird magic numbers here
|
// TODO: figure out need for weird magic numbers here
|
||||||
height: 1.025em;
|
height: 1.025em;
|
||||||
width: 0.75em;
|
width: 0.75em;
|
||||||
|
@@ -37,19 +37,6 @@ main#single {
|
|||||||
color: inherit;
|
color: inherit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
div#comments {
|
|
||||||
margin-top: 1.5em;
|
|
||||||
padding-top: 0.5em;
|
|
||||||
|
|
||||||
@include themed() {
|
|
||||||
border-top: 2px solid t(color-light);
|
|
||||||
}
|
|
||||||
|
|
||||||
div.utterances {
|
|
||||||
max-width: unset;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Responsive
|
// Responsive
|
||||||
|
@@ -29,16 +29,14 @@
|
|||||||
|
|
||||||
# TECHNOLOGY
|
# TECHNOLOGY
|
||||||
|
|
||||||
Hugo extended
|
Hugo Extended
|
||||||
Netlify
|
Netlify
|
||||||
Simple Analytics
|
Simple Analytics
|
||||||
utteranc.es
|
|
||||||
Twemoji
|
|
||||||
...and much more: https://jarv.is/uses/
|
...and much more: https://jarv.is/uses/
|
||||||
|
|
||||||
# VIEW SOURCE
|
# VIEW SOURCE
|
||||||
|
|
||||||
https://go.jarv.is/source
|
https://jrvs.io/source
|
||||||
|
|
||||||
# LICENSES
|
# LICENSES
|
||||||
|
|
||||||
|
@@ -618,6 +618,6 @@ port:17 product:"Windows qotd"
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
If you've found any other juicy Shodan gems, whether it's a search query or a specific example, definitely drop a comment below or [open an issue/PR on GitHub](https://github.com/jakejarvis/awesome-shodan-queries)!
|
If you've found any other juicy Shodan gems, whether it's a search query or a specific example, [open an issue/PR on GitHub!](https://github.com/jakejarvis/awesome-shodan-queries)
|
||||||
|
|
||||||
Bon voyage, fellow penetrators! 😉
|
Bon voyage, fellow penetrators! 😉
|
||||||
|
@@ -10,10 +10,6 @@
|
|||||||
<div id="content">
|
<div id="content">
|
||||||
{{ .Content }}
|
{{ .Content }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{ if and (ne .Params.comments false) (eq hugo.Environment "production") }}
|
|
||||||
<div id="comments"></div>
|
|
||||||
{{ end }}
|
|
||||||
</article>
|
</article>
|
||||||
</main>
|
</main>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
@@ -1,11 +1,3 @@
|
|||||||
{{ if eq hugo.Environment "production" }}
|
|
||||||
{{ if and .IsPage (and (eq .Type .Site.Params.mainSection) (ne .Params.comments false)) }}
|
|
||||||
<link rel="preconnect" href="https://utteranc.es" crossorigin>
|
|
||||||
<link rel="preconnect" href="https://api.utteranc.es" crossorigin>
|
|
||||||
<link rel="preconnect" href="https://api.github.com" crossorigin>
|
|
||||||
{{ end }}
|
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
<link rel="preload" href="{{ "vendor/inter/inter-regular-subset.woff2" | absURL }}" as="font" type="font/woff2" crossorigin>
|
<link rel="preload" href="{{ "vendor/inter/inter-regular-subset.woff2" | absURL }}" as="font" type="font/woff2" crossorigin>
|
||||||
<link rel="preload" href="{{ "vendor/inter/inter-medium-subset.woff2" | absURL }}" as="font" type="font/woff2" crossorigin>
|
<link rel="preload" href="{{ "vendor/inter/inter-medium-subset.woff2" | absURL }}" as="font" type="font/woff2" crossorigin>
|
||||||
<link rel="preload" href="{{ "vendor/inter/inter-bold-subset.woff2" | absURL }}" as="font" type="font/woff2" crossorigin>
|
<link rel="preload" href="{{ "vendor/inter/inter-bold-subset.woff2" | absURL }}" as="font" type="font/woff2" crossorigin>
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
{{- range .Site.Menus.main }}
|
{{- range .Site.Menus.main }}
|
||||||
<li><a class="no-underline" {{ printf "href=%q" .URL | safeHTMLAttr }} aria-label="{{ .Name }}"{{ if strings.HasPrefix .URL "http" }} target="_blank" rel="me noopener"{{ end }}><span class="icon">{{ .Pre }}</span><span class="text">{{ .Name }}</span></a></li>
|
<li><a class="no-underline" {{ printf "href=%q" .URL | safeHTMLAttr }} aria-label="{{ .Name }}"{{ if strings.HasPrefix .URL "http" }} target="_blank" rel="me noopener"{{ end }}><span class="icon">{{ .Pre }}</span><span class="text">{{ .Name }}</span></a></li>
|
||||||
{{ end -}}
|
{{ end -}}
|
||||||
<li><button id="dark-mode-toggle" title="Toggle Dark Mode" aria-label="Toggle Dark Mode"></button></li>
|
<li><button class="dark-mode-toggle" title="Toggle Dark Mode" aria-label="Toggle Dark Mode"></button></li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
</header>
|
</header>
|
||||||
|
@@ -84,22 +84,18 @@
|
|||||||
from = "/sa/send.gif*"
|
from = "/sa/send.gif*"
|
||||||
to = "https://queue.simpleanalyticscdn.com/simple.gif:splat"
|
to = "https://queue.simpleanalyticscdn.com/simple.gif:splat"
|
||||||
status = 200
|
status = 200
|
||||||
force = true
|
|
||||||
[[redirects]]
|
[[redirects]]
|
||||||
from = "/sa/noscript.gif*"
|
from = "/sa/noscript.gif*"
|
||||||
to = "https://queue.simpleanalyticscdn.com/noscript.gif:splat"
|
to = "https://queue.simpleanalyticscdn.com/noscript.gif:splat"
|
||||||
status = 200
|
status = 200
|
||||||
force = true
|
|
||||||
[[redirects]]
|
[[redirects]]
|
||||||
from = "/sa/append"
|
from = "/sa/append"
|
||||||
to = "https://queue.simpleanalyticscdn.com/append"
|
to = "https://queue.simpleanalyticscdn.com/append"
|
||||||
status = 200
|
status = 200
|
||||||
force = true
|
|
||||||
[[redirects]]
|
[[redirects]]
|
||||||
from = "/sa/post"
|
from = "/sa/post"
|
||||||
to = "https://api.simpleanalytics.io/post"
|
to = "https://api.simpleanalytics.io/post"
|
||||||
status = 200
|
status = 200
|
||||||
force = true
|
|
||||||
|
|
||||||
# Support ancient RSS subscriptions and links from WordPress era:
|
# Support ancient RSS subscriptions and links from WordPress era:
|
||||||
[[redirects]]
|
[[redirects]]
|
||||||
|
@@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"origins": ["https://jarv.is"]
|
|
||||||
}
|
|
Reference in New Issue
Block a user