load canceled: fix 'loading canceled' message not displaying, add 'try again' button to non-embed mode as well
This commit is contained in:
@@ -980,6 +980,7 @@ const tt=new WeakMap,it=v(e=>t=>{if(!(t instanceof T))throw new Error("unsafeHTM
|
||||
<div>
|
||||
${this.embed?q`
|
||||
<a class="button is-warning" @click=${e=>window.parent.location.reload()}>Try Again</a>`:q`
|
||||
<a class="button is-warning" @click=${e=>window.location.reload()}>Try Again</a>
|
||||
<a href="/" class="button is-warning">Back</a>`}
|
||||
</div>`;case"waiting":default:return q`<progress class="progress is-primary is-large" style="max-width: 400px"/>`}}});var st=i(101),lt=i.n(st);const ct=new RegExp(`[${["-","[","]","/","{","}","(",")","*","+","?",".","\\","^","$","|"].join("\\")}]`,"g"),dt=e=>e.replace(ct,"\\$&");class ht extends HTMLElement{static get observedAttributes(){return["keywords"]}get keywords(){return this.getAttribute("keywords")||""}set keywords(e){this.setAttribute("keywords",e)}constructor(){super(),this.attachShadow({mode:"open"})}attributeChangedCallback(e,t,i){"keywords"===e&&i!==t&&this._render()}connectedCallback(){this._render(),this.__observer=new MutationObserver(()=>{this._render()}),this.__observer.observe(this,{childList:!0,characterData:!0,subtree:!0})}disconnectedCallback(){this.__observer&&(this.__observer.disconnect(),this.__observer=void 0)}_render(){if(!this.shadowRoot)return;const e=this.textContent||"",t=this.getAttribute("keywords");if(!t)return void(this.shadowRoot.textContent=e);const i=e.toLowerCase(),a=t.toLowerCase().split(/\s+/),o=new RegExp(""+a.map(dt).join("|"),"gi"),r=e.split(o),n=document.createElement("div");let s=0;for(const t of r)if(n.appendChild(document.createTextNode(t)),s+=t.length,s<i.length){const t=i.substring(s),o=a.find(e=>t.startsWith(e));if(o){const t=document.createElement("mark");t.textContent=e.substr(s,o.length),n.appendChild(t),s+=o.length}}this.shadowRoot.innerHTML=`\n <style>\n mark {\n color: var(--keyword-mark-color);\n background: var(--keyword-mark-background, yellow);\n }\n </style>\n ${n.innerHTML}\n `}}customElements.define("keyword-mark",ht);var ft=i(102),bt=i.n(ft);class ut extends ie{constructor(){super(),this.filteredPages=[],this.sortedPages=[],this.query="",this.flex=null,this.newQuery=null,this.loading=!1,this.currList=0,this.active=!1,this.editable=!1,this.changeNeeded=!1,this.selectedPages=new Set}static get sortKeys(){return[{key:"title",name:"Title"},{key:"ts",name:"Date"}]}static get properties(){return{active:{type:Boolean},collInfo:{type:Object},currList:{type:Number},filteredPages:{type:Array},sortedPages:{type:Array},query:{type:String},loading:{type:Boolean},editable:{type:Boolean},selectedPages:{type:Set},allSelected:{type:Boolean}}}_timedUpdate(){null!==this.newQuery&&(this.query=this.newQuery,this.newQuery=null,this.filter())}updated(e){e.has("collInfo")?(this.updateTextSearch(),this.filter()):(e.has("query")||e.has("currList"))&&this.filter(),e.has("active")&&this.active&&this.changeNeeded&&this.filter()}onChangeQuery(e){this.newQuery=e.currentTarget.value,this._ival&&window.clearTimeout(this._ival),this._ival=window.setTimeout(()=>this._timedUpdate(),250)}async filter(){if(this.loading)return;if(this.active||(this.changeNeeded=!0),this.loading=!0,this.flex&&this.query){const e=await this.flex.search(this.query);this.filteredPages=e}else this.filteredPages=[...this.collInfo.pages];0!==this.currList&&await this.filterCurated(),this.loading=!1,this.changeNeeded=!1;const e={query:this.query,currList:this.currList};this.sendChangeEvent(e)}async filterCurated(){const e=await fetch(`${this.collInfo.apiPrefix}/curated/${this.currList}`),t=await e.json();this.sortedPages=[];for(const e of t.curated)for(const t of this.filteredPages)if(t.id===e.page){this.sortedPages.push(t);break}}sendChangeEvent(e){this.dispatchEvent(new CustomEvent("coll-tab-nav",{detail:{data:e}}))}updateTextSearch(){this.flex=new lt.a({doc:{id:"id",field:["url","title","text"]},async:!0}),this.flex.add(this.collInfo.pages)}static get styles(){return be(ee`
|
||||
:host {
|
||||
|
||||
Reference in New Issue
Block a user