diff --git a/handlers/style/view.go b/handlers/style/view.go index 2582a99e..5b76809e 100644 --- a/handlers/style/view.go +++ b/handlers/style/view.go @@ -50,7 +50,7 @@ func GetStylePage(c *fiber.Ctx) error { "User": u, "Title": data.Name, "Style": data, - "URL": c.BaseURL() + c.Path(), + "URL": c.BaseURL() + "/style/" + id, "Slug": slug, "Canonical": "style/" + id + "/" + slug, "RenderMeta": true, diff --git a/web/typescript/page/view-style.ts b/web/typescript/page/view-style.ts index 5a2c95d4..27912087 100644 --- a/web/typescript/page/view-style.ts +++ b/web/typescript/page/view-style.ts @@ -3,16 +3,19 @@ import {doDomOperation} from 'utils/dom'; export const initViewStyle = () => doDomOperation(() => { shareButton(); checkIfStyleInstalled(); + removeStylusTooltip(); }); function shareButton() { - const urlValue = document.getElementById('share').textContent; + const urlBar = document.getElementById('share'); const shareButton = document.getElementById('btn-share') as HTMLButtonElement; if (!shareButton) { return; } + urlBar.textContent += urlBar.getAttribute("slug"); + shareButton.removeAttribute("hidden"); shareButton.addEventListener('click', () => { - navigator.clipboard.writeText(urlValue).then(() => { + navigator.clipboard.writeText(urlBar.textContent).then(() => { shareButton.classList.add('copied'); }, () => { shareButton.classList.add('copied-failed'); @@ -45,3 +48,8 @@ function checkIfStyleInstalled() { origin: 'https://userstyles.world' })); } + +function removeStylusTooltip() { + const Stylus = document.querySelector('a#stylus'); + Stylus.removeAttribute("data-tooltip"); +} diff --git a/web/views/style/view.tmpl b/web/views/style/view.tmpl index f46bc9fa..1087b33b 100644 --- a/web/views/style/view.tmpl +++ b/web/views/style/view.tmpl @@ -46,11 +46,11 @@
- {{ .URL }} + {{ .URL }}
@@ -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