This commit is contained in:
Kovid Goyal 2018-09-27 09:46:21 +05:30
parent 8234dc5436
commit c4295355a2
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

19
src/pyj/viewer/router.pyj Normal file
View File

@ -0,0 +1,19 @@
# vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2018, Kovid Goyal <kovid at kovidgoyal.net>
from __python__ import bound_methods, hash_literals
from modals import close_all_modals
from utils import parse_url_params
def get_current_query(newval):
if newval:
get_current_query.ans = newval
return get_current_query.ans or {}
def apply_url():
close_all_modals() # needed to close any error dialogs, etc when clicking back or forward in the browser or using push_state() to go to a new page
data = parse_url_params()
data.mode = data.mode or 'read_book'
get_current_query.ans = data