From 93e44c9bf44d925813c61803ecfe29da4d55fb66 Mon Sep 17 00:00:00 2001 From: Mike Castle Date: Fri, 20 Oct 2023 20:51:20 -0700 Subject: [PATCH] Add a dismiss button to the header of the new info widget. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Issue #130. ␄ --- linkedin-tool.user.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/linkedin-tool.user.js b/linkedin-tool.user.js index 4b4e66a..70ce81a 100644 --- a/linkedin-tool.user.js +++ b/linkedin-tool.user.js @@ -4144,8 +4144,12 @@ widget.classList.add('lit-info'); const name = document.createElement('div'); - name.innerHTML = `${GM.info.script.name} - ` + - `v${GM.info.script.version}`; + name.classList.add('lit-justify'); + const title = `${GM.info.script.name} - ` + + `v${GM.info.script.version}`; + const dismissId = NH.base.safeId(`${widget.id}-dismiss`); + const dismiss = ``; + name.innerHTML = `${title}${dismiss}`; const instructions = document.createElement('div'); instructions.classList.add('lit-justify'); @@ -4159,6 +4163,10 @@ `Hit ${esc} to close`; widget.append(name, instructions); + + document.getElementById(dismissId).addEventListener('click', () => { + this.#infoWidget.close(); + }); } /** Create CSS styles for stuff specific to LinkedIn Tool. */ @@ -4172,6 +4180,12 @@ ' display: flex;' + ' flex-direction: column;' + '}', + '.lit-info button {' + + ' border-width: 1px;' + + ' border-style: solid;' + + ' border-radius: 1em;' + + ' padding: 3px;' + + '}', '.lit-news {' + ' position: absolute;' + ' bottom: 14px;' +