Browse Source

first commit

master
Cesare Concordia 11 months ago
parent
commit
c6c38e4994
  1. 30
      previewers/AudioPreview.html
  2. 27
      previewers/AudioPreviewOriginal.html
  3. 30
      previewers/HtmlPreview.html
  4. 26
      previewers/HtmlPreviewOriginal.html
  5. 28
      previewers/HypothesisPreview.html
  6. 27
      previewers/ImagePreview.html
  7. 43
      previewers/PDFPreview.html
  8. 40
      previewers/PDFPreviewOriginal.html
  9. 23
      previewers/SendPDF.html
  10. 27
      previewers/SendPDF_original.html
  11. 23
      previewers/SendText.html
  12. 36
      previewers/SpreadsheetPreview.html
  13. 33
      previewers/SpreadsheetPreviewOriginal.html
  14. 30
      previewers/TextPreview.html
  15. 27
      previewers/TextPreview2original.html
  16. 26
      previewers/VideoPreview.html
  17. 76
      previewers/css/lds-spinner.css
  18. 135
      previewers/css/preview.css
  19. 25
      previewers/i18n/en.json
  20. 24
      previewers/i18n/en_orig.json
  21. 25
      previewers/i18n/es.json
  22. 25
      previewers/i18n/fr.json
  23. BIN
      previewers/images/logo_placeholder.png
  24. 14
      previewers/js/audio.js
  25. 16
      previewers/js/html.js
  26. 87
      previewers/js/hypothesis.js
  27. 18
      previewers/js/image.js
  28. 23488
      previewers/js/pdf.js
  29. 55433
      previewers/js/pdf.worker.js
  30. 122
      previewers/js/pdfpreview.js
  31. 222
      previewers/js/retriever.js
  32. 213
      previewers/js/retriever_buono.js
  33. 35
      previewers/js/showdown-xss-filter.js
  34. 3
      previewers/js/showdown.min.js
  35. 45
      previewers/js/spreadsheet.js
  36. 80
      previewers/js/text.js
  37. 80
      previewers/js/text_orig.js
  38. 14
      previewers/js/video.js
  39. 1608
      previewers/js/xss.js
  40. 186
      previewers/lib/jquery.i18n.fallbacks.js
  41. 290
      previewers/lib/jquery.i18n.js
  42. 499
      previewers/lib/jquery.i18n.language.js
  43. 126
      previewers/lib/jquery.i18n.messagestore.js

30
previewers/AudioPreview.html

@ -0,0 +1,30 @@
<html>
<head>
<meta charset="utf-8">
<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/audio.js"></script>
<script src="lib/jquery.i18n.js"></script>
<script src="lib/jquery.i18n.messagestore.js"></script>
<script src="lib/jquery.i18n.language.js"></script>
<script type="text/javascript" src="js/retriever.js"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap-theme.min.css" integrity="sha384-6pzBo3FDv/PJ8r2KRkGHifhEocL+1X2rVCTTkUfGk7/0pbek5mMa1upzvWbrUbOZ" crossorigin="anonymous"><link type="text/css" rel="stylesheet" href="/dataverse-previewers/previewers/css/preview.css"/>
<link type="text/css" rel="stylesheet" href="css/preview.css"/>
</head>
<body class="container">
<script>
var cType="audio%2Fmpeg";
</script>
<img id='logo'></img>
<H1 class="page-title audioPreviewText">SSHOC Audio Preview
</H1>
<div class='preview-container'>
<div class='preview-header'></div>
<div class='preview'></div>
</div>
</body>
</html>

27
previewers/AudioPreviewOriginal.html

@ -0,0 +1,27 @@
<html>
<head>
<meta charset="utf-8">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script type="text/javascript" src="/dataverse-previewers/previewers/js/xss.js"></script>
<script type="text/javascript" src="/dataverse-previewers/previewers/js/audio.js"></script>
<script src="lib/jquery.i18n.js"></script>
<script src="lib/jquery.i18n.messagestore.js"></script>
<script src="lib/jquery.i18n.language.js"></script>
<script type="text/javascript" src="/dataverse-previewers/previewers/js/retriever.js"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap-theme.min.css" integrity="sha384-6pzBo3FDv/PJ8r2KRkGHifhEocL+1X2rVCTTkUfGk7/0pbek5mMa1upzvWbrUbOZ" crossorigin="anonymous"><link type="text/css" rel="stylesheet" href="/dataverse-previewers/previewers/css/preview.css"/>
<link type="text/css" rel="stylesheet" href="/dataverse-previewers/previewers/css/preview.css"/>
</head>
<body class="container">
<img id='logo'></img>
<H1 class="page-title audioPreviewText">Audio Preview
</H1>
<div class='preview-container'>
<div class='preview-header'></div>
<div class='preview'></div>
</div>
</body>
</html>

30
previewers/HtmlPreview.html

@ -0,0 +1,30 @@
<html>
<head>
<meta charset="utf-8">
<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/html.js"></script>
<script src="lib/jquery.i18n.js"></script>
<script src="lib/jquery.i18n.messagestore.js"></script>
<script src="lib/jquery.i18n.language.js"></script>
<script type="text/javascript" src="js/retriever.js"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap-theme.min.css" integrity="sha384-6pzBo3FDv/PJ8r2KRkGHifhEocL+1X2rVCTTkUfGk7/0pbek5mMa1upzvWbrUbOZ" crossorigin="anonymous"><link type="text/css" rel="stylesheet" href="/dataverse-previewers/previewers/css/preview.css"/>
<link type="text/css" rel="stylesheet" href="css/preview.css"/>
</head>
<body class="container">
<script>
var cType="text%2Fhtml";
</script>
<img id='logo'></img>
<H1 class="page-title htmlPreviewText">SSHOC Html Preview
</H1>
<div class='preview-container'>
<div class='preview-header'></div>
<div class='preview'></div>
</div>
</body>
</html>

26
previewers/HtmlPreviewOriginal.html

@ -0,0 +1,26 @@
<html>
<head>
<meta charset="utf-8">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script type="text/javascript" src="/dataverse-previewers/previewers/js/xss.js"></script>
<script type="text/javascript" src="/dataverse-previewers/previewers/js/html.js"></script>
<script src="lib/jquery.i18n.js"></script>
<script src="lib/jquery.i18n.messagestore.js"></script>
<script src="lib/jquery.i18n.language.js"></script>
<script type="text/javascript" src="/dataverse-previewers/previewers/js/retriever.js"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap-theme.min.css" integrity="sha384-6pzBo3FDv/PJ8r2KRkGHifhEocL+1X2rVCTTkUfGk7/0pbek5mMa1upzvWbrUbOZ" crossorigin="anonymous"><link type="text/css" rel="stylesheet" href="/dataverse-previewers/previewers/css/preview.css"/>
<link type="text/css" rel="stylesheet" href="/dataverse-previewers/previewers/css/preview.css"/>
</head>
<body class="container">
<img id='logo'></img>
<H1 class="page-title htmlPreviewText">Html Preview
</H1>
<div class='preview-container'>
<div class='preview-header'></div>
<div class='preview'></div>
</div>
</body>
</html>

28
previewers/HypothesisPreview.html

@ -0,0 +1,28 @@
<html>
<head>
<meta charset="utf-8">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script type="text/javascript" src="/dataverse-previewers/previewers/js/xss.js"></script>
<script type="text/javascript" src="/dataverse-previewers/previewers/js/showdown.min.js"></script>
<script type="text/javascript" src="/dataverse-previewers/previewers/js/showdown-xss-filter.js"></script>
<script type="text/javascript" src="/dataverse-previewers/previewers/js/hypothesis.js"></script>
<script src="lib/jquery.i18n.js"></script>
<script src="lib/jquery.i18n.messagestore.js"></script>
<script src="lib/jquery.i18n.language.js"></script>
<script type="text/javascript" src="/dataverse-previewers/previewers/js/retriever.js"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap-theme.min.css" integrity="sha384-6pzBo3FDv/PJ8r2KRkGHifhEocL+1X2rVCTTkUfGk7/0pbek5mMa1upzvWbrUbOZ" crossorigin="anonymous"><link type="text/css" rel="stylesheet" href="/dataverse-previewers/previewers/css/preview.css"/>
<link type="text/css" rel="stylesheet" href="/dataverse-previewers/previewers/css/preview.css"/>
</head>
<body class="container">
<img id='logo'></img>
<H1 class="page-title">
<a href="https://qdr.syr.edu/ati">ATI</a><span class="annotationsText">Annotations</span>
</H1>
<div class='preview-header'></div>
<div class="hypothesis">
</div>
</body>
</html>

27
previewers/ImagePreview.html

@ -0,0 +1,27 @@
<html>
<head>
<meta charset="utf-8">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script type="text/javascript" src="/dataverse-previewers/previewers/js/xss.js"></script>
<script type="text/javascript" src="/dataverse-previewers/previewers/js/image.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery-zoom/1.7.21/jquery.zoom.min.js"></script>
<script src="lib/jquery.i18n.js"></script>
<script src="lib/jquery.i18n.messagestore.js"></script>
<script src="lib/jquery.i18n.language.js"></script>
<script type="text/javascript" src="/dataverse-previewers/previewers/js/retriever.js"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap-theme.min.css" integrity="sha384-6pzBo3FDv/PJ8r2KRkGHifhEocL+1X2rVCTTkUfGk7/0pbek5mMa1upzvWbrUbOZ" crossorigin="anonymous"><link type="text/css" rel="stylesheet" href="/dataverse-previewers/previewers/css/preview.css"/>
<link type="text/css" rel="stylesheet" href="/dataverse-previewers/previewers/css/preview.css"/>
</head>
<body class="container">
<img id='logo'></img>
<H1 class="page-title imagePreviewText">Image Preview
</H1>
<div class='preview-container'>
<div class='preview-header'></div>
<div class='preview'></div>
</div>
</body>
</html>

43
previewers/PDFPreview.html

@ -0,0 +1,43 @@
<html>
<head>
<meta charset="utf-8">
<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/pdfpreview.js"></script>
<script type="text/javascript" src="js/pdf.js"></script>
<script type="text/javascript" src="js/pdf.worker.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery-zoom/1.7.21/jquery.zoom.min.js"></script>
<script src="lib/jquery.i18n.js"></script>
<script src="lib/jquery.i18n.messagestore.js"></script>
<script src="lib/jquery.i18n.language.js"></script>
<script type="text/javascript" src="js/retriever.js"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap-theme.min.css" integrity="sha384-6pzBo3FDv/PJ8r2KRkGHifhEocL+1X2rVCTTkUfGk7/0pbek5mMa1upzvWbrUbOZ" crossorigin="anonymous"><link type="text/css" rel="stylesheet" href="/dataverse-previewers/previewers/css/preview.css"/>
<link type="text/css" rel="stylesheet" href="css/preview.css"/>
<link type="text/css" rel="stylesheet" href="css/lds-spinner.css"/>
</head>
<body class="container">
<script>
var cType="application%2Fpdf";
</script>
<img id='logo'></img>
<H1 class="page-title pdfPreviewText">SSHOC PDF Preview
</H1>
<div class='preview-container'>
<div class='preview-header'></div>
<div class='preview'>
<div>
<button id="prev">Previous</button>
<button id="next">Next</button>
&nbsp; &nbsp;
<span class="pageText">Page:</span> <span id="page_num"></span> / <span id="page_count"></span>
</div>
<div class="lds-spinner"><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div></div>
<canvas id="the-canvas"></canvas>
</div>
</div>
</body>
</html>

40
previewers/PDFPreviewOriginal.html

@ -0,0 +1,40 @@
<html>
<head>
<meta charset="utf-8">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script type="text/javascript" src="/dataverse-previewers/previewers/js/xss.js"></script>
<script type="text/javascript" src="/dataverse-previewers/previewers/js/pdfpreview.js"></script>
<script type="text/javascript" src="/dataverse-previewers/previewers/js/pdf.js"></script>
<script type="text/javascript" src="/dataverse-previewers/previewers/js/pdf.worker.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery-zoom/1.7.21/jquery.zoom.min.js"></script>
<script src="lib/jquery.i18n.js"></script>
<script src="lib/jquery.i18n.messagestore.js"></script>
<script src="lib/jquery.i18n.language.js"></script>
<script type="text/javascript" src="/dataverse-previewers/previewers/js/retriever.js"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap-theme.min.css" integrity="sha384-6pzBo3FDv/PJ8r2KRkGHifhEocL+1X2rVCTTkUfGk7/0pbek5mMa1upzvWbrUbOZ" crossorigin="anonymous"><link type="text/css" rel="stylesheet" href="/dataverse-previewers/previewers/css/preview.css"/>
<link type="text/css" rel="stylesheet" href="/dataverse-previewers/previewers/css/preview.css"/>
<link type="text/css" rel="stylesheet" href="/dataverse-previewers/previewers/css/lds-spinner.css"/>
</head>
<body class="container">
<img id='logo'></img>
<H1 class="page-title pdfPreviewText">PDF Preview
</H1>
<div class='preview-container'>
<div class='preview-header'></div>
<div class='preview'>
<div>
<button id="prev">Previous</button>
<button id="next">Next</button>
&nbsp; &nbsp;
<span class="pageText">Page:</span> <span id="page_num"></span> / <span id="page_count"></span>
</div>
<div class="lds-spinner"><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div></div>
<canvas id="the-canvas"></canvas>
</div>
</div>
</body>
</html>

23
previewers/SendPDF.html

@ -0,0 +1,23 @@
<html>
<head>
<meta charset="utf-8">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="lib/jquery.i18n.js"></script>
<script src="lib/jquery.i18n.messagestore.js"></script>
<script src="lib/jquery.i18n.language.js"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap-theme.min.css" integrity="sha384-6pzBo3FDv/PJ8r2KRkGHifhEocL+1X2rVCTTkUfGk7/0pbek5mMa1upzvWbrUbOZ" crossorigin="anonymous"><link type="text/css" rel="stylesheet" href="/previewers/css/preview.css"/>
</head>
<body class="container">
<script>
var cType="application%2Fpdf";
queryParams = new URLSearchParams(window.location.search.substring(1));
lRSUrl="https://switchboard.clarin.eu/#/dataverse/"+encodeURIComponent(queryParams.get("siteUrl") + "/api/access/datafile/"+ queryParams.get("fileid")+ "?gbrecs=false" )+"/"+cType+queryParams.get("locale");
$(function() {$(location).attr('href',lRSUrl);});
</script>
</body>
</html>

27
previewers/SendPDF_original.html

@ -0,0 +1,27 @@
<html>
<head>
<meta charset="utf-8">
<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/text.js"></script>
<script src="lib/jquery.i18n.js"></script>
<script src="lib/jquery.i18n.messagestore.js"></script>
<script src="lib/jquery.i18n.language.js"></script>
<script type="text/javascript" src="js/retriever.js"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap-theme.min.css" integrity="sha384-6pzBo3FDv/PJ8r2KRkGHifhEocL+1X2rVCTTkUfGk7/0pbek5mMa1upzvWbrUbOZ" crossorigin="anonymous"><link type="text/css" rel="stylesheet" href="/previewers/css/preview.css"/>
<link type="text/css" rel="stylesheet" href="css/preview.css"/>
</head>
<body class="container">
<script>
var cType="application%2Fpdf";
queryParams = new URLSearchParams(window.location.search.substring(1));
lRSUrl="https://switchboard.clarin.eu/#/d4science/"+encodeURIComponent(queryParams.get("siteUrl") + "/api/access/datafile/"+ queryParams.get("fileid")+ "?gbrecs=false" )+"/"+cType+queryParams.get("locale");
$(function() {$(location).attr('href',lRSUrl);});
</script>
</body>
</html>

23
previewers/SendText.html

@ -0,0 +1,23 @@
<html>
<head>
<meta charset="utf-8">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="lib/jquery.i18n.js"></script>
<script src="lib/jquery.i18n.messagestore.js"></script>
<script src="lib/jquery.i18n.language.js"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap-theme.min.css" integrity="sha384-6pzBo3FDv/PJ8r2KRkGHifhEocL+1X2rVCTTkUfGk7/0pbek5mMa1upzvWbrUbOZ" crossorigin="anonymous"><link type="text/css" rel="stylesheet" href="/previewers/css/preview.css"/>
</head>
<body class="container">
<script>
var cType="text%2Fplain";
queryParams = new URLSearchParams(window.location.search.substring(1));
lRSUrl="https://switchboard.clarin.eu/#/dataverse/"+encodeURIComponent(queryParams.get("siteUrl") + "/api/access/datafile/"+ queryParams.get("fileid")+ "?gbrecs=false" )+"/"+cType+"/en";
//alert(lRSUrl);
$(function() {$(location).attr('href',lRSUrl);});
</script>
</body>
</html>

36
previewers/SpreadsheetPreview.html

@ -0,0 +1,36 @@
<html >
<head>
<meta charset="utf-8">
<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 src="https://cdn.jsdelivr.net/handsontable/0.28.4/handsontable.full.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/papaparse@5"></script>
<script type="text/javascript" src="js/spreadsheet.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery-zoom/1.7.21/jquery.zoom.min.js"></script>
<script src="lib/jquery.i18n.js"></script>
<script src="lib/jquery.i18n.messagestore.js"></script>
<script src="lib/jquery.i18n.language.js"></script>
<script type="text/javascript" src="js/retriever.js"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap-theme.min.css" integrity="sha384-6pzBo3FDv/PJ8r2KRkGHifhEocL+1X2rVCTTkUfGk7/0pbek5mMa1upzvWbrUbOZ" crossorigin="anonymous"><link type="text/css" rel="stylesheet" href="/dataverse-previewers/previewers/css/preview.css"/>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/handsontable/0.28.4/handsontable.full.min.css">
<link type="text/css" rel="stylesheet" href="css/preview.css"/>
</head>
<body class="container">
<script>
var cType="text%2Ftab-separated-values";
</script>
<img id='logo'></img>
<H1 class="page-title spreadsheetViewerText">SSHOC Spreadsheet Viewer
</H1>
<div class='preview-container'>
<div class='preview-header'></div>
<div class='preview'>
<div id="handsontable-container"></div>
</div>
</div>
</body>
</html>

33
previewers/SpreadsheetPreviewOriginal.html

@ -0,0 +1,33 @@
<html >
<head>
<meta charset="utf-8">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script type="text/javascript" src="/dataverse-previewers/previewers/js/xss.js"></script>
<script src="https://cdn.jsdelivr.net/handsontable/0.28.4/handsontable.full.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/papaparse@5"></script>
<script type="text/javascript" src="/dataverse-previewers/previewers/js/spreadsheet.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery-zoom/1.7.21/jquery.zoom.min.js"></script>
<script src="lib/jquery.i18n.js"></script>
<script src="lib/jquery.i18n.messagestore.js"></script>
<script src="lib/jquery.i18n.language.js"></script>
<script type="text/javascript" src="/dataverse-previewers/previewers/js/retriever.js"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap-theme.min.css" integrity="sha384-6pzBo3FDv/PJ8r2KRkGHifhEocL+1X2rVCTTkUfGk7/0pbek5mMa1upzvWbrUbOZ" crossorigin="anonymous"><link type="text/css" rel="stylesheet" href="/dataverse-previewers/previewers/css/preview.css"/>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/handsontable/0.28.4/handsontable.full.min.css">
<link type="text/css" rel="stylesheet" href="/dataverse-previewers/previewers/css/preview.css"/>
</head>
<body class="container">
<img id='logo'></img>
<H1 class="page-title spreadsheetViewerText">Spreadsheet Viewer
</H1>
<div class='preview-container'>
<div class='preview-header'></div>
<div class='preview'>
<div id="handsontable-container"></div>
</div>
</div>
</body>
</html>

30
previewers/TextPreview.html

@ -0,0 +1,30 @@
<html>
<head>
<meta charset="utf-8">
<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/text.js"></script>
<script src="lib/jquery.i18n.js"></script>
<script src="lib/jquery.i18n.messagestore.js"></script>
<script src="lib/jquery.i18n.language.js"></script>
<script type="text/javascript" src="js/retriever.js"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap-theme.min.css" integrity="sha384-6pzBo3FDv/PJ8r2KRkGHifhEocL+1X2rVCTTkUfGk7/0pbek5mMa1upzvWbrUbOZ" crossorigin="anonymous"><link type="text/css" rel="stylesheet" href="/previewers/css/preview.css"/>
<link type="text/css" rel="stylesheet" href="css/preview.css"/>
</head>
<body class="container">
<script>
var cType="text%2Fplain";
</script>
<img id='logo'></img>
<H1 class="page-title textPreviewText">SSHOC Text Preview
</H1>
<div class='preview-container'>
<div class='preview-header'></div>
<div class='preview'></div>
</div>
</body>
</html>

27
previewers/TextPreview2original.html

@ -0,0 +1,27 @@
<html>
<head>
<meta charset="utf-8">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script type="text/javascript" src="/dataverse-previewers/previewers/js/xss.js"></script>
<script type="text/javascript" src="/dataverse-previewers/previewers/js/text.js"></script>
<script src="lib/jquery.i18n.js"></script>
<script src="lib/jquery.i18n.messagestore.js"></script>
<script src="lib/jquery.i18n.language.js"></script>
<script type="text/javascript" src="/dataverse-previewers/previewers/js/retriever.js"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap-theme.min.css" integrity="sha384-6pzBo3FDv/PJ8r2KRkGHifhEocL+1X2rVCTTkUfGk7/0pbek5mMa1upzvWbrUbOZ" crossorigin="anonymous"><link type="text/css" rel="stylesheet" href="/dataverse-previewers/previewers/css/preview.css"/>
<link type="text/css" rel="stylesheet" href="/dataverse-previewers/previewers/css/preview.css"/>
</head>
<body class="container">
<img id='logo'></img>
<H1 class="page-title textPreviewText">Text Preview
</H1>
<div class='preview-container'>
<div class='preview-header'></div>
<div class='preview'></div>
</div>
</body>
</html>

26
previewers/VideoPreview.html

@ -0,0 +1,26 @@
<html>
<head>
<meta charset="utf-8">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script type="text/javascript" src="/dataverse-previewers/previewers/js/xss.js"></script>
<script type="text/javascript" src="/dataverse-previewers/previewers/js/video.js"></script>
<script src="lib/jquery.i18n.js"></script>
<script src="lib/jquery.i18n.messagestore.js"></script>
<script src="lib/jquery.i18n.language.js"></script>
<script type="text/javascript" src="/dataverse-previewers/previewers/js/retriever.js"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap-theme.min.css" integrity="sha384-6pzBo3FDv/PJ8r2KRkGHifhEocL+1X2rVCTTkUfGk7/0pbek5mMa1upzvWbrUbOZ" crossorigin="anonymous"><link type="text/css" rel="stylesheet" href="/dataverse-previewers/previewers/css/preview.css"/>
<link type="text/css" rel="stylesheet" href="/dataverse-previewers/previewers/css/preview.css"/>
</head>
<body class="container">
<img id='logo'></img>
<H1 class="page-title videoPreviewText">Video Preview
</H1>
<div class='preview-container'>
<div class='preview-header'></div>
<div class='preview'></div>
</div>
</body>
</html>

76
previewers/css/lds-spinner.css

@ -0,0 +1,76 @@
.lds-spinner {
color: official;
position: relative;
margin: 20% 10% 10% 30%;
}
.lds-spinner div {
transform-origin: 128px 128px;
animation: lds-spinner 1.2s linear infinite;
}
.lds-spinner div:after {
content: " ";
display: block;
position: absolute;
top: 3px;
left: 122px;
width: 10px;
height: 64px;
border-radius: 20%;
background: #999;
}
.lds-spinner div:nth-child(1) {
transform: rotate(0deg);
animation-delay: -1.1s;
}
.lds-spinner div:nth-child(2) {
transform: rotate(30deg);
animation-delay: -1s;
}
.lds-spinner div:nth-child(3) {
transform: rotate(60deg);
animation-delay: -0.9s;
}
.lds-spinner div:nth-child(4) {
transform: rotate(90deg);
animation-delay: -0.8s;
}
.lds-spinner div:nth-child(5) {
transform: rotate(120deg);
animation-delay: -0.7s;
}
.lds-spinner div:nth-child(6) {
transform: rotate(150deg);
animation-delay: -0.6s;
}
.lds-spinner div:nth-child(7) {
transform: rotate(180deg);
animation-delay: -0.5s;
}
.lds-spinner div:nth-child(8) {
transform: rotate(210deg);
animation-delay: -0.4s;
}
.lds-spinner div:nth-child(9) {
transform: rotate(240deg);
animation-delay: -0.3s;
}
.lds-spinner div:nth-child(10) {
transform: rotate(270deg);
animation-delay: -0.2s;
}
.lds-spinner div:nth-child(11) {
transform: rotate(300deg);
animation-delay: -0.1s;
}
.lds-spinner div:nth-child(12) {
transform: rotate(330deg);
animation-delay: 0s;
}
@keyframes lds-spinner {
0% {
opacity: 1;
}
100% {
opacity: 0;
}
}

135
previewers/css/preview.css

@ -0,0 +1,135 @@
.page-title {
display: inline-block;
width: 58%;
text-align:center;
}
.page-title a {
color: #56B7CB;
}
.preview-header {
font-size:14px;
font-family: sans-serif;
color: darkslategray;
overflow-wrap: break-word;
margin-bottom: 10px;
background: #ECF6FB;
border-color: #9acfea;
border-style: solid;
border-width:1px;
padding: 15px 15px 5px 15px;
}
.preview-header div {
margin: 10px 5px 5px 0px;
}
.preview-header #filename {
font-size: 16px;
}
.preview-header #dataset {
font-style: italic;
}
.preview-note {
float:right;
font-size: 12px;
padding-top:20px;
}
.preview-container {
margin-left: 40px;
}
.preview {
margin: 0 auto;
padding: 10px 10px 5px 10px;
}
.preview audio {
margin:20px auto;
display: table;
}
.preview video {
margin:20px auto;
min-width:600px;
display: table;
}
#logo {
display: inline-block;
margin-left: 40px;
width: 240px;
min-height:140px;
}
#footer {
font-size: x-small;
float: right;
}
}
.annotation-note {
float:right;
font-size: 12px;
padding-top:20px;
}
.annotation-card {
font-size: 13px;
line-height: 15px;
font-weight: 400;
border: 1px solid #ececec;
list-style: none;
padding: 15px;
margin-bottom: 10px;
box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);
background: #fff;
overflow-wrap: break-word;
}
.annotation-card__text {
overflow-wrap: break-word;
}
.annotation-card__text img {
max-width:100%;
}
.annotation-card__quote {
padding: 0 10px;
overflow-wrap: break-word;
color: #a6a6a6;
font-family: sans-serif;
font-size: 12px;
font-style: italic;
letter-spacing: .1px;
border-left: 3px solid #dbdbdb;
margin-bottom: 10px;
}
.annotation-card__tags {
display: -ms-flexbox;
display: flex;
-ms-flex-direction: row;
flex-direction: row;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
}
.annotation-card__tag {
text-decoration: none;
border: 1px solid #dbdbdb;
border-radius: 2px;
padding: 0 5px 2px;
color: #7a7a7a;
background: #f2f2f2;
margin: 0 5px 5px 0;
font-size: 11px;
cursor: pointer;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.annotation_raw {
max-height:500px;
word-break:break-all;
overflow-y:auto;
}

25
previewers/i18n/en.json

@ -0,0 +1,25 @@
{
"filenameText": "Filename: ",
"inText": "In ",
"byText": ", by ",
"uploadedOnText": "File uploaded on ",
"downloadFileText": "Download File",
"closePreviewText": "Close Preview",
"audioPreviewText": "SSHOC Audio Preview",
"csvPreviewText": "Csv Preview",
"htmlPreviewText": "Html Preview",
"annotationsText": "Annotations",
"imagePreviewText": "Image Preview",
"pdfPreviewText": "SSHOC PDF Preview",
"spreadsheetViewerText": "SSHOC Spreadsheet Viewer",
"textPreviewText": "SSHOC Text Preview",
"videoPreviewText": "Video Preview",
"prev": "Previous",
"next": "Next",
"pageText": "Page:",
"versionText": "version",
"LRSText": "Process with Language Resource Switchboard",
"descriptionText": "Description: ",
"footer": "The SSHOC Previewer, developed by Cesare Concordia, is based on the one developed by <a href=\"https://qdr.syr.edu\">QDR</a> and maintained at <a href=\"https://github.com/GlobalDataverseCommunityConsortium/dataverse-previewers\">https://github.com/GlobalDataverseCommunityConsortium/dataverse-previewers</a>.",
"errorText" : "Please try again. The most common issue is that your login has timed out. If the problem persists, please contact the support team of this data repository. Please include any status code included at the end of this message: "
}

24
previewers/i18n/en_orig.json

@ -0,0 +1,24 @@
{
"filenameText": "Filename: ",
"inText": "In ",
"byText": ", by ",
"uploadedOnText": "File uploaded on ",
"downloadFileText": "Download File",
"closePreviewText": "Close Preview",
"audioPreviewText": "Audio Preview",
"csvPreviewText": "Csv Preview",
"htmlPreviewText": "Html Preview",
"annotationsText": "Annotations",
"imagePreviewText": "Image Preview",
"pdfPreviewText": "PDF Preview",
"spreadsheetViewerText": "Spreadsheet Viewer",
"textPreviewText": "Text Preview",
"videoPreviewText": "Video Preview",
"prev": "Previous",
"next": "Next",
"pageText": "Page:",
"versionText": "version",
"descriptionText": "Description: ",
"footer": "Previewers originally developed by <a href=\"https://qdr.syr.edu\">QDR</a> and maintained at <a href=\"https://github.com/GlobalDataverseCommunityConsortium/dataverse-previewers\">https://github.com/GlobalDataverseCommunityConsortium/dataverse-previewers</a>. Feedback and contributions welcome.",
"errorText" : "Please try again. The most common issue is that your login has timed out. If the problem persists, please contact the support team of this data repository. Please include any status code included at the end of this message: "
}

25
previewers/i18n/es.json

@ -0,0 +1,25 @@
{
"filenameText": "Nombre del fichero: ",
"inText": "En ",
"byText": ", por ",
"uploadedOnText": "Fichero subido el ",
"downloadFileText": "Descargar fichero",
"closePreviewText": "Cerrar previsualización",
"audioPreviewText": "SSHOC Previsualización de audio",
"csvPreviewText": "Previsualización de csv",
"htmlPreviewText": "Previsualización de html",
"annotationsText": "Anotaciones",
"imagePreviewText": "Previsualización de imagen",
"pdfPreviewText": "SSHOC Previsualización de pdf",
"spreadsheetViewerText": "SSHOC Visor de hojas de cálculo",
"textPreviewText": "Previsualización de texto",
"videoPreviewText": "Previsualización de vídeo",
"prev": "Anterior",
"next": "Siguiente",
"pageText": "Página:",
"versionText": "versión",
"LRSText": "Process with Language Resource Switchboard",
"descriptionText": "Descripción: ",
"footer": "The SSHOC Previewer, developed by Cesare Concordia, is based on the one developed by <a href=\"https://qdr.syr.edu\">QDR</a> and maintained at <a href=\"https://github.com/GlobalDataverseCommunityConsortium/dataverse-previewers\">https://github.com/GlobalDataverseCommunityConsortium/dataverse-previewers</a>.",
"errorText" : "Inténtelo de nuevo por favor. El problema más común es que su sesión haya caducado. Si el problema continúa puede contactar con el equipo de soporte de su repositorio de datos. Por favor, indique los códigos de estado que encontrará al final de este mensaje: "
}

25
previewers/i18n/fr.json

@ -0,0 +1,25 @@
{
"filenameText": "Nom du fichier: ",
"inText": "Dans ",
"byText": ", par ",
"uploadedOnText": "Fichier téléversé le ",
"downloadFileText": "Télécharger le fichier",
"closePreviewText": "Fermer l'aperçu",
"audioPreviewText": "SSHOC Aperçu audio",
"csvPreviewText": "Aperçu CSV",
"htmlPreviewText": "Aperçu HTML",
"annotationsText": "Annotations",
"imagePreviewText": "Aperçu image",
"pdfPreviewText": "SSHOC Aperçu PDF",
"spreadsheetViewerText": "SSHOC Visualisateur de feuille de calcul",
"textPreviewText": "Aperçu texte",
"videoPreviewText": "Aperçu vidéo",
"prev": "Précédent",
"next": "Suivant",
"pageText": "Page:",
"versionText": "version",
"LRSText": "Process with Language Resource Switchboard",
"descriptionText": "Description: ",
"footer": "The SSHOC Previewer, developed by Cesare Concordia, is based on the one developed by <a href=\"https://qdr.syr.edu\">QDR</a> and maintained at <a href=\"https://github.com/GlobalDataverseCommunityConsortium/dataverse-previewers\">https://github.com/GlobalDataverseCommunityConsortium/dataverse-previewers</a>.",
"errorText" : "Veuillez réessayer. Le problème le plus commun est que votre session a expiré. Si le problème persiste, veuillez communiquer avec l'équipe de soutien pour ce dépôt de données. Veuillez fournir le code indiqué à la fin du présent message : "
}

BIN
previewers/images/logo_placeholder.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 481 B

14
previewers/js/audio.js

@ -0,0 +1,14 @@
$(document).ready(function() {
startPreview(false);
});
function translateBaseHtmlPage() {
var audioPreviewText = $.i18n( "audioPreviewText" );
$( '.audioPreviewText' ).text( audioPreviewText );
}
function writeContent(fileUrl, file, title, authors) {
addStandardPreviewHeader(file, title, authors);
$('.preview').append($("<audio/>").attr("controls","").attr("src",fileUrl));
}

16
previewers/js/html.js

@ -0,0 +1,16 @@
$(document).ready(function() {
startPreview(true);
});
function translateBaseHtmlPage() {
var htmlPreviewText = $.i18n( "htmlPreviewText" );
$( '.htmlPreviewText' ).text( htmlPreviewText );
}
function writeContentAndData(data, fileUrl, file, title, authors) {
addStandardPreviewHeader(file,title, authors);
options = {"stripIgnoreTag":true,
"stripIgnoreTagBody":['script','head']}; // Custom rules
$('.preview').append($("<div/>").html(filterXSS(data,options)));
}

87
previewers/js/hypothesis.js

@ -0,0 +1,87 @@
$(document).ready(function() {
startPreview(true);
});
function translateBaseHtmlPage() {
var annotationsText = $.i18n( "annotationsText" );
$( '.annotationsText' ).text( annotationsText );
}
function writeContentAndData(data, fileUrl, file, title, authors) {
addStandardPreviewHeader(file,title, authors);
var json = JSON.parse(data);
$(".preview-note").text(
json.total + " annotations, retrieved on " + file.creationDate);
$("<div/>").attr('id','incontext').addClass("btn btn-default").append(
$("<a/>").attr("href", json.rows[0].links.incontext).text(
"View Annotations In Context")).insertBefore($('.preview-header>.btn')[0]);
// Order by TextPositionSelector.start
json.rows.sort(annotationCompare);
// Create header block
var hypo = $(".hypothesis");
if (json.rows.length > 0) {
var converter = new showdown.Converter({
extensions : [ 'xssFilter' ]
});
hypo.html("");
//Display annotations
var list = $("<ol>").appendTo(hypo);
for ( var row in json.rows) {
var selectors = json.rows[row].target[0].selector;
var quote = "";
for ( var k in selectors) {
if (selectors[k].type == "TextQuoteSelector") {
quote = selectors[k].exact;
}
}
var created = json.rows[row].created;
list
.append($('<li class="annotation-card">')
.append(
$(
'<blockquote class="annotation-card__quote" title="Annotation quote">')
.text(quote))
.append(
$('<div class="annotation-card__text">')
.html(
converter
.makeHtml(json.rows[row].text))));
var tags = ($('<div class="annotation-card__tags" title="Tags">'))
.appendTo(list);
for ( var j in json.rows[row].tags) {
tags.append($('<div class="annotation-card__tag">').text(
json.rows[row].tags[j]));
}
}
$('.annotation-card__text a').attr("rel", "noopener nofollow").attr(
"target", "_blank");
}
}
function annotationCompare(a, b) {
var aPosition = 0;
var bPosition = 0;
for ( var j in a.target[0].selector) {
if (a.target[0].selector[j].type === "TextPositionSelector") {
aPosition = a.target[0].selector[j].start;
}
}
for ( var j in b.target[0].selector) {
if (b.target[0].selector[j].type === "TextPositionSelector") {
bPosition = b.target[0].selector[j].start;
}
}
if (aPosition < bPosition)
return -1;
if (aPosition > bPosition)
return 1;
return 0;
}

18
previewers/js/image.js

@ -0,0 +1,18 @@
$(document).ready(function() {
startPreview(false);
});
function translateBaseHtmlPage() {
var imagePreviewText = $.i18n( "imagePreviewText" );
$( '.imagePreviewText' ).text( imagePreviewText );
}
function writeContent(fileUrl, file, title, authors) {
addStandardPreviewHeader(file, title, authors);
$('.preview').append($('<img/>').attr('style','max-width:100%').attr('src',fileUrl).attr('id','previewImage'));
$("#previewImage")
.wrap('<span style="display:inline-block"></span>')
.css('display', 'block')
.parent()
.zoom({on:'grab'});
}

23488
previewers/js/pdf.js

File diff suppressed because it is too large

55433
previewers/js/pdf.worker.js

File diff suppressed because it is too large

122
previewers/js/pdfpreview.js

@ -0,0 +1,122 @@
var pdfDoc = null,
pageNum = 1,
pageRendering = false,
pageNumPending = null,
scale = 1.2,
canvas = null,
ctx = null;
$(document)
.ready(
function() {
canvas = document.getElementById('the-canvas');
ctx = canvas.getContext('2d');
document.getElementById('prev').addEventListener('click', onPrevPage);
document.getElementById('next').addEventListener('click', onNextPage);
startPreview(false);
});
function translateBaseHtmlPage() {
//PDF Previewer has prev, next, and Page text on it along with the previewer title
var pdfPreviewText = $.i18n( "pdfPreviewText" );
$( '.pdfPreviewText' ).text( pdfPreviewText );
var prev = $.i18n( "prev" );
$( '#prev' ).text( prev );
var next = $.i18n( "next" );
$( '#next' ).text( next );
var pageText = $.i18n( "pageText" );
$( '.pageText' ).text( pageText );
}
function writeContent(fileUrl, file, title, authors) {
addStandardPreviewHeader(file, title, authors);
// Loaded via <script> tag, create shortcut to access PDF.js exports.
var pdfjsLib = window['pdfjs-dist/build/pdf'];
// The workerSrc property shall be specified.
pdfjsLib.GlobalWorkerOptions.workerSrc = '/dataverse-previewers/previewers/js/pdf.worker.js';
/**
* Asynchronously downloads PDF.
*/
pdfjsLib.getDocument(fileUrl).promise.then(function(pdfDoc_) {
pdfDoc = pdfDoc_;
document.getElementById('page_count').textContent = pdfDoc.numPages;
// Initial/first page rendering
renderPage(pageNum);
});
}
/**
* Get page info from document, resize canvas accordingly, and render page.
* @param num Page number.
*/
function renderPage(num) {
pageRendering = true;
// Using promise to fetch the page
pdfDoc.getPage(num).then(function(page) {
var viewport = page.getViewport({scale: scale});
canvas.height = viewport.height;
canvas.width = viewport.width;
// Render PDF page into canvas context
var renderContext = {
canvasContext: ctx,
viewport: viewport
};
var renderTask = page.render(renderContext);
// Wait for rendering to finish
renderTask.promise.then(function() {
$('.lds-spinner').hide();
pageRendering = false;
if (pageNumPending !== null) {
// New page rendering is pending
renderPage(pageNumPending);
pageNumPending = null;
}
});
});
// Update page counters
document.getElementById('page_num').textContent = num;
}
/**
* If another page rendering in progress, waits until the rendering is
* finised. Otherwise, executes rendering immediately.
*/
function queueRenderPage(num) {
if (pageRendering) {
pageNumPending = num;
} else {
renderPage(num);
}
}
/**
* Displays previous page.
*/
function onPrevPage() {
if (pageNum <= 1) {
return;
}
pageNum--;
queueRenderPage(pageNum);
}
/**
* Displays next page.
*/
function onNextPage() {
if (pageNum >= pdfDoc.numPages) {
return;
}
pageNum++;
queueRenderPage(pageNum);
}

222
previewers/js/retriever.js

@ -0,0 +1,222 @@
var queryParams = null;
var datasetUrl = null;
var version = null;
var fileDownloadUrl = null;
var lrsUrl=null;
var previewMode = null;
var locale=null;
function startPreview(retrieveFile) {
// Retrieve tool launch parameters from URL
queryParams = new URLSearchParams(window.location.search.substring(1));
var fileUrl = queryParams.get("siteUrl") + "/api/access/datafile/"
+ queryParams.get("fileid") + "?gbrecs=true";
fileDownloadUrl = queryParams.get("siteUrl") + "/api/access/datafile/"
+ queryParams.get("fileid") + "?gbrecs=false";
lrsUrl="https://switchboard.clarin.eu/#/dataverse/"+encodeURIComponent(queryParams.get("siteUrl") + "/api/access/datafile/"
+ queryParams.get("fileid")+ "?gbrecs=false" )+"/"+cType+"/en";//"/text%2fplain/en";
var versionUrl = queryParams.get("siteUrl") + "/api/datasets/"
+ queryParams.get("datasetid") + "/versions/"
+ queryParams.get("datasetversion");
var apiKey = queryParams.get("key");
// Hide header and citation to embed on Dataverse file landing page.
previewMode = queryParams.get("preview");
locale = queryParams.get("locale");
if(locale== null) {
locale='en';
}
var i18n = $.i18n();
i18n.locale=locale;
i18n.load( 'i18n/' + i18n.locale + '.json', i18n.locale ).done(
function() {
//Call previewer-specific translation code
translateBaseHtmlPage();
}
);
if (apiKey != null) {
fileUrl = fileUrl + "&key=" + apiKey;
versionUrl = versionUrl + "?key=" + apiKey;
}
// Get metadata for dataset/version/file
$
.ajax({
dataType : "json",
url : versionUrl,
// headers: { 'X-Dataverse-key': apiKey },
crossite : true,
success : function(json, status) {
var mdFields = json.data.metadataBlocks.citation.fields;
var title = "";
var authors = "";
datasetUrl = json.data.storageIdentifier;
datasetUrl = datasetUrl
.substring(datasetUrl.indexOf("//") + 2);
version = queryParams.get("datasetversion");
if (version === ":draft") {
version = "DRAFT";
}
for ( var field in mdFields) {
if (mdFields[field].typeName === "title") {
title = mdFields[field].value;
}
if (mdFields[field].typeName === "author") {
var authorFields = mdFields[field].value;
for ( var author in authorFields) {
if (authors.length > 0) {
authors = authors + "; ";
}
authors = authors
+ authorFields[author].authorName.value;
}
}
}
var datafiles = json.data.files;
var fileIndex = 0;
for ( var entry in datafiles) {
if (JSON.stringify(datafiles[entry].dataFile.id) === queryParams
.get("fileid")) {
fileIndex = entry;
if (retrieveFile) {
$.ajax({
type : 'GET',
dataType : 'text',
// headers: { 'X-Dataverse-key': apiKey},
crosssite : true,
url : fileUrl,
success : function(data, status) {
writeContentAndData(data, fileUrl,
datafiles[fileIndex].dataFile,
title, authors);
},
error : function(request, status, error) {
reportFailure(
"Unable to retrieve file.",
status);
}
});
} else {
writeContent(fileUrl,
datafiles[entry].dataFile, title,
authors);
}
}
}
},
error : function(jqXHR, textStatus, errorThrown) {
//alert (jqXHR + " "+ errorThrown);
reportFailure("Unable to retrieve metadata: ", textStatus);
}
});
}
var filePageUrl = null;
function addStandardPreviewHeader(file, title, authors) {
if (previewMode !== 'true') {
// Add favicon from source Dataverse
$('head')
.append(
$('<link/>')
.attr('type', 'image/png')
.attr('rel', 'icon')
.attr(
'href',
queryParams.get("siteUrl")
+ '/javax.faces.resource/images/favicondataverse.png.xhtml'));
// Add logo from source Dataverse or use a local one, unless we are in preview mode
$('#logo')
.attr('src', queryParams.get("siteUrl") + '/logos/preview_logo.png')
.attr(
'onerror',
'this.onerror=null;this.src="/previewers/images/logo_placeholder.png";');
}
//Footer
var footer = $.i18n( "footer" );
$('body').append($('<div/>').html(footer).attr('id','footer'));
if (previewMode !== 'true') {
options = {"stripIgnoreTag":true, "stripIgnoreTagBody":['script','head']}; // Custom rules
//Translated text used in the preview header
var filenameText = $.i18n( "filenameText" );
var inText = $.i18n( "inText" );
var byText = $.i18n( "byText" );
var uploadedOnText = $.i18n("uploadedOnText");
var downloadFileText = $.i18n( "downloadFileText" );
var closePreviewText = $.i18n( "closePreviewText" );
var versionText = $.i18n( "versionText" );
var descriptionText = $.i18n( "descriptionText" );
var lrsText= $.i18n("LRSText");
filePageUrl = queryParams.get("siteUrl") + "/file.xhtml?";
if (file.persistentId.length == 0) {
filePageUrl = filePageUrl + "fileId=" + file.id;
} else {
filePageUrl = filePageUrl + "persistentId=" + file.persistentId;
}
filePageUrl = filePageUrl + "&version=" + version;
var header = $('.preview-header').append($('<div/>'));
header.append($("<div/>").append($("<span/>").text(filenameText)).append(
$('<a/>').attr('href', filePageUrl).text(file.filename)).attr('id',
'filename'));
if ((file.description != null) && (file.description.length > 0)) {
header.append($('<div/>').html(filterXSS("<span>" + descriptionText + "</span>" + file.description), options));
}
header.append($('<div/>').append($("<span/>").text(inText)).append(
$('<span/>').attr('id', 'dataset').append(
$('<a/>').attr(
'href',
queryParams.get("siteUrl")
+ "/dataset.xhtml?persistentId=doi:"
+ datasetUrl + "&version=" + version).text(
title))).append(
$('<span/>').html(" (<span>" + versionText + "</span> " + version + ")").attr('id', 'version')).append(
$('<span/>').text(byText)).append(
$('<span/>').text(authors).attr('id', 'authors')));
header.append($("<div/>").addClass("btn btn-default").html(
"<a href='" + fileDownloadUrl + "'>" + downloadFileText + "</a>"));
header.append($("<div/>").addClass("btn btn-default").html(
"<a href='" + lrsUrl + "'> <span class='glyphicon glyphicon-cog'></span> " + lrsText + "</a>"));//added
header.append($("<div/>").addClass("btn btn-default").html(
"<a href=\"javascript:window.close();\">" + closePreviewText + "</a>"));
if(file.creationDate != null) {
header.append($("<div/>").addClass("preview-note").text(
uploadedOnText + file.creationDate));
}
}
if (previewMode === 'true') {
$('#logo').hide();
$('.page-title').hide();
var lrsText= $.i18n("LRSText");
options = {"stripIgnoreTag":true, "stripIgnoreTagBody":['script','head']}; // Custom rules
//Translated text used in the preview header
//var header = $('.preview-header').append($('<div/>'));
var header = $('.preview-header');
header.append($("<div/>").addClass("btn btn-default").html(
"<a href='" + lrsUrl + "'><span class='glyphicon glyphicon-cog'></span> " + lrsText + "</a>"));
//<span class="glyphicon glyphicon-cog"></span>
//Cesare
//$('.preview-header').hide();
}
}
function reportFailure(msg, statusCode) {
var preview = $(".preview");
preview.addClass("alert alert-danger");
var errorText = $.i18n( "errorText" );
preview
.text(msg
+ errorText
+ statusCode);
}

213
previewers/js/retriever_buono.js

@ -0,0 +1,213 @@
var queryParams = null;
var datasetUrl = null;
var version = null;
var fileDownloadUrl = null;
var lrsUrl=null;
var previewMode = null;
var locale=null;
function startPreview(retrieveFile) {
// Retrieve tool launch parameters from URL
queryParams = new URLSearchParams(window.location.search.substring(1));
var fileUrl = queryParams.get("siteUrl") + "/api/access/datafile/"
+ queryParams.get("fileid") + "?gbrecs=true";
fileDownloadUrl = queryParams.get("siteUrl") + "/api/access/datafile/"
+ queryParams.get("fileid") + "?gbrecs=false";
lrsUrl="https://switchboard.clarin.eu/#/d4science/"+encodeURIComponent(queryParams.get("siteUrl") + "/api/access/datafile/"
+ queryParams.get("fileid")+ "?gbrecs=false" )+"/text%2fplain/en";
var versionUrl = queryParams.get("siteUrl") + "/api/datasets/"
+ queryParams.get("datasetid") + "/versions/"
+ queryParams.get("datasetversion");
var apiKey = queryParams.get("key");
// Hide header and citation to embed on Dataverse file landing page.
previewMode = queryParams.get("preview");
locale = queryParams.get("locale");
if(locale== null) {
locale='en';
}
var i18n = $.i18n();
i18n.locale=locale;
i18n.load( 'i18n/' + i18n.locale + '.json', i18n.locale ).done(
function() {
//Call previewer-specific translation code
translateBaseHtmlPage();
}
);
if (apiKey != null) {
fileUrl = fileUrl + "&key=" + apiKey;
versionUrl = versionUrl + "?key=" + apiKey;
}
// Get metadata for dataset/version/file
$
.ajax({
dataType : "json",
url : versionUrl,
// headers: { 'X-Dataverse-key': apiKey },
crossite : true,
success : function(json, status) {
var mdFields = json.data.metadataBlocks.citation.fields;
var title = "";
var authors = "";
datasetUrl = json.data.storageIdentifier;
datasetUrl = datasetUrl
.substring(datasetUrl.indexOf("//") + 2);
version = queryParams.get("datasetversion");
if (version === ":draft") {
version = "DRAFT";
}
for ( var field in mdFields) {
if (mdFields[field].typeName === "title") {
title = mdFields[field].value;
}
if (mdFields[field].typeName === "author") {
var authorFields = mdFields[field].value;
for ( var author in authorFields) {
if (authors.length > 0) {
authors = authors + "; ";
}
authors = authors
+ authorFields[author].authorName.value;
}
}
}
var datafiles = json.data.files;
var fileIndex = 0;
for ( var entry in datafiles) {
if (JSON.stringify(datafiles[entry].dataFile.id) === queryParams
.get("fileid")) {
fileIndex = entry;
if (retrieveFile) {
$.ajax({
type : 'GET',
dataType : 'text',
// headers: { 'X-Dataverse-key': apiKey},
crosssite : true,
url : fileUrl,
success : function(data, status) {
writeContentAndData(data, fileUrl,
datafiles[fileIndex].dataFile,
title, authors);
},
error : function(request, status, error) {
reportFailure(
"Unable to retrieve file.",
status);
}
});
} else {
writeContent(fileUrl,
datafiles[entry].dataFile, title,
authors);
}
}
}
},
error : function(jqXHR, textStatus, errorThrown) {
//alert (jqXHR + " "+ errorThrown);
reportFailure("Unable to retrieve metadata: ", textStatus);
}
});
}
var filePageUrl = null;
function addStandardPreviewHeader(file, title, authors) {
if (previewMode !== 'true') {
// Add favicon from source Dataverse
$('head')
.append(
$('<link/>')
.attr('type', 'image/png')
.attr('rel', 'icon')
.attr(
'href',
queryParams.get("siteUrl")
+ '/javax.faces.resource/images/favicondataverse.png.