PageSourceSearch

https://lost-in-history.com/_static/??-eJx9jkuuwjAMRTdEsNCT+AwQS0E…/5UqdaiNLLLEK39J593heNr/HXen/QONrmwz

js lost-in-history.com collected 2026-10-06 21:03:37 UTC 18,227 bytes, 345 lines download raw bytes

1(()=>{const e=document.querySelectorAll(".coblocks-animate");if("IntersectionObserver"in window){const t=new IntersectionObserver((e=>{e.forEach((e=>{e.isIntersecting&&(e.target.classList.add(e.target.dataset.coblocksAnimation),t.unobserve(e.target))}))}),{threshold:[.15]});e.forEach((e=>{t.observe(e)}))}else e.forEach((e=>{e.classList.remove("coblocks-animate"),delete e.dataset.coblocksAnimation}))})();;
2class UniversallySwitcher extends HTMLElement {
3  constructor() {
4    super();
5    this.attachShadow({ mode: 'open' });
6    this._open = false;
7    this._onDocClick = this._onDocClick.bind(this);
8    this._onKeyDown = this._onKeyDown.bind(this);
9  }
10
11  connectedCallback() {
12    const raw = this.getAttribute('data-config');
13    if (!raw) return;
14
15    try {
16      this._config = JSON.parse(raw);
17    } catch {
18      return;
19    }
20
21    this.setAttribute('translate', 'no');
22    this._render();
23    this._bind();
24  }
25
26  disconnectedCallback() {
27    document.removeEventListener('click', this._onDocClick, true);
28    document.removeEventListener('keydown', this._onKeyDown);
29  }
30
31  _render() {
32    const { languages, showNames, showFlags, flagStyle, fixed, position } = this._config;
33    if (!languages || !languages.length) return;
34
35    const current = languages.find(l => l.isCurrent);
36    if (!current) return;
37
38    const others = languages.filter(l => !l.isCurrent && !l.isDisabled);
39
40    const flagRadius = flagStyle === 'square' ? '0' : '50%';
41
42    let hostStyles = '';
43    if (fixed) {
44      const posMap = {
45        bottom_right: 'bottom:20px;right:20px',
46        bottom_left: 'bottom:20px;left:20px',
47        top_right: 'top:20px;right:20px',
48        top_left: 'top:20px;left:20px',
49      };
50      const pos = posMap[position] || posMap.bottom_right;
51      hostStyles = `position:fixed;${pos};z-index:999999;`;
52    }
53
54    const flagHtml = (lang) => {
55      if (!showFlags || !lang.flagUrl) return '';
56      return `<img class="flag" src="${lang.flagUrl}" alt="" />`;
57    };
58
59    const nameHtml = (lang) => {
60      if (!showNames) return '';
61      return `<span class="name">${lang.originalName || lang.name || ''}</span>`;
62    };
63
64    const codeHtml = (lang) => {
65      const code = (lang.region || lang.variant || '').split('-')[0];
66      return `<span class="code">${code.toUpperCase()}</span>`;
67    };
68
69    const labelHtml = (lang) => {
70      if (showFlags || showNames) return `${flagHtml(lang)}${nameHtml(lang)}`;
71      return codeHtml(lang);
72    };
73
74    const itemsHtml = others.map(lang => {
75      // Resolved server-side so it honors the "Hreflang Format" setting; the
76      // region/variant chain is a fallback for configs cached before that existed.
77      const hreflang = lang.hreflang || lang.region || lang.variant || '';
78      // data-lang carries the urlPrefix for target languages; an empty value
79      // marks the source language so the click handler can clear the cookie.
80      const dataLang = lang.isSource ? '' : (lang.urlPrefix || '');
81      // The source link carries an explicit opt-out marker so the server clears
82      // the stored preference even when the click handler doesn't run (new tab,
83      // prefetch, cookie path/domain mismatch). PHP strips the marker and
84      // redirects to the clean URL.
85      const href = lang.isSource
86        ? `${lang.url}${lang.url.includes('?') ? '&' : '?'}universally_switch=source`
87        : lang.url;
88      return `<li><a href="${href}" hreflang="${hreflang}" lang="${hreflang}" data-lang="${dataLang}">${labelHtml(lang)}</a></li>`;
89    }).join('');
90
91    this.shadowRoot.innerHTML = `
92      <style>
93        :host {
94          display: inline-block;
95          font-family: inherit;
96          font-size: var(--universally-font-size, 14px);
97          line-height: 1.4;
98          ${hostStyles}
99        }
100        * { box-sizing: border-box; margin: 0; padding: 0; }
101
102        .trigger {
103          display: inline-flex;
104          align-items: center;
105          gap: 8px;
106          padding: var(--universally-trigger-padding, 8px 12px);
107          background: var(--universally-trigger-bg, #ffffff);
108          border: 1px solid var(--universally-trigger-border, #d1d5db);
109          border-radius: var(--universally-trigger-radius, 6px);
110          cursor: pointer;
111          font: inherit;
112          color: var(--universally-trigger-text, #111827);
113          transition: border-color 0.15s;
114          user-select: none;
115        }
116        .trigger:hover { border-color: var(--universally-trigger-border-hover, #9ca3af); }
117        .trigger:focus-visible {
118          outline: 2px solid var(--universally-focus, #0073aa);
119          outline-offset: 2px;
120        }
121
122        .arrow {
123          display: inline-block;
124          width: 0;
125          height: 0;
126          border-left: 4px solid transparent;
127          border-right: 4px solid transparent;
128          border-top: 5px solid currentColor;
129          transition: transform 0.2s;
130        }
131        :host([open]) .arrow { transform: rotate(180deg); }
132
133        .dropdown {
134          display: none;
135          position: absolute;
136          left: 0;
137          margin: 4px 0;
138          padding: 4px;
139          list-style: none;
140          background: var(--universally-dropdown-bg, #ffffff);
141          border: 1px solid var(--universally-dropdown-border, #d1d5db);
142          border-radius: var(--universally-dropdown-radius, 6px);
143          box-shadow: var(--universally-dropdown-shadow, 0 4px 12px rgba(0,0,0,0.1));
144          min-width: 100%;
145          max-height: 200px;
146          overflow-y: auto;
147          z-index: 10;
148        }
149        :host([open]) .dropdown { display: block; }
150        .dropdown.above { bottom: 100%; top: auto; }
151        .dropdown.below { top: 100%; bottom: auto; }
152
153        .dropdown li { white-space: nowrap; }
154        .dropdown a {
155          display: flex;
156          align-items: center;
157          gap: 8px;
158          padding: 8px 10px;
159          color: var(--universally-dropdown-text, #111827);
160          text-decoration: none;
161          border-radius: 4px;
162          transition: background 0.15s;
163          font: inherit;
164        }
165        .dropdown a:hover { background: var(--universally-dropdown-hover-bg, #f3f4f6); }
166        .dropdown a:focus-visible {
167          outline: 2px solid var(--universally-focus, #0073aa);
168          outline-offset: -2px;
169        }
170
171        .flag {
172          width: 20px;${flagStyle === 'square' ? '' : '\n          height: 20px;'}
173          object-fit: cover;
174          border-radius: ${flagRadius};
175          flex-shrink: 0;
176        }
177        .name { color: inherit; }
178        .code { color: inherit; font-weight: 500; letter-spacing: 0.5px; }
179
180        .wrap { position: relative; display: inline-block; }
181      </style>
182      <div class="wrap">
183        <button class="trigger" type="button" aria-expanded="false" aria-haspopup="listbox">
184          ${labelHtml(current)}${showFlags && !showNames ? '' : '<span class="arrow" aria-hidden="true"></span>'}
185        </button>
186        <ul class="dropdown below" role="listbox">${itemsHtml}</ul>
187      </div>
188    `;
189  }
190
191  _bind() {
192    this._trigger = this.shadowRoot.querySelector('.trigger');
193    this._dropdown = this.shadowRoot.querySelector('.dropdown');
194    if (!this._trigger || !this._dropdown) return;
195
196    this._trigger.addEventListener('click', (e) => {
197      e.stopPropagation();
198      this._toggle();
199    });
200
201    this._dropdown.querySelectorAll('a[data-lang]').forEach((a) => {
202      a.addEventListener('click', () => {
203        this._persistLanguageChoice(a.getAttribute('data-lang') || '');
204      });
205    });
206
207    document.addEventListener('click', this._onDocClick, true);
208    document.addEventListener('keydown', this._onKeyDown);
209  }
210
211  _persistLanguageChoice(urlPrefix) {
212    // The server only honors the cookie when "Remember visitor's language" is
213    // on; writing it anyway would leave a stray cookie the server ignores.
214    if (this._config.rememberLanguage === false) return;
215
216    // Empty urlPrefix means the source language: store the literal value
217    // "source" for instant local effect. The hosted runtime script shares this
218    // cookie and reads "source" as "visitor opted out, do not redirect";
219    // deleting the cookie instead would make the script redirect again on the
220    // next source page load. The authoritative write still happens server-side
221    // via the ?universally_switch=source marker on the source link, which uses
222    // the exact cookie path/domain attributes the cookie was set with.
223    const maxAge = 60 * 60 * 24 * 30;
224    const value = urlPrefix ? encodeURIComponent(urlPrefix) : 'source';
225    const secure = location.protocol === 'https:' ? ';secure' : '';
226    document.cookie = `universally_lang=${value};path=/;max-age=${maxAge};samesite=Lax${secure}`;
227  }
228
229  _toggle() {
230    this._open = !this._open;
231    if (this._open) {
232      this.setAttribute('open', '');
233      this._trigger.setAttribute('aria-expanded', 'true');
234      this._positionDropdown();
235    } else {
236      this._close();
237    }
238  }
239
240  _close() {
241    this._open = false;
242    this.removeAttribute('open');
243    this._trigger.setAttribute('aria-expanded', 'false');
244  }
245
246  _positionDropdown() {
247    const dd = this._dropdown;
248    const pad = 20;
249
250    // Reset to default position for measurement
251    dd.classList.remove('above');
252    dd.classList.add('below');
253    dd.style.left = '0';
254
255    const triggerRect = this._trigger.getBoundingClientRect();
256    const ddRect = dd.getBoundingClientRect();
257    const vh = window.innerHeight;
258    const vw = window.innerWidth;
259
260    // Vertical: prefer below, flip above if not enough space
261    const spaceBelow = vh - triggerRect.bottom;
262    const spaceAbove = triggerRect.top;
263    if (ddRect.height + pad > spaceBelow && spaceAbove > spaceBelow) {
264      dd.classList.remove('below');
265      dd.classList.add('above');
266    }
267
268    // Horizontal: shift if overflowing viewport edges
269    if (ddRect.right > vw - pad) {
270      dd.style.left = `${-(ddRect.right - vw + pad)}px`;
271    } else if (ddRect.left < pad) {
272      dd.style.left = `${pad - ddRect.left}px`;
273    }
274  }
275
276  _onDocClick(e) {
277    if (this._open && !e.composedPath().includes(this)) {
278      this._close();
279    }
280  }
281
282  _onKeyDown(e) {
283    if (e.key === 'Escape' && this._open) {
284      this._close();
285      this._trigger.focus();
286    }
287  }
288}
289
290if (!customElements.get('universally-switcher')) {
291  customElements.define('universally-switcher', UniversallySwitcher);
292}
293;
294/**
295 * File primary-navigation.js.
296 *
297 * This files only gets added to themes that support the mobile nav on side
298 */
299( function() {
300
301	/**
302	 * Menu Toggle Behaviors
303	 *
304	 * @param {Element} element
305	 */
306	var navMenu = function ( buttonId, inputId ) {
307		var wrapper = document.body;
308
309		var toggleButton = document.getElementById( buttonId );
310		var toggleInput  = document.getElementById( inputId );
311
312		if ( toggleButton ) {
313			toggleButton.onclick = function() {
314				if ( true == toggleInput.checked ) {
315					wrapper.classList.remove( 'lock-scrolling' );
316				} else {
317					wrapper.classList.add( 'lock-scrolling' );
318				}
319
320				toggleButton.focus();
321			}
322		}
323
324		document.addEventListener( 'click', function( event ) {
325			// If target onclick is <a> with # within the href attribute
326			if ( event.target.hash && event.target.hash.includes( '#' ) ) {
327				wrapper.classList.remove( 'lock-scrolling' );
328				if (toggleInput) {
329					toggleInput.checked = false;
330				}
331				// Wait 550 and scroll to the anchor.
332				setTimeout(function () {
333					var anchor = document.getElementById(event.target.hash.slice(1));
334					anchor.scrollIntoView();
335				}, 550);
336			}
337		} );
338	}
339
340	window.addEventListener( 'load', function() {
341		navMenu(  'toggle-menu', 'toggle' );
342		navMenu(  'toggle-cart', 'woocommerce-toggle' );
343	} );
344} )();;
345(()=>{var e=[],t=!1,n=2e3,i=[],o=new Promise(e=>{"loading"!==document.readyState?e():window.addEventListener("DOMContentLoaded",()=>e())});function s(e,t){if("string"==typeof e)try{e=JSON.parse(e)}catch{return}if(t&&"function"==typeof t.postMessage)try{t.postMessage(JSON.stringify({type:"likesMessage",data:e}),"*")}catch{}}function r(){const t=[];document.querySelectorAll("div.jetpack-likes-widget-unloaded").forEach(n=>{if(!(e.indexOf(n.id)>-1)&&d(n)){e.push(n.id);var i,o=/like-(post|comment)-wrapper-(\d+)-(\d+)-(\w+)/.exec(n.id);o&&5===o.length&&(i={blog_id:o[2],width:n.width},"post"===o[1]?i.post_id=o[3]:"comment"===o[1]&&(i.comment_id=o[3]),i.obj_id=o[4],t.push(i))}}),t.length>0&&s({event:"initialBatch",requests:t},window.frames["likes-master"])}function a(){const e=document.querySelector("#likes-other-gravatars");if(e){e.style.display="none",e.setAttribute("aria-hidden","true");const t=e.__resizeHandler;t&&(window.removeEventListener("resize",t),delete e.__resizeHandler)}}function l(){var e;if(!t)return s({event:"queryMasterReady"},window.frames["likes-master"]),void setTimeout(l,500);!function(){for(let e=i.length-1;e>=0;e--){const t=i[e];if(!d(t)){const n=t&&t.parentElement&&t.parentElement.parentElement;n.classList.remove("jetpack-likes-widget-loaded"),n.classList.remove("jetpack-likes-widget-loading"),n.classList.add("jetpack-likes-widget-unloaded");const o=n.querySelector(".likes-widget-placeholder");o&&(o.style.display=""),i.splice(e,1),t.remove()}}}(),function(){if(!g)return;document.querySelectorAll("div.jetpack-likes-widget-unloaded").forEach(e=>g.observe(e))}();var n=[...document.querySelectorAll("div.jetpack-likes-widget-unloaded")].filter(e=>d(e));n.length>0&&r();for(var o=0,a=n.length;o<=a-1;o++)(e=n[o].id)&&c(e)}function c(e){if(void 0===e)return;const t=document.querySelector("#"+e);t.querySelectorAll("iframe").forEach(e=>e.remove());const n=t.querySelector(".likes-widget-placeholder");if(n&&n.classList.contains("post-likes-widget-placeholder")){const e=document.createElement("iframe");e.classList.add("post-likes-widget","jetpack-likes-widget"),e.name=t.dataset.name,e.src=t.dataset.src,e.height="55px",e.width="100%",e.frameBorder="0",e.scrolling="no",e.title=t.dataset.title,n.after(e)}if(n.classList.contains("comment-likes-widget-placeholder")){const e=document.createElement("iframe");e.class="comment-likes-widget-frame jetpack-likes-widget-frame",e.name=t.dataset.name,e.src=t.dataset.src,e.height="18px",e.width="100%",e.frameBorder="0",e.scrolling="no",t.querySelector(".comment-like-feedback").after(e),i.push(e)}t.classList.remove("jetpack-likes-widget-unloaded"),t.classList.add("jetpack-likes-widget-loading"),t.querySelector("iframe").addEventListener("load",e=>{t.contains(e.target)&&(s({event:"loadLikeWidget",name:e.target.name,width:e.target.width},window.frames["likes-master"]),n&&(n.style.display="none"),t.classList.remove("jetpack-likes-widget-loading"),t.classList.add("jetpack-likes-widget-loaded"))})}function d(e){const t=e.getBoundingClientRect().top,i=e.getBoundingClientRect().bottom;return t+n>=0&&i<=window.innerHeight+n}window.addEventListener("message",function(e){let n=e&&e.data;if("string"==typeof n)try{n=JSON.parse(n)}catch{return}const i=n&&n.type,l=n&&n.data;if("likesMessage"!==i||void 0===l.event)return;if("https://widgets.wp.com"===e.origin)switch(l.event){case"masterReady":o.then(()=>{t=!0;const e={event:"injectStyles"},n=document.querySelector(".sd-text-color"),i=document.querySelector(".sd-link-color"),o=n&&getComputedStyle(n)||{},a=i&&getComputedStyle(i)||{};document.body.classList.contains("single")&&s({event:"reblogsEnabled"},window.frames["likes-master"]),e.textStyles={color:o.color,fontFamily:o["font-family"],fontSize:o["font-size"],direction:o.direction,fontWeight:o["font-weight"],fontStyle:o["font-style"],textDecoration:o["text-decoration"]},e.linkStyles={color:a.color,fontFamily:a["font-family"],fontSize:a["font-size"],textDecoration:a["text-decoration"],fontWeight:a["font-weight"],fontStyle:a["font-style"]},s(e,window.frames["likes-master"]),r()});break;case"showLikeWidget":case"showCommentLikeWidget":break;case"killCommentLikes":document.querySelectorAll(".jetpack-comment-likes-widget-wrapper").forEach(e
345=>e.remove());break;case"clickReblogFlair":wpcom_reblog&&"function"==typeof wpcom_reblog.toggle_reblog_box_flair&&wpcom_reblog.toggle_reblog_box_flair(l.obj_id);break;case"hideOtherGravatars":a();break;case"showOtherGravatars":{const e=document.querySelector("#likes-other-gravatars");if(!e)break;const t=e.querySelector("ul");e.style.display="none",t.innerHTML="",e.querySelectorAll(".likes-text span").forEach(e=>e.textContent=l.totalLikesLabel),(l.likers||[]).forEach(async(e,n)=>{if("http"!==e.profile_URL.substr(0,4))return;const i=document.createElement("li");t.append(i);const o=encodeURI(e.profile_URL),r=encodeURI(e.avatar_URL);i.innerHTML=`<a href="${o}" rel="nofollow" target="_parent" class="wpl-liker">\n\t\t\t\t\t\t<img src="${r}"\n\t\t\t\t\t\t\talt=""\n\t\t\t\t\t\t\tstyle="width: 28px; height: 28px;" />\n\t\t\t\t\t\t<span></span>\n\t\t\t\t\t</a>`,i.classList.add(e.css_class),i.querySelector("img").alt=l.avatarAltTitle.replace("%s",e.name),i.querySelector("span").innerText=e.name,n===l.likers.length-1&&i.addEventListener("keydown",e=>{"Tab"!==e.key||e.shiftKey||(e.preventDefault(),a(),s({event:"focusLikesCount",parent:l.parent},window.frames["likes-master"]))})});const n=function(){const t="rtl"===getComputedStyle(e).direction,n=document.querySelector(`*[name='${l.parent}']`),i=n.getBoundingClientRect(),o=n.ownerDocument.defaultView,s=i.top+o.pageYOffset,r=i.left+o.pageXOffset;let a;if(e.style.top=s+l.position.top-1+"px",t){const t=l&&l.likers?Math.min(l.likers.length,5):0;a=r+l.position.left+24*t+4,e.style.transform="translateX(-100%)"}else a=r+l.position.left;e.style.left=a+"px",e.style.left="-9999px",e.style.display="block";const c=e.offsetWidth;a+c>o.innerWidth&&(a=i.right-c),e.style.left=a+"px",e.setAttribute("aria-hidden","false")};n(),e.focus();const i=function(e,t){var n;return function(){var i=this,o=arguments;clearTimeout(n),n=setTimeout(function(){e.apply(i,o)},t)}},o=i(n,100);e.__resizeHandler=o,window.addEventListener("resize",o),e.focus()}}}),document.addEventListener("click",a);var f,m,u,p=(f=250,m=l,function(){clearTimeout(u),u=setTimeout(m,f)}),g="function"==typeof IntersectionObserver?new IntersectionObserver(p,{rootMargin:"2000px",threshold:[0,1]}):null;l(),window.addEventListener("scroll",p,!0)})();;

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.