Misplaced Pages

User:JJPMaster/wallpaper.js: Difference between revisions

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.
< User:JJPMaster Browse history interactively← Previous editContent deleted Content added
Revision as of 23:02, 26 December 2024 view sourceJJPMaster (talk | contribs)Extended confirmed users, Page movers, New page reviewers, Rollbackers10,258 editsNo edit summary← Previous edit Latest revision as of 15:58, 31 December 2024 view source JJPMaster (talk | contribs)Extended confirmed users, Page movers, New page reviewers, Rollbackers10,258 edits only that one worksTag: Manual revert 
(19 intermediate revisions by the same user not shown)
Line 1: Line 1:
var portlet = mw.util.addPortletLink('p-cactions', '#', 'Change wallpaper', 'p-wallp', 'Change the wallpaper for this page');
$(".mediawiki").css({
let bgImage = localStorage.getItem("wp-wallpaper");
"background-image": "url(https://c4.wallpaperflare.com/wallpaper/855/310/394/something-beautiful-nature-2880x1800-wallpaper-preview.jpg)",
mw.loader.load( '/search/?title=User:JJPMaster/wallpaper.css&action=raw&ctype=text/css', 'text/css' ); // Backlink: ]
"background-size": "cover",
function setWallpaper(url) {
"background-attachment": "fixed"
$("body").css({
"background-image": `url(${url})`,
"background-size": "cover",
"background-attachment": "fixed",
});
$(".mw-body").css({"background-color": "rgba(255, 255, 255, 0.8)"});
// $("#mw-page-base").css({"background-color": "rgba(255, 255, 255, 0.8) !important"});
}
function setInverted() {
if (localStorage.getItem("wp-inverted") == "true") {
$("#mw-panel .mw-list-item, #footer-info, #footer-places").css({
"filter": "invert(1)",
});
$(".mw-body").css({"background-color": "rgba(255, 255, 255, 0.8)"});
}
return;
}
setWallpaper(bgImage);
setInverted();
$(portlet).click(() => {
bgImage = prompt("What would you like to change the wallpaper to? Please enter a URL.", localStorage.getItem("wp-wallpaper"));
if(bgImage) {
localStorage.setItem("wp-wallpaper", bgImage);
var inverted = confirm("Should the color of the text be inverted?");
localStorage.setItem("wp-inverted", String(inverted));
setInverted();
setWallpaper(bgImage);
}
}); });

Latest revision as of 15:58, 31 December 2024

var portlet = mw.util.addPortletLink('p-cactions', '#', 'Change wallpaper', 'p-wallp', 'Change the wallpaper for this page');
let bgImage = localStorage.getItem("wp-wallpaper");
mw.loader.load( '/search/?title=User:JJPMaster/wallpaper.css&action=raw&ctype=text/css', 'text/css' ); // Backlink: ]
function setWallpaper(url) {
	$("body").css({
		"background-image": `url(${url})`,
		"background-size": "cover",
		"background-attachment": "fixed",
	});
	$(".mw-body").css({"background-color": "rgba(255, 255, 255, 0.8)"});
	// $("#mw-page-base").css({"background-color": "rgba(255, 255, 255, 0.8) !important"});
}
function setInverted() {
	if (localStorage.getItem("wp-inverted") == "true") {
		$("#mw-panel .mw-list-item, #footer-info, #footer-places").css({
			"filter": "invert(1)",
		});
		$(".mw-body").css({"background-color": "rgba(255, 255, 255, 0.8)"});
	}
	return;
}
setWallpaper(bgImage);
setInverted();
$(portlet).click(() => {
	bgImage = prompt("What would you like to change the wallpaper to? Please enter a URL.", localStorage.getItem("wp-wallpaper"));
	if(bgImage) {
		localStorage.setItem("wp-wallpaper", bgImage);
		var inverted = confirm("Should the color of the text be inverted?");
		localStorage.setItem("wp-inverted", String(inverted));
		setInverted();
		setWallpaper(bgImage);
	}
});