mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-11-18 01:10:49 -05:00
revert Access-Control-Allow-Origin: * header
This commit is contained in:
@@ -13,32 +13,31 @@
|
|||||||
let pref = localStorage.getItem('dark_mode_pref');
|
let pref = localStorage.getItem('dark_mode_pref');
|
||||||
|
|
||||||
// keep track of current state (light by default)
|
// keep track of current state (light by default)
|
||||||
let activated = false;
|
let dark = false;
|
||||||
|
|
||||||
// dynamically switch utteranc.es's theme
|
// load utteranc.es with proper theme and dynamically switch it
|
||||||
let utterancesInit = false;
|
let utterancesLoaded = false;
|
||||||
const setUtterances = function() {
|
const setUtterancesTheme = function(theme) {
|
||||||
let theme = activated ? 'github-dark' : 'github-light';
|
|
||||||
const container = document.querySelector('div#comments');
|
const container = document.querySelector('div#comments');
|
||||||
|
|
||||||
// don't do any of this if we're not on a page with comments enabled
|
// don't do any of this if we're not on a page with comments enabled
|
||||||
if (container) {
|
if (container) {
|
||||||
if (!utterancesInit) {
|
if (!utterancesLoaded) {
|
||||||
const script = document.createElement('script');
|
const script = document.createElement('script');
|
||||||
script.type = 'text/javascript';
|
script.type = 'text/javascript';
|
||||||
script.async = true;
|
script.async = true;
|
||||||
script.defer = true;
|
script.defer = true;
|
||||||
script.src = 'https://utteranc.es/client.js';
|
script.src = 'https://utteranc.es/client.js';
|
||||||
script.crossorigin = true;
|
script.crossOrigin = 'anonymous';
|
||||||
script.setAttribute('data-repo', '{{ .Site.Params.github | safeJS }}');
|
script.setAttribute('data-repo', '{{ .Site.Params.github | safeJS }}');
|
||||||
|
script.setAttribute('data-label', 'comments');
|
||||||
script.setAttribute('data-issue-term', 'og:title');
|
script.setAttribute('data-issue-term', 'og:title');
|
||||||
script.setAttribute('data-theme', theme);
|
script.setAttribute('data-theme', theme);
|
||||||
script.setAttribute('data-label', 'comments');
|
|
||||||
container.appendChild(script);
|
container.appendChild(script);
|
||||||
|
|
||||||
utterancesInit = true;
|
utterancesLoaded = true;
|
||||||
} else {
|
} else {
|
||||||
const frame = document.querySelector('.utterances-frame');
|
const frame = document.querySelector('iframe.utterances-frame');
|
||||||
|
|
||||||
// be extra sure frame exists
|
// be extra sure frame exists
|
||||||
if (frame) {
|
if (frame) {
|
||||||
@@ -46,7 +45,7 @@
|
|||||||
frame.contentWindow.postMessage({
|
frame.contentWindow.postMessage({
|
||||||
type: 'set-theme',
|
type: 'set-theme',
|
||||||
theme: theme
|
theme: theme
|
||||||
}, '*');
|
}, 'https://utteranc.es');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -56,18 +55,18 @@
|
|||||||
document.body.classList.remove('light');
|
document.body.classList.remove('light');
|
||||||
document.body.classList.add('dark');
|
document.body.classList.add('dark');
|
||||||
|
|
||||||
activated = true;
|
dark = true;
|
||||||
|
|
||||||
setUtterances();
|
setUtterancesTheme('github-dark');
|
||||||
};
|
};
|
||||||
|
|
||||||
const activateLightMode = function() {
|
const activateLightMode = function() {
|
||||||
document.body.classList.remove('dark');
|
document.body.classList.remove('dark');
|
||||||
document.body.classList.add('light');
|
document.body.classList.add('light');
|
||||||
|
|
||||||
activated = false;
|
dark = false;
|
||||||
|
|
||||||
setUtterances();
|
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.
|
||||||
@@ -93,7 +92,7 @@
|
|||||||
// handle lightbulb click
|
// handle lightbulb click
|
||||||
toggle.addEventListener('click', function() {
|
toggle.addEventListener('click', function() {
|
||||||
// switch to the opposite theme & save preference in local storage
|
// switch to the opposite theme & save preference in local storage
|
||||||
if (!activated) {
|
if (!dark) {
|
||||||
activateDarkMode();
|
activateDarkMode();
|
||||||
localStorage.setItem('dark_mode_pref', 'true');
|
localStorage.setItem('dark_mode_pref', 'true');
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
10
assets/vendor/emoji/emoji.js
vendored
10
assets/vendor/emoji/emoji.js
vendored
@@ -1,11 +1,11 @@
|
|||||||
/* jshint indent: 2, browser: true, bitwise: true, plusplus: true */
|
/* jshint indent: 2, browser: true, bitwise: true, plusplus: true */
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
*
|
*
|
||||||
* Copyright Twitter Inc. and other contributors. Licensed under MIT.
|
* Copyright Twitter Inc. and other contributors. Licensed under MIT.
|
||||||
* https://github.com/twitter/twemoji/blob/gh-pages/LICENSE
|
* https://github.com/twitter/twemoji/blob/gh-pages/LICENSE
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
(function (
|
(function (
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ disableAliases = true
|
|||||||
defaultImage = "img/me_large.jpg"
|
defaultImage = "img/me_large.jpg"
|
||||||
github = "jakejarvis/jarv.is"
|
github = "jakejarvis/jarv.is"
|
||||||
facebookAppID = "3357248167622283"
|
facebookAppID = "3357248167622283"
|
||||||
|
webmention = "jarv.is"
|
||||||
copyrightFirstYear = "2001"
|
copyrightFirstYear = "2001"
|
||||||
license = "CC-BY-4.0"
|
license = "CC-BY-4.0"
|
||||||
licenseFull = "Creative Commons Attribution 4.0 International"
|
licenseFull = "Creative Commons Attribution 4.0 International"
|
||||||
@@ -157,9 +158,3 @@ disableAliases = true
|
|||||||
lineNumbersInTable = true
|
lineNumbersInTable = true
|
||||||
noClasses = true
|
noClasses = true
|
||||||
tabWidth = 4
|
tabWidth = 4
|
||||||
|
|
||||||
[server]
|
|
||||||
[[server.headers]]
|
|
||||||
for = "/**"
|
|
||||||
[server.headers.values]
|
|
||||||
Access-Control-Allow-Origin = "*"
|
|
||||||
|
|||||||
@@ -1,2 +1,4 @@
|
|||||||
<link rel="pingback" href="https://webmention.io/jarv.is/xmlrpc">
|
{{ with .Site.Params.webmention }}
|
||||||
<link rel="webmention" href="https://webmention.io/jarv.is/webmention">
|
<link rel="pingback" href="https://webmention.io/{{ . }}/xmlrpc">
|
||||||
|
<link rel="webmention" href="https://webmention.io/{{ . }}/webmention">
|
||||||
|
{{ end }}
|
||||||
|
|||||||
@@ -44,10 +44,7 @@
|
|||||||
[[headers]]
|
[[headers]]
|
||||||
for = "/*"
|
for = "/*"
|
||||||
[headers.values]
|
[headers.values]
|
||||||
# Needed to fix utteranc.es + CORS issues.
|
# 🐄
|
||||||
# Cringey but not a huge deal for this site.
|
|
||||||
Access-Control-Allow-Origin = "*"
|
|
||||||
# 🐄🐄🐄
|
|
||||||
X-Got-Milk = "2%"
|
X-Got-Milk = "2%"
|
||||||
|
|
||||||
# PGP file: open in browser, download correctly
|
# PGP file: open in browser, download correctly
|
||||||
|
|||||||
Reference in New Issue
Block a user