Skip to content

Instantly share code, notes, and snippets.

@TomasKulhanek
Created May 16, 2019 14:30
Show Gist options
  • Save TomasKulhanek/cb49e76430b7df4bf6ef5f5561da2dab to your computer and use it in GitHub Desktop.
Save TomasKulhanek/cb49e76430b7df4bf6ef5f5561da2dab to your computer and use it in GitHub Desktop.
B2NOTE demo widgets
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>B2NOTE demo widget</title>
<script src="index.js"></script>
</head>
<body>
<div id="b2note" style="float:right;width:30%">
<iframe id="b2note_iframe" name="b2note_iframe" src="" style="width: 100%; height: 600px; border: 1px solid grey;"></iframe>
</div>
test b2note widget as iframe
<form id="b2note_form_" action="https://b2note.bsc.es/interface_main.html" method="post" target="b2note_iframe" onSubmit='togglewidgeton()'>
<input type="hidden" name="recordurl_tofeed" value='https%3A%2F%2Ftrng-b2share.eudat.eu%2Frecords%2F3894dfbf97a44e04814fb986f56c87ce' className="field left" readOnly="readonly"/>
<input type="hidden" name="pid_tofeed" value='http%3A%2F%2Fhdl.handle.net%2F0000%2F3894dfbf97a44e04814fb986f56c87ce' className="field left" readOnly="readonly"/>
<input type="hidden" name="subject_tofeed" value='https%3A%2F%2Ftrng-b2share.eudat.eu%2Fapi%2Ffiles%2Ff2b09dd8-a524-49e4-a7d3-100d830895b7%2FtestFile.txt' className="field left" readOnly="readonly"/>
<input type="hidden" name="keywords_tofeed" value='' className="field left" readOnly="readonly"/>
<input type="submit" className="btn btn-sm btn-default" value="Annotate in B2Note" title="Click to annotate file using B2Note."/>
</form>
test b2note as popup window
<form id="b2note_form3" action="https://b2note.bsc.es/interface_main.html" method="post" target="b2notewin" onSubmit='popupwindow()'>
<input type="hidden" name="recordurl_tofeed" value='https%3A%2F%2Ftrng-b2share.eudat.eu%2Frecords%2F3894dfbf97a44e04814fb986f56c87ce' className="field left" readOnly="readonly"/>
<input type="hidden" name="pid_tofeed" value='http%3A%2F%2Fhdl.handle.net%2F0000%2F3894dfbf97a44e04814fb986f56c87ce' className="field left" readOnly="readonly"/>
<input type="hidden" name="subject_tofeed" value='https%3A%2F%2Ftrng-b2share.eudat.eu%2Fapi%2Ffiles%2Ff2b09dd8-a524-49e4-a7d3-100d830895b7%2FtestFile.txt' className="field left" readOnly="readonly"/>
<input type="hidden" name="keywords_tofeed" value='' className="field left" readOnly="readonly"/>
<input type="submit" className="btn btn-sm btn-default" value="Annotate in popup B2Note" title="Click to annotate file using B2Note."/>
</form>
</body>
</html>
function togglewidgeton() {
let b2noteDIVDOM = document.getElementById('b2note');
let display = b2noteDIVDOM.style.display;
if (display === 'none') {
display = 'block';
//document.getElementById("b2note_iframe").innerHTML = '<b>posting request, loading ... </b>';
//postb2noterequest();
}
//else display = 'none';
console.log('toggling widget:', display);
b2noteDIVDOM.style.display = display;
}
function popupwindow(){
var mapForm = document.getElementById("b2note_form3");
map=window.open("","b2notewin","status=0,title=0,height=600,width=300,scrollbars=1,menubar=0,status=0");
if (map) {
mapForm.submit();
} else {
alert('You must allow popups for this map to work.');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment