mirror of
https://github.com/ivabus/www
synced 2024-11-26 05:45:06 +03:00
fix: language selection on whitepaper page
This commit is contained in:
parent
79058110bb
commit
280d3e5bb0
1 changed files with 61 additions and 31 deletions
|
@ -42,21 +42,6 @@
|
|||
<div id="adobe-dc-view" style="width: 100%;"></div>
|
||||
<script src="https://documentservices.adobe.com/view-sdk/viewer.js"></script>
|
||||
<script type="text/javascript">
|
||||
document.addEventListener("adobe_dc_view_sdk.ready", function(){
|
||||
//Must change clientId before final merge
|
||||
var adobeDCView = new AdobeDC.View({clientId: "fc933927b4e947c2aaf9a7b33b26f0b4", divId: "adobe-dc-view"});
|
||||
adobeDCView.previewFile({
|
||||
content:{location: {url: "https://tea.xyz/tea.white-paper.pdf"}},
|
||||
metaData:{fileName: "tea.white-paper.pdf"}
|
||||
}, {embedMode: "IN_LINE"});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<script>
|
||||
const versions = [
|
||||
['English', ''],
|
||||
['Bahasa Indonesia', '_id'],
|
||||
|
@ -68,19 +53,64 @@
|
|||
['官话', '_zh']
|
||||
];
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
for (const lang of versions) {
|
||||
let adobeDcView;
|
||||
|
||||
$('#language-selector').append("<li><a class=\"dropdown-item\" onclick=\"go(\'" + lang[1] + "')\">" + lang[0] + "</a></li>");
|
||||
const getAdobeDcView = () => {
|
||||
if (!adobeDcView) {
|
||||
adobeDCView = new AdobeDC.View({
|
||||
clientId: "fc933927b4e947c2aaf9a7b33b26f0b4",
|
||||
divId: "adobe-dc-view"
|
||||
});
|
||||
}
|
||||
return adobeDCView;
|
||||
}
|
||||
}, false);
|
||||
|
||||
function go(suffix) {
|
||||
const url = 'https://tea.xyz/tea.white-paper' + suffix + '.pdf';
|
||||
document.getElementById('wp-iframe').setAttribute('src', url + '#toolbar=0&navpanes=0&view=fitH');
|
||||
document.getElementById('mobile-wp-download').setAttribute('href', url);
|
||||
const getWhitePaperUrl = (suffix = '') => {
|
||||
return 'https://tea.xyz/tea.white-paper' + suffix + '.pdf';
|
||||
}
|
||||
|
||||
document.addEventListener("adobe_dc_view_sdk.ready", function(){
|
||||
//Must change clientId before final merge
|
||||
try {
|
||||
for (const lang of versions) {
|
||||
$('#language-selector').append("<li><a class=\"dropdown-item\" onclick=\"viewWhitepaper(\'" + lang[1] + "')\">" + lang[0] + "</a></li>");
|
||||
}
|
||||
const adobeDCView = getAdobeDcView();
|
||||
|
||||
adobeDCView.previewFile({
|
||||
content:{
|
||||
location: {
|
||||
url: getWhitePaperUrl(),
|
||||
}
|
||||
},
|
||||
metaData:{
|
||||
fileName: "tea.white-paper.pdf"
|
||||
}
|
||||
}, { embedMode: "IN_LINE" });
|
||||
} catch (error) {
|
||||
console.error('test:', error);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
function viewWhitepaper(suffix) {
|
||||
const adobeDCView = getAdobeDcView();
|
||||
const url = getWhitePaperUrl(suffix);
|
||||
adobeDCView.previewFile({
|
||||
content:{
|
||||
location: { url }
|
||||
},
|
||||
metaData:{
|
||||
fileName: "tea.white-paper.pdf"
|
||||
}
|
||||
}, { embedMode: "IN_LINE" });
|
||||
// document.getElementById('mobile-wp-download').setAttribute('href', url);
|
||||
}
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Start PDF
|
||||
|
||||
|
|
Loading…
Reference in a new issue