Skip to content

Commit

Permalink
faster book, thanks Niphlod
Browse files Browse the repository at this point in the history
  • Loading branch information
mdipierro committed Sep 14, 2012
1 parent e592e03 commit 9527b07
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
13 changes: 8 additions & 5 deletions controllers/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))]
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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')
Expand Down
7 changes: 3 additions & 4 deletions views/default/chapter.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ <h4><a href="#" onclick="jQuery('ul.jquery-toc-1').slideToggle();return false;">
<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'});
Expand All @@ -72,7 +75,3 @@ <h4><a href="#" onclick="jQuery('ul.jquery-toc-1').slideToggle();return false;">
<div class="article">
{{=content}}
</div>




0 comments on commit 9527b07

Please sign in to comment.