@acdh-oeaw/universalviewer
Version:
The Universal Viewer is a community-developed open source project on a mission to help you share your 📚📜📰📽️📻🗿 with the 🌎
2 lines (1 loc) • 10.9 kB
JavaScript
import{a as N}from"./chunk-LJMGJU2H.js";import{a as G}from"./chunk-C3LB7FRW.js";import{b as E,e as C,g as y,h as R,j as k,k as U,l as D}from"./chunk-UGKRI7YJ.js";import{c as P}from"./chunk-FEXGFX4C.js";import{a as o}from"./chunk-Z6KGRKDP.js";import{a as L,c as M,o as B}from"./chunk-LLTGMZMR.js";import{b as d,g}from"./chunk-5XPHF4E5.js";import{d as Z}from"./chunk-L67DAW3A.js";var F=Z(P());var v=L(),s=class extends E{constructor(A){super(A)}create(){this.setConfig("fileLinkCenterPanel"),super.create(),this.extensionHost.subscribe(o.OPEN_EXTERNAL_RESOURCE,A=>{this.openMedia(A)}),this.$scroll=v('<div class="scroll"></div>'),this.$content.append(this.$scroll),this.$downloadItems=v("<ol></ol>"),this.$scroll.append(this.$downloadItems),this.$downloadItemTemplate=v('<li><img/><div class="col2"><a class="filename" target="_blank" download=""></a><span class="label"></span><a class="description" target="_blank" download=""></a></div></li>'),this.title=this.extension.helper.getLabel()}async openMedia(A){await this.extension.getExternalResources(A);let l=this.extension.helper.getCurrentCanvas().getContent(),e;for(let n=0;n<l.length;n++){let a=l[n];if(!a.getBody().length)continue;e=this.$downloadItemTemplate.clone();let r=e.find(".filename"),m=e.find(".label"),w=e.find("img"),f=e.find(".description"),b=a.getBody()[0],i=b.getProperty("id");i&&(r.prop("href",i),r.text(i.substr(i.lastIndexOf("/")+1)));let I=F.LanguageMap.getValue(b.getLabel());I&&m.text(d(I));let x=a.getProperty("thumbnail");x?w.prop("src",x):w.hide();let Q=b.getProperty("description");Q&&(f.text(d(Q)),i&&f.prop("href",i)),this.$downloadItems.append(e)}this.extensionHost.publish(g.EXTERNAL_RESOURCE_OPENED),this.extensionHost.publish(g.LOAD)}resize(){super.resize(),this.title&&this.$title.text(d(this.title)),this.$scroll.height(this.$content.height()-this.$scroll.verticalMargins())}};var u=class extends U{constructor(A){super(A)}create(){this.setConfig("settingsDialogue"),super.create()}};var p=class extends D{constructor(A){super(A)}create(){this.setConfig("shareDialogue"),super.create()}update(){super.update(),this.code=this.extension.getEmbedScript(this.options.embedTemplate,this.currentWidth,this.currentHeight),this.$code.val(this.code)}resize(){super.resize()}};var z={options:{allowStealFocus:!1,authAPIVersion:1,bookmarkThumbHeight:150,bookmarkThumbWidth:90,dropEnabled:!0,footerPanelEnabled:!0,headerPanelEnabled:!0,leftPanelEnabled:!0,limitLocales:!1,metrics:[{type:"sm",minWidth:0},{type:"md",minWidth:768},{type:"lg",minWidth:1024},{type:"xl",minWidth:1280}],multiSelectionMimeType:"application/zip",navigatorEnabled:!0,openTemplate:"http://universalviewer.io?manifest={0}",overrideFullScreen:!1,pagingEnabled:!0,pagingOptionEnabled:!0,pessimisticAccessControl:!1,preserveViewport:!1,rightPanelEnabled:!0,saveUserSettings:!1,clickToZoomEnabled:!0,searchWithinEnabled:!0,termsOfUseEnabled:!1,theme:"uv-en-GB-theme",tokenStorage:"session",useArrowKeysToNavigate:!1,zoomToSearchResultEnabled:!0},modules:{leftPanel:{options:{expandFullEnabled:!1,panelAnimationDuration:250,panelCollapsedWidth:30,panelExpandedWidth:255,panelOpen:!1},content:{collapse:"$collapse",collapseFull:"$collapseFull",expand:"$expandContents",expandFull:"$expandGallery"}},shareDialogue:{options:{embedEnabled:!0,shareEnabled:!0,embedTemplate:'<iframe src="{0}" width="{1}" height="{2}" allowfullscreen frameborder="0" title="{3}"></iframe>',instructionsEnabled:!1,shareFrameEnabled:!0,shareManifestsEnabled:!0,topCloseButtonEnabled:!1},content:{close:"$close",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",shareUrl:"$shareUrl"}},centerPanel:{options:{titleEnabled:!0,subtitleEnabled:!0,mostSpecificRequiredStatement:!0,requiredStatementEnabled:!0},content:{attribution:"$attribution",close:"$close",closeAttribution:"$closeAttribution"}},fileLinkCenterPanel:{options:{titleEnabled:!0,subtitleEnabled:!0,mostSpecificRequiredStatement:!0,requiredStatementEnabled:!0},content:{attribution:"$attribution",close:"$close",closeAttribution:"$closeAttribution"}},footerPanel:{options:{bookmarkEnabled:!1,downloadEnabled:!0,embedEnabled:!1,feedbackEnabled:!1,fullscreenEnabled:!0,minimiseButtons:!0,moreInfoEnabled:!0,openEnabled:!1,printEnabled:!1,shareEnabled:!0},content:{bookmark:"$add_to_bookmarks",download:"$download",embed:"$embed",exitFullScreen:"$exitFullScreen",feedback:"$feedback",fullScreen:"$fullScreen",moreInfo:"$moreInfo",open:"$open",share:"$share"}},genericDialogue:{options:{topCloseButtonEnabled:!1},content:{close:"$close",emptyValue:"$emptyValue",invalidNumber:"$invalidNumber",noMatches:"$noMatches",ok:"$ok",pageNotFound:"$pageNotFound",refresh:"$refresh"}},headerPanel:{options:{centerOptionsEnabled:!0,localeToggleEnabled:!1,settingsButtonEnabled:!0},content:{close:"$close",settings:"$settings"}},helpDialogue:{options:{topCloseButtonEnabled:!1},content:{close:"$close",text:"$placeholder_text",title:"$help"}},restrictedDialogue:{options:{topCloseButtonEnabled:!1},content:{cancel:"$cancel",close:"$close"}},moreInfoRightPanel:{options:{canvasDisplayOrder:"",canvasExclude:"",copyToClipboardEnabled:!1,expandFullEnabled:!1,limitToRange:!1,manifestDisplayOrder:"",manifestExclude:"",panelAnimationDuration:250,panelCollapsedWidth:30,panelExpandedWidth:255,panelOpen:!1,rtlLanguageCodes:"ar, ara, dv, div, he, heb, ur, urd",showAllLanguages:!1,textLimit:4,textLimitType:"lines",topCloseButtonEnabled:!1},content:{attribution:"$attribution",canvasHeader:"$aboutTheImage",close:"$close",collapse:"$collapseInformation",collapseFull:"$collapseGallery",copiedToClipboard:"$copiedToClipboard",copyToClipboard:"$copyToClipboard",description:"$description",expand:"$expandInformation",expandFull:"$expandGallery",holdingText:"$moduleGoesHere",less:"$less",lessAriaLabelTemplate:"$lessAriaLabelTemplate",license:"$license",logo:"$logo",manifestHeader:"$aboutTheItem",more:"$more",moreAriaLabelTemplate:"$moreAriaLabelTemplate",noData:"$noDataToDisplay",page:"$page",rangeHeader:"$aboutThisSection",title:"$moreInformation"}},resourcesLeftPanel:{options:{expandFullEnabled:!1,panelAnimationDuration:250,panelCollapsedWidth:30,panelExpandedWidth:255,panelOpen:!0,oneColThumbHeight:320,oneColThumbWidth:200,twoColThumbHeight:150,twoColThumbWidth:90},content:{title:"$contents",collapse:"$collapse",collapseFull:"$collapseFull",expand:"$expandContents",expandFull:"$expandGallery"}},dialogue:{options:{topCloseButtonEnabled:!1},content:{close:"$close"}},authDialogue:{options:{topCloseButtonEnabled:!1},content:{cancel:"$cancel",close:"$close",confirm:"$confirm"}},adjustImageDialogue:{options:{topCloseButtonEnabled:!1},content:{title:"$adjustImage",brightness:"$brightness",contrast:"$contrast",saturation:"$saturation",close:"$close",reset:"$reset",remember:"$remember"}},clickThroughDialogue:{options:{topCloseButtonEnabled:!1},content:{close:"$close",viewTerms:"$viewTerms"}},downloadDialogue:{options:{topCloseButtonEnabled:!1},content:{allPages:"$allPages",close:"$close",currentViewAsJpg:"$currentViewAsJpg",currentViewAsJpgExplanation:"$openNewWindow",download:"$download",downloadSelection:"$downloadSelection",downloadSelectionExplanation:"$downloadSelectionExplanation",editSettings:"$editSettings",entireDocument:"$entireDocument",entireFileAsOriginal:"$entireFile",entireFileAsOriginalWithFormat:"$entireFileWithFormat",individualPages:"$individualPages",noneAvailable:"$noDownloadOptionsAvailable",pagingNote:"$pagingNote",preview:"$preview",selection:"$selection",termsOfUse:"$termsOfUse",title:"$download",wholeImageHighRes:"$wholeImageHighRes",wholeImageHighResExplanation:"$openNewWindow",wholeImageLowResAsJpg:"$wholeImageLowResAsJpg",wholeImageLowResAsJpgExplanation:"$openNewWindow",wholeImagesHighRes:"$wholeImagesHighRes",wholeImagesHighResExplanation:"$wholeImagesHighResExplanation"}},loginDialogue:{options:{topCloseButtonEnabled:!1},content:{login:"$login",logout:"$logout",cancel:"$cancel",close:"$close"}},settingsDialogue:{options:{topCloseButtonEnabled:!1},content:{close:"$close",locale:"$locale",navigatorEnabled:"$navigatorEnabled",clickToZoomEnabled:"$clickToZoomEnabled",pagingEnabled:"$twoPageView",reducedMotion:"$reducedMotion",truncateThumbnailLabels:"$truncateThumbnailLabels",preserveViewport:"$preserveViewport",title:"$settings",website:"$uvWebsite"}}},localisation:{label:"English (GB)",locales:[{name:"cy-GB",label:"Cymraeg"},{name:"en-GB",label:"English (GB)"},{name:"fr-FR",label:"Fran\xE7ais (FR)"},{name:"pl-PL",label:"Polski"},{name:"sv-SE",label:"Svenska"}]},content:{authCORSError:"$authCORSError",authorisationFailedMessage:"$authorisationFailedMessage",canvasIndexOutOfRange:"$canvasIndexOutOfRange",fallbackDegradedLabel:"$fallbackDegradedLabel",fallbackDegradedMessage:"$fallbackDegradedMessage",forbiddenResourceMessage:"$forbiddenResourceMessage",termsOfUse:"$termsOfUse",mediaViewer:"$mediaViewer",skipToDownload:"$skipToDownload"}};var h=class extends C{constructor(){super(...arguments);this.defaultConfig=z}create(){super.create(),this.extensionHost.subscribe(o.CANVAS_INDEX_CHANGE,t=>{this.viewCanvas(t)}),this.extensionHost.subscribe(o.THUMB_SELECTED,t=>{this.extensionHost.publish(o.CANVAS_INDEX_CHANGE,t)})}createModules(){super.createModules(),this.isHeaderPanelEnabled()?this.headerPanel=new R(this.shell.$headerPanel):this.shell.$headerPanel.hide(),this.isLeftPanelEnabled()&&(this.leftPanel=new N(this.shell.$leftPanel)),this.centerPanel=new s(this.shell.$centerPanel),this.isRightPanelEnabled()&&(this.rightPanel=new k(this.shell.$rightPanel)),this.isFooterPanelEnabled()?this.footerPanel=new y(this.shell.$footerPanel):this.shell.$footerPanel.hide(),this.$helpDialogue=$('<div class="overlay help" aria-hidden="true"></div>'),this.shell.$overlays.append(this.$helpDialogue),this.helpDialogue=new G(this.$helpDialogue),this.$shareDialogue=$('<div class="overlay share" aria-hidden="true"></div>'),this.shell.$overlays.append(this.$shareDialogue),this.shareDialogue=new p(this.$shareDialogue),this.$settingsDialogue=$('<div class="overlay settings" aria-hidden="true"></div>'),this.shell.$overlays.append(this.$settingsDialogue),this.settingsDialogue=new u(this.$settingsDialogue),this.isLeftPanelEnabled()&&this.leftPanel.init(),this.isRightPanelEnabled()&&this.rightPanel.init()}render(){super.render()}isLeftPanelEnabled(){return M.getBool(this.data.config.options.leftPanelEnabled,!0)&&(this.helper.isMultiCanvas()||this.helper.isMultiSequence()||this.helper.hasResources())}getEmbedScript(t,l,e){let n=this.getAppUri(),a=this.helper.getLabel()||"",r=`${n}#?manifest=${this.helper.manifestUri}&c=${this.helper.collectionIndex}&m=${this.helper.manifestIndex}&cv=${this.helper.canvasIndex}`;return B.format(t,r,l.toString(),e.toString(),a)}};export{h as default};