feature: Okay should be good now

This commit is contained in:
Dominic Harris 2022-03-24 18:10:15 -04:00
parent 788235d411
commit b983bc352f
No known key found for this signature in database
GPG Key ID: 93CCF85F3E2A4F65
3 changed files with 20 additions and 3 deletions

View File

@ -19,7 +19,6 @@ head
meta(property='twitter:description' content='🖊 Just a place to paste')
meta(property='twitter:image' content='https://raw.githubusercontent.com/zer0bin-dev/.github/main/zer0bin.png')
script(defer='' type='module' src='src/index.ts')
script(defer='' type='module' src='src/icons.ts')
ul.noselect#messages
.button-wrapper.noselect()

View File

@ -6,7 +6,8 @@ import {
ForkOutlined,
HeartOutlined,
StarOutlined,
EyeOutlined
EyeOutlined,
EyeInvisibleOutlined
} from "@ant-design/icons-svg"
import { renderIconDefinitionToSVGElement } from "@ant-design/icons-svg/es/helpers"
import tippy from "tippy.js"
@ -37,7 +38,7 @@ copyButton.innerHTML += renderIconDefinitionToSVGElement(CopyOutlined, {
githubButton.innerHTML += renderIconDefinitionToSVGElement(GithubOutlined, {
extraSVGAttrs: extraSVGAttrs,
})
hideButton.innerHTML += renderIconDefinitionToSVGElement(EyeOutlined, {
hideButton.innerHTML += renderIconDefinitionToSVGElement(EyeInvisibleOutlined, {
extraSVGAttrs: extraSVGAttrs,
})
@ -109,3 +110,15 @@ function callback() {
observer.observe(document.getElementById("code-view-pre"), {
attributes: true,
})
export function toggleHiddenIcon(hidden: boolean) {
if (!hidden) {
hideButton.innerHTML = renderIconDefinitionToSVGElement(EyeInvisibleOutlined, {
extraSVGAttrs: extraSVGAttrs,
})
} else {
hideButton.innerHTML = renderIconDefinitionToSVGElement(EyeOutlined, {
extraSVGAttrs: extraSVGAttrs,
})
}
}

View File

@ -5,7 +5,10 @@ import { marked } from "marked"
import JSConfetti from "js-confetti"
import Scrollbar from "smooth-scrollbar"
import "./icons"
import config from "../config.json"
import { toggleHiddenIcon } from "./icons"
const apiUrl = config.api_url
const confettiChance = parseInt(config.confetti_chance)
let rawContent = ""
@ -274,6 +277,8 @@ hideButton.addEventListener("click", function () {
buttonPaneHidden = false
show(buttonWrapper)
}
toggleHiddenIcon(buttonPaneHidden)
})
async function handlePopstate() {