MediaWiki:Common.js: Revizyonlar arasındaki fark

Orta Anadolu Kürtleri Kültürel Hafıza Arşivi sitesinden
(Pepuk projektor modu URL parametresi rastgele gecislerde korunuyor)
(Pepuk projektor modu eski tarayicilar icin daha uyumlu hale getirildi)
4. satır: 4. satır:
var match = new RegExp('[?&]' + name + '=([^&]*)').exec(window.location.search);
var match = new RegExp('[?&]' + name + '=([^&]*)').exec(window.location.search);
return match ? decodeURIComponent(match[1].replace(/\+/g, ' ')) : null;
return match ? decodeURIComponent(match[1].replace(/\+/g, ' ')) : null;
}
function nowMs() {
return new Date().getTime();
}
function redirectTo(url) {
window.location.href = url;
}
function onReady(fn) {
if (document.readyState === 'complete' || document.readyState === 'interactive') {
fn();
return;
}
if (document.addEventListener) {
document.addEventListener('DOMContentLoaded', fn, false);
} else if (window.attachEvent) {
window.attachEvent('onload', fn);
} else {
var oldOnload = window.onload;
window.onload = function () {
if (oldOnload) {
oldOnload();
}
fn();
};
}
}
}


25. satır: 53. satır:


var active = false;
var active = false;
try {
try {
active = localStorage.getItem(storageKey) === '1';
active = localStorage.getItem(storageKey) === '1';
35. satır: 62. satır:


function applyProjectorMode() {
function applyProjectorMode() {
if (document.getElementById('pepuk-projecteur-style')) {
return;
}
var style = document.createElement('style');
var style = document.createElement('style');
style.id = 'pepuk-projecteur-style';
style.id = 'pepuk-projecteur-style';
style.textContent = [
var css = '' +
'html, body { background: #101418 !important; color: #f4ead7 !important; overflow-x: hidden !important; }',
'html, body { background: #101418 !important; color: #f4ead7 !important; overflow-x: hidden !important; }' +
'#mw-panel, #p-logo, #p-personal, #footer, #mw-head, #left-navigation, #right-navigation, .vector-header-container, .vector-page-toolbar, .vector-sticky-header, .mw-editsection, .catlinks, .printfooter, .mw-indicators, .mw-jump, .mw-portlet, .vector-column-end, .page-actions, .mw-footer, .vector-page-tools-landmark { display: none !important; }',
'#mw-panel, #p-logo, #p-personal, #footer, #mw-head, #left-navigation, #right-navigation, .vector-header-container, .vector-page-toolbar, .vector-sticky-header, .mw-editsection, .catlinks, .printfooter, .mw-indicators, .mw-jump, .mw-portlet, .vector-column-end, .page-actions, .mw-footer, .vector-page-tools-landmark { display: none !important; }' +
'#content, .mw-body, .vector-body, .vector-page-titlebar, .mw-parser-output { margin: 0 !important; max-width: none !important; width: auto !important; }',
'#content, .mw-body, .vector-body, .vector-page-titlebar, .mw-parser-output { margin: 0 !important; max-width: none !important; width: auto !important; }' +
'#content, .mw-body, .vector-body { background: #f6eddc !important; color: #201a16 !important; padding: 2.4rem 3rem !important; box-sizing: border-box !important; }',
'#content, .mw-body, .vector-body { background: #f6eddc !important; color: #201a16 !important; padding: 2.4rem 3rem !important; box-sizing: border-box !important; }' +
'body, #content, .mw-body, .vector-body { font-size: 145% !important; line-height: 1.5 !important; }',
'body, #content, .mw-body, .vector-body { font-size: 145% !important; line-height: 1.5 !important; }' +
'#mw-content-text, .mw-parser-output p, .mw-parser-output li, .mw-parser-output dd, .mw-parser-output blockquote, .mw-parser-output td, .mw-parser-output th { font-size: 1em !important; line-height: 1.55 !important; }',
'#mw-content-text, .mw-parser-output p, .mw-parser-output li, .mw-parser-output dd, .mw-parser-output blockquote, .mw-parser-output td, .mw-parser-output th { font-size: 1em !important; line-height: 1.55 !important; }' +
'.mw-page-container, .vector-sitenotice-container, .vector-main-menu-container, .vector-column-start, .vector-column-center, .vector-body-before-content { max-width: none !important; margin: 0 !important; padding: 0 !important; }',
'.mw-page-container, .vector-sitenotice-container, .vector-main-menu-container, .vector-column-start, .vector-column-center, .vector-body-before-content { max-width: none !important; margin: 0 !important; padding: 0 !important; }' +
'a { color: #7a2d12 !important; }'
'a { color: #7a2d12 !important; }';
].join('\n');


if (!document.getElementById(style.id)) {
if (style.styleSheet) {
document.head.appendChild(style);
style.styleSheet.cssText = css;
} else {
style.appendChild(document.createTextNode(css));
}
}
var head = document.getElementsByTagName('head')[0] || document.documentElement;
head.appendChild(style);
}
}


if (document.readyState === 'loading') {
onReady(applyProjectorMode);
document.addEventListener('DOMContentLoaded', applyProjectorMode, { once: true });
} else {
applyProjectorMode();
}


setTimeout(function () {
window.setTimeout(function () {
window.location.href = randomPath + '?pepuk_projecteur=1&pepuk_time=' + Date.now();
redirectTo(randomPath + '?pepuk_projecteur=1&pepuk_time=' + nowMs());
}, rotateDelayMs);
}, rotateDelayMs);
}());
}());
66. satır: 97. satır:
/* Pepuk Projector Shortcut */
/* Pepuk Projector Shortcut */
(function () {
(function () {
var normalizedTitle = (mw.config.get('wgPageName') || '').replace(/_/g, ' ');
function nowMs() {
if (normalizedTitle !== 'Proj') {
return new Date().getTime();
}
 
var pageName = '';
if (window.mw && mw.config && mw.config.get) {
pageName = mw.config.get('wgPageName') || '';
} else {
var match = /[?&]title=([^&]+)/.exec(window.location.search);
if (match) {
pageName = decodeURIComponent(match[1].replace(/\+/g, ' '));
} else {
pageName = window.location.pathname.split('/').pop() || '';
}
}
 
pageName = pageName.replace(/_/g, ' ');
if (pageName !== 'Proj') {
return;
return;
}
}
window.location.replace('/index.php?title=Anasayfa&pepuk_projecteur=1&pepuk_time=' + Date.now());
 
window.location.href = '/index.php?title=Anasayfa&pepuk_projecteur=1&pepuk_time=' + nowMs();
}());
}());

05.20, 24 Haziran 2026 tarihindeki hâli

/* Pepuk Cafe Projector Mode */
(function () {
	function getParam(name) {
		var match = new RegExp('[?&]' + name + '=([^&]*)').exec(window.location.search);
		return match ? decodeURIComponent(match[1].replace(/\+/g, ' ')) : null;
	}

	function nowMs() {
		return new Date().getTime();
	}

	function redirectTo(url) {
		window.location.href = url;
	}

	function onReady(fn) {
		if (document.readyState === 'complete' || document.readyState === 'interactive') {
			fn();
			return;
		}
		if (document.addEventListener) {
			document.addEventListener('DOMContentLoaded', fn, false);
		} else if (window.attachEvent) {
			window.attachEvent('onload', fn);
		} else {
			var oldOnload = window.onload;
			window.onload = function () {
				if (oldOnload) {
					oldOnload();
				}
				fn();
			};
		}
	}

	var mode = getParam('pepuk_projecteur');
	var storageKey = 'pepukProjecteur';
	var randomPath = '/index.php/%C3%96zel:Rastgele';
	var rotateDelayMs = 30000;

	if (mode === '1') {
		try {
			localStorage.setItem(storageKey, '1');
		} catch (e) {}
	}

	if (mode === '0') {
		try {
			localStorage.removeItem(storageKey);
		} catch (e) {}
		return;
	}

	var active = false;
	try {
		active = localStorage.getItem(storageKey) === '1';
	} catch (e) {}

	if (!active) {
		return;
	}

	function applyProjectorMode() {
		if (document.getElementById('pepuk-projecteur-style')) {
			return;
		}

		var style = document.createElement('style');
		style.id = 'pepuk-projecteur-style';
		var css = '' +
			'html, body { background: #101418 !important; color: #f4ead7 !important; overflow-x: hidden !important; }' +
			'#mw-panel, #p-logo, #p-personal, #footer, #mw-head, #left-navigation, #right-navigation, .vector-header-container, .vector-page-toolbar, .vector-sticky-header, .mw-editsection, .catlinks, .printfooter, .mw-indicators, .mw-jump, .mw-portlet, .vector-column-end, .page-actions, .mw-footer, .vector-page-tools-landmark { display: none !important; }' +
			'#content, .mw-body, .vector-body, .vector-page-titlebar, .mw-parser-output { margin: 0 !important; max-width: none !important; width: auto !important; }' +
			'#content, .mw-body, .vector-body { background: #f6eddc !important; color: #201a16 !important; padding: 2.4rem 3rem !important; box-sizing: border-box !important; }' +
			'body, #content, .mw-body, .vector-body { font-size: 145% !important; line-height: 1.5 !important; }' +
			'#mw-content-text, .mw-parser-output p, .mw-parser-output li, .mw-parser-output dd, .mw-parser-output blockquote, .mw-parser-output td, .mw-parser-output th { font-size: 1em !important; line-height: 1.55 !important; }' +
			'.mw-page-container, .vector-sitenotice-container, .vector-main-menu-container, .vector-column-start, .vector-column-center, .vector-body-before-content { max-width: none !important; margin: 0 !important; padding: 0 !important; }' +
			'a { color: #7a2d12 !important; }';

		if (style.styleSheet) {
			style.styleSheet.cssText = css;
		} else {
			style.appendChild(document.createTextNode(css));
		}

		var head = document.getElementsByTagName('head')[0] || document.documentElement;
		head.appendChild(style);
	}

	onReady(applyProjectorMode);

	window.setTimeout(function () {
		redirectTo(randomPath + '?pepuk_projecteur=1&pepuk_time=' + nowMs());
	}, rotateDelayMs);
}());

/* Pepuk Projector Shortcut */
(function () {
	function nowMs() {
		return new Date().getTime();
	}

	var pageName = '';
	if (window.mw && mw.config && mw.config.get) {
		pageName = mw.config.get('wgPageName') || '';
	} else {
		var match = /[?&]title=([^&]+)/.exec(window.location.search);
		if (match) {
			pageName = decodeURIComponent(match[1].replace(/\+/g, ' '));
		} else {
			pageName = window.location.pathname.split('/').pop() || '';
		}
	}

	pageName = pageName.replace(/_/g, ' ');
	if (pageName !== 'Proj') {
		return;
	}

	window.location.href = '/index.php?title=Anasayfa&pepuk_projecteur=1&pepuk_time=' + nowMs();
}());