|
|
| 1. satır: |
1. satır: |
| /* 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 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-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);
| |
|
| |
| 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 () {
| |
| redirectTo('/index.php?title=' + encodeURIComponent(nextSlideMap[pageName]) + '&pepuk_time=' + nowMs());
| |
| }, 30000);
| |
| return;
| |
| }
| |
|
| |
| 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();
| |
| }());
| |