changeset 2442:02652fe03cd4

Display a link to original image on image pages
author Radomir Dopieralski <sheep-devel@sheep.art.pl>
date Sun, 17 Nov 2013 01:09:52 +0100
parents 099eb9ba2924
children ea61d1d55c54
files hatta/page.py hatta/static/scripts.js
diffstat 2 files changed, 17 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hatta/page.py	Mon Nov 11 22:54:00 2013 +0100
+++ b/hatta/page.py	Sun Nov 17 01:09:52 2013 +0100
@@ -579,8 +579,9 @@
     def view_content(self, lines=None):
         if self.title not in self.storage:
             raise hatta.error.NotFoundErr()
-        content = ['<img src="%s" alt="%s">'
-                   % (self.request.get_url(self.title, 'render'),
+        content = ['<a href="%s"><img src="%s" alt="%s"></a>'
+                   % (self.request.get_url(self.title, 'download'),
+                      self.request.get_url(self.title, 'render'),
                       werkzeug.escape(self.title))]
         return content
 
--- a/hatta/static/scripts.js	Mon Nov 11 22:54:00 2013 +0100
+++ b/hatta/static/scripts.js	Sun Nov 17 01:09:52 2013 +0100
@@ -141,6 +141,20 @@
         });
     };
 
+    hatta.toc = function () {
+        var tags = [];
+        hatta._foreach_tag(['h1', 'h2', 'h3', 'h4', 'h5', 'h6'], function (tag) {
+            if (tag.getAttribute('id')) {
+                tags.push(tag);
+            }
+        });
+        tags.sort(function (a, b) {
+            /* Sort according to line numbers from id="line_X" attributes. */
+            return a.getAttribute('id').slice(5) - b.getAttribute('id').slice(5);
+        });
+        console.log(tags);
+    };
+
     return hatta;
 }();