load canceled: fix 'loading canceled' message not displaying, add 'try again' button to non-embed mode as well

This commit is contained in:
Ilya Kreymer
2020-07-03 17:55:26 -07:00
parent 3e99ec2378
commit 34585550b6
4 changed files with 25 additions and 2 deletions
+1
View File
@@ -228,6 +228,7 @@ You can select a file to upload from the main page by clicking the \'Choose File
<div>
${this.embed ? html`
<a class="button is-warning" @click=${(e) => window.parent.location.reload()}>Try Again</a>` : html`
<a class="button is-warning" @click=${(e) => window.location.reload()}>Try Again</a>
<a href="/" class="button is-warning">Back</a>`}
</div>`;
+1 -1
View File
File diff suppressed because one or more lines are too long
+1
View File
@@ -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 {
+22 -1
View File
@@ -291,9 +291,30 @@
"@webassemblyjs/wast-parser" "1.9.0"
"@xtuc/long" "4.2.2"
"@webrecorder/wabac@^2.0.1":
version "2.0.1"
resolved "https://registry.yarnpkg.com/@webrecorder/wabac/-/wabac-2.0.1.tgz#0482593ea79799680890665b738911246f938954"
integrity sha512-KgI4UI3eYN2x3Z6G0lHKCZvoi2dV4rTPFDL0JJAQluw39/K6jezrGz0NRMoP/AbV3Yb/R64P6Xhu2PAdSuBZ8w==
dependencies:
brotli "github:foliojs/brotli.js"
fast-xml-parser "^3.15.1"
http-status-codes "^1.4.0"
idb "^5.0.1"
js-yaml "^3.13.1"
json-2-csv "^3.7.1"
jszip "^3.4.0"
pako "^1.0.10"
parse5-html-rewriting-stream "^6.0.0"
parse5-sax-parser "^6.0.0"
path-parser "^6.1.0"
unescape-js "^1.1.4"
warcio "^1.2.0"
wbn "^0.0.3"
wombat "github:webrecorder/wombat"
"@webrecorder/wabac@github:webrecorder/wabac.js":
version "2.0.2"
resolved "https://codeload.github.com/webrecorder/wabac.js/tar.gz/f84a2013c408fb6627e92e9365dae4e1b954fbb9"
resolved "https://codeload.github.com/webrecorder/wabac.js/tar.gz/1368c64010fc451fac9f532d53f3ebd5ffda2569"
dependencies:
brotli "github:foliojs/brotli.js"
fast-xml-parser "^3.15.1"