diff --git a/src/content-handlers/iiif/modules/uv-contentleftpanel-module/ContentLeftPanel.ts b/src/content-handlers/iiif/modules/uv-contentleftpanel-module/ContentLeftPanel.ts index e35e98d26..93947b93b 100644 --- a/src/content-handlers/iiif/modules/uv-contentleftpanel-module/ContentLeftPanel.ts +++ b/src/content-handlers/iiif/modules/uv-contentleftpanel-module/ContentLeftPanel.ts @@ -23,6 +23,7 @@ import { import { AnnotationGroup, TreeSortType } from "@iiif/manifold"; import { isVisible } from "../../../../Utils"; import { ContentLeftPanel as ContentLeftPanelConfig } from "../../extensions/config/ContentLeftPanel"; +import { Dates } from "@edsilv/utils"; export class ContentLeftPanel extends LeftPanel { $bottomOptions: JQuery; @@ -52,6 +53,7 @@ export class ContentLeftPanel extends LeftPanel { treeSortType: TreeSortType = TreeSortType.NONE; treeView: TreeView; thumbsRoot: Root; + thumbsCacheKey: string; constructor($element: JQuery) { super($element); @@ -62,6 +64,8 @@ export class ContentLeftPanel extends LeftPanel { super.create(); + this.updateThumbsCacheKey(); + this.extensionHost.subscribe(IIIFEvents.SETTINGS_CHANGE, () => { this.render(); }); @@ -115,6 +119,12 @@ export class ContentLeftPanel extends LeftPanel { this.updateTreeTabBySelection(); }); + this.extensionHost.subscribe(IIIFEvents.LOGIN, () => { + this.updateThumbsCacheKey(); + this.renderThumbs(); + this.renderGallery(); + }); + // this.extensionHost.subscribe( // OpenSeadragonExtensionEvents.PAGING_TOGGLED, // (_paged: boolean) => { @@ -246,6 +256,10 @@ export class ContentLeftPanel extends LeftPanel { // ); // } + updateThumbsCacheKey(): void { + this.thumbsCacheKey = Dates.getTimeStamp().toString(); + } + createTreeView(): void { this.treeView = new TreeView(this.$treeView); this.treeView.treeData = this.getTreeData(); @@ -457,9 +471,22 @@ export class ContentLeftPanel extends LeftPanel { // height = this.config.options.oneColThumbHeight; // } - const thumbs: Thumb[] = this.extension.helper.getThumbs(90); + let thumbs: Thumb[] = this.extension.helper.getThumbs(90); // this.extension.helper.getThumbs(width, height) + thumbs = thumbs.map( + (t) => { + let u = new URL(t.uri) + if (u.search == '') { + u.search += '?_uv_t='+ this.thumbsCacheKey; + } else { + u.search += '&_uv_t='+ this.thumbsCacheKey; + } + t.uri = u.href; + return t; + } + ); + if ( viewingDirection && viewingDirection === ViewingDirectionEnum.BOTTOM_TO_TOP diff --git a/src/content-handlers/iiif/modules/uv-shared-module/Auth1.ts b/src/content-handlers/iiif/modules/uv-shared-module/Auth1.ts index 3769ddb8e..00a6c814b 100644 --- a/src/content-handlers/iiif/modules/uv-shared-module/Auth1.ts +++ b/src/content-handlers/iiif/modules/uv-shared-module/Auth1.ts @@ -100,6 +100,7 @@ export class Auth1 { // It can but wait. const poll: number = window.setInterval(() => { if (contentProviderWindow.closed) { + Auth1.publish(IIIFEvents.LOGIN); window.clearInterval(poll); resolve(true); }