Rainbow Background Bookmarklet
Double-click to exit.
Shorter than v2. (810 -> 561)
javascript:( ( r , a , s , p , b , e , n ) => { let w = window , l = e ( "body" ) . classList , x = c => l . remove ( c ) ; if ( ! e ( "#" + r + s ) ) e ( "head" ) . innerHTML += `<style id="${ r + s } ">@keyframes ${ r } -${ a } {${ [ 0 , 1 , 2 , 3 , 4 , 5 , 6 ] . map ( i => i / 0.06 + "%{background-color:#" + "c44c44cc4cc4c" . substr ( i % 2 * 5 + i % 6 , 3 ) + "}" ) . join ( "" ) } }.${ r } {${ a } :${ r } -${ a } 15s linear 0s infinite normal}.${ r + p } {${ a } -play-state:paused}</style>` ; if ( l . contains ( r ) ) { if ( w [ r ] [ b ] + 500 >= n ) { x ( r ) ; x ( r + p ) } else { l . toggle ( r + p ) ; w [ r ] [ b ] = n } } else { l . add ( r ) ; w [ r ] = { before :0 } } } ) ( "rainbowbg3" , "animation" , "-style" , "-pause" , "before" , q => document . querySelector ( q ) , Date . now ( ) )
javascript:( ( ) => { const b = document . getElementsByTagName ( "body" ) [ 0 ] . classList ; if ( ! document . getElementById ( "rainbowbg2-style" ) ) document . getElementsByTagName ( "head" ) [ 0 ] . innerHTML += '<style id="rainbowbg2-style">@keyframes rainbowbg2-animation{0%{background-color:#c44}16.7%{background-color:#cc4}33.3%{background-color:#4c4}50%{background-color:#4cc}66.7%{background-color:#44c}83.3%{background-color:#c4c}100%{background-color:#c44}}.rainbowbg2{animation:rainbowbg2-animation 15s linear 0s infinite normal}.rainbowbg2-stop{animation-play-state:paused}</style>' ; if ( b . contains ( "rainbowbg2" ) ) { if ( window . rainbowbg2 . before + 500 >= Date . now ( ) ) { b . remove ( "rainbowbg2" ) ; b . remove ( "rainbowbg2-stop" ) } else { b . toggle ( "rainbowbg2-stop" ) ; window . rainbowbg2 . before = Date . now ( ) } } else { b . add ( "rainbowbg2" ) ; window . rainbowbg2 = { before :0 } } } ) ( )
javascript:( ( ) => { if ( ! window . rainbowbg ) window . rainbowbg = { } ; if ( window . rainbowbg . intervalId ) clearInterval ( window . rainbowbg . intervalId ) ; let c = [ 1 , 0 , 0 ] , d = 0.01 ; window . rainbowbg . intervalId = setInterval ( ( ) => { for ( let i of [ 0 , 1 , 2 ] ) if ( c [ i ] == 1 && c [ ( i + 1 ) % 3 ] != 1 ) { if ( c [ ( ( i - 1 ) % 3 + 3 ) % 3 ] > 0 ) c [ ( ( i - 1 ) % 3 + 3 ) % 3 ] -= d ; else c [ ( i + 1 ) % 3 ] += d ; break } c = c . map ( c => c < 0 ?0 :c > 1 ?1 :c ) ; document . getElementsByTagName ( "body" ) [ 0 ] . style . backgroundColor = `rgb(${ c . map ( c => 63 + 128 * c ) . join ( "," ) } )` } , 25 ) } ) ( )
javascript:( ( ) => { if ( ! window . rainbowbg ) window . rainbowbg = { } ; if ( window . rainbowbg . intervalId ) clearInterval ( window . rainbowbg . intervalId ) } ) ( )