mirror of https://github.com/zer0bin-dev/zer0bin
refactor: 💄 Share button to top bar
This commit is contained in:
parent
648b6aac4e
commit
f001286f5b
|
@ -46,13 +46,13 @@ html(lang='en')
|
||||||
//- - }
|
//- - }
|
||||||
button#new-button.btn(aria-label='New paste')
|
button#new-button.btn(aria-label='New paste')
|
||||||
button#copy-button.btn(aria-label='Copy')
|
button#copy-button.btn(aria-label='Copy')
|
||||||
|
button#share-button.btn(aria-label='Share')
|
||||||
a(href='https://github.com/zer0bin-dev/zer0bin' aria-label='GitHub repo')
|
a(href='https://github.com/zer0bin-dev/zer0bin' aria-label='GitHub repo')
|
||||||
button#github-button.btn(aria-label='GitHub')
|
button#github-button.btn(aria-label='GitHub')
|
||||||
span.viewcounter.noselect#viewcounter-label(style='visibility: hidden; display: none') Views:
|
span.viewcounter.noselect#viewcounter-label(style='visibility: hidden; display: none') Views:
|
||||||
span.viewcounter.noselect#viewcounter-count(style='visibility: hidden; display: none')
|
span.viewcounter.noselect#viewcounter-count(style='visibility: hidden; display: none')
|
||||||
|
|
||||||
.bottom-button-wrapper
|
.bottom-button-wrapper
|
||||||
button#share-button.btn(aria-label='Share' style='visibility: hidden')
|
|
||||||
button#hide-button.btn(aria-label='Hide')
|
button#hide-button.btn(aria-label='Hide')
|
||||||
|
|
||||||
.scrollbar-container
|
.scrollbar-container
|
||||||
|
|
|
@ -93,6 +93,14 @@ tippy("#copy-button", {
|
||||||
allowHTML: true,
|
allowHTML: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
tippy("#share-button", {
|
||||||
|
content: `Share paste<br><span class='keybind'>Copies URL</span>`,
|
||||||
|
placement: "top",
|
||||||
|
animation: "scale",
|
||||||
|
theme: "rosepine",
|
||||||
|
allowHTML: true,
|
||||||
|
})
|
||||||
|
|
||||||
tippy("#github-button", {
|
tippy("#github-button", {
|
||||||
content: `GitHub<br><span class='keybind'>
|
content: `GitHub<br><span class='keybind'>
|
||||||
${renderIconDefinitionToSVGElement(StarOutlined, {
|
${renderIconDefinitionToSVGElement(StarOutlined, {
|
||||||
|
@ -116,14 +124,6 @@ tippy("#hide-button", {
|
||||||
allowHTML: true,
|
allowHTML: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
tippy("#share-button", {
|
|
||||||
content: "Share paste",
|
|
||||||
placement: "top",
|
|
||||||
animation: "scale",
|
|
||||||
theme: "rosepine",
|
|
||||||
allowHTML: true,
|
|
||||||
})
|
|
||||||
|
|
||||||
const observer = new MutationObserver(callback)
|
const observer = new MutationObserver(callback)
|
||||||
|
|
||||||
function callback() {
|
function callback() {
|
||||||
|
|
|
@ -117,6 +117,7 @@ function newPaste() {
|
||||||
enable(saveButton)
|
enable(saveButton)
|
||||||
disable(newButton)
|
disable(newButton)
|
||||||
disable(copyButton)
|
disable(copyButton)
|
||||||
|
disable(shareButton)
|
||||||
enable(singleViewButton)
|
enable(singleViewButton)
|
||||||
|
|
||||||
editor.value = ""
|
editor.value = ""
|
||||||
|
@ -128,7 +129,6 @@ function newPaste() {
|
||||||
hide(codeViewPre)
|
hide(codeViewPre)
|
||||||
hide(viewCounterLabel)
|
hide(viewCounterLabel)
|
||||||
hide(viewCounter)
|
hide(viewCounter)
|
||||||
hide(shareButton)
|
|
||||||
viewCounterLabel.style.display = "none"
|
viewCounterLabel.style.display = "none"
|
||||||
viewCounter.style.display = "none"
|
viewCounter.style.display = "none"
|
||||||
}
|
}
|
||||||
|
@ -167,7 +167,7 @@ function viewPaste(content: string, views: string, singleView: boolean) {
|
||||||
addMessage("This is a single-view paste!")
|
addMessage("This is a single-view paste!")
|
||||||
}
|
}
|
||||||
|
|
||||||
show(shareButton)
|
enable(shareButton)
|
||||||
shareButton.addEventListener("click", function () {
|
shareButton.addEventListener("click", function () {
|
||||||
const url = window.location.toString()
|
const url = window.location.toString()
|
||||||
if (navigator.canShare) {
|
if (navigator.canShare) {
|
||||||
|
|
Loading…
Reference in New Issue