Skip to content

Commit ed72473

Browse files
[DSC-1309] Mirador's index.js refactoring and fixes
1 parent 0a0227f commit ed72473

1 file changed

Lines changed: 118 additions & 118 deletions

File tree

src/mirador-viewer/config.default.js

Lines changed: 118 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const multi = params.get('multi');
2626
const notMobile = params.get('notMobile');
2727

2828
let windowSettings = {};
29-
let sidbarPanel = 'info';
29+
let sideBarPanel = 'info';
3030
let defaultView = 'single';
3131
let multipleItems = false;
3232
let thumbNavigation = 'off';
@@ -36,7 +36,7 @@ windowSettings.manifestId = manifest;
3636
(() => {
3737
if (searchOption) {
3838
defaultView = 'book';
39-
sidbarPanel = 'search';
39+
sideBarPanel = 'search';
4040
multipleItems = true;
4141
if (notMobile) {
4242
thumbNavigation = 'far-right';
@@ -45,7 +45,7 @@ windowSettings.manifestId = manifest;
4545
windowSettings.defaultSearchQuery = query;
4646
}
4747
} else {
48-
if(multi) {
48+
if (multi) {
4949
multipleItems = multi;
5050
if (notMobile) {
5151
thumbNavigation = 'far-right';
@@ -54,127 +54,127 @@ windowSettings.manifestId = manifest;
5454
}
5555
})();
5656

57-
(Mirador.viewer(
58-
{
59-
id: 'mirador',
60-
mainMenuSettings: {
61-
show: true
62-
},
63-
thumbnailNavigation: {
64-
defaultPosition: thumbNavigation, // Which position for the thumbnail navigation to be be displayed. Other possible values are "far-bottom" or "far-right"
65-
displaySettings: true, // Display the settings for this in WindowTopMenu
66-
height: 120, // height of entire ThumbnailNavigation area when position is "far-bottom"
67-
width: 100, // width of one canvas (doubled for book view) in ThumbnailNavigation area when position is "far-right"
68-
},
69-
themes: {
70-
light: {
71-
palette: {
72-
type: 'light',
73-
primary: {
74-
main: '#266883',
75-
},
76-
secondary: {
77-
main: '#b03727',
78-
},
79-
shades: { // Shades that can be used to offset color areas of the Workspace / Window
80-
dark: '#eeeeee',
81-
main: '#ffffff',
82-
light: '#ffffff',
83-
},
84-
highlights: {
85-
primary: '#ffff00',
86-
secondary: '#00BFFF',
87-
},
88-
search: {
89-
default: { fillStyle: '#00BFFF', globalAlpha: 0.3 },
90-
hovered: { fillStyle: '#00FFFF', globalAlpha: 0.3 },
91-
selected: { fillStyle: '#ff0900', globalAlpha: 0.3 },
92-
},
93-
},
57+
const miradorConfiguration = {
58+
id: 'mirador',
59+
mainMenuSettings: {
60+
show: true
61+
},
62+
thumbnailNavigation: {
63+
defaultPosition: thumbNavigation, // Which position for the thumbnail navigation to be be displayed. Other possible values are "far-bottom" or "far-right"
64+
displaySettings: true, // Display the settings for this in WindowTopMenu
65+
height: 120, // height of entire ThumbnailNavigation area when position is "far-bottom"
66+
width: 100, // width of one canvas (doubled for book view) in ThumbnailNavigation area when position is "far-right"
67+
},
68+
themes: {
69+
light: {
70+
palette: {
71+
type: 'light',
72+
primary: {
73+
main: '#266883',
9474
},
95-
dark: {
96-
palette: {
97-
type: 'dark',
98-
primary: {
99-
main: '#2790b0',
100-
},
101-
secondary: {
102-
main: '#eeeeee',
103-
},
104-
highlights: {
105-
primary: '#ffff00',
106-
secondary: '#00BFFF',
107-
},
108-
},
75+
secondary: {
76+
main: '#b03727',
10977
},
110-
},
111-
selectedTheme: 'light',
112-
data: [manifest],
113-
windows: [
114-
windowSettings
115-
],
116-
miradorSharePlugin: {
117-
dragAndDropInfoLink: 'https://iiif.io',
118-
embedOption: {
119-
enabled: true,
120-
embedUrlReplacePattern: [
121-
/.*/,
122-
embedURL
123-
],
124-
syncIframeDimensions: {
125-
height: {param: 'maxheight'},
126-
},
78+
shades: { // Shades that can be used to offset color areas of the Workspace / Window
79+
dark: '#eeeeee',
80+
main: '#ffffff',
81+
light: '#ffffff',
12782
},
128-
shareLink: {
129-
enabled: true,
130-
manifestIdReplacePattern: [
131-
/\/iiif\/manifest/,
132-
'',
133-
],
83+
highlights: {
84+
primary: '#ffff00',
85+
secondary: '#00BFFF',
86+
},
87+
search: {
88+
default: { fillStyle: '#00BFFF', globalAlpha: 0.3 },
89+
hovered: { fillStyle: '#00FFFF', globalAlpha: 0.3 },
90+
selected: { fillStyle: '#ff0900', globalAlpha: 0.3 },
13491
},
13592
},
136-
miradorDownloadPlugin: {
137-
restrictDownloadOnSizeDefinition: false
138-
},
139-
window: {
140-
allowClose: false,
141-
// sideBarOpenByDefault: false,
142-
allowFullscreen: true,
143-
allowMaximize: false,
144-
defaultView: defaultView,
145-
sideBarOpen: notMobile,
146-
allowTopMenuButton: true,
147-
defaultSidebarPanelWidth: 230,
148-
switchCanvasOnSearch: true,
149-
views: [
150-
{ key: 'single', behaviors: ['individuals'] },
151-
{ key: 'book', behaviors: ['paged'] },
152-
{ key: 'scroll', behaviors: ['continuous'] },
153-
{ key: 'gallery' },
154-
],
155-
panels: {
156-
info: true,
157-
attribution: false,
158-
canvas: true,
159-
search: searchOption,
160-
layers: false,
93+
},
94+
dark: {
95+
palette: {
96+
type: 'dark',
97+
primary: {
98+
main: '#2790b0',
99+
},
100+
secondary: {
101+
main: '#eeeeee',
102+
},
103+
highlights: {
104+
primary: '#ffff00',
105+
secondary: '#00BFFF',
161106
},
162-
sideBarPanel: sidbarPanel
163107
},
164-
workspace: {
165-
allowNewWindows: false,
166-
showZoomControls: true,
167-
type: 'mosaic'
108+
},
109+
},
110+
selectedTheme: 'light',
111+
data: [manifest],
112+
windows: [
113+
windowSettings
114+
],
115+
miradorSharePlugin: {
116+
dragAndDropInfoLink: 'https://iiif.io',
117+
embedOption: {
118+
enabled: true,
119+
embedUrlReplacePattern: [
120+
/.*/,
121+
embedURL
122+
],
123+
syncIframeDimensions: {
124+
height: {param: 'maxheight'},
168125
},
169-
workspaceControlPanel: {
170-
enabled: false
171-
}
172126
},
173-
[
174-
miradorShareDialogPlugin,
175-
miradorSharePlugin,
176-
miradorDownloadDialog,
177-
miradorDownloadPlugin
178-
]
179-
)
180-
)(manifest);
127+
shareLink: {
128+
enabled: true,
129+
manifestIdReplacePattern: [
130+
/\/iiif\/manifest/,
131+
'',
132+
],
133+
},
134+
},
135+
miradorDownloadPlugin: {
136+
restrictDownloadOnSizeDefinition: false
137+
},
138+
window: {
139+
allowClose: false,
140+
// sideBarOpenByDefault: false,
141+
allowFullscreen: true,
142+
allowMaximize: false,
143+
defaultView: defaultView,
144+
sideBarOpen: notMobile,
145+
allowTopMenuButton: true,
146+
defaultSidebarPanelWidth: 230,
147+
switchCanvasOnSearch: true,
148+
views: [
149+
{ key: 'single', behaviors: ['individuals'] },
150+
{ key: 'book', behaviors: ['paged'] },
151+
{ key: 'scroll', behaviors: ['continuous'] },
152+
{ key: 'gallery' },
153+
],
154+
panels: {
155+
info: true,
156+
attribution: false,
157+
canvas: true,
158+
search: searchOption,
159+
layers: false,
160+
},
161+
sideBarPanel: sideBarPanel
162+
},
163+
workspace: {
164+
allowNewWindows: false,
165+
showZoomControls: true,
166+
type: 'mosaic'
167+
},
168+
workspaceControlPanel: {
169+
enabled: false
170+
}
171+
};
172+
173+
const miradorPlugins = [
174+
miradorShareDialogPlugin,
175+
miradorSharePlugin,
176+
miradorDownloadDialog,
177+
miradorDownloadPlugin
178+
];
179+
180+
Mirador.viewer(miradorConfiguration, miradorPlugins);

0 commit comments

Comments
 (0)