Skip to content

Commit

Permalink
feat(ui): add nojs tooltip to "Get Stylus" button
Browse files Browse the repository at this point in the history
To avoid user confustion if Stylus is installed.
  • Loading branch information
astyled committed Sep 13, 2023
1 parent cd05202 commit 1cd0096
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions web/typescript/page/view-style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {doDomOperation} from 'utils/dom';
export const initViewStyle = () => doDomOperation(() => {
shareButton();
checkIfStyleInstalled();
removeStylusTooltip();
});

function shareButton() {
Expand Down Expand Up @@ -47,3 +48,8 @@ function checkIfStyleInstalled() {
origin: 'https://userstyles.world'
}));
}

function removeStylusTooltip() {
const Stylus = document.querySelector('a#stylus');
Stylus.removeAttribute("data-tooltip");
}
1 change: 1 addition & 0 deletions web/views/style/view.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@
target="_blank"
rel="noopener"
href="https://github.com/openstyles/stylus/#readme"
data-tooltip="Stylus detection only works with JS enabled"
id="stylus" class="btn icon stylus"
>{{ template "icons/brush" }} Get Stylus</a>
</div>
Expand Down

0 comments on commit 1cd0096

Please sign in to comment.