Last active
February 8, 2019 18:09
-
-
Save cybernar/4175b0124a2feea81b81e85269a58d09 to your computer and use it in GitHub Desktop.
Display Firefox bookmarks (after exporting them to json)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="fr"> | |
<head> | |
<meta charset="utf-8" /> | |
<!-- | |
<link rel="stylesheet" href="design.css" /> | |
<script src="script.js"></script> | |
--> | |
<script src="bookmarks-2019-02-08.js"></script> | |
<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Roboto"> | |
<style type="text/css"> | |
body { | |
font-family: 'Roboto', monospace; | |
} | |
.comment{ | |
width: 400px; | |
height: 100px; | |
background: white; | |
border: 1px solid black; | |
border-radius: 30px; | |
padding: 30px; | |
font-family: 'Roboto Mono', monospace; | |
} | |
</style> | |
</head> | |
<body> | |
<h1>GIS DATA</h1> | |
<script type="text/javascript"> | |
var parcours_bookmarks = function parcours(node, func) { | |
func(node); | |
if (node.type && node.type==='text/x-moz-place-container') { | |
var nodes = node.children || []; | |
for (var i = 0, nch = nodes.length; i < nch; i++) { | |
//node = nodes[i]; | |
parcours(nodes[i], func); | |
} | |
} | |
}; | |
var gis_bookmarks = function gis_walk(node) { | |
if (node.type && node.type==='text/x-moz-place-container') { | |
var annos = node.annos || []; | |
var nodes = node.children || []; | |
var titre = node.title || ''; | |
var tags = node.tags || ''; | |
document.writeln('<h2>' + titre + '</h2>'); | |
for (var j = 0, nann = annos.length; j < nann; j++) { | |
var anno = annos[j]; | |
if (anno.name && anno.name === 'bookmarkProperties/description') { | |
document.writeln('<p>' + anno.value + '</p>'); | |
} | |
} | |
for (var i = 0, nch = nodes.length; i < nch; i++) { | |
//node = nodes[i]; | |
gis_walk(nodes[i]); | |
} | |
} | |
if (node.type && node.type==='text/x-moz-place') { | |
var annos = node.annos || []; | |
var titre = node.title || ''; | |
var tags = node.tags || ''; | |
//document.writeln('<div id="' + node.id + '" class="gis_link">'); | |
document.writeln('<h3>' + titre + '</h3>'); | |
for (var j = 0, nann = annos.length; j < nann; j++) { | |
var anno = annos[j]; | |
if (anno.name && anno.name === 'bookmarkProperties/description') { | |
document.writeln('<p>' + anno.value + '</p>'); | |
} | |
} | |
document.writeln('<p><a href="' + node.uri + '">' + node.uri + '</a></p>'); | |
var arrayOfTags = tags.split(','); | |
if (arrayOfTags.length > 0) { | |
document.write('<p>Tags : '); | |
for (var k=0; k < arrayOfTags.length; k++) { | |
document.write('<code>`' + arrayOfTags[k] + "`</code> "); | |
} | |
document.writeln('</p>'); | |
} | |
//document.writeln('</div>'); | |
} | |
}; | |
var result = null; | |
parcours_bookmarks(bookmarks, function (node) { | |
// document.writeln('<p>- guid = ' + node.guid + '/'+ node.title + ' -</p>'); | |
if (node.title && node.title === 'SIG DATA') { | |
result = node; | |
} | |
}); | |
// document.writeln('<p>result guid = ' + result.guid + '</p>'); | |
if (result) { | |
gis_bookmarks(result); | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment