From 820b9143d7db96d521e2716631da8e33d8370f7d Mon Sep 17 00:00:00 2001 From: Edward Silverton Date: Fri, 24 Nov 2023 15:27:57 +0000 Subject: [PATCH] before removing duplicate panel config --- src/content-handlers/iiif/BaseConfig.ts | 311 ++++--- .../extensions/config/ContentLeftPanel.ts | 75 ++ .../iiif/extensions/config/ExpandPanel.ts | 26 + .../extensions/config/ExtendedLeftPanel.ts | 4 + .../extensions/config/ResourcesLeftPanel.ts | 32 + .../uv-aleph-extension/ShareDialogue.ts | 5 +- .../uv-aleph-extension/config/Config.ts | 57 +- .../uv-aleph-extension/config/config.json | 30 +- .../uv-av-extension/DownloadDialogue.ts | 18 +- .../uv-av-extension/ShareDialogue.ts | 5 +- .../uv-av-extension/config/Config.ts | 67 +- .../uv-av-extension/config/config.json | 40 +- .../uv-default-extension/ShareDialogue.ts | 5 +- .../uv-default-extension/config/Config.ts | 59 +- .../uv-default-extension/config/config.json | 73 +- .../uv-ebook-extension/ShareDialogue.ts | 5 +- .../uv-ebook-extension/config/Config.ts | 57 +- .../uv-ebook-extension/config/config.json | 55 +- .../ShareDialogue.ts | 5 +- .../config/Config.ts | 57 +- .../config/config.json | 61 +- .../ShareDialogue.ts | 5 +- .../config/Config.ts | 59 +- .../config/config.json | 65 +- .../DownloadDialogue_old.ts | 830 ------------------ .../ShareDialogue.ts | 5 +- .../config/Config.ts | 261 ++---- .../config/config.json | 97 +- .../extensions/uv-pdf-extension/Extension.ts | 5 +- .../uv-pdf-extension/ShareDialogue.ts | 5 +- .../uv-pdf-extension/config/Config.ts | 59 +- .../uv-pdf-extension/config/config.json | 102 ++- .../AlephCenterPanel.ts | 5 +- .../uv-avcenterpanel-module/AVCenterPanel.ts | 11 +- .../MobileFooter.ts | 5 +- .../ContentLeftPanel.ts | 6 +- .../uv-contentleftpanel-module/GalleryView.ts | 3 +- .../uv-contentleftpanel-module/TreeView.ts | 3 +- .../uv-dialogues-module/AuthDialogue.ts | 7 +- .../ClickThroughDialogue.ts | 5 +- .../uv-dialogues-module/DownloadDialogue.ts | 5 +- .../ExternalContentDialogue.ts | 5 +- .../uv-dialogues-module/HelpDialogue.ts | 5 +- .../uv-dialogues-module/MoreInfoDialogue.ts | 5 +- .../uv-dialogues-module/RestrictedDialogue.ts | 5 +- .../uv-dialogues-module/SettingsDialogue.ts | 5 +- .../uv-dialogues-module/ShareDialogue.ts | 5 +- .../EbookCenterPanel.ts | 5 +- .../FileLinkCenterPanel.ts | 5 +- .../MediaElementCenterPanel.ts | 29 +- .../ModelViewerCenterPanel.ts | 10 +- .../MoreInfoRightPanel.ts | 23 +- .../MultiSelectDialogue.ts | 5 +- .../OpenSeadragonCenterPanel.ts | 6 +- .../MobileFooter.ts | 5 +- .../PDFCenterPanel.ts | 25 +- .../ResourcesLeftPanel.ts | 6 +- .../ThumbsView.ts | 3 +- .../FooterPanel.ts | 5 +- .../uv-shared-module/BaseExpandPanel.ts | 6 +- .../modules/uv-shared-module/CenterPanel.ts | 17 +- .../uv-shared-module/GenericDialogue.ts | 5 +- .../modules/uv-shared-module/RightPanel.ts | 3 +- .../modules/uv-shared-module/ThumbsView.ts | 3 +- 64 files changed, 1414 insertions(+), 1367 deletions(-) create mode 100644 src/content-handlers/iiif/extensions/config/ContentLeftPanel.ts create mode 100644 src/content-handlers/iiif/extensions/config/ExpandPanel.ts create mode 100644 src/content-handlers/iiif/extensions/config/ExtendedLeftPanel.ts create mode 100644 src/content-handlers/iiif/extensions/config/ResourcesLeftPanel.ts delete mode 100644 src/content-handlers/iiif/extensions/uv-openseadragon-extension/DownloadDialogue_old.ts diff --git a/src/content-handlers/iiif/BaseConfig.ts b/src/content-handlers/iiif/BaseConfig.ts index 0641ff947..b3e871153 100644 --- a/src/content-handlers/iiif/BaseConfig.ts +++ b/src/content-handlers/iiif/BaseConfig.ts @@ -1,4 +1,9 @@ import { StorageType } from "@edsilv/utils"; +import { + ExpandPanel, + ExpandPanelContent, + ExpandPanelOptions, +} from "./extensions/config/ExpandPanel"; export { StorageType } from "@edsilv/utils"; export type MetricType = string | "sm" | "md" | "lg" | "xl"; @@ -137,29 +142,22 @@ type HeaderPanel = ModuleConfig & { content: HeaderPanelContent; }; -export type LeftPanelOptions = { - /** Determines if expand full is enabled */ - expandFullEnabled: boolean; - /** Determines the duration of the panel expand/collapse animation */ - panelAnimationDuration: number; - /** Width of the collapsed panel */ - panelCollapsedWidth: number; - /** Width of the expanded panel */ - panelExpandedWidth: number; - /** Determines if the panel is open */ - panelOpen: boolean; +type LeftPanel = ExpandPanel & {}; + +export type CenterPanelOptions = { + titleEnabled: boolean; + subtitleEnabled: boolean; + mostSpecificRequiredStatement: boolean; + requiredStatementEnabled: boolean; }; -export type LeftPanelContent = { - collapse: string; - collapseFull: string; - expand: string; - expandFull: string; +export type CenterPanelContent = { + attribution: string; }; -type LeftPanel = ModuleConfig & { - options: LeftPanelOptions; - content: LeftPanelContent; +type CenterPanel = ModuleConfig & { + options: CenterPanelOptions; + content: CenterPanelContent; }; export type FooterPanelOptions = { @@ -202,11 +200,11 @@ type FooterPanel = ModuleConfig & { content: FooterPanelContent; }; -type DialogueOptions = { +export type DialogueOptions = { topCloseButtonEnabled: boolean; }; -type DialogueContent = { +export type DialogueContent = { close: string; }; @@ -215,64 +213,123 @@ type Dialogue = ModuleConfig & { content: DialogueContent; }; -/** - * Type for Download Dialogue Options - */ -type DownloadDialogueOptions = { - /** Size of the confined image */ - confinedImageSize: number; - /** Percentage of the current view that is disabled */ - currentViewDisabledPercentage: number; - /** Determines if download of current view is enabled */ - downloadCurrentViewEnabled: boolean; - /** Determines if download of whole image in high resolution is enabled */ - downloadWholeImageHighResEnabled: boolean; - /** Determines if download of whole image in low resolution is enabled */ - downloadWholeImageLowResEnabled: boolean; - /** Maximum width of the image */ - maxImageWidth: number; - /** Determines if explanatory text for options is enabled */ - optionsExplanatoryTextEnabled: boolean; - /** Determines if selection is enabled */ - selectionEnabled: boolean; -}; - -type DownloadDialogueContent = { - allPages: string; - currentViewAsJpg: string; - currentViewAsJpgExplanation: string; +export type SettingsDialogueOptions = DialogueOptions & {}; + +export type SettingsDialogueContent = DialogueContent & { + locale: string; + navigatorEnabled: string; + clickToZoomEnabled: string; + pagingEnabled: string; + reducedMotion: string; + preserveViewport: string; + title: string; + website: string; +}; + +type SettingsDialogue = ModuleConfig & { + options: SettingsDialogueOptions; + content: SettingsDialogueContent; +}; + +export type ShareDialogueOptions = DialogueOptions & { + /** Determines if embed is enabled */ + embedEnabled: boolean; + /** Template for embedding */ + embedTemplate: string; + /** Determines if instructions are enabled */ + instructionsEnabled: boolean; + /** Determines if sharing is enabled */ + shareEnabled: boolean; + /** Determines if sharing frame is enabled */ + shareFrameEnabled: boolean; + /** Determines if sharing manifests is enabled */ + shareManifestsEnabled: boolean; +}; + +export type ShareDialogueContent = DialogueContent & { + customSize: string; + embed: string; + embedInstructions: string; + height: string; + iiif: string; + share: string; + shareInstructions: string; + size: string; + width: string; + shareUrl: string; +}; + +type ShareDialogue = ModuleConfig & { + options: ShareDialogueOptions; + content: ShareDialogueContent; +}; + +type AuthDialogueOptions = DialogueOptions & {}; + +type AuthDialogueContent = DialogueContent & { + cancel: string; + confirm: string; +}; + +type AuthDialogue = ModuleConfig & { + options: AuthDialogueOptions; + content: AuthDialogueContent; +}; + +export type DownloadDialogueOptions = DialogueOptions & {}; + +export type DownloadDialogueContent = DialogueContent & { download: string; - downloadSelection: string; - downloadSelectionExplanation: string; - editSettings: string; entireDocument: string; entireFileAsOriginal: string; - individualPages: string; + entireFileAsOriginalWithFormat: string; noneAvailable: string; - pagingNote: string; - preview: string; - selection: string; - termsOfUse: string; title: string; - wholeImageHighRes: string; - wholeImageHighResExplanation: string; - wholeImageLowResAsJpg: string; - wholeImageLowResAsJpgExplanation: string; - wholeImagesHighRes: string; - wholeImagesHighResExplanation: string; }; -type DownloadDialogue = { - options?: DownloadDialogueOptions; +export type DownloadDialogue = ModuleConfig & { + options: DownloadDialogueOptions; content: DownloadDialogueContent; }; -/** - * Type for Generic Dialogue Options - */ -type GenericDialogueOptions = {}; +type ClickThroughDialogueOptions = DialogueOptions & {}; + +type ClickThroughDialogueContent = DialogueContent & { + viewTerms: string; +}; + +type ClickThroughDialogue = ModuleConfig & { + options: ClickThroughDialogueOptions; + content: ClickThroughDialogueContent; +}; + +type LoginDialogueOptions = DialogueOptions & {}; + +type LoginDialogueContent = DialogueContent & { + login: string; + logout: string; + cancel: string; +}; + +type LoginDialogue = ModuleConfig & { + options: LoginDialogueOptions; + content: LoginDialogueContent; +}; + +type RestrictedDialogueOptions = DialogueOptions & {}; + +type RestrictedDialogueContent = DialogueContent & { + cancel: string; +}; + +type RestrictedDialogue = ModuleConfig & { + options: RestrictedDialogueOptions; + content: RestrictedDialogueContent; +}; + +type GenericDialogueOptions = DialogueOptions & {}; -type GenericDialogueContent = { +type GenericDialogueContent = DialogueContent & { emptyValue: string; invalidNumber: string; noMatches: string; @@ -281,63 +338,71 @@ type GenericDialogueContent = { refresh: string; }; -type GenericDialogue = { - options?: GenericDialogueOptions; +type GenericDialogue = ModuleConfig & { + options: GenericDialogueOptions; content: GenericDialogueContent; }; -type MoreInfoRightPanelOptions = { - /** Order in which canvases are displayed */ - canvasDisplayOrder: string; - /** Canvases to exclude from display */ - canvasExclude: string; - /** Determines if copying to clipboard is enabled */ - copyToClipboardEnabled: boolean; - /** Order in which manifests are displayed */ - manifestDisplayOrder: string; - /** Manifests to exclude from display */ - manifestExclude: string; - /** Duration of the panel animation */ - panelAnimationDuration: number; - /** Width of the collapsed panel */ - panelCollapsedWidth: number; - /** Width of the expanded panel */ - panelExpandedWidth: number; - /** Determines if the panel is open */ - panelOpen: boolean; - /** Language codes for right-to-left languages */ - rtlLanguageCodes: string; - /** Determines if all languages should be shown */ - showAllLanguages: boolean; - /** Limit for the text */ - textLimit: number; - /** Type of the text limit */ - textLimitType: string; -}; - -type MoreInfoRightPanelContent = { - attribution: string; - canvasHeader: string; - collapse: string; - collapseFull: string; - copiedToClipboard: string; - copyToClipboard: string; - description: string; - expand: string; - expandFull: string; - holdingText: string; - less: string; - license: string; - logo: string; - manifestHeader: string; - more: string; - noData: string; - page: string; - rangeHeader: string; +type HelpDialogueOptions = DialogueOptions & {}; + +type HelpDialogueContent = DialogueContent & { + text: string; title: string; }; -type MoreInfoRightPanel = { +type HelpDialogue = ModuleConfig & { + options: HelpDialogueOptions; + content: HelpDialogueContent; +}; + +type MoreInfoRightPanelOptions = DialogueOptions & + ExpandPanelOptions & { + /** Order in which canvases are displayed */ + canvasDisplayOrder: string; + /** Canvases to exclude from display */ + canvasExclude: string; + /** Determines if copying to clipboard is enabled */ + copyToClipboardEnabled: boolean; + /** Determines if download is enabled */ + limitToRange: boolean; + /** Order in which manifests are displayed */ + manifestDisplayOrder: string; + /** Manifests to exclude from display */ + manifestExclude: string; + /** Language codes for right-to-left languages */ + rtlLanguageCodes: string; + /** Determines if all languages should be shown */ + showAllLanguages: boolean; + /** Limit for the text */ + textLimit: number; + /** Type of the text limit */ + textLimitType: string; + }; + +type MoreInfoRightPanelContent = DialogueContent & + ExpandPanelContent & { + attribution: string; + canvasHeader: string; + collapse: string; + collapseFull: string; + copiedToClipboard: string; + copyToClipboard: string; + description: string; + expand: string; + expandFull: string; + holdingText: string; + less: string; + license: string; + logo: string; + manifestHeader: string; + more: string; + noData: string; + page: string; + rangeHeader: string; + title: string; + }; + +export type MoreInfoRightPanel = ModuleConfig & { options: MoreInfoRightPanelOptions; content: MoreInfoRightPanelContent; }; @@ -358,13 +423,21 @@ export type BaseConfig = { uri?: string; options: Options; modules: { + authDialogue: AuthDialogue; + centerPanel: CenterPanel; + clickThroughDialogue: ClickThroughDialogue; dialogue: Dialogue; downloadDialogue: DownloadDialogue; footerPanel: FooterPanel; genericDialogue: GenericDialogue; headerPanel: HeaderPanel; + helpDialogue: HelpDialogue; leftPanel: LeftPanel; + loginDialogue: LoginDialogue; moreInfoRightPanel: MoreInfoRightPanel; + restrictedDialogue: RestrictedDialogue; + settingsDialogue: SettingsDialogue; + shareDialogue: ShareDialogue; }; localisation: Localisation; content: Content; diff --git a/src/content-handlers/iiif/extensions/config/ContentLeftPanel.ts b/src/content-handlers/iiif/extensions/config/ContentLeftPanel.ts new file mode 100644 index 000000000..ee8b10959 --- /dev/null +++ b/src/content-handlers/iiif/extensions/config/ContentLeftPanel.ts @@ -0,0 +1,75 @@ +import { ModuleConfig } from "../../BaseConfig"; +import { ExpandPanelContent, ExpandPanelOptions } from "./ExpandPanel"; + +type ThumbsCacheInvalidation = { + /** Determines if cache invalidation is enabled */ + enabled: boolean; + /** Type of the parameter for cache invalidation */ + paramType: string; +}; + +type ContentLeftPanelOptions = ExpandPanelOptions & { + /** Determines if tree should expand automatically */ + autoExpandTreeEnabled: boolean; + /** Number of items to auto expand tree */ + autoExpandTreeIfFewerThan: number; + /** Determines if branch nodes expand on click */ + branchNodesExpandOnClick: boolean; + /** Determines if branch nodes are selectable */ + branchNodesSelectable: boolean; + /** Determines if tree is the default view */ + defaultToTreeEnabled: boolean; + /** Number of items to default to tree view */ + defaultToTreeIfGreaterThan: number; + /** Number of characters to elide at */ + elideCount: number; + /** Threshold for gallery thumb chunked resizing */ + galleryThumbChunkedResizingThreshold: number; + /** Height of the gallery thumbnail */ + galleryThumbHeight: number; + /** Padding for gallery thumb load */ + galleryThumbLoadPadding: number; + /** Width of the gallery thumbnail */ + galleryThumbWidth: number; + /** Height of the one column thumbnail */ + oneColThumbHeight: number; + /** Width of the one column thumbnail */ + oneColThumbWidth: number; + /** Determines if page mode is enabled */ + pageModeEnabled: boolean; + /** Order of the tabs */ + tabOrder: string; + /** Configuration for thumbs cache invalidation */ + thumbsCacheInvalidation: ThumbsCacheInvalidation; + /** Determines if thumbnails are enabled */ + thumbsEnabled: boolean; + /** Extra height for thumbnails */ + thumbsExtraHeight: number; + /** Duration for thumbnails image fade in */ + thumbsImageFadeInDuration: number; + /** Load range for thumbnails */ + thumbsLoadRange: number; + /** Determines if tree is enabled */ + treeEnabled: boolean; + /** Height of the two column thumbnail */ + twoColThumbHeight: number; + /** Width of the two column thumbnail */ + twoColThumbWidth: number; +}; + +type ContentLeftPanelContent = ExpandPanelContent & { + date: string; + index: string; + manifestRanges: string; + searchResult: string; + searchResults: string; + sortBy: string; + thumbnails: string; + title: string; + volume: string; +}; + +export type ContentLeftPanel = ModuleConfig & { + options: ContentLeftPanelOptions; + content: ContentLeftPanelContent; +}; diff --git a/src/content-handlers/iiif/extensions/config/ExpandPanel.ts b/src/content-handlers/iiif/extensions/config/ExpandPanel.ts new file mode 100644 index 000000000..a50a4d230 --- /dev/null +++ b/src/content-handlers/iiif/extensions/config/ExpandPanel.ts @@ -0,0 +1,26 @@ +import { ModuleConfig } from "../../BaseConfig"; + +export type ExpandPanelOptions = { + /** Determines if expand full is enabled */ + expandFullEnabled: boolean; + /** Determines the duration of the panel expand/collapse animation */ + panelAnimationDuration: number; + /** Width of the collapsed panel */ + panelCollapsedWidth: number; + /** Width of the expanded panel */ + panelExpandedWidth: number; + /** Determines if the panel is open */ + panelOpen: boolean; +}; + +export type ExpandPanelContent = { + collapse: string; + collapseFull: string; + expand: string; + expandFull: string; +}; + +export type ExpandPanel = ModuleConfig & { + options: ExpandPanelOptions; + content: ExpandPanelContent; +}; diff --git a/src/content-handlers/iiif/extensions/config/ExtendedLeftPanel.ts b/src/content-handlers/iiif/extensions/config/ExtendedLeftPanel.ts new file mode 100644 index 000000000..12b3c5488 --- /dev/null +++ b/src/content-handlers/iiif/extensions/config/ExtendedLeftPanel.ts @@ -0,0 +1,4 @@ +import { ContentLeftPanel } from "./ContentLeftPanel"; +import { ResourcesLeftPanel } from "./ResourcesLeftPanel"; + +export type ExtendedLeftPanel = ContentLeftPanel & ResourcesLeftPanel & {}; diff --git a/src/content-handlers/iiif/extensions/config/ResourcesLeftPanel.ts b/src/content-handlers/iiif/extensions/config/ResourcesLeftPanel.ts new file mode 100644 index 000000000..183b5fcc1 --- /dev/null +++ b/src/content-handlers/iiif/extensions/config/ResourcesLeftPanel.ts @@ -0,0 +1,32 @@ +import { ModuleConfig } from "../../BaseConfig"; +import { ExpandPanelContent, ExpandPanelOptions } from "./ExpandPanel"; + +type ResourcesLeftPanelOptions = ExpandPanelOptions & { + /** Determines if full expansion is enabled */ + expandFullEnabled: boolean; + /** Duration of the panel animation */ + panelAnimationDuration: number; + /** Width of the panel when collapsed */ + panelCollapsedWidth: number; + /** Width of the panel when expanded */ + panelExpandedWidth: number; + /** Determines if the panel is open */ + panelOpen: boolean; + /** Width of the thumbnail in two column view */ + twoColThumbWidth: number; + /** Height of the thumbnail in two column view */ + twoColThumbHeight: number; + /** Width of the thumbnail in one column view */ + oneColThumbWidth: number; + /** Height of the thumbnail in one column view */ + oneColThumbHeight: number; +}; + +type ResourcesLeftPanelContent = ExpandPanelContent & { + title: string; +}; + +export type ResourcesLeftPanel = ModuleConfig & { + options: ResourcesLeftPanelOptions; + content: ResourcesLeftPanelContent; +}; diff --git a/src/content-handlers/iiif/extensions/uv-aleph-extension/ShareDialogue.ts b/src/content-handlers/iiif/extensions/uv-aleph-extension/ShareDialogue.ts index e977ef75f..fdaafde72 100644 --- a/src/content-handlers/iiif/extensions/uv-aleph-extension/ShareDialogue.ts +++ b/src/content-handlers/iiif/extensions/uv-aleph-extension/ShareDialogue.ts @@ -1,7 +1,10 @@ import { ShareDialogue as BaseShareDialogue } from "../../modules/uv-dialogues-module/ShareDialogue"; +import { Config } from "../uv-aleph-extension/config/Config"; import { IAlephExtension } from "./IAlephExtension"; -export class ShareDialogue extends BaseShareDialogue { +export class ShareDialogue extends BaseShareDialogue< + Config["modules"]["shareDialogue"] +> { constructor($element: JQuery) { super($element); } diff --git a/src/content-handlers/iiif/extensions/uv-aleph-extension/config/Config.ts b/src/content-handlers/iiif/extensions/uv-aleph-extension/config/Config.ts index e20aa5f1f..f0d0d546d 100644 --- a/src/content-handlers/iiif/extensions/uv-aleph-extension/config/Config.ts +++ b/src/content-handlers/iiif/extensions/uv-aleph-extension/config/Config.ts @@ -1,17 +1,26 @@ import { BaseConfig, - LeftPanelContent, - LeftPanelOptions, + CenterPanelContent, + CenterPanelOptions, + DownloadDialogueContent, + DownloadDialogueOptions, + ModuleConfig, + ShareDialogueContent, + ShareDialogueOptions, } from "@/content-handlers/iiif/BaseConfig"; +import { + ExpandPanelContent, + ExpandPanelOptions, +} from "../../config/ExpandPanel"; -type AlephLeftPanelOptions = LeftPanelOptions & { +type AlephLeftPanelOptions = ExpandPanelOptions & { consoleTabEnabled: boolean; graphTabEnabled: boolean; settingsTabEnabled: boolean; srcTabEnabled: boolean; }; -type AlephLeftPanelContent = LeftPanelContent & { +type AlephLeftPanelContent = ExpandPanelContent & { title: string; }; @@ -20,8 +29,48 @@ type AlephLeftPanel = { content: AlephLeftPanelContent; }; +type AlephCenterPanelOptions = CenterPanelOptions & {}; + +type AlephCenterPanelContent = CenterPanelContent & {}; + +type AlephCenterPanel = { + options: AlephCenterPanelOptions; + content: AlephCenterPanelContent; +}; + +type AlephDownloadDialogueOptions = DownloadDialogueOptions & {}; + +type AlephDownloadDialogueContent = DownloadDialogueContent & {}; + +type AlephDownloadDialogue = ModuleConfig & { + options: AlephDownloadDialogueOptions; + content: AlephDownloadDialogueContent; +}; + +type AlephShareDialogueOptions = ShareDialogueOptions & {}; + +type AlephShareDialogueContent = ShareDialogueContent & {}; + +type AlephShareDialogue = ModuleConfig & { + options: AlephShareDialogueOptions; + content: AlephShareDialogueContent; +}; + +type AlephSettingsDialogueOptions = ShareDialogueOptions & {}; + +type AlephSettingsDialogueContent = ShareDialogueContent & {}; + +type AlephSettingsDialogue = ModuleConfig & { + options: AlephSettingsDialogueOptions; + content: AlephSettingsDialogueContent; +}; + type Modules = { alephLeftPanel: AlephLeftPanel; + alephCenterPanel: AlephCenterPanel; + downloadDialogue: AlephDownloadDialogue; + shareDialogue: AlephShareDialogue; + settingsDialogue: AlephSettingsDialogue; }; export type Config = BaseConfig & { diff --git a/src/content-handlers/iiif/extensions/uv-aleph-extension/config/config.json b/src/content-handlers/iiif/extensions/uv-aleph-extension/config/config.json index 3bb85b7cf..584bc8903 100644 --- a/src/content-handlers/iiif/extensions/uv-aleph-extension/config/config.json +++ b/src/content-handlers/iiif/extensions/uv-aleph-extension/config/config.json @@ -146,6 +146,8 @@ "canvasDisplayOrder": "", "canvasExclude": "", "copyToClipboardEnabled": false, + "expandFullEnabled": false, + "limitToRange": false, "manifestDisplayOrder": "", "manifestExclude": "", "panelAnimationDuration": 250, @@ -179,8 +181,23 @@ "title": "$moreInformation" } }, + "centerPanel": { + "options": { + "titleEnabled": true, + "subtitleEnabled": true, + "mostSpecificRequiredStatement": true, + "requiredStatementEnabled": true + }, + "content": { + "attribution": "$attribution" + } + }, "alephCenterPanel": { "options": { + "titleEnabled": true, + "subtitleEnabled": true, + "mostSpecificRequiredStatement": true, + "requiredStatementEnabled": true, "dracoDecoderPath": "uv/lib/" }, "content": { @@ -203,7 +220,8 @@ "options": { "embedTemplate": "", "instructionsEnabled": false, - "shareFrameEnabled": true + "shareFrameEnabled": true, + "shareManifestsEnabled": true }, "content": { "customSize": "custom", @@ -255,10 +273,14 @@ } }, "loginDialogue": { + "options": { + "topCloseButtonEnabled": false + }, "content": { - "login": "Login", - "logout": "Logout", - "cancel": "Cancel" + "login": "$login", + "logout": "$logout", + "cancel": "$cancel", + "close": "$close" } }, "restrictedDialogue": { diff --git a/src/content-handlers/iiif/extensions/uv-av-extension/DownloadDialogue.ts b/src/content-handlers/iiif/extensions/uv-av-extension/DownloadDialogue.ts index 160eca1fe..f804c9643 100644 --- a/src/content-handlers/iiif/extensions/uv-av-extension/DownloadDialogue.ts +++ b/src/content-handlers/iiif/extensions/uv-av-extension/DownloadDialogue.ts @@ -21,27 +21,26 @@ export class DownloadDialogue extends BaseDownloadDialogue { } create(): void { - this.setConfig("downloadDialogue"); super.create(); this.$entireFileAsOriginal = $( '
  • ' + DownloadOption.ENTIRE_FILE_AS_ORIGINAL + + '" type="radio" name="downloadOptions" tabindex="0" />' ); this.$downloadOptions.append(this.$entireFileAsOriginal); this.$entireFileAsOriginal.hide(); this.$downloadButton = $( '' + - this.content.download + - "" + this.content.download + + "" ); this.$buttons.prepend(this.$downloadButton); this.$imageOptionsContainer = $('
  • '); @@ -89,7 +88,6 @@ export class DownloadDialogue extends BaseDownloadDialogue { } open(triggerButton: HTMLElement) { - super.open(triggerButton); const canvas: Canvas = this.extension.helper.getCurrentCanvas(); diff --git a/src/content-handlers/iiif/extensions/uv-av-extension/ShareDialogue.ts b/src/content-handlers/iiif/extensions/uv-av-extension/ShareDialogue.ts index 46f3ef3ae..2fde27568 100644 --- a/src/content-handlers/iiif/extensions/uv-av-extension/ShareDialogue.ts +++ b/src/content-handlers/iiif/extensions/uv-av-extension/ShareDialogue.ts @@ -1,7 +1,10 @@ import { ShareDialogue as BaseShareDialogue } from "../../modules/uv-dialogues-module/ShareDialogue"; +import { Config } from "../uv-av-extension/config/Config"; import { IAVExtension } from "./IAVExtension"; -export class ShareDialogue extends BaseShareDialogue { +export class ShareDialogue extends BaseShareDialogue< + Config["modules"]["shareDialogue"] +> { constructor($element: JQuery) { super($element); } diff --git a/src/content-handlers/iiif/extensions/uv-av-extension/config/Config.ts b/src/content-handlers/iiif/extensions/uv-av-extension/config/Config.ts index 30f142a17..2bdec173b 100644 --- a/src/content-handlers/iiif/extensions/uv-av-extension/config/Config.ts +++ b/src/content-handlers/iiif/extensions/uv-av-extension/config/Config.ts @@ -1,6 +1,69 @@ -import { BaseConfig } from "@/content-handlers/iiif/BaseConfig"; +import { + BaseConfig, + CenterPanelContent, + CenterPanelOptions, + DownloadDialogueContent, + DownloadDialogueOptions, + ModuleConfig, + ShareDialogueContent, + ShareDialogueOptions, +} from "@/content-handlers/iiif/BaseConfig"; -type Modules = {}; +type AVCenterPanelOptions = CenterPanelOptions & { + posterImageExpanded: boolean; + hideMediaError: boolean; + includeParentInTitleEnabled: boolean; + subtitleMetadataField: string; + autoPlay: boolean; + enableFastForward: boolean; + enableFastRewind: boolean; + posterImageRatio: number; + limitToRange: boolean; + autoAdvanceRanges: boolean; +}; + +type AVCenterPanelContent = CenterPanelContent & { + delimiter: string; +}; + +type AVCenterPanel = { + options: AVCenterPanelOptions; + content: AVCenterPanelContent; +}; + +type AVDownloadDialogueOptions = DownloadDialogueOptions & {}; + +type AVDownloadDialogueContent = DownloadDialogueContent & {}; + +type AVDownloadDialogue = ModuleConfig & { + options: AVDownloadDialogueOptions; + content: AVDownloadDialogueContent; +}; + +type AVShareDialogueOptions = ShareDialogueOptions & {}; + +type AVShareDialogueContent = ShareDialogueContent & {}; + +type AVShareDialogue = ModuleConfig & { + options: AVShareDialogueOptions; + content: AVShareDialogueContent; +}; + +type AVSettingsDialogueOptions = ShareDialogueOptions & {}; + +type AVSettingsDialogueContent = ShareDialogueContent & {}; + +type AVSettingsDialogue = ModuleConfig & { + options: AVSettingsDialogueOptions; + content: AVSettingsDialogueContent; +}; + +type Modules = { + avCenterPanel: AVCenterPanel; + downloadDialogue: AVDownloadDialogue; + shareDialogue: AVShareDialogue; + settingsDialogue: AVSettingsDialogue; +}; export type Config = BaseConfig & { modules: Modules; diff --git a/src/content-handlers/iiif/extensions/uv-av-extension/config/config.json b/src/content-handlers/iiif/extensions/uv-av-extension/config/config.json index 489d48135..c274e0c35 100644 --- a/src/content-handlers/iiif/extensions/uv-av-extension/config/config.json +++ b/src/content-handlers/iiif/extensions/uv-av-extension/config/config.json @@ -172,6 +172,8 @@ "canvasDisplayOrder": "", "canvasExclude": "", "copyToClipboardEnabled": false, + "expandFullEnabled": false, + "limitToRange": false, "manifestDisplayOrder": "", "manifestExclude": "", "panelAnimationDuration": 250, @@ -205,6 +207,17 @@ "title": "$moreInformation" } }, + "centerPanel": { + "options": { + "titleEnabled": true, + "subtitleEnabled": true, + "mostSpecificRequiredStatement": true, + "requiredStatementEnabled": true + }, + "content": { + "attribution": "$attribution" + } + }, "avCenterPanel": { "options": { "autoPlay": false, @@ -242,18 +255,19 @@ "options": { "embedTemplate": "", "instructionsEnabled": false, - "shareFrameEnabled": true + "shareFrameEnabled": true, + "shareManifestsEnabled": true }, "content": { - "customSize": "$custom", - "embed": "$embed", - "embedInstructions": "$embedInstructions", - "height": "$height", - "iiif": "$iiifManifest", - "share": "$share", - "shareInstructions": "$shareInstructions", - "size": "$size", - "width": "$width" + "customSize": "custom", + "embed": "Embed", + "embedInstructions": "To embed this item in your own website, copy and paste the code below.", + "height": "Height", + "iiif": "IIIF Manifest", + "share": "Share", + "shareInstructions": "To share this item, copy the URL below.", + "size": "Size:", + "width": "Width" } }, "authDialogue": { @@ -294,10 +308,14 @@ } }, "loginDialogue": { + "options": { + "topCloseButtonEnabled": false + }, "content": { "login": "$login", "logout": "$logout", - "cancel": "$cancel" + "cancel": "$cancel", + "close": "$close" } }, "restrictedDialogue": { diff --git a/src/content-handlers/iiif/extensions/uv-default-extension/ShareDialogue.ts b/src/content-handlers/iiif/extensions/uv-default-extension/ShareDialogue.ts index ea7ad52d7..0fe2b49c1 100644 --- a/src/content-handlers/iiif/extensions/uv-default-extension/ShareDialogue.ts +++ b/src/content-handlers/iiif/extensions/uv-default-extension/ShareDialogue.ts @@ -1,7 +1,10 @@ import { ShareDialogue as BaseShareDialogue } from "../../modules/uv-dialogues-module/ShareDialogue"; +import { Config } from "../uv-default-extension/config/Config"; import { IDefaultExtension } from "./IDefaultExtension"; -export class ShareDialogue extends BaseShareDialogue { +export class ShareDialogue extends BaseShareDialogue< + Config["modules"]["shareDialogue"] +> { constructor($element: JQuery) { super($element); } diff --git a/src/content-handlers/iiif/extensions/uv-default-extension/config/Config.ts b/src/content-handlers/iiif/extensions/uv-default-extension/config/Config.ts index ec0f16eff..1bcf1bb25 100644 --- a/src/content-handlers/iiif/extensions/uv-default-extension/config/Config.ts +++ b/src/content-handlers/iiif/extensions/uv-default-extension/config/Config.ts @@ -1,32 +1,55 @@ import { BaseConfig, - LeftPanelContent, - LeftPanelOptions, + CenterPanelContent, + CenterPanelOptions, + DownloadDialogueContent, + DownloadDialogueOptions, + ModuleConfig, + ShareDialogueContent, + ShareDialogueOptions, } from "@/content-handlers/iiif/BaseConfig"; -type ResourcesLeftPanelOptions = LeftPanelOptions & { - expandFullEnabled: boolean; - panelAnimationDuration: number; - panelCollapsedWidth: number; - panelExpandedWidth: number; - panelOpen: boolean; - twoColThumbWidth: number; - twoColThumbHeight: number; - oneColThumbWidth: number; - oneColThumbHeight: number; +type FileLinkCenterPanelOptions = CenterPanelOptions & {}; + +type FileLinkCenterPanelContent = CenterPanelContent & {}; + +type FileLinkCenterPanel = { + options: FileLinkCenterPanelOptions; + content: FileLinkCenterPanelContent; +}; + +type DefaultDownloadDialogueOptions = DownloadDialogueOptions & {}; + +type DefaultDownloadDialogueContent = DownloadDialogueContent & {}; + +type DefaultDownloadDialogue = ModuleConfig & { + options: DefaultDownloadDialogueOptions; + content: DefaultDownloadDialogueContent; }; -type ResourcesLeftPanelContent = LeftPanelContent & { - title: string; +type DefaultShareDialogueOptions = ShareDialogueOptions & {}; + +type DefaultShareDialogueContent = ShareDialogueContent & {}; + +type DefaultShareDialogue = ModuleConfig & { + options: DefaultShareDialogueOptions; + content: DefaultShareDialogueContent; }; -type ResourcesLeftPanel = { - options: ResourcesLeftPanelOptions; - content: ResourcesLeftPanelContent; +type DefaultSettingsDialogueOptions = ShareDialogueOptions & {}; + +type DefaultSettingsDialogueContent = ShareDialogueContent & {}; + +type DefaultSettingsDialogue = ModuleConfig & { + options: DefaultSettingsDialogueOptions; + content: DefaultSettingsDialogueContent; }; type Modules = { - resourcesLeftPanel: ResourcesLeftPanel; + fileLinkCenterPanel: FileLinkCenterPanel; + downloadDialogue: DefaultDownloadDialogue; + shareDialogue: DefaultShareDialogue; + settingsDialogue: DefaultSettingsDialogue; }; export type Config = BaseConfig & { diff --git a/src/content-handlers/iiif/extensions/uv-default-extension/config/config.json b/src/content-handlers/iiif/extensions/uv-default-extension/config/config.json index 58055a400..29a457206 100644 --- a/src/content-handlers/iiif/extensions/uv-default-extension/config/config.json +++ b/src/content-handlers/iiif/extensions/uv-default-extension/config/config.json @@ -63,22 +63,44 @@ }, "shareDialogue": { "options": { - "embedTemplate": "" + "embedTemplate": "", + "instructionsEnabled": false, + "shareFrameEnabled": true, + "shareManifestsEnabled": true }, "content": { - "customSize": "$custom", - "embed": "$embed", - "embedInstructions": "$embedInstruction", - "height": "$height", - "iiif": "$iiifManifest", - "share": "$share", - "shareInstructions": "$shareInstructions", - "size": "$size", - "width": "$width" + "customSize": "custom", + "embed": "Embed", + "embedInstructions": "To embed this item in your own website, copy and paste the code below.", + "height": "Height", + "iiif": "IIIF Manifest", + "share": "Share", + "shareInstructions": "To share this item, copy the URL below.", + "size": "Size:", + "width": "Width" + } + }, + "centerPanel": { + "options": { + "titleEnabled": true, + "subtitleEnabled": true, + "mostSpecificRequiredStatement": true, + "requiredStatementEnabled": true + }, + "content": { + "attribution": "$attribution" } }, "fileLinkCenterPanel": { - "content": {} + "options": { + "titleEnabled": true, + "subtitleEnabled": true, + "mostSpecificRequiredStatement": true, + "requiredStatementEnabled": true + }, + "content": { + "attribution": "$attribution" + } }, "footerPanel": { "options": { @@ -132,11 +154,18 @@ "title": "$help" } }, + "restrictedDialogue": { + "content": { + "cancel": "$cancel" + } + }, "moreInfoRightPanel": { "options": { "canvasDisplayOrder": "", "canvasExclude": "", "copyToClipboardEnabled": false, + "expandFullEnabled": false, + "limitToRange": false, "manifestDisplayOrder": "", "manifestExclude": "", "panelAnimationDuration": 250, @@ -198,6 +227,17 @@ "close": "$close" } }, + "authDialogue": { + "content": { + "cancel": "$cancel", + "confirm": "$confirm" + } + }, + "clickThroughDialogue": { + "content": { + "viewTerms": "$viewTerms" + } + }, "downloadDialogue": { "content": { "allPages": "$allPages", @@ -225,17 +265,24 @@ } }, "loginDialogue": { + "options": { + "topCloseButtonEnabled": false + }, "content": { "login": "$login", - "cancel": "$cancel" + "logout": "$logout", + "cancel": "$cancel", + "close": "$close" } }, "settingsDialogue": { "content": { "locale": "$locale", + "navigatorEnabled": "$navigatorEnabled", + "clickToZoomEnabled": "$clickToZoomEnabled", "pagingEnabled": "$twoPageView", - "preserveViewport": "$preserveViewport", "reducedMotion": "$reducedMotion", + "preserveViewport": "$preserveViewport", "title": "$settings", "website": "$uvWebsite" } diff --git a/src/content-handlers/iiif/extensions/uv-ebook-extension/ShareDialogue.ts b/src/content-handlers/iiif/extensions/uv-ebook-extension/ShareDialogue.ts index 6e383e3b2..433f89cfa 100644 --- a/src/content-handlers/iiif/extensions/uv-ebook-extension/ShareDialogue.ts +++ b/src/content-handlers/iiif/extensions/uv-ebook-extension/ShareDialogue.ts @@ -1,7 +1,10 @@ import { ShareDialogue as BaseShareDialogue } from "../../modules/uv-dialogues-module/ShareDialogue"; +import { Config } from "../uv-ebook-extension/config/Config"; import { IEbookExtension } from "./IEbookExtension"; -export class ShareDialogue extends BaseShareDialogue { +export class ShareDialogue extends BaseShareDialogue< + Config["modules"]["shareDialogue"] +> { constructor($element: JQuery) { super($element); } diff --git a/src/content-handlers/iiif/extensions/uv-ebook-extension/config/Config.ts b/src/content-handlers/iiif/extensions/uv-ebook-extension/config/Config.ts index e0f0614f1..5c1450e2b 100644 --- a/src/content-handlers/iiif/extensions/uv-ebook-extension/config/Config.ts +++ b/src/content-handlers/iiif/extensions/uv-ebook-extension/config/Config.ts @@ -1,10 +1,19 @@ import { BaseConfig, - LeftPanelContent, - LeftPanelOptions, + CenterPanelContent, + CenterPanelOptions, + DownloadDialogueContent, + DownloadDialogueOptions, + ModuleConfig, + ShareDialogueContent, + ShareDialogueOptions, } from "@/content-handlers/iiif/BaseConfig"; +import { + ExpandPanelContent, + ExpandPanelOptions, +} from "../../config/ExpandPanel"; -type EbookLeftPanelOptions = LeftPanelOptions & { +type EbookLeftPanelOptions = ExpandPanelOptions & { expandFullEnabled: boolean; panelAnimationDuration: number; panelCollapsedWidth: number; @@ -12,7 +21,7 @@ type EbookLeftPanelOptions = LeftPanelOptions & { panelOpen: boolean; }; -type EbookLeftPanelContent = LeftPanelContent & { +type EbookLeftPanelContent = ExpandPanelContent & { title: string; }; @@ -21,8 +30,48 @@ type EbookLeftPanel = { content: EbookLeftPanelContent; }; +type EbookCenterPanelOptions = CenterPanelOptions & {}; + +type EbookCenterPanelContent = CenterPanelContent & {}; + +type EbookCenterPanel = { + options: EbookCenterPanelOptions; + content: EbookCenterPanelContent; +}; + +type EbookDownloadDialogueOptions = DownloadDialogueOptions & {}; + +type EbookDownloadDialogueContent = DownloadDialogueContent & {}; + +type EbookDownloadDialogue = ModuleConfig & { + options: EbookDownloadDialogueOptions; + content: EbookDownloadDialogueContent; +}; + +type EbookShareDialogueOptions = ShareDialogueOptions & {}; + +type EbookShareDialogueContent = ShareDialogueContent & {}; + +type EbookShareDialogue = ModuleConfig & { + options: EbookShareDialogueOptions; + content: EbookShareDialogueContent; +}; + +type EbookSettingsDialogueOptions = ShareDialogueOptions & {}; + +type EbookSettingsDialogueContent = ShareDialogueContent & {}; + +type EbookSettingsDialogue = ModuleConfig & { + options: EbookSettingsDialogueOptions; + content: EbookSettingsDialogueContent; +}; + type Modules = { ebookLeftPanel: EbookLeftPanel; + ebookCenterPanel: EbookCenterPanel; + downloadDialogue: EbookDownloadDialogue; + shareDialogue: EbookShareDialogue; + settingsDialogue: EbookSettingsDialogue; }; export type Config = BaseConfig & { diff --git a/src/content-handlers/iiif/extensions/uv-ebook-extension/config/config.json b/src/content-handlers/iiif/extensions/uv-ebook-extension/config/config.json index 2ce909d27..fb2ae81a8 100644 --- a/src/content-handlers/iiif/extensions/uv-ebook-extension/config/config.json +++ b/src/content-handlers/iiif/extensions/uv-ebook-extension/config/config.json @@ -142,6 +142,8 @@ "canvasDisplayOrder": "", "canvasExclude": "", "copyToClipboardEnabled": false, + "expandFullEnabled": false, + "limitToRange": false, "manifestDisplayOrder": "", "manifestExclude": "", "panelAnimationDuration": 250, @@ -175,8 +177,27 @@ "title": "$moreInformation" } }, + "centerPanel": { + "options": { + "titleEnabled": true, + "subtitleEnabled": true, + "mostSpecificRequiredStatement": true, + "requiredStatementEnabled": true + }, + "content": { + "attribution": "$attribution" + } + }, "ebookCenterPanel": { - "options": {} + "options": { + "titleEnabled": true, + "subtitleEnabled": true, + "mostSpecificRequiredStatement": true, + "requiredStatementEnabled": true + }, + "content": { + "attribution": "$attribution" + } }, "settingsDialogue": { "content": { @@ -194,18 +215,19 @@ "options": { "embedTemplate": "", "instructionsEnabled": false, - "shareFrameEnabled": true + "shareFrameEnabled": true, + "shareManifestsEnabled": true }, "content": { - "customSize": "$custom", - "embed": "$embed", - "embedInstructions": "$embedInstructions", - "height": "$height", - "iiif": "$iiifManifest", - "share": "$share", - "shareInstructions": "$shareInstructions", - "size": "$size", - "width": "$width" + "customSize": "custom", + "embed": "Embed", + "embedInstructions": "To embed this item in your own website, copy and paste the code below.", + "height": "Height", + "iiif": "IIIF Manifest", + "share": "Share", + "shareInstructions": "To share this item, copy the URL below.", + "size": "Size:", + "width": "Width" } }, "authDialogue": { @@ -246,15 +268,14 @@ } }, "loginDialogue": { + "options": { + "topCloseButtonEnabled": false + }, "content": { "login": "$login", "logout": "$logout", - "cancel": "$cancel" - } - }, - "avCenterPanel": { - "content": { - "attribution": "$attribution" + "cancel": "$cancel", + "close": "$close" } }, "restrictedDialogue": { diff --git a/src/content-handlers/iiif/extensions/uv-mediaelement-extension/ShareDialogue.ts b/src/content-handlers/iiif/extensions/uv-mediaelement-extension/ShareDialogue.ts index c4ef18293..5e14ff1dc 100644 --- a/src/content-handlers/iiif/extensions/uv-mediaelement-extension/ShareDialogue.ts +++ b/src/content-handlers/iiif/extensions/uv-mediaelement-extension/ShareDialogue.ts @@ -1,7 +1,10 @@ import { ShareDialogue as BaseShareDialogue } from "../../modules/uv-dialogues-module/ShareDialogue"; +import { Config } from "../uv-mediaelement-extension/config/Config"; import { IMediaElementExtension } from "./IMediaElementExtension"; -export class ShareDialogue extends BaseShareDialogue { +export class ShareDialogue extends BaseShareDialogue< + Config["modules"]["shareDialogue"] +> { constructor($element: JQuery) { super($element); } diff --git a/src/content-handlers/iiif/extensions/uv-mediaelement-extension/config/Config.ts b/src/content-handlers/iiif/extensions/uv-mediaelement-extension/config/Config.ts index 30f142a17..63a329d99 100644 --- a/src/content-handlers/iiif/extensions/uv-mediaelement-extension/config/Config.ts +++ b/src/content-handlers/iiif/extensions/uv-mediaelement-extension/config/Config.ts @@ -1,6 +1,59 @@ -import { BaseConfig } from "@/content-handlers/iiif/BaseConfig"; +import { + BaseConfig, + CenterPanelContent, + CenterPanelOptions, + DownloadDialogueContent, + DownloadDialogueOptions, + ModuleConfig, + ShareDialogueContent, + ShareDialogueOptions, +} from "@/content-handlers/iiif/BaseConfig"; -type Modules = {}; +type MediaElementCenterPanelOptions = CenterPanelOptions & { + defaultHeight: number; + defaultWidth: number; +}; + +type MediaElementCenterPanelContent = CenterPanelContent & {}; + +type MediaElementCenterPanel = { + options: MediaElementCenterPanelOptions; + content: MediaElementCenterPanelContent; +}; + +type MediaElementDownloadDialogueOptions = DownloadDialogueOptions & {}; + +type MediaElementDownloadDialogueContent = DownloadDialogueContent & {}; + +type MediaElementDownloadDialogue = ModuleConfig & { + options: MediaElementDownloadDialogueOptions; + content: MediaElementDownloadDialogueContent; +}; + +type MediaElementShareDialogueOptions = ShareDialogueOptions & {}; + +type MediaElementShareDialogueContent = ShareDialogueContent & {}; + +type MediaElementShareDialogue = ModuleConfig & { + options: MediaElementShareDialogueOptions; + content: MediaElementShareDialogueContent; +}; + +type MediaElementSettingsDialogueOptions = ShareDialogueOptions & {}; + +type MediaElementSettingsDialogueContent = ShareDialogueContent & {}; + +type MediaElementSettingsDialogue = ModuleConfig & { + options: MediaElementSettingsDialogueOptions; + content: MediaElementSettingsDialogueContent; +}; + +type Modules = { + mediaelementCenterPanel: MediaElementCenterPanel; + downloadDialogue: MediaElementDownloadDialogue; + shareDialogue: MediaElementShareDialogue; + settingsDialogue: MediaElementSettingsDialogue; +}; export type Config = BaseConfig & { modules: Modules; diff --git a/src/content-handlers/iiif/extensions/uv-mediaelement-extension/config/config.json b/src/content-handlers/iiif/extensions/uv-mediaelement-extension/config/config.json index 41ccae357..5f870bd71 100644 --- a/src/content-handlers/iiif/extensions/uv-mediaelement-extension/config/config.json +++ b/src/content-handlers/iiif/extensions/uv-mediaelement-extension/config/config.json @@ -63,18 +63,21 @@ }, "shareDialogue": { "options": { - "embedTemplate": "" + "embedTemplate": "", + "instructionsEnabled": false, + "shareFrameEnabled": true, + "shareManifestsEnabled": true }, "content": { - "customSize": "$custom", - "embed": "$embed", - "embedInstructions": "$embedInstruction", - "height": "$height", - "iiif": "$iiifManifest", - "share": "$share", - "shareInstructions": "$shareInstructions", - "size": "$size", - "width": "$width" + "customSize": "custom", + "embed": "Embed", + "embedInstructions": "To embed this item in your own website, copy and paste the code below.", + "height": "Height", + "iiif": "IIIF Manifest", + "share": "Share", + "shareInstructions": "To share this item, copy the URL below.", + "size": "Size:", + "width": "Width" } }, "footerPanel": { @@ -129,6 +132,17 @@ "title": "$help" } }, + "centerPanel": { + "options": { + "titleEnabled": true, + "subtitleEnabled": true, + "mostSpecificRequiredStatement": true, + "requiredStatementEnabled": true + }, + "content": { + "attribution": "$attribution" + } + }, "mediaelementCenterPanel": { "defaultHeight": 420, "defaultWidth": 560, @@ -136,11 +150,29 @@ "attribution": "$attribution" } }, + "restrictedDialogue": { + "content": { + "cancel": "$cancel" + } + }, + "authDialogue": { + "content": { + "cancel": "$cancel", + "confirm": "$confirm" + } + }, + "clickThroughDialogue": { + "content": { + "viewTerms": "$viewTerms" + } + }, "moreInfoRightPanel": { "options": { "canvasDisplayOrder": "", "canvasExclude": "", "copyToClipboardEnabled": false, + "expandFullEnabled": false, + "limitToRange": false, "manifestDisplayOrder": "", "manifestExclude": "", "panelAnimationDuration": 250, @@ -221,14 +253,21 @@ } }, "loginDialogue": { + "options": { + "topCloseButtonEnabled": false + }, "content": { "login": "$login", - "cancel": "$cancel" + "logout": "$logout", + "cancel": "$cancel", + "close": "$close" } }, "settingsDialogue": { "content": { "locale": "$locale", + "navigatorEnabled": "$navigatorEnabled", + "clickToZoomEnabled": "$clickToZoomEnabled", "pagingEnabled": "$twoPageView", "reducedMotion": "$reducedMotion", "preserveViewport": "$preserveViewport", diff --git a/src/content-handlers/iiif/extensions/uv-model-viewer-extension/ShareDialogue.ts b/src/content-handlers/iiif/extensions/uv-model-viewer-extension/ShareDialogue.ts index 3662b4ef0..03aa4ef9b 100644 --- a/src/content-handlers/iiif/extensions/uv-model-viewer-extension/ShareDialogue.ts +++ b/src/content-handlers/iiif/extensions/uv-model-viewer-extension/ShareDialogue.ts @@ -1,7 +1,10 @@ import { ShareDialogue as BaseShareDialogue } from "../../modules/uv-dialogues-module/ShareDialogue"; +import { Config } from "../uv-model-viewer-extension/config/Config"; import ModelViewerExtension from "./Extension"; -export class ShareDialogue extends BaseShareDialogue { +export class ShareDialogue extends BaseShareDialogue< + Config["modules"]["shareDialogue"] +> { constructor($element: JQuery) { super($element); } diff --git a/src/content-handlers/iiif/extensions/uv-model-viewer-extension/config/Config.ts b/src/content-handlers/iiif/extensions/uv-model-viewer-extension/config/Config.ts index 30f142a17..edb2890f6 100644 --- a/src/content-handlers/iiif/extensions/uv-model-viewer-extension/config/Config.ts +++ b/src/content-handlers/iiif/extensions/uv-model-viewer-extension/config/Config.ts @@ -1,6 +1,61 @@ -import { BaseConfig } from "@/content-handlers/iiif/BaseConfig"; +import { + BaseConfig, + CenterPanelContent, + CenterPanelOptions, + DownloadDialogueContent, + DownloadDialogueOptions, + ModuleConfig, + ShareDialogueContent, + ShareDialogueOptions, +} from "@/content-handlers/iiif/BaseConfig"; -type Modules = {}; +type ModelViewerCenterPanelOptions = CenterPanelOptions & { + autoRotateEnabled: boolean; + cameraChangeDelay: number; + doubleClickAnnotationEnabled: boolean; + interactionPromptEnabled: boolean; +}; + +type ModelViewerCenterPanelContent = CenterPanelContent & {}; + +type ModelViewerCenterPanel = { + options: ModelViewerCenterPanelOptions; + content: ModelViewerCenterPanelContent; +}; + +type ModelViewerDownloadDialogueOptions = DownloadDialogueOptions & {}; + +type ModelViewerDownloadDialogueContent = DownloadDialogueContent & {}; + +type ModelViewerDownloadDialogue = ModuleConfig & { + options: ModelViewerDownloadDialogueOptions; + content: ModelViewerDownloadDialogueContent; +}; + +type ModelViewerShareDialogueOptions = ShareDialogueOptions & {}; + +type ModelViewerShareDialogueContent = ShareDialogueContent & {}; + +type ModelViewerShareDialogue = ModuleConfig & { + options: ModelViewerShareDialogueOptions; + content: ModelViewerShareDialogueContent; +}; + +type ModelViewerSettingsDialogueOptions = ShareDialogueOptions & {}; + +type ModelViewerSettingsDialogueContent = ShareDialogueContent & {}; + +type ModelViewerSettingsDialogue = ModuleConfig & { + options: ModelViewerSettingsDialogueOptions; + content: ModelViewerSettingsDialogueContent; +}; + +type Modules = { + modelViewerCenterPanel: ModelViewerCenterPanel; + downloadDialogue: ModelViewerDownloadDialogue; + shareDialogue: ModelViewerShareDialogue; + settingsDialogue: ModelViewerSettingsDialogue; +}; export type Config = BaseConfig & { modules: Modules; diff --git a/src/content-handlers/iiif/extensions/uv-model-viewer-extension/config/config.json b/src/content-handlers/iiif/extensions/uv-model-viewer-extension/config/config.json index 57bdef65c..124718648 100644 --- a/src/content-handlers/iiif/extensions/uv-model-viewer-extension/config/config.json +++ b/src/content-handlers/iiif/extensions/uv-model-viewer-extension/config/config.json @@ -46,21 +46,39 @@ "zoomToSearchResultEnabled": true }, "modules": { + "restrictedDialogue": { + "content": { + "cancel": "$cancel" + } + }, + "authDialogue": { + "content": { + "cancel": "$cancel", + "confirm": "$confirm" + } + }, + "clickThroughDialogue": { + "content": { + "viewTerms": "$viewTerms" + } + }, "shareDialogue": { "options": { "embedTemplate": "", + "instructionsEnabled": false, + "shareFrameEnabled": true, "shareManifestsEnabled": true }, "content": { - "customSize": "$custom", - "embed": "$embed", - "embedInstructions": "$embedInstructions", - "height": "$height", - "iiif": "$iiifManifest", - "share": "$share", - "shareInstructions": "$shareInstructions", - "size": "$size", - "width": "$width" + "customSize": "custom", + "embed": "Embed", + "embedInstructions": "To embed this item in your own website, copy and paste the code below.", + "height": "Height", + "iiif": "IIIF Manifest", + "share": "Share", + "shareInstructions": "To share this item, copy the URL below.", + "size": "Size:", + "width": "Width" } }, "footerPanel": { @@ -120,6 +138,8 @@ "canvasDisplayOrder": "", "canvasExclude": "", "copyToClipboardEnabled": false, + "expandFullEnabled": false, + "limitToRange": false, "manifestDisplayOrder": "", "manifestExclude": "", "panelAnimationDuration": 250, @@ -189,11 +209,27 @@ "twoColThumbWidth": 90 } }, + "centerPanel": { + "options": { + "titleEnabled": true, + "subtitleEnabled": true, + "mostSpecificRequiredStatement": true, + "requiredStatementEnabled": true + }, + "content": { + "attribution": "$attribution" + } + }, "modelViewerCenterPanel": { "options": { + "titleEnabled": true, + "subtitleEnabled": true, + "mostSpecificRequiredStatement": true, + "requiredStatementEnabled": true, "autoRotateEnabled": false, "cameraChangeDelay": 500, - "interactionPromptEnabled": false + "interactionPromptEnabled": false, + "doubleClickAnnotationEnabled": false }, "content": { "attribution": "$attribution", @@ -237,9 +273,14 @@ } }, "loginDialogue": { + "options": { + "topCloseButtonEnabled": false + }, "content": { "login": "$login", - "cancel": "$cancel" + "logout": "$logout", + "cancel": "$cancel", + "close": "$close" } }, "mediaelementCenterPanel": { @@ -248,6 +289,8 @@ "settingsDialogue": { "content": { "locale": "$locale", + "navigatorEnabled": "$navigatorEnabled", + "clickToZoomEnabled": "$clickToZoomEnabled", "pagingEnabled": "$twoPageView", "reducedMotion": "$reducedMotion", "preserveViewport": "$preserveViewport", diff --git a/src/content-handlers/iiif/extensions/uv-openseadragon-extension/DownloadDialogue_old.ts b/src/content-handlers/iiif/extensions/uv-openseadragon-extension/DownloadDialogue_old.ts deleted file mode 100644 index 1324fd686..000000000 --- a/src/content-handlers/iiif/extensions/uv-openseadragon-extension/DownloadDialogue_old.ts +++ /dev/null @@ -1,830 +0,0 @@ -const $ = require("jquery"); -import { IIIFEvents } from "../../IIIFEvents"; -import { CroppedImageDimensions } from "./CroppedImageDimensions"; -import { DownloadDialogue as BaseDownloadDialogue } from "../../modules/uv-dialogues-module/DownloadDialogue"; -import { DownloadOption } from "../../modules/uv-shared-module/DownloadOption"; -import OpenSeadragonExtension from "./Extension"; -import { IRenderingOption } from "../../modules/uv-shared-module/IRenderingOption"; -import { Async, Strings, Bools, Files } from "@edsilv/utils"; -import { MediaType } from "@iiif/vocabulary/dist-commonjs/"; -import { - Annotation, - Canvas, - IExternalImageResourceData, - Range, - Resource, - Size, - Utils, -} from "manifesto.js"; - -export class DownloadDialogue extends BaseDownloadDialogue { - $canvasOptions: JQuery; - $canvasOptionsContainer: JQuery; - $currentViewAsJpgButton: JQuery; - $downloadButton: JQuery; - $explanatoryTextTemplate: JQuery; - $imageOptions: JQuery; - $imageOptionsContainer: JQuery; - $manifestOptions: JQuery; - $manifestOptionsContainer: JQuery; - $pagingNote: JQuery; - $selectionButton: JQuery; - $settingsButton: JQuery; - $wholeImageHighResButton: JQuery; - $wholeImageLowResAsJpgButton: JQuery; - $wholeImagesHighResButton: JQuery; - - constructor($element: JQuery) { - super($element); - } - - create(): void { - this.setConfig("downloadDialogue"); - - super.create(); - - // create ui. - this.$settingsButton = $( - '' + this.content.editSettings + "" - ); - this.$pagingNote = $( - '
    ' + this.content.pagingNote + "
    " - ); - this.$pagingNote.append(this.$settingsButton); - this.$content.append(this.$pagingNote); - - this.$imageOptionsContainer = $('
  • '); - this.$downloadOptions.append(this.$imageOptionsContainer); - this.$imageOptions = $(""); - this.$imageOptionsContainer.append(this.$imageOptions); - - this.$currentViewAsJpgButton = $( - '
  • ' - ); - this.$imageOptions.append(this.$currentViewAsJpgButton); - this.$currentViewAsJpgButton.hide(); - - this.$wholeImageHighResButton = $( - '
  • ' - ); - this.$imageOptions.append(this.$wholeImageHighResButton); - this.$wholeImageHighResButton.hide(); - - this.$wholeImagesHighResButton = $( - '
  • ' - ); - this.$imageOptions.append(this.$wholeImagesHighResButton); - this.$wholeImageHighResButton.hide(); - - this.$wholeImageLowResAsJpgButton = $( - '
  • " - ); - this.$imageOptions.append(this.$wholeImageLowResAsJpgButton); - this.$wholeImageLowResAsJpgButton.hide(); - - this.$canvasOptionsContainer = $('
  • '); - this.$downloadOptions.append(this.$canvasOptionsContainer); - this.$canvasOptions = $(""); - this.$canvasOptionsContainer.append(this.$canvasOptions); - - this.$manifestOptionsContainer = $('
  • '); - this.$downloadOptions.append(this.$manifestOptionsContainer); - this.$manifestOptions = $(""); - this.$manifestOptionsContainer.append(this.$manifestOptions); - - this.$selectionButton = $( - '
  • ' - ); - this.$manifestOptions.append(this.$selectionButton); - this.$selectionButton.hide(); - - this.$downloadButton = $( - '' + - this.content.download + - "" - ); - this.$buttons.prepend(this.$downloadButton); - - this.$explanatoryTextTemplate = $(''); - - const that = this; - - // what happens on download is specific to the extension (except for renderings which need to be moved to the base download dialogue) - // todo: we need to make everything a list of radio button options in the base class, then we can unify everything into a single render method - this.$downloadButton.on("click", (e) => { - e.preventDefault(); - - const $selectedOption: JQuery = that.getSelectedOption(); - - const id: string = $selectedOption.attr("id"); - const label: string = $selectedOption.attr("title"); - const mime: any = $selectedOption.data("mime"); - let type: string = DownloadOption.UNKNOWN; - const canvas: Canvas = this.extension.helper.getCurrentCanvas(); - - if (this.renderingUrls[id]) { - if (mime) { - if (mime.toLowerCase().indexOf("pdf") !== -1) { - type = DownloadOption.ENTIRE_DOCUMENT_AS_PDF; - } else if (mime.toLowerCase().indexOf("txt") !== -1) { - type = DownloadOption.ENTIRE_DOCUMENT_AS_TEXT; - } - } - - if ((type = DownloadOption.ENTIRE_DOCUMENT_AS_PDF)) { - //var printService: manifesto.Service = this.extension.helper.manifest.getService(manifesto.ServiceProfile.printExtensions()); - - // if downloading a pdf - if there's a print service, generate an event instead of opening a new window. - // if (printService && this.extension.isOnHomeDomain()){ - // this.component.publish(Events.PRINT); - // } else { - window.open(this.renderingUrls[id]); - //} - } - } else { - type = id; - switch (type) { - case DownloadOption.CURRENT_VIEW: - const viewer: any = (( - that.extension - )).getViewer(); - window.open( - ( - (that.extension).getCroppedImageUri( - canvas, - viewer - ) - ) - ); - break; - case DownloadOption.SELECTION: - Async.waitFor( - () => { - return !this.isActive; - }, - () => { - this.extensionHost.publish( - IIIFEvents.SHOW_MULTISELECT_DIALOGUE - ); - } - ); - break; - case DownloadOption.WHOLE_IMAGE_HIGH_RES: - window.open( - this.getCanvasHighResImageUri( - this.extension.helper.getCurrentCanvas() - ) - ); - break; - case DownloadOption.WHOLE_IMAGES_HIGH_RES: - const indices: number[] = this.extension.getPagedIndices(); - - for (let i = 0; i < indices.length; i++) { - window.open( - this.getCanvasHighResImageUri( - this.extension.helper.getCanvasByIndex(indices[i]) - ) - ); - } - - break; - case DownloadOption.WHOLE_IMAGE_LOW_RES: - const imageUri: string | null = (( - that.extension - )).getConfinedImageUri(canvas, that.options.confinedImageSize); - - if (imageUri) { - window.open(imageUri); - } - break; - } - } - - this.extensionHost.publish(IIIFEvents.DOWNLOAD, { - type: type, - label: label, - }); - - this.close(); - }); - - this.$settingsButton.onPressed(() => { - this.extensionHost.publish(IIIFEvents.HIDE_DOWNLOAD_DIALOGUE); - this.extensionHost.publish(IIIFEvents.SHOW_SETTINGS_DIALOGUE); - }); - } - - open(triggerButton?: HTMLElement) { - super.open(triggerButton); - - const canvas: Canvas = this.extension.helper.getCurrentCanvas(); - - const rotation: number = ( - (this.extension).getViewerRotation() - ); - const hasNormalDimensions: boolean = rotation % 180 == 0; - - if (this.isDownloadOptionAvailable(DownloadOption.CURRENT_VIEW)) { - const $input: JQuery = this.$currentViewAsJpgButton.find("input"); - const $label: JQuery = this.$currentViewAsJpgButton.find("label"); - - let label: string = this.content.currentViewAsJpg; - const viewer = (this.extension).getViewer(); - const dimensions: CroppedImageDimensions | null = (< - OpenSeadragonExtension - >this.extension).getCroppedImageDimensions(canvas, viewer); - - // dimensions - if (dimensions) { - label = hasNormalDimensions - ? Strings.format( - label, - dimensions.size.width.toString(), - dimensions.size.height.toString() - ) - : Strings.format( - label, - dimensions.size.height.toString(), - dimensions.size.width.toString() - ); - $label.text(label); - $input.prop("title", label); - this.$currentViewAsJpgButton.data("width", dimensions.size.width); - this.$currentViewAsJpgButton.data("height", dimensions.size.height); - this.$currentViewAsJpgButton.show(); - } else { - this.$currentViewAsJpgButton.hide(); - } - - // explanatory text - if (Bools.getBool(this.options.optionsExplanatoryTextEnabled, false)) { - const text: string = this.content.currentViewAsJpgExplanation; - if (text) { - const $span = this.$explanatoryTextTemplate.clone(); - $span.text(text); - $label.append($span); - } - } - } else { - this.$currentViewAsJpgButton.hide(); - } - - if (this.isDownloadOptionAvailable(DownloadOption.WHOLE_IMAGE_HIGH_RES)) { - const $input: JQuery = this.$wholeImageHighResButton.find("input"); - const $label: JQuery = this.$wholeImageHighResButton.find("label"); - let mime: string | null = this.getCanvasMimeType( - this.extension.helper.getCurrentCanvas() - ); - - if (mime) { - mime = Files.simplifyMimeType(mime); - } else { - mime = "?"; - } - - // dimensions - const size: Size | null = this.getCanvasComputedDimensions( - this.extension.helper.getCurrentCanvas() - ); - - if (!size) { - // if there is no image service, allow the image to be downloaded directly. - if ( - canvas.externalResource && - !canvas.externalResource.hasServiceDescriptor() - ) { - const label: string = Strings.format( - this.content.wholeImageHighRes, - "?", - "?", - mime - ); - $label.text(label); - $input.prop("title", label); - this.$wholeImageHighResButton.show(); - } else { - this.$wholeImageHighResButton.hide(); - } - } else { - const label: string = hasNormalDimensions - ? Strings.format( - this.content.wholeImageHighRes, - size.width.toString(), - size.height.toString(), - mime - ) - : Strings.format( - this.content.wholeImageHighRes, - size.height.toString(), - size.width.toString(), - mime - ); - $label.text(label); - $input.prop("title", label); - - this.$wholeImageHighResButton.data("width", size.width); - this.$wholeImageHighResButton.data("height", size.height); - - this.$wholeImageHighResButton.show(); - } - - // explanatory text - if (Bools.getBool(this.options.optionsExplanatoryTextEnabled, false)) { - const text: string = this.content.wholeImageHighResExplanation; - if (text) { - const $span: JQuery = this.$explanatoryTextTemplate.clone(); - $span.text(text); - $label.append($span); - } - } - } else { - this.$wholeImageHighResButton.hide(); - } - - if (this.isDownloadOptionAvailable(DownloadOption.WHOLE_IMAGES_HIGH_RES)) { - const $input: JQuery = this.$wholeImagesHighResButton.find("input"); - const $label: JQuery = this.$wholeImagesHighResButton.find("label"); - let mime: string | null = this.getCanvasMimeType( - this.extension.helper.getCurrentCanvas() - ); - - if (mime) { - mime = Files.simplifyMimeType(mime); - } else { - mime = "?"; - } - - const label: string = Strings.format( - this.content.wholeImagesHighRes, - mime - ); - $label.text(label); - $input.prop("title", label); - - this.$wholeImagesHighResButton.show(); - - // explanatory text - if (Bools.getBool(this.options.optionsExplanatoryTextEnabled, false)) { - const text: string = this.content.wholeImagesHighResExplanation; - if (text) { - const $span: JQuery = this.$explanatoryTextTemplate.clone(); - $span.text(text); - $label.append($span); - } - } - } else { - this.$wholeImagesHighResButton.hide(); - } - - if (this.isDownloadOptionAvailable(DownloadOption.WHOLE_IMAGE_LOW_RES)) { - const $input: JQuery = this.$wholeImageLowResAsJpgButton.find("input"); - const $label: JQuery = this.$wholeImageLowResAsJpgButton.find("label"); - const size: Size | null = (( - this.extension - )).getConfinedImageDimensions(canvas, this.options.confinedImageSize); - const label = hasNormalDimensions - ? Strings.format( - this.content.wholeImageLowResAsJpg, - size.width.toString(), - size.height.toString() - ) - : Strings.format( - this.content.wholeImageLowResAsJpg, - size.height.toString(), - size.width.toString() - ); - $label.text(label); - $input.prop("title", label); - this.$wholeImageLowResAsJpgButton.data("width", size.width); - this.$wholeImageLowResAsJpgButton.data("height", size.height); - this.$wholeImageLowResAsJpgButton.show(); - - // explanatory text - if (Bools.getBool(this.options.optionsExplanatoryTextEnabled, false)) { - const text: string = this.content.wholeImageLowResAsJpgExplanation; - if (text) { - const $span = this.$explanatoryTextTemplate.clone(); - $span.text(text); - $label.append($span); - } - } - } else { - this.$wholeImageLowResAsJpgButton.hide(); - } - - if (this.isDownloadOptionAvailable(DownloadOption.SELECTION)) { - const $input: JQuery = this.$selectionButton.find("input"); - const $label: JQuery = this.$selectionButton.find("label"); - $label.text(this.content.downloadSelection); - $input.prop("title", this.content.downloadSelection); - this.$selectionButton.show(); - - // explanatory text - if (Bools.getBool(this.options.optionsExplanatoryTextEnabled, false)) { - const text: string = this.content.selectionExplanation; - if (text) { - const $span = this.$explanatoryTextTemplate.clone(); - $span.text(text); - $label.append($span); - } - } - } else { - this.$selectionButton.hide(); - } - - this.resetDynamicDownloadOptions(); - - if (this.isDownloadOptionAvailable(DownloadOption.RANGE_RENDERINGS)) { - if (canvas.ranges && canvas.ranges.length) { - for (let i = 0; i < canvas.ranges.length; i++) { - const range: Range = canvas.ranges[i]; - const renderingOptions: IRenderingOption[] = this.getDownloadOptionsForRenderings( - range, - this.content.entireFileAsOriginal, - DownloadOption.CANVAS_RENDERINGS - ); - this.addDownloadOptionsForRenderings(renderingOptions); - } - } - } - - if (this.isDownloadOptionAvailable(DownloadOption.IMAGE_RENDERINGS)) { - const images: Annotation[] = canvas.getImages(); - for (let i = 0; i < images.length; i++) { - const renderingOptions: IRenderingOption[] = this.getDownloadOptionsForRenderings( - images[i].getResource(), - this.content.entireFileAsOriginal, - DownloadOption.IMAGE_RENDERINGS - ); - this.addDownloadOptionsForRenderings(renderingOptions); - } - } - - if (this.isDownloadOptionAvailable(DownloadOption.CANVAS_RENDERINGS)) { - const renderingOptions: IRenderingOption[] = this.getDownloadOptionsForRenderings( - canvas, - this.content.entireFileAsOriginal, - DownloadOption.CANVAS_RENDERINGS - ); - this.addDownloadOptionsForRenderings(renderingOptions); - } - - if (this.isDownloadOptionAvailable(DownloadOption.MANIFEST_RENDERINGS)) { - let renderingOptions: IRenderingOption[] = this.getDownloadOptionsForRenderings( - this.extension.helper.getCurrentSequence(), - this.content.entireDocument, - DownloadOption.MANIFEST_RENDERINGS - ); - - if (!renderingOptions.length && this.extension.helper.manifest) { - renderingOptions = this.getDownloadOptionsForRenderings( - this.extension.helper.manifest, - this.content.entireDocument, - DownloadOption.MANIFEST_RENDERINGS - ); - } - - this.addDownloadOptionsForRenderings(renderingOptions); - } - - // hide the current view option if it's equivalent to whole image. - if (this.isDownloadOptionAvailable(DownloadOption.CURRENT_VIEW)) { - const currentWidth: number = parseInt( - this.$currentViewAsJpgButton.data("width").toString() - ); - const currentHeight: number = parseInt( - this.$currentViewAsJpgButton.data("height").toString() - ); - const wholeWidth: number = parseInt( - this.$wholeImageHighResButton.data("width").toString() - ); - const wholeHeight: number = parseInt( - this.$wholeImageHighResButton.data("height").toString() - ); - - const percentageWidth: number = (currentWidth / wholeWidth) * 100; - const percentageHeight: number = (currentHeight / wholeHeight) * 100; - - const disabledPercentage: number = this.options - .currentViewDisabledPercentage; - - // if over disabledPercentage of the size of whole image - if ( - percentageWidth >= disabledPercentage && - percentageHeight >= disabledPercentage - ) { - this.$currentViewAsJpgButton.hide(); - } else { - this.$currentViewAsJpgButton.show(); - } - } - - // order by image area - let $options: any = this.$imageOptions.find("li.single"); - - $options = $options.sort((a: any, b: any) => { - let aWidth: any = $(a).data("width"); - aWidth ? (aWidth = parseInt(aWidth.toString())) : 0; - - let aHeight: any = $(a).data("height"); - aHeight ? (aHeight = parseInt(aHeight.toString())) : 0; - - let bWidth: any = $(b).data("width"); - bWidth ? (bWidth = parseInt(bWidth.toString())) : 0; - - let bHeight: any = $(b).data("height"); - bHeight ? (bHeight = parseInt(bHeight.toString())) : 0; - - const aArea: number = aWidth * aHeight; - const bArea: number = bWidth * bHeight; - - if (aArea < bArea) { - return -1; - } - - if (aArea > bArea) { - return 1; - } - - return 0; - }); - - $options.detach().appendTo(this.$imageOptions); - - // hide empty groups - const $groups: JQuery = this.$downloadOptions.find("li.group"); - - $groups.each((index: number, group: Element) => { - const $group: JQuery = $(group); - - $group.show(); - - if ( - $group.find("li.option:hidden").length === - $group.find("li.option").length - ) { - // all options are hidden, hide group. - $group.hide(); - } - }); - - this.$downloadOptions - .find("li.group:visible") - .last() - .addClass("lastVisible"); - - if ( - (this.extension).isPagingSettingEnabled() && - this.config.options.downloadPagingNoteEnabled - ) { - this.$pagingNote.show(); - } else { - this.$pagingNote.hide(); - } - - if (!this.$downloadOptions.find("li.option:visible").length) { - this.$noneAvailable.show(); - this.$downloadButton.hide(); - } else { - // select first option. - this.$downloadOptions - .find("li.option input:visible:first") - .prop("checked", true); - this.$noneAvailable.hide(); - this.$downloadButton.show(); - } - - this.resize(); - } - - addDownloadOptionsForRenderings(renderingOptions: IRenderingOption[]): void { - renderingOptions.forEach((option: IRenderingOption) => { - switch (option.type) { - case DownloadOption.IMAGE_RENDERINGS: - this.$imageOptions.append(option.button); - break; - case DownloadOption.CANVAS_RENDERINGS: - this.$canvasOptions.append(option.button); - break; - case DownloadOption.MANIFEST_RENDERINGS: - this.$manifestOptions.append(option.button); - break; - } - }); - } - - getCanvasImageResource(canvas: Canvas): Resource | null { - const images: Annotation[] = canvas.getImages(); - if (images[0]) { - return images[0].getResource(); - } - return null; - } - - getCanvasHighResImageUri(canvas: Canvas): string { - const size: Size | null = this.getCanvasComputedDimensions(canvas); - - if (size) { - const width: number = size.width; - let uri: string = canvas.getCanonicalImageUri(width); - - if ( - canvas.externalResource && - canvas.externalResource.hasServiceDescriptor() - ) { - const uri_parts: string[] = uri.split("/"); - const rotation: number = ( - (this.extension).getViewerRotation() - ); - uri_parts[uri_parts.length - 2] = String(rotation); - uri = uri_parts.join("/"); - } - - return uri; - } else if ( - canvas.externalResource && - !canvas.externalResource.hasServiceDescriptor() - ) { - // if there is no image service, return the dataUri. - return canvas.externalResource.dataUri; - } - return ""; - } - - getCanvasMimeType(canvas: Canvas): string | null { - const resource: Resource | null = this.getCanvasImageResource(canvas); - - if (resource) { - const format: MediaType | null = resource.getFormat(); - - if (format) { - return format.toString(); - } - } - - return null; - } - - getCanvasDimensions(canvas: Canvas): Size | null { - // externalResource may not have loaded yet - if (canvas.externalResource.data) { - const width: number | undefined = (( - canvas.externalResource.data - )).width; - const height: number | undefined = (( - canvas.externalResource.data - )).height; - if (width && height) { - return new Size(width, height); - } - } - - return null; - } - - getCanvasComputedDimensions(canvas: Canvas): Size | null { - const imageSize: Size | null = this.getCanvasDimensions(canvas); - const requiredSize: Size | null = canvas.getMaxDimensions(); - - if (!imageSize) { - return null; - } - - if (!requiredSize) { - return imageSize; - } - - if ( - imageSize.width <= requiredSize.width && - imageSize.height <= requiredSize.height - ) { - return imageSize; - } - - const scaleW: number = requiredSize.width / imageSize.width; - const scaleH: number = requiredSize.height / imageSize.height; - const scale: number = Math.min(scaleW, scaleH); - - return new Size( - Math.floor(imageSize.width * scale), - Math.floor(imageSize.height * scale) - ); - } - - private _isLevel0(profile: any): boolean { - if (!profile || !profile.length) return false; - - return Utils.isLevel0ImageProfile(profile[0]); - } - - isDownloadOptionAvailable(option: DownloadOption): boolean { - if (!this.extension.resources) { - return false; - } - - const canvas: Canvas = this.extension.helper.getCurrentCanvas(); - - // if the external resource doesn't have a service descriptor or is level 0 - // only allow wholeImageHighRes - if ( - !canvas.externalResource.hasServiceDescriptor() || - this._isLevel0(canvas.externalResource.data.profile) - ) { - if (option === DownloadOption.WHOLE_IMAGE_HIGH_RES) { - // if in one-up mode, or in two-up mode with a single page being shown - if ( - !(this.extension).isPagingSettingEnabled() || - ((this.extension).isPagingSettingEnabled() && - this.extension.resources && - this.extension.resources.length === 1) - ) { - return true; - } - } - return false; - } - - switch (option) { - case DownloadOption.CURRENT_VIEW: - case DownloadOption.CANVAS_RENDERINGS: - case DownloadOption.IMAGE_RENDERINGS: - case DownloadOption.WHOLE_IMAGE_HIGH_RES: - // if in one-up mode, or in two-up mode with a single page being shown - if ( - !(this.extension).isPagingSettingEnabled() || - ((this.extension).isPagingSettingEnabled() && - this.extension.resources && - this.extension.resources.length === 1) - ) { - const maxDimensions: Size | null = canvas.getMaxDimensions(); - - if (maxDimensions) { - if (maxDimensions.width <= this.options.maxImageWidth) { - return true; - } else { - return false; - } - } - return true; - } - return false; - case DownloadOption.WHOLE_IMAGES_HIGH_RES: - if ( - (this.extension).isPagingSettingEnabled() && - this.extension.resources && - this.extension.resources.length > 1 - ) { - return true; - } - return false; - case DownloadOption.WHOLE_IMAGE_LOW_RES: - // hide low-res option if hi-res width is smaller than constraint - const size: Size | null = this.getCanvasComputedDimensions(canvas); - if (!size) { - return false; - } - return ( - !(this.extension).isPagingSettingEnabled() && - size.width > this.options.confinedImageSize - ); - case DownloadOption.SELECTION: - return this.options.selectionEnabled; - case DownloadOption.RANGE_RENDERINGS: - if (canvas.ranges && canvas.ranges.length) { - const range: Range = canvas.ranges[0]; - return range.getRenderings().length > 0; - } - return false; - default: - return super.isDownloadOptionAvailable(option); - } - } -} diff --git a/src/content-handlers/iiif/extensions/uv-openseadragon-extension/ShareDialogue.ts b/src/content-handlers/iiif/extensions/uv-openseadragon-extension/ShareDialogue.ts index 354002a42..1396ff329 100644 --- a/src/content-handlers/iiif/extensions/uv-openseadragon-extension/ShareDialogue.ts +++ b/src/content-handlers/iiif/extensions/uv-openseadragon-extension/ShareDialogue.ts @@ -1,8 +1,11 @@ import { OpenSeadragonExtensionEvents } from "./Events"; import OpenSeadragonExtension from "./Extension"; import { ShareDialogue as BaseShareDialogue } from "../../modules/uv-dialogues-module/ShareDialogue"; +import { Config } from "../uv-openseadragon-extension/config/Config"; -export class ShareDialogue extends BaseShareDialogue { +export class ShareDialogue extends BaseShareDialogue< + Config["modules"]["shareDialogue"] +> { constructor($element: JQuery) { super($element); diff --git a/src/content-handlers/iiif/extensions/uv-openseadragon-extension/config/Config.ts b/src/content-handlers/iiif/extensions/uv-openseadragon-extension/config/Config.ts index fc2480b93..0da36408c 100644 --- a/src/content-handlers/iiif/extensions/uv-openseadragon-extension/config/Config.ts +++ b/src/content-handlers/iiif/extensions/uv-openseadragon-extension/config/Config.ts @@ -1,99 +1,23 @@ import { BaseConfig, + CenterPanelContent, + CenterPanelOptions, + DialogueContent, + DialogueOptions, + DownloadDialogueContent, + DownloadDialogueOptions, FooterPanelContent, FooterPanelOptions, HeaderPanelContent, HeaderPanelOptions, - LeftPanelContent, - LeftPanelOptions, + ModuleConfig, + ShareDialogueContent, + ShareDialogueOptions, } from "@/content-handlers/iiif/BaseConfig"; -/** - * Type for Thumbs Cache Invalidation - */ -type ThumbsCacheInvalidation = { - /** Determines if cache invalidation is enabled */ - enabled: boolean; - /** Type of the parameter for cache invalidation */ - paramType: string; -}; - -type ContentLeftPanelOptions = LeftPanelOptions & { - /** Determines if tree should expand automatically */ - autoExpandTreeEnabled: boolean; - /** Number of items to auto expand tree */ - autoExpandTreeIfFewerThan: number; - /** Determines if branch nodes expand on click */ - branchNodesExpandOnClick: boolean; - /** Determines if branch nodes are selectable */ - branchNodesSelectable: boolean; - /** Determines if tree is the default view */ - defaultToTreeEnabled: boolean; - /** Number of items to default to tree view */ - defaultToTreeIfGreaterThan: number; - /** Number of characters to elide at */ - elideCount: number; - /** Threshold for gallery thumb chunked resizing */ - galleryThumbChunkedResizingThreshold: number; - /** Height of the gallery thumbnail */ - galleryThumbHeight: number; - /** Padding for gallery thumb load */ - galleryThumbLoadPadding: number; - /** Width of the gallery thumbnail */ - galleryThumbWidth: number; - /** Height of the one column thumbnail */ - oneColThumbHeight: number; - /** Width of the one column thumbnail */ - oneColThumbWidth: number; - /** Determines if page mode is enabled */ - pageModeEnabled: boolean; - /** Order of the tabs */ - tabOrder: string; - /** Configuration for thumbs cache invalidation */ - thumbsCacheInvalidation: ThumbsCacheInvalidation; - /** Determines if thumbnails are enabled */ - thumbsEnabled: boolean; - /** Extra height for thumbnails */ - thumbsExtraHeight: number; - /** Duration for thumbnails image fade in */ - thumbsImageFadeInDuration: number; - /** Load range for thumbnails */ - thumbsLoadRange: number; - /** Determines if tree is enabled */ - treeEnabled: boolean; - /** Height of the two column thumbnail */ - twoColThumbHeight: number; - /** Width of the two column thumbnail */ - twoColThumbWidth: number; -}; +import { ContentLeftPanel } from "../../config/ContentLeftPanel"; -type ContentLeftPanelContent = LeftPanelContent & { - date: string; - index: string; - manifestRanges: string; - searchResult: string; - searchResults: string; - sortBy: string; - thumbnails: string; - title: string; - volume: string; -}; - -type ContentLeftPanel = { - options: ContentLeftPanelOptions; - content: ContentLeftPanelContent; -}; - -type HelpDialogueContent = { - text: string; - title: string; -}; - -type HelpDialogue = { - content: HelpDialogueContent; -}; - -type MultiSelectDialogueOptions = { +type MultiSelectDialogueOptions = DialogueOptions & { /** Determines if chunked resizing is enabled for gallery thumbnails */ galleryThumbChunkedResizingEnabled: boolean; /** Threshold for chunked resizing of gallery thumbnails */ @@ -108,13 +32,13 @@ type MultiSelectDialogueOptions = { pageModeEnabled: boolean; }; -type MultiSelectDialogueContent = { +type MultiSelectDialogueContent = DialogueContent & { select: string; selectAll: string; title: string; }; -type MultiSelectDialogue = { +export type MultiSelectDialogue = ModuleConfig & { options: MultiSelectDialogueOptions; content: MultiSelectDialogueContent; }; @@ -164,12 +88,12 @@ type PagingHeaderPanelContent = HeaderPanelContent & { twoUp: string; }; -type PagingHeaderPanel = { +type PagingHeaderPanel = ModuleConfig & { options: PagingHeaderPanelOptions; content: PagingHeaderPanelContent; }; -type OpenSeadragonCenterPanelOptions = { +type OpenSeadragonCenterPanelOptions = CenterPanelOptions & { /** Duration of the animation */ animationTime: number; /** Determines if controls are hidden automatically */ @@ -188,6 +112,8 @@ type OpenSeadragonCenterPanelOptions = { controlsFadeLength: number; /** Default zoom level */ defaultZoomLevel: number; + /** Determines if annotation is enabled */ + doubleClickAnnotationEnabled: boolean; /** Determines if rendering is immediate */ immediateRender: boolean; /** Maximum pixel ratio for zoom */ @@ -204,7 +130,7 @@ type OpenSeadragonCenterPanelOptions = { visibilityRatio: number; }; -type OpenSeadragonCenterPanelContent = { +type OpenSeadragonCenterPanelContent = CenterPanelContent & { attribution: string; goHome: string; imageUnavailable: string; @@ -215,7 +141,7 @@ type OpenSeadragonCenterPanelContent = { zoomOut: string; }; -type OpenSeadragonCenterPanel = { +type OpenSeadragonCenterPanel = ModuleConfig & { options: OpenSeadragonCenterPanelOptions; content: OpenSeadragonCenterPanelContent; }; @@ -254,114 +180,103 @@ type SearchFooterPanelContent = FooterPanelContent & { searchWithin: string; }; -type SearchFooterPanel = { +type SearchFooterPanel = ModuleConfig & { options: SearchFooterPanelOptions; content: SearchFooterPanelContent; }; -type SettingsDialogueContent = { - locale: string; - navigatorEnabled: string; - clickToZoomEnabled: string; - pagingEnabled: string; - reducedMotion: string; - preserveViewport: string; - title: string; - website: string; -}; - -type SettingsDialogue = { - content: SettingsDialogueContent; -}; - -type ShareDialogueOptions = { - /** Template for embedding */ - embedTemplate: string; - /** Determines if instructions are enabled */ - instructionsEnabled: boolean; - /** Determines if sharing frame is enabled */ - shareFrameEnabled: boolean; - /** Determines if sharing manifests is enabled */ - shareManifestsEnabled: boolean; -}; - -type ShareDialogueContent = { - customSize: string; - embed: string; - embedInstructions: string; - height: string; - iiif: string; - share: string; - shareInstructions: string; - size: string; - width: string; -}; - -type ShareDialogue = { - options: ShareDialogueOptions; - content: ShareDialogueContent; -}; +type MobileFooterPanelOptions = FooterPanelOptions & {}; -type AuthDialogueContent = { - cancel: string; - confirm: string; +type MobileFooterPanelContent = FooterPanelContent & { + rotateRight: string; + moreInfo: string; + zoomIn: string; + zoomOut: string; }; -type AuthDialogue = { - content: AuthDialogueContent; +type MobileFooterPanel = ModuleConfig & { + options: MobileFooterPanelOptions; + content: MobileFooterPanelContent; }; -type ClickThroughDialogueContent = { - viewTerms: string; +type OSDDownloadDialogueOptions = DownloadDialogueOptions & { + /** Size of the confined image */ + confinedImageSize: number; + /** Percentage of the current view that is disabled */ + currentViewDisabledPercentage: number; + /** Determines if download of current view is enabled */ + downloadCurrentViewEnabled: boolean; + /** Determines if download of whole image in high resolution is enabled */ + downloadWholeImageHighResEnabled: boolean; + /** Determines if download of whole image in low resolution is enabled */ + downloadWholeImageLowResEnabled: boolean; + /** Maximum width of the image */ + maxImageWidth: number; + /** Determines if explanatory text for options is enabled */ + optionsExplanatoryTextEnabled: boolean; + /** Determines if selection is enabled */ + selectionEnabled: boolean; +}; + +type OSDDownloadDialogueContent = DownloadDialogueContent & { + allPages: string; + currentViewAsJpg: string; + currentViewAsJpgExplanation: string; + download: string; + downloadSelection: string; + downloadSelectionExplanation: string; + editSettings: string; + entireDocument: string; + entireFileAsOriginal: string; + entireFileAsOriginalWithFormat: string; + individualPages: string; + noneAvailable: string; + pagingNote: string; + preview: string; + selection: string; + termsOfUse: string; + title: string; + wholeImageHighRes: string; + wholeImageHighResExplanation: string; + wholeImageLowResAsJpg: string; + wholeImageLowResAsJpgExplanation: string; + wholeImagesHighRes: string; + wholeImagesHighResExplanation: string; }; -type ClickThroughDialogue = { - content: ClickThroughDialogueContent; +type OSDDownloadDialogue = ModuleConfig & { + options: OSDDownloadDialogueOptions; + content: OSDDownloadDialogueContent; }; -type LoginDialogueContent = { - login: string; - logout: string; - cancel: string; -}; +type OSDShareDialogueOptions = ShareDialogueOptions & {}; -type LoginDialogue = { - content: LoginDialogueContent; -}; +type OSDShareDialogueContent = ShareDialogueContent & {}; -type MobileFooterPanelContent = { - rotateRight: string; - moreInfo: string; - zoomIn: string; - zoomOut: string; +type OSDShareDialogue = ModuleConfig & { + options: OSDShareDialogueOptions; + content: OSDShareDialogueContent; }; -type MobileFooterPanel = { - content: MobileFooterPanelContent; -}; +type OSDSettingsDialogueOptions = ShareDialogueOptions & {}; -type RestrictedDialogueContent = { - cancel: string; -}; +type OSDSettingsDialogueContent = ShareDialogueContent & {}; -type RestrictedDialogue = { - content: RestrictedDialogueContent; +type OSDSettingsDialogue = ModuleConfig & { + options: OSDSettingsDialogueOptions; + content: OSDSettingsDialogueContent; }; type Modules = { contentLeftPanel: ContentLeftPanel; - helpDialogue: HelpDialogue; + downloadDialogue: OSDDownloadDialogue; multiSelectDialogue: MultiSelectDialogue; pagingHeaderPanel: PagingHeaderPanel; openSeadragonCenterPanel: OpenSeadragonCenterPanel; searchFooterPanel: SearchFooterPanel; - settingsDialogue: SettingsDialogue; - shareDialogue: ShareDialogue; - authDialogue: AuthDialogue; - clickThroughDialogue: ClickThroughDialogue; - loginDialogue: LoginDialogue; mobileFooterPanel: MobileFooterPanel; - restrictedDialogue: RestrictedDialogue; + shareDialogue: OSDShareDialogue; + settingsDialogue: OSDSettingsDialogue; }; export type Config = BaseConfig & { diff --git a/src/content-handlers/iiif/extensions/uv-openseadragon-extension/config/config.json b/src/content-handlers/iiif/extensions/uv-openseadragon-extension/config/config.json index d0ea1fe0b..2f02fb281 100644 --- a/src/content-handlers/iiif/extensions/uv-openseadragon-extension/config/config.json +++ b/src/content-handlers/iiif/extensions/uv-openseadragon-extension/config/config.json @@ -94,11 +94,13 @@ "thumbsExtraHeight": 8, "thumbsImageFadeInDuration": 300, "thumbsLoadRange": 15, + "topCloseButtonEnabled": false, "treeEnabled": true, "twoColThumbHeight": 150, "twoColThumbWidth": 90 }, "content": { + "close": "$close", "collapse": "$collapse", "collapseFull": "$collapseFull", "date": "$date", @@ -131,10 +133,12 @@ "downloadWholeImageLowResEnabled": true, "maxImageWidth": 5000, "optionsExplanatoryTextEnabled": false, - "selectionEnabled": false + "selectionEnabled": false, + "topCloseButtonEnabled": false }, "content": { "allPages": "$allPages", + "close": "$close", "currentViewAsJpg": "$currentViewAsJpg", "currentViewAsJpgExplanation": "$openNewWindow", "download": "$download", @@ -143,6 +147,7 @@ "editSettings": "$editSettings", "entireDocument": "$entireDocument", "entireFileAsOriginal": "$entireFile", + "entireFileAsOriginalWithFormat": "$entireFileWithFormat", "individualPages": "$individualPages", "noneAvailable": "$noDownloadOptionsAvailable", "pagingNote": "$pagingNote", @@ -184,8 +189,12 @@ } }, "genericDialogue": { + "options": { + "topCloseButtonEnabled": false + }, "content": { "emptyValue": "$emptyValue", + "close": "$close", "invalidNumber": "$invalidNumber", "noMatches": "$noMatches", "ok": "$ok", @@ -205,7 +214,11 @@ } }, "helpDialogue": { + "options": { + "topCloseButtonEnabled": false + }, "content": { + "close": "$close", "text": "$placeholder_text", "title": "$help" } @@ -215,6 +228,8 @@ "canvasDisplayOrder": "", "canvasExclude": "", "copyToClipboardEnabled": false, + "expandFullEnabled": false, + "limitToRange": false, "manifestDisplayOrder": "", "manifestExclude": "", "panelAnimationDuration": 250, @@ -224,11 +239,13 @@ "rtlLanguageCodes": "ar, ara, dv, div, he, heb, ur, urd", "showAllLanguages": false, "textLimit": 4, - "textLimitType": "lines" + "textLimitType": "lines", + "topCloseButtonEnabled": false }, "content": { "attribution": "$attribution", "canvasHeader": "$aboutTheImage", + "close": "$close", "collapse": "$collapseInformation", "collapseFull": "$collapseGallery", "copiedToClipboard": "$copiedToClipboard", @@ -255,9 +272,11 @@ "galleryThumbHeight": 320, "galleryThumbLoadPadding": 3, "galleryThumbWidth": 200, - "pageModeEnabled": true + "pageModeEnabled": true, + "topCloseButtonEnabled": false }, "content": { + "close": "$close", "select": "$download", "selectAll": "$selectAll", "title": "$selectPagesForDownload" @@ -305,22 +324,37 @@ "twoUp": "$twoPageView" } }, + "centerPanel": { + "options": { + "titleEnabled": true, + "subtitleEnabled": true, + "mostSpecificRequiredStatement": true, + "requiredStatementEnabled": true + }, + "content": { + "attribution": "$attribution" + } + }, "openSeadragonCenterPanel": { "options": { "animationTime": 0.15, "autoHideControls": true, - "requiredStatementEnabled": true, "blendTime": 0, "constrainDuringPan": false, "controlsFadeAfterInactive": 1500, "controlsFadeDelay": 250, "controlsFadeLength": 250, "defaultZoomLevel": 0, + "doubleClickAnnotationEnabled": false, "immediateRender": false, "maxZoomPixelRatio": 1.25, + "mostSpecificRequiredStatement": true, "navigatorPosition": "BOTTOM_RIGHT", "pageGap": 50, + "requiredStatementEnabled": true, "showHomeControl": false, + "subtitleEnabled": true, + "titleEnabled": true, "trimAttributionCount": 150, "visibilityRatio": 0.5 }, @@ -383,7 +417,11 @@ } }, "settingsDialogue": { + "options": { + "topCloseButtonEnabled": false + }, "content": { + "close": "$close", "locale": "$locale", "navigatorEnabled": "$navigatorEnabled", "clickToZoomEnabled": "$clickToZoomEnabled", @@ -396,12 +434,16 @@ }, "shareDialogue": { "options": { + "embedEnabled": true, "embedTemplate": "", "instructionsEnabled": false, + "shareEnabled": true, "shareFrameEnabled": true, - "shareManifestsEnabled": true + "shareManifestsEnabled": true, + "topCloseButtonEnabled": false }, "content": { + "close": "$close", "customSize": "$custom", "embed": "$embed", "embedInstructions": "$embedInstructions", @@ -409,39 +451,76 @@ "iiif": "$iiifManifest", "share": "$share", "shareInstructions": "$shareInstructions", + "shareUrl": "$shareUrl", "size": "$size", "width": "$width" } }, "authDialogue": { + "options": { + "topCloseButtonEnabled": false + }, "content": { "cancel": "$cancel", - "confirm": "$confirm" + "confirm": "$confirm", + "close": "$close" } }, "clickThroughDialogue": { + "options": { + "topCloseButtonEnabled": false + }, "content": { + "close": "$close", "viewTerms": "$viewTerms" } }, "loginDialogue": { + "options": { + "topCloseButtonEnabled": false + }, "content": { "login": "$login", "logout": "$logout", - "cancel": "$cancel" + "cancel": "$cancel", + "close": "$close" } }, "mobileFooterPanel": { + "options": { + "bookmarkEnabled": false, + "downloadEnabled": true, + "embedEnabled": false, + "feedbackEnabled": false, + "fullscreenEnabled": true, + "minimiseButtons": true, + "moreInfoEnabled": true, + "openEnabled": false, + "printEnabled": false, + "shareEnabled": true + }, "content": { "rotateRight": "$rotateRight", "moreInfo": "$moreInfo", "zoomIn": "$zoomIn", - "zoomOut": "$zoomOut" + "zoomOut": "$zoomOut", + "bookmark": "$add_to_bookmarks", + "download": "$download", + "embed": "$embed", + "exitFullScreen": "$exitFullScreen", + "feedback": "$feedback", + "fullScreen": "$fullScreen", + "open": "$open", + "share": "$share" } }, "restrictedDialogue": { + "options": { + "topCloseButtonEnabled": false + }, "content": { - "cancel": "$cancel" + "cancel": "$cancel", + "close": "$close" } } }, diff --git a/src/content-handlers/iiif/extensions/uv-pdf-extension/Extension.ts b/src/content-handlers/iiif/extensions/uv-pdf-extension/Extension.ts index cb550fbeb..b2152407f 100644 --- a/src/content-handlers/iiif/extensions/uv-pdf-extension/Extension.ts +++ b/src/content-handlers/iiif/extensions/uv-pdf-extension/Extension.ts @@ -79,7 +79,10 @@ export default class Extension extends BaseExtension isHeaderPanelEnabled(): boolean { return ( super.isHeaderPanelEnabled() && - Bools.getBool(this.data.config!.options.usePdfJs, true) + Bools.getBool( + this.data.config!.modules.pdfCenterPanel.options.usePdfJs, + true + ) ); } diff --git a/src/content-handlers/iiif/extensions/uv-pdf-extension/ShareDialogue.ts b/src/content-handlers/iiif/extensions/uv-pdf-extension/ShareDialogue.ts index 96a4abf89..62dee6cd5 100644 --- a/src/content-handlers/iiif/extensions/uv-pdf-extension/ShareDialogue.ts +++ b/src/content-handlers/iiif/extensions/uv-pdf-extension/ShareDialogue.ts @@ -1,7 +1,10 @@ import { ShareDialogue as BaseShareDialogue } from "../../modules/uv-dialogues-module/ShareDialogue"; +import { Config } from "../uv-pdf-extension/config/Config"; import { IPDFExtension } from "./IPDFExtension"; -export class ShareDialogue extends BaseShareDialogue { +export class ShareDialogue extends BaseShareDialogue< + Config["modules"]["shareDialogue"] +> { constructor($element: JQuery) { super($element); } diff --git a/src/content-handlers/iiif/extensions/uv-pdf-extension/config/Config.ts b/src/content-handlers/iiif/extensions/uv-pdf-extension/config/Config.ts index 254955eeb..9f9e6720c 100644 --- a/src/content-handlers/iiif/extensions/uv-pdf-extension/config/Config.ts +++ b/src/content-handlers/iiif/extensions/uv-pdf-extension/config/Config.ts @@ -1,10 +1,30 @@ import { BaseConfig, + CenterPanelContent, + CenterPanelOptions, + DownloadDialogueContent, + DownloadDialogueOptions, HeaderPanelContent, HeaderPanelOptions, - Options, + ModuleConfig, + SettingsDialogueContent, + SettingsDialogueOptions, + ShareDialogueContent, + ShareDialogueOptions, } from "@/content-handlers/iiif/BaseConfig"; +type PDFCenterPanelOptions = CenterPanelOptions & { + /** Determines if PDF.js should be used for PDF rendering */ + usePdfJs?: boolean; +}; + +type PDFCenterPanelContent = CenterPanelContent & {}; + +type PDFCenterPanel = { + options: PDFCenterPanelOptions; + content: PDFCenterPanelContent; +}; + type PDFHeaderPanelOptions = HeaderPanelOptions & {}; type PDFHeaderPanelContent = HeaderPanelContent & { @@ -23,16 +43,41 @@ type PDFHeaderPanel = { content: PDFHeaderPanelContent; }; -type Modules = { - pdfHeaderPanel: PDFHeaderPanel; +type PDFDownloadDialogueOptions = DownloadDialogueOptions & {}; + +type PDFDownloadDialogueContent = DownloadDialogueContent & {}; + +type PDFDownloadDialogue = ModuleConfig & { + options: PDFDownloadDialogueOptions; + content: PDFDownloadDialogueContent; }; -type PDFOptions = Options & { - /** Determines if PDF.js should be used for PDF rendering */ - usePdfJs?: boolean; +type PDFShareDialogueOptions = ShareDialogueOptions & {}; + +type PDFShareDialogueContent = ShareDialogueContent & {}; + +type PDFShareDialogue = ModuleConfig & { + options: PDFShareDialogueOptions; + content: PDFShareDialogueContent; +}; + +type PDFSettingsDialogueOptions = SettingsDialogueOptions & {}; + +type PDFSettingsDialogueContent = SettingsDialogueContent & {}; + +type PDFSettingsDialogue = { + options: PDFSettingsDialogueOptions; + content: PDFSettingsDialogueContent; +}; + +type Modules = { + pdfCenterPanel: PDFCenterPanel; + pdfHeaderPanel: PDFHeaderPanel; + settingsDialogue: PDFSettingsDialogue; + downloadDialogue: PDFDownloadDialogue; + shareDialogue: PDFShareDialogue; }; export type Config = BaseConfig & { - options: PDFOptions; modules: Modules; }; diff --git a/src/content-handlers/iiif/extensions/uv-pdf-extension/config/config.json b/src/content-handlers/iiif/extensions/uv-pdf-extension/config/config.json index fcdf5cbc9..af646b77b 100644 --- a/src/content-handlers/iiif/extensions/uv-pdf-extension/config/config.json +++ b/src/content-handlers/iiif/extensions/uv-pdf-extension/config/config.json @@ -62,22 +62,6 @@ "expandFull": "$expandGallery" } }, - "shareDialogue": { - "options": { - "embedTemplate": "" - }, - "content": { - "customSize": "$custom", - "embed": "$embed", - "embedInstructions": "$embedInstructions", - "height": "$height", - "iiif": "$iiifManifest", - "share": "$share", - "shareInstructions": "$shareInstructions", - "size": "$size", - "width": "$width" - } - }, "footerPanel": { "options": { "bookmarkEnabled": false, @@ -104,6 +88,9 @@ } }, "genericDialogue": { + "options": { + "topCloseButtonEnabled": false + }, "content": { "emptyValue": "$emptyValue", "invalidNumber": "$invalidNumber", @@ -125,6 +112,9 @@ } }, "helpDialogue": { + "options": { + "topCloseButtonEnabled": false + }, "content": { "text": "$placeholder_text text", "title": "$help" @@ -135,6 +125,8 @@ "canvasDisplayOrder": "", "canvasExclude": "", "copyToClipboardEnabled": false, + "expandFullEnabled": false, + "limitToRange": false, "manifestDisplayOrder": "", "manifestExclude": "", "panelAnimationDuration": 250, @@ -168,9 +160,23 @@ "title": "$moreInformation" } }, + "centerPanel": { + "options": { + "titleEnabled": true, + "subtitleEnabled": true, + "mostSpecificRequiredStatement": true, + "requiredStatementEnabled": true + }, + "content": { + "attribution": "$attribution" + } + }, "pdfCenterPanel": { "options": { - "titleEnabled": false + "titleEnabled": false, + "subtitleEnabled": true, + "mostSpecificRequiredStatement": true, + "requiredStatementEnabled": true }, "content": { "attribution": "$attribution" @@ -206,6 +212,9 @@ } }, "downloadDialogue": { + "options": { + "topCloseButtonEnabled": false + }, "content": { "allPages": "$allPages", "currentViewAsJpg": "$currentViewAsJpg", @@ -250,16 +259,73 @@ "settings": "$settings" } }, + "shareDialogue": { + "options": { + "embedTemplate": "", + "instructionsEnabled": false, + "shareFrameEnabled": true, + "shareManifestsEnabled": true, + "topCloseButtonEnabled": false + }, + "content": { + "customSize": "$custom", + "embed": "$embed", + "embedInstructions": "$embedInstructions", + "height": "$height", + "iiif": "$iiifManifest", + "share": "$share", + "shareInstructions": "$shareInstructions", + "size": "$size", + "width": "$width" + } + }, + "authDialogue": { + "options": { + "topCloseButtonEnabled": false + }, + "content": { + "cancel": "$cancel", + "confirm": "$confirm", + "close": "$close" + } + }, + "clickThroughDialogue": { + "options": { + "topCloseButtonEnabled": false + }, + "content": { + "viewTerms": "$viewTerms", + "close": "$close" + } + }, "loginDialogue": { + "options": { + "topCloseButtonEnabled": false + }, "content": { "login": "$login", + "logout": "$logout", + "cancel": "$cancel", + "close": "$close" + } + }, + "restrictedDialogue": { + "options": { + "topCloseButtonEnabled": false + }, + "content": { "cancel": "$cancel" } }, "settingsDialogue": { + "options": { + "topCloseButtonEnabled": false + }, "content": { "locale": "$locale", - "pagingEnabled": "$twoPageView", + "navigatorEnabled": "$navigatorEnabled", + "clickToZoomEnabled": "$clickToZoomEnabled", + "pagingEnabled": "$goHome", "reducedMotion": "$reducedMotion", "preserveViewport": "$preserveViewport", "title": "$settings", diff --git a/src/content-handlers/iiif/modules/uv-alephcenterpanel-module/AlephCenterPanel.ts b/src/content-handlers/iiif/modules/uv-alephcenterpanel-module/AlephCenterPanel.ts index 09027a0a3..3e26c11f9 100644 --- a/src/content-handlers/iiif/modules/uv-alephcenterpanel-module/AlephCenterPanel.ts +++ b/src/content-handlers/iiif/modules/uv-alephcenterpanel-module/AlephCenterPanel.ts @@ -20,8 +20,11 @@ import { } from "@universalviewer/aleph/loader"; import "@universalviewer/aleph/dist/collection/assets/OrbitControls"; import { Events } from "../../../../Events"; +import { Config } from "../../extensions/uv-aleph-extension/config/Config"; -export class AlephCenterPanel extends CenterPanel { +export class AlephCenterPanel extends CenterPanel< + Config["modules"]["alephCenterPanel"] +> { private _alViewer: any; private _alViewerReady: boolean = false; private _state: any = {}; diff --git a/src/content-handlers/iiif/modules/uv-avcenterpanel-module/AVCenterPanel.ts b/src/content-handlers/iiif/modules/uv-avcenterpanel-module/AVCenterPanel.ts index 41e7df2d3..a268a25e1 100644 --- a/src/content-handlers/iiif/modules/uv-avcenterpanel-module/AVCenterPanel.ts +++ b/src/content-handlers/iiif/modules/uv-avcenterpanel-module/AVCenterPanel.ts @@ -14,8 +14,11 @@ import { MetadataGroup, MetadataOptions } from "@iiif/manifold"; import { AVComponent } from "@iiif/iiif-av-component/dist-esmodule"; import { Bools } from "@edsilv/utils"; import { Events } from "../../../../Events"; +import { Config } from "../../extensions/uv-av-extension/config/Config"; -export class AVCenterPanel extends CenterPanel { +export class AVCenterPanel extends CenterPanel< + Config["modules"]["avCenterPanel"] +> { $avcomponent: JQuery; avcomponent: any; private _lastCanvasIndex: number | undefined; @@ -164,10 +167,10 @@ export class AVCenterPanel extends CenterPanel { posterImageExpanded: this.options.posterImageExpanded, enableFastForward: true, enableFastRewind: true, - } + }, }); - this.avcomponent.on('mediaerror', (err) => { + this.avcomponent.on("mediaerror", (err) => { if (!this.config.options.hideMediaError) { this.extensionHost.publish(IIIFEvents.SHOW_MESSAGE, [err]); } @@ -262,7 +265,7 @@ export class AVCenterPanel extends CenterPanel { const groups: MetadataGroup[] = this.extension.helper.getMetadata(< MetadataOptions >{ - range: currentRange + range: currentRange, }); for (let i = 0; i < groups.length; i++) { diff --git a/src/content-handlers/iiif/modules/uv-avmobilefooterpanel-module/MobileFooter.ts b/src/content-handlers/iiif/modules/uv-avmobilefooterpanel-module/MobileFooter.ts index 037a90984..13fb61330 100644 --- a/src/content-handlers/iiif/modules/uv-avmobilefooterpanel-module/MobileFooter.ts +++ b/src/content-handlers/iiif/modules/uv-avmobilefooterpanel-module/MobileFooter.ts @@ -1,6 +1,9 @@ +import { Config } from "../../extensions/uv-av-extension/config/Config"; import { FooterPanel as BaseFooterPanel } from "../uv-shared-module/FooterPanel"; -export class FooterPanel extends BaseFooterPanel { +export class FooterPanel extends BaseFooterPanel< + Config["modules"]["footerPanel"] +> { $fullScreenBtn: JQuery; constructor($element: JQuery) { 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 96bbb4a4e..e35e98d26 100644 --- a/src/content-handlers/iiif/modules/uv-contentleftpanel-module/ContentLeftPanel.ts +++ b/src/content-handlers/iiif/modules/uv-contentleftpanel-module/ContentLeftPanel.ts @@ -22,11 +22,9 @@ import { } from "manifesto.js"; import { AnnotationGroup, TreeSortType } from "@iiif/manifold"; import { isVisible } from "../../../../Utils"; -import { Config } from "../../extensions/uv-openseadragon-extension/config/Config"; +import { ContentLeftPanel as ContentLeftPanelConfig } from "../../extensions/config/ContentLeftPanel"; -export class ContentLeftPanel extends LeftPanel< - Config["modules"]["contentLeftPanel"] -> { +export class ContentLeftPanel extends LeftPanel { $bottomOptions: JQuery; $galleryView: JQuery; $leftOptions: JQuery; diff --git a/src/content-handlers/iiif/modules/uv-contentleftpanel-module/GalleryView.ts b/src/content-handlers/iiif/modules/uv-contentleftpanel-module/GalleryView.ts index bf65de49c..0e7acfb3f 100644 --- a/src/content-handlers/iiif/modules/uv-contentleftpanel-module/GalleryView.ts +++ b/src/content-handlers/iiif/modules/uv-contentleftpanel-module/GalleryView.ts @@ -1,9 +1,10 @@ const $ = require("jquery"); import { IIIFEvents } from "../../IIIFEvents"; +import { ContentLeftPanel } from "../../extensions/config/ContentLeftPanel"; import { BaseView } from "../uv-shared-module/BaseView"; import { GalleryComponent } from "@iiif/iiif-gallery-component"; -export class GalleryView extends BaseView { +export class GalleryView extends BaseView { isOpen: boolean = false; galleryComponent: any; galleryData: any; diff --git a/src/content-handlers/iiif/modules/uv-contentleftpanel-module/TreeView.ts b/src/content-handlers/iiif/modules/uv-contentleftpanel-module/TreeView.ts index 686b8c69d..aefa43bab 100644 --- a/src/content-handlers/iiif/modules/uv-contentleftpanel-module/TreeView.ts +++ b/src/content-handlers/iiif/modules/uv-contentleftpanel-module/TreeView.ts @@ -3,8 +3,9 @@ import { IIIFEvents } from "../../IIIFEvents"; import { BaseView } from "../uv-shared-module/BaseView"; import { TreeNode } from "manifesto.js"; import { TreeComponent } from "@iiif/iiif-tree-component"; +import { ContentLeftPanel } from "./ContentLeftPanel"; -export class TreeView extends BaseView { +export class TreeView extends BaseView { isOpen: boolean = false; treeComponent: any; treeData: any; diff --git a/src/content-handlers/iiif/modules/uv-dialogues-module/AuthDialogue.ts b/src/content-handlers/iiif/modules/uv-dialogues-module/AuthDialogue.ts index 1ff994cb3..f53239613 100644 --- a/src/content-handlers/iiif/modules/uv-dialogues-module/AuthDialogue.ts +++ b/src/content-handlers/iiif/modules/uv-dialogues-module/AuthDialogue.ts @@ -3,8 +3,11 @@ import { IIIFEvents } from "../../IIIFEvents"; import { Dialogue } from "../uv-shared-module/Dialogue"; import { sanitize } from "../../../../Utils"; import { Service } from "manifesto.js"; +import { BaseConfig } from "../../BaseConfig"; -export class AuthDialogue extends Dialogue { +export class AuthDialogue extends Dialogue< + BaseConfig["modules"]["authDialogue"] +> { closeCallback: any; confirmCallback: any; cancelCallback: any; @@ -119,7 +122,7 @@ export class AuthDialogue extends Dialogue { var buttonsToAdd = ''; // If the top button is enabled, add an additional close button for consistency. - if (this.config.topCloseButtonEnabled) { + if (this.options.topCloseButtonEnabled) { buttonsToAdd += ''; } return buttonsToAdd; diff --git a/src/content-handlers/iiif/modules/uv-dialogues-module/ClickThroughDialogue.ts b/src/content-handlers/iiif/modules/uv-dialogues-module/ClickThroughDialogue.ts index 78051a768..3a2500d13 100644 --- a/src/content-handlers/iiif/modules/uv-dialogues-module/ClickThroughDialogue.ts +++ b/src/content-handlers/iiif/modules/uv-dialogues-module/ClickThroughDialogue.ts @@ -1,9 +1,12 @@ const $ = require("jquery"); +import { BaseConfig } from "../../BaseConfig"; import { IIIFEvents } from "../../IIIFEvents"; import { Dialogue } from "../uv-shared-module/Dialogue"; import { IExternalResource } from "manifesto.js"; -export class ClickThroughDialogue extends Dialogue { +export class ClickThroughDialogue extends Dialogue< + BaseConfig["modules"]["clickThroughDialogue"] +> { acceptCallback: any; $acceptTermsButton: JQuery; $message: JQuery; diff --git a/src/content-handlers/iiif/modules/uv-dialogues-module/DownloadDialogue.ts b/src/content-handlers/iiif/modules/uv-dialogues-module/DownloadDialogue.ts index 009aae156..1ed3ac993 100644 --- a/src/content-handlers/iiif/modules/uv-dialogues-module/DownloadDialogue.ts +++ b/src/content-handlers/iiif/modules/uv-dialogues-module/DownloadDialogue.ts @@ -14,8 +14,11 @@ import { } from "manifesto.js"; import { RenderingFormat, MediaType } from "@iiif/vocabulary/dist-commonjs/"; import { ILabelValuePair } from "@iiif/manifold"; +import { BaseConfig } from "../../BaseConfig"; -export class DownloadDialogue extends Dialogue { +export class DownloadDialogue extends Dialogue< + BaseConfig["modules"]["downloadDialogue"] +> { $downloadOptions: JQuery; $noneAvailable: JQuery; $title: JQuery; diff --git a/src/content-handlers/iiif/modules/uv-dialogues-module/ExternalContentDialogue.ts b/src/content-handlers/iiif/modules/uv-dialogues-module/ExternalContentDialogue.ts index 1b4edeb66..e2d06e950 100644 --- a/src/content-handlers/iiif/modules/uv-dialogues-module/ExternalContentDialogue.ts +++ b/src/content-handlers/iiif/modules/uv-dialogues-module/ExternalContentDialogue.ts @@ -1,8 +1,11 @@ const $ = require("jquery"); import { IIIFEvents } from "../../IIIFEvents"; +import { Config } from "../../extensions/uv-openseadragon-extension/config/Config"; import { Dialogue } from "../uv-shared-module/Dialogue"; -export class ExternalContentDialogue extends Dialogue { +export class ExternalContentDialogue extends Dialogue< + Config["modules"]["multiSelectDialogue"] +> { $iframe: JQuery; constructor($element: JQuery) { diff --git a/src/content-handlers/iiif/modules/uv-dialogues-module/HelpDialogue.ts b/src/content-handlers/iiif/modules/uv-dialogues-module/HelpDialogue.ts index 23cd02a70..d18ebadca 100644 --- a/src/content-handlers/iiif/modules/uv-dialogues-module/HelpDialogue.ts +++ b/src/content-handlers/iiif/modules/uv-dialogues-module/HelpDialogue.ts @@ -1,8 +1,11 @@ const $ = require("jquery"); +import { BaseConfig } from "../../BaseConfig"; import { IIIFEvents } from "../../IIIFEvents"; import { Dialogue } from "../uv-shared-module/Dialogue"; -export class HelpDialogue extends Dialogue { +export class HelpDialogue extends Dialogue< + BaseConfig["modules"]["helpDialogue"] +> { $message: JQuery; $scroll: JQuery; $title: JQuery; diff --git a/src/content-handlers/iiif/modules/uv-dialogues-module/MoreInfoDialogue.ts b/src/content-handlers/iiif/modules/uv-dialogues-module/MoreInfoDialogue.ts index 281a1b981..28b3521bd 100644 --- a/src/content-handlers/iiif/modules/uv-dialogues-module/MoreInfoDialogue.ts +++ b/src/content-handlers/iiif/modules/uv-dialogues-module/MoreInfoDialogue.ts @@ -4,8 +4,11 @@ import { Dialogue } from "../uv-shared-module/Dialogue"; import { sanitize } from "../../../../Utils"; import { Bools } from "@edsilv/utils"; import { MetadataComponent, LimitType } from "@iiif/iiif-metadata-component"; +import { BaseConfig } from "../../BaseConfig"; -export class MoreInfoDialogue extends Dialogue { +export class MoreInfoDialogue extends Dialogue< + BaseConfig["modules"]["moreInfoRightPanel"] +> { $title: JQuery; metadataComponent: any; $metadata: JQuery; diff --git a/src/content-handlers/iiif/modules/uv-dialogues-module/RestrictedDialogue.ts b/src/content-handlers/iiif/modules/uv-dialogues-module/RestrictedDialogue.ts index 233fcd065..8fd987535 100644 --- a/src/content-handlers/iiif/modules/uv-dialogues-module/RestrictedDialogue.ts +++ b/src/content-handlers/iiif/modules/uv-dialogues-module/RestrictedDialogue.ts @@ -1,9 +1,12 @@ const $ = require("jquery"); +import { BaseConfig } from "../../BaseConfig"; import { IIIFEvents } from "../../IIIFEvents"; import { Dialogue } from "../uv-shared-module/Dialogue"; import { IExternalResource } from "manifesto.js"; -export class RestrictedDialogue extends Dialogue { +export class RestrictedDialogue extends Dialogue< + BaseConfig["modules"]["restrictedDialogue"] +> { $cancelButton: JQuery; $message: JQuery; $nextVisibleButton: JQuery; diff --git a/src/content-handlers/iiif/modules/uv-dialogues-module/SettingsDialogue.ts b/src/content-handlers/iiif/modules/uv-dialogues-module/SettingsDialogue.ts index dc92e7f64..69d55bec6 100644 --- a/src/content-handlers/iiif/modules/uv-dialogues-module/SettingsDialogue.ts +++ b/src/content-handlers/iiif/modules/uv-dialogues-module/SettingsDialogue.ts @@ -1,9 +1,12 @@ const $ = require("jquery"); +import { BaseConfig } from "../../BaseConfig"; import { IIIFEvents } from "../../IIIFEvents"; import { Dialogue } from "../uv-shared-module/Dialogue"; import { ILocale } from "../uv-shared-module/ILocale"; -export class SettingsDialogue extends Dialogue { +export class SettingsDialogue extends Dialogue< + BaseConfig["modules"]["settingsDialogue"] +> { $locale: JQuery; $localeDropDown: JQuery; $localeLabel: JQuery; diff --git a/src/content-handlers/iiif/modules/uv-dialogues-module/ShareDialogue.ts b/src/content-handlers/iiif/modules/uv-dialogues-module/ShareDialogue.ts index db4e02ebc..060465067 100644 --- a/src/content-handlers/iiif/modules/uv-dialogues-module/ShareDialogue.ts +++ b/src/content-handlers/iiif/modules/uv-dialogues-module/ShareDialogue.ts @@ -1,10 +1,13 @@ const $ = require("jquery"); +import { BaseConfig } from "../../BaseConfig"; import { IIIFEvents } from "../../IIIFEvents"; import { Dialogue } from "../uv-shared-module/Dialogue"; import { Bools, Numbers } from "@edsilv/utils"; import { ILabelValuePair } from "@iiif/manifold"; -export class ShareDialogue extends Dialogue { +export class ShareDialogue< + T extends BaseConfig["modules"]["shareDialogue"] +> extends Dialogue { $code: JQuery; $customSize: JQuery; $customSizeDropDown: JQuery; diff --git a/src/content-handlers/iiif/modules/uv-ebookcenterpanel-module/EbookCenterPanel.ts b/src/content-handlers/iiif/modules/uv-ebookcenterpanel-module/EbookCenterPanel.ts index 13e4f83c3..b07d0f8ba 100644 --- a/src/content-handlers/iiif/modules/uv-ebookcenterpanel-module/EbookCenterPanel.ts +++ b/src/content-handlers/iiif/modules/uv-ebookcenterpanel-module/EbookCenterPanel.ts @@ -15,8 +15,11 @@ import { defineCustomElements, } from "@universalviewer/uv-ebook-components/loader"; import { Events } from "../../../../Events"; +import { Config } from "../../extensions/uv-ebook-extension/config/Config"; -export class EbookCenterPanel extends CenterPanel { +export class EbookCenterPanel extends CenterPanel< + Config["modules"]["ebookCenterPanel"] +> { private _cfi: string; private _ebookReader: any; private _ebookReaderReady: boolean = false; diff --git a/src/content-handlers/iiif/modules/uv-filelinkcenterpanel-module/FileLinkCenterPanel.ts b/src/content-handlers/iiif/modules/uv-filelinkcenterpanel-module/FileLinkCenterPanel.ts index 05911bd6a..4d08950ef 100644 --- a/src/content-handlers/iiif/modules/uv-filelinkcenterpanel-module/FileLinkCenterPanel.ts +++ b/src/content-handlers/iiif/modules/uv-filelinkcenterpanel-module/FileLinkCenterPanel.ts @@ -10,8 +10,11 @@ import { LanguageMap, } from "manifesto.js"; import { Events } from "../../../../Events"; +import { Config } from "../../extensions/uv-default-extension/config/Config"; -export class FileLinkCenterPanel extends CenterPanel { +export class FileLinkCenterPanel extends CenterPanel< + Config["modules"]["fileLinkCenterPanel"] +> { $scroll: JQuery; $downloadItems: JQuery; $downloadItemTemplate: JQuery; diff --git a/src/content-handlers/iiif/modules/uv-mediaelementcenterpanel-module/MediaElementCenterPanel.ts b/src/content-handlers/iiif/modules/uv-mediaelementcenterpanel-module/MediaElementCenterPanel.ts index 5d5ce9981..76062f189 100644 --- a/src/content-handlers/iiif/modules/uv-mediaelementcenterpanel-module/MediaElementCenterPanel.ts +++ b/src/content-handlers/iiif/modules/uv-mediaelementcenterpanel-module/MediaElementCenterPanel.ts @@ -1,4 +1,4 @@ -import {Dimensions} from "@edsilv/utils"; +import { Dimensions } from "@edsilv/utils"; const $ = require("jquery"); import { IIIFEvents } from "../../IIIFEvents"; @@ -18,8 +18,11 @@ import "mediaelement-plugins/dist/source-chooser/source-chooser"; import "mediaelement-plugins/dist/source-chooser/source-chooser.css"; import { TFragment } from "../uv-shared-module/TFragment"; import { Events } from "../../../../Events"; +import { Config } from "../../extensions/uv-mediaelement-extension/config/Config"; -export class MediaElementCenterPanel extends CenterPanel { +export class MediaElementCenterPanel extends CenterPanel< + Config["modules"]["mediaelementCenterPanel"] +> { $wrapper: JQuery; $container: JQuery; $media: JQuery; @@ -77,8 +80,8 @@ export class MediaElementCenterPanel extends CenterPanel { const canvas: Canvas = this.extension.helper.getCurrentCanvas(); - this.mediaHeight = this.config.defaultHeight; - this.mediaWidth = this.config.defaultWidth; + this.mediaHeight = this.options.defaultHeight; + this.mediaWidth = this.options.defaultWidth; const poster: string = (( this.extension @@ -103,7 +106,9 @@ export class MediaElementCenterPanel extends CenterPanel { if (this.isTypeCaption(rendering)) { subtitles.push({ - label: rendering.getLabel().getValue() ?? rendering.getFormat().toString(), + label: + rendering.getLabel().getValue() ?? + rendering.getFormat().toString(), id: rendering.id, }); } @@ -177,7 +182,7 @@ export class MediaElementCenterPanel extends CenterPanel { "tracks", "volume", "sourcechooser", - "fullscreen" + "fullscreen", ], success: function(mediaElement: any, originalNode: any) { mediaElement.addEventListener("loadstart", () => { @@ -316,10 +321,7 @@ export class MediaElementCenterPanel extends CenterPanel { return false; } - const captionTypes = new Set([ - "text/vtt", - "text/srt", - ]); + const captionTypes = new Set(["text/vtt", "text/srt"]); return captionTypes.has(type.toString()); } @@ -339,7 +341,12 @@ export class MediaElementCenterPanel extends CenterPanel { this.$title.text(sanitize(this.title)); } - const size = Dimensions.fitRect(this.mediaWidth, this.mediaHeight, this.$content.width(), this.$content.height()); + const size = Dimensions.fitRect( + this.mediaWidth, + this.mediaHeight, + this.$content.width(), + this.$content.height() + ); this.$container.height(size.height); this.$container.width(size.width); diff --git a/src/content-handlers/iiif/modules/uv-modelviewercenterpanel-module/ModelViewerCenterPanel.ts b/src/content-handlers/iiif/modules/uv-modelviewercenterpanel-module/ModelViewerCenterPanel.ts index f59571039..85078dbfb 100644 --- a/src/content-handlers/iiif/modules/uv-modelviewercenterpanel-module/ModelViewerCenterPanel.ts +++ b/src/content-handlers/iiif/modules/uv-modelviewercenterpanel-module/ModelViewerCenterPanel.ts @@ -14,7 +14,9 @@ import ModelViewerExtension from "../../extensions/uv-model-viewer-extension/Ext import { Events } from "../../../../Events"; import { Config } from "../../extensions/uv-model-viewer-extension/config/Config"; -export class ModelViewerCenterPanel extends CenterPanel { +export class ModelViewerCenterPanel extends CenterPanel< + Config["modules"]["modelViewerCenterPanel"] +> { $modelviewer: JQuery; $spinner: JQuery; @@ -56,11 +58,9 @@ export class ModelViewerCenterPanel extends CenterPanel { this.$modelviewer = $( ` { metadataComponent: any; $metadata: JQuery; limitType: any; @@ -49,10 +50,7 @@ export class MoreInfoRightPanel extends RightPanel { href ); // Time change. - const time: string | null = Urls.getHashParameterFromString( - "t", - href - ); + const time: string | null = Urls.getHashParameterFromString("t", href); if (rangeId && time === null) { const range: Range | null = this.extension.helper.getRangeById( @@ -67,17 +65,22 @@ export class MoreInfoRightPanel extends RightPanel { if (time !== null) { const timeAsNumber = Number(time); if (!Number.isNaN(timeAsNumber)) { - if (rangeId) { // We want to make the time change RELATIVE to the start of the range. const range: Range | null = this.extension.helper.getRangeById( rangeId ); if (range) { - this.extensionHost.publish(IIIFEvents.RANGE_TIME_CHANGE, { rangeId: range.id, time: timeAsNumber }); + this.extensionHost.publish(IIIFEvents.RANGE_TIME_CHANGE, { + rangeId: range.id, + time: timeAsNumber, + }); } - } else { - this.extensionHost.publish(IIIFEvents.CURRENT_TIME_CHANGE, timeAsNumber); + } else { + this.extensionHost.publish( + IIIFEvents.CURRENT_TIME_CHANGE, + timeAsNumber + ); } } } @@ -116,7 +119,7 @@ export class MoreInfoRightPanel extends RightPanel { ), helper: this.extension.helper, licenseFormatter: new UriLabeller( - this.config.license ? this.config.license : {} + this.content.license ? this.content.license : {} ), limit: this.config.options.textLimit || 4, limitType: LimitType.LINES, diff --git a/src/content-handlers/iiif/modules/uv-multiselectdialogue-module/MultiSelectDialogue.ts b/src/content-handlers/iiif/modules/uv-multiselectdialogue-module/MultiSelectDialogue.ts index 5b8b93e4a..8c378bbe7 100644 --- a/src/content-handlers/iiif/modules/uv-multiselectdialogue-module/MultiSelectDialogue.ts +++ b/src/content-handlers/iiif/modules/uv-multiselectdialogue-module/MultiSelectDialogue.ts @@ -7,8 +7,11 @@ import { Bools } from "@edsilv/utils"; import { GalleryComponent } from "@iiif/iiif-gallery-component"; // import { GalleryComponent } from "../../GalleryComponent"; import { MultiSelectState } from "@iiif/manifold"; +import { Config } from "../../extensions/uv-openseadragon-extension/config/Config"; -export class MultiSelectDialogue extends Dialogue { +export class MultiSelectDialogue extends Dialogue< + Config["modules"]["multiSelectDialogue"] +> { $title: JQuery; $gallery: JQuery; galleryComponent: any; diff --git a/src/content-handlers/iiif/modules/uv-openseadragoncenterpanel-module/OpenSeadragonCenterPanel.ts b/src/content-handlers/iiif/modules/uv-openseadragoncenterpanel-module/OpenSeadragonCenterPanel.ts index 6546c8714..0096187ec 100644 --- a/src/content-handlers/iiif/modules/uv-openseadragoncenterpanel-module/OpenSeadragonCenterPanel.ts +++ b/src/content-handlers/iiif/modules/uv-openseadragoncenterpanel-module/OpenSeadragonCenterPanel.ts @@ -23,8 +23,11 @@ import OpenSeadragonExtension from "../../extensions/uv-openseadragon-extension/ import "@openseadragon-imaging/openseadragon-viewerinputhook"; import { MediaType } from "@iiif/vocabulary/dist-commonjs"; import { Events } from "../../../../Events"; +import { Config } from "../../extensions/uv-openseadragon-extension/config/Config"; -export class OpenSeadragonCenterPanel extends CenterPanel { +export class OpenSeadragonCenterPanel extends CenterPanel< + Config["modules"]["openSeadragonCenterPanel"] +> { controlsVisible: boolean = false; currentAnnotationRect: AnnotationRect; currentBounds: XYWHFragment | null; @@ -394,6 +397,7 @@ export class OpenSeadragonCenterPanel extends CenterPanel { // when mouse move stopped this.$element.on( + //@ts-ignore "mousemove", () => { // if over element, hide controls. diff --git a/src/content-handlers/iiif/modules/uv-osdmobilefooterpanel-module/MobileFooter.ts b/src/content-handlers/iiif/modules/uv-osdmobilefooterpanel-module/MobileFooter.ts index 0914df4b3..c7bb229c5 100644 --- a/src/content-handlers/iiif/modules/uv-osdmobilefooterpanel-module/MobileFooter.ts +++ b/src/content-handlers/iiif/modules/uv-osdmobilefooterpanel-module/MobileFooter.ts @@ -1,8 +1,11 @@ const $ = require("jquery"); import { FooterPanel as BaseFooterPanel } from "../uv-shared-module/FooterPanel"; import { OpenSeadragonExtensionEvents } from "../../extensions/uv-openseadragon-extension/Events"; +import { Config } from "../../extensions/uv-openseadragon-extension/config/Config"; -export class FooterPanel extends BaseFooterPanel { +export class FooterPanel extends BaseFooterPanel< + Config["modules"]["mobileFooterPanel"] +> { $rotateButton: JQuery; //$spacer: JQuery; $zoomInButton: JQuery; diff --git a/src/content-handlers/iiif/modules/uv-pdfcenterpanel-module/PDFCenterPanel.ts b/src/content-handlers/iiif/modules/uv-pdfcenterpanel-module/PDFCenterPanel.ts index 1e30700ab..cf2b97808 100644 --- a/src/content-handlers/iiif/modules/uv-pdfcenterpanel-module/PDFCenterPanel.ts +++ b/src/content-handlers/iiif/modules/uv-pdfcenterpanel-module/PDFCenterPanel.ts @@ -10,7 +10,9 @@ import { Config } from "../../extensions/uv-pdf-extension/config/Config"; // declare var PDFJS: any; -export class PDFCenterPanel extends CenterPanel { +export class PDFCenterPanel extends CenterPanel< + Config["modules"]["pdfCenterPanel"] +> { // private _$spinner: JQuery; private _$canvas: JQuery; private _$nextButton: JQuery; @@ -58,12 +60,7 @@ export class PDFCenterPanel extends CenterPanel { // Only attach PDF controls if we're using PDF.js; they have no meaning in // PDFObject. However, we still create the objects above so that references // to them do not cause errors (simpler than putting usePdfJs checks all over): - if ( - Bools.getBool( - (this.extension.data.config! as Config).options.usePdfJs, - false - ) - ) { + if (Bools.getBool(this.options.usePdfJs, false)) { // this.$content.append(this._$spinner); this.$content.append(this._$progress); this.$content.append(this._$prevButton); @@ -271,12 +268,7 @@ export class PDFCenterPanel extends CenterPanel { this._lastMediaUri = mediaUri; - if ( - !Bools.getBool( - (this.extension.data.config! as Config).options.usePdfJs, - false - ) - ) { + if (!Bools.getBool(this.options.usePdfJs, false)) { window.PDFObject = await import( /* webpackChunkName: "pdfobject" */ /* webpackMode: "lazy" */ "pdfobject" ); @@ -328,12 +320,7 @@ export class PDFCenterPanel extends CenterPanel { } private _render(num: number): void { - if ( - !Bools.getBool( - (this.extension.data.config! as Config).options.usePdfJs, - false - ) - ) { + if (!Bools.getBool(this.options.usePdfJs, false)) { return; } diff --git a/src/content-handlers/iiif/modules/uv-resourcesleftpanel-module/ResourcesLeftPanel.ts b/src/content-handlers/iiif/modules/uv-resourcesleftpanel-module/ResourcesLeftPanel.ts index 61af584db..92df02206 100644 --- a/src/content-handlers/iiif/modules/uv-resourcesleftpanel-module/ResourcesLeftPanel.ts +++ b/src/content-handlers/iiif/modules/uv-resourcesleftpanel-module/ResourcesLeftPanel.ts @@ -5,11 +5,9 @@ import { ThumbsView } from "./ThumbsView"; import { ViewingDirection, MediaType } from "@iiif/vocabulary/dist-commonjs/"; import { Files } from "@edsilv/utils"; import { Annotation, LanguageMap, Resource } from "manifesto.js"; -import { Config } from "../../extensions/uv-default-extension/config/Config"; +import { ResourcesLeftPanel as ResourcesLeftPanelConfig } from "../../extensions/config/ResourcesLeftPanel"; -export class ResourcesLeftPanel extends LeftPanel< - Config["modules"]["resourcesLeftPanel"] -> { +export class ResourcesLeftPanel extends LeftPanel { $resources: JQuery; $resourcesButton: JQuery; $resourcesView: JQuery; diff --git a/src/content-handlers/iiif/modules/uv-resourcesleftpanel-module/ThumbsView.ts b/src/content-handlers/iiif/modules/uv-resourcesleftpanel-module/ThumbsView.ts index a02eda618..4c507f59b 100644 --- a/src/content-handlers/iiif/modules/uv-resourcesleftpanel-module/ThumbsView.ts +++ b/src/content-handlers/iiif/modules/uv-resourcesleftpanel-module/ThumbsView.ts @@ -1,6 +1,7 @@ import { ThumbsView as BaseView } from "../uv-shared-module/ThumbsView"; +import { ExtendedLeftPanel } from "../../extensions/config/ExtendedLeftPanel"; -export class ThumbsView extends BaseView { +export class ThumbsView extends BaseView { create(): void { this.setConfig("resourcesLeftPanel"); super.create(); diff --git a/src/content-handlers/iiif/modules/uv-searchfooterpanel-module/FooterPanel.ts b/src/content-handlers/iiif/modules/uv-searchfooterpanel-module/FooterPanel.ts index a495f5fbd..6275d62d1 100644 --- a/src/content-handlers/iiif/modules/uv-searchfooterpanel-module/FooterPanel.ts +++ b/src/content-handlers/iiif/modules/uv-searchfooterpanel-module/FooterPanel.ts @@ -11,8 +11,11 @@ import { Bools, Strings } from "@edsilv/utils"; import * as KeyCodes from "@edsilv/key-codes"; import { AnnotationGroup } from "@iiif/manifold"; import { Canvas, LanguageMap } from "manifesto.js"; +import { Config } from "../../extensions/uv-openseadragon-extension/config/Config"; -export class FooterPanel extends BaseFooterPanel { +export class FooterPanel extends BaseFooterPanel< + Config["modules"]["searchFooterPanel"] +> { $clearSearchResultsButton: JQuery; $line: JQuery; $nextResultButton: JQuery; diff --git a/src/content-handlers/iiif/modules/uv-shared-module/BaseExpandPanel.ts b/src/content-handlers/iiif/modules/uv-shared-module/BaseExpandPanel.ts index fc6c61758..5f0e8cf97 100644 --- a/src/content-handlers/iiif/modules/uv-shared-module/BaseExpandPanel.ts +++ b/src/content-handlers/iiif/modules/uv-shared-module/BaseExpandPanel.ts @@ -2,11 +2,9 @@ const $ = require("jquery"); import { BaseView } from "./BaseView"; import { Bools } from "@edsilv/utils"; import { IIIFEvents } from "../../IIIFEvents"; -import { BaseConfig } from "../../BaseConfig"; +import { ExpandPanel } from "../../extensions/config/ExpandPanel"; -export class BaseExpandPanel< - T extends BaseConfig["modules"]["leftPanel"] -> extends BaseView { +export class BaseExpandPanel extends BaseView { isExpanded: boolean = false; isFullyExpanded: boolean = false; isUnopened: boolean = true; diff --git a/src/content-handlers/iiif/modules/uv-shared-module/CenterPanel.ts b/src/content-handlers/iiif/modules/uv-shared-module/CenterPanel.ts index 2f97c33d1..4905166fa 100644 --- a/src/content-handlers/iiif/modules/uv-shared-module/CenterPanel.ts +++ b/src/content-handlers/iiif/modules/uv-shared-module/CenterPanel.ts @@ -5,8 +5,11 @@ import { BaseView } from "./BaseView"; import { Position } from "./Position"; import { sanitize, isVisible } from "../../../../Utils"; import { Bools } from "@edsilv/utils"; +import { BaseConfig } from "../../BaseConfig"; -export class CenterPanel extends BaseView { +export class CenterPanel< + T extends BaseConfig["modules"]["centerPanel"] +> extends BaseView { title: string | null; subtitle: string | null; subtitleExpanded: boolean = false; @@ -189,11 +192,9 @@ export class CenterPanel extends BaseView { } }); - $attributionText - .find("img") - .one('error', () => { - resize(); - }) + $attributionText.find("img").one("error", () => { + resize(); + }); $attributionText.targetBlank(); } @@ -265,10 +266,10 @@ export class CenterPanel extends BaseView { this.$content.height(this.$element.height() - titleHeight - subtitleHeight); this.$content.width(this.$element.width()); - const $text = this.$attribution.find('.attribution-text'); + const $text = this.$attribution.find(".attribution-text"); $text.css("maxHeight", `calc(${this.$content.height()}px - 100px)`); - $text.css('overflow-y', 'auto'); + $text.css("overflow-y", "auto"); if (this.$attribution && this.isAttributionOpen) { switch (this.attributionPosition) { diff --git a/src/content-handlers/iiif/modules/uv-shared-module/GenericDialogue.ts b/src/content-handlers/iiif/modules/uv-shared-module/GenericDialogue.ts index 8f2a73c92..52aacfd67 100644 --- a/src/content-handlers/iiif/modules/uv-shared-module/GenericDialogue.ts +++ b/src/content-handlers/iiif/modules/uv-shared-module/GenericDialogue.ts @@ -1,8 +1,11 @@ const $ = require("jquery"); +import { BaseConfig } from "../../BaseConfig"; import { IIIFEvents } from "../../IIIFEvents"; import { Dialogue } from "./Dialogue"; -export class GenericDialogue extends Dialogue { +export class GenericDialogue extends Dialogue< + BaseConfig["modules"]["genericDialogue"] +> { acceptCallback: any; $acceptButton: JQuery; $message: JQuery; diff --git a/src/content-handlers/iiif/modules/uv-shared-module/RightPanel.ts b/src/content-handlers/iiif/modules/uv-shared-module/RightPanel.ts index 1808bb479..f11ce04bf 100644 --- a/src/content-handlers/iiif/modules/uv-shared-module/RightPanel.ts +++ b/src/content-handlers/iiif/modules/uv-shared-module/RightPanel.ts @@ -1,8 +1,9 @@ +import { ExpandPanel } from "../../extensions/config/ExpandPanel"; import { IIIFEvents } from "../../IIIFEvents"; import { BaseExpandPanel } from "./BaseExpandPanel"; import { Bools } from "@edsilv/utils"; -export class RightPanel extends BaseExpandPanel { +export class RightPanel extends BaseExpandPanel { constructor($element: JQuery) { super($element); } diff --git a/src/content-handlers/iiif/modules/uv-shared-module/ThumbsView.ts b/src/content-handlers/iiif/modules/uv-shared-module/ThumbsView.ts index eda5cfc9b..b6a165394 100644 --- a/src/content-handlers/iiif/modules/uv-shared-module/ThumbsView.ts +++ b/src/content-handlers/iiif/modules/uv-shared-module/ThumbsView.ts @@ -8,8 +8,9 @@ import { import { Annotation, AnnotationBody, Canvas, Thumb } from "manifesto.js"; import * as KeyCodes from "@edsilv/key-codes"; import { Dates, Keyboard, Maths, Strings } from "@edsilv/utils"; +import { ExtendedLeftPanel } from "../../extensions/config/ExtendedLeftPanel"; -export class ThumbsView extends BaseView { +export class ThumbsView extends BaseView { private _$thumbsCache: JQuery | null; $selectedThumb: JQuery; $thumbs: JQuery;