|
|
| 1. satır: |
1. satır: |
| /* Pepuk Cafe Projector Mode for Minerva */
| |
| (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 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 pageName = '';
| |
| if (window.mw && mw.config && mw.config.get) {
| |
| pageName = mw.config.get('wgPageName') || '';
| |
| } else {
| |
| var titleMatch = /[?&]title=([^&]+)/.exec(window.location.search);
| |
| if (titleMatch) {
| |
| pageName = decodeURIComponent(titleMatch[1].replace(/\+/g, ' '));
| |
| } else {
| |
| pageName = window.location.pathname.split('/').pop() || '';
| |
| }
| |
| }
| |
| pageName = pageName.replace(/_/g, ' ');
| |
| var isPepukSlide = /^Proj\/[1-5]$/.test(pageName);
| |
| 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 && !isPepukSlide) {
| |
| return;
| |
| }
| |
|
| |
| function applyProjectorMode() {
| |
| if (document.getElementById('pepuk-projecteur-minerva-style')) {
| |
| return;
| |
| }
| |
|
| |
| var style = document.createElement('style');
| |
| style.id = 'pepuk-projecteur-minerva-style';
| |
| var css = '' +
| |
| 'html, body { background: #101418 !important; color: #f4ead7 !important; overflow-x: hidden !important; }' +
| |
| '.minerva-header, .overlay-header, .header-container, .branding-box, .page-actions-menu, .page-actions, .last-modified-bar, .minerva__tab-container, .pre-content, .post-content, .page-heading__actions, .minerva-footer, #mw-mf-page-left, #mw-mf-page-right, .printfooter, .catlinks, .mw-editsection { display: none !important; }' +
| |
| '#content, #bodyContent, .content, .mw-body, .mw-parser-output { margin: 0 !important; max-width: none !important; width: auto !important; }' +
| |
| '#content, #bodyContent, .content, .mw-body { background: #f6eddc !important; color: #201a16 !important; padding: 2rem 2.2rem !important; box-sizing: border-box !important; }' +
| |
| 'body, #content, #bodyContent, .content, .mw-body { font-size: 155% !important; line-height: 1.55 !important; }' +
| |
| '.mw-parser-output p, .mw-parser-output li, .mw-parser-output dd, .mw-parser-output td, .mw-parser-output th, .mw-parser-output blockquote { font-size: 1em !important; line-height: 1.6 !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);
| |
|
| |
| if (isPepukSlide) {
| |
| var nextSlideMap = {
| |
| 'Proj/1': 'Proj/2',
| |
| 'Proj/2': 'Proj/3',
| |
| 'Proj/3': 'Proj/4',
| |
| 'Proj/4': 'Proj/5',
| |
| 'Proj/5': 'Proj/1'
| |
| };
| |
| window.setTimeout(function () {
| |
| window.location.href = '/index.php?title=' + encodeURIComponent(nextSlideMap[pageName]) + '&pepuk_time=' + nowMs();
| |
| }, 30000);
| |
| return;
| |
| }
| |
|
| |
| window.setTimeout(function () {
| |
| window.location.href = randomPath + '?pepuk_projecteur=1&pepuk_time=' + nowMs();
| |
| }, rotateDelayMs);
| |
| }());
| |