better annotations dictionary
authorRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Wed, 29 Sep 2010 12:23:51 +0000 (14:23 +0200)
committerRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Wed, 29 Sep 2010 12:23:51 +0000 (14:23 +0200)
redakcja/static/css/gallery.css
redakcja/static/js/wiki/view_annotations.js

index 1274321..6a9165e 100644 (file)
     padding: 1em 1em 0 1em;
 }
 
     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;
     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;
 }
 
 /* =========== */
 }
 
 /* =========== */
index d51ce9c..3ea3aa1 100644 (file)
 
             for (var i=0; i<annos.length; i++)
             {
 
             for (var i=0; i<annos.length; i++)
             {
-                text = serializer.serializeToString(annos[i]).replace(/<(\/?)pe[^>]*>/g, "<$1akap>");
+                xml_text = serializer.serializeToString(annos[i]).replace(/^<pe[^>]*>|<\/pe>$/g, "");
                 xml2html({
                 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: "<akap>" + xml_text + "</akap>",
+                    success: function(xml_text){
+                        return function(elem){
+                            elem.sortby = $(elem).text().trim();
+                            $(elem).append("<div class='src'>"+ xml_text.replace("&", "&amp;", "g").replace("<", "&lt;", "g") +"</div>")
+                            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);
                     error: function(text) {
                         $.unblockUI();
                         self.$error.html(text);