User:Ahecht/Scripts/cookies.js

/* Wikipedia cookie display tool Ahecht - 2017

Add the following line to Special:MyPage/common.js or meta:Special:MyPage/global.js page to install: mw.loader.load( '//en.wikipedia.org/w/index.php?title='User:Ahecht/Scripts/cookies.js&action=raw&ctype=text/javascript' ); //User:Ahecht/Scripts/cookies.js Once installed, navigate to Special:Cookies to view the cookies Wikipedia has stored in your browser.

mw.loader.using(['mediawiki.api.edit', 'mediawiki.Title'], function {	"use strict";	var config = mw.config.get(['wgNamespaceNumber', 'wgTitle', 'wgUserGroups', 'skin']);	function showCookies {		var bodyContent = (config.skin == "cologneblue" ? "article" : "bodyContent");		document.getElementsByTagName("h1")[0].textContent = "Wikipedia cookie display tool";		document.title = "Wikipedia cookie display tool - Wikipedia, the free encyclopedia";		document.getElementById(bodyContent).innerHTML = ' From Wikipedia, the free encyclopedia ' +			' ' + 			'  ';		var cookies = document.cookie.split('; ');		if (cookies.length == 0) {			document.getElementById(bodyContent).innerHTML += ' You have no cookies from Wikipedia ';		} else {			document.getElementById(bodyContent).innerHTML += ' The following are the cookies stored in your browser by ' +				window.location.hostname +				'. For more information, see https://wikimediafoundation.org/wiki/Cookie_statement. ' +				''; for(var i = 0; i < cookies.length; i++){ var c = cookies[i].split('='); if ( c[0] ) { document.getElementById(bodyContent).innerHTML += ' ' + c[0] + '= ' + unescape(c[1]) + ''; }			}			document.getElementById(bodyContent).innerHTML += '' }		document.getElementById(bodyContent).innerHTML += ' ' document.getElementById(bodyContent).setAttribute('class', 'mw-body-content'); }	if (config.wgNamespaceNumber == -1 && config.wgTitle.toLowerCase == "cookies") { showCookies; }

});