diff --git a/date-button/index.js b/date-button/index.js index 42fd6618115145a2ac72ce266eeb69398fd2de1d..e00a3f1529af92e828b7a6b23ebe295a48d741d0 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); })(); - - - - - - - - - - - - -