replaywebpage 2.3.0 → 2.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/adblock/adblock.gz +0 -0
- package/dist/index.js +3 -3
- package/dist/preload.js +2 -2
- package/dist/sw.js +2 -2
- package/dist/types/pages.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/pages.ts +9 -10
- package/sw.js +2 -2
- package/ui.js +3 -3
package/adblock/adblock.gz
CHANGED
|
Binary file
|
package/dist/index.js
CHANGED
|
@@ -66,7 +66,7 @@ class Le extends Ie{constructor(e){if(super(e),this.it=X,e.type!==ze)throw Error
|
|
|
66
66
|
* Copyright 2017 Google LLC
|
|
67
67
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
68
68
|
*/
|
|
69
|
-
class Ae extends Le{}Ae.directiveName="unsafeSVG",Ae.resultType=2;const Te=Ce(Ae),Pe="important",De=" !"+Pe,Fe=Ce(class extends Ie{constructor(e){if(super(e),e.type!==$e||"style"!==e.name||e.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(e){return Object.keys(e).reduce(((t,i)=>{const o=e[i];return null==o?t:t+`${i=i.includes("-")?i:i.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${o};`}),"")}update(e,[t]){const{style:i}=e.element;if(void 0===this.ft)return this.ft=new Set(Object.keys(t)),this.render(t);for(const e of this.ft)null==t[e]&&(this.ft.delete(e),e.includes("-")?i.removeProperty(e):i[e]=null);for(const e in t){const o=t[e];if(null!=o){this.ft.add(e);const t="string"==typeof o&&o.endsWith(De);e.includes("-")||t?i.setProperty(e,t?o.slice(0,-11):o,t?Pe:""):i[e]=o}}return J}});var Me,Re=__webpack_require__(989);const Oe="./w/api",Ue="./w",Be=d(Re.A);function Ne(e){return[Be,e]}const qe=window.IS_APP||(null===(Me=window.electron)||void 0===Me?void 0:Me.IS_APP)||window.matchMedia("(display-mode: standalone)").matches,je="2.3.
|
|
69
|
+
class Ae extends Le{}Ae.directiveName="unsafeSVG",Ae.resultType=2;const Te=Ce(Ae),Pe="important",De=" !"+Pe,Fe=Ce(class extends Ie{constructor(e){if(super(e),e.type!==$e||"style"!==e.name||e.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(e){return Object.keys(e).reduce(((t,i)=>{const o=e[i];return null==o?t:t+`${i=i.includes("-")?i:i.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${o};`}),"")}update(e,[t]){const{style:i}=e.element;if(void 0===this.ft)return this.ft=new Set(Object.keys(t)),this.render(t);for(const e of this.ft)null==t[e]&&(this.ft.delete(e),e.includes("-")?i.removeProperty(e):i[e]=null);for(const e in t){const o=t[e];if(null!=o){this.ft.add(e);const t="string"==typeof o&&o.endsWith(De);e.includes("-")||t?i.setProperty(e,t?o.slice(0,-11):o,t?Pe:""):i[e]=o}}return J}});var Me,Re=__webpack_require__(989);const Oe="./w/api",Ue="./w",Be=d(Re.A);function Ne(e){return[Be,e]}const qe=window.IS_APP||(null===(Me=window.electron)||void 0===Me?void 0:Me.IS_APP)||window.matchMedia("(display-mode: standalone)").matches,je="2.3.2";function He(e){" "==e.key&&(e.preventDefault(),e.target.click())}function We(e){const t=document.querySelector("head"),i=document.querySelectorAll("link[rel*='icon']");for(const e of i)t.removeChild(e);for(const i of e.icons){const e=document.createElement("link");e.rel=i.rel,e.href=i.href,t.appendChild(e)}}class Ve extends me{constructor(){super(),this.size="1.1em",this.width=null,this.height=null}static get properties(){return{svg:{type:String},size:{type:String},width:{type:String},height:{type:String}}}static get styles(){return h`
|
|
70
70
|
:host {
|
|
71
71
|
display: inline-block;
|
|
72
72
|
padding: 0;
|
|
@@ -2302,7 +2302,7 @@ function*(e,t){if(void 0!==e){let i=0;for(const o of e)yield t(o,i++)}}(e.resour
|
|
|
2302
2302
|
|
|
2303
2303
|
${this.extraMsg&&Q` <p class="extra-msg">(${this.extraMsg})</p> `}
|
|
2304
2304
|
</div>`:Q``}
|
|
2305
|
-
`}onAskPermission(){var e;return i(this,void 0,void 0,(function*(){"granted"===(yield null===(e=this.fileHandle)||void 0===e?void 0:e.requestPermission({mode:"read"}))&&this.doLoad()}))}}t([ye({type:String})],fo.prototype,"sourceUrl",void 0),t([ye({type:Object})],fo.prototype,"loadInfo",void 0),t([ye({type:String})],fo.prototype,"state",void 0),t([ye({type:Number})],fo.prototype,"progress",void 0),t([ye({type:Number})],fo.prototype,"percent",void 0),t([ye({type:Number})],fo.prototype,"currentSize",void 0),t([ye({type:Number})],fo.prototype,"totalSize",void 0),t([ye({type:String})],fo.prototype,"error",void 0),t([ye({type:Number})],fo.prototype,"total",void 0),t([ye({type:String})],fo.prototype,"status",void 0),t([ye({type:String})],fo.prototype,"coll",void 0),t([ye({type:String})],fo.prototype,"embed",void 0),t([ye({type:Boolean})],fo.prototype,"tryFileHandle",void 0),t([ye({type:Boolean})],fo.prototype,"errorAllowRetry",void 0),t([ye({type:String})],fo.prototype,"extraMsg",void 0),t([ye({type:String})],fo.prototype,"swName",void 0),customElements.define("wr-loader",fo);var mo=__webpack_require__(563),bo=__webpack_require__.n(mo),go=__webpack_require__(112);class vo extends me{constructor(){super(...arguments),this.filteredPages=[],this.sortedPages=[],this.query="",this.flex=null,this.textPages=null,this.newQuery=null,this.loading=!1,this.updatingSearch=!1,this.showAllPages=!1,this.hasExtraPages=!1,this.currList=0,this.active=!1,this.editable=!1,this.changeNeeded=!1,this.selectedPages=new Set,this.menuActive=!1,this.sortKey="date",this.sortDesc=!0,this.isSidebar=!1,this.url="",this.ts="",this.editing=!1,this.toDeletePages=null,this.toDeletePage=null,this.collInfo=null,this.allSelected=!1,this.defaultKey="",this.dynamicPagesQuery=!1,this.totalPages=0,this.dynamicPageCount=1,this.skipScrollMore=!1}static get sortKeys(){return[{key:"",name:"Best Match"},{key:"title",name:"Title"},{key:"date",name:"Date"}]}_timedUpdate(){null!==this.newQuery&&(this.query=this.newQuery,this.newQuery=null,this.filter())}updated(e){return i(this,void 0,void 0,(function*(){if(e.has("collInfo")?this.updateTextSearch():(e.has("query")||e.has("currList")||e.has("showAllPages"))&&this.filter(),e.has("active")&&this.active&&this.changeNeeded&&this.filter(),e.has("query")){this.query?(this.sortKey="",this.sortDesc=!1):(this.sortKey="date",this.sortDesc=!0);const e=this.renderRoot.querySelector("wr-sorter");e&&(e.sortKey=this.sortKey,e.sortDesc=this.sortDesc)}if(e.has("sortedPages")&&this.isSidebar){const e=this.renderRoot.querySelector(".current");if(e){const t={behavior:"smooth",block:"nearest",inline:"nearest"};setTimeout((()=>e.scrollIntoView(t)),100)}}}))}onChangeQuery(e){this.newQuery=e.currentTarget.value,this._ival&&window.clearTimeout(this._ival),this._ival=window.setTimeout((()=>this._timedUpdate()),250)}filter(){return i(this,void 0,void 0,(function*(){if(this.loading)return;if(this.active||(this.changeNeeded=!0),this.loading=!0,this.flex&&this.query&&this.textPages){const e=yield this.flex.searchAsync(this.query,25);this.filteredPages=e.map((e=>this.textPages[e]))}else this.showAllPages&&this.hasExtraPages?this.filteredPages=[...this.textPages]:this.dynamicPagesQuery||(this.filteredPages=[...this.collInfo.pages]);if(this.totalPages=this.filteredPages.length,this.dynamicPagesQuery){if(
|
|
2305
|
+
`}onAskPermission(){var e;return i(this,void 0,void 0,(function*(){"granted"===(yield null===(e=this.fileHandle)||void 0===e?void 0:e.requestPermission({mode:"read"}))&&this.doLoad()}))}}t([ye({type:String})],fo.prototype,"sourceUrl",void 0),t([ye({type:Object})],fo.prototype,"loadInfo",void 0),t([ye({type:String})],fo.prototype,"state",void 0),t([ye({type:Number})],fo.prototype,"progress",void 0),t([ye({type:Number})],fo.prototype,"percent",void 0),t([ye({type:Number})],fo.prototype,"currentSize",void 0),t([ye({type:Number})],fo.prototype,"totalSize",void 0),t([ye({type:String})],fo.prototype,"error",void 0),t([ye({type:Number})],fo.prototype,"total",void 0),t([ye({type:String})],fo.prototype,"status",void 0),t([ye({type:String})],fo.prototype,"coll",void 0),t([ye({type:String})],fo.prototype,"embed",void 0),t([ye({type:Boolean})],fo.prototype,"tryFileHandle",void 0),t([ye({type:Boolean})],fo.prototype,"errorAllowRetry",void 0),t([ye({type:String})],fo.prototype,"extraMsg",void 0),t([ye({type:String})],fo.prototype,"swName",void 0),customElements.define("wr-loader",fo);var mo=__webpack_require__(563),bo=__webpack_require__.n(mo),go=__webpack_require__(112);class vo extends me{constructor(){super(...arguments),this.filteredPages=[],this.sortedPages=[],this.query="",this.flex=null,this.textPages=null,this.newQuery=null,this.loading=!1,this.updatingSearch=!1,this.showAllPages=!1,this.hasExtraPages=!1,this.currList=0,this.active=!1,this.editable=!1,this.changeNeeded=!1,this.selectedPages=new Set,this.menuActive=!1,this.sortKey="date",this.sortDesc=!0,this.isSidebar=!1,this.url="",this.ts="",this.editing=!1,this.toDeletePages=null,this.toDeletePage=null,this.collInfo=null,this.allSelected=!1,this.defaultKey="",this.dynamicPagesQuery=!1,this.totalPages=0,this.dynamicPageCount=1,this.skipScrollMore=!1}static get sortKeys(){return[{key:"",name:"Best Match"},{key:"title",name:"Title"},{key:"date",name:"Date"}]}_timedUpdate(){null!==this.newQuery&&(this.query=this.newQuery,this.newQuery=null,this.filter())}updated(e){return i(this,void 0,void 0,(function*(){if(e.has("collInfo")?this.updateTextSearch():(e.has("query")||e.has("currList")||e.has("showAllPages"))&&this.filter(),e.has("active")&&this.active&&this.changeNeeded&&this.filter(),e.has("query")){this.query?(this.sortKey="",this.sortDesc=!1):(this.sortKey="date",this.sortDesc=!0);const e=this.renderRoot.querySelector("wr-sorter");e&&(e.sortKey=this.sortKey,e.sortDesc=this.sortDesc)}if(e.has("sortedPages")&&this.isSidebar){const e=this.renderRoot.querySelector(".current");if(e){const t={behavior:"smooth",block:"nearest",inline:"nearest"};setTimeout((()=>e.scrollIntoView(t)),100)}}}))}onChangeQuery(e){this.newQuery=e.currentTarget.value,this._ival&&window.clearTimeout(this._ival),this._ival=window.setTimeout((()=>this._timedUpdate()),250)}filter(){return i(this,void 0,void 0,(function*(){if(this.loading)return;if(this.active||(this.changeNeeded=!0),this.loading=!0,this.flex&&this.query&&this.textPages){const e=yield this.flex.searchAsync(this.query,25);this.filteredPages=e.map((e=>this.textPages[e]))}else this.showAllPages&&this.hasExtraPages?this.filteredPages=[...this.textPages]:this.dynamicPagesQuery||(this.filteredPages=[...this.collInfo.pages]);if(this.totalPages=this.filteredPages.length,this.dynamicPagesQuery){if(this.query)this.hasExtraPages=!1;else{const e=this.collInfo.pages.filter((e=>e.isSeed));this.filteredPages=this.showAllPages||!e.length?[...this.collInfo.pages]:e,this.hasExtraPages=e.length<this.collInfo.pages.length}this.dynamicPageCount=1,yield this.addDynamicPages()}0!==this.currList&&(yield this.filterCurated());for(const e of this.filteredPages){const{timestamp:t,date:i}=bt(e);if(null==i)throw new Error("Page date is null");e.timestamp=t,e.date=i}this.loading=!1,this.changeNeeded=!1;const e={query:this.query,currList:this.currList};this.sendChangeEvent(e)}))}addDynamicPages(){return i(this,void 0,void 0,(function*(){const e=new URLSearchParams;this.query&&e.set("search",this.query),e.set("page",this.dynamicPageCount+""),e.set("pageSize","25");const t=yield fetch(`${this.collInfo.apiPrefix}/pages?${e.toString()}`),i=yield t.json();if(!i.pages)return;i.pages.length||(this.skipScrollMore=!0);const o=new Set;this.filteredPages.forEach((e=>o.add(e.id)));const n=[];for(const{id:e,url:t,title:r,mime:s,status:a,ts:l,favIconUrl:c,waczhash:d,isSeed:h}of i.pages){if(o.has(e))continue;if(!this.showAllPages&&this.hasExtraPages&&!this.query&&!h)continue;let i;i="string"==typeof l?new Date(l).getTime():l;const u={id:e,url:t,title:r,mime:s,status:a,ts:i,favIconUrl:c,waczhash:d};n.push(u)}n.length&&(this.filteredPages=[...this.filteredPages,...n]),this.totalPages=this.filteredPages.length}))}filterCurated(){return i(this,void 0,void 0,(function*(){const e=yield fetch(`${this.collInfo.apiPrefix}/curated/${this.currList}`),t=(yield e.json()).curated;this.filteredPages=t}))}sendChangeEvent(e){this.dispatchEvent(new CustomEvent("coll-tab-nav",{detail:{data:e}}))}addPages(e){var t;const i=new go.Index;return this.flex=i,this.textPages=e,this.dynamicPagesQuery||(this.hasExtraPages=Boolean(this.textPages&&(null===(t=this.collInfo)||void 0===t?void 0:t.pages)&&this.textPages.length>this.collInfo.pages.length)),this.collInfo&&(this.dynamicPagesQuery=this.collInfo.canQueryPages||!1),Promise.all(e.map(((e,t)=>{let o=e.url;return e.title&&(o+=" "+e.title),e.text&&(o+=" "+e.text),i.addAsync(t,o)})))}updateTextSearch(){var e,t,o,r;return i(this,void 0,void 0,(function*(){if(this.updatingSearch)return;this.updatingSearch=!0;let i=0;try{const c=yield caches.open("cache:"+this.collInfo.coll),d=`${this.collInfo.apiPrefix}/textIndex`;let h=yield c.match(d);h&&Number(h.headers.get("Content-Length"))||(h=yield fetch(d),200===h.status&&Number(h.headers.get("Content-Length"))&&c.put(d,h.clone()));const u=[];try{for(var s,a=!0,l=n(bo()(h.body.getReader()));s=yield l.next(),!(e=s.done);a=!0){r=s.value,a=!1;const e=r;e.url&&(e.id=++i,u.push(e))}}catch(e){t={error:e}}finally{try{a||e||!(o=l.return)||(yield o.call(l))}finally{if(t)throw t.error}}yield this.addPages(u)}catch(e){console.warn(e)}finally{0===i&&(yield this.addPages(this.collInfo.pages)),this.updatingSearch=!1}yield this.filter()}))}static get styles(){return Ne(h`
|
|
2306
2306
|
:host {
|
|
2307
2307
|
width: 100%;
|
|
2308
2308
|
flex: 1 1 auto;
|
|
@@ -2835,7 +2835,7 @@ function*(e,t){if(void 0!==e){let i=0;for(const o of e)yield t(o,i++)}}(e.resour
|
|
|
2835
2835
|
>`:"No Pages Found":Q`<span class="fix-text-wrapping"
|
|
2836
2836
|
>No Pages are defined in this archive. The archive may be empty.
|
|
2837
2837
|
<a href="#view=resources">Try browsing by URL</a>.</span
|
|
2838
|
-
>`}onScroll(e){return i(this,void 0,void 0,(function*(){const t=e.currentTarget;if(t.scrollHeight-t.scrollTop-t.clientHeight<40&&!this.skipScrollMore){this.skipScrollMore=!0,this.dynamicPagesQuery&&
|
|
2838
|
+
>`}onScroll(e){return i(this,void 0,void 0,(function*(){const t=e.currentTarget;if(t.scrollHeight-t.scrollTop-t.clientHeight<40&&!this.skipScrollMore){this.skipScrollMore=!0,this.dynamicPagesQuery&&(this.dynamicPageCount+=1,yield this.addDynamicPages());const e=this.renderRoot.querySelector("wr-sorter");e&&e.getMore(25)}}))}}t([ye({type:Array})],vo.prototype,"filteredPages",void 0),t([ye({type:Array})],vo.prototype,"sortedPages",void 0),t([ye({type:String})],vo.prototype,"query",void 0),t([ye({attribute:!1})],vo.prototype,"flex",void 0),t([ye({attribute:!1})],vo.prototype,"textPages",void 0),t([ye()],vo.prototype,"newQuery",void 0),t([ye({type:Boolean})],vo.prototype,"loading",void 0),t([ye({type:Boolean})],vo.prototype,"updatingSearch",void 0),t([ye({type:Boolean})],vo.prototype,"showAllPages",void 0),t([ye({type:Boolean})],vo.prototype,"hasExtraPages",void 0),t([ye({type:Number})],vo.prototype,"currList",void 0),t([ye({type:Boolean})],vo.prototype,"active",void 0),t([ye({type:Boolean})],vo.prototype,"editable",void 0),t([ye({type:Boolean})],vo.prototype,"changeNeeded",void 0),t([ye({attribute:!1})],vo.prototype,"selectedPages",void 0),t([ye({type:Boolean})],vo.prototype,"menuActive",void 0),t([ye({type:String})],vo.prototype,"sortKey",void 0),t([ye({type:Boolean})],vo.prototype,"sortDesc",void 0),t([ye({type:Boolean})],vo.prototype,"isSidebar",void 0),t([ye({type:String})],vo.prototype,"url",void 0),t([ye({type:String})],vo.prototype,"ts",void 0),t([ye({type:Boolean})],vo.prototype,"editing",void 0),t([ye({type:Array})],vo.prototype,"toDeletePages",void 0),t([ye({type:Object})],vo.prototype,"toDeletePage",void 0),t([ye({type:Object})],vo.prototype,"collInfo",void 0),t([ye({type:Boolean})],vo.prototype,"allSelected",void 0),t([ye({type:String})],vo.prototype,"defaultKey",void 0),t([ye({type:Boolean})],vo.prototype,"dynamicPagesQuery",void 0),t([ye({type:Number})],vo.prototype,"totalPages",void 0),t([ye({type:Number})],vo.prototype,"dynamicPageCount",void 0),t([ye({type:Boolean})],vo.prototype,"skipScrollMore",void 0),customElements.define("wr-page-view",vo);const wo=new RegExp(`[${["-","[","]","/","{","}","(",")","*","+","?",".","\\","^","$","|"].join("\\")}]`,"g"),yo=e=>e.replace(wo,"\\$&");class xo extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}static get observedAttributes(){return["keywords","delimiter"]}get keywords(){var e;return null!==(e=this.getAttribute("keywords"))&&void 0!==e?e:""}set keywords(e){this.setAttribute("keywords",e)}get delimiter(){var e;return null!==(e=this.getAttribute("delimiter"))&&void 0!==e?e:""}set delimiter(e){this.setAttribute("delimiter",e)}attributeChangedCallback(e,t,i){"keywords"!==e&&"delimiter"!==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"),i=this.getAttribute("delimiter")||/\s+/;if(!t)return void(this.shadowRoot.textContent=e);const o=e.toLowerCase(),n=t.toLowerCase().split(i).sort(((e,t)=>t.length-e.length)),r=new RegExp(`${n.map(yo).join("|")}`,"gi"),s=e.split(r),a=document.createElement("div");let l=0;for(const t of s)if(a.appendChild(document.createTextNode(t)),l+=t.length,l<o.length){const t=o.substring(l),i=n.find((e=>t.startsWith(e)));if(i){const t=document.createElement("mark");t.textContent=e.substr(l,i.length),a.appendChild(t),l+=i.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 ${a.innerHTML}\n `}}customElements.define("keyword-mark",xo);class ko extends me{constructor(){super(...arguments),this.query="",this.textSnippet="",this.page=null,this.replayPrefix="",this.deleting=!1,this.selected=!1,this.editable=!1,this.index=0,this.isCurrent=!1,this.isSidebar=!1,this.thumbnailValid=!0,this.iconValid=!0}static get styles(){return Ne(h`
|
|
2839
2839
|
:host {
|
|
2840
2840
|
min-height: min-content;
|
|
2841
2841
|
width: 100%;
|