1!function(){"use strict";var t={response:null,getEndpointURL:function(t){var e,s="undefined"!=typeof wp&&wp.customize&&wp.customize.settings&&wp.customize.settings.url&&wp.customize.settings.url.self;s?(e=document.createElement("a")).href=wp.customize.settings.url.self:e=document.location,"string"==typeof t&&t.match(/^https?:\/\//)&&((e=document.createElement("a")).href=t);var a="relatedposts=1",r=document.querySelector("#jp-relatedposts");if(!r)return!1;r.hasAttribute("data-exclude")&&(a+="&relatedposts_exclude="+r.getAttribute("data-exclude")),s&&(a+="&jetpackrpcustomize=1");var o=e.pathname;return"/"!==o[0]&&(o="/"+o),""===e.search?o+"?"+a:o+e.search+"&"+a},getAnchor:function(t,e){var s=t.title,a=document.createElement("a");return a.setAttribute("class",e),a.setAttribute("href",t.url),a.setAttribute("title",s),a.setAttribute("data-origin",t.url_meta.origin),a.setAttribute("data-position",t.url_meta.position),""!==t.rel&&a.setAttribute("rel",t.rel),a},cleanHtml:function(t){var e=document.createElement("div");return e.innerHTML=t,e.textContent||e.innerText||""},generateMinimalDiv:function(t,e){var s=this,a=document.createElement("div");return a.setAttribute("class","jp-relatedposts-items jp-relatedposts-items-minimal jp-relatedposts-"+e.layout),t.forEach(function(t,r){var o="jp-relatedposts-post jp-relatedposts-post"+r;t.classes.length>0&&(o+=" "+t.classes.join(" "));var n=document.createElement("p");n.setAttribute("class",o),n.setAttribute("data-post-id",t.id),n.setAttribute("data-post-format",t.format),a.appendChild(n);var i=document.createElement("span");i.setAttribute("class","jp-relatedposts-post-title"),n.appendChild(i);var p=s.getAnchor(t,"jp-relatedposts-post-a");if(i.appendChild(p),p.textContent=s.cleanHtml(t.title),e.showDate){var l=document.createElement("time");l.setAttribute("class","jp-relatedposts-post-date"),l.setAttribute("datetime",t.date),l.textContent=t.date,n.appendChild(l)}if(e.showContext){var c=document.createElement("span");c.setAttribute("class","jp-relatedposts-post-context"),c.textContent=s.cleanHtml(t.context),n.appendChild(c)}}),a},generateVisualDiv:function(t,e){var s=this,a=document.createElement("div");return a.setAttribute("class","jp-relatedposts-items jp-relatedposts-items-visual jp-relatedposts-"+e.layout),t.forEach(function(t,r){var o="jp-relatedposts-post jp-relatedposts-post"+r;t.classes.length>0&&(o+=" "+t.classes.join(" ")),t.img.src?o+=" jp-relatedposts-post-thumbs":o+=" jp-relatedposts-post-nothumbs";var n=document.createElement("div");if(n.setAttribute("class",o),n.setAttribute("data-post-id",t.id),n.setAttribute("data-post-format",t.format),a.appendChild(n),t.img.src){var i=s.getAnchor(t,"jp-relatedposts-post-a");n.appendChild(i);var p=document.createElement("img");p.setAttribute("class","jp-relatedposts-post-img"),p.setAttribute("loading","lazy"),p.setAttribute("src",t.img.src),p.setAttribute("width",t.img.width),p.setAttribute("height",t.img.height),t.img.srcset&&p.setAttribute("srcset",t.img.srcset),t.img.sizes&&p.setAttribute("sizes",t.img.sizes),p.setAttribute("alt",t.img.alt_text),i.appendChild(p)}else{var l=s.getAnchor(t,"jp-relatedposts-post-a jp-relatedposts-post-aoverlay");n.appendChild(l)}var c=document.createElement(related_posts_js_options.post_heading);c.setAttribute("class","jp-relatedposts-post-title"),n.appendChild(c);var d=s.getAnchor(t,"jp-relatedposts-post-a");d.textContent=s.cleanHtml(t.title),c.appendChild(d);var u=document.createElement("p");if(u.setAttribute("class","jp-relatedposts-post-excerpt"),u.textContent=s.cleanHtml(t.excerpt),n.appendChild(u),e.showDate){var m=document.createElement("time");m.setAttribute("class","jp-relatedposts-post-date"),m.setAttribute("datetime",t.date),m.textContent=t.date,n.appendChild(m)}if(e.showContext){var h=document.createElement("p");h.setAttribute("class","jp-relatedposts-post-context"),h.textContent=s.cleanHtml(t.context),n.appendChild(h)}}),a},setVisualExcerptHeights:function(){var t=document.querySelectorAll("#jp-relatedposts .jp-relatedposts-post-nothumbs .jp-relatedposts-post-excerpt");if(t.length)for(var e=getComputedStyle(t[0]),s=parseInt(e.fontSize,10),a=parseInt(e.lineHeight,10),r=0;r<t.length;r++)t[r].style.maxHeight=5*a/s+"em"}
1,getTrackedUrl:function(t){var e="relatedposts_hit=1";e+="&relatedposts_origin="+t.getAttribute("data-origin"),e+="&relatedposts_position="+t.getAttribute("data-position");var s=t.pathname;return"/"!==s[0]&&(s="/"+s),""===t.search?s+"?"+e:s+t.search+"&"+e},cleanupTrackedUrl:function(){if("function"==typeof history.replaceState){var t=document.location.search.replace(/\brelatedposts_[a-z]+=[0-9]*&?\b/gi,"");"?"===t&&(t=""),document.location.search!==t&&history.replaceState({},document.title,document.location.pathname+t)}}};function e(){t.setVisualExcerptHeights();var e=document.querySelectorAll("#jp-relatedposts a.jp-relatedposts-post-a");Array.prototype.forEach.call(e,function(e){document.addEventListener("click",function(){e.href=t.getTrackedUrl(e)})})}function s(){t.cleanupTrackedUrl();var s=t.getEndpointURL();if(s)if(document.querySelectorAll("#jp-relatedposts .jp-relatedposts-post").length)e();else{var a=document.querySelector("#jp-relatedposts"),r=new XMLHttpRequest;r.open("GET",s,!0),r.setRequestHeader("x-requested-with","XMLHttpRequest"),r.onreadystatechange=function(){if(this.readyState===XMLHttpRequest.DONE&&200===this.status)try{var s=JSON.parse(r.responseText);if(0===s.items.length||0===a.length)return;t.response=s;var o,n={};"undefined"!=typeof wp&&wp.customize?(o=wp.customize.instance("jetpack_relatedp
1osts[show_thumbnails]").get(),n.showDate=wp.customize.instance("jetpack_relatedposts[show_date]").get(),n.showContext=wp.customize.instance("jetpack_relatedposts[show_context]").get(),n.layout=wp.customize.instance("jetpack_relatedposts[layout]").get()):(o=s.show_thumbnails,n.showDate=s.show_date,n.showContext=s.show_context,n.layout=s.layout);var i=o?t.generateVisualDiv(s.items,n):t.generateMinimalDiv(s.items,n);if(a.appendChild(i),n.showDate){var p=a.querySelectorAll(".jp-relatedposts-post-date");Array.prototype.forEach.call(p,function(t){t.style.display="block"})}a.style.display="block",e()}catch{}},r.send()}}function a(){"undefined"!=typeof wp&&wp.customize?(wp.customize.selectiveRefresh&&wp.customize.selectiveRefresh.bind("partial-content-rendered",function(t){"jetpack_relatedposts"===t.partial.id&&s()}),wp.customize.bind("preview-ready",s)):s()}"loading"!==document.readyState?a():document.addEventListener("DOMContentLoaded",a)}();; 2// listen for rlt authentication events and pass them to children of this document. 3( function() { 4 var currentToken; 5 var parentOrigin; 6 var iframeOrigins; 7 var registeredIframes = []; 8 var initializationListeners = []; 9 var hasBeenInitialized = false; 10 var RLT_KEY = 'jetpack:wpcomRLT'; 11 12 // should we inject RLT into this iframe? 13 function rltShouldAuthorizeIframe( frameOrigin ) { 14 if ( ! Array.isArray( iframeOrigins ) ) { 15 return false; 16 } 17 return iframeOrigins.includes( frameOrigin ); 18 } 19 20 function rltInvalidateWindowToken( token, target, origin ) { 21 if ( target && typeof target.postMessage === 'function' ) { 22 try { 23 target.postMessage( JSON.stringify( { 24 type: 'rltMessage', 25 data: { 26 event: 'invalidate', 27 token: token, 28 sourceOrigin: window.location.origin, 29 }, 30 } ), origin ); 31 } catch ( err ) { 32 return; 33 } 34 } 35 } 36 37 /** 38 * PUBLIC METHODS 39 */ 40 window.rltInvalidateToken = function( token, sourceOrigin ) { 41 // invalidate in current context 42 if ( token === currentToken ) { 43 currentToken = null; 44 } 45 46 // remove from localstorage, but only if in a top level window, not iframe 47 try { 48 if ( window.location === window.parent.location && window.localStorage ) { 49 if ( window.localStorage.getItem(RLT_KEY) === token ) { 50 window.localStorage.removeItem(RLT_KEY); 51 } 52 } 53 } catch( e ) { 54 console.info("localstorage access for invalidate denied - probably blocked third-party access", window.location.href); 55 } 56 57 // invalidate in registered iframes 58 for ( const [ frameOrigin, frameWindow ] of registeredIframes ) { 59 if ( frameOrigin !== sourceOrigin ) { 60 rltInvalidateWindowToken( token, frameWindow, frameOrigin ); 61 } 62 } 63 64 // invalidate in parent 65 if ( parentOrigin && parentOrigin !== sourceOrigin && window.parent ) { 66 rltInvalidateWindowToken( token, window.parent, parentOrigin ); 67 } 68 } 69 70 window.rltInjectToken = function( token, target, origin ) { 71 if ( target && typeof target.postMessage === 'function' ) { 72 try { 73 target.postMessage( JSON.stringify( { 74 type: 'loginMessage', 75 data: { 76 event: 'login', 77 success: true, 78 type: 'rlt', 79 token: token, 80 sourceOrigin: window.location.origin, 81 }, 82 } ), origin ); 83 } catch ( err ) { 84 return; 85 } 86 } 87 }; 88 89 window.rltIsAuthenticated = function() { 90 return !! currentToken; 91 }; 92 93 window.rltGetToken = function() { 94 return currentToken; 95 }; 96 97 window.rltAddInitializationListener = function( listener ) { 98 // if RLT is already initialized, call the listener immediately 99 if ( hasBeenInitialized ) { 100 listener( currentToken ); 101 } else { 102 initializationListeners.push( listener ); 103 } 104 }; 105 106 // store the token in localStorage 107 window.rltStoreToken = function( token ) { 108 currentToken = token; 109 try { 110 if ( window.location === window.parent.location && window.localStorage ) { 111 window.localStorage.setItem( RLT_KEY, token ); 112 } 113 } catch( e ) { 114 console.info("localstorage access denied - probably blocked third-party access", window.location.href); 115 } 116 } 117 118 window.rltInitialize = function( config ) { 119 if ( ! config || typeof window.postMessage !== 'function' ) { 120 return; 121 } 122 123 currentToken = config.token; 124 iframeOrigins = config.iframeOrigins; 125 parentOrigin = config.parentOrigin; // needed? 126 127 // load token from localStorage if possible, but only in top level window 128 try { 129 if ( ! currentToken && window.location === window.parent.location && window.localStorage ) { 130 currentToken = window.localStorage.getItem(RLT_KEY); 131 } 132 } catch( e ) { 133 console.info("localstorage access denied - probably blocked third-party access", window.location.href); 134 } 135 136 // listen for RLT events from approved origins 137 window.addEventListener( 'message', function( e ) { 138 var message = e && e.data; 139 if ( typeof message === 'string' ) { 140 try { 141 message = JSON.parse( message ); 142 } catch ( err ) { 143 return; 144 } 145 } 146 147 var type = message && message.type; 148 var data = message && message.data; 149 150 if ( type === 'loginMessage' ) { 151 if ( data && data.type === 'rlt' && data.token !== currentToken ) { 152 // put into localStorage if running in top-level window (not iframe) 153 rltStoreToken( data.token ); 154 155 // send to registered iframes 156 for ( const [ frameOrigin, frameWindow ] of registeredIframes ) { 157 rltInjectToken( currentToken, frameWindow, frameOrigin ); 158 } 159 160 // send to the parent, unless the event was sent _by_ the parent 161 if ( parentOrigin && parentOrigin !== data.sourceOrigin && window.parent ) { 162 rltInjectToken( currentToken, window.parent, parentOrigin ); 163 } 164 } 165 } 166 167 if ( type === 'rltMessage' ) {
168 if ( data && data.event === 'invalidate' && data.token === currentToken ) { 169 rltInvalidateToken( data.token ); 170 } 171 172 if ( data && data.event === 'register' ) { 173 if ( rltShouldAuthorizeIframe( e.origin ) ) { 174 registeredIframes.push( [ e.origin, e.source ] ); 175 if ( currentToken ) { 176 rltInjectToken( currentToken, e.source, e.origin ); 177 } 178 } 179 } 180 } 181 } ); 182 183 initializationListeners.forEach( function( listener ) { 184 listener( currentToken ); 185 } ); 186 187 initializationListeners = []; 188 189 // inform the parent that we are ready to receive the RLT token 190 window.parent.postMessage( { 191 type: 'rltMessage', 192 data: { 193 event: 'register' 194 }, 195 }, '*' ); 196 197 hasBeenInitialized = true; 198 }; 199} )(); 200; 201/** 202* @preserve HTML5 Shiv 3.7.3 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed 203*/ 204;(function(window, document) { 205/*jshint evil:true */ 206 /** version */ 207 var version = '3.7.3'; 208 209 /** Preset options */ 210 var options = window.html5 || {}; 211 212 /** Used to skip problem elements */ 213 var reSkip = /^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i; 214 215 /** Not all elements can be cloned in IE **/ 216 var saveClones = /^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i; 217 218 /** Detect whether the browser supports default html5 styles */ 219 var supportsHtml5Styles; 220 221 /** Name of the expando, to work with multiple documents or to re-shiv one document */ 222 var expando = '_html5shiv'; 223 224 /** The id for the the documents expando */ 225 var expanID = 0; 226 227 /** Cached data for each document */ 228 var expandoData = {}; 229 230 /** Detect whether the browser supports unknown elements */ 231 var supportsUnknownElements; 232 233 (function() { 234 try { 235 var a = document.createElement('a'); 236 a.innerHTML = '<xyz></xyz>'; 237 //if the hidden property is implemented we can assume, that the browser supports basic HTML5 Styles 238 supportsHtml5Styles = ('hidden' in a); 239 240 supportsUnknownElements = a.childNodes.length == 1 || (function() { 241 // assign a false positive if unable to shiv 242 (document.createElement)('a'); 243 var frag = document.createDocumentFragment(); 244 return ( 245 typeof frag.cloneNode == 'undefined' || 246 typeof frag.createDocumentFragment == 'undefined' || 247 typeof frag.createElement == 'undefined' 248 ); 249 }()); 250 } catch(e) { 251 // assign a false positive if detection fails => unable to shiv 252 supportsHtml5Styles = true; 253 supportsUnknownElements = true; 254 } 255 256 }()); 257 258 /*--------------------------------------------------------------------------*/ 259 260 /** 261 * Creates a style sheet with the given CSS text and adds it to the document. 262 * @private 263 * @param {Document} ownerDocument The document. 264 * @param {String} cssText The CSS text. 265 * @returns {StyleSheet} The style element. 266 */ 267 function addStyleSheet(ownerDocument, cssText) { 268 var p = ownerDocument.createElement('p'), 269 parent = ownerDocument.getElementsByTagName('head')[0] || ownerDocument.documentElement; 270 271 p.innerHTML = 'x<style>' + cssText + '</style>'; 272 return parent.insertBefore(p.lastChild, parent.firstChild); 273 } 274 275 /** 276 * Returns the value of `html5.elements` as an array. 277 * @private 278 * @returns {Array} An array of shived element node names. 279 */ 280 function getElements() { 281 var elements = html5.elements; 282 return typeof elements == 'string' ? elements.split(' ') : elements; 283 } 284 285 /** 286 * Extends the built-in list of html5 elements 287 * @memberOf html5 288 * @param {String|Array} newElements whitespace separated list or array of new element names to shiv 289 * @param {Document} ownerDocument The context document. 290 */ 291 function addElements(newElements, ownerDocument) { 292 var elements = html5.elements; 293 if(typeof elements != 'string'){ 294 elements = elements.join(' '); 295 } 296 if(typeof newElements != 'string'){ 297 newElements = newElements.join(' '); 298 } 299 html5.elements = elements +' '+ newElements; 300 shivDocument(ownerDocument); 301 } 302 303 /** 304 * Returns the data associated to the given document 305 * @private 306 * @param {Document} ownerDocument The document. 307 * @returns {Object} An object of data. 308 */ 309 function getExpandoData(ownerDocument) { 310 var data = expandoData[ownerDocument[expando]]; 311 if (!data) { 312 data = {}; 313 expanID++; 314 ownerDocument[expando] = expanID; 315 expandoData[expanID] = data; 316 } 317 return data; 318 } 319 320 /** 321 * returns a shived element for the given nodeName and document 322 * @memberOf html5 323 * @param {String}
vendor: 4,255 bytes, lines 323-450
323 nodeName name of the element 324 * @param {Document|DocumentFragment} ownerDocument The context document. 325 * @returns {Object} The shived element. 326 */ 327 function createElement(nodeName, ownerDocument, data){ 328 if (!ownerDocument) { 329 ownerDocument = document; 330 } 331 if(supportsUnknownElements){ 332 return ownerDocument.createElement(nodeName); 333 } 334 if (!data) { 335 data = getExpandoData(ownerDocument); 336 } 337 var node; 338 339 if (data.cache[nodeName]) { 340 node = data.cache[nodeName].cloneNode(); 341 } else if (saveClones.test(nodeName)) { 342 node = (data.cache[nodeName] = data.createElem(nodeName)).cloneNode(); 343 } else { 344 node = data.createElem(nodeName); 345 } 346 347 // Avoid adding some elements to fragments in IE < 9 because 348 // * Attributes like `name` or `type` cannot be set/changed once an element 349 // is inserted into a document/fragment 350 // * Link elements with `src` attributes that are inaccessible, as with 351 // a 403 response, will cause the tab/window to crash 352 // * Script elements appended to fragments will execute when their `src` 353 // or `text` property is set 354 return node.canHaveChildren && !reSkip.test(nodeName) && !node.tagUrn ? data.frag.appendChild(node) : node; 355 } 356 357 /** 358 * returns a shived DocumentFragment for the given document 359 * @memberOf html5 360 * @param {Document} ownerDocument The context document. 361 * @returns {Object} The shived DocumentFragment. 362 */ 363 function createDocumentFragment(ownerDocument, data){ 364 if (!ownerDocument) { 365 ownerDocument = document; 366 } 367 if(supportsUnknownElements){ 368 return ownerDocument.createDocumentFragment(); 369 } 370 data = data || getExpandoData(ownerDocument); 371 var clone = data.frag.cloneNode(), 372 i = 0, 373 elems = getElements(), 374 l = elems.length; 375 for(;i<l;i++){ 376 clone.createElement(elems[i]); 377 } 378 return clone; 379 } 380 381 /** 382 * Shivs the `createElement` and `createDocumentFragment` methods of the document. 383 * @private 384 * @param {Document|DocumentFragment} ownerDocument The document. 385 * @param {Object} data of the document. 386 */ 387 function shivMethods(ownerDocument, data) { 388 if (!data.cache) { 389 data.cache = {}; 390 data.createElem = ownerDocument.createElement; 391 data.createFrag = ownerDocument.createDocumentFragment; 392 data.frag = data.createFrag(); 393 } 394 395 396 ownerDocument.createElement = function(nodeName) { 397 //abort shiv 398 if (!html5.shivMethods) { 399 return data.createElem(nodeName); 400 } 401 return createElement(nodeName, ownerDocument, data); 402 }; 403 404 ownerDocument.createDocumentFragment = Function('h,f', 'return function(){' + 405 'var n=f.cloneNode(),c=n.createElement;' + 406 'h.shivMethods&&(' + 407 // unroll the `createElement` calls 408 getElements().join().replace(/[\w\-:]+/g, function(nodeName) { 409 data.createElem(nodeName); 410 data.frag.createElement(nodeName); 411 return 'c("' + nodeName + '")'; 412 }) + 413 ');return n}' 414 )(html5, data.frag); 415 } 416 417 /*--------------------------------------------------------------------------*/ 418 419 /** 420 * Shivs the given document. 421 * @memberOf html5 422 * @param {Document} ownerDocument The document to shiv. 423 * @returns {Document} The shived document. 424 */ 425 function shivDocument(ownerDocument) { 426 if (!ownerDocument) { 427 ownerDocument = document; 428 } 429 var data = getExpandoData(ownerDocument); 430 431 if (html5.shivCSS && !supportsHtml5Styles && !data.hasCSS) { 432 data.hasCSS = !!addStyleSheet(ownerDocument, 433 // corrects block display not defined in IE6/7/8/9 434 'article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}' + 435 // adds styling not present in IE6/7/8/9 436 'mark{background:#FF0;color:#000}' + 437 // hides non-rendered elements 438 'template{display:none}' 439 ); 440 } 441 if (!supportsUnknownElements) { 442 shivMethods(ownerDocument, data); 443 } 444 return ownerDocument; 445 } 446 447 /*--------------------------------------------------------------------------*/ 448 449 /** 450 * The `html5` object is exposed so that more elements can be shived and
451 * existing shiving can be detected on iframes. 452 * @type Object 453 * @example 454 * 455 * // options can be changed before the script is included 456 * html5 = { 'elements': 'mark section', 'shivCSS': false, 'shivMethods': false }; 457 */ 458 var html5 = { 459 460 /** 461 * An array or space separated string of node names of the elements to shiv. 462 * @memberOf html5 463 * @type Array|String 464 */ 465 'elements': options.elements || 'abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output picture progress section summary template time video', 466 467 /** 468 * current version of html5shiv 469 */ 470 'version': version, 471 472 /** 473 * A flag to indicate that the HTML5 style sheet should be inserted. 474 * @memberOf html5 475 * @type Boolean 476 */ 477 'shivCSS': (options.shivCSS !== false), 478 479 /** 480 * Is equal to true if a browser supports creating unknown/HTML5 elements 481 * @memberOf html5 482 * @type boolean 483 */ 484 'supportsUnknownElements': supportsUnknownElements, 485 486 /** 487 * A flag to indicate that the document's `createElement` and `createDocumentFragment` 488 * methods should be overwritten. 489 * @memberOf html5 490 * @type Boolean 491 */ 492 'shivMethods': (options.shivMethods !== false), 493 494 /** 495 * A string to describe the type of `html5` object ("default" or "default print"). 496 * @memberOf html5
497 * @type String 498 */ 499 'type': 'default', 500 501 // shivs the document according to the specified `html5` object options 502 'shivDocument': shivDocument, 503 504 //creates a shived element 505 createElement: createElement, 506 507 //creates a shived documentFragment 508 createDocumentFragment: createDocumentFragment, 509 510 //extends list of elements 511 addElements: addElements 512 }; 513 514 /*--------------------------------------------------------------------------*/ 515 516 // expose html5 517 window.html5 = html5; 518 519 // shiv the document 520 shivDocument(document); 521 522 if(typeof module == 'object' && module.exports){ 523 module.exports = html5; 524 } 525 526}(typeof window !== "undefined" ? window : this, document));;
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.