Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

faster book, thanks Niphlod

  • Loading branch information...
commit 9527b07fda08b080ca4bdb73465164a4fcfcd5d6 1 parent e592e03
@mdipierro authored
Showing with 11 additions and 9 deletions.
  1. +8 −5 controllers/default.py
  2. +3 −4 views/default/chapter.html
View
13 controllers/default.py
@@ -11,7 +11,7 @@ def splitter(x):
return a.strip(),b.strip()
@cache('folders',None)
-def get_folders():
+def get_folders(dummy=None):
folder = os.path.join(request.folder,'sources')
return folder, [f for f in os.listdir(folder)
if os.path.isdir(os.path.join(folder,f))]
@@ -42,7 +42,7 @@ def get_chapters(subfolder):
return chapters
@cache('menu',None)
-def build_menu():
+def build_menu(dummy=None):
menu = []
submenu = []
for subfolder in FOLDERS:
@@ -78,9 +78,12 @@ def index():
return locals()
def calc_date(now=request.utcnow.date()):
- TOMORROW = now + datetime.timedelta(days=1)
- format = '%a, %d %b %Y %H:%M:%S GMT'
- return TOMORROW.strftime(format)
+ # if you are changing sources often remove the
+ # comment from the next 2 lines
+ # import datetime
+ # now = now + datetime.timedelta(days=1)
+ format = '%a, %d %b %Y 23:59:59 GMT'
+ return now.strftime(format)
def chapter():
book_id, chapter_id = request.args(0), request.args(1,cast=int,default='0')
View
7 views/default/chapter.html
@@ -61,6 +61,9 @@
<script>
jQuery(document).ready(function(){
jQuery.toc('.article h1, .article h2, .article h3, .article h4').prependTo('.article');
+ if (location.hash) setTimeout(function(){
+ jQuery(document).scrollTo('a[name=' + location.hash.replace('#', '') + ']',2000, {axis:'y'});
+ }, 1000);
{{if request.vars.search:}}
jQuery('.article').highlight('{{=request.vars.search}}');
jQuery(document).scrollTo('.highlight',2000, {axis:'y'});
@@ -72,7 +75,3 @@
<div class="article">
{{=content}}
</div>
-
-
-
-
Please sign in to comment.
Something went wrong with that request. Please try again.