Compare commits
No commits in common. "f6106feb5f6d64ea76a1f2fc4e8285d029ff6c0d" and "fe99175139f0f373f5a37aae42a365723a6d2e56" have entirely different histories.
f6106feb5f
...
fe99175139
9 changed files with 84 additions and 71 deletions
|
@ -1,8 +1,8 @@
|
||||||
pipeline:
|
pipeline:
|
||||||
build:
|
build:
|
||||||
image: registry.nulo.in/sutty/haini.sh:root
|
image: registry.nulo.in/sutty/haini.sh:latest
|
||||||
commands:
|
commands:
|
||||||
- rm -f assets/js/*
|
- rm assets/js/*
|
||||||
- make yarn hainish="sh -c"
|
- make yarn hainish="sh -c"
|
||||||
- make webpack hainish="sh -c"
|
- make webpack hainish="sh -c"
|
||||||
|
|
||||||
|
@ -10,11 +10,13 @@ pipeline:
|
||||||
- eval $(ssh-agent -s)
|
- eval $(ssh-agent -s)
|
||||||
- echo "$${GIT_BASE64_SSH_KEY}" | base64 -d | ssh-add -
|
- echo "$${GIT_BASE64_SSH_KEY}" | base64 -d | ssh-add -
|
||||||
- echo [nulo.in]:420 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHgHIbf5/jkeyLMndnWlEO12DPj41YPqkmz+aIreVOsP >> ~/.ssh/known_hosts
|
- echo [nulo.in]:420 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHgHIbf5/jkeyLMndnWlEO12DPj41YPqkmz+aIreVOsP >> ~/.ssh/known_hosts
|
||||||
|
- git checkout ${DRONE_BRANCH} # Tenemos que hacer esto porque Woodpecker solo `git reset` ea el commit que quiere.
|
||||||
- git config user.name Woodpecker
|
- git config user.name Woodpecker
|
||||||
- git config user.email ci@nulo.in
|
- git config user.email ci@nulo.in
|
||||||
|
- git add assets/js/* _data/assets.json
|
||||||
|
- git commit -m "[skip ci] Recompilar JS"
|
||||||
- git remote add nulo ssh://_gitea@nulo.in:420/Sutty/sutty-base-jekyll-theme.git
|
- git remote add nulo ssh://_gitea@nulo.in:420/Sutty/sutty-base-jekyll-theme.git
|
||||||
- git diff-index --quiet HEAD --ignore-submodules || ( git commit assets/js/ _data/assets.json -m "[skip ci] Recompilar JS" && git push -u nulo ${DRONE_BRANCH} )
|
- git push -u nulo ${DRONE_BRANCH}
|
||||||
secrets:
|
secrets:
|
||||||
- git_base64_ssh_key
|
- git_base64_ssh_key
|
||||||
when:
|
when:
|
||||||
|
|
|
@ -1,17 +1,4 @@
|
||||||
{%- assign title = include.title | escape -%}
|
<input type="checkbox" id="share" class="toggler" autocomplete="off" />
|
||||||
{%- assign text = include.description | strip_html | escape -%}
|
|
||||||
{%- assign url = site.url | append: include.url | escape -%}
|
|
||||||
|
|
||||||
<input
|
|
||||||
data-controller="share"
|
|
||||||
data-action="share#share"
|
|
||||||
data-share-title-value="{{ title }}"
|
|
||||||
data-share-text-value="{{ text }}"
|
|
||||||
data-share-url-value="{{ url }}"
|
|
||||||
type="checkbox"
|
|
||||||
id="share"
|
|
||||||
class="toggler"
|
|
||||||
autocomplete="off" />
|
|
||||||
|
|
||||||
<label class="share btn border btn-block" for="share">
|
<label class="share btn border btn-block" for="share">
|
||||||
{{ site.i18n.share.text }}
|
{{ site.i18n.share.text }}
|
||||||
|
|
|
@ -16,7 +16,7 @@ export default class extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
connect () {
|
connect () {
|
||||||
const q = new URLSearchParams(window.location.search).get('q')?.trim()
|
const q = new URLSearchParams(window.location.search).get('q').trim()
|
||||||
|
|
||||||
if (q) {
|
if (q) {
|
||||||
this.qTarget.value = q
|
this.qTarget.value = q
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
import { Controller } from 'stimulus'
|
|
||||||
|
|
||||||
export default class extends Controller {
|
|
||||||
static values = {
|
|
||||||
title: String,
|
|
||||||
text: String,
|
|
||||||
url: String
|
|
||||||
}
|
|
||||||
|
|
||||||
async share (event = undefined) {
|
|
||||||
event?.preventDefault()
|
|
||||||
event?.stopPropagation()
|
|
||||||
|
|
||||||
const title = this.titleValue
|
|
||||||
const text = this.textValue
|
|
||||||
const url = this.urlValue
|
|
||||||
const data = { title, text, url }
|
|
||||||
|
|
||||||
if ('share' in navigator) {
|
|
||||||
if (navigator.canShare(data)) {
|
|
||||||
navigator.share(data)
|
|
||||||
} else {
|
|
||||||
console.error('No se puede compartir', data)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -6,23 +6,11 @@ window.airbrake = new Notifier({
|
||||||
host: 'https://panel.sutty.nl'
|
host: 'https://panel.sutty.nl'
|
||||||
})
|
})
|
||||||
|
|
||||||
console.originalError = console.error
|
|
||||||
console.error = (...e) => {
|
|
||||||
window.airbrake.notify(e.join(' '))
|
|
||||||
return console.originalError(...e)
|
|
||||||
}
|
|
||||||
|
|
||||||
import 'core-js/stable'
|
import 'core-js/stable'
|
||||||
import 'regenerator-runtime/runtime'
|
import 'regenerator-runtime/runtime'
|
||||||
|
|
||||||
// Turbo acelera la navegación al no tener que recargar todo el JS y CSS
|
const Turbolinks = require("turbolinks")
|
||||||
// de la página, con lo que se siente más rápida y "nativa".
|
Turbolinks.start()
|
||||||
//
|
|
||||||
// Cambiamos de turbolinks a turbo porque turbo soporta la función
|
|
||||||
// fetch(), que luego es interceptada por el SW para obtener las
|
|
||||||
// direcciones localmente.
|
|
||||||
import * as Turbo from "@hotwired/turbo"
|
|
||||||
Turbo.start()
|
|
||||||
|
|
||||||
import { Application } from 'stimulus'
|
import { Application } from 'stimulus'
|
||||||
import { definitionsFromContext } from "stimulus/webpack-helpers"
|
import { definitionsFromContext } from "stimulus/webpack-helpers"
|
||||||
|
@ -31,17 +19,33 @@ const application = Application.start()
|
||||||
const context = require.context("./controllers", true, /\.js$/)
|
const context = require.context("./controllers", true, /\.js$/)
|
||||||
application.load(definitionsFromContext(context))
|
application.load(definitionsFromContext(context))
|
||||||
|
|
||||||
|
// Prevenir que Turbolinks interfiera con la navegación por anchors
|
||||||
|
// https://github.com/turbolinks/turbolinks/issues/75#issuecomment-445325162
|
||||||
|
document.addEventListener('turbolinks:click', event => {
|
||||||
|
const anchorElement = event.target
|
||||||
|
const isSamePageAnchor = (
|
||||||
|
anchorElement.hash &&
|
||||||
|
anchorElement.origin === window.location.origin &&
|
||||||
|
anchorElement.pathname === window.location.pathname
|
||||||
|
)
|
||||||
|
|
||||||
|
if (!isSamePageAnchor) return
|
||||||
|
|
||||||
|
Turbolinks.controller.pushHistoryWithLocationAndRestorationIdentifier(event.data.url, Turbolinks.uuid())
|
||||||
|
|
||||||
|
event.preventDefault()
|
||||||
|
})
|
||||||
|
|
||||||
try {
|
try {
|
||||||
window.axe = require('axe-core/axe')
|
window.axe = require('axe-core/axe')
|
||||||
} catch(e) {}
|
} catch(e) {}
|
||||||
|
|
||||||
if (window.axe) window.axe.configure({ locale: require('axe-core/locales/es.json') })
|
if (window.axe) window.axe.configure({ locale: require('axe-core/locales/es.json') })
|
||||||
|
|
||||||
document.addEventListener('turbo:load', event => {
|
// Prevenir que Turbolinks interfiera la navegación a un anchor al
|
||||||
document.querySelectorAll("a[href^='http://'],a[href^='https://'],a[href^='//']").forEach(a => {
|
// recargar la página
|
||||||
a.rel = "noopener"
|
document.addEventListener('turbolinks:load', event => {
|
||||||
a.target = "_blank"
|
window.location.hash = window.location.hash
|
||||||
})
|
|
||||||
|
|
||||||
if (!window.axe) return
|
if (!window.axe) return
|
||||||
|
|
||||||
|
|
|
@ -118,6 +118,9 @@ $label-margin-bottom: 0;
|
||||||
@import "editor";
|
@import "editor";
|
||||||
@import "menu";
|
@import "menu";
|
||||||
|
|
||||||
|
/// La barra de progreso de Turbolinks tiene el color primario
|
||||||
|
/// de la paleta, definido por Bootstrap o por nosotres.
|
||||||
|
.turbolinks-progress-bar { background-color: $primary; }
|
||||||
/// La barra de progreso de Turbo tiene el color primario
|
/// La barra de progreso de Turbo tiene el color primario
|
||||||
/// de la paleta, definido por Bootstrap o por nosotres.
|
/// de la paleta, definido por Bootstrap o por nosotres.
|
||||||
.turbo-progress-bar { background-color: $primary; }
|
.turbo-progress-bar { background-color: $primary; }
|
||||||
|
|
44
assets/js/script.js
Normal file
44
assets/js/script.js
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
---
|
||||||
|
---
|
||||||
|
|
||||||
|
const loadEvent = () => {
|
||||||
|
try {
|
||||||
|
if (Turbolinks) return 'turbolinks:load'
|
||||||
|
} catch {
|
||||||
|
return 'DOMContentLoaded'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
document.addEventListener(loadEvent(), () => {
|
||||||
|
document.querySelectorAll('.share').forEach(share => {
|
||||||
|
share.addEventListener('click', event => {
|
||||||
|
if (!Navigator.share) return;
|
||||||
|
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
|
||||||
|
const title = document.querySelector('title').text;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const text = document.querySelector('meta[property="og:description"]').content;
|
||||||
|
} catch {
|
||||||
|
const text = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const url = document.querySelector('link[rel=canonical]').href;
|
||||||
|
} catch {
|
||||||
|
const url = document.location.href;
|
||||||
|
}
|
||||||
|
|
||||||
|
const data = { title: title, text: text, url: url };
|
||||||
|
|
||||||
|
if (Navigator.canShare(data)) Navigator.share(data).then();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
document.querySelectorAll("a[href^='http://'],a[href^='https://'],a[href^='//']").forEach(a => {
|
||||||
|
a.rel = "noopener";
|
||||||
|
a.target = "_blank";
|
||||||
|
});
|
||||||
|
});
|
|
@ -12,7 +12,6 @@
|
||||||
"@babel/core": "^7.10.4",
|
"@babel/core": "^7.10.4",
|
||||||
"@babel/plugin-proposal-class-properties": "^7.10.4",
|
"@babel/plugin-proposal-class-properties": "^7.10.4",
|
||||||
"@babel/preset-env": "^7.10.4",
|
"@babel/preset-env": "^7.10.4",
|
||||||
"@hotwired/turbo": "^7.0.0-rc.4",
|
|
||||||
"axe-core": "^4.1.2",
|
"axe-core": "^4.1.2",
|
||||||
"babel-loader": "^8.1.0",
|
"babel-loader": "^8.1.0",
|
||||||
"core-js": "^3.6.5",
|
"core-js": "^3.6.5",
|
||||||
|
@ -23,6 +22,7 @@
|
||||||
"sassdoc-theme-herman": "^4.0.2",
|
"sassdoc-theme-herman": "^4.0.2",
|
||||||
"stimulus": "^1.1.1",
|
"stimulus": "^1.1.1",
|
||||||
"svgo": "^2.5.0",
|
"svgo": "^2.5.0",
|
||||||
|
"turbolinks": "^5.2.0",
|
||||||
"webpack": "^4.43.0",
|
"webpack": "^4.43.0",
|
||||||
"webpack-assets-manifest": "~4",
|
"webpack-assets-manifest": "~4",
|
||||||
"webpack-cli": "^3.3.12",
|
"webpack-cli": "^3.3.12",
|
||||||
|
|
10
yarn.lock
10
yarn.lock
|
@ -880,11 +880,6 @@
|
||||||
"@babel/helper-validator-identifier" "^7.14.0"
|
"@babel/helper-validator-identifier" "^7.14.0"
|
||||||
to-fast-properties "^2.0.0"
|
to-fast-properties "^2.0.0"
|
||||||
|
|
||||||
"@hotwired/turbo@^7.0.0-rc.4":
|
|
||||||
version "7.0.0-rc.4"
|
|
||||||
resolved "https://registry.yarnpkg.com/@hotwired/turbo/-/turbo-7.0.0-rc.4.tgz#d3ab9555544534f5ec649613553e72ff6c7d7122"
|
|
||||||
integrity sha512-4qx+6O6mUN+cSN+ZLGCOGc+2MxNrs7cFbmnWD6LIfiHAQyuNiIuB87Y5IAtOo8xj16fOBd2CdU1WRJya4Wkw0A==
|
|
||||||
|
|
||||||
"@sindresorhus/is@^0.14.0":
|
"@sindresorhus/is@^0.14.0":
|
||||||
version "0.14.0"
|
version "0.14.0"
|
||||||
resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-0.14.0.tgz#9fb3a3cf3132328151f353de4632e01e52102bea"
|
resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-0.14.0.tgz#9fb3a3cf3132328151f353de4632e01e52102bea"
|
||||||
|
@ -6383,6 +6378,11 @@ tty-browserify@0.0.0:
|
||||||
resolved "https://registry.yarnpkg.com/tty-browserify/-/tty-browserify-0.0.0.tgz#a157ba402da24e9bf957f9aa69d524eed42901a6"
|
resolved "https://registry.yarnpkg.com/tty-browserify/-/tty-browserify-0.0.0.tgz#a157ba402da24e9bf957f9aa69d524eed42901a6"
|
||||||
integrity sha1-oVe6QC2iTpv5V/mqadUk7tQpAaY=
|
integrity sha1-oVe6QC2iTpv5V/mqadUk7tQpAaY=
|
||||||
|
|
||||||
|
turbolinks@^5.2.0:
|
||||||
|
version "5.2.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/turbolinks/-/turbolinks-5.2.0.tgz#e6877a55ea5c1cb3bb225f0a4ae303d6d32ff77c"
|
||||||
|
integrity sha512-pMiez3tyBo6uRHFNNZoYMmrES/IaGgMhQQM+VFF36keryjb5ms0XkVpmKHkfW/4Vy96qiGW3K9bz0tF5sK9bBw==
|
||||||
|
|
||||||
type-fest@^0.8.1:
|
type-fest@^0.8.1:
|
||||||
version "0.8.1"
|
version "0.8.1"
|
||||||
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d"
|
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d"
|
||||||
|
|
Loading…
Reference in a new issue