Skip to content

Commit

Permalink
Add a dismiss button to the header of the new info widget.
Browse files Browse the repository at this point in the history
Issue #130.

␄
  • Loading branch information
Mike Castle committed Oct 21, 2023
1 parent 44de03b commit 93e44c9
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions linkedin-tool.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -4144,8 +4144,12 @@
widget.classList.add('lit-info');

const name = document.createElement('div');
name.innerHTML = `<b>${GM.info.script.name}</b> - ` +
`v${GM.info.script.version}`;
name.classList.add('lit-justify');
const title = `<b>${GM.info.script.name}</b> - ` +
`v${GM.info.script.version}`;
const dismissId = NH.base.safeId(`${widget.id}-dismiss`);
const dismiss = `<button id=${dismissId}>X</button>`;
name.innerHTML = `<span>${title}</span><span>${dismiss}</span>`;

const instructions = document.createElement('div');
instructions.classList.add('lit-justify');
Expand All @@ -4159,6 +4163,10 @@
`<span>Hit ${esc} to close</span>`;

widget.append(name, instructions);

document.getElementById(dismissId).addEventListener('click', () => {
this.#infoWidget.close();
});
}

/** Create CSS styles for stuff specific to LinkedIn Tool. */
Expand All @@ -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;' +
Expand Down

0 comments on commit 93e44c9

Please sign in to comment.