Difference between revisions of "User:RJackson/vector.js"

From Team Fortress Wiki
Jump to: navigation, search
(can i not use template strings???)
(testing dark mode shite)
Line 4: Line 4:
 
// Im a profeional developer so i must make sure there is no flash of unrotated content
 
// Im a profeional developer so i must make sure there is no flash of unrotated content
 
logo.setAttribute('angleshaha', true);
 
logo.setAttribute('angleshaha', true);
 +
 +
 +
$( function () {
 +
var darkMode = false;
 +
 +
$( '#pt-darkmode-link a' ).on( 'click', function ( e ) {
 +
e.preventDefault();
 +
darkMode = !darkMode;
 +
 +
$( document.documentElement ).toggleClass( 'client-dark-mode', darkMode );
 +
$( e.target ).text( mw.msg( darkMode ? 'darkmode-default-link' : 'darkmode-link' ) );
 +
} );
 +
} );

Revision as of 15:25, 3 October 2020

const logo = document.querySelector('.mw-wiki-logo');
logo.style.transform = 'rotate(' + Math.random() * 360 + 'deg)';

// Im a profeional developer so i must make sure there is no flash of unrotated content
logo.setAttribute('angleshaha', true);


$( function () {
	var darkMode = false;

	$( '#pt-darkmode-link a' ).on( 'click', function ( e ) {
		e.preventDefault();
		darkMode = !darkMode;

		$( document.documentElement ).toggleClass( 'client-dark-mode', darkMode );
		$( e.target ).text( mw.msg( darkMode ? 'darkmode-default-link' : 'darkmode-link' ) );
	} );
} );