summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2009-04-16 20:46:49 +0200
committerdakkar <dakkar@thenautilus.net>2009-04-16 20:46:49 +0200
commitdb586f633f5f904bf39c2ae052011a3e5def1962 (patch)
tree669a889869bf15b846a050db9125978bb826dd68
downloadmy-foxmarks-db586f633f5f904bf39c2ae052011a3e5def1962.tar.gz
my-foxmarks-db586f633f5f904bf39c2ae052011a3e5def1962.tar.bz2
my-foxmarks-db586f633f5f904bf39c2ae052011a3e5def1962.zip
first version
-rw-r--r--folder-closed.pngbin0 -> 587 bytes
-rw-r--r--folder-item.pngbin0 -> 725 bytes
-rw-r--r--folder-open.pngbin0 -> 668 bytes
-rw-r--r--foxmarks.css39
-rw-r--r--my-foxmarks.js65
5 files changed, 104 insertions, 0 deletions
diff --git a/folder-closed.png b/folder-closed.png
new file mode 100644
index 0000000..de27140
--- /dev/null
+++ b/folder-closed.png
Binary files differ
diff --git a/folder-item.png b/folder-item.png
new file mode 100644
index 0000000..edfc325
--- /dev/null
+++ b/folder-item.png
Binary files differ
diff --git a/folder-open.png b/folder-open.png
new file mode 100644
index 0000000..2519d3f
--- /dev/null
+++ b/folder-open.png
Binary files differ
diff --git a/foxmarks.css b/foxmarks.css
new file mode 100644
index 0000000..9fd6cb3
--- /dev/null
+++ b/foxmarks.css
@@ -0,0 +1,39 @@
+ul {
+ border: none;
+ margin: 0;
+ padding: 0;
+ margin-left: 1em;
+}
+ul.collapsed {
+ display: none;
+}
+
+li {
+ list-style-type: none;
+ list-style-image: none;
+ list-style-position: inside;
+ margin: 0;
+ padding: 0;
+ border: none;
+}
+
+li.folder {
+ list-style-image: url(folder-open.png);
+}
+li.collapsed {
+ list-style-image: url(folder-closed.png);
+}
+
+li > p {
+ margin: 0;
+ padding: 0;
+ border: none;
+ display: inline;
+}
+
+li > a {
+ margin-left: 0.5em;
+}
+
+li > hr {
+} \ No newline at end of file
diff --git a/my-foxmarks.js b/my-foxmarks.js
new file mode 100644
index 0000000..1b085bd
--- /dev/null
+++ b/my-foxmarks.js
@@ -0,0 +1,65 @@
+function setup_foxmarks() {
+ $.getJSON("bookmarks.json",
+ create_html_display
+ );
+};
+
+var default_icon={'src':'folder-item.png'};
+
+var templates={
+ "separator": function() {
+ return [
+ 'li',{},['hr',{}]
+ ];
+ },
+ "folder" : function() {
+ if (this.args.pnid!=null) {
+ return [
+ 'li',{"class":"folder"},[
+ 'p',{"class":"folder-name"},this.args.name,
+ 'ul',{ "id":this.nid, "class":"folder" },''
+ ]
+ ];
+ }
+ else {
+ return [
+ 'h1',{},this.args.name,
+ 'ul',{ "id":this.nid },''
+ ];
+ }
+ },
+ "bookmark" : function() {
+ return [
+ 'li',{},[
+ 'img',(this.args.icon ? {"src": this.args.icon} : default_icon),[],
+ 'a',{"href":this.args.url},this.args.name
+ ]
+ ];
+ }
+};
+
+function create_html_display(marks) {
+ jQuery.each(marks["commands"],function() {
+ if (this.action == "insert" && this.nid != undefined) {
+ if (templates.hasOwnProperty(this.args.ntype)) {
+ var parent;
+ if (this.args.pnid!=null) {
+ parent=$("#"+this.args.pnid);
+ }
+ else {
+ parent=$("body");
+ }
+ //console.debug("applying template for %s to %o on %o",this.args.ntype,this,parent);
+ parent.tplAppend(this,templates[this.args.ntype]);
+ }
+ }
+ });
+ $('li.folder').children('p,ul').andSelf().addClass('collapsed');
+ $('li.folder').click(function(event){
+ event.preventDefault();
+ event.stopPropagation();
+ $(this).children('p,ul').andSelf().toggleClass('collapsed');
+ });
+};
+
+$(document).ready(setup_foxmarks);