diff --git a/src/coll.js b/src/coll.js index e9bf5ee..fb62329 100644 --- a/src/coll.js +++ b/src/coll.js @@ -1,7 +1,7 @@ import { LitElement, html, css } from 'lit-element'; import { wrapCss, rwpLogo, IS_APP } from './misc'; -import { sourceToId } from './pageutils'; +import { sourceToId, tsToDate } from './pageutils'; import fasBook from '@fortawesome/fontawesome-free/svgs/solid/book.svg'; @@ -9,10 +9,7 @@ import farListAlt from '@fortawesome/fontawesome-free/svgs/regular/list-alt.svg' import farResources from '@fortawesome/fontawesome-free/svgs/solid/puzzle-piece.svg'; import farPages from '@fortawesome/fontawesome-free/svgs/regular/file-image.svg'; -import { tsToDate } from './pageutils'; - import fasRefresh from '@fortawesome/fontawesome-free/svgs/solid/redo-alt.svg'; -import fasSearch from '@fortawesome/fontawesome-free/svgs/solid/search.svg'; import fasFullscreen from '@fortawesome/fontawesome-free/svgs/solid/desktop.svg'; import fasUnfullscreen from '@fortawesome/fontawesome-free/svgs/solid/compress-arrows-alt.svg'; @@ -21,7 +18,7 @@ import fasRight from '@fortawesome/fontawesome-free/svgs/solid/arrow-right.svg'; import fasMenuV from '@fortawesome/fontawesome-free/svgs/solid/ellipsis-v.svg'; -const RWP_SCHEME = "rwp://"; +const RWP_SCHEME = "search://"; // =========================================================================== diff --git a/src/pages.js b/src/pages.js index 853f5e3..4f9e013 100644 --- a/src/pages.js +++ b/src/pages.js @@ -46,7 +46,7 @@ class Pages extends LitElement return [ { "key": "", - "name": "Score", + "name": "Best Match", }, { "key": "title", @@ -191,9 +191,9 @@ class Pages extends LitElement let resp = await cache.match(indexUrl); - if (!resp) { + if (!resp || !Number(resp.headers.get("Content-Length"))) { resp = await fetch(`${this.collInfo.apiPrefix}/textIndex`); - if (resp.status === 200) { + if (resp.status === 200 && Number(resp.headers.get("Content-Length"))) { cache.put(indexUrl, resp.clone()); } } @@ -353,6 +353,7 @@ class Pages extends LitElement .mobile-header { margin: 0.5rem; + margin-left: 1.0rem; display: flex; justify-content: space-between; flex-direction: row; @@ -499,7 +500,7 @@ class Pages extends LitElement
${this.getNoResultsMessage()}
`}>>2),c[l++]=255&(r<<6|i<<1|n>>>4),c[l++]=255&(n<<4|s>>>1),c[l++]=255&(s<<7|o<<2|a>>>3),c[l++]=255&(a<<5|u);var m=d-p;return 2===m?(e=h[t.charAt(f++)],r=h[t.charAt(f++)],c[l++]=255&(e<<3|r>>>2)):4===m?(e=h[t.charAt(f++)],r=h[t.charAt(f++)],i=h[t.charAt(f++)],n=h[t.charAt(f++)],c[l++]=255&(e<<3|r>>>2),c[l++]=255&(r<<6|i<<1|n>>>4)):5===m?(e=h[t.charAt(f++)],r=h[t.charAt(f++)],i=h[t.charAt(f++)],n=h[t.charAt(f++)],s=h[t.charAt(f++)],c[l++]=255&(e<<3|r>>>2),c[l++]=255&(r<<6|i<<1|n>>>4),c[l++]=255&(n<<4|s>>>1)):7===m&&(e=h[t.charAt(f++)],r=h[t.charAt(f++)],i=h[t.charAt(f++)],n=h[t.charAt(f++)],s=h[t.charAt(f++)],o=h[t.charAt(f++)],a=h[t.charAt(f++)],c[l++]=255&(e<<3|r>>>2),c[l++]=255&(r<<6|i<<1|n>>>4),c[l++]=255&(n<<4|s>>>1),c[l++]=255&(s<<7|o<<2|a>>>3)),c},f=function(t,e){if(!e)return function(t){for(var e,r,i="",n=t.length,s=0,o=0;s >6,c[a++]=128|63&o):o<55296||o>=57344?(c[a++]=224|o>>12,c[a++]=128|o>>6&63,c[a++]=128|63&o):(o=65536+((1023&o)<<10|1023&t.charCodeAt(++d)),c[a++]=240|o>>18,c[a++]=128|o>>12&63,c[a++]=128|o>>6&63,c[a++]=128|63&o);a-f,f=a-5,d===p&&++d,d>p&&a<6&&(h=!0),e=c[0],a>4?(r=c[1],i=c[2],n=c[3],s=c[4],l+=u[e>>>3]+u[31&(e<<2|r>>>6)]+u[r>>>1&31]+u[31&(r<<4|i>>>4)]+u[31&(i<<1|n>>>7)]+u[n>>>2&31]+u[31&(n<<3|s>>>5)]+u[31&s]):1===a?l+=u[e>>>3]+u[e<<2&31]+"======":2===a?(r=c[1],l+=u[e>>>3]+u[31&(e<<2|r>>>6)]+u[r>>>1&31]+u[r<<4&31]+"===="):3===a?(r=c[1],i=c[2],l+=u[e>>>3]+u[31&(e<<2|r>>>6)]+u[r>>>1&31]+u[31&(r<<4|i>>>4)]+u[i<<1&31]+"==="):(r=c[1],i=c[2],n=c[3],l+=u[e>>>3]+u[31&(e<<2|r>>>6)]+u[r>>>1&31]+u[31&(r<<4|i>>>4)]+u[31&(i<<1|n>>>7)]+u[n>>>2&31]+u[n<<3&31]+"=")}while(!h);return l}(t)},decode:f};f.asBytes=d,o?t.exports=p:(s.base32=p,a&&(void 0===(n=function(){return p}.call(p,r,p,t))||(t.exports=n)))}()}).call(this,r(15),r(6))},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0,r(164);var i=/\\(u\{([0-9A-Fa-f]+)\}|u([0-9A-Fa-f]{4})|x([0-9A-Fa-f]{2})|([1-7][0-7]{0,2}|[0-7]{2,3})|(['"tbrnfv0\\]))|\\U([0-9A-Fa-f]{8})/g,n={0:"\0",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t",v:"\v","'":"'",'"':'"',"\\":"\\"},s=function(t){return String.fromCodePoint(parseInt(t,16))};e.default=function(t){return t.replace(i,(function(t,e,r,i,o,a,u,h){return void 0!==r?s(r):void 0!==i?s(i):void 0!==o?s(o):void 0!==a?(c=a,String.fromCodePoint(parseInt(c,8))):void 0!==h?s(h):n[u];var c}))},t.exports=e.default},function(t,e){var r={};r[e.ACCEPTED=202]="Accepted",r[e.BAD_GATEWAY=502]="Bad Gateway",r[e.BAD_REQUEST=400]="Bad Request",r[e.CONFLICT=409]="Conflict",r[e.CONTINUE=100]="Continue",r[e.CREATED=201]="Created",r[e.EXPECTATION_FAILED=417]="Expectation Failed",r[e.FAILED_DEPENDENCY=424]="Failed Dependency",r[e.FORBIDDEN=403]="Forbidden",r[e.GATEWAY_TIMEOUT=504]="Gateway Timeout",r[e.GONE=410]="Gone",r[e.HTTP_VERSION_NOT_SUPPORTED=505]="HTTP Version Not Supported",r[e.IM_A_TEAPOT=418]="I'm a teapot",r[e.INSUFFICIENT_SPACE_ON_RESOURCE=419]="Insufficient Space on Resource",r[e.INSUFFICIENT_STORAGE=507]="Insufficient Storage",r[e.INTERNAL_SERVER_ERROR=500]="Server Error",r[e.LENGTH_REQUIRED=411]="Length Required",r[e.LOCKED=423]="Locked",r[e.METHOD_FAILURE=420]="Method Failure",r[e.METHOD_NOT_ALLOWED=405]="Method Not Allowed",r[e.MOVED_PERMANENTLY=301]="Moved Permanently",r[e.MOVED_TEMPORARILY=302]="Moved Temporarily",r[e.MULTI_STATUS=207]="Multi-Status",r[e.MULTIPLE_CHOICES=300]="Multiple Choices",r[e.NETWORK_AUTHENTICATION_REQUIRED=511]="Network Authentication Required",r[e.NO_CONTENT=204]="No Content",r[e.NON_AUTHORITATIVE_INFORMATION=203]="Non Authoritative Information",r[e.NOT_ACCEPTABLE=406]="Not Acceptable",r[e.NOT_FOUND=404]="Not Found",r[e.NOT_IMPLEMENTED=501]="Not Implemented",r[e.NOT_MODIFIED=304]="Not Modified",r[e.OK=200]="OK",r[e.PARTIAL_CONTENT=206]="Partial Content",r[e.PAYMENT_REQUIRED=402]="Payment Required",r[e.PERMANENT_REDIRECT=308]="Permanent Redirect",r[e.PRECONDITION_FAILED=412]="Precondition Failed",r[e.PRECONDITION_REQUIRED=428]="Precondition Required",r[e.PROCESSING=102]="Processing",r[e.PROXY_AUTHENTICATION_REQUIRED=407]="Proxy Authentication Required",r[e.REQUEST_HEADER_FIELDS_TOO_LARGE=431]="Request Header Fields Too Large",r[e.REQUEST_TIMEOUT=408]="Request Timeout",r[e.REQUEST_TOO_LONG=413]="Request Entity Too Large",r[e.REQUEST_URI_TOO_LONG=414]="Request-URI Too Long",r[e.REQUESTED_RANGE_NOT_SATISFIABLE=416]="Requested Range Not Satisfiable",r[e.RESET_CONTENT=205]="Reset Content",r[e.SEE_OTHER=303]="See Other",r[e.SERVICE_UNAVAILABLE=503]="Service Unavailable",r[e.SWITCHING_PROTOCOLS=101]="Switching Protocols",r[e.TEMPORARY_REDIRECT=307]="Temporary Redirect",r[e.TOO_MANY_REQUESTS=429]="Too Many Requests",r[e.UNAUTHORIZED=401]="Unauthorized",r[e.UNPROCESSABLE_ENTITY=422]="Unprocessable Entity",r[e.UNSUPPORTED_MEDIA_TYPE=415]="Unsupported Media Type",r[e.USE_PROXY=305]="Use Proxy",e.getStatusText=function(t){if(r.hasOwnProperty(t))return r[t];throw new Error("Status code does not exist: "+t)},e.getStatusCode=function(t){for(key in r)if(r[key]===t)return parseInt(key,10);throw new Error("Reason phrase does not exist: "+t)}},function(t,e,r){"use strict";(function(t){r.d(e,"a",(function(){return s}));var i=r(115),n=r(19);class s extends n.a{constructor(e){super(),this.bundle=new i.Bundle(t.from(e))}async load(t){this.db=t;const e=this.bundle.primaryURL,r=new Date,i=r.getTime(),n=e;this.addPage({url:e,date:r.toISOString(),title:n});for(const t of this.bundle.urls){const e=this.bundle.getResponse(t);this.addResource({url:t,ts:i,status:e.status,respHeaders:e.headers,payload:e.body})}return await this.finishIndexing(),{}}}}).call(this,r(3).Buffer)},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=r(190);e.Bundle=i.Bundle,e.Response=i.Response;var n=r(203);e.BundleBuilder=n.BundleBuilder},function(t,e,r){(function(e,r,i){t.exports=function t(e,r,i){function n(o,a){if(!r[o]){if(!e[o]){if(s)return s(o,!0);var u=new Error("Cannot find module '"+o+"'");throw u.code="MODULE_NOT_FOUND",u}var h=r[o]={exports:{}};e[o][0].call(h.exports,(function(t){return n(e[o][1][t]||t)}),h,h.exports,t,e,r,i)}return r[o].exports}for(var s=!1,o=0;o