[py-svn] r35393 - in py/dist/py/apigen: . rest
guido at codespeak.net
guido at codespeak.net
Wed Dec 6 14:32:23 CET 2006
Author: guido
Date: Wed Dec 6 14:32:22 2006
New Revision: 35393
Modified:
py/dist/py/apigen/apigen.js
py/dist/py/apigen/rest/htmlhandlers.py
Log:
Added small hack to allow bookmarking individual pages (using # in urls).
Modified: py/dist/py/apigen/apigen.js
==============================================================================
--- py/dist/py/apigen/apigen.js (original)
+++ py/dist/py/apigen/apigen.js Wed Dec 6 14:32:22 2006
@@ -26,3 +26,25 @@
};
};
};
+
+function set_location(el) {
+ var currloc = document.location.toString();
+ var url = currloc;
+ if (currloc.indexOf('#') > -1) {
+ var chunks = currloc.split('#');
+ url = chunks[0];
+ };
+ document.location = url + '#' + escape(el.getAttribute('href'));
+};
+
+function loadloc() {
+ /* load iframe content using # part of the url */
+ var loc = document.location.toString();
+ if (loc.indexOf('#') == -1) {
+ return;
+ };
+ var chunks = loc.split('#');
+ var anchor = chunks[chunks.length - 1];
+ var iframe = document.getElementsByTagName('iframe')[0];
+ iframe.src = anchor;
+};
Modified: py/dist/py/apigen/rest/htmlhandlers.py
==============================================================================
--- py/dist/py/apigen/rest/htmlhandlers.py (original)
+++ py/dist/py/apigen/rest/htmlhandlers.py Wed Dec 6 14:32:22 2006
@@ -10,7 +10,8 @@
def handleLink(self, text, target):
self.tagstack[-1].append(html.a(text, href=target,
- onclick='parent.set_breadcrumb(this)',
+ onclick=('parent.set_breadcrumb(this);'
+ 'parent.set_location(this);'),
target='content'))
@@ -21,7 +22,8 @@
super(IndexHandler, self).startDocument()
self.head.append(html.script(type='text/javascript', src='apigen.js'))
self.body.attr.onload = ('set_breadcrumb('
- 'document.getElementsByTagName("a")[0])')
+ 'document.getElementsByTagName("a")[0]);'
+ 'loadloc();')
self._push(html.div(id='sidebar'))
def endDocument(self):
More information about the py-svn
mailing list