-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbookmarkletInstall.html
More file actions
33 lines (33 loc) · 3.04 KB
/
bookmarkletInstall.html
File metadata and controls
33 lines (33 loc) · 3.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<style>
body {
font-family: arial, helvetica, sans-serif;
margin-left:50px;
margin-right: 80px;
}
a#bookmark {
text-decoration: none;
font-size: 48px;
font-weigth: bold;
color: red;
background-color: yellow;
border: solid 2px red;
}
#footer {
text-align: right;
}
</style>
</head>
<body>
<h1>Analytics: add XML Save/Load button to advanced tab in Analytics</h1>
<p>Drag and drop the above link to your browser bookmark bar:</p>
<a id="bookmark" href="javascript:(function()%7Bif%20(!document.body.contains(document.getElementsByName('XmlText')%5B0%5D)%20%7C%7C%20document.body.contains(document.getElementById('bkLoadSaveXML')))%20return%3Bvar%20bkScrCode%3D%60function%20bkSaveXml(xmlbox)%20%7Bvar%20xmltext%20%3D%20xmlbox.value%3Bvar%20outfile%20%3D%20document.createElement('a')%3Bvar%20filename%20%3D%20document.getElementById('idHeaderTitleCell').innerText%3Boutfile.href%20%3D%20'data%3Atext%2Fxml%3Bcharset%3Dutf-8%2C'%20%2B%20encodeURIComponent(xmltext)%3Boutfile.download%20%3D%20filename%2B%22.xml%22%3Boutfile.click()%3B%7D%3Bfunction%20bkLoadXml(xmlbox)%20%7Bvar%20infile%20%3D%20document.createElement('input')%3Binfile.type%20%3D%20'file'%3Binfile.id%20%3D%20'xmlLoad'%3Binfile.accept%20%3D%20'text%2Fxml'%3Bdocument.body.appendChild(infile)%3Binfile.addEventListener('change'%2C%20function()%20%7Bconst%20newxml%20%3D%20new%20FileReader()%3Bnewxml.onload%20%3D%20function()%20%7Bxmlbox.value%20%3D%20newxml.result%3Bvar%20apply%20%3D%20confirm(%22New%20xml%20analysis%20loaded%3A%20press%20OK%20to%20apply%20it%22)%3Bif%20(apply)%20%7Bdocument.getElementById('advancedTabApplyXmlButton').click()%3Breturn%3B%7D%20else%20%7Breturn%3B%7D%7D%3Bnewxml.readAsText(this.files%5B0%5D)%3B%7D)%3Binfile.click()%3B%7D%3B%60%3Bif%20(!document.body.contains(document.getElementById('bk-script')))%20%7Bvar%20bkScript%20%3D%20document.createElement('script')%3BbkScript.id%20%3D%20%22bk-script%22%3BbkScript.type%20%20%3D%20%22text%2Fjavascript%22%3BbkScript.text%20%3D%20bkScrCode%3Bdocument.body.appendChild(bkScript)%3B%7D%3Bvar%20bkButtons%3D%60%3Cspan%20id%3D%22bkLoadSaveXML%22%20class%3D%22masterToolbarTextButton%20minibuttonOn%22%3E%3Cspan%20id%3D%22bkTitle%22%20onMouseOver%3D%22this.style.color%3D'%23000'%3B%22%3EAnalyticsLoadSave%20Bookmarklet%3A%20%3C%2Fspan%3E%3Ca%20id%3D%22bkSave%22%20onclick%3D%22var%20xmlbox%20%3D%20document.getElementsByName('XmlText')%5B0%5D%3B%20bkSaveXml(xmlbox)%3B%22%20href%3D%22javascript%3Avoid(null)%22%3ESave%20XML%3C%2Fa%3E%20%7C%20%3Ca%20id%3D%22bkLoad%22%20onclick%3D%22var%20xmlbox%20%3D%20document.getElementsByName('XmlText')%5B0%5D%3B%20bkLoadXml(xmlbox)%3B%22%20href%3D%22javascript%3Avoid(null)%22%3ELoad%20XML%3C%2Fa%3E%3C%2Fspan%3E%60%3Bvar%20xmlBtn%20%3D%20document.getElementById('advancedTabApplyXmlButton')%3BxmlBtn.insertAdjacentHTML('beforebegin'%2C%20bkButtons)%7D)()">AnalyticsXmlSaveLoad</a>
<p>Return to <a href="https://github.com/bediniupi/AnalyticsXmlSaveLoad/">README</a></p>
<div id="footer">
<p>2020 Nazzareno Bedini - Università di Pisa</p>
</div>
</body>
</html>