From 85b3487ad012d291643b781f056f3b8347903ec7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= <hugo@lysator.liu.se> Date: Mon, 6 Jun 2022 22:52:33 +0200 Subject: [PATCH] Fix styles for date-button. --- date-button/index.js | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/date-button/index.js b/date-button/index.js index 42fd661..e00a3f1 100644 --- a/date-button/index.js +++ b/date-button/index.js @@ -1,7 +1,7 @@ // ==UserScript== // @name Date Button // @namespace http://hugo.hornquist.se -// @version 0.1.1 +// @version 0.1.2 // @author hugo@lysator.liu.se // @match * // @description Inputs the current date into the current text field. @@ -16,6 +16,7 @@ (function () { 'use strict'; + let btn_id = 'id-37582c25-78ad-4922-a19b-244361f42ec0' function serialize_event(e) { return { @@ -52,10 +53,7 @@ } let btn = document.createElement('button'); - - btn.style.position = 'absolute'; - btn.style.top = '1em'; - btn.style.left = '1em'; + btn.id = btn_id; let registered_key_combo = GM_getValue('date-key'); console.log(registered_key_combo); @@ -106,20 +104,18 @@ }); let style = document.createElement('style'); - style.textContent = `button:focus {background: pink;})` + style.textContent = ` + #${btn_id} { + position: absolute; + top: 1em; + left: 1em; + z-index: 10000; + } + #${btn_id}:focus { + background: pink; + } + ` + document.head.appendChild(style); })(); - - - - - - - - - - - - - -- GitLab