generated from projects/testosmaximus
Compare commits
2 Commits
eeb00379bb
...
6f633d33f4
| Author | SHA1 | Date | |
|---|---|---|---|
| 6f633d33f4 | |||
| 1cdb770d68 |
6
source/package-lock.json
generated
6
source/package-lock.json
generated
@ -1,14 +1,14 @@
|
|||||||
{
|
{
|
||||||
"name": "@funky-flask-test/funky-flask-test",
|
"name": "@funky-flask-test/funky-flask-test",
|
||||||
"version": "1.0.1",
|
"version": "1.1.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@funky-flask-test/funky-flask-test",
|
"name": "@funky-flask-test/funky-flask-test",
|
||||||
"version": "1.0.1",
|
"version": "1.1.0",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"typescript": "^5.0.0",
|
"typescript": "^5.8.3",
|
||||||
"vite": "^5.0.0"
|
"vite": "^5.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@funky-flask-test/funky-flask-test",
|
"name": "@funky-flask-test/funky-flask-test",
|
||||||
"version": "1.0.1",
|
"version": "1.1.0",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "./dist/index.js",
|
"main": "./dist/index.js",
|
||||||
"exports": {
|
"exports": {
|
||||||
@ -19,7 +19,7 @@
|
|||||||
"preview": "vite preview"
|
"preview": "vite preview"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"vite": "^5.0.0",
|
"typescript": "^5.8.3",
|
||||||
"typescript": "^5.0.0"
|
"vite": "^5.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,60 +1,27 @@
|
|||||||
let clickCount = 0
|
import { h, render, Component } from 'nano-jsx'
|
||||||
|
|
||||||
export function insertRickLabel(target: HTMLElement | string = document.body): void {
|
class RickLabel extends Component {
|
||||||
const label = document.createElement('div')
|
count = 0
|
||||||
label.textContent = `Rickroll Me (0)`
|
|
||||||
Object.assign(label.style, {
|
|
||||||
background: 'white',
|
|
||||||
color: 'black',
|
|
||||||
fontFamily: 'sans-serif',
|
|
||||||
padding: '8px 12px',
|
|
||||||
borderRadius: '6px',
|
|
||||||
cursor: 'pointer',
|
|
||||||
boxShadow: '0 0 5px rgba(0,0,0,0.1)',
|
|
||||||
width: 'fit-content',
|
|
||||||
userSelect: 'none',
|
|
||||||
transition: 'all 0.3s ease'
|
|
||||||
})
|
|
||||||
|
|
||||||
label.onclick = () => {
|
handleClick = () => {
|
||||||
clickCount++
|
this.count++
|
||||||
label.textContent = `Rickroll Me (${clickCount})`
|
window.open('https://www.youtube.com/watch?v=dQw4w9WgXcQ', '_blank')
|
||||||
|
this.update()
|
||||||
const url =
|
|
||||||
clickCount >= 69
|
|
||||||
? 'https://youtu.be/soKTQx0p7_Q?list=RDsoKTQx0p7_Q'
|
|
||||||
: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
|
|
||||||
|
|
||||||
if (clickCount === 69) {
|
|
||||||
// Activate rainbow effect via CSS animation
|
|
||||||
label.style.animation = 'rainbowBackground 3s linear infinite'
|
|
||||||
label.style.color = 'white'
|
|
||||||
}
|
|
||||||
|
|
||||||
window.open(url, '_blank')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof target === 'string') {
|
render() {
|
||||||
document.querySelector(target)?.appendChild(label)
|
return (
|
||||||
} else {
|
<div
|
||||||
target.appendChild(label)
|
style="background:white; padding:8px 12px; border-radius:6px; cursor:pointer; font-family:sans-serif;"
|
||||||
}
|
onclick={this.handleClick}
|
||||||
|
>
|
||||||
// Inject rainbow animation into page if not already there
|
Rickroll Me ({this.count})
|
||||||
if (!document.getElementById('rainbow-style')) {
|
</div>
|
||||||
const style = document.createElement('style')
|
)
|
||||||
style.id = 'rainbow-style'
|
|
||||||
style.textContent = `
|
|
||||||
@keyframes rainbowBackground {
|
|
||||||
0% { background: red; }
|
|
||||||
16% { background: orange; }
|
|
||||||
32% { background: yellow; }
|
|
||||||
48% { background: green; }
|
|
||||||
64% { background: blue; }
|
|
||||||
80% { background: indigo; }
|
|
||||||
100% { background: violet; }
|
|
||||||
}
|
|
||||||
`
|
|
||||||
document.head.appendChild(style)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function insertRickLabel(target: HTMLElement | string = document.body) {
|
||||||
|
const container = typeof target === 'string' ? document.querySelector(target) : target
|
||||||
|
if (container) render(<RickLabel />, container)
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user