mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-07-17 16:25:31 -04:00
make prettier play nice with (almost) everything 👸
This commit is contained in:
@@ -51,10 +51,7 @@
|
||||
|
||||
if (cryptoObject && cryptoObject.getRandomValues)
|
||||
return emptyUUID.replace(/[018]/g, function (c) {
|
||||
return (
|
||||
c ^
|
||||
(cryptoObject.getRandomValues(new Uint8Array(1))[0] & (15 >> (c / 4)))
|
||||
).toString(16);
|
||||
return (c ^ (cryptoObject.getRandomValues(new Uint8Array(1))[0] & (15 >> (c / 4)))).toString(16);
|
||||
});
|
||||
|
||||
return emptyUUID.replace(/[018]/g, function (c) {
|
||||
@@ -103,11 +100,7 @@
|
||||
return data[key] != undefinedVar;
|
||||
})
|
||||
.map(function (key) {
|
||||
return (
|
||||
encodeURIComponentFunc(key) +
|
||||
"=" +
|
||||
encodeURIComponentFunc(data[key])
|
||||
);
|
||||
return encodeURIComponentFunc(key) + "=" + encodeURIComponentFunc(data[key]);
|
||||
})
|
||||
.join("&");
|
||||
}
|
||||
@@ -156,9 +149,7 @@
|
||||
try {
|
||||
var getParams = function (regex) {
|
||||
// From the search we grab the utm_source and ref and save only that
|
||||
var matches = loc.search.match(
|
||||
new RegExp("[?&](" + regex + ")=([^?&]+)", "gi")
|
||||
);
|
||||
var matches = loc.search.match(new RegExp("[?&](" + regex + ")=([^?&]+)", "gi"));
|
||||
var match = matches
|
||||
? matches.map(function (m) {
|
||||
return m.split("=")[1];
|
||||
@@ -218,10 +209,7 @@
|
||||
if (push || !(sendBeaconText in nav)) {
|
||||
sendData(append);
|
||||
} else {
|
||||
nav[sendBeaconText](
|
||||
fullApiUrl + "/append",
|
||||
stringify(assign(payload, append))
|
||||
);
|
||||
nav[sendBeaconText](fullApiUrl + "/append", stringify(assign(payload, append)));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -247,11 +235,7 @@
|
||||
);
|
||||
return Math.min(
|
||||
100,
|
||||
Math.round(
|
||||
(100 * ((documentElement.scrollTop || 0) + documentClientHeight)) /
|
||||
height /
|
||||
5
|
||||
) * 5
|
||||
Math.round((100 * ((documentElement.scrollTop || 0) + documentClientHeight)) / height / 5) * 5
|
||||
);
|
||||
} catch (error) {
|
||||
return 0;
|
||||
@@ -308,23 +292,15 @@
|
||||
perf.getEntriesByType &&
|
||||
perf.getEntriesByType(navigation)[0] &&
|
||||
perf.getEntriesByType(navigation)[0].type
|
||||
? ["reload", "back_forward"].indexOf(
|
||||
perf.getEntriesByType(navigation)[0].type
|
||||
) > -1
|
||||
? ["reload", "back_forward"].indexOf(perf.getEntriesByType(navigation)[0].type) > -1
|
||||
: // Check if back, forward or reload buttons are being use in older browsers
|
||||
// 1: TYPE_RELOAD, 2: TYPE_BACK_FORWARD
|
||||
perf &&
|
||||
perf[navigation] &&
|
||||
[1, 2].indexOf(perf[navigation].type) > -1;
|
||||
perf && perf[navigation] && [1, 2].indexOf(perf[navigation].type) > -1;
|
||||
|
||||
/** if uniques **/
|
||||
// We set unique variable based on pushstate or back navigation, if no match we check the referrer
|
||||
data.unique =
|
||||
isPushState || userNavigated
|
||||
? false
|
||||
: doc.referrer
|
||||
? doc.referrer.split(slash)[2] != hostname
|
||||
: true;
|
||||
isPushState || userNavigated ? false : doc.referrer ? doc.referrer.split(slash)[2] != hostname : true;
|
||||
/** endif **/
|
||||
|
||||
page = data;
|
||||
@@ -340,8 +316,7 @@
|
||||
|
||||
var sendEvent = function (event, callbackRaw) {
|
||||
var isFunction = event instanceof Function;
|
||||
var callback =
|
||||
callbackRaw instanceof Function ? callbackRaw : function () {};
|
||||
var callback = callbackRaw instanceof Function ? callbackRaw : function () {};
|
||||
|
||||
if (validTypes.indexOf(typeof event) < 0 && !isFunction) {
|
||||
warn("event is not a string: " + event);
|
||||
@@ -378,8 +353,7 @@
|
||||
};
|
||||
|
||||
// Set default function if user didn't define a function
|
||||
if (!window[options.functionName])
|
||||
window[options.functionName] = defaultEventFunc;
|
||||
if (!window[options.functionName]) window[options.functionName] = defaultEventFunc;
|
||||
|
||||
var eventFunc = window[options.functionName];
|
||||
|
||||
|
@@ -3,10 +3,10 @@
|
||||
// Gradient hack to get our custom underline to wrap:
|
||||
// https://www.dannyguo.com/blog/animated-multiline-link-underlines-with-css/
|
||||
@function underline-hack($color) {
|
||||
// Calculate lighter underline color compared to text color by
|
||||
// mix()'ing with background (#fff) to give the impression of
|
||||
// opacity but with MUCH better compatibility.
|
||||
$color-opaque-hex: mix($color, $link-opacity-color, $link-underline-opacity);
|
||||
// [deprecated] Calculate lighter underline color compared to text
|
||||
// color by mix()'ing with background (#fff) to give the impression
|
||||
// of opacity but with MUCH better compatibility.
|
||||
// $color-opaque-hex: mix($color, $link-opacity-color, $link-underline-opacity);
|
||||
|
||||
// Less compatible but better for light/dark mode switching.
|
||||
$color-opaque-alpha: rgba($color, $link-underline-opacity / 100%);
|
||||
@@ -16,22 +16,47 @@
|
||||
}
|
||||
|
||||
// Web fonts (see components/_fonts.scss)
|
||||
@mixin font-face(
|
||||
$family,
|
||||
$src,
|
||||
$weight: normal,
|
||||
$style: normal,
|
||||
$display: swap
|
||||
) {
|
||||
@mixin font-face($family, $src, $weight: normal, $style: normal, $display: swap) {
|
||||
@font-face {
|
||||
font-family: $family;
|
||||
font-style: $style;
|
||||
font-weight: $weight;
|
||||
font-display: $display;
|
||||
src: url($base-url + $src + ".woff2") format("woff2"),
|
||||
url($base-url + $src + ".woff") format("woff");
|
||||
src: url($base-url + $src + ".woff2") format("woff2"), url($base-url + $src + ".woff") format("woff");
|
||||
|
||||
// Allow additional declarations to be passed in:
|
||||
// Allow additional rules to be passed in:
|
||||
@content;
|
||||
}
|
||||
}
|
||||
|
||||
// Simple dark/light theme switching via <body> class and $themes map in abstracts/_themes.scss
|
||||
// https://medium.com/@katiemctigue/how-to-create-a-dark-mode-in-sass-609f131a3995
|
||||
@mixin themed() {
|
||||
@each $theme, $map in $themes {
|
||||
body.#{$theme} & {
|
||||
$theme-map: () !global;
|
||||
@each $key, $submap in $map {
|
||||
$value: map-get(map-get($themes, $theme), "#{$key}");
|
||||
$theme-map: map-merge(
|
||||
$theme-map,
|
||||
(
|
||||
$key: $value,
|
||||
)
|
||||
) !global;
|
||||
}
|
||||
@content;
|
||||
$theme-map: null !global;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Just @include themed() and call t() when a rule depends on which theme is active, eg:
|
||||
// a {
|
||||
// text-decoration: none;
|
||||
// @include themed() {
|
||||
// color: t(links);
|
||||
// }
|
||||
// }
|
||||
@function t($key) {
|
||||
@return map-get($theme-map, $key);
|
||||
}
|
||||
|
@@ -6,13 +6,10 @@ $webfont-mono: "Hack", monospace;
|
||||
|
||||
// System fonts
|
||||
// https://markdotto.com/2018/02/07/github-system-fonts/
|
||||
$system-fonts: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
|
||||
"Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans",
|
||||
"Helvetica Neue", sans-serif, "Apple Color Emoji", "Segoe UI Emoji",
|
||||
"Segoe UI Symbol";
|
||||
$system-fonts: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell",
|
||||
"Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
|
||||
$system-fonts-emoji: "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
|
||||
$system-fonts-monospace: "SFMono-Regular", "Consolas", "Liberation Mono",
|
||||
"Menlo", "Courier", monospace;
|
||||
$system-fonts-monospace: "SFMono-Regular", "Consolas", "Liberation Mono", "Menlo", "Courier", monospace;
|
||||
|
||||
// Width at which to switch to mobile styles
|
||||
$responsive-width: 830px;
|
||||
|
@@ -189,27 +189,3 @@ $color-logo3: #009cdf;
|
||||
$icon-bulb-on: "data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjIgMzUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3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
// https://medium.com/@katiemctigue/how-to-create-a-dark-mode-in-sass-609f131a3995
|
||||
@mixin themed() {
|
||||
@each $theme, $map in $themes {
|
||||
body.#{$theme} & {
|
||||
$theme-map: () !global;
|
||||
@each $key, $submap in $map {
|
||||
$value: map-get(map-get($themes, $theme), "#{$key}");
|
||||
$theme-map: map-merge(
|
||||
$theme-map,
|
||||
(
|
||||
$key: $value,
|
||||
)
|
||||
) !global;
|
||||
}
|
||||
@content;
|
||||
$theme-map: null !global;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@function t($key) {
|
||||
@return map-get($theme-map, $key);
|
||||
}
|
||||
|
@@ -3,7 +3,6 @@
|
||||
// Note to self: got this list after subsetting Inter with glyphhanger:
|
||||
// https://github.com/filamentgroup/glyphhanger
|
||||
// ex: glyphhanger --whitelist="" --family="Inter" --formats=woff2,woff --subset="*.woff"
|
||||
// prettier-ignore
|
||||
$unicode-subset: U+0000-00FF, U+2000-206F, U+20A0-20CF, U+2190-21FF, U+2200-22FF, U+2122;
|
||||
|
||||
/*!
|
||||
|
@@ -1,16 +1,18 @@
|
||||
@charset "UTF-8";
|
||||
|
||||
// all code
|
||||
code {
|
||||
font-family: $webfont-mono;
|
||||
font-size: 0.95em;
|
||||
letter-spacing: 0;
|
||||
page-break-inside: avoid;
|
||||
}
|
||||
div#content {
|
||||
// all code
|
||||
code {
|
||||
font-family: $webfont-mono;
|
||||
font-size: 0.95em;
|
||||
letter-spacing: 0;
|
||||
page-break-inside: avoid;
|
||||
}
|
||||
|
||||
// inline code in paragraphs (single tildes)
|
||||
p code {
|
||||
padding: 0 0.15em;
|
||||
// inline code in paragraphs (single tildes)
|
||||
p code {
|
||||
padding: 0 0.15em;
|
||||
}
|
||||
}
|
||||
|
||||
// code fences
|
||||
@@ -23,10 +25,6 @@ div.highlight {
|
||||
margin: 1em 0;
|
||||
border: 1px solid;
|
||||
|
||||
@include themed() {
|
||||
border-color: t(light);
|
||||
}
|
||||
|
||||
pre {
|
||||
padding-left: 1.7em;
|
||||
}
|
||||
@@ -80,6 +78,7 @@ body.light {
|
||||
div.highlight {
|
||||
color: #464646;
|
||||
background-color: #fdfdfd;
|
||||
border: 1px solid #d2d2d2;
|
||||
|
||||
.chroma {
|
||||
.k,
|
||||
@@ -153,6 +152,7 @@ body.dark {
|
||||
div.highlight {
|
||||
color: #dfdfdf;
|
||||
background-color: #1f1f1f;
|
||||
border: 1px solid #646464;
|
||||
|
||||
.chroma {
|
||||
.k,
|
||||
|
@@ -1,33 +1,37 @@
|
||||
@charset "UTF-8";
|
||||
|
||||
// all variables set by Hugo's config.toml must go here
|
||||
// stylelint-disable
|
||||
$max-width: {{ printf "%d%s" .Site.Params.pageMaxWidth "px" }};
|
||||
$base-url: "{{ strings.TrimRight "/" .Site.BaseURL }}/"; // consistent trailing forward slash
|
||||
// stylelint-enable
|
||||
// NOTE: all variables set by Hugo's config.toml MUST go here:
|
||||
// prettier-ignore
|
||||
$max-width: "{{ printf "%d%s" .Site.Params.pageMaxWidth "px" }}";
|
||||
$base-url: "{{ strings.TrimRight "/" .Site.BaseURL }}" + "/";
|
||||
|
||||
// those values need quotes because, even though prettier & stylelint are correct
|
||||
// in that it's insanely invalid SCSS, they refuse to ignore it. but $max-width is
|
||||
// a numerical value that can't have quotes, so let's remove them...
|
||||
$max-width: unquote($max-width);
|
||||
|
||||
// Variables & Functions
|
||||
@import 'abstracts/settings';
|
||||
@import 'abstracts/themes';
|
||||
@import 'abstracts/functions';
|
||||
@import "abstracts/functions";
|
||||
@import "abstracts/settings";
|
||||
@import "abstracts/themes";
|
||||
|
||||
// Global Styles
|
||||
@import 'components/fonts';
|
||||
@import 'components/global';
|
||||
@import 'components/header';
|
||||
@import 'components/footer';
|
||||
@import 'components/content';
|
||||
@import "components/fonts";
|
||||
@import "components/global";
|
||||
@import "components/header";
|
||||
@import "components/footer";
|
||||
@import "components/content";
|
||||
|
||||
// Pages
|
||||
@import 'pages/home';
|
||||
@import 'pages/list';
|
||||
@import 'pages/single';
|
||||
@import 'pages/videos';
|
||||
@import 'pages/etc';
|
||||
@import "pages/home";
|
||||
@import "pages/list";
|
||||
@import "pages/single";
|
||||
@import "pages/videos";
|
||||
@import "pages/etc";
|
||||
|
||||
// Responsive Mixins
|
||||
@import 'abstracts/responsive';
|
||||
@import "abstracts/responsive";
|
||||
|
||||
// Miscellaneous
|
||||
@import 'components/syntax';
|
||||
@import 'components/animation';
|
||||
@import "components/syntax";
|
||||
@import "components/animation";
|
||||
|
Reference in New Issue
Block a user