From 3ca842cccb9ecaef81eb1123f3c5cc87943508c4 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Wed, 29 Sep 2010 14:23:51 +0200 Subject: [PATCH] better annotations dictionary --- redakcja/static/css/gallery.css | 21 +++++++++++++++- redakcja/static/js/wiki/view_annotations.js | 27 ++++++++++++--------- 2 files changed, 35 insertions(+), 13 deletions(-) diff --git a/redakcja/static/css/gallery.css b/redakcja/static/css/gallery.css index 12743214..6a9165e8 100644 --- a/redakcja/static/css/gallery.css +++ b/redakcja/static/css/gallery.css @@ -32,11 +32,30 @@ padding: 1em 1em 0 1em; } -#side-annotations p.akap { +#side-annotations .akap { font-size: 16px; font-family: "Georgia", "Times New Roman", serif; line-height: 1.5em; margin-bottom: 1em; + position: relative; +} + +#side-annotations .src { + font-family: monospace; + font-size: 10px; + font-weight: 400; + line-height: 13px; + position: absolute; + top: 0; + bottom: -.5em; + display:none; + background: white; + border: 1px solid #888; + width: 100%; +} + +#side-annotations .akap:hover .src { + display: block; } /* =========== */ diff --git a/redakcja/static/js/wiki/view_annotations.js b/redakcja/static/js/wiki/view_annotations.js index d51ce9c8..3ea3aa1e 100644 --- a/redakcja/static/js/wiki/view_annotations.js +++ b/redakcja/static/js/wiki/view_annotations.js @@ -68,20 +68,23 @@ for (var i=0; i]*>/g, "<$1akap>"); + xml_text = serializer.serializeToString(annos[i]).replace(/^]*>|<\/pe>$/g, ""); xml2html({ - xml: text, - success: function(elem){ - elem.txt = $(elem).text().trim(); - anno_list.push(elem); - counter--; - - if (!counter) { - anno_list.sort(function(a, b){return (a.txt < b.txt) ? -1 : (a.txt > b.txt ? 1 : 0)}); - self.$annos.append(anno_list); - self.$annos.show(); + xml: "" + xml_text + "", + success: function(xml_text){ + return function(elem){ + elem.sortby = $(elem).text().trim(); + $(elem).append("
"+ xml_text.replace("&", "&", "g").replace("<", "<", "g") +"
") + anno_list.push(elem); + counter--; + + if (!counter) { + anno_list.sort(function(a, b){return a.sortby.localeCompare(b.sortby);}); + self.$annos.append(anno_list); + self.$annos.show(); + } } - }, + }(xml_text), error: function(text) { $.unblockUI(); self.$error.html(text); -- 2.20.1