Skip to content

Instantly share code, notes, and snippets.

@rofe
rofe / tampermonkey-helix-changes-7d.js
Last active September 12, 2020 08:14
Tampermonkey script to show Helix changes from the last 7 days
d=new Intl.DateTimeFormat("de", { year: 'numeric', month: '2-digit', day: "2-digit" }).format(new Date(Date.now()-691200000)).split('.').reverse().join('-');window.open(`https://github.com/issues?q=is%3Aissue+label%3Aenhancement+org%3Aadobe+helix+OR+theblog+closed%3A>${d}`);
// ==UserScript==
// @name Helix changes
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Find all Helix enhancements in GitHub in the last 7 days
// @author rofe
// @match <your_url>
// @grant none
// ==/UserScript==
{
"project": "My Project",
"host": "www.mydomain.prod",
"plugins": []
}
{
"plugins": [
{
"id": "foo",
"title": "Foo",
"event": "foo"
}
]
}
const foo = ({ detail }) => {
const sk = detail.data;
// your custom code from button.action goes here
};
const sk = document.querySelector('helix-sidekick');
if (sk) {
// sidekick already loaded
sk.addEventListener('custom:foo', foo);
} else {
{
"plugins": [
{
"id": "foo",
"title": "Foo",
"url": "/tools/sidekick/foo.html"
},
]
}
/*
* Copyright 2023 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
@rofe
rofe / config-special-view.json
Last active July 29, 2023 16:52
sidekick custom view: config.json
{
"specialViews": [{
"title": "Better JSON Viewer",
"path": "**.json",
"viewer": "/tools/sidekick/better-json-viewer/index.html"
}]
}
@rofe
rofe / sidekick-special-view.html
Last active July 29, 2023 16:45
sidekick custom view: HTML
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<!-- inherit base styles from sidekick (if desired) -->
<link rel="stylesheet" href="chrome-extension://ccfggkjabjahcjoljmgmklhpaccedipo/app.css">
<!-- add your own styles -->
<link rel="stylesheet" href="styles.css">
<!-- add your logic -->
<script src="script.js"></script>
</head>
@rofe
rofe / sidekick-special-view.js
Created July 29, 2023 16:48
sidekick custom view: scripts.js
(async () => {
try {
// get the resource URL from the url query parameter
const url = new URL(window.location.href).searchParams.get('url');
if (url) {
const res = await fetch(url);
if (res.ok) {
const text = await res.text();
const data = JSON.parse(text);
// do something with the data
@rofe
rofe / using-placeholders.js
Last active February 21, 2024 14:35
placeholders
import { fetchPlaceholders } from '/scripts/aem.js';
// fetch placeholders from the 'en' folder
const placeholders = await fetchPlaceholders('en');
// retrieve the value for key 'foo'
const { foo } = placeholders;