Skip to content

Commit

Permalink
ro-crate previewer
Browse files Browse the repository at this point in the history
  • Loading branch information
ErykKul committed Sep 29, 2023
1 parent 811f99b commit 52995e1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
1 change: 0 additions & 1 deletion previewers/betatest/ROCrate.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
<title class="rocratePreviewText">RO-Crate Preview</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script type="text/javascript" src="js/xss.js"></script>
<script type="text/javascript" src="js/ro-crate-dynamic.js"></script>
<script type="text/javascript" src="js/rocrate.js"></script>
<script src="lib/jquery.i18n.js"></script>
<script src="lib/jquery.i18n.messagestore.js"></script>
Expand Down
10 changes: 10 additions & 0 deletions previewers/betatest/js/ro-crate-dynamic.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,16 @@ async function load() {
updatePage();
}

window.onhashchange = function () {
load();
};

window.onload = function () {
load();
};



async function updatePage() {
var hash = location.hash;

Expand Down
8 changes: 2 additions & 6 deletions previewers/betatest/js/rocrate.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ function translateBaseHtmlPage() {
async function writeContentAndData(data, fileUrl, file, title, authors) {
addStandardPreviewHeader(file, title, authors);
$('.preview').append($("<script type=\"application/ld+json\"/>").html(data));
window.onhashchange = function () {
load();
};
window.onload = function () {
load();
};
$('.preview').append($("<script type=\"text/javascript\" src=\"js/ro-crate-dynamic.js\"/>"))
document.location.reload(true)
}

0 comments on commit 52995e1

Please sign in to comment.