PageSourceSearch

https://opensource.com/themes/osdc/node_modules/%40patternfly/pfe-readtime/dist/pfe-readtime.min.js?sqka6y

js opensource.com collected 2026-09-24 06:45:47 UTC 3,894 bytes, 26 lines download raw bytes

1import e from"../../pfelement/dist/pfelement.min.js";
2/*!
3 * PatternFly Elements: PfeReadtime 1.12.3
4 * @license
5 * Copyright 2021 Red Hat, LLC
6 * 
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to deal
9 * in the Software without restriction, including without limitation the rights
10 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 * copies of the Software, and to permit persons to whom the Software is
12 * furnished to do so, subject to the following conditions:
13 * 
14 * The above copyright notice and this permission notice shall be included in
15 * all copies or substantial portions of the Software.
16 * 
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 * SOFTWARE.
24 * 
25*/function t(e){switch(e){case"en":case"ko":return 228;case"zh":return 158;case"fr":return 195;case"ja":return 193;case"de":return 179;case"it":return 188;case"pt-br":return 181;case"es":return 218;default:return 228}}class r extends e{static get version(){return"1.12.3"}get html(){return`\n<style>:host{font-size:1rem;font-size:var(--pfe-readtime--FontSize,var(--pf-global--FontSize--md,1rem))}:host([hidden]){display:none} /*# sourceMappingURL=pfe-readtime.min.css.map */</style>\n<span class="pfe-readtime__text">${this.readString}</span>`}static get tag(){return"pfe-readtime"}static get meta(){return{title:"Readtime",description:"This element will collect a word count on a given section and calculate the readtime based on that count."}}get templateUrl(){return"pfe-readtime.html"}get styleUrl(){return"pfe-readtime.scss"}static get PfeType(){return e.PfeTypes.Content}static get properties(){return{wpm:{title:"Words per minute",type:Number,default:e=>t(e._lang),observer:"render"},wordCount:{title:"Number of words in the content",type:Number,default:0,observer:"render"},templateString:{title:"Template for printing the readtime",description:"Translatable string for printing out the readtime in a readable format. Use %t as a stand-in for the calculated value.",attr:"template",type:String,default:e=>e.textContent.trim()||"%t-minute readtime",observer:"render"},_lang:{title:"Language of content",type:String,attr:"lang",enum:["en","ko","zh","fr","ja","de","it","pt-br","es"],default:()=>document.documentElement.lang||"en",observer:"_langChangedHandler"},for:{title:"Element containing content",type:String,observer:"_forChangeHandler"}}}get readtime(){return Math.floor(this.wordCount/this.wpm)||0}get readString(){if(!(this.readtime<=0))return this.removeAttribute("hidden"),this.templateString&&this.templateString.match(/%t/)?this.templateString.replace("%t",this.readtime):`${this.readtime}${this.templateString}`;this.setAttribute("hidden","")}constructor(){super(r,{type:r.PfeType,delayRender:!0}),this._forChangeHandler=this._forChangeHandler.bind(this),this._langChangedHandler=this._langChangedHandler.bind(this)}connectedCallback(){super.connectedCallback(),this.render()}_forChangeHandler(e,t){if(t===e)return;const r=document.querySelector(t)||document.querySelector("#"+t);if(r){if(this.content=r,r.hasAttribute("word-count")){const e=r.getAttribute("word-count");Number(e)>=0&&(this.wordCount=Number(e))}else r.textContent.trim()&&(this.wordCount=r.textContent.split(/\b\w+\b/).length);this.render()}}_langChangedHandler(e,r){r!==e&&(this.wpm=t(r),this.render())}}e.create(r);export default r;
26//# sourceMappingURL=pfe-readtime.min.js.map

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.