1/*! instant.page v5.1.0 - (C) 2019-2020 Alexandre Dieulot - https://instant.page/license */ 2let t,e;const n=new Set,o=document.createElement("link"),i=o.relList&&o.relList.supports&&o.relList.supports("prefetch")&&window.IntersectionObserver&&"isIntersecting"in IntersectionObserverEntry.prototype,s="instantAllowQueryString"in document.body.dataset,a="instantAllowExternalLinks"in document.body.dataset,r="instantWhitelist"in document.body.dataset,c="instantMousedownShortcut"in document.body.dataset,d=1111;let l=65,u=!1,f=!1,m=!1;if("instantIntensity"in document.body.dataset){const t=document.body.dataset.instantIntensity;if("mousedown"==t.substr(0,"mousedown".length))u=!0,"mousedown-only"==t&&(f=!0);else if("viewport"==t.substr(0,"viewport".length))navigator.connection&&(navigator.connection.saveData||navigator.connection.effectiveType&&navigator.connection.effectiveType.includes("2g"))||("viewport"==t?document.documentElement.clientWidth*document.documentElement.clientHeight<45e4&&(m=!0):"viewport-all"==t&&(m=!0));else{const e=parseInt(t);isNaN(e)||(l=e)}}if(i){const n={capture:!0,passive:!0};if(f||document.addEventListener("touchstart",function(t){e=performance.now();const n=t.target.closest("a");if(!h(n))return;v(n.href)},n),u?c||document.addEventListener("mousedown",function(t){const e=t.target.closest("a");if(!h(e))return;v(e.href)},n):document.addEventListener("mouseover",function(n){if(performance.now()-e<d)return;const o=n.target.closest("a");if(!h(o))return;o.addEventListener("mouseout",p,{passive:!0}),t=setTimeout(()=>{v(o.href),t=void 0},l)},n),c&&document.addEventListener("mousedown",function(t){if(performance.now()-e<d)return;const n=t.target.closest("a");if(t.which>1||t.metaKey||t.ctrlKey)return;if(!n)return;n.addEventListener("click",function(t){1337!=t.detail&&t.preventDefault()},{capture:!0,passive:!1,once:!0});const o=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!1,detail:1337});n.dispatchEvent(o)},n),m){let t;(t=window.requestIdleCallback?t=>{requestIdleCallback(t,{timeout:1500})}:t=>{t()})(()=>{const t=new IntersectionObserver(e=>{e.forEach(e=>{if(e.isIntersecting){const n=e.target;t.unobserve(n),v(n.href)}})});document.querySelectorAll("a").forEach(e=>{h(e)&&t.observe(e)})})}}function p(e){e.relatedTarget&&e.target.closest("a")==e.relatedTarget.closest("a")||t&&(clearTimeout(t),t=void 0)}function h(t){if(t&&t.href&&(!r||"instant"in t.dataset)&&(a||t.origin==location.origin||"instant"in t.dataset)&&["http:","https:"].includes(t.protocol)&&("http:"!=t.protocol||"https:"!=location.protocol)&&(s||!t.search||"instant"in t.dataset)&&!(t.hash&&t.pathname+t.search==location.pathname+location.search||"noInstant"in t.dataset))return!0}function v(t){if(n.has(t))return;const e=document.createElement("link");e.rel="prefetch",e.href=t,document.head.appendChild(e),n.add(t)} 3 4/* 5 * Pjax 6**/ 7(function (f) { if (typeof exports === "object" && typeof module !== "undefined") { module.exports = f() } else if (typeof define === "function" && define.amd) { define([], f) } else { var g; if (typeof window !== "undefined") { g = window } else if (typeof global !== "undefined") { g = global } else if (typeof self !== "undefined") { g = self } else { g = this } g.Pjax = f() } })(function () { var define, module, exports; return function () { function r(e, n, t) { function o(i, f) { if (!n[i]) { if (!e[i]) { var c = "function" == typeof require && require; if (!f && c) return c(i, !0); if (u) return u(i, !0); var a = new Error("Cannot find module '" + i + "'"); throw a.code = "MODULE_NOT_FOUND", a } var p = n[i] = { exports: {} }; e[i][0].call(p.exports, function (r) { var n = e[i][1][r]; return o(n || r) }, p, p.exports, r, e, n, t) } return n[i].exports } for (var u = "function" == typeof require && require, i = 0; i < t.length; i++)o(t[i]); return o } return r }()({ 1: [function (require, module, exports) { var executeScripts = require("./lib/execute-scripts"); var forEachEls = require("./lib/foreach-els"); var parseOptions = require("./lib/parse-options"); var switches = require("./lib/switches"); var newUid = require("./lib/uniqueid"); var on = require("./lib/events/on"); var trigger = require("./lib/events/trigger"); var clone = require("./lib/util/clone"); var contains = require("./lib/util/contains"); var extend = require("./lib/util/extend"); var noop = require("./lib/util/noop"); var Pjax = function (options) { this.state = { numPendingSwitches: 0, href: null, options: null }; this.options = parseOptions(options); this.log("Pjax options", this.options); if (this.options.scrollRestoration && "scrollRestoration" in history) { history.scrollRestoration = "manual" } this.maxUid = this.lastUid = newUid(); this.parseDOM(document); on(window, "popstate", function (st) { if (st.state) { var opt = clone(this.options); opt.url = st.state.url;
vendor: 21,539 bytes, line 7
7 opt.title = st.state.title; opt.history = false; opt.scrollPos = st.state.scrollPos; if (st.state.uid < this.lastUid) { opt.backward = true } else { opt.forward = true } this.lastUid = st.state.uid; this.loadUrl(st.state.url, opt) } }.bind(this)) }; Pjax.switches = switches; Pjax.prototype = { log: require("./lib/proto/log"), getElements: function (el) { return el.querySelectorAll(this.options.elements) }, parseDOM: function (el) { var parseElement = require("./lib/proto/parse-element"); forEachEls(this.getElements(el), parseElement, this) }, refresh: function (el) { this.parseDOM(el || document) }, reload: function () { window.location.reload() }, attachLink: require("./lib/proto/attach-link"), attachForm: require("./lib/proto/attach-form"), forEachSelectors: function (cb, context, DOMcontext) { return require("./lib/foreach-selectors").bind(this)(this.options.selectors, cb, context, DOMcontext) }, switchSelectors: function (selectors, fromEl, toEl, options) { return require("./lib/switches-selectors").bind(this)(this.options.switches, this.options.switchesOptions, selectors, fromEl, toEl, options) }, latestChance: function (href) { window.location = href }, onSwitch: function () { trigger(window, "resize scroll"); this.state.numPendingSwitches--; if (this.state.numPendingSwitches === 0) { this.afterAllSwitches() } }, loadContent: function (html, options) { if (typeof html !== "string") { trigger(document, "pjax:complete pjax:error", options); return } var tmpEl = document.implementation.createHTMLDocument("pjax"); var htmlRegex = /<html[^>]+>/gi; var htmlAttribsRegex = /\s?[a-z:]+(?:=['"][^'">]+['"])*/gi; var matches = html.match(htmlRegex); if (matches && matches.length) { matches = matches[0].match(htmlAttribsRegex); if (matches.length) { matches.shift(); matches.forEach(function (htmlAttrib) { var attr = htmlAttrib.trim().split("="); if (attr.length === 1) { tmpEl.documentElement.setAttribute(attr[0], true) } else { tmpEl.documentElement.setAttribute(attr[0], attr[1].slice(1, -1)) } }) } } tmpEl.documentElement.innerHTML = html; this.log("load content", tmpEl.documentElement.attributes, tmpEl.documentElement.innerHTML.length); if (document.activeElement && contains(document, this.options.selectors, document.activeElement)) { try { document.activeElement.blur() } catch (e) { } } this.switchSelectors(this.options.selectors, tmpEl, document, options) }, abortRequest: require("./lib/abort-request"), doRequest: require("./lib/send-request"), handleResponse: require("./lib/proto/handle-response"), loadUrl: function (href, options) { options = typeof options === "object" ? extend({}, this.options, options) : clone(this.options); this.log("load href", href, options); this.abortRequest(this.request); trigger(document, "pjax:send", options); this.request = this.doRequest(href, options, this.handleResponse.bind(this)) }, afterAllSwitches: function () { var autofocusEl = Array.prototype.slice.call(document.querySelectorAll("[autofocus]")).pop(); if (autofocusEl && document.activeElement !== autofocusEl) { autofocusEl.focus() } this.options.selectors.forEach(function (selector) { forEachEls(document.querySelectorAll(selector), function (el) { executeScripts(el) }) }); var state = this.state; if (state.options.history) { if (!window.history.state) { this.lastUid = this.maxUid = newUid(); window.history.replaceState({ url: window.location.href, title: document.title, uid: this.maxUid, scrollPos: [0, 0] }, document.title) } this.lastUid = this.maxUid = newUid(); window.history.pushState({ url: state.href, title: state.options.title, uid: this.maxUid, scrollPos: [0, 0] }, state.options.title, state.href) } this.forEachSelectors(function (el) { this.parseDOM(el) }, this); trigger(document, "pjax:complete pjax:success", state.options); if (typeof state.options.analytics === "function") { state.options.analytics() } if (state.options.history) { var a = document.createElement("a"); a.href = this.state.href; if (a.hash) { var name = a.hash.slice(1); name = decodeURIComponent(name); var curtop = 0; var target = document.getElementById(name) || document.getElementsByName(name)[0]; if (target) { if (target.offsetParent) { do { curtop += target.offsetTop; target = target.offsetParent } while (target) } } window.scrollTo(0, curtop) } else if (state.options.scrollTo !== false) { if (state.options.scrollTo.length > 1) { window.scrollTo(state.options.scrollTo[0], state.options.scrollTo[1]) } else { window.scrollTo(0, state.options.scrollTo) } } } else if (state.options.scrollRestoration && state.options.scrollPos) { window.scrollTo(state.options.scrollPos[0], state.options.scrollPos[1]) } this.state = { numPendingSwitches: 0, href: null, options: null } } }; Pjax.isSupported = require("./lib/is-supported"); if (Pjax.isSupported()) { module.exports = Pjax } else { var stupidPjax = noop; for (var key in Pjax.prototype) { if (Pjax.prototype.hasOwnProperty(key) && typeof Pjax.prototype[key] === "function") { stupidPjax[key] = noop } } module.exports = stupidPjax } }, { "./lib/abort-request": 2, "./lib/events/on": 4, "./lib/events/trigger": 5, "./lib/execute-scripts": 6, "./lib/foreach-els": 7, "./lib/foreach-selectors": 8, "./lib/is-supported": 9, "./lib/parse-options": 10, "./lib/proto/attach-form": 11, "./lib/proto/attach-link": 12, "./lib/proto/handle-response": 13, "./lib/proto/log": 14, "./lib/proto/parse-element": 15, "./lib/send-request": 16, "./lib/switches": 18, "./lib/switches-selectors": 17, "./lib/uniqueid": 19, "./lib/util/clone": 20, "./lib/util/contains": 21, "./lib/util/extend": 22, "./lib/util/noop": 23 }], 2: [function (require, module, exports) { var noop = require("./util/noop"); module.exports = function (request) { if (request && request.readyState < 4) { request.onreadystatechange = noop; request.abort() } } }, { "./util/noop": 23 }], 3: [function (require, module, exports) { module.exports = function (el) { var code = el.text || el.textContent || el.innerHTML || ""; var src = el.src || ""; var parent = el.parentNode || document.querySelector("head") || document.documentElement; var script = document.createElement("script"); if (code.match("document.write")) { if (console && console.log) { console.log("Script contains document.write. Canât be executed correctly. Code skipped ", el) } return false } script.type = "text/javascript"; script.id = el.id; if (src !== "") { script.src = src; script.async = false } if (code !== "") { try { script.appendChild(document.createTextNode(code)) } catch (e) { script.text = code } } parent.appendChild(script); if ((parent instanceof HTMLHeadElement || parent instanceof HTMLBodyElement) && parent.contains(script)) { parent.removeChild(script) } return true } }, {}], 4: [function (require, module, exports) { var forEachEls = require("../foreach-els"); module.exports = function (els, events, listener, useCapture) { events = typeof events === "string" ? events.split(" ") : events; events.forEach(function (e) { forEachEls(els, function (el) { el.addEventListener(e, listener, useCapture) }) }) } }, { "../foreach-els": 7 }], 5: [function (require, module, exports) { var forEachEls = require("../foreach-els"); module.exports = function (els, events, opts) { events = typeof events === "string" ? events.split(" ") : events; events.forEach(function (e) { var event; event = document.createEvent("HTMLEvents"); event.initEvent(e, true, true); event.eventName = e; if (opts) { Object.keys(opts).forEach(function (key) { event[key] = opts[key] }) } forEachEls(els, function (el) { var domFix = false; if (!el.parentNode && el !== document && el !== window) { domFix = true; document.body.appendChild(el) } el.dispatchEvent(event); if (domFix) { el.parentNode.removeChild(el) } }) }) } }, { "../foreach-els": 7 }], 6: [function (require, module, exports) { var forEachEls = require("./foreach-els"); var evalScript = require("./eval-script"); module.exports = function (el) { if (el.tagName.toLowerCase() === "script") { evalScript(el) } forEachEls(el.querySelectorAll("script"), function (script) { if (!script.type || script.type.toLowerCase() === "text/javascript") { if (script.parentNode) { script.parentNode.removeChild(script) } evalScript(script) } }) } }, { "./eval-script": 3, "./foreach-els": 7 }], 7: [function (require, module, exports) { module.exports = function (els, fn, context) { if (els instanceof HTMLCollection || els instanceof NodeList || els instanceof Array) { return Array.prototype.forEach.call(els, fn, context) } return fn.call(context, els) } }, {}], 8: [function (require, module, exports) { var forEachEls = require("./foreach-els"); module.exports = function (selectors, cb, context, DOMcontext) { DOMcontext = DOMcontext || document; selectors.forEach(function (selector) { forEachEls(DOMcontext.querySelectorAll(selector), cb, context) }) } }, { "./foreach-els": 7 }], 9: [function (require, module, exports) { module.exports = function () { return window.history && window.history.pushState && window.history.replaceState && !navigator.userAgent.match(/((iPod|iPhone|iPad).+\bOS\s+[1-4]\D|WebApps\/.+CFNetwork)/) } }, {}], 10: [function (require, module, exports) { var defaultSwitches = require("./switches"); module.exports = function (options) { options = options || {}; options.elements = options.elements || "a[href], form[action]"; options.selectors = options.selectors || ["title", ".js-Pjax"]; options.switches = options.switches || {}; options.switchesOptions = options.switchesOptions || {}; options.history = typeof options.history === "undefined" ? true : options.history; options.analytics = typeof options.analytics === "function" || options.analytics === false ? options.analytics : defaultAnalytics; options.scrollTo = typeof options.scrollTo === "undefined" ? 0 : options.scrollTo; options.scrollRestoration = typeof options.scrollRestoration !== "undefined" ? options.scrollRestoration : true; options.cacheBust = typeof options.cacheBust === "undefined" ? true : options.cacheBust; options.debug = options.debug || false; options.timeout = options.timeout || 0; options.currentUrlFullReload = typeof options.currentUrlFullReload === "undefined" ? false : options.currentUrlFullReload; if (!options.switches.head) { options.switches.head = defaultSwitches.switchElementsAlt } if (!options.switches.body) { options.switches.body = defaultSwitches.switchElementsAlt } return options }; function defaultAnalytics() { if (window._gaq) { _gaq.push(["_trackPageview"]) } if (window.ga) { ga("send", "pageview", { page: location.pathname, title: document.title }) } } }, { "./switches": 18 }], 11: [function (require, module, exports) { var on = require("../events/on"); var clone = require("../util/clone"); var attrState = "data-pjax-state"; var formAction = function (el, event) { if (isDefaultPrevented(event)) { return } var options = clone(this.options); options.requestOptions = { requestUrl: el.getAttribute("action") || window.location.href, requestMethod: el.getAttribute("method") || "GET" }; var virtLinkElement = document.createElement("a"); virtLinkElement.setAttribute("href", options.requestOptions.requestUrl); var attrValue = checkIfShouldAbort(virtLinkElement, options); if (attrValue) { el.setAttribute(attrState, attrValue); return } event.preventDefault(); if (el.enctype === "multipart/form-data") { options.requestOptions.formData = new FormData(el) } else { options.requestOptions.requestParams = parseFormElements(el) } el.setAttribute(attrState, "submit"); options.triggerElement = el; this.loadUrl(virtLinkElement.href, options) }; function parseFormElements(el) { var requestParams = []; var formElements = el.elements; for (var i = 0; i < formElements.length; i++) { var element = formElements[i]; var tagName = element.tagName.toLowerCase(); if (!!element.name && element.attributes !== undefined && tagName !== "button") { var type = element.attributes.type; if (!type || type.value !== "checkbox" && type.value !== "radio" || element.checked) { var values = []; if (tagName === "select") { var opt; for (var j = 0; j < element.options.length; j++) { opt = element.options[j]; if (opt.selected && !opt.disabled) { values.push(opt.hasAttribute("value") ? opt.value : opt.text) } } } else { values.push(element.value) } for (var k = 0; k < values.length; k++) { requestParams.push({ name: encodeURIComponent(element.name), value: encodeURIComponent(values[k]) }) } } } } return requestParams } function checkIfShouldAbort(virtLinkElement, options) { if (virtLinkElement.protocol !== window.location.protocol || virtLinkElement.host !== window.location.host) { return "external" } if (virtLinkElement.hash && virtLinkElement.href.replace(virtLinkElement.hash, "") === window.location.href.replace(location.hash, "")) { return "anchor" } if (virtLinkElement.href === window.location.href.split("#")[0] + "#") { return "anchor-empty" } if (options.currentUrlFullReload && virtLinkElement.href === window.location.href.split("#")[0]) { return "reload" } } var isDefaultPrevented = function (event) { return event.defaultPrevented || event.returnValue === false }; module.exports = function (el) { var that = this; el.setAttribute(attrState, ""); on(el, "submit", function (event) { formAction.call(that, el, event) }) } }, { "../events/on": 4, "../util/clone": 20 }], 12: [function (require, module, exports) { var on = require("../events/on"); var clone = require("../util/clone"); var attrState = "data-pjax-state"; var linkAction = function (el, event) { if (isDefaultPrevented(event)) { return } var options = clone(this.options); var attrValue = checkIfShouldAbort(el, event); if (attrValue) { el.setAttribute(attrState, attrValue); return } event.preventDefault(); if (this.options.currentUrlFullReload && el.href === window.location.href.split("#")[0]) { el.setAttribute(attrState, "reload"); this.reload(); return } el.setAttribute(attrState, "load"); options.triggerElement = el; this.loadUrl(el.href, options) }; function checkIfShouldAbort(el, event) { if (event.which > 1 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) { return "modifier" } if (el.protocol !== window.location.protocol || el.host !== window.location.host) { return "external" } if (el.hash && el.href.replace(el.hash, "") === window.location.href.replace(location.hash, "")) { return "anchor" } if (el.href === window.location.href.split("#")[0] + "#") { return "anchor-empty" } } var isDefaultPrevented = function (event) { return event.defaultPrevented || event.returnValue === false }; module.exports = function (el) { var that = this; el.setAttribute(attrState, ""); on(el, "click", function (event) { linkAction.call(that, el, event) }); on(el, "keyup", function (event) { if (event.keyCode === 13) { linkAction.call(that, el, event) } }.bind(this)) } }, { "../events/on": 4, "../util/clone": 20 }], 13: [function (require, module, exports) { var clone = require("../util/clone"); var newUid = require("../uniqueid"); var trigger = require("../events/trigger"); module.exports = function (responseText, request, href, options) { options = clone(options || this.options); options.request = request; if (responseText === false) { trigger(document, "pjax:complete pjax:error", options); return } var currentState = window.history.state || {}; window.history.replaceState({ url: currentState.url || window.location.href, title: currentState.title || document.title, uid: currentState.uid || newUid(), scrollPos: [document.documentElement.scrollLeft || document.body.scrollLeft, document.documentElement.scrollTop || document.body.scrollTop] }, document.title, window.location.href); var oldHref = href; if (request.responseURL) { if (href !== request.responseURL) { href = request.responseURL } } else if (request.getResponseHeader("X-PJAX-URL")) { href = request.getResponseHeader("X-PJAX-URL") } else if (request.getResponseHeader("X-XHR-Redirected-To")) { href = request.getResponseHeader("X-XHR-Redirected-To") } var a = document.createElement("a"); a.href = oldHref; var oldHash = a.hash; a.href = href; if (oldHash && !a.hash) { a.hash = oldHash; href = a.href } this.state.href = href; this.state.options = options; try { this.loadContent(responseText, options) } catch (e) { trigger(document, "pjax:error", options); if (!this.options.debug) { if (console && console.error) { console.error("Pjax switch fail: ", e) } return this.latestChance(href) } else { throw e } } } }, { "../events/trigger": 5, "../uniqueid": 19, "../util/clone": 20 }], 14: [function (require, module, exports) { module.exports = function () { if (this.options.debug && console) { if (typeof console.log === "function") { console.log.apply(console, arguments) } else if (console.log) { console.log(arguments) } } } }, {}], 15: [function (require, module, exports) { var attrState = "data-pjax-state"; module.exports = function (el) { switch (el.tagName.toLowerCase()) { case "a": if (!el.hasAttribute(attrState)) { this.attachLink(el) } break; case "form": if (!el.hasAttribute(attrState)) { this.attachForm(el) } break; default: throw "Pjax can only be applied on <a> or <form> submit" } } }, {}], 16: [function (require, module, exports) { var updateQueryString = require("./util/update-query-string"); module.exports = function (location, options, callback) { options = options || {}; var queryString; var requestOptions = options.requestOptions || {}; var requestMethod = (requestOptions.requestMethod || "GET").toUpperCase(); var requestParams = requestOptions.requestParams || null; var formData = requestOptions.formData || null; var requestPayload = null; var request = new XMLHttpRequest; var timeout = options.timeout || 0; request.onreadystatechange = function () { if (request.readyState === 4) { if (request.status === 200) { callback(request.responseText, request, location, options) } else if (request.status !== 0) { callback(null, request, location, options) } } }; request.onerror = function (e) { console.log(e); callback(null, request, location, options) }; request.ontimeout = function () { callback(null, request, location, options) }; if (requestParams && requestParams.length) { queryString = requestParams.map(function (param) { return param.name + "=" + param.value }).join("&"); switch (requestMethod) { case "GET": location = location.split("?")[0]; location += "?" + queryString; break; case "POST": requestPayload = queryString; break } } else if (formData) { requestPayload = formData } if (options.cacheBust) { location = updateQueryString(location, "t", Date.now()) } request.open(requestMethod, location, true); request.timeout = timeout; request.setRequestHeader("X-Requested-With", "XMLHttpRequest"); request.setRequestHeader("X-PJAX", "true"); request.setRequestHeader("X-PJAX-Selectors", JSON.stringify(options.selectors)); if (requestPayload && requestMethod === "POST" && !formData) { request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded") } request.send(requestPayload); return request } }, { "./util/update-query-string": 24 }], 17: [function (require, module, exports) { var forEachEls = require("./foreach-els"); var defaultSwitches = require("./switches"); module.exports = function (switches, switchesOptions, selectors, fromEl, toEl, options) { var switchesQueue = []; selectors.forEach(function (selector) { var newEls = fromEl.querySelectorAll(selector); var oldEls = toEl.querySelectorAll(selector); if (this.log) { this.log("Pjax switch", selector, newEls, oldEls) } if (newEls.length !== oldEls.length) { throw "DOM doesnât look the same on new loaded page: â" + selector + "â - new " + newEls.length + ", old " + oldEls.length } forEachEls(newEls, function (newEl, i) { var oldEl = oldEls[i]; if (this.log) { this.log("newEl", newEl, "oldEl", oldEl) } var callback = switches[selector] ? switches[selector].bind(this, oldEl, newEl, options, switchesOptions[selector]) : defaultSwitches.outerHTML.bind(this, oldEl, newEl, options); switchesQueue.push(callback) }, this) }, this); this.state.numPendingSwitches = switchesQueue.length; switchesQueue.forEach(function (queuedSwitch) { queuedSwitch() }) } }, { "./foreach-els": 7, "./switches": 18 }], 18: [function (require, module, exports) { var on = require("./events/on"); module.exports = { outerHTML: function (oldEl, newEl) { oldEl.outerHTML = newEl.outerHTML; this.onSwitch() }, innerHTML: function (oldEl, newEl) { oldEl.innerHTML = newEl.innerHTML; if (newEl.className === "") { oldEl.removeAttribute("class") } else { oldEl.className = newEl.className } this.onSwitch() }, switchElementsAlt: function (oldEl, newEl) { oldEl.innerHTML = newEl.innerHTML; if (newEl.hasAttributes()) { var attrs = newEl.attributes; for (var i = 0; i < attrs.length; i++) { oldEl.attributes.setNamedItem(attrs[i].cloneNode()) } } this.onSwitch() }, replaceNode: function (oldEl, newEl) { oldEl.parentNode.replaceChild(newEl, oldEl); this.onSwitch() }, sideBySide: function (oldEl, newEl, options, switchOptions) { var forEach = Array.prototype.forEach; var elsToRemove = []; var elsToAdd = []; var fragToAppend = document.createDocumentFragment(); var animationEventNames = "animationend webkitAnimationEnd MSAnimationEnd oanimationend"; var animatedElsNumber = 0; var sexyAnimationEnd = function (e) { if (e.target !== e.currentTarget) { return } animatedElsNumber--; if (animatedElsNumber <= 0 && elsToRemove) { elsToRemove.forEach(function (el) { if (el.parentNode) { el.parentNode.removeChild(el) } }); elsToAdd.forEach(function (el) { el.className = el.className.replace(el.getAttribute("data-pjax-classe
7s"), ""); el.removeAttribute("data-pjax-classes") }); elsToAdd = null; elsToRemove = null; this.onSwitch() } }.bind(this); switchOptions = switchOptions || {}; forEach.call(oldEl.childNodes, function (el) { elsToRemove.push(el); if (el.classList && !el.classList.contains("js-Pjax-remove")) { if (el.hasAttribute("data-pjax-classes")) { el.className = el.className.replace(el.getAttribute("data-pjax-classes"), ""); el.removeAttribute("data-pjax-classes") } el.classList.add("js-Pjax-remove"); if (switchOptions.callbacks && switchOptions.callbacks.removeElement) { switchOptions.callbacks.removeElement(el) } if (switchOptions.classNames) { el.className += " " + switchOptions.classNames.remove + " " + (options.backward ? switchOptions.classNames.backward : switchOptions.classNames.forward) } animatedElsNumber++; on(el, animationEventNames, sexyAnimationEnd, true) } }); forEach.call(newEl.childNodes, function (el) { if (el.classList) { var addClasses = ""; if (switchOptions.classNames) { addClasses = " js-Pjax-add " + switchOptions.classNames.add + " " + (options.backward ? switchOptions.classNames.forward : switchOptions.classNames.backward) } if (switchOptions.callbacks && switchOptions.callbacks.addElement) { switchOptions.callbacks.addElement(el) } el.className += addClasses; el.setAttribute("data-pjax-classes", addClasses); elsToAdd.push(el); fragToAppend.appendChild(el); animatedElsNumber++; on(el, animationEventNames, sexyAnimationEnd, true) } }); oldEl.className = newEl.className; oldEl.appendChild(fragToAppend) } } }, { "./events/on": 4 }], 19: [function (require, module, exports) { module.exports = function () { var counter = 0; return function () { var id = "pjax" + (new Date).getTime() + "_" + counter; counter++; return id } }() }, {}], 20: [function (require, module, exports) { module.exports = function (obj) { if (null === obj || "object" !== typeof obj) { return obj } var copy = obj.constructor(); for (var attr in obj) { if (obj.hasOwnProperty(attr)) { copy[attr] = obj[attr] } } return copy } }, {}], 21: [function (require, module, exports) { module.exports = function contains(doc, selectors, el) { for (var i = 0; i < selectors.length; i++) { var selectedEls = doc.querySelectorAll(selectors[i]); for (var j = 0; j < selectedEls.length; j++) { if (selectedEls[j].contains(el)) { return true } } } return false } }, {}], 22: [function (require, module, exports) { module.exports = function (target) { if (target == null) { return null } var to = Object(target); for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; if (source != null) { for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { to[key] = source[key] } } } } return to } }, {}], 23: [function (require, module, exports) { module.exports = function () { } }, {}], 24: [function (require, module, exports) { module.exports = function (uri, key, value) { var re = new RegExp("([?&])" + key + "=.*?(&|$)", "i"); var separator = uri.indexOf("?") !== -1 ? "&" : "?"; if (uri.match(re)) { return uri.replace(re, "$1" + key + "=" + value + "$2") } else { return uri + separator + key + "=" + value } } }, {}] }, {}, [1])(1) }); 8 9const wwsivGlobals = {}; 10 11(function () { 12 let virgin = false; 13 let podloveInstances = {}; 14 let activeInstance = null; 15 let startPos = null; 16 let activeTab = null; 17 let crashStarted = false; 18 const playerToggleShow = document.querySelector('.overlay-player__toggle--show'); 19 20 const initPlayers = function () { 21 const players = document.querySelectorAll('.pwp4-wrapper[data-episode]'); 22 23 if (players) { 24 25 // reset tab info in localStorage to start with no opened tab 26 Object.entries(localStorage).forEach(function (data) { 27 let key = data[0]; 28 if (/^pwp-/.test(key)) { 29 let value = JSON.parse(data[1]); 30 Object.entries(value.tabs).forEach(function (tabData) { 31 value.tabs[tabData[0]] = false 32 }); 33 localStorage.setItem(key, JSON.stringify(value)); 34 } 35 }) 36 37 players.forEach(function (player) { 38 let config = player.dataset.episode; 39 let parent = player.parentElement; 40 let playBtn = document.createElement('a'); 41 let episodeTitle = (parent.querySelector('.episode__headline') || parent.querySelector('.neon__blue') || { textContent: '' }).textContent; 42 let onHome = document.body.classList.contains('home'); 43 let inJumbotron = parent.parentElement.classList.contains('jumbotron'); 44 let label = onHome && inJumbotron ? 'Anhören' : '<i class="play-icon"></i> Abspielen'; 45 let instanceUrl = config.split('?')[0]; 46
47 if (onHome && inJumbotron) { 48 playBtn.setAttribute('aria-label', 'Neueste Episode anhören'); 49 playBtn.title = 'Neueste Episode anhören'; 50 } 51 52 playBtn.className = 'btn btn-' + (inJumbotron && onHome ? 'invisible' : 'primary') + (inJumbotron ? '' : ' btn-sm'); 53 playBtn.href = '#show-player'; 54 playBtn.innerHTML = "<span class=\"sr-only\">" + episodeTitle + "</span>\n" + label; 55 playBtn.addEventListener('click', function () { 56 let playerInstance = podloveInstances[instanceUrl]; 57 58 if (playerInstance === '__loading__') { 59 return; 60 } 61 62 // player instance for this episode does not exist yet: create it 63 if (!playerInstance) { 64 podloveInstances[instanceUrl] = '__loading__'; 65 let wrapper = document.querySelector('.overlay-player__slot') 66 // pause all other instances 67 Object.keys(podloveInstances).forEach(function (key) { 68 let instance = podloveInstances[key]; 69 if (instance !== '__loading__') { 70 instance.wrapper.classList.remove('is-active'); 71 instance.store.dispatch({ 72 type: "PLAYER_REQUEST_PAUSE" 73 }); 74 } 75 }); 76 77 window.fetch(config).then(function (data) { 78 return data.json(); 79 }).then(function (configObj) { 80 configObj.tabs = { 81 "audio": false, 82 "chapters": false, 83 "files": false, 84 "info": false, 85 "share": false, 86 "transcripts": false, 87 "null": true 88 }; 89 podlovePlayer('.overlay-player__slot', configObj).then(function (store) { 90 let playerDoc = wrapper.querySelector('iframe').contentDocument; 91 let head = playerDoc.getElementsByTagName('head')[0]; 92 let link = playerDoc.createElement('link'); 93 link.rel = 'stylesheet'; 94 link.type = 'text/css'; 95 link.href = WP_CONFIG.templateUrl + '/player.css'; 96 link.media = 'all'; 97 head.appendChild(link); 98 99 activeInstance = playerInstance = podloveInstances[instanceUrl] = { 100 store: store, 101 wrapper: wrapper 102 }; 103 104 playerInstance.store.subscribe(function () { 105 const lastState = store.getState(); 106 const lastAction = lastState.lastAction; 107 const isActive = playerInstance === activeInstance; 108 109 switch (lastAction.type) { 110 case 'PLAYER_BACKEND_PAUSE': 111 if (isActive) { 112 playerToggleShow.classList.remove('is-playing'); 113 } 114 break; 115 case 'PLAYER_BACKEND_PLAY': 116 playerToggleShow.classList.add('is-playing'); 117 if (startPos) { 118 activeInstance.store.dispatch({ 119 "type": "PLAYER_REQUEST_PLAYTIME", 120 "payload": startPos * 1000 121 }); 122 } 123 startPos = null; 124 break; 125 case 'PLAYER_BACKEND_LOADING_END': 126 if (isActive && lastAction.payload.ended) { 127 playerInstance.store.dispatch({ 128 type: "PLAYER_REQUEST_RESTART" 129 }); 130 } 131 break; 132 case 'PLAYER_TOGGLE_TAB': 133 if (isActive && lastState.driver.playing) { 134 // all tabs closed 135 if (lastAction.payload === activeTab) { 136 activeTab = null; 137 // tab changed 138 } else { 139 activeTab = lastAction.payload; 140 } 141 // console.log(`active tab has been changed to ${activeTab}`); 142 } 143 break; 144 case 'PLAYER_BACKEND_PLAYTIME': 145 if (!crashStarted) { 146 var secondsLeftMin = null; 147 var secondsLeftMax = null; 148 var secondsLeft = ((lastState.timepiece.duration - lastState.timepiece.playtime) / 1000).toFixed(2); 149 switch(lastState.episode.title) { 150 case 'Stapelüberfluss': 151 secondsLeftMin = 3.8; 152 secondsLeftMax = 4.8; 153 break; 154 case 'Die Chinesen haben das Klima erfunden': 155 secondsLeftMin = 8.2; 156 secondsLeftMax = 9.2; 157 break; 158 case 'CCC: Corona, Cloud und Chaos': 159 secondsLeftMin = 2.2; 160 secondsLeftMax = 3.2; 161 break; 162 case 'Special: Gekommen um zu bleiben!': 163 secondsLeftMin = 2.5; 164 secondsLeftMax = 3.5; 165 break; 166 default: 167 secondsLeftMin = 2.1; 168 secondsLeftMax = 3; 169 // console.log('test', lastState.episode, secondsLeft); 170 break; 171 } 172 if (secondsLeftMin && secondsLeftMax) { 173 if (secondsLeft <= secondsLeftMax && secondsLeft >= secondsLeftMin) { 174 crashItBaby(); 175 } 176 } 177 } 178 break; 179 // default: 180 // console.log(lastAction.type); 181 } 182 }); 183 store.dispatch({ 184 type: "PLAYER_REQUEST_PLAY" 185 }); 186 if (activeTab) { 187 store.dispatch({ 188 type: "PLAYER_TOGGLE_TAB", 189 payload: activeTab 190 }); 191 } 192 }); 193 wrapper.classList.replace('overlay-player__slot', 'overlay-player__wrapper'); 194 wrapper.classList.add('is-active'); 195 let newSlot = document.createElement('div'); 196 newSlot.className = 'overlay-player__slot';
197 document.getElementById('show-player').appendChild(newSlot); 198 }).catch(function (e) { 199 throw e; 200 }); 201 // player instance for this episode exists: resume 202 } else { 203 // resume this instance and pause all others 204 Object.keys(podloveInstances).forEach(function (key) { 205 let instance = podloveInstances[key]; 206 let isCurrent = instance === playerInstance; 207 208 // this is the instance we're looking for 209 if (isCurrent) { 210 let lastAction = instance.store.getState().lastAction; 211 // instance is not active yet: activate and play 212 if (!instance.wrapper.classList.contains('is-active')) { 213 instance.store.dispatch({ 214 type: "PLAYER_REQUEST_PLAY" 215 }); 216 217 let tabStatus = instance.store.getState().tabs; 218 // console.log(tabStatus); 219 // console.log(activeTab, tabStatus[activeTab]); 220 if (!activeTab) { 221 let instanceActiveTab = Object.keys(tabStatus).filter(function (key) { 222 return tabStatus[key]; 223 })[0]; 224 // console.log(`instance active tab is ${instanceActiveTab} and should be closed`); 225 instance.store.dispatch({ 226 type: "PLAYER_TOGGLE_TAB", 227 payload: instanceActiveTab 228 }); 229 } else if (!tabStatus[activeTab]) { 230 // console.log(`should set active tab to ${activeTab}`); 231 instance.store.dispatch({ 232 type: "PLAYER_TOGGLE_TAB", 233 payload: activeTab 234 }); 235 } 236 // if (!tabStatus[activeTab || "null"] || !activeTab) { 237 // console.log(`should set active tab to ${activeTab || "null"}`); 238 // instance.store.dispatch({ 239 // type: "PLAYER_TOGGLE_TAB", 240 // payload: activeTab || "null" 241 // }); 242 // } 243 instance.wrapper.classList.add('is-active'); 244 // instance is active but has ended: restart 245 } else if (lastAction.type === 'PLAYER_SHOW_COMPONENT_CONTROLS_BUTTON_REPLAY') { 246 instance.store.dispatch({ 247 type: "PLAYER_REQUEST_RESTART" 248 }); 249 // instance is active but paused: play 250 } else if (lastAction.type === 'PLAYER_SHOW_COMPONENT_CONTROLS_BUTTON_PAUSE') { 251 instance.store.dispatch({ 252 type: "PLAYER_REQUEST_PLAY" 253 }); 254 } 255 activeInstance = playerInstance; 256 // this is not the droid errr... instance you're looking for: pause 257 } else { 258 instance.wrapper.classList.remove('is-active'); 259 instance.store.dispatch({ 260 type: "PLAYER_REQUEST_PAUSE" 261 }); 262 } 263 }); 264 } 265 }); 266 parent.replaceChild(playBtn, player); 267 }); 268 269 playerToggleShow.addEventListener('click', function () { 270 if (!activeInstance) { 271 let firstPlayButton = document.querySelector('[href="#show-player"]'); 272 if (firstPlayButton) { 273 firstPlayButton.click(); 274 } 275 } 276 }); 277 } 278 279 linkTimeMarks(); 280 }; 281 282 document.addEventListener('DOMContentLoaded', initPlayers); 283 284 const $P = new Pjax({ 285 cacheBust: false, 286 analytics: false, 287 elements: 'a:not([target="_blank"]):not([href*="/wp-admin/"]):not([href*="/feed/"]), form[action]', 288 selectors: [ 289 'head > title', 290 '#page', 291 '#wpadminbar' 292 ] 293 }); 294 $P._handleResponse = $P.handleResponse; 295 296 $P.handleResponse = function handleResponse(responseText, request, href, options) { 297 const newDoc = (new DOMParser()).parseFromString(responseText, 'text/html'); 298 299 // switch body classes 300 document.body.className = newDoc.body.className; 301 302 // switch html element attributes 303 const oldHtmlAttributes = document.documentElement.attributes; 304 const newHtmlAttributes = newDoc.documentElement.attributes; 305 306 let removeAttrs = []; 307 for (var n = 0; n < oldHtmlAttributes.length; n++) { 308 if (!newHtmlAttributes.hasOwnProperty(oldHtmlAttributes[n].name)) { 309 removeAttrs.push(oldHtmlAttributes[n].name); 310 } 311 } 312 removeAttrs.forEach(function (attr) { 313 document.documentElement.removeAttribute(attr); 314 }) 315 316 for (var n = 0; n < newHtmlAttributes.length; n++) { 317 document.documentElement.setAttribute(newHtmlAttributes[n].name, newHtmlAttributes[n].value); 318 } 319 320 if (!window.podloveSubscribeAttrs) { 321 let sbScript = newDoc.querySelector('script.podlove-subscribe-button'); 322 if (sbScript) { 323 window.podloveSubscribeAttrs = Array.from(sbScript.attributes); 324 } 325 } 326 327 $P._handleResponse(responseText, request, href, options); 328 329 var responseUrl = request.getResponseHeader("X-PJAX-URL"); 330 if ( responseUrl && window.URL ) { 331 var responseUrlObject = new URL(responseUrl); 332 if ( responseUrlObject && responseUrlObject.hash ) { 333 if ( window.location.replace ) { 334 // window.setTimeout(function () { 335 window.location.replace(responseUrlObject); 336 // }, 0); 337 } else { 338 window.location.hash = responseUrlObject.hash; 339 } 340 } 341 } 342 }; 343 344 document.addEventListener('pjax:success', function () { 345 startPos = null; 346 initPlayers(); 347 348 // re-init subscribe button 349 let newSubscribeButtonScript = document.createElement('script'); 350 let sbId; 351 for (var n = 0; n < podloveSubscribeAttrs.length; n++) { 352 let attrName = podloveSubscribeAttrs[n].name; 353 let attrVal = podloveSubscribeAttrs[n].value; 354 newSubscribeButtonScript.setAttribute(attrName, attrVal); 355
356 if (attrName === 'data-buttonid') { 357 sbId = attrVal; 358 } 359 } 360 361 let oldFrame = document.getElementById(sbId); 362 if (oldFrame) { 363 oldFrame.parentNode.replaceChild(newSubscribeButtonScript, oldFrame); 364 } else { 365 document.body.appendChild(newSubscribeButtonScript); 366 } 367 }); 368 369 // BUZZZZZZ!!!!11 370 const buzzSound = 'https://wowirsindistvorne.show/wp-content/themes/wwsiv/audio/buzz.wav'; 371 let buzzAudio; 372 let buzzAudioContext; 373 let buzzAudioBuffer; 374 let buzzGainNode; 375 let buzzInited = false; 376 let logoFillVariants = ['url(#ee_rainbow)', 'url(#ee_bi)', 'url(#ee_trans)', 'url(#ee_enby)', 'url(#ee_fluid)']; 377 let logoFillCurrentVariant = -1; 378 379 function setLogoVariant() { 380 const isNormal = logoFillCurrentVariant < 0; 381 document.getElementById('logo_shield').style.fill = isNormal ? 'var(--pink)' : logoFillVariants[logoFillCurrentVariant]; 382 // document.getElementById('logo_W_left').style.fill = logoFillCurrentVariant < 2 ? '#ebebeb' : 'var(--purple)'; 383 document.getElementById('logo_W_left').style.fillOpacity = isNormal ? 1 : 0.6; 384 // document.getElementById('logo_W_right').style.fill = logoFillCurrentVariant < 3 ? '#fff' : 'var(--purple)'; 385 document.getElementById('logo_W_right').style.fillOpacity = isNormal ? 1 : 0.6; 386 } 387 388 function buzzTrigger() { 389 let buzzer = document.querySelector('.neon__blue'); 390 if ( buzzer ) { 391 if ( typeof window.AudioContext !== 'undefined' && typeof window.fetch !== 'undefined' ) { 392 buzzAudioContext = new AudioContext(); 393 buzzer.addEventListener('mouseover', () => { 394 if ( buzzAudioBuffer ) { 395 buzzAudioContext.resume(); 396 if ( buzzGainNode ) { 397 buzzGainNode.gain.value = .5; 398 } 399 } else if ( ! buzzInited ) { 400 buzzInited = true; 401 fetch(buzzSound).then((response) => { 402 if (response.ok) { 403 response.arrayBuffer().then((buffer) => { 404 buzzAudioContext.decodeAudioData( buffer, (decoded) => { 405 buzzAudioBuffer = decoded; 406 407 const source = buzzAudioContext.createBufferSource(); 408 buzzGainNode = buzzAudioContext.createGain(); 409 buzzGainNode.gain.value = 1; 410 source.connect(buzzGainNode).connect(buzzAudioContext.destination); 411 412 source.buffer = buzzAudioBuffer; 413 source.start(0); 414 source.loop = true; 415 }); 416 }); 417 } 418 }); 419 } 420 }); 421 const muteBuzz = () => { 422 if ( buzzGainNode ) { 423 buzzGainNode.gain.value = 0; 424 } 425 }; 426 427 buzzer.addEventListener('mouseout', muteBuzz); 428 429 var hidden, visibilityChange; 430 if (typeof document.hidden !== "undefined") { 431 hidden = "hidden"; 432 visibilityChange = "visibilitychange"; 433 } else if (typeof document.msHidden !== "undefined") { 434 hidden = "msHidden"; 435 visibilityChange = "msvisibilitychange"; 436 } else if (typeof document.webkitHidden !== "undefined") { 437 hidden = "webkitHidden"; 438 visibilityChange = "webkitvisibilitychange"; 439 } 440 document.addEventListener(visibilityChange, muteBuzz, false); 441 } else { 442 if ( ! buzzAudio ) { 443 buzzAudio = document.createElement('audio'); 444 buzzAudio.src = buzzSound; 445 buzzAudio.paused = true; 446 buzzAudio.loop = true; 447 } 448 449 buzzer.addEventListener('mouseover', () => { 450 buzzAudio.play(); 451 }); 452 buzzer.addEventListener('mouseout', () => { 453 buzzAudio.pause(); 454 }); 455 } 456 457 buzzer.addEventListener('click', () => { 458 logoFillCurrentVariant++; 459 if ( logoFillCurrentVariant > logoFillVariants.length - 1 ) { 460 logoFillCurrentVariant = -1; 461 } 462 setLogoVariant(); 463 }); 464 } 465 466 setLogoVariant(); 467 } 468 buzzTrigger(); 469 document.addEventListener('pjax:success', function () { 470 if ( buzzGainNode ) { 471 buzzAudioContext.resume(); 472 buzzGainNode.gain.value = 0; 473 } 474 buzzTrigger(); 475 }); 476 477 // save comment author name and mail 478 if ( window.localStorage ) { 479 document.addEventListener('pjax:send', function ( ev ) { 480 if ( ev.triggerElement && ev.triggerElement.matches && ev.triggerElement.matches('form.comment-form') ) { 481 const checkbox = ev.triggerElement.querySelector('input[name="wp-comment-cookies-consent"]'); 482 const author = ev.triggerElement.querySelector('input[name="author"]'); 483 const email = ev.triggerElement.querySelector('input[name="email"]'); 484 if ( checkbox ) { 485 if ( checkbox.checked || checkbox.type === 'hidden' ) { 486 window.localStorage.setItem('wwsiv-save-commentator-data', JSON.stringify({ 487 author: author ? author.value : null, email: email ? email.value : null 488 })); 489 } else { 490 window.localStorage.removeItem('wwsiv-save-commentator-data'); 491 } 492 } 493 } 494 }); 495 } 496 // restore comment author name and email 497 function restoreCommonAuthorData() { 498 const commentForms = document.querySelectorAll('form.comment-form'); 499 if ( commentForms && commentForms.length ) { 500 let authorData = window.localStorage.getItem('wwsiv-save-commentator-data'); 501 if ( authorData ) { 502 try { 503 authorData = JSON.parse(authorData); 504 } catch(e) { 505 authorData = {}; 506 }
507 commentForms.forEach((f) => { 508 const checkbox = f.querySelector('input[name="wp-comment-cookies-consent"]'); 509 const author = f.querySelector('input[name="author"]'); 510 const email = f.querySelector('input[name="email"]'); 511 checkbox && ( checkbox.checked = true ); 512 author && authorData.author && ( author.value = authorData.author ); 513 email && authorData.email && ( email.value = authorData.email ); 514 checkbox.addEventListener('change', function() { 515 if ( !this.checked ) { 516 window.localStorage.removeItem('wwsiv-save-commentator-data'); 517 } 518 }); 519 }) 520 } 521 } 522 } 523 restoreCommonAuthorData(); 524 document.addEventListener('pjax:success', function () { 525 restoreCommonAuthorData(); 526 }); 527 528 // Autogrow textareas 529 function autoGrowTextareas() { 530 var tx = document.getElementsByTagName('textarea'); 531 for (var i = 0; i < tx.length; i++) { 532 if ( tx[i].ariaHidden ) continue; // ignore anti-spam field 533 tx[i].setAttribute('style', 'height:' + (tx[i].scrollHeight) + 'px;overflow-y:hidden;'); 534 tx[i].addEventListener("input", OnInput, false); 535 } 536 537 function OnInput() { 538 this.style.height = 'auto'; 539 this.style.height = (this.scrollHeight) + 'px'; 540 } 541 } 542 autoGrowTextareas(); 543 document.addEventListener('pjax:success', function () { 544 autoGrowTextareas(); 545 }); 546 547 //================================================== 548 // Polyfill for pseudo selector :placeholder-shown 549 // Author: Subash Selvaraj(github userid:sesubash) 550 //================================================== 551 (function () { 552 553 var placeholderShownPolyfill = { 554 init: function () { 555 var self = this; 556 document.querySelectorAll('[placeholder]').forEach(function (el) { 557 if (el.getAttribute('placeholder').value !== "") { 558 self.updatePlaceholder.call(el); 559 } 560 561 el.addEventListener('change', self.updatePlaceholder); 562 el.addEventListener('keyup', self.updatePlaceholder); 563 }); 564 }, 565 566 updatePlaceholder: function () { 567 this.classList[this.value ? 'remove' : 'add']('placeholder-shown'); 568 } 569 }; 570 571 /*document.addEventListener('pjax:success', () => { 572 placeholderShownPolyfill.init(); 573 });*/ 574 575 if (/^[c|i]|d$/.test(document.readyState || "")) { 576 placeholderShownPolyfill.init(); 577 } else { 578 document.addEventListener("DOMContentLoaded", placeholderShownPolyfill.init()); 579 } 580 581 window.placeholderShownPolyfill = placeholderShownPolyfill; 582 583 })(); 584 585 // link time marks in shownotes 586 function linkTimeMarks() { 587 let showNotes = document.querySelector('body.single-podcast article.post.type-podcast'); 588 if (showNotes) { 589 var rx = /\b([0-9]|0[0-9]|1[0-9]|2[0-3])(:[0-5][0-9]){1,2}(?!:)\b/gi; 590 // var subst = '<a href="#" data-timejump="2">$1</a>'; 591 showNotes.innerHTML = showNotes.innerHTML.replace(rx, function (timeString) { 592 let parts = timeString.split(':').map(function (t) { return parseInt(t, 10) }); 593 let timeJump = null; 594 if (parts.length === 3) { 595 timeJump = parts[0] * 60 * 60 + parts[1] * 60 + parts[2]; 596 } else if (parts.length === 2) { 597 timeJump = parts[0] * 60 + parts[1]; 598 } 599 600 if (timeJump !== null) { 601 return '<a href="#" data-timejump="' + timeJump + '">' + timeString + '</a>'; 602 } else { 603 return timeString; 604 } 605 }); 606 607 var jumpLinks = showNotes.querySelectorAll('[data-timejump]'); 608 if (jumpLinks) { 609 for (var i = 0; i < jumpLinks.length; i++) { 610 jumpLinks[i].addEventListener('click', function (event) { 611 startPos = event.target.getAttribute('data-timejump'); 612 event.preventDefault(); 613 if (!activeInstance) { 614 playerToggleShow.click(); 615 } else { 616 let playBtn = document.querySelector('.btn[href="#show-player"]'); 617 if (playBtn) { 618 playBtn.click(); 619 } 620 activeInstance.store.dispatch({ 621 "type": "PLAYER_REQUEST_PLAYTIME", 622 "payload": startPos * 1000 623 }); 624 } 625 //event.target.blur(); 626 return false; 627 }); 628 } 629 } 630 } 631 } 632 633 let crashItBaby = (function () { 634 crashStarted = true; 635 document.body.classList.add('crash'); 636 637 window.setTimeout(function () { 638 let clickHandler = function () { 639 document.body.classList.remove('crash'); 640 document.removeEventListener('click', clickHandler); 641 errMsg.parentNode.removeChild(errMsg); 642 }; 643 document.addEventListener('click', clickHandler); 644 645 let errMsg = document.createElement('div'); 646 errMsg.tabIndex = 0; 647 errMsg.setAttribute('aria-hidden', 'true') 648 errMsg.style.background = "url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAVkAAACCBAMAAAAeUqawAAAAHlBMVEXAwMAAAMgAAAB4eHj/////AACZmZlgAAB/f3/f398o2/1OAAADy0lEQVR42u3cTW7aQBQH8CePlbCl5QDuqAewah/AqV9uEJRtVmTbTWDLoguWWba37fswpjYQS6MQZqL3x/GMZxD6afSMDUIBTCgFtFU6Ie08mXw17T6mjV+7QM23NLR/JX9Uu7jjoTvkGZwj0h8N8cb962fxCpzZsVadvNcthixeZ1uYbVVLRH6QTR/z/UA8WtjBDqe1XOJ3iHPdrhHVzna/m1NaUmGvReQRnboSVrWwQ1Atq4hFaIZqCfOS6trGoZ3ttglpd7jrteRBURJNNuShiLQzqtrtKa3Wbaelvmj5FLumFhAAZ4lcy/TqkIp2p0lD+8Vr0tCmdceYsBaSiTPtPqY1rca0ptWY1rQa0yasvd1sNr8g1oy0m5flcvm4gUgz1N4uNbGu7kB7+9JpHyPlDrSCVS5EGdYO6mBcC5n3BfTxkPEYnM546sO0a+hSdIJCLFOkIoAQotVCeBDqPZXCU+RaXlq8XxIZpRQO2owaD+CLjCqBGxr1vMmYDMmkBy/T9LQuF9SyE5nM5vVIW0AmnYybTA/0UTBYNupKpwhY4wCtQJW8fjqjVY4sJHAjYu4ctHBprZYtS0XMhTuxtjwnjWoBPl67RM7ySJsNtVCcqIQraB8Iey/a1X/vt55FtGetNNmZsyzjPmuVe2ntkpdWtVNv/9Mzpj1bCfHl5FmWirZ7B0tAO7o6xK/tr7xJaPu7Grnyxpezd4yr2LWDu/HEtBBhTn6KjLUQzn1Cj7MQhlp47usgykIYaW+6b5ZWcS7tQMvc581ms44VO9bCihNpHRxr4WYV7cqm/m1z3DFtH9OaVmNa02pMa1qNaU2rMa1pNaZNW+uDA28n80F5W/sdA/NzShv2qhNaCMyPKW0T9KqmNe2n1lZVeXgm/fVH2g/XFrSNfsOVHSbDtC7H1vUHDUDeK6UfrvW9qeiZ4doDsG0OB5IausSodaWruCLkQPpQlY7asqxKngirhAKKzAPtvWipGLpfkEjXh9atwxLLGlvR1txv89ZxW1GbYx2mzRRMDdct76mvm8yEaLlumxrqmqyidWVeu6pqkcbqxlGZhGu9J5VWgmjBg2h5JkAr8+1ACy2JEVnJg+FaWkASHbTK7Nc2qG6PtCWUNXVdr3Wh2uxQCQDBlTCu26Z0Vc6to11NfQdVuV/bpirDtXqWZfJ++y5nWY4IOWBTUwuIyH1ocoQG8jwH7oZpxyne88pbw+nQeufxaXM4E8QmnvuEtO5qUtBWgZnUtkGv+pk+80Yc0/YxrWk1pjWtxrSm1ZjWtBeKS+0/yvqEUvwD2eMFz1nov90AAAAASUVORK5CYII=')"; 649 errMsg.style.position = 'fixed'; 650 errMsg.style.top = '50%'; 651 errMsg.style.left = '50%'; 652 errMsg.style.transform = 'translate(-50%, -50%)'; 653 errMsg.style.width = '345px'; 654 errMsg.style.height = '130px'; 655 errMsg.style.zIndex = 999999; 656 document.body.appendChild(errMsg); 657 crashStarted = false;
658 }, 1000); 659 }); 660 661 // const liveCheckSeconds = 60; 662 // const liveCheckCallback = () => { 663 // window.fetch('/livecheck.php').then((response) => { 664 // if (response.status == 200) { 665 // response.json().then(function(data) { 666 // if (!! data?.twitch) { 667 // window.clearInterval(liveCheckInterval); 668 // document.querySelector('.twitch-modal')?.showModal(); 669 // document.documentElement.classList.add('is--live-on-twitch'); 670 // } else { 671 // document.documentElement.classList.remove('is--live-on-twitch'); 672 // } 673 // }); 674 // } 675 // }); 676 // }; 677 // let liveCheckInterval = window.setInterval(liveCheckCallback, liveCheckSeconds * 1000); 678 // liveCheckCallback(); 679})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.