Skip to content

Commit

Permalink
🎁 Add highlight key to UV
Browse files Browse the repository at this point in the history
This commit allows for the `parent_query` to be highlighted in the UV so
users won't have to do a catalog search and also a UV search.
  • Loading branch information
kirkkwang committed Oct 6, 2023
1 parent 95a7482 commit 80e02d3
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions config/uv/uv.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,28 @@
}
</style>
<script type="text/javascript">
window.addEventListener('uvLoaded', function(e) {
window.addEventListener('uvLoaded', function(e) {
urlDataProvider = new UV.URLDataProvider(true);
var formattedLocales;
var locales = urlDataProvider.get('locales', '');

if (locales) {
var names = locales.split(',');
formattedLocales = [];

for (var i in names) {
var nameparts = String(names[i]).split(':');
formattedLocales[i] = {name: nameparts[0], label: nameparts[1]};
}

} else {
formattedLocales = [
{
name: 'en-GB'
}
]
}

uv = createUV('#uv', {
root: '.',
iiifResourceUri: urlDataProvider.get('manifest'),
Expand All @@ -53,34 +53,35 @@
rotation: Number(urlDataProvider.get('r', 0)),
xywh: urlDataProvider.get('xywh', ''),
embedded: true,
highlight: urlDataProvider.get('q'),

This comment has been minimized.

Copy link
@kirkkwang

kirkkwang Oct 6, 2023

Author Collaborator

actual change is here

locales: formattedLocales
}, urlDataProvider);
}, false);
</script>
</head>
</head>
<body>

<div id="uv" class="uv"></div>

<script>
$(function() {

var $UV = $('#uv');

function resize() {
var windowWidth = window.innerWidth;
var windowHeight = window.innerHeight;
$UV.width(windowWidth);
$UV.height(windowHeight);
}

$(window).on('resize' ,function() {
resize();
});

resize();
});

</script>
<script type="text/javascript" src="uv.js"></script>
</body>
Expand Down

0 comments on commit 80e02d3

Please sign in to comment.