From 3f4a0d5370ae6c34afe180df96add3b8522f4af1 Mon Sep 17 00:00:00 2001 From: mattkae Date: Wed, 11 May 2022 09:23:58 -0400 Subject: initial commit --- .../skewer-everything.user.js | 54 ++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 elpa/skewer-mode-20200304.1142/skewer-everything.user.js (limited to 'elpa/skewer-mode-20200304.1142/skewer-everything.user.js') diff --git a/elpa/skewer-mode-20200304.1142/skewer-everything.user.js b/elpa/skewer-mode-20200304.1142/skewer-everything.user.js new file mode 100644 index 0000000..4d22273 --- /dev/null +++ b/elpa/skewer-mode-20200304.1142/skewer-everything.user.js @@ -0,0 +1,54 @@ +// ==UserScript== +// @name Skewer Everything +// @description Add a toggle button to run Skewer on the current page +// @lastupdated 2015-09-14 +// @version 1.3 +// @license Public Domain +// @include /^https?:/// +// @grant none +// @run-at document-start +// ==/UserScript== + +window.skewerNativeXHR = XMLHttpRequest; +window.skewerInject = inject; + +var host = 'http://localhost:8080'; + +var toggle = document.createElement('div'); +toggle.onclick = inject; +toggle.style.width = '0px'; +toggle.style.height = '0px'; +toggle.style.borderStyle = 'solid'; +toggle.style.borderWidth = '0 12px 12px 0'; +toggle.style.borderColor = 'transparent #F00 transparent transparent'; +toggle.style.position = 'fixed'; +toggle.style.right = 0; +toggle.style.top = 0; +toggle.style.zIndex = 214748364; + +var injected = false; + +function inject() { + if (!injected) { + var script = document.createElement('script'); + script.src = host + '/skewer'; + document.body.appendChild(script); + toggle.style.borderRightColor = '#0F0'; + } else { + /* break skewer to disable it */ + skewer.fn = null; + toggle.style.borderRightColor = '#F00'; + } + injected = !injected; + localStorage._autoskewered = JSON.stringify(injected); +} + +document.addEventListener('DOMContentLoaded', function() { + /* Don't use on iframes. */ + if (window.top === window.self) { + document.body.appendChild(toggle); + if (JSON.parse(localStorage._autoskewered || 'false')) { + inject(); + } + } +}); -- cgit v1.2.1