"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "resources/viewer.js" between
calibre-4.2.0.tar.xz and calibre-4.3.0.tar.xz

About: calibre is an e-book library management application (syncing, converting, viewing,\PKG_DESCR_TTnbsp;...).

viewer.js  (calibre-4.2.0.tar.xz):viewer.js  (calibre-4.3.0.tar.xz)
skipping to change at line 4987 skipping to change at line 4987
if (path[0] !== "/") { if (path[0] !== "/") {
slash = ((ρσ_expr_temp = window.location.pathname)[ρσ_expr_temp. length-1] === "/") ? "" : "/"; slash = ((ρσ_expr_temp = window.location.pathname)[ρσ_expr_temp. length-1] === "/") ? "" : "/";
path = window.location.pathname + slash + path; path = window.location.pathname + slash + path;
} }
return path; return path;
}; };
if (!absolute_path.__argnames__) Object.defineProperties(absolute_path, { if (!absolute_path.__argnames__) Object.defineProperties(absolute_path, {
__argnames__ : {value: ["path"]} __argnames__ : {value: ["path"]}
}); });
function workaround_qt_bug() {
var xhr = ( 0 === arguments.length-1 && arguments[arguments.length-1
] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arg
uments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[0];
var end_type = ( 1 === arguments.length-1 && arguments[arguments.len
gth-1] !== null && typeof arguments[arguments.length-1] === "object" && argument
s[arguments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[1];
var ok_code = (arguments[2] === undefined || ( 2 === arguments.lengt
h-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.leng
th-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)
) ? workaround_qt_bug.__defaults__.ok_code : arguments[2];
var ρσ_kwargs_obj = arguments[arguments.length-1];
if (ρσ_kwargs_obj === null || typeof ρσ_kwargs_obj !== "object" || ρ
σ_kwargs_obj [ρσ_kwargs_symbol] !== true) ρσ_kwargs_obj = {};
if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "ok_code")){
ok_code = ρσ_kwargs_obj.ok_code;
}
if (end_type === "error" && xhr.status === ok_code && window.navigat
or.userAgent.indexOf("calibre-viewer") === 0) {
end_type = "load";
}
return end_type;
};
if (!workaround_qt_bug.__defaults__) Object.defineProperties(workaround_
qt_bug, {
__defaults__ : {value: {ok_code:200}},
__handles_kwarg_interpolation__ : {value: true},
__argnames__ : {value: ["xhr", "end_type", "ok_code"]}
});
function ajax() { function ajax() {
var path = ( 0 === arguments.length-1 && arguments[arguments.length- 1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[ar guments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[0]; var path = ( 0 === arguments.length-1 && arguments[arguments.length- 1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[ar guments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[0];
var on_complete = ( 1 === arguments.length-1 && arguments[arguments. length-1] !== null && typeof arguments[arguments.length-1] === "object" && argum ents[arguments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[1] ; var on_complete = ( 1 === arguments.length-1 && arguments[arguments. length-1] !== null && typeof arguments[arguments.length-1] === "object" && argum ents[arguments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[1] ;
var on_progress = (arguments[2] === undefined || ( 2 === arguments.l ength-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments. length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === t rue)) ? ajax.__defaults__.on_progress : arguments[2]; var on_progress = (arguments[2] === undefined || ( 2 === arguments.l ength-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments. length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === t rue)) ? ajax.__defaults__.on_progress : arguments[2];
var bypass_cache = (arguments[3] === undefined || ( 3 === arguments. length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments .length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? ajax.__defaults__.bypass_cache : arguments[3]; var bypass_cache = (arguments[3] === undefined || ( 3 === arguments. length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments .length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? ajax.__defaults__.bypass_cache : arguments[3];
var method = (arguments[4] === undefined || ( 4 === arguments.length -1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.lengt h-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? ajax.__defaults__.method : arguments[4]; var method = (arguments[4] === undefined || ( 4 === arguments.length -1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.lengt h-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? ajax.__defaults__.method : arguments[4];
var query = (arguments[5] === undefined || ( 5 === arguments.length- 1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length -1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? ajax.__defaults__.query : arguments[5]; var query = (arguments[5] === undefined || ( 5 === arguments.length- 1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length -1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? ajax.__defaults__.query : arguments[5];
var timeout = (arguments[6] === undefined || ( 6 === arguments.lengt h-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.leng th-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ) ? ajax.__defaults__.timeout : arguments[6]; var timeout = (arguments[6] === undefined || ( 6 === arguments.lengt h-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.leng th-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ) ? ajax.__defaults__.timeout : arguments[6];
var ok_code = (arguments[7] === undefined || ( 7 === arguments.lengt h-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.leng th-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ) ? ajax.__defaults__.ok_code : arguments[7]; var ok_code = (arguments[7] === undefined || ( 7 === arguments.lengt h-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.leng th-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ) ? ajax.__defaults__.ok_code : arguments[7];
var progress_totals_needed = (arguments[8] === undefined || ( 8 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments [arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_sy mbol] === true)) ? ajax.__defaults__.progress_totals_needed : arguments[8]; var progress_totals_needed = (arguments[8] === undefined || ( 8 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments [arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_sy mbol] === true)) ? ajax.__defaults__.progress_totals_needed : arguments[8];
skipping to change at line 5051 skipping to change at line 5071
xhr.error_html = str.format(_("Failed to communicate with \" {}\", aborted"), xhr.request_path); xhr.error_html = str.format(_("Failed to communicate with \" {}\", aborted"), xhr.request_path);
} else { } else {
try { try {
rtext = xhr.responseText || ""; rtext = xhr.responseText || "";
} catch (ρσ_Exception) { } catch (ρσ_Exception) {
ρσ_last_exception = ρσ_Exception; ρσ_last_exception = ρσ_Exception;
{ {
rtext = ""; rtext = "";
} }
} }
xhr.error_html = str.format(_("Failed to communicate with \" {}\", with status: [{}] {}<br><br>{}"), xhr.request_path, xhr.status, xhr.status Text, rtext.slice(0, 200)); xhr.error_html = str.format(_("Failed to communicate with \" {}\", with status: [{} ({})] {}<br><br>{}"), xhr.request_path, xhr.status, event , xhr.statusText, rtext.slice(0, 200));
} }
}; };
if (!set_error.__argnames__) Object.defineProperties(set_error, { if (!set_error.__argnames__) Object.defineProperties(set_error, {
__argnames__ : {value: ["event", "is_network_error"]} __argnames__ : {value: ["event", "is_network_error"]}
}); });
function progress_callback(ev) { function progress_callback(ev) {
var ul; var ul;
if (ev.lengthComputable) { if (ev.lengthComputable) {
on_progress(ev.loaded, ev.total, xhr); on_progress(ev.loaded, ev.total, xhr);
skipping to change at line 5093 skipping to change at line 5113
if (!progress_callback.__argnames__) Object.defineProperties(progres s_callback, { if (!progress_callback.__argnames__) Object.defineProperties(progres s_callback, {
__argnames__ : {value: ["ev"]} __argnames__ : {value: ["ev"]}
}); });
function complete_callback(end_type, ev) { function complete_callback(end_type, ev) {
var is_network_error; var is_network_error;
is_network_error = (end_type === "error") ? ev : false; is_network_error = (end_type === "error") ? ev : false;
if (xhr.status !== ok_code && end_type === "load") { if (xhr.status !== ok_code && end_type === "load") {
end_type = "error"; end_type = "error";
} }
end_type = workaround_qt_bug(xhr, end_type, ok_code);
if (end_type !== "load") { if (end_type !== "load") {
set_error(end_type, is_network_error); set_error(end_type, is_network_error);
} }
on_complete(end_type, xhr, ev); on_complete(end_type, xhr, ev);
}; };
if (!complete_callback.__argnames__) Object.defineProperties(complet e_callback, { if (!complete_callback.__argnames__) Object.defineProperties(complet e_callback, {
__argnames__ : {value: ["end_type", "ev"]} __argnames__ : {value: ["end_type", "ev"]}
}); });
if (on_progress) { if (on_progress) {
skipping to change at line 5233 skipping to change at line 5254
}; };
if (!console_print.__handles_kwarg_interpolation__) Object.definePropert ies(console_print, { if (!console_print.__handles_kwarg_interpolation__) Object.definePropert ies(console_print, {
__handles_kwarg_interpolation__ : {value: true} __handles_kwarg_interpolation__ : {value: true}
}); });
ρσ_modules.ajax.default_timeout = default_timeout; ρσ_modules.ajax.default_timeout = default_timeout;
ρσ_modules.ajax.set_default_timeout = set_default_timeout; ρσ_modules.ajax.set_default_timeout = set_default_timeout;
ρσ_modules.ajax.encode_query_component = encode_query_component; ρσ_modules.ajax.encode_query_component = encode_query_component;
ρσ_modules.ajax.encode_query = encode_query; ρσ_modules.ajax.encode_query = encode_query;
ρσ_modules.ajax.absolute_path = absolute_path; ρσ_modules.ajax.absolute_path = absolute_path;
ρσ_modules.ajax.workaround_qt_bug = workaround_qt_bug;
ρσ_modules.ajax.ajax = ajax; ρσ_modules.ajax.ajax = ajax;
ρσ_modules.ajax.ajax_send = ajax_send; ρσ_modules.ajax.ajax_send = ajax_send;
ρσ_modules.ajax.ajax_send_file = ajax_send_file; ρσ_modules.ajax.ajax_send_file = ajax_send_file;
ρσ_modules.ajax.console_print = console_print; ρσ_modules.ajax.console_print = console_print;
})(); })();
(function(){ (function(){
var __name__ = "book_list"; var __name__ = "book_list";
})(); })();
skipping to change at line 5809 skipping to change at line 5831
ρσ_d["columns_per_screen"] = (function(){ ρσ_d["columns_per_screen"] = (function(){
var ρσ_d = Object.create(null); var ρσ_d = Object.create(null);
ρσ_d["portrait"] = 0; ρσ_d["portrait"] = 0;
ρσ_d["landscape"] = 0; ρσ_d["landscape"] = 0;
return ρσ_d; return ρσ_d;
}).call(this); }).call(this);
ρσ_d["user_stylesheet"] = ""; ρσ_d["user_stylesheet"] = "";
ρσ_d["background_image"] = null; ρσ_d["background_image"] = null;
ρσ_d["background_image_style"] = "scaled"; ρσ_d["background_image_style"] = "scaled";
ρσ_d["background_image_fade"] = 0; ρσ_d["background_image_fade"] = 0;
ρσ_d["current_color_scheme"] = "white"; ρσ_d["current_color_scheme"] = "system";
ρσ_d["user_color_schemes"] = Object.create(null); ρσ_d["user_color_schemes"] = Object.create(null);
ρσ_d["base_font_size"] = 16; ρσ_d["base_font_size"] = 16;
ρσ_d["controls_help_shown_count"] = 0; ρσ_d["controls_help_shown_count"] = 0;
ρσ_d["header"] = Object.create(null); ρσ_d["header"] = Object.create(null);
ρσ_d["footer"] = (function(){ ρσ_d["footer"] = (function(){
var ρσ_d = Object.create(null); var ρσ_d = Object.create(null);
ρσ_d["right"] = "progress"; ρσ_d["right"] = "progress";
return ρσ_d; return ρσ_d;
}).call(this); }).call(this);
ρσ_d["word_actions"] = []; ρσ_d["word_actions"] = [];
skipping to change at line 11526 skipping to change at line 11548
function set_toc_anchor_map(val) { function set_toc_anchor_map(val) {
toc_anchor_map.value = val; toc_anchor_map.value = val;
}; };
if (!set_toc_anchor_map.__argnames__) Object.defineProperties(set_toc_an chor_map, { if (!set_toc_anchor_map.__argnames__) Object.defineProperties(set_toc_an chor_map, {
__argnames__ : {value: ["val"]} __argnames__ : {value: ["val"]}
}); });
default_color_schemes = (function(){ default_color_schemes = (function(){
var ρσ_d = Object.create(null); var ρσ_d = Object.create(null);
ρσ_d["system"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["foreground"] = "#000000";
ρσ_d["background"] = "#ffffff";
ρσ_d["name"] = _("System");
return ρσ_d;
}).call(this);
ρσ_d["white"] = (function(){ ρσ_d["white"] = (function(){
var ρσ_d = Object.create(null); var ρσ_d = Object.create(null);
ρσ_d["foreground"] = "#000000"; ρσ_d["foreground"] = "#000000";
ρσ_d["background"] = "#ffffff"; ρσ_d["background"] = "#ffffff";
ρσ_d["name"] = _("White"); ρσ_d["name"] = _("White");
return ρσ_d; return ρσ_d;
}).call(this); }).call(this);
ρσ_d["black"] = (function(){ ρσ_d["black"] = (function(){
var ρσ_d = Object.create(null); var ρσ_d = Object.create(null);
ρσ_d["foreground"] = "#ffffff"; ρσ_d["foreground"] = "#ffffff";
skipping to change at line 11558 skipping to change at line 11587
ρσ_d["sepia-dark"] = (function(){ ρσ_d["sepia-dark"] = (function(){
var ρσ_d = Object.create(null); var ρσ_d = Object.create(null);
ρσ_d["background"] = "#39322B"; ρσ_d["background"] = "#39322B";
ρσ_d["foreground"] = "#F6F3E9"; ρσ_d["foreground"] = "#F6F3E9";
ρσ_d["link"] = "#4f81bd"; ρσ_d["link"] = "#4f81bd";
ρσ_d["name"] = _("Sepia dark"); ρσ_d["name"] = _("Sepia dark");
return ρσ_d; return ρσ_d;
}).call(this); }).call(this);
return ρσ_d; return ρσ_d;
}).call(this); }).call(this);
function set_system_colors(spec) {
var c;
c = default_color_schemes.system;
c.foreground = spec.foreground;
c.background = spec.background;
c.link = spec.link;
};
if (!set_system_colors.__argnames__) Object.defineProperties(set_system_
colors, {
__argnames__ : {value: ["spec"]}
});
register_callback(function () { register_callback(function () {
var scheme, key; var scheme, key;
var ρσ_Iter0 = ρσ_Iterable(default_color_schemes); var ρσ_Iter0 = ρσ_Iterable(default_color_schemes);
for (var ρσ_Index0 = 0; ρσ_Index0 < ρσ_Iter0.length; ρσ_Index0++) { for (var ρσ_Index0 = 0; ρσ_Index0 < ρσ_Iter0.length; ρσ_Index0++) {
key = ρσ_Iter0[ρσ_Index0]; key = ρσ_Iter0[ρσ_Index0];
scheme = default_color_schemes[(typeof key === "number" && key < 0) ? default_color_schemes.length + key : key]; scheme = default_color_schemes[(typeof key === "number" && key < 0) ? default_color_schemes.length + key : key];
scheme.name = gt(scheme.name); scheme.name = gt(scheme.name);
} }
if (window.matchMedia && window.matchMedia("(prefers-color-scheme: d
ark)").matches) {
set_system_colors((function(){
var ρσ_d = Object.create(null);
ρσ_d["background"] = "#111";
ρσ_d["foreground"] = "#ddd";
ρσ_d["link"] = "#6cb4ee";
return ρσ_d;
}).call(this));
}
}); });
runtime = (function(){ runtime = (function(){
var ρσ_d = Object.create(null); var ρσ_d = Object.create(null);
ρσ_d["is_standalone_viewer"] = false; ρσ_d["is_standalone_viewer"] = false;
ρσ_d["viewer_in_full_screen"] = false; ρσ_d["viewer_in_full_screen"] = false;
return ρσ_d; return ρσ_d;
}).call(this); }).call(this);
ui_operations = (function(){ ui_operations = (function(){
var ρσ_d = Object.create(null); var ρσ_d = Object.create(null);
ρσ_d["get_file"] = null; ρσ_d["get_file"] = null;
ρσ_d["get_mathjax_files"] = null; ρσ_d["get_mathjax_files"] = null;
ρσ_d["update_url_state"] = null; ρσ_d["update_url_state"] = null;
ρσ_d["update_last_read_time"] = null; ρσ_d["update_last_read_time"] = null;
ρσ_d["show_error"] = null; ρσ_d["show_error"] = null;
ρσ_d["redisplay_book"] = null; ρσ_d["redisplay_book"] = null;
ρσ_d["reload_book"] = null; ρσ_d["reload_book"] = null;
ρσ_d["forward_gesture"] = null; ρσ_d["forward_gesture"] = null;
ρσ_d["update_color_scheme"] = null; ρσ_d["update_color_scheme"] = null;
ρσ_d["update_font_size"] = null; ρσ_d["update_font_size"] = null;
ρσ_d["goto_bookpos"] = null; ρσ_d["goto_cfi"] = null;
ρσ_d["delete_book"] = null; ρσ_d["delete_book"] = null;
ρσ_d["focus_iframe"] = null; ρσ_d["focus_iframe"] = null;
ρσ_d["toggle_toc"] = null; ρσ_d["toggle_toc"] = null;
ρσ_d["toggle_full_screen"] = null; ρσ_d["toggle_full_screen"] = null;
return ρσ_d; return ρσ_d;
}).call(this); }).call(this);
ρσ_modules["read_book.globals"]._boss = _boss; ρσ_modules["read_book.globals"]._boss = _boss;
ρσ_modules["read_book.globals"].uid = uid; ρσ_modules["read_book.globals"].uid = uid;
ρσ_modules["read_book.globals"].default_color_schemes = default_color_sc hemes; ρσ_modules["read_book.globals"].default_color_schemes = default_color_sc hemes;
ρσ_modules["read_book.globals"].runtime = runtime; ρσ_modules["read_book.globals"].runtime = runtime;
skipping to change at line 11607 skipping to change at line 11656
ρσ_modules["read_book.globals"].set_boss = set_boss; ρσ_modules["read_book.globals"].set_boss = set_boss;
ρσ_modules["read_book.globals"].get_boss = get_boss; ρσ_modules["read_book.globals"].get_boss = get_boss;
ρσ_modules["read_book.globals"].current_book = current_book; ρσ_modules["read_book.globals"].current_book = current_book;
ρσ_modules["read_book.globals"].viewport_mode_changer = viewport_mode_ch anger; ρσ_modules["read_book.globals"].viewport_mode_changer = viewport_mode_ch anger;
ρσ_modules["read_book.globals"].current_layout_mode = current_layout_mod e; ρσ_modules["read_book.globals"].current_layout_mode = current_layout_mod e;
ρσ_modules["read_book.globals"].set_layout_mode = set_layout_mode; ρσ_modules["read_book.globals"].set_layout_mode = set_layout_mode;
ρσ_modules["read_book.globals"].current_spine_item = current_spine_item; ρσ_modules["read_book.globals"].current_spine_item = current_spine_item;
ρσ_modules["read_book.globals"].set_current_spine_item = set_current_spi ne_item; ρσ_modules["read_book.globals"].set_current_spine_item = set_current_spi ne_item;
ρσ_modules["read_book.globals"].toc_anchor_map = toc_anchor_map; ρσ_modules["read_book.globals"].toc_anchor_map = toc_anchor_map;
ρσ_modules["read_book.globals"].set_toc_anchor_map = set_toc_anchor_map; ρσ_modules["read_book.globals"].set_toc_anchor_map = set_toc_anchor_map;
ρσ_modules["read_book.globals"].set_system_colors = set_system_colors;
})(); })();
(function(){ (function(){
var __name__ = "read_book.settings"; var __name__ = "read_book.settings";
var opts; var opts;
var E = ρσ_modules.elementmaker.E; var E = ρσ_modules.elementmaker.E;
var runtime = ρσ_modules["read_book.globals"].runtime; var runtime = ρσ_modules["read_book.globals"].runtime;
opts = Object.create(null); opts = Object.create(null);
skipping to change at line 12041 skipping to change at line 12091
ns_rmap[(typeof ns === "number" && ns < 0) ? ns_rmap.length + ns : ns] = ans = "ns" + ns_count; ns_rmap[(typeof ns === "number" && ns < 0) ? ns_rmap.length + ns : ns] = ans = "ns" + ns_count;
ns_count += 1; ns_count += 1;
} }
return ans + ":"; return ans + ":";
}; };
if (!get_prefix.__argnames__) Object.defineProperties(get_prefix, { if (!get_prefix.__argnames__) Object.defineProperties(get_prefix, {
__argnames__ : {value: ["ns"]} __argnames__ : {value: ["ns"]}
}); });
function apply_attributes(src, elem, ns_map) { function apply_attributes(src, elem, ns_map) {
var attributes, ns, a; var attributes, ns, name, a;
attributes = src.a; attributes = src.a;
if (!attributes) { if (!attributes) {
return; return;
} }
var ρσ_Iter8 = ρσ_Iterable(attributes); var ρσ_Iter8 = ρσ_Iterable(attributes);
for (var ρσ_Index8 = 0; ρσ_Index8 < ρσ_Iter8.length; ρσ_Index8++) { for (var ρσ_Index8 = 0; ρσ_Index8 < ρσ_Iter8.length; ρσ_Index8++) {
a = ρσ_Iter8[ρσ_Index8]; a = ρσ_Iter8[ρσ_Index8];
if (a[2]) { if (a[2]) {
ns = ns_map[ρσ_bound_index(a[2], ns_map)]; ns = ns_map[ρσ_bound_index(a[2], ns_map)];
elem.setAttributeNS(ns, get_prefix(ns) + a[0], a[1]); elem.setAttributeNS(ns, get_prefix(ns) + a[0], a[1]);
} else { } else {
if (hide_tooltips && (a[0] === "title" || a[0] === "alt")) { name = a[0];
if (hide_tooltips && (name === "title" || name === "alt")) {
continue; continue;
} }
elem.setAttribute(a[0], a[1]); elem.setAttribute(name, a[1]);
} }
} }
}; };
if (!apply_attributes.__argnames__) Object.defineProperties(apply_attrib utes, { if (!apply_attributes.__argnames__) Object.defineProperties(apply_attrib utes, {
__argnames__ : {value: ["src", "elem", "ns_map"]} __argnames__ : {value: ["src", "elem", "ns_map"]}
}); });
function process_stack(stack, tag_map, ns_map, load_required, onload) { function process_stack(stack, tag_map, ns_map, load_required, onload) {
var ρσ_unpack, node, parent, src, elem, loadable, attr, a; var ρσ_unpack, node, parent, tag_id, src, elem, loadable, attr, a;
while (stack.length) { while (stack.length) {
ρσ_unpack = stack.pop(); ρσ_unpack = stack.pop();
ρσ_unpack = ρσ_unpack_asarray(2, ρσ_unpack); ρσ_unpack = ρσ_unpack_asarray(2, ρσ_unpack);
node = ρσ_unpack[0]; node = ρσ_unpack[0];
parent = ρσ_unpack[1]; parent = ρσ_unpack[1];
src = tag_map[ρσ_bound_index(node[0], tag_map)]; if (tag_map) {
tag_id = node[0];
src = tag_map[(typeof tag_id === "number" && tag_id < 0) ? t
ag_map.length + tag_id : tag_id];
} else {
src = node;
tag_id = process_stack.tag_id++;
}
if (src.s) { if (src.s) {
elem = document.createElementNS(ns_map[ρσ_bound_index(src.s, if (src.n) {
ns_map)], src.n); elem = document.createElementNS(ns_map[ρσ_bound_index(sr
c.s, ns_map)], src.n);
} else {
if (src.l) {
parent.appendChild(document.createTextNode(src.l));
}
continue;
}
} else { } else {
elem = document.createElement(src.n); elem = document.createElement(src.n);
} }
loadable = false; loadable = false;
attr = resource_tag_names[ρσ_bound_index(src.n, resource_tag_nam es)]; attr = resource_tag_names[ρσ_bound_index(src.n, resource_tag_nam es)];
if (attr) { if (attr) {
if (ρσ_not_equals(attr.indexOf(":"), -1)) { if (ρσ_not_equals(attr.indexOf(":"), -1)) {
attr = attr.replace("xlink:", ""); attr = attr.replace("xlink:", "");
} }
if (src.a) { if (src.a) {
skipping to change at line 12095 skipping to change at line 12159
for (var ρσ_Index9 = 0; ρσ_Index9 < ρσ_Iter9.length; ρσ_ Index9++) { for (var ρσ_Index9 = 0; ρσ_Index9 < ρσ_Iter9.length; ρσ_ Index9++) {
a = ρσ_Iter9[ρσ_Index9]; a = ρσ_Iter9[ρσ_Index9];
if (a[0] === attr) { if (a[0] === attr) {
loadable = true; loadable = true;
break; break;
} }
} }
} }
} }
if (loadable) { if (loadable) {
load_required.add(node[0]); load_required.add(tag_id);
elem.addEventListener("load", onload.bind(node[0])); elem.addEventListener("load", onload.bind(tag_id));
elem.addEventListener("error", onload.bind(node[0])); elem.addEventListener("error", onload.bind(tag_id));
} }
apply_attributes(src, elem, ns_map); apply_attributes(src, elem, ns_map);
parent.appendChild(elem); parent.appendChild(elem);
if (src.x) { if (src.x) {
if (src.n === "script" && js_types[ρσ_bound_index((elem.getA ttribute("type") || "text/javascript").toLowerCase(), js_types)] === true) { if (src.n === "script" && js_types[ρσ_bound_index((elem.getA ttribute("type") || "text/javascript").toLowerCase(), js_types)] === true) {
elem.text = src.x; elem.text = src.x;
} else { } else {
elem.appendChild(document.createTextNode(src.x)); elem.appendChild(document.createTextNode(src.x));
} }
} }
if (src.l) { if (src.l) {
parent.appendChild(document.createTextNode(src.l)); parent.appendChild(document.createTextNode(src.l));
} }
for (var i = node.length - 1; i >= 1; i--) { if (tag_map) {
stack.push([node[i], elem]); for (var i = node.length - 1; i >= 1; i--) {
stack.push([node[i], elem]);
}
} else if (node.c) {
for (var i = node.c.length; i-- > 0;) {
stack.push([node.c[i], elem]);
}
} }
} }
}; };
if (!process_stack.__argnames__) Object.defineProperties(process_stack, { if (!process_stack.__argnames__) Object.defineProperties(process_stack, {
__argnames__ : {value: ["stack", "tag_map", "ns_map", "load_required ", "onload"]} __argnames__ : {value: ["stack", "tag_map", "ns_map", "load_required ", "onload"]}
}); });
function unserialize_html(serialized_data, proceed, postprocess_dom, roo t_name) { function unserialize_html(serialized_data, proceed, postprocess_dom, roo t_name) {
var html, ns_map, base, load_required, proceeded, hang_timeout, body
_done, child, ev;
hide_tooltips = opts.hide_tooltips;
if (serialized_data.tag_map) {
return unserialize_html_legacy(serialized_data, proceed, postpro
cess_dom, root_name);
}
html = serialized_data.tree;
ns_map = serialized_data.ns_map;
remove_all_attributes(document.documentElement, document.head, docum
ent.body);
clear(document.head, document.body);
apply_attributes(html, document.documentElement, ns_map);
document.head.appendChild(ρσ_interpolate_kwargs.call(E, E.style, ["h
tml::-webkit-scrollbar, body::-webkit-scrollbar { display: none !important }"].c
oncat([ρσ_desugar_kwargs({type: "text/css"})])));
if (runtime.is_standalone_viewer && root_name) {
if (root_name.indexOf("/") > -1) {
base = window.location.pathname.rpartition("/")[0];
base = "" + ρσ_str.format("{}", window.location.protocol) +
"//" + ρσ_str.format("{}", window.location.hostname) + "" + ρσ_str.format("{}",
base) + "/" + root_name;
document.head.appendChild(ρσ_interpolate_kwargs.call(E, E.ba
se, [ρσ_desugar_kwargs({href: base})]));
}
}
if (!runtime.is_standalone_viewer) {
document.head.appendChild(ρσ_interpolate_kwargs.call(E, E.style,
["html {{ font-family: {} }}".format(window.default_font_family || "sans-serif"
)].concat([ρσ_desugar_kwargs({type: "text/css"})])));
}
load_required = set();
proceeded = false;
hang_timeout = 5;
function hangcheck() {
if (!proceeded) {
proceeded = true;
print("WARNING: All resources did not load in {} seconds, pr
oceeding anyway ({} resources left)".format(hang_timeout, load_required.length))
;
proceed();
}
};
function onload() {
load_required.discard(this);
if (!load_required.length) {
proceeded = true;
proceed();
}
};
function process_children(node, parent) {
var stack, child;
if (!node.c) {
return;
}
stack = [];
for (var i = node.c.length; i-- > 0;) {
child = node.c[i];
if (child.n !== "meta" && child.n !== "base") {
stack.push([child, parent]);
}
}
process_stack(stack, null, ns_map, load_required, onload);
};
if (!process_children.__argnames__) Object.defineProperties(process_
children, {
__argnames__ : {value: ["node", "parent"]}
});
body_done = false;
process_stack.tag_id = 1;
var ρσ_Iter10 = ρσ_Iterable(html.c);
for (var ρσ_Index10 = 0; ρσ_Index10 < ρσ_Iter10.length; ρσ_Index10++
) {
child = ρσ_Iter10[ρσ_Index10];
if (child.n === "head") {
process_children(child, document.head);
} else if (child.n === "body") {
if (!body_done) {
body_done = true;
apply_attributes(child, document.body, ns_map);
}
if (child.x) {
document.body.appendChild(document.createTextNode(child.
x));
}
process_children(child, document.body);
}
}
if (postprocess_dom) {
postprocess_dom();
}
ev = document.createEvent("Event");
ev.initEvent("DOMContentLoaded", true, true);
document.dispatchEvent(ev);
if (load_required.length) {
setTimeout(hangcheck, hang_timeout * 1e3);
} else {
proceeded = true;
proceed();
}
};
if (!unserialize_html.__argnames__) Object.defineProperties(unserialize_
html, {
__argnames__ : {value: ["serialized_data", "proceed", "postprocess_d
om", "root_name"]}
});
function unserialize_html_legacy(serialized_data, proceed, postprocess_d
om, root_name) {
var tag_map, tree, ns_map, html, ρσ_unpack, head, body, base, load_r equired, proceeded, hang_timeout, stack, bnode, ev; var tag_map, tree, ns_map, html, ρσ_unpack, head, body, base, load_r equired, proceeded, hang_timeout, stack, bnode, ev;
tag_map = serialized_data.tag_map; tag_map = serialized_data.tag_map;
tree = serialized_data.tree; tree = serialized_data.tree;
ns_map = serialized_data.ns_map; ns_map = serialized_data.ns_map;
html = tag_map[0]; html = tag_map[0];
remove_all_attributes(document.documentElement); remove_all_attributes(document.documentElement);
apply_attributes(html, document.documentElement, ns_map); apply_attributes(html, document.documentElement, ns_map);
ρσ_unpack = [tree[1], tree[2]]; ρσ_unpack = [tree[1], tree[2]];
head = ρσ_unpack[0]; head = ρσ_unpack[0];
body = ρσ_unpack[1]; body = ρσ_unpack[1];
skipping to change at line 12147 skipping to change at line 12311
base = "" + ρσ_str.format("{}", window.location.protocol) + "//" + ρσ_str.format("{}", window.location.hostname) + "" + ρσ_str.format("{}", base) + "/" + root_name; base = "" + ρσ_str.format("{}", window.location.protocol) + "//" + ρσ_str.format("{}", window.location.hostname) + "" + ρσ_str.format("{}", base) + "/" + root_name;
document.head.appendChild(ρσ_interpolate_kwargs.call(E, E.ba se, [ρσ_desugar_kwargs({href: base})])); document.head.appendChild(ρσ_interpolate_kwargs.call(E, E.ba se, [ρσ_desugar_kwargs({href: base})]));
} }
} }
if (!runtime.is_standalone_viewer) { if (!runtime.is_standalone_viewer) {
document.head.appendChild(ρσ_interpolate_kwargs.call(E, E.style, ["html {{ font-family: {} }}".format(window.default_font_family || "sans-serif" )].concat([ρσ_desugar_kwargs({type: "text/css"})]))); document.head.appendChild(ρσ_interpolate_kwargs.call(E, E.style, ["html {{ font-family: {} }}".format(window.default_font_family || "sans-serif" )].concat([ρσ_desugar_kwargs({type: "text/css"})])));
} }
load_required = set(); load_required = set();
proceeded = false; proceeded = false;
hang_timeout = 5; hang_timeout = 5;
hide_tooltips = opts.hide_tooltips;
function hangcheck() { function hangcheck() {
if (!proceeded) { if (!proceeded) {
proceeded = true; proceeded = true;
print("WARNING: All resources did not load in {} seconds, pr oceeding anyway ({} resources left)".format(hang_timeout, load_required.length)) ; print("WARNING: All resources did not load in {} seconds, pr oceeding anyway ({} resources left)".format(hang_timeout, load_required.length)) ;
proceed(); proceed();
} }
}; };
function onload() { function onload() {
load_required.discard(this); load_required.discard(this);
skipping to change at line 12191 skipping to change at line 12354
ev = document.createEvent("Event"); ev = document.createEvent("Event");
ev.initEvent("DOMContentLoaded", true, true); ev.initEvent("DOMContentLoaded", true, true);
document.dispatchEvent(ev); document.dispatchEvent(ev);
if (load_required.length) { if (load_required.length) {
setTimeout(hangcheck, hang_timeout * 1e3); setTimeout(hangcheck, hang_timeout * 1e3);
} else { } else {
proceeded = true; proceeded = true;
proceed(); proceed();
} }
}; };
if (!unserialize_html.__argnames__) Object.defineProperties(unserialize_ html, { if (!unserialize_html_legacy.__argnames__) Object.defineProperties(unser ialize_html_legacy, {
__argnames__ : {value: ["serialized_data", "proceed", "postprocess_d om", "root_name"]} __argnames__ : {value: ["serialized_data", "proceed", "postprocess_d om", "root_name"]}
}); });
function text_from_serialized_html(data) { function text_from_serialized_html(data) {
var serialized_data, tag_map, ans, stack, ignore_text, node, src; var serialized_data, tag_map, ans, stack, child, ignore_text, node, src;
serialized_data = JSON.parse(data); serialized_data = JSON.parse(data);
tag_map = serialized_data.tag_map; tag_map = serialized_data.tag_map;
ans = []; ans = [];
stack = [serialized_data.tree[2]]; if (tag_map) {
stack = [serialized_data.tree[2]];
} else {
stack = [];
var ρσ_Iter11 = ρσ_Iterable(serialized_data.tree.c);
for (var ρσ_Index11 = 0; ρσ_Index11 < ρσ_Iter11.length; ρσ_Index
11++) {
child = ρσ_Iter11[ρσ_Index11];
if (child.n === "body") {
stack.push(child);
}
}
}
ignore_text = (function(){ ignore_text = (function(){
var ρσ_d = Object.create(null); var ρσ_d = Object.create(null);
ρσ_d["script"] = true; ρσ_d["script"] = true;
ρσ_d["style"] = true; ρσ_d["style"] = true;
ρσ_d["title"] = true;
return ρσ_d; return ρσ_d;
}).call(this); }).call(this);
while (stack.length) { while (stack.length) {
node = stack.pop(); node = stack.pop();
if (typeof node === "string") { if (typeof node === "string") {
ans.push(node); ans.push(node);
continue; continue;
} }
src = tag_map[ρσ_bound_index(node[0], tag_map)]; if (tag_map) {
if (!ignore_text[ρσ_bound_index(src.n, ignore_text)] && src.x) { src = tag_map[ρσ_bound_index(node[0], tag_map)];
} else {
src = node;
}
if (src.n && !ignore_text[ρσ_bound_index(src.n, ignore_text)] &&
src.x) {
ans.push(src.x); ans.push(src.x);
} }
if (src.l) { if (src.l) {
stack.push(src.l); stack.push(src.l);
} }
for (var i = node.length - 1; i >= 1; i--) { if (tag_map) {
stack.push(node[(typeof i === "number" && i < 0) ? node.leng for (var i = node.length - 1; i >= 1; i--) {
th + i : i]); stack.push(node[(typeof i === "number" && i < 0) ? node.
length + i : i]);
}
} else {
if (src.c) {
for (var i = src.c.length; i-- > 0;) {
stack.push(src.c[i]);
}
}
} }
} }
return ans.join(""); return ans.join("");
}; };
if (!text_from_serialized_html.__argnames__) Object.defineProperties(tex t_from_serialized_html, { if (!text_from_serialized_html.__argnames__) Object.defineProperties(tex t_from_serialized_html, {
__argnames__ : {value: ["data"]} __argnames__ : {value: ["data"]}
}); });
ρσ_modules["read_book.resources"].JSON_XHTML_MIMETYPE = JSON_XHTML_MIMET YPE; ρσ_modules["read_book.resources"].JSON_XHTML_MIMETYPE = JSON_XHTML_MIMET YPE;
ρσ_modules["read_book.resources"].mathjax_data = mathjax_data; ρσ_modules["read_book.resources"].mathjax_data = mathjax_data;
skipping to change at line 12248 skipping to change at line 12435
ρσ_modules["read_book.resources"].decode_component = decode_component; ρσ_modules["read_book.resources"].decode_component = decode_component;
ρσ_modules["read_book.resources"].decode_url = decode_url; ρσ_modules["read_book.resources"].decode_url = decode_url;
ρσ_modules["read_book.resources"].create_link_pat = create_link_pat; ρσ_modules["read_book.resources"].create_link_pat = create_link_pat;
ρσ_modules["read_book.resources"].load_resources = load_resources; ρσ_modules["read_book.resources"].load_resources = load_resources;
ρσ_modules["read_book.resources"].load_mathjax = load_mathjax; ρσ_modules["read_book.resources"].load_mathjax = load_mathjax;
ρσ_modules["read_book.resources"].finalize_resources = finalize_resource s; ρσ_modules["read_book.resources"].finalize_resources = finalize_resource s;
ρσ_modules["read_book.resources"].get_prefix = get_prefix; ρσ_modules["read_book.resources"].get_prefix = get_prefix;
ρσ_modules["read_book.resources"].apply_attributes = apply_attributes; ρσ_modules["read_book.resources"].apply_attributes = apply_attributes;
ρσ_modules["read_book.resources"].process_stack = process_stack; ρσ_modules["read_book.resources"].process_stack = process_stack;
ρσ_modules["read_book.resources"].unserialize_html = unserialize_html; ρσ_modules["read_book.resources"].unserialize_html = unserialize_html;
ρσ_modules["read_book.resources"].unserialize_html_legacy = unserialize_ html_legacy;
ρσ_modules["read_book.resources"].text_from_serialized_html = text_from_ serialized_html; ρσ_modules["read_book.resources"].text_from_serialized_html = text_from_ serialized_html;
})(); })();
(function(){ (function(){
var __name__ = "read_book.footnotes"; var __name__ = "read_book.footnotes";
var block_names, block_display_styles, ok_list_types; var block_names, block_display_styles, ok_list_types;
var clear = ρσ_modules.dom.clear; var clear = ρσ_modules.dom.clear;
var IframeClient = ρσ_modules.iframe_comm.IframeClient; var IframeClient = ρσ_modules.iframe_comm.IframeClient;
skipping to change at line 12681 skipping to change at line 12869
ρσ_modules["read_book.footnotes"].get_page_break = get_page_break; ρσ_modules["read_book.footnotes"].get_page_break = get_page_break;
ρσ_modules["read_book.footnotes"].hide_children = hide_children; ρσ_modules["read_book.footnotes"].hide_children = hide_children;
ρσ_modules["read_book.footnotes"].unhide_tree = unhide_tree; ρσ_modules["read_book.footnotes"].unhide_tree = unhide_tree;
ρσ_modules["read_book.footnotes"].show_footnote = show_footnote; ρσ_modules["read_book.footnotes"].show_footnote = show_footnote;
ρσ_modules["read_book.footnotes"].PopupIframeBoss = PopupIframeBoss; ρσ_modules["read_book.footnotes"].PopupIframeBoss = PopupIframeBoss;
ρσ_modules["read_book.footnotes"].main = main; ρσ_modules["read_book.footnotes"].main = main;
})(); })();
(function(){ (function(){
var __name__ = "fs_images"; var __name__ = "fs_images";
function is_svg_fs_markup(names, svg) {
if (svg !== null) {
if (names.length === 2 || names.length === 3) {
if (names[names.length-1] === "image" && names[names.length-
2] === "svg") {
if (names.length === 2 || names[0] === "div") {
if (svg.width === "100%" && svg.height === "100%") {
return true;
}
}
}
}
}
return false;
};
if (!is_svg_fs_markup.__argnames__) Object.defineProperties(is_svg_fs_ma
rkup, {
__argnames__ : {value: ["names", "svg"]}
});
function fix_fullscreen_svg_images() { function fix_fullscreen_svg_images() {
var child_names, name, node, names, svg; var child_names, name, node, names, svg;
child_names = []; child_names = [];
var ρσ_Iter0 = ρσ_Iterable(document.body.childNodes); var ρσ_Iter0 = ρσ_Iterable(document.body.childNodes);
for (var ρσ_Index0 = 0; ρσ_Index0 < ρσ_Iter0.length; ρσ_Index0++) { for (var ρσ_Index0 = 0; ρσ_Index0 < ρσ_Iter0.length; ρσ_Index0++) {
node = ρσ_Iter0[ρσ_Index0]; node = ρσ_Iter0[ρσ_Index0];
if (node.tagName) { if (node.tagName) {
name = node.tagName.toLowerCase(); name = node.tagName.toLowerCase();
if (name !== "style" && name !== "script") { if (name !== "style" && name !== "script") {
child_names.push(name); child_names.push(name);
} }
if (child_names.length > 1) { if (child_names.length > 1) {
break; break;
} }
} }
} }
if (child_names.length === 1 && child_names[0] === "div") { if (child_names.length === 1 && (child_names[0] === "div" || child_n
names = ρσ_list_decorate([]); ames[0] === "svg")) {
names = [];
svg = null; svg = null;
var ρσ_Iter1 = ρσ_Iterable(document.body.querySelectorAll("*")); var ρσ_Iter1 = ρσ_Iterable(document.body.querySelectorAll("*"));
for (var ρσ_Index1 = 0; ρσ_Index1 < ρσ_Iter1.length; ρσ_Index1++ ) { for (var ρσ_Index1 = 0; ρσ_Index1 < ρσ_Iter1.length; ρσ_Index1++ ) {
node = ρσ_Iter1[ρσ_Index1]; node = ρσ_Iter1[ρσ_Index1];
if (node.tagName) { if (node.tagName) {
name = node.tagName.toLowerCase(); name = node.tagName.toLowerCase();
if (name !== "style" && name !== "script") { if (name !== "style" && name !== "script") {
names.push(name); names.push(name);
if (name === "svg") { if (name === "svg") {
svg = node; svg = node;
} }
} }
} }
} }
if (ρσ_equals(names, ρσ_list_decorate([ "div", "svg", "image" ]) if (is_svg_fs_markup(names, svg)) {
) || ρσ_equals(names, ρσ_list_decorate([ "svg", "image" ]))) { svg.setAttribute("width", "100vw");
if (svg.getAttribute("width") === "100%" && svg.getAttribute svg.setAttribute("height", "100vh");
("height") === "100%") {
svg.setAttribute("width", "100vw");
svg.setAttribute("height", "100vh");
}
} }
} }
}; };
ρσ_modules.fs_images.is_svg_fs_markup = is_svg_fs_markup;
ρσ_modules.fs_images.fix_fullscreen_svg_images = fix_fullscreen_svg_imag es; ρσ_modules.fs_images.fix_fullscreen_svg_images = fix_fullscreen_svg_imag es;
})(); })();
(function(){ (function(){
var __name__ = "read_book.viewport"; var __name__ = "read_book.viewport";
var FUNCTIONS, scroll_viewport, attr; var FUNCTIONS, scroll_viewport, attr;
FUNCTIONS = "x y scroll_to scroll_into_view reset_globals reset_transfor ms".split(" "); FUNCTIONS = "x y scroll_to scroll_into_view reset_globals reset_transfor ms".split(" ");
var get_boss = ρσ_modules["read_book.globals"].get_boss; var get_boss = ρσ_modules["read_book.globals"].get_boss;
var viewport_mode_changer = ρσ_modules["read_book.globals"].viewport_mod e_changer; var viewport_mode_changer = ρσ_modules["read_book.globals"].viewport_mod e_changer;
skipping to change at line 13611 skipping to change at line 13816
sc = ρσ_unpack[2]; sc = ρσ_unpack[2];
ec = ρσ_unpack[3]; ec = ρσ_unpack[3];
node = r.startContainer; node = r.startContainer;
ndoc = node.ownerDocument; ndoc = node.ownerDocument;
span = ndoc.createElement("span"); span = ndoc.createElement("span");
span.setAttribute("style", "border-width: 0; padding: 0; margin: 0"); span.setAttribute("style", "border-width: 0; padding: 0; margin: 0");
r.surroundContents(span); r.surroundContents(span);
scroll_viewport.scroll_into_view(span); scroll_viewport.scroll_into_view(span);
scroll_viewport.reset_transforms(); scroll_viewport.reset_transforms();
fn = function () { fn = function () {
var rect, p, node, rects, x, y, ρσ_unpack; var rect, p, node, offset, rects, x, y, ρσ_unpack;
rect = span.getBoundingClientRect(); rect = span.getBoundingClientRect();
p = span.parentNode; p = span.parentNode;
var ρσ_Iter1 = ρσ_Iterable(span.childNodes); var ρσ_Iter1 = ρσ_Iterable(span.childNodes);
for (var ρσ_Index1 = 0; ρσ_Index1 < ρσ_Iter1.length; ρσ_Inde x1++) { for (var ρσ_Index1 = 0; ρσ_Index1 < ρσ_Iter1.length; ρσ_Inde x1++) {
node = ρσ_Iter1[ρσ_Index1]; node = ρσ_Iter1[ρσ_Index1];
span.removeChild(node); span.removeChild(node);
p.insertBefore(node, span); p.insertBefore(node, span);
} }
p.removeChild(span); p.removeChild(span);
p.normalize(); p.normalize();
r.setStart(sc, so); offset = so;
try { while (offset > -1) {
r.setEnd(ec, eo); try {
} catch (ρσ_Exception) { r.setStart(sc, offset);
ρσ_last_exception = ρσ_Exception; break;
{ } catch (ρσ_Exception) {
r.setEnd(ec, eo - 1); ρσ_last_exception = ρσ_Exception;
{
offset -= 1;
}
}
}
offset = eo;
while (offset > -1) {
try {
r.setEnd(ec, offset);
break;
} catch (ρσ_Exception) {
ρσ_last_exception = ρσ_Exception;
{
offset -= 1;
}
} }
} }
rects = r.getClientRects(); rects = r.getClientRects();
if (rects.length > 0) { if (rects.length > 0) {
rect = rects[0]; rect = rects[0];
} }
x = point_.a * rect.left + (1 - point_.a) * rect.right; x = point_.a * rect.left + (1 - point_.a) * rect.right;
y = (rect.top + rect.bottom) / 2; y = (rect.top + rect.bottom) / 2;
ρσ_unpack = viewport_to_document(x, y, ndoc); ρσ_unpack = viewport_to_document(x, y, ndoc);
ρσ_unpack = ρσ_unpack_asarray(2, ρσ_unpack); ρσ_unpack = ρσ_unpack_asarray(2, ρσ_unpack);
skipping to change at line 14051 skipping to change at line 14271
var ρσ_anonfunc = function scroll_by(y) { var ρσ_anonfunc = function scroll_by(y) {
window.scrollBy(0, y); window.scrollBy(0, y);
}; };
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["y"]} __argnames__ : {value: ["y"]}
}); });
return ρσ_anonfunc; return ρσ_anonfunc;
})()); })());
function flow_onwheel(evt) { function flow_onwheel(evt) {
var dx, dy; var dx, dy, WheelEvent;
dx = dy = 0; dx = dy = 0;
WheelEvent = window.WheelEvent;
if (evt.deltaY) { if (evt.deltaY) {
if (evt.deltaMode === evt.DOM_DELTA_PIXEL) { if (evt.deltaMode === WheelEvent.DOM_DELTA_PIXEL) {
dy = evt.deltaY; dy = evt.deltaY;
} else if (evt.deltaMode === evt.DOM_DELTA_LINE) { } else if (evt.deltaMode === WheelEvent.DOM_DELTA_LINE) {
dy = 15 * evt.deltaY; dy = 15 * evt.deltaY;
} }
if (evt.deltaMode === evt.DOM_DELTA_PAGE) { if (evt.deltaMode === WheelEvent.DOM_DELTA_PAGE) {
dy = (scroll_viewport.height() - 30) * evt.deltaY; dy = (scroll_viewport.height() - 30) * evt.deltaY;
} }
} }
if (evt.deltaX) { if (evt.deltaX) {
if (evt.deltaMode === evt.DOM_DELTA_PIXEL) { if (evt.deltaMode === WheelEvent.DOM_DELTA_PIXEL) {
dx = evt.deltaX; dx = evt.deltaX;
} else if (evt.deltaMode === evt.DOM_DELTA_LINE) { } else if (evt.deltaMode === WheelEvent.DOM_DELTA_LINE) {
dx = 15 * evt.deltaX; dx = 15 * evt.deltaX;
} else { } else {
dx = (scroll_viewport.width() - 30) * evt.deltaX; dx = (scroll_viewport.width() - 30) * evt.deltaX;
} }
} }
if (dx) { if (dx) {
window.scrollBy(dx, 0); window.scrollBy(dx, 0);
} else if (dy) { } else if (dy) {
scroll_by(dy); scroll_by(dy);
} }
skipping to change at line 14562 skipping to change at line 14783
ρσ_modules["read_book.mathjax"].get_url = get_url; ρσ_modules["read_book.mathjax"].get_url = get_url;
ρσ_modules["read_book.mathjax"].monkeypatch = monkeypatch; ρσ_modules["read_book.mathjax"].monkeypatch = monkeypatch;
ρσ_modules["read_book.mathjax"].postprocess = postprocess; ρσ_modules["read_book.mathjax"].postprocess = postprocess;
ρσ_modules["read_book.mathjax"].init_mathjax = init_mathjax; ρσ_modules["read_book.mathjax"].init_mathjax = init_mathjax;
ρσ_modules["read_book.mathjax"].apply_mathjax = apply_mathjax; ρσ_modules["read_book.mathjax"].apply_mathjax = apply_mathjax;
})(); })();
(function(){ (function(){
var __name__ = "read_book.paged_mode"; var __name__ = "read_book.paged_mode";
var _in_paged_mode, col_width, screen_width, screen_height, cols_per_scr een, gap, col_and_gap, number_of_cols, is_full_screen_layout, anchor_funcs; var _in_paged_mode, col_width, screen_width, screen_height, cols_per_scr een, gap, col_and_gap, number_of_cols, last_scrolled_to_column, is_full_screen_l ayout, anchor_funcs, resize_manager;
var traceback = ρσ_modules.traceback; var traceback = ρσ_modules.traceback;
var E = ρσ_modules.elementmaker.E; var E = ρσ_modules.elementmaker.E;
var word_at_point = ρσ_modules.select.word_at_point; var word_at_point = ρσ_modules.select.word_at_point;
var set_css = ρσ_modules.dom.set_css; var set_css = ρσ_modules.dom.set_css;
var cfi_at_current = ρσ_modules["read_book.cfi"].at_current; var cfi_at_current = ρσ_modules["read_book.cfi"].at_current;
var cfi_at_point = ρσ_modules["read_book.cfi"].at_point; var cfi_at_point = ρσ_modules["read_book.cfi"].at_point;
skipping to change at line 14654 skipping to change at line 14875
}; };
if (!create_page_div.__argnames__) Object.defineProperties(create_page_d iv, { if (!create_page_div.__argnames__) Object.defineProperties(create_page_d iv, {
__argnames__ : {value: ["elem"]} __argnames__ : {value: ["elem"]}
}); });
_in_paged_mode = false; _in_paged_mode = false;
function in_paged_mode() { function in_paged_mode() {
return _in_paged_mode; return _in_paged_mode;
}; };
col_width = screen_width = screen_height = cols_per_screen = gap = col_a nd_gap = number_of_cols = 0; col_width = screen_width = screen_height = cols_per_screen = gap = col_a nd_gap = number_of_cols = last_scrolled_to_column = 0;
is_full_screen_layout = false; is_full_screen_layout = false;
function reset_paged_mode_globals() { function reset_paged_mode_globals() {
scroll_viewport.reset_globals(); scroll_viewport.reset_globals();
col_width = screen_width = screen_height = cols_per_screen = gap = c ol_and_gap = number_of_cols = 0; col_width = screen_width = screen_height = cols_per_screen = gap = c ol_and_gap = number_of_cols = last_scrolled_to_column = 0;
is_full_screen_layout = _in_paged_mode = false; is_full_screen_layout = _in_paged_mode = false;
resize_manager.reset();
}; };
function column_at(xpos) { function column_at(xpos) {
var sw; var sw;
sw = scroll_viewport.paged_content_width(); sw = scroll_viewport.paged_content_width();
if (xpos >= sw - col_and_gap) { if (xpos >= sw - col_and_gap) {
xpos = sw - col_width + 10; xpos = sw - col_width + 10;
} }
return Math.floor((xpos + gap) / col_and_gap); return Math.floor((xpos + gap) / col_and_gap);
}; };
skipping to change at line 14756 skipping to change at line 14978
cps = 0; cps = 0;
} }
} }
if (!cps) { if (!cps) {
cps = int(Math.floor(scroll_viewport.width() / 500)); cps = int(Math.floor(scroll_viewport.width() / 500));
} }
cps = max(1, min(cps || 1, 20)); cps = max(1, min(cps || 1, 20));
return cps; return cps;
}; };
function layout(is_single_page) { function layout(is_single_page, on_resize) {
var body_style, first_layout, cps, single_screen, has_svg, imgs, onl y_img, num, elems, n, ww, sm, c, c2, data, dw, elem; var body_style, first_layout, cps, single_screen, has_svg, imgs, onl y_img, num, elems, n, ww, sm, c, c2, data, dw, elem;
body_style = window.getComputedStyle(document.body); body_style = window.getComputedStyle(document.body);
first_layout = !_in_paged_mode; first_layout = !_in_paged_mode;
cps = calc_columns_per_screen(); cps = calc_columns_per_screen();
if (first_layout) { if (first_layout) {
handle_rtl_body(body_style); handle_rtl_body(body_style);
single_screen = document_height() < scroll_viewport.height() + 7 5; single_screen = document_height() < scroll_viewport.height() + 7 5;
first_layout = true; first_layout = true;
has_svg = document.getElementsByTagName("svg").length > 0; has_svg = document.getElementsByTagName("svg").length > 0;
imgs = document.getElementsByTagName("img"); imgs = document.getElementsByTagName("img");
only_img = imgs.length === 1 && document.getElementsByTagName("d iv").length < 3 && document.getElementsByTagName("p").length < 2; only_img = imgs.length === 1 && document.getElementsByTagName("d iv").length < 3 && document.getElementsByTagName("p").length < 2;
if (only_img && window.getComputedStyle(imgs[0]).zIndex < 0) { if (only_img && window.getComputedStyle(imgs[0]).zIndex < 0) {
imgs[0].style.zIndex = "0"; imgs[0].style.zIndex = "0";
} }
if (!single_screen && cps > 1) { if (!single_screen && cps > 1) {
num = cps - 1; num = cps - 1;
elems = document.querySelectorAll("body > *"); elems = document.querySelectorAll("body > *");
if ((elems.length === 1 || typeof elems.length === "object" && ρσ_equals(elems.length, 1))) { if (elems.length === 1) {
elems[0].style.height = "auto"; elems[0].style.height = "auto";
} }
while (num > 0) { while (num > 0) {
num -= 1; num -= 1;
create_page_div(); create_page_div();
} }
} }
} }
n = cols_per_screen = cps; n = cols_per_screen = cps;
ww = col_width = screen_width = scroll_viewport.width(); ww = col_width = screen_width = scroll_viewport.width();
skipping to change at line 14848 skipping to change at line 15070
} }
data = check_column_widths(); data = check_column_widths();
if (data) { if (data) {
print("WARNING: column layout broken, probably because there is some non-reflowable content in the book that is wider than the column width", da ta); print("WARNING: column layout broken, probably because there is some non-reflowable content in the book that is wider than the column width", da ta);
} }
_in_paged_mode = true; _in_paged_mode = true;
fit_images(); fit_images();
return gap; return gap;
}; };
if (!layout.__argnames__) Object.defineProperties(layout, { if (!layout.__argnames__) Object.defineProperties(layout, {
__argnames__ : {value: ["is_single_page"]} __argnames__ : {value: ["is_single_page", "on_resize"]}
}); });
function current_scroll_offset() { function current_scroll_offset() {
return scroll_viewport.x(); return scroll_viewport.x();
}; };
function scroll_to_offset(x) { function scroll_to_offset(x) {
scroll_viewport.scroll_to(x, 0); scroll_viewport.scroll_to(x, 0);
}; };
if (!scroll_to_offset.__argnames__) Object.defineProperties(scroll_to_of fset, { if (!scroll_to_offset.__argnames__) Object.defineProperties(scroll_to_of fset, {
skipping to change at line 14875 skipping to change at line 15097
var duration = (arguments[2] === undefined || ( 2 === arguments.leng th-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.len gth-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true )) ? scroll_to_column.__defaults__.duration : arguments[2]; var duration = (arguments[2] === undefined || ( 2 === arguments.leng th-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.len gth-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true )) ? scroll_to_column.__defaults__.duration : arguments[2];
var ρσ_kwargs_obj = arguments[arguments.length-1]; var ρσ_kwargs_obj = arguments[arguments.length-1];
if (ρσ_kwargs_obj === null || typeof ρσ_kwargs_obj !== "object" || ρ σ_kwargs_obj [ρσ_kwargs_symbol] !== true) ρσ_kwargs_obj = {}; if (ρσ_kwargs_obj === null || typeof ρσ_kwargs_obj !== "object" || ρ σ_kwargs_obj [ρσ_kwargs_symbol] !== true) ρσ_kwargs_obj = {};
if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "notify")){ if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "notify")){
notify = ρσ_kwargs_obj.notify; notify = ρσ_kwargs_obj.notify;
} }
if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "duration")) { if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "duration")) {
duration = ρσ_kwargs_obj.duration; duration = ρσ_kwargs_obj.duration;
} }
var pos, limit; var pos, limit;
last_scrolled_to_column = number;
pos = number * col_and_gap; pos = number * col_and_gap;
limit = scroll_viewport.paged_content_width() - screen_width; limit = scroll_viewport.paged_content_width() - screen_width;
pos = min(pos, limit); pos = min(pos, limit);
scroll_to_offset(pos); scroll_to_offset(pos);
}; };
if (!scroll_to_column.__defaults__) Object.defineProperties(scroll_to_co lumn, { if (!scroll_to_column.__defaults__) Object.defineProperties(scroll_to_co lumn, {
__defaults__ : {value: {notify:false, duration:1e3}}, __defaults__ : {value: {notify:false, duration:1e3}},
__handles_kwarg_interpolation__ : {value: true}, __handles_kwarg_interpolation__ : {value: true},
__argnames__ : {value: ["number", "notify", "duration"]} __argnames__ : {value: ["number", "notify", "duration"]}
}); });
skipping to change at line 14904 skipping to change at line 15127
} }
if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "duration")) { if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "duration")) {
duration = ρσ_kwargs_obj.duration; duration = ρσ_kwargs_obj.duration;
} }
if (typeof xpos !== "number") { if (typeof xpos !== "number") {
print(xpos, "is not a number, cannot scroll to it!"); print(xpos, "is not a number, cannot scroll to it!");
return; return;
} }
if (is_full_screen_layout) { if (is_full_screen_layout) {
scroll_to_offset(0); scroll_to_offset(0);
last_scrolled_to_column = 0;
return; return;
} }
ρσ_interpolate_kwargs.call(this, scroll_to_column, [column_at(xpos)] .concat([ρσ_desugar_kwargs({notify: notify, duration: duration})])); ρσ_interpolate_kwargs.call(this, scroll_to_column, [column_at(xpos)] .concat([ρσ_desugar_kwargs({notify: notify, duration: duration})]));
}; };
if (!scroll_to_xpos.__defaults__) Object.defineProperties(scroll_to_xpos , { if (!scroll_to_xpos.__defaults__) Object.defineProperties(scroll_to_xpos , {
__defaults__ : {value: {notify:false, duration:1e3}}, __defaults__ : {value: {notify:false, duration:1e3}},
__handles_kwarg_interpolation__ : {value: true}, __handles_kwarg_interpolation__ : {value: true},
__argnames__ : {value: ["xpos", "notify", "duration"]} __argnames__ : {value: ["xpos", "notify", "duration"]}
}); });
skipping to change at line 15321 skipping to change at line 15545
var ρσ_anonfunc = function cmp(a, b) { var ρσ_anonfunc = function cmp(a, b) {
return a - b; return a - b;
}; };
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfu nc, { if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfu nc, {
__argnames__ : {value: ["a", "b"]} __argnames__ : {value: ["a", "b"]}
}); });
return ρσ_anonfunc; return ρσ_anonfunc;
})(); })();
return ρσ_d; return ρσ_d;
}).call(this); }).call(this);
function ResizeManager() {
if (this.ρσ_object_id === undefined) Object.defineProperty(this, "ρσ
_object_id", {"value":++ρσ_object_counter});
ResizeManager.prototype.__init__.apply(this, arguments);
}
ResizeManager.prototype.__init__ = function __init__() {
var self = this;
self.reset();
};
ResizeManager.__argnames__ = ResizeManager.prototype.__init__.__argnames
__;
ResizeManager.__handles_kwarg_interpolation__ = ResizeManager.prototype.
__init__.__handles_kwarg_interpolation__;
ResizeManager.prototype.reset = function reset() {
var self = this;
self.resize_in_progress = null;
self.last_transition = null;
};
ResizeManager.prototype.start_resize = function start_resize(width, heig
ht) {
var self = this;
self.resize_in_progress = (function(){
var ρσ_d = Object.create(null);
ρσ_d["width"] = width;
ρσ_d["height"] = height;
ρσ_d["column"] = last_scrolled_to_column;
return ρσ_d;
}).call(this);
};
if (!ResizeManager.prototype.start_resize.__argnames__) Object.definePro
perties(ResizeManager.prototype.start_resize, {
__argnames__ : {value: ["width", "height"]}
});
ResizeManager.prototype.end_resize = function end_resize() {
var self = this;
var ρσ_unpack, rp, transition;
if (!self.resize_in_progress) {
return;
}
ρσ_unpack = [self.resize_in_progress, null];
rp = ρσ_unpack[0];
self.resize_in_progress = ρσ_unpack[1];
transition = (function(){
var ρσ_d = Object.create(null);
ρσ_d["before"] = rp;
ρσ_d["after"] = (function(){
var ρσ_d = Object.create(null);
ρσ_d["width"] = scroll_viewport.width();
ρσ_d["height"] = scroll_viewport.height();
ρσ_d["column"] = last_scrolled_to_column;
return ρσ_d;
}).call(this);
return ρσ_d;
}).call(this);
if (self.is_inverse_transition(transition)) {
if (transition.after.column !== self.last_transition.before.colu
mn) {
self.scroll_to_column(transition.after.column);
transition.after.column = last_scrolled_to_column;
}
}
self.last_transition = transition;
};
ResizeManager.prototype.is_inverse_transition = function is_inverse_tran
sition(transition) {
var self = this;
var p, n;
p = self.last_transition;
if (!p) {
return false;
}
p = p.after;
n = transition.before;
return p.column === n.column && p.width === n.width && p.height ===
n.height;
};
if (!ResizeManager.prototype.is_inverse_transition.__argnames__) Object.
defineProperties(ResizeManager.prototype.is_inverse_transition, {
__argnames__ : {value: ["transition"]}
});
ResizeManager.prototype.__repr__ = function __repr__ () {
return "<" + __name__ + "." + this.constructor.name + "
#" + this.ρσ_object_id + ">";
};
ResizeManager.prototype.__str__ = function __str__ () {
return this.__repr__();
};
Object.defineProperty(ResizeManager.prototype, "__bases__", {value: []})
;
resize_manager = new ResizeManager;
function prepare_for_resize(width, height) {
resize_manager.start_resize(width, height);
};
if (!prepare_for_resize.__argnames__) Object.defineProperties(prepare_fo
r_resize, {
__argnames__ : {value: ["width", "height"]}
});
function resize_done() {
resize_manager.end_resize();
};
ρσ_modules["read_book.paged_mode"]._in_paged_mode = _in_paged_mode; ρσ_modules["read_book.paged_mode"]._in_paged_mode = _in_paged_mode;
ρσ_modules["read_book.paged_mode"].col_width = col_width; ρσ_modules["read_book.paged_mode"].col_width = col_width;
ρσ_modules["read_book.paged_mode"].screen_width = screen_width; ρσ_modules["read_book.paged_mode"].screen_width = screen_width;
ρσ_modules["read_book.paged_mode"].screen_height = screen_height; ρσ_modules["read_book.paged_mode"].screen_height = screen_height;
ρσ_modules["read_book.paged_mode"].cols_per_screen = cols_per_screen; ρσ_modules["read_book.paged_mode"].cols_per_screen = cols_per_screen;
ρσ_modules["read_book.paged_mode"].gap = gap; ρσ_modules["read_book.paged_mode"].gap = gap;
ρσ_modules["read_book.paged_mode"].col_and_gap = col_and_gap; ρσ_modules["read_book.paged_mode"].col_and_gap = col_and_gap;
ρσ_modules["read_book.paged_mode"].number_of_cols = number_of_cols; ρσ_modules["read_book.paged_mode"].number_of_cols = number_of_cols;
ρσ_modules["read_book.paged_mode"].last_scrolled_to_column = last_scroll ed_to_column;
ρσ_modules["read_book.paged_mode"].is_full_screen_layout = is_full_scree n_layout; ρσ_modules["read_book.paged_mode"].is_full_screen_layout = is_full_scree n_layout;
ρσ_modules["read_book.paged_mode"].anchor_funcs = anchor_funcs; ρσ_modules["read_book.paged_mode"].anchor_funcs = anchor_funcs;
ρσ_modules["read_book.paged_mode"].resize_manager = resize_manager;
ρσ_modules["read_book.paged_mode"].first_child = first_child; ρσ_modules["read_book.paged_mode"].first_child = first_child;
ρσ_modules["read_book.paged_mode"].has_start_text = has_start_text; ρσ_modules["read_book.paged_mode"].has_start_text = has_start_text;
ρσ_modules["read_book.paged_mode"].handle_rtl_body = handle_rtl_body; ρσ_modules["read_book.paged_mode"].handle_rtl_body = handle_rtl_body;
ρσ_modules["read_book.paged_mode"].create_page_div = create_page_div; ρσ_modules["read_book.paged_mode"].create_page_div = create_page_div;
ρσ_modules["read_book.paged_mode"].in_paged_mode = in_paged_mode; ρσ_modules["read_book.paged_mode"].in_paged_mode = in_paged_mode;
ρσ_modules["read_book.paged_mode"].reset_paged_mode_globals = reset_page d_mode_globals; ρσ_modules["read_book.paged_mode"].reset_paged_mode_globals = reset_page d_mode_globals;
ρσ_modules["read_book.paged_mode"].column_at = column_at; ρσ_modules["read_book.paged_mode"].column_at = column_at;
ρσ_modules["read_book.paged_mode"].fit_images = fit_images; ρσ_modules["read_book.paged_mode"].fit_images = fit_images;
ρσ_modules["read_book.paged_mode"].calc_columns_per_screen = calc_column s_per_screen; ρσ_modules["read_book.paged_mode"].calc_columns_per_screen = calc_column s_per_screen;
ρσ_modules["read_book.paged_mode"].layout = layout; ρσ_modules["read_book.paged_mode"].layout = layout;
skipping to change at line 15362 skipping to change at line 15679
ρσ_modules["read_book.paged_mode"].jump_to_anchor = jump_to_anchor; ρσ_modules["read_book.paged_mode"].jump_to_anchor = jump_to_anchor;
ρσ_modules["read_book.paged_mode"].scroll_to_elem = scroll_to_elem; ρσ_modules["read_book.paged_mode"].scroll_to_elem = scroll_to_elem;
ρσ_modules["read_book.paged_mode"].snap_to_selection = snap_to_selection ; ρσ_modules["read_book.paged_mode"].snap_to_selection = snap_to_selection ;
ρσ_modules["read_book.paged_mode"].jump_to_cfi = jump_to_cfi; ρσ_modules["read_book.paged_mode"].jump_to_cfi = jump_to_cfi;
ρσ_modules["read_book.paged_mode"].current_cfi = current_cfi; ρσ_modules["read_book.paged_mode"].current_cfi = current_cfi;
ρσ_modules["read_book.paged_mode"].progress_frac = progress_frac; ρσ_modules["read_book.paged_mode"].progress_frac = progress_frac;
ρσ_modules["read_book.paged_mode"].onwheel = onwheel; ρσ_modules["read_book.paged_mode"].onwheel = onwheel;
ρσ_modules["read_book.paged_mode"].scroll_by_page = scroll_by_page; ρσ_modules["read_book.paged_mode"].scroll_by_page = scroll_by_page;
ρσ_modules["read_book.paged_mode"].handle_shortcut = handle_shortcut; ρσ_modules["read_book.paged_mode"].handle_shortcut = handle_shortcut;
ρσ_modules["read_book.paged_mode"].handle_gesture = handle_gesture; ρσ_modules["read_book.paged_mode"].handle_gesture = handle_gesture;
ρσ_modules["read_book.paged_mode"].ResizeManager = ResizeManager;
ρσ_modules["read_book.paged_mode"].prepare_for_resize = prepare_for_resi
ze;
ρσ_modules["read_book.paged_mode"].resize_done = resize_done;
})(); })();
(function(){ (function(){
var __name__ = "read_book.shortcuts"; var __name__ = "read_book.shortcuts";
var GROUP_DESC, SHORTCUTS;
var _ = ρσ_modules.gettext.gettext; var _ = ρσ_modules.gettext.gettext;
function parse_key_repr(sc) { function parse_key_repr(sc) {
var parts, key, ans, q, modifier; var parts, key, ans, q, modifier;
parts = sc.split("+"); parts = sc.split("+");
if (sc.endsWith("++")) { if (sc.endsWith("++")) {
parts = parts.slice(0, -2); parts = parts.slice(0, -2);
parts.push("+"); parts.push("+");
} }
key = parts[parts.length-1]; key = parts[parts.length-1];
skipping to change at line 15518 skipping to change at line 15837
key = get_key_text(evt); key = get_key_text(evt);
if (key === " ") { if (key === " ") {
key = "Space"; key = "Space";
} }
return mods + key; return mods + key;
}; };
if (!key_as_text.__argnames__) Object.defineProperties(key_as_text, { if (!key_as_text.__argnames__) Object.defineProperties(key_as_text, {
__argnames__ : {value: ["evt"]} __argnames__ : {value: ["evt"]}
}); });
GROUP_DESC = (function(){ function shortcuts_definition() {
var ρσ_d = Object.create(null); var ans;
ρσ_d["scroll"] = _("Navigation"); ans = shortcuts_definition.ans;
ρσ_d["ui"] = _("Interface"); if (!ans) {
return ρσ_d; ans = shortcuts_definition.ans = (function(){
}).call(this); var ρσ_d = Object.create(null);
SHORTCUTS = (function(){ ρσ_d["start_of_file"] = desc(['Ctrl+ArrowUp', 'Ctrl+ArrowLef
var ρσ_d = Object.create(null); t', 'Home'], "scroll", _("Scroll to the beginning of the current file"), _("When
ρσ_d["start_of_file"] = desc(['Ctrl+ArrowUp', 'Ctrl+ArrowLeft', 'Hom the e-book is made of of multiple individual files, scroll to the start of the
e'], "scroll", _("Scroll to the beginning of the current file"), _("When the e-b current file."));
ook is made of of multiple individual files, scroll to the start of the current ρσ_d["start_of_book"] = desc("Ctrl+Home", "scroll", _("Scrol
file.")); l to the beginning of the book"));
ρσ_d["start_of_book"] = desc("Ctrl+Home", "scroll", _("Scroll to the ρσ_d["end_of_book"] = desc("Ctrl+End", "scroll", _("Scroll t
beginning of the book")); o the end of the book"));
ρσ_d["end_of_book"] = desc("Ctrl+End", "scroll", _("Scroll to the en ρσ_d["end_of_file"] = desc(['Ctrl+ArrowDown', 'Ctrl+ArrowRig
d of the book")); ht', 'End'], "scroll", _("Scroll to the end of the current file"), _("When the e
ρσ_d["end_of_file"] = desc(['Ctrl+ArrowDown', 'Ctrl+ArrowRight', 'En -book is made of of multiple individual files, scroll to the end of the current
d'], "scroll", _("Scroll to the end of the current file"), _("When the e-book is file."));
made of of multiple individual files, scroll to the end of the current file.")) ρσ_d["up"] = desc("ArrowUp", "scroll", _("Scroll backwards s
; moothly (by screen-fulls in paged mode)"), _("Scroll backwards, smoothly in flow
ρσ_d["up"] = desc("ArrowUp", "scroll", _("Scroll backwards smoothly mode and by screen fulls in paged mode"));
(by screen-fulls in paged mode)"), _("Scroll backwards, smoothly in flow mode an ρσ_d["down"] = desc("ArrowDown", "scroll", _("Scroll forward
d by screen fulls in paged mode")); s smoothly (by screen-fulls in paged mode)"), _("Scroll forwards, smoothly in fl
ρσ_d["down"] = desc("ArrowDown", "scroll", _("Scroll forwards smooth ow mode and by screen fulls in paged mode"));
ly (by screen-fulls in paged mode)"), _("Scroll forwards, smoothly in flow mode ρσ_d["left"] = desc("ArrowLeft", "scroll", _("Scroll left"),
and by screen fulls in paged mode")); _("Scroll leftwards by a little in flow mode and by a page in paged mode"));
ρσ_d["left"] = desc("ArrowLeft", "scroll", _("Scroll left"), _("Scro ρσ_d["right"] = desc("ArrowRight", "scroll", _("Scroll right
ll leftwards by a little in flow mode and by a page in paged mode")); "), _("Scroll rightwards by a little in flow mode and by a page in paged mode"))
ρσ_d["right"] = desc("ArrowRight", "scroll", _("Scroll right"), _("S ;
croll rightwards by a little in flow mode and by a page in paged mode")); ρσ_d["pageup"] = desc("PageUp", "scroll", _("Scroll backward
ρσ_d["pageup"] = desc("PageUp", "scroll", _("Scroll backwards by scr s by screen-fulls"));
een-fulls")); ρσ_d["pagedown"] = desc([' ', 'PageDown'], "scroll", _("Scro
ρσ_d["pagedown"] = desc([' ', 'PageDown'], "scroll", _("Scroll forwa ll forwards by screen-fulls"));
rds by screen-fulls")); ρσ_d["previous_section"] = desc("Ctrl+PageUp", "scroll", _("
ρσ_d["previous_section"] = desc("Ctrl+PageUp", "scroll", _("Scroll t Scroll to the previous section"));
o the previous section")); ρσ_d["next_section"] = desc("Ctrl+PageDown", "scroll", _("Sc
ρσ_d["next_section"] = desc("Ctrl+PageDown", "scroll", _("Scroll to roll to the next section"));
the next section")); ρσ_d["back"] = desc(['Alt+ArrowLeft', 'Shift+ArrowLeft'], "s
ρσ_d["back"] = desc(['Alt+ArrowLeft', 'Shift+ArrowLeft'], "scroll", croll", _("Back"));
_("Back")); ρσ_d["forward"] = desc(['Alt+ArrowRight', 'Shift+ArrowRight'
ρσ_d["forward"] = desc(['Alt+ArrowRight', 'Shift+ArrowRight'], "scro ], "scroll", _("Forward"));
ll", _("Forward")); ρσ_d["toggle_toc"] = desc("Ctrl+t", "ui", _("Show/hide Table
ρσ_d["toggle_toc"] = desc("Ctrl+t", "ui", _("Show/hide Table of Cont of Contents"));
ents")); ρσ_d["start_search"] = desc(['/', 'Ctrl+f'], "ui", _("Start
ρσ_d["start_search"] = desc(['/', 'Ctrl+f'], "ui", _("Start search") search"));
); ρσ_d["next_match"] = desc(['F3'], "ui", _("Find next"));
ρσ_d["next_match"] = desc(['F3'], "ui", _("Find next")); ρσ_d["previous_match"] = desc(['Shift+F3'], "ui", _("Find pr
ρσ_d["previous_match"] = desc(['Shift+F3'], "ui", _("Find previous") evious"));
); ρσ_d["increase_font_size"] = desc(['Ctrl+=', 'Ctrl++', 'Ctrl
ρσ_d["increase_font_size"] = desc(['Ctrl+=', 'Ctrl++', 'Ctrl+Shift++ +Shift++', 'Ctrl+Shift+=', 'Meta++', 'Meta+Shift++', 'Meta+Shift+='], "ui", _("I
', 'Ctrl+Shift+=', 'Meta++', 'Meta+Shift++', 'Meta+Shift+='], "ui", _("Increase ncrease font size"));
font size")); ρσ_d["decrease_font_size"] = desc(['Ctrl+-', 'Ctrl+_', 'Ctrl
ρσ_d["decrease_font_size"] = desc(['Ctrl+-', 'Ctrl+_', 'Ctrl+Shift+- +Shift+-', 'Ctrl+Shift+_', 'Meta+-', 'Meta+_'], "ui", _("Decrease font size"));
', 'Ctrl+Shift+_', 'Meta+-', 'Meta+_'], "ui", _("Decrease font size")); ρσ_d["toggle_full_screen"] = desc(['F11', 'Ctrl+Shift+F'], "
ρσ_d["toggle_full_screen"] = desc(['F11', 'Ctrl+Shift+F'], "ui", _(" ui", _("Toggle full screen"));
Toggle full screen")); ρσ_d["toggle_paged_mode"] = desc("Ctrl+m", "ui", _("Toggle b
ρσ_d["toggle_paged_mode"] = desc("Ctrl+m", "ui", _("Toggle between P etween Paged mode and Flow mode for text layout"));
aged mode and Flow mode for text layout")); ρσ_d["reload_book"] = desc(['F5', 'Ctrl+r'], "ui", _("Reload
ρσ_d["reload_book"] = desc(['F5', 'Ctrl+r'], "ui", _("Reload book")) book"));
; ρσ_d["search_for_selection"] = desc(['Ctrl+s'], "ui", _("Sea
ρσ_d["search_for_selection"] = desc(['Ctrl+s'], "ui", _("Search for rch for next occurrence of selected text"));
next occurrence of selected text")); ρσ_d["show_chrome"] = desc(['Escape', 'ContextMenu'], "ui",
ρσ_d["show_chrome"] = desc(['Escape', 'ContextMenu'], "ui", _("Show _("Show the viewer controls"));
the viewer controls")); ρσ_d["goto_location"] = desc([';', ':', 'Shift+:', 'Shift+;'
return ρσ_d; , 'Ctrl+g'], "ui", _("Go to a specified book location or position"));
}).call(this); return ρσ_d;
}).call(this);
}
return ans;
};
function shortcuts_group_desc() {
var ans;
ans = shortcuts_group_desc.ans;
if (!ans) {
ans = shortcuts_group_desc.ans = (function(){
var ρσ_d = Object.create(null);
ρσ_d["scroll"] = _("Navigation");
ρσ_d["ui"] = _("Interface");
return ρσ_d;
}).call(this);
}
return ans;
};
function add_standalone_viewer_shortcuts() { function add_standalone_viewer_shortcuts() {
var ismacos, quit_shortcut; var ismacos, sc, quit_shortcut;
ismacos = ρσ_in("macos", window.navigator.userAgent); ismacos = ρσ_in("macos", window.navigator.userAgent);
SHORTCUTS["toggle_bookmarks"] = desc(['Ctrl+b'], "ui", _("Show/hide sc = shortcuts_definition();
bookmarks")); sc["toggle_bookmarks"] = desc(['Ctrl+b'], "ui", _("Show/hide bookmar
SHORTCUTS["toggle_inspector"] = desc(['Ctrl+i'], "ui", _("Show/hide ks"));
Inspector")); sc["toggle_inspector"] = desc(['Ctrl+i'], "ui", _("Show/hide Inspect
SHORTCUTS["toggle_lookup"] = desc(['Ctrl+l'], "ui", _("Show/hide the or"));
word lookup panel")); sc["toggle_lookup"] = desc(['Ctrl+l'], "ui", _("Show/hide the word l
ookup panel"));
quit_shortcut = (ismacos) ? "Meta+q" : "Ctrl+q"; quit_shortcut = (ismacos) ? "Meta+q" : "Ctrl+q";
SHORTCUTS["quit"] = desc(quit_shortcut, "ui", _("Quit the viewer")); sc["quit"] = desc(quit_shortcut, "ui", _("Quit the viewer"));
sc["print"] = desc("Ctrl+P", "ui", _("Print book to PDF"));
}; };
function create_shortcut_map(custom_shortcuts) { function create_shortcut_map(custom_shortcuts) {
var ans, entry, shortcuts, sc, sc_name; var ans, scd, entry, shortcuts, sc, sc_name;
ans = Object.create(null); ans = Object.create(null);
var ρσ_Iter4 = ρσ_Iterable(Object.keys(SHORTCUTS)); scd = shortcuts_definition();
var ρσ_Iter4 = ρσ_Iterable(Object.keys(scd));
for (var ρσ_Index4 = 0; ρσ_Index4 < ρσ_Iter4.length; ρσ_Index4++) { for (var ρσ_Index4 = 0; ρσ_Index4 < ρσ_Iter4.length; ρσ_Index4++) {
sc_name = ρσ_Iter4[ρσ_Index4]; sc_name = ρσ_Iter4[ρσ_Index4];
entry = SHORTCUTS[(typeof sc_name === "number" && sc_name < 0) ? SHORTCUTS.length + sc_name : sc_name]; entry = scd[(typeof sc_name === "number" && sc_name < 0) ? scd.l ength + sc_name : sc_name];
shortcuts = entry.shortcuts; shortcuts = entry.shortcuts;
if (custom_shortcuts && custom_shortcuts[(typeof sc_name === "nu mber" && sc_name < 0) ? custom_shortcuts.length + sc_name : sc_name]) { if (custom_shortcuts && custom_shortcuts[(typeof sc_name === "nu mber" && sc_name < 0) ? custom_shortcuts.length + sc_name : sc_name]) {
shortcuts = custom_shortcuts[(typeof sc_name === "number" && sc_name < 0) ? custom_shortcuts.length + sc_name : sc_name]; shortcuts = custom_shortcuts[(typeof sc_name === "number" && sc_name < 0) ? custom_shortcuts.length + sc_name : sc_name];
} }
var ρσ_Iter5 = ρσ_Iterable(shortcuts); var ρσ_Iter5 = ρσ_Iterable(shortcuts);
for (var ρσ_Index5 = 0; ρσ_Index5 < ρσ_Iter5.length; ρσ_Index5++ ) { for (var ρσ_Index5 = 0; ρσ_Index5 < ρσ_Iter5.length; ρσ_Index5++ ) {
sc = ρσ_Iter5[ρσ_Index5]; sc = ρσ_Iter5[ρσ_Index5];
ans[ρσ_bound_index(keyevent_to_index(sc), ans)] = sc_name; ans[ρσ_bound_index(keyevent_to_index(sc), ans)] = sc_name;
} }
} }
skipping to change at line 15595 skipping to change at line 15934
function shortcut_for_key_event(evt, shortcut_map) { function shortcut_for_key_event(evt, shortcut_map) {
var idx; var idx;
idx = keyevent_to_index(evt); idx = keyevent_to_index(evt);
return shortcut_map[(typeof idx === "number" && idx < 0) ? shortcut_ map.length + idx : idx]; return shortcut_map[(typeof idx === "number" && idx < 0) ? shortcut_ map.length + idx : idx];
}; };
if (!shortcut_for_key_event.__argnames__) Object.defineProperties(shortc ut_for_key_event, { if (!shortcut_for_key_event.__argnames__) Object.defineProperties(shortc ut_for_key_event, {
__argnames__ : {value: ["evt", "shortcut_map"]} __argnames__ : {value: ["evt", "shortcut_map"]}
}); });
ρσ_modules["read_book.shortcuts"].GROUP_DESC = GROUP_DESC;
ρσ_modules["read_book.shortcuts"].SHORTCUTS = SHORTCUTS;
ρσ_modules["read_book.shortcuts"].parse_key_repr = parse_key_repr; ρσ_modules["read_book.shortcuts"].parse_key_repr = parse_key_repr;
ρσ_modules["read_book.shortcuts"].desc = desc; ρσ_modules["read_book.shortcuts"].desc = desc;
ρσ_modules["read_book.shortcuts"].keyevent_as_shortcut = keyevent_as_sho rtcut; ρσ_modules["read_book.shortcuts"].keyevent_as_shortcut = keyevent_as_sho rtcut;
ρσ_modules["read_book.shortcuts"].shortcut_differs = shortcut_differs; ρσ_modules["read_book.shortcuts"].shortcut_differs = shortcut_differs;
ρσ_modules["read_book.shortcuts"].get_key_text = get_key_text; ρσ_modules["read_book.shortcuts"].get_key_text = get_key_text;
ρσ_modules["read_book.shortcuts"].keyevent_to_index = keyevent_to_index; ρσ_modules["read_book.shortcuts"].keyevent_to_index = keyevent_to_index;
ρσ_modules["read_book.shortcuts"].key_as_text = key_as_text; ρσ_modules["read_book.shortcuts"].key_as_text = key_as_text;
ρσ_modules["read_book.shortcuts"].shortcuts_definition = shortcuts_defin
ition;
ρσ_modules["read_book.shortcuts"].shortcuts_group_desc = shortcuts_group
_desc;
ρσ_modules["read_book.shortcuts"].add_standalone_viewer_shortcuts = add_ standalone_viewer_shortcuts; ρσ_modules["read_book.shortcuts"].add_standalone_viewer_shortcuts = add_ standalone_viewer_shortcuts;
ρσ_modules["read_book.shortcuts"].create_shortcut_map = create_shortcut_ map; ρσ_modules["read_book.shortcuts"].create_shortcut_map = create_shortcut_ map;
ρσ_modules["read_book.shortcuts"].shortcut_for_key_event = shortcut_for_ key_event; ρσ_modules["read_book.shortcuts"].shortcut_for_key_event = shortcut_for_ key_event;
})(); })();
(function(){ (function(){
var __name__ = "complete"; var __name__ = "complete";
var ensure_id = ρσ_modules.dom.ensure_id; var ensure_id = ρσ_modules.dom.ensure_id;
var E = ρσ_modules.elementmaker.E; var E = ρσ_modules.elementmaker.E;
skipping to change at line 15810 skipping to change at line 16149
update_completion_items(); update_completion_items();
function trigger() { function trigger() {
var text, items, idx; var text, items, idx;
text = ewc.text_input.value; text = ewc.text_input.value;
ewc.hide_completion_popup(); ewc.hide_completion_popup();
action(text); action(text);
if (text && text.strip()) { if (text && text.strip()) {
items = local_storage().get(history_name) || []; items = local_storage().get(history_name) || [];
idx = items.indexOf(text); idx = items.indexOf(text);
if (idx > -1) { if (idx > -1) {
items = items.splice(idx, 1); items.splice(idx, 1);
} }
items.unshift(text); items.unshift(text);
local_storage().set(history_name, uniq(items.slice(0, histor y_size))); local_storage().set(history_name, uniq(items.slice(0, histor y_size)));
update_completion_items(); update_completion_items();
} }
}; };
ewc.onenterkey = trigger; ewc.onenterkey = trigger;
if (button) { if (button) {
ewc.add_associated_widget(button); ewc.add_associated_widget(button);
skipping to change at line 17124 skipping to change at line 17463
var apply_mathjax = ρσ_modules["read_book.mathjax"].apply_mathjax; var apply_mathjax = ρσ_modules["read_book.mathjax"].apply_mathjax;
var paged_anchor_funcs = ρσ_modules["read_book.paged_mode"].anchor_funcs ; var paged_anchor_funcs = ρσ_modules["read_book.paged_mode"].anchor_funcs ;
var calc_columns_per_screen = ρσ_modules["read_book.paged_mode"].calc_co lumns_per_screen; var calc_columns_per_screen = ρσ_modules["read_book.paged_mode"].calc_co lumns_per_screen;
var current_cfi = ρσ_modules["read_book.paged_mode"].current_cfi; var current_cfi = ρσ_modules["read_book.paged_mode"].current_cfi;
var paged_handle_gesture = ρσ_modules["read_book.paged_mode"].handle_ges ture; var paged_handle_gesture = ρσ_modules["read_book.paged_mode"].handle_ges ture;
var paged_handle_shortcut = ρσ_modules["read_book.paged_mode"].handle_sh ortcut; var paged_handle_shortcut = ρσ_modules["read_book.paged_mode"].handle_sh ortcut;
var paged_jump_to_cfi = ρσ_modules["read_book.paged_mode"].jump_to_cfi; var paged_jump_to_cfi = ρσ_modules["read_book.paged_mode"].jump_to_cfi;
var paged_layout = ρσ_modules["read_book.paged_mode"].layout; var paged_layout = ρσ_modules["read_book.paged_mode"].layout;
var paged_onwheel = ρσ_modules["read_book.paged_mode"].onwheel; var paged_onwheel = ρσ_modules["read_book.paged_mode"].onwheel;
var paged_prepare_for_resize = ρσ_modules["read_book.paged_mode"].prepar e_for_resize;
var progress_frac = ρσ_modules["read_book.paged_mode"].progress_frac; var progress_frac = ρσ_modules["read_book.paged_mode"].progress_frac;
var reset_paged_mode_globals = ρσ_modules["read_book.paged_mode"].reset_ paged_mode_globals; var reset_paged_mode_globals = ρσ_modules["read_book.paged_mode"].reset_ paged_mode_globals;
var paged_resize_done = ρσ_modules["read_book.paged_mode"].resize_done;
var paged_scroll_by_page = ρσ_modules["read_book.paged_mode"].scroll_by_ page; var paged_scroll_by_page = ρσ_modules["read_book.paged_mode"].scroll_by_ page;
var scroll_to_elem = ρσ_modules["read_book.paged_mode"].scroll_to_elem; var scroll_to_elem = ρσ_modules["read_book.paged_mode"].scroll_to_elem;
var paged_scroll_to_fraction = ρσ_modules["read_book.paged_mode"].scroll _to_fraction; var paged_scroll_to_fraction = ρσ_modules["read_book.paged_mode"].scroll _to_fraction;
var snap_to_selection = ρσ_modules["read_book.paged_mode"].snap_to_selec tion; var snap_to_selection = ρσ_modules["read_book.paged_mode"].snap_to_selec tion;
var finalize_resources = ρσ_modules["read_book.resources"].finalize_reso urces; var finalize_resources = ρσ_modules["read_book.resources"].finalize_reso urces;
var unserialize_html = ρσ_modules["read_book.resources"].unserialize_htm l; var unserialize_html = ρσ_modules["read_book.resources"].unserialize_htm l;
var apply_colors = ρσ_modules["read_book.settings"].apply_colors; var apply_colors = ρσ_modules["read_book.settings"].apply_colors;
var apply_font_size = ρσ_modules["read_book.settings"].apply_font_size; var apply_font_size = ρσ_modules["read_book.settings"].apply_font_size;
skipping to change at line 17239 skipping to change at line 17580
IframeBoss.prototype.__init__.apply(this, arguments); IframeBoss.prototype.__init__.apply(this, arguments);
} }
Object.defineProperty(IframeBoss.prototype, "__bind_methods__", {value: function () { Object.defineProperty(IframeBoss.prototype, "__bind_methods__", {value: function () {
this.set_forward_keypresses = IframeBoss.prototype.set_forward_keypr esses.bind(this); this.set_forward_keypresses = IframeBoss.prototype.set_forward_keypr esses.bind(this);
this.initialize = IframeBoss.prototype.initialize.bind(this); this.initialize = IframeBoss.prototype.initialize.bind(this);
this.onerror = IframeBoss.prototype.onerror.bind(this); this.onerror = IframeBoss.prototype.onerror.bind(this);
this.display = IframeBoss.prototype.display.bind(this); this.display = IframeBoss.prototype.display.bind(this);
this.on_scroll_to_frac = IframeBoss.prototype.on_scroll_to_frac.bind (this); this.on_scroll_to_frac = IframeBoss.prototype.on_scroll_to_frac.bind (this);
this.handle_gesture = IframeBoss.prototype.handle_gesture.bind(this) ; this.handle_gesture = IframeBoss.prototype.handle_gesture.bind(this) ;
this.gesture_from_margin = IframeBoss.prototype.gesture_from_margin. bind(this); this.gesture_from_margin = IframeBoss.prototype.gesture_from_margin. bind(this);
this.wheel_from_margin = IframeBoss.prototype.wheel_from_margin.bind (this);
this.report_human_scroll = IframeBoss.prototype.report_human_scroll. bind(this); this.report_human_scroll = IframeBoss.prototype.report_human_scroll. bind(this);
this.on_scroll_to_anchor = IframeBoss.prototype.on_scroll_to_anchor. bind(this); this.on_scroll_to_anchor = IframeBoss.prototype.on_scroll_to_anchor. bind(this);
this.on_next_screen = IframeBoss.prototype.on_next_screen.bind(this) ; this.on_next_screen = IframeBoss.prototype.on_next_screen.bind(this) ;
this.change_font_size = IframeBoss.prototype.change_font_size.bind(t his); this.change_font_size = IframeBoss.prototype.change_font_size.bind(t his);
this.change_stylesheet = IframeBoss.prototype.change_stylesheet.bind (this); this.change_stylesheet = IframeBoss.prototype.change_stylesheet.bind (this);
this.change_color_scheme = IframeBoss.prototype.change_color_scheme. bind(this); this.change_color_scheme = IframeBoss.prototype.change_color_scheme. bind(this);
this.content_loaded = IframeBoss.prototype.content_loaded.bind(this) ; this.content_loaded = IframeBoss.prototype.content_loaded.bind(this) ;
this.content_loaded_stage2 = IframeBoss.prototype.content_loaded_sta ge2.bind(this); this.content_loaded_stage2 = IframeBoss.prototype.content_loaded_sta ge2.bind(this);
this.calculate_progress_frac = IframeBoss.prototype.calculate_progre ss_frac.bind(this); this.calculate_progress_frac = IframeBoss.prototype.calculate_progre ss_frac.bind(this);
this.get_current_cfi = IframeBoss.prototype.get_current_cfi.bind(thi s); this.get_current_cfi = IframeBoss.prototype.get_current_cfi.bind(thi s);
skipping to change at line 17287 skipping to change at line 17629
handlers = (function(){ handlers = (function(){
var ρσ_d = Object.create(null); var ρσ_d = Object.create(null);
ρσ_d["initialize"] = self.initialize; ρσ_d["initialize"] = self.initialize;
ρσ_d["display"] = self.display; ρσ_d["display"] = self.display;
ρσ_d["scroll_to_anchor"] = self.on_scroll_to_anchor; ρσ_d["scroll_to_anchor"] = self.on_scroll_to_anchor;
ρσ_d["scroll_to_frac"] = self.on_scroll_to_frac; ρσ_d["scroll_to_frac"] = self.on_scroll_to_frac;
ρσ_d["next_screen"] = self.on_next_screen; ρσ_d["next_screen"] = self.on_next_screen;
ρσ_d["change_font_size"] = self.change_font_size; ρσ_d["change_font_size"] = self.change_font_size;
ρσ_d["change_color_scheme"] = self.change_color_scheme; ρσ_d["change_color_scheme"] = self.change_color_scheme;
ρσ_d["gesture_from_margin"] = self.gesture_from_margin; ρσ_d["gesture_from_margin"] = self.gesture_from_margin;
ρσ_d["wheel_from_margin"] = self.wheel_from_margin;
ρσ_d["find"] = self.find; ρσ_d["find"] = self.find;
ρσ_d["window_size"] = self.received_window_size; ρσ_d["window_size"] = self.received_window_size;
ρσ_d["get_current_cfi"] = self.get_current_cfi; ρσ_d["get_current_cfi"] = self.get_current_cfi;
ρσ_d["set_forward_keypresses"] = self.set_forward_keypresses; ρσ_d["set_forward_keypresses"] = self.set_forward_keypresses;
return ρσ_d; return ρσ_d;
}).call(this); }).call(this);
self.comm = new IframeClient(handlers); self.comm = new IframeClient(handlers);
self.last_window_ypos = 0; self.last_window_ypos = 0;
self.length_before = null; self.length_before = null;
}; };
skipping to change at line 17455 skipping to change at line 17798
if (!IframeBoss.prototype.handle_gesture.__argnames__) Object.defineProp erties(IframeBoss.prototype.handle_gesture, { if (!IframeBoss.prototype.handle_gesture.__argnames__) Object.defineProp erties(IframeBoss.prototype.handle_gesture, {
__argnames__ : {value: ["gesture"]} __argnames__ : {value: ["gesture"]}
}); });
IframeBoss.prototype.gesture_from_margin = function gesture_from_margin( data) { IframeBoss.prototype.gesture_from_margin = function gesture_from_margin( data) {
var self = this; var self = this;
self.handle_gesture(data.gesture); self.handle_gesture(data.gesture);
}; };
if (!IframeBoss.prototype.gesture_from_margin.__argnames__) Object.defin eProperties(IframeBoss.prototype.gesture_from_margin, { if (!IframeBoss.prototype.gesture_from_margin.__argnames__) Object.defin eProperties(IframeBoss.prototype.gesture_from_margin, {
__argnames__ : {value: ["data"]} __argnames__ : {value: ["data"]}
}); });
IframeBoss.prototype.wheel_from_margin = function wheel_from_margin(data
) {
var self = this;
self.onwheel(data.evt);
};
if (!IframeBoss.prototype.wheel_from_margin.__argnames__) Object.defineP
roperties(IframeBoss.prototype.wheel_from_margin, {
__argnames__ : {value: ["data"]}
});
IframeBoss.prototype.report_human_scroll = function report_human_scroll( scrolled_by_frac) { IframeBoss.prototype.report_human_scroll = function report_human_scroll( scrolled_by_frac) {
var self = this; var self = this;
ρσ_interpolate_kwargs.call(self, self.send_message, ["human_scroll"] .concat([ρσ_desugar_kwargs({scrolled_by_frac: scrolled_by_frac || null})])); ρσ_interpolate_kwargs.call(self, self.send_message, ["human_scroll"] .concat([ρσ_desugar_kwargs({scrolled_by_frac: scrolled_by_frac || null})]));
}; };
if (!IframeBoss.prototype.report_human_scroll.__argnames__) Object.defin eProperties(IframeBoss.prototype.report_human_scroll, { if (!IframeBoss.prototype.report_human_scroll.__argnames__) Object.defin eProperties(IframeBoss.prototype.report_human_scroll, {
__argnames__ : {value: ["scrolled_by_frac"]} __argnames__ : {value: ["scrolled_by_frac"]}
}); });
IframeBoss.prototype.on_scroll_to_anchor = function on_scroll_to_anchor( data) { IframeBoss.prototype.on_scroll_to_anchor = function on_scroll_to_anchor( data) {
var self = this; var self = this;
var frag; var frag;
skipping to change at line 17673 skipping to change at line 18023
if (self.content_ready) { if (self.content_ready) {
ρσ_interpolate_kwargs.call(self, self.send_message, ["selectionc hange"].concat([ρσ_desugar_kwargs({text: document.getSelection().toString()})])) ; ρσ_interpolate_kwargs.call(self, self.send_message, ["selectionc hange"].concat([ρσ_desugar_kwargs({text: document.getSelection().toString()})])) ;
} }
}; };
IframeBoss.prototype.onresize_stage2 = function onresize_stage2() { IframeBoss.prototype.onresize_stage2 = function onresize_stage2() {
var self = this; var self = this;
var ρσ_unpack, cfi; var ρσ_unpack, cfi;
if (scroll_viewport.width() === self.last_window_width && scroll_vie wport.height() === self.last_window_height) { if (scroll_viewport.width() === self.last_window_width && scroll_vie wport.height() === self.last_window_height) {
return; return;
} }
if (current_layout_mode() !== "flow") {
paged_prepare_for_resize(self.last_window_width, self.last_windo
w_height);
self.do_layout(self.is_titlepage);
}
ρσ_unpack = [scroll_viewport.width(), scroll_viewport.height()]; ρσ_unpack = [scroll_viewport.width(), scroll_viewport.height()];
self.last_window_width = ρσ_unpack[0]; self.last_window_width = ρσ_unpack[0];
self.last_window_height = ρσ_unpack[1]; self.last_window_height = ρσ_unpack[1];
if (current_layout_mode() !== "flow") {
self.do_layout();
}
if (self.last_cfi) { if (self.last_cfi) {
cfi = self.last_cfi.slice(len("epubcfi(/"), -1).partition("/")[2 ]; cfi = self.last_cfi.slice(len("epubcfi(/"), -1).partition("/")[2 ];
if (cfi) { if (cfi) {
paged_jump_to_cfi("/" + cfi); paged_jump_to_cfi("/" + cfi);
} }
} }
if (current_layout_mode() !== "flow") {
paged_resize_done();
}
self.update_cfi(); self.update_cfi();
self.update_toc_position(); self.update_toc_position();
}; };
IframeBoss.prototype.received_window_size = function received_window_siz e(data) { IframeBoss.prototype.received_window_size = function received_window_siz e(data) {
var self = this; var self = this;
scroll_viewport.update_window_size(data.width, data.height); scroll_viewport.update_window_size(data.width, data.height);
if (self.content_ready) { if (self.content_ready) {
self.onresize_stage2(); self.onresize_stage2();
} }
}; };
if (!IframeBoss.prototype.received_window_size.__argnames__) Object.defi neProperties(IframeBoss.prototype.received_window_size, { if (!IframeBoss.prototype.received_window_size.__argnames__) Object.defi neProperties(IframeBoss.prototype.received_window_size, {
__argnames__ : {value: ["data"]} __argnames__ : {value: ["data"]}
}); });
IframeBoss.prototype.onwheel = function onwheel(evt) { IframeBoss.prototype.onwheel = function onwheel(evt) {
var self = this; var self = this;
if (self.content_ready) { if (self.content_ready) {
evt.preventDefault(); if (evt.preventDefault) {
evt.preventDefault();
}
if (evt.deltaY && evt.ctrlKey && !evt.shiftKey && !evt.altKey && !evt.metaKey) { if (evt.deltaY && evt.ctrlKey && !evt.shiftKey && !evt.altKey && !evt.metaKey) {
ρσ_interpolate_kwargs.call(self, self.send_message, ["handle _shortcut"].concat([ρσ_desugar_kwargs({name: (evt.deltaY < 0) ? "increase_font_s ize" : "decrease_font_size"})])); ρσ_interpolate_kwargs.call(self, self.send_message, ["handle _shortcut"].concat([ρσ_desugar_kwargs({name: (evt.deltaY < 0) ? "increase_font_s ize" : "decrease_font_size"})]));
} else { } else {
self.handle_wheel(evt); self.handle_wheel(evt);
} }
} }
}; };
if (!IframeBoss.prototype.onwheel.__argnames__) Object.defineProperties( IframeBoss.prototype.onwheel, { if (!IframeBoss.prototype.onwheel.__argnames__) Object.defineProperties( IframeBoss.prototype.onwheel, {
__argnames__ : {value: ["evt"]} __argnames__ : {value: ["evt"]}
}); });
skipping to change at line 18887 skipping to change at line 19243
}; };
if (!create_goto_panel.__argnames__) Object.defineProperties(create_goto _panel, { if (!create_goto_panel.__argnames__) Object.defineProperties(create_goto _panel, {
__argnames__ : {value: ["current_position_data", "book", "container" , "onclick"]} __argnames__ : {value: ["current_position_data", "book", "container" , "onclick"]}
}); });
function create_location_overlay(current_position_data, overlay, contain er) { function create_location_overlay(current_position_data, overlay, contain er) {
var container_id, current_cfi; var container_id, current_cfi;
container_id = ensure_id(container); container_id = ensure_id(container);
container.appendChild(ρσ_interpolate_kwargs.call(E, E.div, [ρσ_desug ar_kwargs({style: "margin: 0 1rem"})])); container.appendChild(ρσ_interpolate_kwargs.call(E, E.div, [ρσ_desug ar_kwargs({style: "margin: 0 1rem"})]));
container = container.lastChild; container = container.lastChild;
container.appendChild(ρσ_interpolate_kwargs.call(E, E.div, [E.h4(_(" Using book location (most accurate)"))].concat([ρσ_desugar_kwargs({style: "paddi ng-top: 1rem"})])));
current_cfi = current_position_data.cfi; current_cfi = current_position_data.cfi;
if (current_cfi) { if (current_cfi) {
container.lastChild.appendChild(ρσ_interpolate_kwargs.call(E, E. div, [ρσ_interpolate_kwargs.call(E, E.input, [ρσ_desugar_kwargs({type: "text", r eadonly: "readonly", value: _("Currently at: {}").format(current_cfi), name: "cu rrent_location", style: "border-width: 0; background-color: transparent; outline : none; flex-grow: 10; font-family: inherit"})]), ρσ_interpolate_kwargs.call(thi s, create_button, [_("Copy")].concat([ρσ_desugar_kwargs({action: function () { container.appendChild(ρσ_interpolate_kwargs.call(E, E.div, [ρσ_i nterpolate_kwargs.call(E, E.input, [ρσ_desugar_kwargs({type: "text", readonly: " readonly", value: _("Current location: {}").format(current_cfi), name: "current_ location", style: "border-width: 0; background-color: transparent; outline: none ; flex-grow: 10; font-family: inherit"})]), ρσ_interpolate_kwargs.call(this, cre ate_button, [_("Copy")].concat([ρσ_desugar_kwargs({action: function () {
var src, orig; var src, orig;
src = document.querySelector("#" + ρσ_str.format("{}", conta iner_id) + " [name=current_location]"); src = document.querySelector("#" + ρσ_str.format("{}", conta iner_id) + " [name=current_location]");
orig = src.value; orig = src.value;
src.value = current_cfi; src.value = current_cfi;
src.focus(); src.focus();
src.select(); src.select();
try { try {
document.execCommand("copy"); document.execCommand("copy");
} finally { } finally {
src.value = orig; src.value = orig;
src.blur(); src.blur();
} }
}})]))].concat([ρσ_desugar_kwargs({style: "margin: 1rem 0; displ ay: flex; align-items: baseline"})]))); }})]))].concat([ρσ_desugar_kwargs({style: "margin: 1rem; display : flex; align-items: baseline"})])));
} }
function goto_loc() { function goto_cfi(cfi) {
var src; if (ui_operations.goto_cfi(cfi)) {
src = document.querySelector("#" + ρσ_str.format("{}", container overlay.hide();
_id) + " [name=newloc]"); } else {
if (src.value) { error_dialog(_("No such location"), _("No location {} found"
if (ui_operations.goto_bookpos(src.value)) { ).format(cfi));
overlay.hide();
} else {
error_dialog(_("No such location"), _("No location {} fo
und").format(src.value));
}
} }
}; };
if (!goto_cfi.__argnames__) Object.defineProperties(goto_cfi, {
__argnames__ : {value: ["cfi"]}
});
container.lastChild.appendChild(ρσ_interpolate_kwargs.call(E, E.div,
[ρσ_interpolate_kwargs.call(E, E.div, [ρσ_interpolate_kwargs.call(E, E.label, [
_("Go to:")].concat([ρσ_desugar_kwargs({style: "margin-right: 1rem"})])), ρσ_int
erpolate_kwargs.call(E, E.input, [ρσ_desugar_kwargs({name: "newloc", type: "text
", style: "flex-grow: 10; margin-right: 1rem", onkeydown: (function() {
var ρσ_anonfunc = function (ev) {
if (ev.key === "Enter") {
goto_loc();
}
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfu
nc, {
__argnames__ : {value: ["ev"]}
});
return ρσ_anonfunc;
})()})]), E.span(" "), ρσ_interpolate_kwargs.call(this, create_butto
n, [_("Go")].concat([ρσ_desugar_kwargs({action: goto_loc})]))].concat([ρσ_desuga
r_kwargs({style: "display: flex; align-items: baseline"})]))].concat([ρσ_desugar
_kwargs({style: "margin: 1rem 0;"})])));
container.appendChild(ρσ_interpolate_kwargs.call(E, E.div, [E.h4(_("
Using book position"))].concat([ρσ_desugar_kwargs({style: "margin-top: 1rem; bor
der-top: solid 1px; padding-top: 1rem"})])));
if (current_position_data.book_length > 0) { if (current_position_data.book_length > 0) {
container.lastChild.appendChild(ρσ_interpolate_kwargs.call(E, E. div, [_("Currently at: {}").format(format_pos(current_position_data.progress_fra c, current_position_data.book_length))].concat([ρσ_desugar_kwargs({style: "margi n: 1rem 0"})]))); container.appendChild(ρσ_interpolate_kwargs.call(E, E.div, [_("C urrent position: {}").format(format_pos(current_position_data.progress_frac, cur rent_position_data.book_length))].concat([ρσ_desugar_kwargs({style: "margin: 1re m"})])));
} }
function goto_pos() { function goto_pos() {
var src, val; var src;
src = document.querySelector("#" + ρσ_str.format("{}", container src = document.querySelector("#" + ρσ_str.format("{}", container
_id) + " [name=newpos]"); _id) + " [name=newpos]").value;
val = max(0, min(1e3 * float(src.value) / current_position_data. if (!src) {
book_length, 1)); return;
ui_operations.goto_frac(val); }
overlay.hide(); if (src.indexOf("epubcfi(") === 0) {
return goto_cfi(src);
}
var ρσ_try_else_1 = false;
try {
ui_operations.goto_book_position(float(src));
ρσ_try_else_1 = true;
} catch (ρσ_Exception) {
ρσ_last_exception = ρσ_Exception;
{
error_dialog(_("Not a valid book position"), _("{} is no
t a valid book position").format(src));
}
}
if (ρσ_try_else_1) {
overlay.hide();
}
}; };
container.lastChild.appendChild(ρσ_interpolate_kwargs.call(E, E.div, [ρσ_interpolate_kwargs.call(E, E.div, [ρσ_interpolate_kwargs.call(E, E.label, [ _("Go to:")].concat([ρσ_desugar_kwargs({style: "margin-right: 1rem"})])), ρσ_int erpolate_kwargs.call(E, E.input, [ρσ_desugar_kwargs({name: "newpos", type: "numb er", min: "0", max: str(current_position_data.book_length), step: "0.1", style: "flex-grow: 10; margin-right: 1rem", onkeydown: (function() { container.appendChild(ρσ_interpolate_kwargs.call(E, E.div, [ρσ_inter polate_kwargs.call(E, E.div, [ρσ_interpolate_kwargs.call(E, E.label, [_("Go to:" )].concat([ρσ_desugar_kwargs({style: "margin-right: 1rem"})])), ρσ_interpolate_k wargs.call(E, E.input, [ρσ_desugar_kwargs({name: "newpos", type: "text", min: "0 ", max: str(current_position_data.book_length), step: "0.1", style: "flex-grow: 10; margin-right: 1rem", onkeydown: (function() {
var ρσ_anonfunc = function (ev) { var ρσ_anonfunc = function (ev) {
if (ev.key === "Enter") { if (ev.key === "Enter") {
goto_pos(); goto_pos();
} }
}; };
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfu nc, { if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfu nc, {
__argnames__ : {value: ["ev"]} __argnames__ : {value: ["ev"]}
}); });
return ρσ_anonfunc; return ρσ_anonfunc;
})()})]), E.span(" "), ρσ_interpolate_kwargs.call(this, create_butto })()})]), E.span(" "), ρσ_interpolate_kwargs.call(this, create_butto
n, [_("Go")].concat([ρσ_desugar_kwargs({action: goto_pos})]))].concat([ρσ_desuga n, [_("Go")].concat([ρσ_desugar_kwargs({action: goto_pos})]))].concat([ρσ_desuga
r_kwargs({style: "display: flex; align-items: baseline"})]))].concat([ρσ_desugar r_kwargs({style: "display: flex; align-items: baseline"})]))].concat([ρσ_desugar
_kwargs({style: "margin: 1rem 0;"})]))); _kwargs({style: "margin: 1rem;"})])));
container.querySelector("[name=newpos]").focus();
}; };
if (!create_location_overlay.__argnames__) Object.defineProperties(creat e_location_overlay, { if (!create_location_overlay.__argnames__) Object.defineProperties(creat e_location_overlay, {
__argnames__ : {value: ["current_position_data", "overlay", "contain er"]} __argnames__ : {value: ["current_position_data", "overlay", "contain er"]}
}); });
ρσ_modules["read_book.goto"].create_goto_list = create_goto_list; ρσ_modules["read_book.goto"].create_goto_list = create_goto_list;
ρσ_modules["read_book.goto"].get_next_section = get_next_section; ρσ_modules["read_book.goto"].get_next_section = get_next_section;
ρσ_modules["read_book.goto"].create_goto_panel = create_goto_panel; ρσ_modules["read_book.goto"].create_goto_panel = create_goto_panel;
ρσ_modules["read_book.goto"].create_location_overlay = create_location_o verlay; ρσ_modules["read_book.goto"].create_location_overlay = create_location_o verlay;
})(); })();
skipping to change at line 18998 skipping to change at line 19357
c = container.lastChild; c = container.lastChild;
items = ρσ_list_decorate([]); items = ρσ_list_decorate([]);
c.appendChild(ρσ_interpolate_kwargs.call(E, E.div, [_("Recently viewed books")].concat([ρσ_desugar_kwargs({style: "margin-top: 1rem"})]))); c.appendChild(ρσ_interpolate_kwargs.call(E, E.div, [_("Recently viewed books")].concat([ρσ_desugar_kwargs({style: "margin-top: 1rem"})])));
c.appendChild(E.div()); c.appendChild(E.div());
var ρσ_Iter0 = ρσ_Iterable(rl); var ρσ_Iter0 = ρσ_Iterable(rl);
for (var ρσ_Index0 = 0; ρσ_Index0 < ρσ_Iter0.length; ρσ_Index0++ ) { for (var ρσ_Index0 = 0; ρσ_Index0 < ρσ_Iter0.length; ρσ_Index0++ ) {
entry = ρσ_Iter0[ρσ_Index0]; entry = ρσ_Iter0[ρσ_Index0];
if (book && book.manifest.pathtoebook === entry.pathtoebook) { if (book && book.manifest.pathtoebook === entry.pathtoebook) {
continue; continue;
} }
fname = str.replace(entry.pathtoebook, "\\", "/"); if (typeof entry.pathtoebook !== "string") {
continue;
}
fname = entry.pathtoebook.replace(/\\/g, "/");
if (ρσ_in("/", fname)) { if (ρσ_in("/", fname)) {
fname = (ρσ_expr_temp = fname.rpartition("/"))[ρσ_expr_t emp.length-1]; fname = (ρσ_expr_temp = fname.rpartition("/"))[ρσ_expr_t emp.length-1];
} }
items.push(create_item(entry.title, ui_operations.ask_for_op en.bind(null, entry.pathtoebook), fname)); items.push(create_item(entry.title, ui_operations.ask_for_op en.bind(null, entry.pathtoebook), fname));
} }
create_item_list(c.lastChild, items); create_item_list(c.lastChild, items);
c.appendChild(ρσ_interpolate_kwargs.call(E, E.div, [ρσ_desugar_k wargs({style: "margin: 1rem"})])); c.appendChild(ρσ_interpolate_kwargs.call(E, E.div, [ρσ_desugar_k wargs({style: "margin: 1rem"})]));
c.lastChild.appendChild(ρσ_interpolate_kwargs.call(this, create_ button, [_("Clear recent list")].concat([ρσ_desugar_kwargs({action: clear_recent _list.bind(null, c.id)})]))); c.lastChild.appendChild(ρσ_interpolate_kwargs.call(this, create_ button, [_("Clear recent list")].concat([ρσ_desugar_kwargs({action: clear_recent _list.bind(null, c.id)})])));
} }
}; };
skipping to change at line 23152 skipping to change at line 23514
ans = FORMAT_PRIORITIES.indexOf(fmt); ans = FORMAT_PRIORITIES.indexOf(fmt);
if (ans < 0) { if (ans < 0) {
ans = FORMAT_PRIORITIES.length; ans = FORMAT_PRIORITIES.length;
} }
return ans; return ans;
}; };
if (!sort_formats_key.__argnames__) Object.defineProperties(sort_formats _key, { if (!sort_formats_key.__argnames__) Object.defineProperties(sort_formats _key, {
__argnames__ : {value: ["fmt"]} __argnames__ : {value: ["fmt"]}
}); });
function get_preferred_format(metadata, output_format, input_formats) { function get_preferred_format(metadata, output_format, input_formats, fo
var formats, f, fmt, q; r_download) {
var formats, f, fmt, found, q;
formats = metadata && metadata.formats || []; formats = metadata && metadata.formats || [];
formats = (function() { formats = (function() {
var ρσ_Iter = ρσ_Iterable(formats), ρσ_Result = [], f; var ρσ_Iter = ρσ_Iterable(formats), ρσ_Result = [], f;
for (var ρσ_Index = 0; ρσ_Index < ρσ_Iter.length; ρσ_Index++) { for (var ρσ_Index = 0; ρσ_Index < ρσ_Iter.length; ρσ_Index++) {
f = ρσ_Iter[ρσ_Index]; f = ρσ_Iter[ρσ_Index];
ρσ_Result.push(f.toUpperCase()); ρσ_Result.push(f.toUpperCase());
} }
ρσ_Result = ρσ_list_constructor(ρσ_Result); ρσ_Result = ρσ_list_constructor(ρσ_Result);
return ρσ_Result; return ρσ_Result;
})(); })();
fmt = (output_format === "PDF") ? "EPUB" : output_format; fmt = (output_format === "PDF") ? "EPUB" : output_format;
if (formats.length && formats.indexOf(fmt) === -1) { if (formats.length && formats.indexOf(fmt) === -1) {
var ρσ_Iter0 = ρσ_Iterable(ρσ_interpolate_kwargs.call(this, sort found = false;
ed, [formats].concat([ρσ_desugar_kwargs({key: sort_formats_key})]))); formats = ρσ_interpolate_kwargs.call(this, sorted, [formats].con
cat([ρσ_desugar_kwargs({key: sort_formats_key})]));
var ρσ_Iter0 = ρσ_Iterable(formats);
for (var ρσ_Index0 = 0; ρσ_Index0 < ρσ_Iter0.length; ρσ_Index0++ ) { for (var ρσ_Index0 = 0; ρσ_Index0 < ρσ_Iter0.length; ρσ_Index0++ ) {
q = ρσ_Iter0[ρσ_Index0]; q = ρσ_Iter0[ρσ_Index0];
if (input_formats[(typeof q === "number" && q < 0) ? input_f ormats.length + q : q]) { if (input_formats[(typeof q === "number" && q < 0) ? input_f ormats.length + q : q]) {
fmt = q; fmt = q;
found = true;
break; break;
} }
} }
if (for_download && !found && formats.length) {
fmt = formats[0];
}
} }
return fmt.toUpperCase(); return fmt.toUpperCase();
}; };
if (!get_preferred_format.__argnames__) Object.defineProperties(get_pref erred_format, { if (!get_preferred_format.__argnames__) Object.defineProperties(get_pref erred_format, {
__argnames__ : {value: ["metadata", "output_format", "input_formats" ]} __argnames__ : {value: ["metadata", "output_format", "input_formats" , "for_download"]}
}); });
IGNORED_FIELDS = (function(){ IGNORED_FIELDS = (function(){
var s = ρσ_set(); var s = ρσ_set();
s.jsset.add("title"); s.jsset.add("title");
s.jsset.add("sort"); s.jsset.add("sort");
s.jsset.add("uuid"); s.jsset.add("uuid");
s.jsset.add("id"); s.jsset.add("id");
s.jsset.add("urls_from_identifiers"); s.jsset.add("urls_from_identifiers");
s.jsset.add("lang_names"); s.jsset.add("lang_names");
skipping to change at line 23777 skipping to change at line 24145
var img; var img;
img = err.target; img = err.target;
if (img.parentNode) { if (img.parentNode) {
img.parentNode.style.display = "none"; img.parentNode.style.display = "none";
} }
}; };
if (!on_img_err.__argnames__) Object.defineProperties(on_img_err, { if (!on_img_err.__argnames__) Object.defineProperties(on_img_err, {
__argnames__ : {value: ["err"]} __argnames__ : {value: ["err"]}
}); });
function preferred_format(book_id) { function preferred_format(book_id, for_download) {
var interface_data; var interface_data;
interface_data = get_interface_data(); interface_data = get_interface_data();
return get_preferred_format(book_metadata(book_id), interface_data.o utput_format, interface_data.input_formats); return get_preferred_format(book_metadata(book_id), interface_data.o utput_format, interface_data.input_formats, for_download);
}; };
if (!preferred_format.__argnames__) Object.defineProperties(preferred_fo rmat, { if (!preferred_format.__argnames__) Object.defineProperties(preferred_fo rmat, {
__argnames__ : {value: ["book_id"]} __argnames__ : {value: ["book_id", "for_download"]}
}); });
function read_format(book_id, fmt) { function read_format(book_id, fmt) {
open_book(book_id, fmt); open_book(book_id, fmt);
}; };
if (!read_format.__argnames__) Object.defineProperties(read_format, { if (!read_format.__argnames__) Object.defineProperties(read_format, {
__argnames__ : {value: ["book_id", "fmt"]} __argnames__ : {value: ["book_id", "fmt"]}
}); });
function read_book(book_id) { function read_book(book_id) {
skipping to change at line 23811 skipping to change at line 24179
function download_format(book_id, fmt) { function download_format(book_id, fmt) {
window.location = download_url(book_id, fmt); window.location = download_url(book_id, fmt);
}; };
if (!download_format.__argnames__) Object.defineProperties(download_form at, { if (!download_format.__argnames__) Object.defineProperties(download_form at, {
__argnames__ : {value: ["book_id", "fmt"]} __argnames__ : {value: ["book_id", "fmt"]}
}); });
function download_book(book_id) { function download_book(book_id) {
var fmt; var fmt;
fmt = preferred_format(book_id); fmt = preferred_format(book_id, true);
download_format(book_id, fmt); download_format(book_id, fmt);
}; };
if (!download_book.__argnames__) Object.defineProperties(download_book, { if (!download_book.__argnames__) Object.defineProperties(download_book, {
__argnames__ : {value: ["book_id"]} __argnames__ : {value: ["book_id"]}
}); });
function next_book(book_id, delta) { function next_book(book_id, delta) {
var next_book_id, q; var next_book_id, q;
next_book_id = book_after(book_id, delta); next_book_id = book_after(book_id, delta);
if (next_book_id) { if (next_book_id) {
skipping to change at line 23860 skipping to change at line 24228
border_radius = 20; border_radius = 20;
imgdiv = ρσ_interpolate_kwargs.call(E, E.div, [ρσ_interpolate_kwargs .call(E, E.img, [ρσ_desugar_kwargs({alt: alt, title: alt, data_title: metadata.t itle, data_authors: authors, onclick: read_book.bind(null, book_id), style: "cur sor: pointer; border-radius: 20px; max-width: calc(100vw - 2em); max-height: cal c(100vh - 4ex - {}); display: block; width:auto; height:auto; border-radius: {}p x".format(get_font_size("title"), border_radius)})]), ρσ_interpolate_kwargs.call (E, E.div, [prev_next_button(true), prev_next_button()].concat([ρσ_desugar_kwarg s({style: "position: absolute; top:0; width: 100%; padding: " + ρσ_str.format("{ }", Math.floor(border_radius / 2)) + "px; box-sizing: border-box; font-size: 2re m; display: flex; justify-content: space-between; color: " + ρσ_str.format("{}", get_color("button-text")) + ""})]))].concat([ρσ_desugar_kwargs({style: "positio n: relative"})])); imgdiv = ρσ_interpolate_kwargs.call(E, E.div, [ρσ_interpolate_kwargs .call(E, E.img, [ρσ_desugar_kwargs({alt: alt, title: alt, data_title: metadata.t itle, data_authors: authors, onclick: read_book.bind(null, book_id), style: "cur sor: pointer; border-radius: 20px; max-width: calc(100vw - 2em); max-height: cal c(100vh - 4ex - {}); display: block; width:auto; height:auto; border-radius: {}p x".format(get_font_size("title"), border_radius)})]), ρσ_interpolate_kwargs.call (E, E.div, [prev_next_button(true), prev_next_button()].concat([ρσ_desugar_kwarg s({style: "position: absolute; top:0; width: 100%; padding: " + ρσ_str.format("{ }", Math.floor(border_radius / 2)) + "px; box-sizing: border-box; font-size: 2re m; display: flex; justify-content: space-between; color: " + ρσ_str.format("{}", get_color("button-text")) + ""})]))].concat([ρσ_desugar_kwargs({style: "positio n: relative"})]));
img = imgdiv.getElementsByTagName("img")[0]; img = imgdiv.getElementsByTagName("img")[0];
img.onerror = on_img_err; img.onerror = on_img_err;
img.src = cover_url(book_id); img.src = cover_url(book_id);
c = c.lastChild; c = c.lastChild;
c.appendChild(ρσ_interpolate_kwargs.call(E, E.div, [ρσ_interpolate_k wargs.call(E, E.div, [ρσ_desugar_kwargs({style: "margin-right: 1em; flex-grow: 3 ; max-width: 500px", data_book_id: "" + book_id})]), imgdiv].concat([ρσ_desugar_ kwargs({style: "display:flex; padding: 1ex 1em; align-items: flex-start; justify -content: flex-start; flex-wrap: wrap"})]))); c.appendChild(ρσ_interpolate_kwargs.call(E, E.div, [ρσ_interpolate_k wargs.call(E, E.div, [ρσ_desugar_kwargs({style: "margin-right: 1em; flex-grow: 3 ; max-width: 500px", data_book_id: "" + book_id})]), imgdiv].concat([ρσ_desugar_ kwargs({style: "display:flex; padding: 1ex 1em; align-items: flex-start; justify -content: flex-start; flex-wrap: wrap"})])));
container = c.lastChild.firstChild; container = c.lastChild.firstChild;
read_button = create_button(_("Read"), "book", read_book.bind(null, book_id), _("Read this book")); read_button = create_button(_("Read"), "book", read_book.bind(null, book_id), _("Read this book"));
fmt = preferred_format(book_id); fmt = preferred_format(book_id, true);
download_button = ρσ_interpolate_kwargs.call(this, create_button, [_ ("Download"), "cloud-download", download_url(book_id, fmt), _("Download this boo k in the {0} format ({1})").format(fmt, human_readable((ρσ_expr_temp = metadata. format_sizes)[(typeof fmt === "number" && fmt < 0) ? ρσ_expr_temp.length + fmt : fmt] || 0))].concat([ρσ_desugar_kwargs({download_filename: "" + ρσ_str.format(" {}", metadata.title) + "." + ρσ_str.format("{}", fmt.toLowerCase()) + ""})])); download_button = ρσ_interpolate_kwargs.call(this, create_button, [_ ("Download"), "cloud-download", download_url(book_id, fmt), _("Download this boo k in the {0} format ({1})").format(fmt, human_readable((ρσ_expr_temp = metadata. format_sizes)[(typeof fmt === "number" && fmt < 0) ? ρσ_expr_temp.length + fmt : fmt] || 0))].concat([ρσ_desugar_kwargs({download_filename: "" + ρσ_str.format(" {}", metadata.title) + "." + ρσ_str.format("{}", fmt.toLowerCase()) + ""})]));
row = ρσ_interpolate_kwargs.call(E, E.div, [read_button, "   ", down load_button].concat([ρσ_desugar_kwargs({style: "margin-bottom: 1ex"})])); row = ρσ_interpolate_kwargs.call(E, E.div, [read_button, "   ", down load_button].concat([ρσ_desugar_kwargs({style: "margin-bottom: 1ex"})]));
if (!metadata.formats || !metadata.formats.length) { if (!metadata.formats || !metadata.formats.length) {
row.style.display = "none"; row.style.display = "none";
} }
container.appendChild(row); container.appendChild(row);
md = ρσ_interpolate_kwargs.call(E, E.div, [ρσ_desugar_kwargs({style: "margin-bottom: 2ex"})]); md = ρσ_interpolate_kwargs.call(E, E.div, [ρσ_desugar_kwargs({style: "margin-bottom: 2ex"})]);
table = ρσ_interpolate_kwargs.call(E, E.table, [ρσ_desugar_kwargs({c lass_: "metadata"})]); table = ρσ_interpolate_kwargs.call(E, E.table, [ρσ_desugar_kwargs({c lass_: "metadata"})]);
container.appendChild(md); container.appendChild(md);
md.appendChild(table); md.appendChild(table);
skipping to change at line 24012 skipping to change at line 24380
} }
container = container.lastChild; container = container.lastChild;
clear(container); clear(container);
if (!load_status.ok) { if (!load_status.ok) {
report_load_failure(container); report_load_failure(container);
return; return;
} }
create_book_details(container); create_book_details(container);
}; };
function onkeydown(container_id, ev) { function onkeydown(container_id, close_action, ev) {
if (render_book.book_id) { if (render_book.book_id) {
if (!ev.altKey && !ev.ctrlKey && !ev.metaKey && !ev.shiftKey) { if (!ev.altKey && !ev.ctrlKey && !ev.metaKey && !ev.shiftKey) {
if (ev.key === "ArrowLeft") { if (ev.key === "ArrowLeft") {
next_book(render_book.book_id, -1); next_book(render_book.book_id, -1);
[ev.preventDefault(), ev.stopPropagation()]; [ev.preventDefault(), ev.stopPropagation()];
} else if (ev.key === "ArrowRight") { } else if (ev.key === "ArrowRight") {
next_book(render_book.book_id, 1); next_book(render_book.book_id, 1);
[ev.preventDefault(), ev.stopPropagation()]; [ev.preventDefault(), ev.stopPropagation()];
} else if (ev.key === "Escape") {
[ev.preventDefault(), ev.stopPropagation()];
close_action();
} }
} }
} }
}; };
if (!onkeydown.__argnames__) Object.defineProperties(onkeydown, { if (!onkeydown.__argnames__) Object.defineProperties(onkeydown, {
__argnames__ : {value: ["container_id", "ev"]} __argnames__ : {value: ["container_id", "close_action", "ev"]}
}); });
function init(container_id) { function init(container_id) {
var container, ρσ_unpack, close_action, close_icon, q, ca; var container, ρσ_unpack, close_action, close_icon, q, ca;
container = document.getElementById(container_id); container = document.getElementById(container_id);
ρσ_unpack = [back, "close"]; ρσ_unpack = [back, "close"];
close_action = ρσ_unpack[0]; close_action = ρσ_unpack[0];
close_icon = ρσ_unpack[1]; close_icon = ρσ_unpack[1];
q = parse_url_params(); q = parse_url_params();
ca = q.close_action; ca = q.close_action;
skipping to change at line 24055 skipping to change at line 24426
show_panel("book_list", (function(){ show_panel("book_list", (function(){
var ρσ_d = Object.create(null); var ρσ_d = Object.create(null);
ρσ_d["book_id"] = q.book_id; ρσ_d["book_id"] = q.book_id;
return ρσ_d; return ρσ_d;
}).call(this)); }).call(this));
}; };
} }
ρσ_interpolate_kwargs.call(this, create_top_bar, [container].concat( [ρσ_desugar_kwargs({title: _("Book details"), action: close_action, icon: close_ icon})])); ρσ_interpolate_kwargs.call(this, create_top_bar, [container].concat( [ρσ_desugar_kwargs({title: _("Book details"), action: close_action, icon: close_ icon})]));
window.scrollTo(0, 0); window.scrollTo(0, 0);
container.appendChild(ρσ_interpolate_kwargs.call(E, E.div, [ρσ_desug ar_kwargs({class_: CLASS_NAME, tabindex: "0"})])); container.appendChild(ρσ_interpolate_kwargs.call(E, E.div, [ρσ_desug ar_kwargs({class_: CLASS_NAME, tabindex: "0"})]));
container.lastChild.addEventListener("keydown", onkeydown.bind(null, container_id), (function(){ container.lastChild.addEventListener("keydown", onkeydown.bind(null, container_id, close_action), (function(){
var ρσ_d = Object.create(null); var ρσ_d = Object.create(null);
ρσ_d["passive"] = false; ρσ_d["passive"] = false;
ρσ_d["capture"] = true; ρσ_d["capture"] = true;
return ρσ_d; return ρσ_d;
}).call(this)); }).call(this));
container.lastChild.focus(); container.lastChild.focus();
container.lastChild.appendChild(ρσ_interpolate_kwargs.call(E, E.div, [_("Loading books from the calibre library, please wait...")].concat([ρσ_desuga r_kwargs({style: "margin: 1ex 1em"})]))); container.lastChild.appendChild(ρσ_interpolate_kwargs.call(E, E.div, [_("Loading books from the calibre library, please wait...")].concat([ρσ_desuga r_kwargs({style: "margin: 1ex 1em"})])));
conditional_timeout(container_id, 5, check_for_books_loaded); conditional_timeout(container_id, 5, check_for_books_loaded);
}; };
if (!init.__argnames__) Object.defineProperties(init, { if (!init.__argnames__) Object.defineProperties(init, {
skipping to change at line 24491 skipping to change at line 24862
function show_custom_size(ev) { function show_custom_size(ev) {
var c, child; var c, child;
c = element(CONTAINER); c = element(CONTAINER);
var ρσ_Iter0 = ρσ_Iterable(c.childNodes); var ρσ_Iter0 = ρσ_Iterable(c.childNodes);
for (var ρσ_Index0 = 0; ρσ_Index0 < ρσ_Iter0.length; ρσ_Index0++) { for (var ρσ_Index0 = 0; ρσ_Index0 < ρσ_Iter0.length; ρσ_Index0++) {
child = ρσ_Iter0[ρσ_Index0]; child = ρσ_Iter0[ρσ_Index0];
child.style.display = "none"; child.style.display = "none";
} }
c.lastChild.style.display = "block"; c.lastChild.style.display = "block";
c.lastChild.querySelector("input").focus();
}; };
if (!show_custom_size.__argnames__) Object.defineProperties(show_custom_ size, { if (!show_custom_size.__argnames__) Object.defineProperties(show_custom_ size, {
__argnames__ : {value: ["ev"]} __argnames__ : {value: ["ev"]}
}); });
function create_font_size_panel(container, close) { function create_font_size_panel(container, close) {
var quick, sd, cfs, sz; var quick, sd, cfs, sz;
container.appendChild(ρσ_interpolate_kwargs.call(E, E.div, [ρσ_desug ar_kwargs({id: CONTAINER, style: "margin:15vh auto; max-width: 500px; border-rad ius: 8px; border: solid 1px currentColor; padding:1ex 1rem", onclick: (function( ) { container.appendChild(ρσ_interpolate_kwargs.call(E, E.div, [ρσ_desug ar_kwargs({id: CONTAINER, style: "margin:15vh auto; max-width: 500px; border-rad ius: 8px; border: solid 1px currentColor; padding:1ex 1rem", onclick: (function( ) {
var ρσ_anonfunc = function (ev) { var ρσ_anonfunc = function (ev) {
[ev.preventDefault(), ev.stopPropagation()]; [ev.preventDefault(), ev.stopPropagation()];
skipping to change at line 24527 skipping to change at line 24899
var ρσ_anonfunc = function (ev) { var ρσ_anonfunc = function (ev) {
[set_quick_size(ev), close()]; [set_quick_size(ev), close()];
}; };
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_an onfunc, { if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_an onfunc, {
__argnames__ : {value: ["ev"]} __argnames__ : {value: ["ev"]}
}); });
return ρσ_anonfunc; return ρσ_anonfunc;
})()})]))].concat([ρσ_desugar_kwargs({display: "inline-block", f ont_size: sz + "px", padding: "5px", cursor: "pointer", border_radius: "2px"})]) )); })()})]))].concat([ρσ_desugar_kwargs({display: "inline-block", f ont_size: sz + "px", padding: "5px", cursor: "pointer", border_radius: "2px"})]) ));
} }
container.appendChild(ρσ_interpolate_kwargs.call(E, E.div, [ρσ_inter polate_kwargs.call(E, E.a, [_("Custom size")].concat([ρσ_desugar_kwargs({class_: "blue-link", href: "javascript:void", onclick: show_custom_size, style: "cursor :pointer"})]))].concat([ρσ_desugar_kwargs({style: "text-align: right; font-size: smaller; margin-top: 2ex"})]))); container.appendChild(ρσ_interpolate_kwargs.call(E, E.div, [ρσ_inter polate_kwargs.call(E, E.a, [_("Custom size")].concat([ρσ_desugar_kwargs({class_: "blue-link", href: "javascript:void", onclick: show_custom_size, style: "cursor :pointer"})]))].concat([ρσ_desugar_kwargs({style: "text-align: right; font-size: smaller; margin-top: 2ex"})])));
container.appendChild(ρσ_interpolate_kwargs.call(E, E.div, [E.div(E. container.appendChild(ρσ_interpolate_kwargs.call(E, E.div, [E.div(E.
label(_("Font size (pixels):"), " ", ρσ_interpolate_kwargs.call(E, E.input, [ρσ_ label(_("Font size (pixels):"), " ", ρσ_interpolate_kwargs.call(E, E.input, [ρσ_
desugar_kwargs({type: "number", min: 8, max: 60, step: 1, value: str(sd.get("bas desugar_kwargs({type: "number", min: 8, max: 60, step: 1, value: sd.get("base_fo
e_font_size"))})]))), ρσ_interpolate_kwargs.call(E, E.div, [create_button(_("OK" nt_size") + "", onkeydown: (function() {
), "check", function () { var ρσ_anonfunc = function (evt) {
if (evt.key === "Enter") {
evt.preventDefault();
[set_custom_size(), close()];
}
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfu
nc, {
__argnames__ : {value: ["evt"]}
});
return ρσ_anonfunc;
})()})]))), ρσ_interpolate_kwargs.call(E, E.div, [create_button(_("O
K"), "check", function () {
[set_custom_size(), close()]; [set_custom_size(), close()];
}), E.span(" "), ρσ_interpolate_kwargs.call(this, create_button, [_( "Cancel")].concat([ρσ_desugar_kwargs({action: close})]))].concat([ρσ_desugar_kwa rgs({style: "text-align:right; margin-top:1ex; display:flex; justify-content: fl ex-end"})]))].concat([ρσ_desugar_kwargs({style: "display:none"})]))); }), E.span(" "), ρσ_interpolate_kwargs.call(this, create_button, [_( "Cancel")].concat([ρσ_desugar_kwargs({action: close})]))].concat([ρσ_desugar_kwa rgs({style: "text-align:right; margin-top:1ex; display:flex; justify-content: fl ex-end"})]))].concat([ρσ_desugar_kwargs({style: "display:none"})])));
}; };
if (!create_font_size_panel.__argnames__) Object.defineProperties(create _font_size_panel, { if (!create_font_size_panel.__argnames__) Object.defineProperties(create _font_size_panel, {
__argnames__ : {value: ["container", "close"]} __argnames__ : {value: ["container", "close"]}
}); });
function develop(container) { function develop(container) {
create_font_size_panel(container, function () { create_font_size_panel(container, function () {
}); });
skipping to change at line 25108 skipping to change at line 25491
var get_session_data = ρσ_modules["book_list.globals"].get_session_data; var get_session_data = ρσ_modules["book_list.globals"].get_session_data;
var create_item = ρσ_modules["book_list.item_list"].create_item; var create_item = ρσ_modules["book_list.item_list"].create_item;
var create_item_list = ρσ_modules["book_list.item_list"].create_item_lis t; var create_item_list = ρσ_modules["book_list.item_list"].create_item_lis t;
var clear = ρσ_modules.dom.clear; var clear = ρσ_modules.dom.clear;
var svgicon = ρσ_modules.dom.svgicon; var svgicon = ρσ_modules.dom.svgicon;
var unique_id = ρσ_modules.dom.unique_id; var unique_id = ρσ_modules.dom.unique_id;
var GROUP_DESC = ρσ_modules["read_book.shortcuts"].GROUP_DESC;
var SHORTCUTS = ρσ_modules["read_book.shortcuts"].SHORTCUTS;
var key_as_text = ρσ_modules["read_book.shortcuts"].key_as_text; var key_as_text = ρσ_modules["read_book.shortcuts"].key_as_text;
var keyevent_as_shortcut = ρσ_modules["read_book.shortcuts"].keyevent_as _shortcut; var keyevent_as_shortcut = ρσ_modules["read_book.shortcuts"].keyevent_as _shortcut;
var shortcut_differs = ρσ_modules["read_book.shortcuts"].shortcut_differ s; var shortcut_differs = ρσ_modules["read_book.shortcuts"].shortcut_differ s;
var shortcuts_definition = ρσ_modules["read_book.shortcuts"].shortcuts_d
efinition;
var shortcuts_group_desc = ρσ_modules["read_book.shortcuts"].shortcuts_g
roup_desc;
var create_button = ρσ_modules.widgets.create_button; var create_button = ρσ_modules.widgets.create_button;
function get_container() { function get_container() {
return document.getElementById(get_container.id); return document.getElementById(get_container.id);
}; };
function restore_defaults(close_func) { function restore_defaults(close_func) {
var q, item; var q, item;
get_container().dataset.changed = "true"; get_container().dataset.changed = "true";
var ρσ_Iter0 = ρσ_Iterable(get_container().querySelectorAll("[data-u ser-data]")); var ρσ_Iter0 = ρσ_Iterable(get_container().querySelectorAll("[data-u ser-data]"));
for (var ρσ_Index0 = 0; ρσ_Index0 < ρσ_Iter0.length; ρσ_Index0++) { for (var ρσ_Index0 = 0; ρσ_Index0 < ρσ_Iter0.length; ρσ_Index0++) {
item = ρσ_Iter0[ρσ_Index0]; item = ρσ_Iter0[ρσ_Index0];
q = JSON.parse(item.dataset.userData); q = JSON.parse(item.dataset.userData);
q.shortcuts = SHORTCUTS[ρσ_bound_index(q.name, SHORTCUTS)].short cuts; q.shortcuts = (ρσ_expr_temp = shortcuts_definition())[ρσ_bound_i ndex(q.name, ρσ_expr_temp)].shortcuts;
item.dataset.userData = JSON.stringify(q); item.dataset.userData = JSON.stringify(q);
} }
close_func(); close_func();
}; };
if (!restore_defaults.__argnames__) Object.defineProperties(restore_defa ults, { if (!restore_defaults.__argnames__) Object.defineProperties(restore_defa ults, {
__argnames__ : {value: ["close_func"]} __argnames__ : {value: ["close_func"]}
}); });
function as_groups(shortcuts) { function as_groups(shortcuts) {
var ans, sc, sc_name; var ans, sc, sc_name;
skipping to change at line 25288 skipping to change at line 25671
item = ρσ_Iter5[ρσ_Index5]; item = ρσ_Iter5[ρσ_Index5];
q = JSON.parse(item.dataset.userData); q = JSON.parse(item.dataset.userData);
if (q.name === sc_name) { if (q.name === sc_name) {
shortcuts = q.shortcuts; shortcuts = q.shortcuts;
break; break;
} }
} }
container = container.lastChild; container = container.lastChild;
clear(container); clear(container);
container.dataset.scName = sc_name; container.dataset.scName = sc_name;
sc = SHORTCUTS[(typeof sc_name === "number" && sc_name < 0) ? SHORTC UTS.length + sc_name : sc_name]; sc = (ρσ_expr_temp = shortcuts_definition())[(typeof sc_name === "nu mber" && sc_name < 0) ? ρσ_expr_temp.length + sc_name : sc_name];
container.appendChild(E.h4(sc.short)); container.appendChild(E.h4(sc.short));
if (sc.long) { if (sc.long) {
container.appendChild(ρσ_interpolate_kwargs.call(E, E.div, [sc.l ong].concat([ρσ_desugar_kwargs({style: "font-style: italic; font-size: smaller; margin-top: 1ex"})]))); container.appendChild(ρσ_interpolate_kwargs.call(E, E.div, [sc.l ong].concat([ρσ_desugar_kwargs({style: "font-style: italic; font-size: smaller; margin-top: 1ex"})])));
} }
container.appendChild(ρσ_interpolate_kwargs.call(E, E.div, [_("Exist ing shortcuts:")].concat([ρσ_desugar_kwargs({style: "margin-top: 1rem"})]))); container.appendChild(ρσ_interpolate_kwargs.call(E, E.div, [_("Exist ing shortcuts:")].concat([ρσ_desugar_kwargs({style: "margin-top: 1rem"})])));
key_con = container.appendChild(ρσ_interpolate_kwargs.call(E, E.tabl e, [ρσ_desugar_kwargs({class_: "key-container"})])); key_con = container.appendChild(ρσ_interpolate_kwargs.call(E, E.tabl e, [ρσ_desugar_kwargs({class_: "key-container"})]));
var ρσ_Iter6 = ρσ_Iterable(shortcuts); var ρσ_Iter6 = ρσ_Iterable(shortcuts);
for (var ρσ_Index6 = 0; ρσ_Index6 < ρσ_Iter6.length; ρσ_Index6++) { for (var ρσ_Index6 = 0; ρσ_Index6 < ρσ_Iter6.length; ρσ_Index6++) {
key = ρσ_Iter6[ρσ_Index6]; key = ρσ_Iter6[ρσ_Index6];
key_con.appendChild(key_widget(key)); key_con.appendChild(key_widget(key));
} }
container.appendChild(ρσ_interpolate_kwargs.call(E, E.div, [add_key_ widget()].concat([ρσ_desugar_kwargs({style: "margin-top:1ex;"})]))); container.appendChild(ρσ_interpolate_kwargs.call(E, E.div, [add_key_ widget()].concat([ρσ_desugar_kwargs({style: "margin-top:1ex;"})])));
container.appendChild(ρσ_interpolate_kwargs.call(E, E.div, [ρσ_inter polate_kwargs.call(this, create_button, [_("OK")].concat([ρσ_desugar_kwargs({act ion: close_customize_shortcut.bind(null, true)})])), E.span(" "), ρσ_interpolate _kwargs.call(this, create_button, [_("Cancel")].concat([ρσ_desugar_kwargs({actio n: close_customize_shortcut.bind(null, false)})]))].concat([ρσ_desugar_kwargs({s tyle: "margin-top:1ex; display:flex; justify-content: flex-end"})]))); container.appendChild(ρσ_interpolate_kwargs.call(E, E.div, [ρσ_inter polate_kwargs.call(this, create_button, [_("OK")].concat([ρσ_desugar_kwargs({act ion: close_customize_shortcut.bind(null, true)})])), E.span(" "), ρσ_interpolate _kwargs.call(this, create_button, [_("Cancel")].concat([ρσ_desugar_kwargs({actio n: close_customize_shortcut.bind(null, false)})]))].concat([ρσ_desugar_kwargs({s tyle: "margin-top:1ex; display:flex; justify-content: flex-end"})])));
}; };
if (!customize_shortcut.__argnames__) Object.defineProperties(customize_ shortcut, { if (!customize_shortcut.__argnames__) Object.defineProperties(customize_ shortcut, {
__argnames__ : {value: ["sc_name"]} __argnames__ : {value: ["sc_name"]}
}); });
function create_keyboard_panel(container, close_func, onchange) { function create_keyboard_panel(container, apply_func, cancel_func, oncha nge) {
var sd, custom_shortcuts, groups, group, items, sc, sc_name, group_n ame; var sd, custom_shortcuts, groups, group, items, sc, sc_name, group_n ame;
create_keyboard_panel.onchange = onchange; create_keyboard_panel.onchange = onchange;
container.appendChild(ρσ_interpolate_kwargs.call(E, E.div, [ρσ_desug ar_kwargs({id: unique_id("keyboard-settings"), style: "margin: 1rem"})])); container.appendChild(ρσ_interpolate_kwargs.call(E, E.div, [ρσ_desug ar_kwargs({id: unique_id("keyboard-settings"), style: "margin: 1rem"})]));
container = container.lastChild; container = container.lastChild;
container.dataset.changed = "false"; container.dataset.changed = "false";
get_container.id = container.id; get_container.id = container.id;
container.appendChild(E.div()); container.appendChild(E.div());
container.appendChild(ρσ_interpolate_kwargs.call(E, E.div, [ρσ_desug ar_kwargs({style: "display: none"})])); container.appendChild(ρσ_interpolate_kwargs.call(E, E.div, [ρσ_desug ar_kwargs({style: "display: none"})]));
container = container.firstChild; container = container.firstChild;
sd = get_session_data(); sd = get_session_data();
custom_shortcuts = sd.get("keyboard_shortcuts"); custom_shortcuts = sd.get("keyboard_shortcuts");
groups = as_groups(SHORTCUTS); groups = as_groups(shortcuts_definition());
var ρσ_Iter7 = ρσ_Iterable(Object.keys(groups)); var ρσ_Iter7 = ρσ_Iterable(Object.keys(groups));
for (var ρσ_Index7 = 0; ρσ_Index7 < ρσ_Iter7.length; ρσ_Index7++) { for (var ρσ_Index7 = 0; ρσ_Index7 < ρσ_Iter7.length; ρσ_Index7++) {
group_name = ρσ_Iter7[ρσ_Index7]; group_name = ρσ_Iter7[ρσ_Index7];
container.appendChild(ρσ_interpolate_kwargs.call(E, E.h3, [GROUP _DESC[(typeof group_name === "number" && group_name < 0) ? GROUP_DESC.length + g roup_name : group_name]].concat([ρσ_desugar_kwargs({style: "margin-top: 1ex"})]) )); container.appendChild(ρσ_interpolate_kwargs.call(E, E.h3, [(ρσ_e xpr_temp = shortcuts_group_desc())[(typeof group_name === "number" && group_name < 0) ? ρσ_expr_temp.length + group_name : group_name]].concat([ρσ_desugar_kwarg s({style: "margin-top: 1ex"})])));
group = groups[(typeof group_name === "number" && group_name < 0 ) ? groups.length + group_name : group_name]; group = groups[(typeof group_name === "number" && group_name < 0 ) ? groups.length + group_name : group_name];
items = ρσ_list_decorate([]); items = ρσ_list_decorate([]);
var ρσ_Iter8 = ρσ_Iterable(ρσ_interpolate_kwargs.call(this, sort ed, [Object.keys(group)].concat([ρσ_desugar_kwargs({key: sort_group_key.bind(nul l, group)})]))); var ρσ_Iter8 = ρσ_Iterable(ρσ_interpolate_kwargs.call(this, sort ed, [Object.keys(group)].concat([ρσ_desugar_kwargs({key: sort_group_key.bind(nul l, group)})])));
for (var ρσ_Index8 = 0; ρσ_Index8 < ρσ_Iter8.length; ρσ_Index8++ ) { for (var ρσ_Index8 = 0; ρσ_Index8 < ρσ_Iter8.length; ρσ_Index8++ ) {
sc_name = ρσ_Iter8[ρσ_Index8]; sc_name = ρσ_Iter8[ρσ_Index8];
sc = group[(typeof sc_name === "number" && sc_name < 0) ? gr oup.length + sc_name : sc_name]; sc = group[(typeof sc_name === "number" && sc_name < 0) ? gr oup.length + sc_name : sc_name];
items.push(sc_as_item(sc_name, sc, custom_shortcuts[(typeof sc_name === "number" && sc_name < 0) ? custom_shortcuts.length + sc_name : sc_na me])); items.push(sc_as_item(sc_name, sc, custom_shortcuts[(typeof sc_name === "number" && sc_name < 0) ? custom_shortcuts.length + sc_name : sc_na me]));
} }
container.appendChild(E.div()); container.appendChild(E.div());
create_item_list(container.lastChild, items); create_item_list(container.lastChild, items);
} }
container.appendChild(ρσ_interpolate_kwargs.call(E, E.div, [ρσ_inter polate_kwargs.call(this, create_button, [_("Restore defaults")].concat([ρσ_desug ar_kwargs({action: restore_defaults.bind(null, close_func)})]))].concat([ρσ_desu gar_kwargs({style: "margin-top: 1rem"})]))); container.appendChild(ρσ_interpolate_kwargs.call(E, E.div, [ρσ_inter polate_kwargs.call(this, create_button, [_("Restore defaults")].concat([ρσ_desug ar_kwargs({action: restore_defaults.bind(null, apply_func)})]))].concat([ρσ_desu gar_kwargs({style: "margin-top: 1rem"})])));
}; };
if (!create_keyboard_panel.__argnames__) Object.defineProperties(create_ keyboard_panel, { if (!create_keyboard_panel.__argnames__) Object.defineProperties(create_ keyboard_panel, {
__argnames__ : {value: ["container", "close_func", "onchange"]} __argnames__ : {value: ["container", "apply_func", "cancel_func", "o nchange"]}
}); });
develop = create_keyboard_panel; develop = create_keyboard_panel;
function shortcuts_differ(a, b) { function shortcuts_differ(a, b) {
var ρσ_unpack, x, y; var ρσ_unpack, x, y;
if (a.length !== b.length) { if (a.length !== b.length) {
return true; return true;
} }
var ρσ_Iter9 = ρσ_Iterable(zip(a, b)); var ρσ_Iter9 = ρσ_Iterable(zip(a, b));
for (var ρσ_Index9 = 0; ρσ_Index9 < ρσ_Iter9.length; ρσ_Index9++) { for (var ρσ_Index9 = 0; ρσ_Index9 < ρσ_Iter9.length; ρσ_Index9++) {
skipping to change at line 25370 skipping to change at line 25753
}); });
function commit_keyboard(onchange) { function commit_keyboard(onchange) {
var sd, vals, q, item; var sd, vals, q, item;
sd = get_session_data(); sd = get_session_data();
vals = Object.create(null); vals = Object.create(null);
var ρσ_Iter10 = ρσ_Iterable(get_container().querySelectorAll("[data- user-data]")); var ρσ_Iter10 = ρσ_Iterable(get_container().querySelectorAll("[data- user-data]"));
for (var ρσ_Index10 = 0; ρσ_Index10 < ρσ_Iter10.length; ρσ_Index10++ ) { for (var ρσ_Index10 = 0; ρσ_Index10 < ρσ_Iter10.length; ρσ_Index10++ ) {
item = ρσ_Iter10[ρσ_Index10]; item = ρσ_Iter10[ρσ_Index10];
q = JSON.parse(item.dataset.userData); q = JSON.parse(item.dataset.userData);
if (shortcuts_differ(q.shortcuts, SHORTCUTS[ρσ_bound_index(q.nam e, SHORTCUTS)].shortcuts)) { if (shortcuts_differ(q.shortcuts, (ρσ_expr_temp = shortcuts_defi nition())[ρσ_bound_index(q.name, ρσ_expr_temp)].shortcuts)) {
vals[ρσ_bound_index(q.name, vals)] = q.shortcuts; vals[ρσ_bound_index(q.name, vals)] = q.shortcuts;
} }
} }
sd.set("keyboard_shortcuts", vals); sd.set("keyboard_shortcuts", vals);
create_keyboard_panel.onchange = null; create_keyboard_panel.onchange = null;
if (get_container().dataset.changed === "true") { if (get_container().dataset.changed === "true") {
onchange(); onchange();
} }
}; };
if (!commit_keyboard.__argnames__) Object.defineProperties(commit_keyboa rd, { if (!commit_keyboard.__argnames__) Object.defineProperties(commit_keyboa rd, {
skipping to change at line 25710 skipping to change at line 26093
var defaults = ρσ_modules.session.defaults; var defaults = ρσ_modules.session.defaults;
var create_button_box = ρσ_modules["read_book.prefs.utils"].create_butto n_box; var create_button_box = ρσ_modules["read_book.prefs.utils"].create_butto n_box;
CONTAINER = unique_id("standalone-misc-settings"); CONTAINER = unique_id("standalone-misc-settings");
DEFAULTS = (function(){ DEFAULTS = (function(){
var ρσ_d = Object.create(null); var ρσ_d = Object.create(null);
ρσ_d["remember_window_geometry"] = false; ρσ_d["remember_window_geometry"] = false;
ρσ_d["remember_last_read"] = true; ρσ_d["remember_last_read"] = true;
ρσ_d["show_actions_toolbar"] = false;
ρσ_d["save_annotations_in_ebook"] = true; ρσ_d["save_annotations_in_ebook"] = true;
ρσ_d["singleinstance"] = false; ρσ_d["singleinstance"] = false;
return ρσ_d; return ρσ_d;
}).call(this); }).call(this);
function restore_defaults() { function restore_defaults() {
var container, q; var container, q;
container = get_container(); container = get_container();
var ρσ_Iter0 = ρσ_Iterable(Object.keys(DEFAULTS)); var ρσ_Iter0 = ρσ_Iterable(Object.keys(DEFAULTS));
for (var ρσ_Index0 = 0; ρσ_Index0 < ρσ_Iter0.length; ρσ_Index0++) { for (var ρσ_Index0 = 0; ρσ_Index0 < ρσ_Iter0.length; ρσ_Index0++) {
q = ρσ_Iter0[ρσ_Index0]; q = ρσ_Iter0[ρσ_Index0];
skipping to change at line 25747 skipping to change at line 26131
var ans; var ans;
ans = ρσ_interpolate_kwargs.call(E, E.input, [ρσ_desugar_kwargs( {type: "checkbox", name: name})]); ans = ρσ_interpolate_kwargs.call(E, E.input, [ρσ_desugar_kwargs( {type: "checkbox", name: name})]);
ans.checked = (typeof settings[(typeof name === "number" && name < 0) ? settings.length + name : name] === "boolean") ? settings[(typeof name == = "number" && name < 0) ? settings.length + name : name] : DEFAULTS[(typeof name === "number" && name < 0) ? DEFAULTS.length + name : name]; ans.checked = (typeof settings[(typeof name === "number" && name < 0) ? settings.length + name : name] === "boolean") ? settings[(typeof name == = "number" && name < 0) ? settings.length + name : name] : DEFAULTS[(typeof name === "number" && name < 0) ? DEFAULTS.length + name : name];
return ρσ_interpolate_kwargs.call(E, E.div, [E.label(ans, " " + text)].concat([ρσ_desugar_kwargs({style: "margin-top:1ex"})])); return ρσ_interpolate_kwargs.call(E, E.div, [E.label(ans, " " + text)].concat([ρσ_desugar_kwargs({style: "margin-top:1ex"})]));
}; };
if (!cb.__argnames__) Object.defineProperties(cb, { if (!cb.__argnames__) Object.defineProperties(cb, {
__argnames__ : {value: ["name", "text"]} __argnames__ : {value: ["name", "text"]}
}); });
container.append(cb("remember_window_geometry", _("Remember last use d window size and position"))); container.append(cb("remember_window_geometry", _("Remember last use d window size and position")));
container.append(cb("show_actions_toolbar", _("Show a toolbar with t he most useful actions")));
container.append(cb("remember_last_read", _("Remember current page w hen quitting"))); container.append(cb("remember_last_read", _("Remember current page w hen quitting")));
container.append(cb("save_annotations_in_ebook", _("Keep a copy of a nnotations/bookmarks in the e-book file, for easy sharing"))); container.append(cb("save_annotations_in_ebook", _("Keep a copy of a nnotations/bookmarks in the e-book file, for easy sharing")));
container.append(cb("singleinstance", _("Allow only a single instanc e of the viewer (needs restart)"))); container.append(cb("singleinstance", _("Allow only a single instanc e of the viewer (needs restart)")));
container.append(cb("hide_tooltips", _("Hide mouse-over tooltips in the book text"))); container.append(cb("hide_tooltips", _("Hide mouse-over tooltips in the book text")));
container.appendChild(create_button_box(restore_defaults, apply_func , cancel_func)); container.appendChild(create_button_box(restore_defaults, apply_func , cancel_func));
}; };
if (!create_misc_panel.__argnames__) Object.defineProperties(create_misc _panel, { if (!create_misc_panel.__argnames__) Object.defineProperties(create_misc _panel, {
__argnames__ : {value: ["container", "apply_func", "cancel_func"]} __argnames__ : {value: ["container", "apply_func", "cancel_func"]}
}); });
skipping to change at line 26092 skipping to change at line 26477
which = self.stack.pop(); which = self.stack.pop();
close_func = getattr(self, "close_" + which, null); close_func = getattr(self, "close_" + which, null);
if (close_func) { if (close_func) {
close_func.bind(self)(); close_func.bind(self)();
} }
self.display_panel((ρσ_expr_temp = self.stack)[ρσ_expr_temp.leng th-1]); self.display_panel((ρσ_expr_temp = self.stack)[ρσ_expr_temp.leng th-1]);
} else { } else {
self.close_func(); self.close_func();
} }
}; };
Prefs.prototype.create_panel = function create_panel(container, which, c reate_func) { Prefs.prototype.create_panel = function create_panel(container, which, c reate_func, needs_onchange) {
var self = this; var self = this;
document.getElementById(self.title_id).textContent = (ρσ_expr_temp = self.title_map)[(typeof which === "number" && which < 0) ? ρσ_expr_temp.length + which : which] || which; document.getElementById(self.title_id).textContent = (ρσ_expr_temp = self.title_map)[(typeof which === "number" && which < 0) ? ρσ_expr_temp.length + which : which] || which;
create_func(container, self.onclose, self.cancel); if (needs_onchange) {
create_func(container, self.onclose, self.cancel, self.onchange)
;
} else {
create_func(container, self.onclose, self.cancel);
}
}; };
if (!Prefs.prototype.create_panel.__argnames__) Object.defineProperties( Prefs.prototype.create_panel, { if (!Prefs.prototype.create_panel.__argnames__) Object.defineProperties( Prefs.prototype.create_panel, {
__argnames__ : {value: ["container", "which", "create_func"]} __argnames__ : {value: ["container", "which", "create_func", "needs_ onchange"]}
}); });
Prefs.prototype.display_panel = function display_panel(which) { Prefs.prototype.display_panel = function display_panel(which) {
var self = this; var self = this;
var container; var container;
container = self.container; container = self.container;
clear(container); clear(container);
getattr(self, "display_" + which)(container); getattr(self, "display_" + which)(container);
}; };
if (!Prefs.prototype.display_panel.__argnames__) Object.defineProperties (Prefs.prototype.display_panel, { if (!Prefs.prototype.display_panel.__argnames__) Object.defineProperties (Prefs.prototype.display_panel, {
__argnames__ : {value: ["which"]} __argnames__ : {value: ["which"]}
skipping to change at line 26217 skipping to change at line 26606
}; };
if (!Prefs.prototype.display_head_foot.__argnames__) Object.defineProper ties(Prefs.prototype.display_head_foot, { if (!Prefs.prototype.display_head_foot.__argnames__) Object.defineProper ties(Prefs.prototype.display_head_foot, {
__argnames__ : {value: ["container"]} __argnames__ : {value: ["container"]}
}); });
Prefs.prototype.close_head_foot = function close_head_foot() { Prefs.prototype.close_head_foot = function close_head_foot() {
var self = this; var self = this;
commit_head_foot(self.onchange, self.container); commit_head_foot(self.onchange, self.container);
}; };
Prefs.prototype.display_keyboard = function display_keyboard(container) { Prefs.prototype.display_keyboard = function display_keyboard(container) {
var self = this; var self = this;
self.create_panel(container, "keyboard", create_keyboard_panel); self.create_panel(container, "keyboard", create_keyboard_panel, true );
}; };
if (!Prefs.prototype.display_keyboard.__argnames__) Object.definePropert ies(Prefs.prototype.display_keyboard, { if (!Prefs.prototype.display_keyboard.__argnames__) Object.definePropert ies(Prefs.prototype.display_keyboard, {
__argnames__ : {value: ["container"]} __argnames__ : {value: ["container"]}
}); });
Prefs.prototype.close_keyboard = function close_keyboard() { Prefs.prototype.close_keyboard = function close_keyboard() {
var self = this; var self = this;
commit_keyboard(self.onchange, self.container); commit_keyboard(self.onchange, self.container);
}; };
Prefs.prototype.display_scrolling = function display_scrolling(container ) { Prefs.prototype.display_scrolling = function display_scrolling(container ) {
var self = this; var self = this;
skipping to change at line 26752 skipping to change at line 27141
if (d.device !== dev && d.epoch > epoch) { if (d.device !== dev && d.epoch > epoch) {
epoch = d.epoch; epoch = d.epoch;
ans = d; ans = d;
} }
} }
} }
} }
if (ans !== null) { if (ans !== null) {
cfi = ans.cfi; cfi = ans.cfi;
if (cfi) { if (cfi) {
self.overlay.view.goto_bookpos(cfi); self.overlay.view.goto_cfi(cfi);
} }
} }
}; };
if (!SyncBook.prototype.sync_data_received.__argnames__) Object.definePr operties(SyncBook.prototype.sync_data_received, { if (!SyncBook.prototype.sync_data_received.__argnames__) Object.definePr operties(SyncBook.prototype.sync_data_received, {
__argnames__ : {value: ["library_id", "lrmap", "load_type", "xhr", " ev"]} __argnames__ : {value: ["library_id", "lrmap", "load_type", "xhr", " ev"]}
}); });
SyncBook.prototype.__repr__ = function __repr__ () { SyncBook.prototype.__repr__ = function __repr__ () {
return "<" + __name__ + "." + this.constructor.name + " #" + this.ρσ_object_id + ">"; return "<" + __name__ + "." + this.constructor.name + " #" + this.ρσ_object_id + ">";
}; };
SyncBook.prototype.__str__ = function __str__ () { SyncBook.prototype.__str__ = function __str__ () {
skipping to change at line 26923 skipping to change at line 27312
} }
if (self.elements.link) { if (self.elements.link) {
copy_actions.appendChild(ac(_("Copy link"), _("Copy the curr ent link"), function () { copy_actions.appendChild(ac(_("Copy link"), _("Copy the curr ent link"), function () {
[self.overlay.hide(), ui_operations.copy_selection(self. elements.link)]; [self.overlay.hide(), ui_operations.copy_selection(self. elements.link)];
}, "link")); }, "link"));
} }
if (self.elements.img) { if (self.elements.img) {
copy_actions.appendChild(ac(_("View image"), _("View the cur rent image"), function () { copy_actions.appendChild(ac(_("View image"), _("View the cur rent image"), function () {
[self.overlay.hide(), ui_operations.view_image(self.elem ents.img)]; [self.overlay.hide(), ui_operations.view_image(self.elem ents.img)];
}, "image")); }, "image"));
copy_actions.appendChild(ac(_("Copy image"), _("View the cur rent image"), function () { copy_actions.appendChild(ac(_("Copy image"), _("Copy the cur rent image"), function () {
[self.overlay.hide(), ui_operations.copy_image(self.elem ents.img)]; [self.overlay.hide(), ui_operations.copy_image(self.elem ents.img)];
}, "copy")); }, "copy"));
} }
if (copy_actions.childNodes.length) { if (copy_actions.childNodes.length) {
actions_div.appendChild(copy_actions); actions_div.appendChild(copy_actions);
} }
actions_div.appendChild(E.ul(ac(_("Inspector"), _("Show the cont ent inspector"), function () { actions_div.appendChild(E.ul(ac(_("Inspector"), _("Show the cont ent inspector"), function () {
[self.overlay.hide(), ui_operations.toggle_inspector()]; [self.overlay.hide(), ui_operations.toggle_inspector()];
}, "bug"))); }, "bug"), ac(_("Reset interface"), _("Reset viewer panels, tool
bars and scrollbars to defaults"), function () {
[self.overlay.hide(), ui_operations.reset_interface()];
}, "remove")));
} }
container.appendChild(ρσ_interpolate_kwargs.call(this, set_css, [ρσ_ interpolate_kwargs.call(E, E.div, [ρσ_interpolate_kwargs.call(this, set_css, [E. div(ρσ_interpolate_kwargs.call(E, E.div, [self.overlay.view.book.metadata.title] .concat([ρσ_desugar_kwargs({style: "max-width: 90%; text-overflow: ellipsis; fon t-weight: bold; white-space: nowrap"})])), ρσ_interpolate_kwargs.call(E, E.div, [self.date_formatter.format(new Date)].concat([ρσ_desugar_kwargs({id: self.timer _id, style: "max-width: 9%; text-overflow: ellipsis; white-space: nowrap"})])))] .concat([ρσ_desugar_kwargs({display: "flex", justify_content: "space-between", a lign_items: "baseline", font_size: "smaller", padding: "0.5ex 1rem", border_bott om: "solid 1px currentColor"})])), actions_div].concat([ρσ_desugar_kwargs({class _: MAIN_OVERLAY_TS_CLASS, onclick: (function() { container.appendChild(ρσ_interpolate_kwargs.call(this, set_css, [ρσ_ interpolate_kwargs.call(E, E.div, [ρσ_interpolate_kwargs.call(this, set_css, [E. div(ρσ_interpolate_kwargs.call(E, E.div, [self.overlay.view.book.metadata.title] .concat([ρσ_desugar_kwargs({style: "max-width: 90%; text-overflow: ellipsis; fon t-weight: bold; white-space: nowrap"})])), ρσ_interpolate_kwargs.call(E, E.div, [self.date_formatter.format(new Date)].concat([ρσ_desugar_kwargs({id: self.timer _id, style: "max-width: 9%; text-overflow: ellipsis; white-space: nowrap"})])))] .concat([ρσ_desugar_kwargs({display: "flex", justify_content: "space-between", a lign_items: "baseline", font_size: "smaller", padding: "0.5ex 1rem", border_bott om: "solid 1px currentColor"})])), actions_div].concat([ρσ_desugar_kwargs({class _: MAIN_OVERLAY_TS_CLASS, onclick: (function() {
var ρσ_anonfunc = function (evt) { var ρσ_anonfunc = function (evt) {
evt.stopPropagation(); evt.stopPropagation();
}; };
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfu nc, { if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfu nc, {
__argnames__ : {value: ["evt"]} __argnames__ : {value: ["evt"]}
}); });
return ρσ_anonfunc; return ρσ_anonfunc;
})()})]))].concat([ρσ_desugar_kwargs({user_select: "none", backgroun d_color: get_color("window-background")})]))); })()})]))].concat([ρσ_desugar_kwargs({user_select: "none", backgroun d_color: get_color("window-background")})])));
skipping to change at line 27134 skipping to change at line 27525
Object.defineProperty(WordActionsOverlay.prototype, "__bases__", {value: []}); Object.defineProperty(WordActionsOverlay.prototype, "__bases__", {value: []});
function PrefsOverlay() { function PrefsOverlay() {
if (this.ρσ_object_id === undefined) Object.defineProperty(this, "ρσ _object_id", {"value":++ρσ_object_counter}); if (this.ρσ_object_id === undefined) Object.defineProperty(this, "ρσ _object_id", {"value":++ρσ_object_counter});
PrefsOverlay.prototype.__bind_methods__.call(this); PrefsOverlay.prototype.__bind_methods__.call(this);
PrefsOverlay.prototype.__init__.apply(this, arguments); PrefsOverlay.prototype.__init__.apply(this, arguments);
} }
Object.defineProperty(PrefsOverlay.prototype, "__bind_methods__", {value : function () { Object.defineProperty(PrefsOverlay.prototype, "__bind_methods__", {value : function () {
this.on_container_click = PrefsOverlay.prototype.on_container_click. bind(this); this.on_container_click = PrefsOverlay.prototype.on_container_click. bind(this);
this.show = PrefsOverlay.prototype.show.bind(this); this.show = PrefsOverlay.prototype.show.bind(this);
this.on_change = PrefsOverlay.prototype.on_change.bind(this);
this.handle_escape = PrefsOverlay.prototype.handle_escape.bind(this) ; this.handle_escape = PrefsOverlay.prototype.handle_escape.bind(this) ;
this.on_hide = PrefsOverlay.prototype.on_hide.bind(this); this.on_hide = PrefsOverlay.prototype.on_hide.bind(this);
}}); }});
PrefsOverlay.prototype.__init__ = function __init__(overlay) { PrefsOverlay.prototype.__init__ = function __init__(overlay) {
var self = this; var self = this;
self.overlay = overlay; self.overlay = overlay;
self.changes_occurred = false; self.changes_occurred = false;
}; };
if (!PrefsOverlay.prototype.__init__.__argnames__) Object.defineProperti es(PrefsOverlay.prototype.__init__, { if (!PrefsOverlay.prototype.__init__.__argnames__) Object.defineProperti es(PrefsOverlay.prototype.__init__, {
__argnames__ : {value: ["overlay"]} __argnames__ : {value: ["overlay"]}
skipping to change at line 27157 skipping to change at line 27549
PrefsOverlay.prototype.on_container_click = function on_container_click( evt) { PrefsOverlay.prototype.on_container_click = function on_container_click( evt) {
var self = this; var self = this;
}; };
if (!PrefsOverlay.prototype.on_container_click.__argnames__) Object.defi neProperties(PrefsOverlay.prototype.on_container_click, { if (!PrefsOverlay.prototype.on_container_click.__argnames__) Object.defi neProperties(PrefsOverlay.prototype.on_container_click, {
__argnames__ : {value: ["evt"]} __argnames__ : {value: ["evt"]}
}); });
PrefsOverlay.prototype.show = function show(container) { PrefsOverlay.prototype.show = function show(container) {
var self = this; var self = this;
self.changes_occurred = false; self.changes_occurred = false;
container.style.backgroundColor = get_color("window-background"); container.style.backgroundColor = get_color("window-background");
self.prefs = create_prefs_panel(container, self.overlay.hide_current self.prefs = create_prefs_panel(container, self.overlay.hide_current
_panel, function () { _panel, self.on_change);
self.changes_occurred = true;
});
}; };
if (!PrefsOverlay.prototype.show.__argnames__) Object.defineProperties(P refsOverlay.prototype.show, { if (!PrefsOverlay.prototype.show.__argnames__) Object.defineProperties(P refsOverlay.prototype.show, {
__argnames__ : {value: ["container"]} __argnames__ : {value: ["container"]}
}); });
PrefsOverlay.prototype.on_change = function on_change() {
var self = this;
self.changes_occurred = true;
};
PrefsOverlay.prototype.handle_escape = function handle_escape() { PrefsOverlay.prototype.handle_escape = function handle_escape() {
var self = this; var self = this;
self.prefs.onclose(); self.prefs.onclose();
}; };
PrefsOverlay.prototype.on_hide = function on_hide() { PrefsOverlay.prototype.on_hide = function on_hide() {
var self = this; var self = this;
if (self.changes_occurred) { if (self.changes_occurred) {
self.changes_occurred = false; self.changes_occurred = false;
ui_operations.redisplay_book(); ui_operations.redisplay_book();
} }
skipping to change at line 27538 skipping to change at line 27932
if (!show_metadata_overlay.__argnames__) Object.defineProperties(sho w_metadata_overlay, { if (!show_metadata_overlay.__argnames__) Object.defineProperties(sho w_metadata_overlay, {
__argnames__ : {value: ["mi", "pathtoebook", "overlay", "contain er"]} __argnames__ : {value: ["mi", "pathtoebook", "overlay", "contain er"]}
}); });
self.panels.push(new SimpleOverlay(self, show_metadata_overlay.bind( null, self.view.book.metadata, self.view.book.manifest.pathtoebook), self.view.b ook.metadata.title)); self.panels.push(new SimpleOverlay(self, show_metadata_overlay.bind( null, self.view.book.metadata, self.view.book.manifest.pathtoebook), self.view.b ook.metadata.title));
self.show_current_panel(); self.show_current_panel();
}; };
Overlay.prototype.show_ask_for_location = function show_ask_for_location () { Overlay.prototype.show_ask_for_location = function show_ask_for_location () {
var self = this; var self = this;
self.hide_current_panel(); self.hide_current_panel();
self.panels.push(new SimpleOverlay(self, create_location_overlay.bin d(null, self.view.current_position_data), _("Go to location…"))); self.panels.push(new SimpleOverlay(self, create_location_overlay.bin d(null, self.view.current_position_data), _("Go to location or position…")));
self.show_current_panel(); self.show_current_panel();
}; };
Overlay.prototype.show_search = function show_search() { Overlay.prototype.show_search = function show_search() {
var self = this; var self = this;
self.hide(); self.hide();
self.view.show_search(); self.view.show_search();
}; };
Overlay.prototype.show_prefs = function show_prefs() { Overlay.prototype.show_prefs = function show_prefs() {
var self = this; var self = this;
self.hide_current_panel(); self.hide_current_panel();
skipping to change at line 28113 skipping to change at line 28507
View.prototype.__bind_methods__.call(this); View.prototype.__bind_methods__.call(this);
View.prototype.__init__.apply(this, arguments); View.prototype.__init__.apply(this, arguments);
} }
Object.defineProperty(View.prototype, "__bind_methods__", {value: functi on () { Object.defineProperty(View.prototype, "__bind_methods__", {value: functi on () {
this.on_lookup_word = View.prototype.on_lookup_word.bind(this); this.on_lookup_word = View.prototype.on_lookup_word.bind(this);
this.left_margin_clicked = View.prototype.left_margin_clicked.bind(t his); this.left_margin_clicked = View.prototype.left_margin_clicked.bind(t his);
this.right_margin_clicked = View.prototype.right_margin_clicked.bind (this); this.right_margin_clicked = View.prototype.right_margin_clicked.bind (this);
this.top_margin_clicked = View.prototype.top_margin_clicked.bind(thi s); this.top_margin_clicked = View.prototype.top_margin_clicked.bind(thi s);
this.bottom_margin_clicked = View.prototype.bottom_margin_clicked.bi nd(this); this.bottom_margin_clicked = View.prototype.bottom_margin_clicked.bi nd(this);
this.margin_context_menu = View.prototype.margin_context_menu.bind(t his); this.margin_context_menu = View.prototype.margin_context_menu.bind(t his);
this.on_margin_wheel = View.prototype.on_margin_wheel.bind(this);
this.forward_gesture = View.prototype.forward_gesture.bind(this); this.forward_gesture = View.prototype.forward_gesture.bind(this);
this.iframe_size = View.prototype.iframe_size.bind(this); this.iframe_size = View.prototype.iframe_size.bind(this);
this.on_request_size = View.prototype.on_request_size.bind(this); this.on_request_size = View.prototype.on_request_size.bind(this);
this.on_print = View.prototype.on_print.bind(this); this.on_print = View.prototype.on_print.bind(this);
this.on_human_scroll = View.prototype.on_human_scroll.bind(this); this.on_human_scroll = View.prototype.on_human_scroll.bind(this);
this.on_handle_keypress = View.prototype.on_handle_keypress.bind(thi s); this.on_handle_keypress = View.prototype.on_handle_keypress.bind(thi s);
this.handle_keypress = View.prototype.handle_keypress.bind(this); this.handle_keypress = View.prototype.handle_keypress.bind(this);
this.overlay_visibility_changed = View.prototype.overlay_visibility_ changed.bind(this); this.overlay_visibility_changed = View.prototype.overlay_visibility_ changed.bind(this);
this.on_handle_shortcut = View.prototype.on_handle_shortcut.bind(thi s); this.on_handle_shortcut = View.prototype.on_handle_shortcut.bind(thi s);
this.on_selection_change = View.prototype.on_selection_change.bind(t his); this.on_selection_change = View.prototype.on_selection_change.bind(t his);
skipping to change at line 28151 skipping to change at line 28546
this.show_loading = View.prototype.show_loading.bind(this); this.show_loading = View.prototype.show_loading.bind(this);
this.hide_loading = View.prototype.hide_loading.bind(this); this.hide_loading = View.prototype.hide_loading.bind(this);
this.parse_cfi = View.prototype.parse_cfi.bind(this); this.parse_cfi = View.prototype.parse_cfi.bind(this);
this.display_book = View.prototype.display_book.bind(this); this.display_book = View.prototype.display_book.bind(this);
this.redisplay_book = View.prototype.redisplay_book.bind(this); this.redisplay_book = View.prototype.redisplay_book.bind(this);
this.iframe_settings = View.prototype.iframe_settings.bind(this); this.iframe_settings = View.prototype.iframe_settings.bind(this);
this.show_name = View.prototype.show_name.bind(this); this.show_name = View.prototype.show_name.bind(this);
this.load_doc = View.prototype.load_doc.bind(this); this.load_doc = View.prototype.load_doc.bind(this);
this.goto_doc_boundary = View.prototype.goto_doc_boundary.bind(this) ; this.goto_doc_boundary = View.prototype.goto_doc_boundary.bind(this) ;
this.goto_frac = View.prototype.goto_frac.bind(this); this.goto_frac = View.prototype.goto_frac.bind(this);
this.goto_book_position = View.prototype.goto_book_position.bind(thi s);
this.on_scroll_to_anchor = View.prototype.on_scroll_to_anchor.bind(t his); this.on_scroll_to_anchor = View.prototype.on_scroll_to_anchor.bind(t his);
this.goto_bookpos = View.prototype.goto_bookpos.bind(this); this.goto_cfi = View.prototype.goto_cfi.bind(this);
this.goto_named_destination = View.prototype.goto_named_destination. bind(this); this.goto_named_destination = View.prototype.goto_named_destination. bind(this);
this.goto_toc_node = View.prototype.goto_toc_node.bind(this); this.goto_toc_node = View.prototype.goto_toc_node.bind(this);
this.on_next_spine_item = View.prototype.on_next_spine_item.bind(thi s); this.on_next_spine_item = View.prototype.on_next_spine_item.bind(thi s);
this.on_next_section = View.prototype.on_next_section.bind(this); this.on_next_section = View.prototype.on_next_section.bind(this);
this.get_current_cfi = View.prototype.get_current_cfi.bind(this); this.get_current_cfi = View.prototype.get_current_cfi.bind(this);
this.update_cfi_data = View.prototype.update_cfi_data.bind(this); this.update_cfi_data = View.prototype.update_cfi_data.bind(this);
this.on_report_cfi = View.prototype.on_report_cfi.bind(this); this.on_report_cfi = View.prototype.on_report_cfi.bind(this);
this.on_update_progress_frac = View.prototype.on_update_progress_fra c.bind(this); this.on_update_progress_frac = View.prototype.on_update_progress_fra c.bind(this);
this.on_update_cfi = View.prototype.on_update_cfi.bind(this); this.on_update_cfi = View.prototype.on_update_cfi.bind(this);
this.update_header_footer = View.prototype.update_header_footer.bind (this); this.update_header_footer = View.prototype.update_header_footer.bind (this);
skipping to change at line 28227 skipping to change at line 28623
var ρσ_d = Object.create(null); var ρσ_d = Object.create(null);
ρσ_d["clock"] = 0; ρσ_d["clock"] = 0;
return ρσ_d; return ρσ_d;
}).call(this); }).call(this);
self.book_scrollbar = new BookScrollbar(self); self.book_scrollbar = new BookScrollbar(self);
sd = get_session_data(); sd = get_session_data();
self.keyboard_shortcut_map = create_shortcut_map(sd.get("keyboard_sh ortcuts")); self.keyboard_shortcut_map = create_shortcut_map(sd.get("keyboard_sh ortcuts"));
if (ui_operations.export_shortcut_map) { if (ui_operations.export_shortcut_map) {
ui_operations.export_shortcut_map(self.keyboard_shortcut_map); ui_operations.export_shortcut_map(self.keyboard_shortcut_map);
} }
left_margin = ρσ_interpolate_kwargs.call(E, E.div, [svgicon("caret-l eft")].concat([ρσ_desugar_kwargs({style: "width:{}px;".format(sd.get("margin_lef t", 20)), class_: "book-side-margin", id: "book-left-margin", onclick: self.left _margin_clicked, oncontextmenu: self.margin_context_menu.bind(null, "left")})])) ; left_margin = ρσ_interpolate_kwargs.call(E, E.div, [svgicon("caret-l eft")].concat([ρσ_desugar_kwargs({style: "width:{}px;".format(sd.get("margin_lef t", 20)), class_: "book-side-margin", id: "book-left-margin", onclick: self.left _margin_clicked, oncontextmenu: self.margin_context_menu.bind(null, "left"), onw heel: self.on_margin_wheel.bind(null, "left")})]));
set_left_margin_handler(left_margin); set_left_margin_handler(left_margin);
right_margin = ρσ_interpolate_kwargs.call(E, E.div, [svgicon("caret- right")].concat([ρσ_desugar_kwargs({style: "width:{}px;".format(sd.get("margin_r ight", 20)), class_: "book-side-margin", id: "book-right-margin", onclick: self. right_margin_clicked, oncontextmenu: self.margin_context_menu.bind(null, "right" )})])); right_margin = ρσ_interpolate_kwargs.call(E, E.div, [svgicon("caret- right")].concat([ρσ_desugar_kwargs({style: "width:{}px;".format(sd.get("margin_r ight", 20)), class_: "book-side-margin", id: "book-right-margin", onclick: self. right_margin_clicked, oncontextmenu: self.margin_context_menu.bind(null, "right" ), onwheel: self.on_margin_wheel.bind(null, "right")})]));
set_right_margin_handler(right_margin); set_right_margin_handler(right_margin);
iframe_id = unique_id("read-book-iframe"); iframe_id = unique_id("read-book-iframe");
sandbox = "allow-popups allow-scripts allow-popups-to-escape-sandbox "; sandbox = "allow-popups allow-scripts allow-popups-to-escape-sandbox ";
if (runtime.is_standalone_viewer) { if (runtime.is_standalone_viewer) {
sandbox += " allow-same-origin"; sandbox += " allow-same-origin";
} }
container.appendChild(ρσ_interpolate_kwargs.call(E, E.div, [ρσ_inter polate_kwargs.call(E, E.div, [ρσ_interpolate_kwargs.call(E, E.div, [left_margin, ρσ_interpolate_kwargs.call(E, E.div, [margin_elem(sd, "margin_top", "book-top-m argin", self.top_margin_clicked, self.margin_context_menu.bind(null, "top")), ρσ _interpolate_kwargs.call(E, E.iframe, [ρσ_desugar_kwargs({id: iframe_id, seamles s: true, sandbox: sandbox, style: "flex-grow: 2", allowfullscreen: "true"})]), m argin_elem(sd, "margin_bottom", "book-bottom-margin", self.bottom_margin_clicked , self.margin_context_menu.bind(null, "bottom"))].concat([ρσ_desugar_kwargs({sty le: "flex-grow:2; display:flex; align-items:stretch; flex-direction: column"})]) ), right_margin, self.book_scrollbar.create(), ρσ_interpolate_kwargs.call(E, E.d iv, [ρσ_desugar_kwargs({style: "position: absolute; top:0; left:0; width: 100%; pointer-events:none; display:none", id: "book-search-overlay"})]), ρσ_interpolat e_kwargs.call(E, E.div, [ρσ_desugar_kwargs({style: "position: absolute; top:0; l eft:0; width: 100%; height: 100%; display:none", id: "book-content-popup-overlay "})]), ρσ_interpolate_kwargs.call(E, E.div, [ρσ_desugar_kwargs({style: "position : absolute; top:0; left:0; width: 100%; height: 100%; display:none", id: "book-o verlay"})]), ρσ_interpolate_kwargs.call(E, E.div, [ρσ_desugar_kwargs({style: "po sition: absolute; top:0; left:0; width: 100%; height: 100%; display:none", id: " controls-help-overlay"})])].concat([ρσ_desugar_kwargs({style: "max-height: 100vh ; flex-grow: 2; display:flex; align-items: stretch"})]))].concat([ρσ_desugar_kwa rgs({style: "max-height: 100vh; display: flex; flex-direction: column; align-ite ms: stretch; flex-grow:2"})]))].concat([ρσ_desugar_kwargs({style: "max-height: 1 00vh; width: 100vw; height: 100vh; overflow: hidden; display: flex; align-items: stretch"})]))); container.appendChild(ρσ_interpolate_kwargs.call(E, E.div, [ρσ_inter polate_kwargs.call(E, E.div, [ρσ_interpolate_kwargs.call(E, E.div, [left_margin, ρσ_interpolate_kwargs.call(E, E.div, [margin_elem(sd, "margin_top", "book-top-m argin", self.top_margin_clicked, self.margin_context_menu.bind(null, "top")), ρσ _interpolate_kwargs.call(E, E.iframe, [ρσ_desugar_kwargs({id: iframe_id, seamles s: true, sandbox: sandbox, style: "flex-grow: 2", allowfullscreen: "true"})]), m argin_elem(sd, "margin_bottom", "book-bottom-margin", self.bottom_margin_clicked , self.margin_context_menu.bind(null, "bottom"))].concat([ρσ_desugar_kwargs({sty le: "flex-grow:2; display:flex; align-items:stretch; flex-direction: column"})]) ), right_margin, self.book_scrollbar.create(), ρσ_interpolate_kwargs.call(E, E.d iv, [ρσ_desugar_kwargs({style: "position: absolute; top:0; left:0; width: 100%; pointer-events:none; display:none", id: "book-search-overlay"})]), ρσ_interpolat e_kwargs.call(E, E.div, [ρσ_desugar_kwargs({style: "position: absolute; top:0; l eft:0; width: 100%; height: 100%; display:none", id: "book-content-popup-overlay "})]), ρσ_interpolate_kwargs.call(E, E.div, [ρσ_desugar_kwargs({style: "position : absolute; top:0; left:0; width: 100%; height: 100%; display:none", id: "book-o verlay"})]), ρσ_interpolate_kwargs.call(E, E.div, [ρσ_desugar_kwargs({style: "po sition: absolute; top:0; left:0; width: 100%; height: 100%; display:none", id: " controls-help-overlay"})])].concat([ρσ_desugar_kwargs({style: "max-height: 100vh ; flex-grow: 2; display:flex; align-items: stretch"})]))].concat([ρσ_desugar_kwa rgs({style: "max-height: 100vh; display: flex; flex-direction: column; align-ite ms: stretch; flex-grow:2"})]))].concat([ρσ_desugar_kwargs({style: "max-height: 1 00vh; width: 100vw; height: 100vh; overflow: hidden; display: flex; align-items: stretch"})])));
handlers = (function(){ handlers = (function(){
var ρσ_d = Object.create(null); var ρσ_d = Object.create(null);
ρσ_d["ready"] = self.on_iframe_ready; ρσ_d["ready"] = self.on_iframe_ready;
skipping to change at line 28368 skipping to change at line 28764
__argnames__ : {value: ["event"]} __argnames__ : {value: ["event"]}
}); });
View.prototype.margin_context_menu = function margin_context_menu(which, event) { View.prototype.margin_context_menu = function margin_context_menu(which, event) {
var self = this; var self = this;
[event.preventDefault(), event.stopPropagation()]; [event.preventDefault(), event.stopPropagation()];
self.show_chrome(); self.show_chrome();
}; };
if (!View.prototype.margin_context_menu.__argnames__) Object.definePrope rties(View.prototype.margin_context_menu, { if (!View.prototype.margin_context_menu.__argnames__) Object.definePrope rties(View.prototype.margin_context_menu, {
__argnames__ : {value: ["which", "event"]} __argnames__ : {value: ["which", "event"]}
}); });
View.prototype.on_margin_wheel = function on_margin_wheel(which, event)
{
var self = this;
var evt, attr;
event.preventDefault();
evt = Object.create(null);
var ρσ_Iter0 = ρσ_Iterable(ρσ_list_decorate([ "deltaX", "deltaY", "d
eltaMode", "altKey", "ctrlKey", "shiftKey", "metaKey" ]));
for (var ρσ_Index0 = 0; ρσ_Index0 < ρσ_Iter0.length; ρσ_Index0++) {
attr = ρσ_Iter0[ρσ_Index0];
evt[(typeof attr === "number" && attr < 0) ? evt.length + attr :
attr] = event[(typeof attr === "number" && attr < 0) ? event.length + attr : at
tr];
}
ρσ_interpolate_kwargs.call(self.iframe_wrapper, self.iframe_wrapper.
send_message, ["wheel_from_margin"].concat([ρσ_desugar_kwargs({evt: evt})]));
};
if (!View.prototype.on_margin_wheel.__argnames__) Object.definePropertie
s(View.prototype.on_margin_wheel, {
__argnames__ : {value: ["which", "event"]}
});
View.prototype.forward_gesture = function forward_gesture(gesture) { View.prototype.forward_gesture = function forward_gesture(gesture) {
var self = this; var self = this;
ρσ_interpolate_kwargs.call(self.iframe_wrapper, self.iframe_wrapper. send_message, ["gesture_from_margin"].concat([ρσ_desugar_kwargs({gesture: gestur e})])); ρσ_interpolate_kwargs.call(self.iframe_wrapper, self.iframe_wrapper. send_message, ["gesture_from_margin"].concat([ρσ_desugar_kwargs({gesture: gestur e})]));
}; };
if (!View.prototype.forward_gesture.__argnames__) Object.definePropertie s(View.prototype.forward_gesture, { if (!View.prototype.forward_gesture.__argnames__) Object.definePropertie s(View.prototype.forward_gesture, {
__argnames__ : {value: ["gesture"]} __argnames__ : {value: ["gesture"]}
}); });
View.prototype.iframe_size = function iframe_size() { View.prototype.iframe_size = function iframe_size() {
var self = this; var self = this;
var iframe, ρσ_unpack, l, r, w, t, b, h; var iframe, ρσ_unpack, l, r, w, t, b, h;
skipping to change at line 28474 skipping to change at line 28885
} else if (data.name === "show_chrome") { } else if (data.name === "show_chrome") {
self.show_chrome(); self.show_chrome();
} else if (data.name === "toggle_toc") { } else if (data.name === "toggle_toc") {
ui_operations.toggle_toc(); ui_operations.toggle_toc();
} else if (data.name === "toggle_bookmarks") { } else if (data.name === "toggle_bookmarks") {
ui_operations.toggle_bookmarks(); ui_operations.toggle_bookmarks();
} else if (data.name === "toggle_inspector") { } else if (data.name === "toggle_inspector") {
ui_operations.toggle_inspector(); ui_operations.toggle_inspector();
} else if (data.name === "toggle_lookup") { } else if (data.name === "toggle_lookup") {
ui_operations.toggle_lookup(); ui_operations.toggle_lookup();
} else if (data.name === "toggle_full_screen") {
ui_operations.toggle_full_screen();
} else if (data.name === "toggle_paged_mode") { } else if (data.name === "toggle_paged_mode") {
self.toggle_paged_mode(); self.toggle_paged_mode();
} else if (data.name === "quit") { } else if (data.name === "quit") {
ui_operations.quit(); ui_operations.quit();
} else if (data.name === "start_search") { } else if (data.name === "start_search") {
self.show_search(); self.show_search();
} else if (data.name === "next_match") { } else if (data.name === "next_match") {
self.search_overlay.find_next(); self.search_overlay.find_next();
} else if (data.name === "previous_match") { } else if (data.name === "previous_match") {
self.search_overlay.find_previous(); self.search_overlay.find_previous();
skipping to change at line 28517 skipping to change at line 28930
var ρσ_d = Object.create(null); var ρσ_d = Object.create(null);
ρσ_d["forward"] = true; ρσ_d["forward"] = true;
return ρσ_d; return ρσ_d;
}).call(this)); }).call(this));
} else if (data.name === "previous_section") { } else if (data.name === "previous_section") {
self.on_next_section((function(){ self.on_next_section((function(){
var ρσ_d = Object.create(null); var ρσ_d = Object.create(null);
ρσ_d["forward"] = false; ρσ_d["forward"] = false;
return ρσ_d; return ρσ_d;
}).call(this)); }).call(this));
} else if (data.name === "open_book") {
self.overlay.open_book();
} else if (data.name === "next") {
ρσ_interpolate_kwargs.call(self.iframe_wrapper, self.iframe_wrap
per.send_message, ["next_screen"].concat([ρσ_desugar_kwargs({backwards: false, a
ll_pages_on_screen: get_session_data().get("paged_margin_clicks_scroll_by_screen
")})]));
} else if (data.name === "previous") {
ρσ_interpolate_kwargs.call(self.iframe_wrapper, self.iframe_wrap
per.send_message, ["next_screen"].concat([ρσ_desugar_kwargs({backwards: true, al
l_pages_on_screen: get_session_data().get("paged_margin_clicks_scroll_by_screen"
)})]));
} else if (data.name === "print") {
ui_operations.print_book();
} else if (data.name === "preferences") {
self.overlay.show_prefs();
} else if (data.name === "metadata") {
self.overlay.show_metadata();
} else if (data.name === "goto_location") {
self.overlay.show_ask_for_location();
} }
}; };
if (!View.prototype.on_handle_shortcut.__argnames__) Object.defineProper ties(View.prototype.on_handle_shortcut, { if (!View.prototype.on_handle_shortcut.__argnames__) Object.defineProper ties(View.prototype.on_handle_shortcut, {
__argnames__ : {value: ["data"]} __argnames__ : {value: ["data"]}
}); });
View.prototype.on_selection_change = function on_selection_change(data) { View.prototype.on_selection_change = function on_selection_change(data) {
var self = this; var self = this;
self.currently_showing.selected_text = data.text; self.currently_showing.selected_text = data.text;
if (ui_operations.selection_changed) { if (ui_operations.selection_changed) {
ui_operations.selection_changed(data.text); ui_operations.selection_changed(data.text);
skipping to change at line 28567 skipping to change at line 28994
spine = self.book.manifest.spine; spine = self.book.manifest.spine;
idx = spine.indexOf(self.currently_showing.name); idx = spine.indexOf(self.currently_showing.name);
if (idx < 0) { if (idx < 0) {
ρσ_interpolate_kwargs.call(this, error_dialog, [_("Missing file" ), _("Could not search as the spine item {} is missing from the book").format(se lf.currently_showing.name)].concat([ρσ_desugar_kwargs({on_close: function () { ρσ_interpolate_kwargs.call(this, error_dialog, [_("Missing file" ), _("Could not search as the spine item {} is missing from the book").format(se lf.currently_showing.name)].concat([ρσ_desugar_kwargs({on_close: function () {
self.search_overlay.show(); self.search_overlay.show();
}})])); }})]));
return; return;
} }
names = []; names = [];
item_groups = (data.backwards) ? ρσ_list_decorate([ range(idx - 1, - 1, -1), range(spine.length - 1, idx, -1) ]) : ρσ_list_decorate([ range(idx + 1, spine.length), range(idx) ]); item_groups = (data.backwards) ? ρσ_list_decorate([ range(idx - 1, - 1, -1), range(spine.length - 1, idx, -1) ]) : ρσ_list_decorate([ range(idx + 1, spine.length), range(idx) ]);
var ρσ_Iter0 = ρσ_Iterable(item_groups); var ρσ_Iter1 = ρσ_Iterable(item_groups);
for (var ρσ_Index0 = 0; ρσ_Index0 < ρσ_Iter0.length; ρσ_Index0++) { for (var ρσ_Index1 = 0; ρσ_Index1 < ρσ_Iter1.length; ρσ_Index1++) {
items = ρσ_Iter0[ρσ_Index0]; items = ρσ_Iter1[ρσ_Index1];
var ρσ_Iter1 = ρσ_Iterable(items); var ρσ_Iter2 = ρσ_Iterable(items);
for (var ρσ_Index1 = 0; ρσ_Index1 < ρσ_Iter1.length; ρσ_Index1++ for (var ρσ_Index2 = 0; ρσ_Index2 < ρσ_Iter2.length; ρσ_Index2++
) { ) {
i = ρσ_Iter1[ρσ_Index1]; i = ρσ_Iter2[ρσ_Index2];
names.push(spine[(typeof i === "number" && i < 0) ? spine.le ngth + i : i]); names.push(spine[(typeof i === "number" && i < 0) ? spine.le ngth + i : i]);
} }
} }
find_in_spine(names, self.book, data.text, (function() { find_in_spine(names, self.book, data.text, (function() {
var ρσ_anonfunc = function (found_in) { var ρσ_anonfunc = function (found_in) {
if (found_in) { if (found_in) {
ρσ_interpolate_kwargs.call(self, self.show_name, [found_ in].concat([ρσ_desugar_kwargs({initial_position: (function(){ ρσ_interpolate_kwargs.call(self, self.show_name, [found_ in].concat([ρσ_desugar_kwargs({initial_position: (function(){
var ρσ_d = Object.create(null); var ρσ_d = Object.create(null);
ρσ_d["type"] = "search"; ρσ_d["type"] = "search";
ρσ_d["search_data"] = data; ρσ_d["search_data"] = data;
skipping to change at line 28735 skipping to change at line 29162
}; };
if (!View.prototype.on_iframe_error.__argnames__) Object.definePropertie s(View.prototype.on_iframe_error, { if (!View.prototype.on_iframe_error.__argnames__) Object.definePropertie s(View.prototype.on_iframe_error, {
__argnames__ : {value: ["data"]} __argnames__ : {value: ["data"]}
}); });
View.prototype.get_color_scheme = function get_color_scheme(apply_to_mar gins) { View.prototype.get_color_scheme = function get_color_scheme(apply_to_mar gins) {
var self = this; var self = this;
var ans, m, s, which, sd, iframe, bg_image; var ans, m, s, which, sd, iframe, bg_image;
ans = resolve_color_scheme(); ans = resolve_color_scheme();
self.current_color_scheme = ans; self.current_color_scheme = ans;
if (apply_to_margins) { if (apply_to_margins) {
var ρσ_Iter2 = ρσ_Iterable("left top right bottom".split(" ")); var ρσ_Iter3 = ρσ_Iterable("left top right bottom".split(" "));
for (var ρσ_Index2 = 0; ρσ_Index2 < ρσ_Iter2.length; ρσ_Index2++ for (var ρσ_Index3 = 0; ρσ_Index3 < ρσ_Iter3.length; ρσ_Index3++
) { ) {
which = ρσ_Iter2[ρσ_Index2]; which = ρσ_Iter3[ρσ_Index3];
m = document.getElementById("book-{}-margin".format(which)); m = document.getElementById("book-{}-margin".format(which));
s = m.style; s = m.style;
s.color = ans.foreground; s.color = ans.foreground;
s.backgroundColor = ans.background; s.backgroundColor = ans.background;
} }
sd = get_session_data(); sd = get_session_data();
iframe = self.iframe; iframe = self.iframe;
iframe.style.backgroundColor = ans.background || "white"; iframe.style.backgroundColor = ans.background || "white";
bg_image = sd.get("background_image"); bg_image = sd.get("background_image");
if (bg_image) { if (bg_image) {
skipping to change at line 28839 skipping to change at line 29266
if (typeof snum === "number") { if (typeof snum === "number") {
name = (ρσ_expr_temp = book.manifest.spine)[ρσ_bound_index(M ath.floor(int(snum) / 2) - 1, ρσ_expr_temp)] || name; name = (ρσ_expr_temp = book.manifest.spine)[ρσ_bound_index(M ath.floor(int(snum) / 2) - 1, ρσ_expr_temp)] || name;
cfi = "/" + rest; cfi = "/" + rest;
} }
} }
return [name, cfi]; return [name, cfi];
}; };
if (!View.prototype.parse_cfi.__argnames__) Object.defineProperties(View .prototype.parse_cfi, { if (!View.prototype.parse_cfi.__argnames__) Object.defineProperties(View .prototype.parse_cfi, {
__argnames__ : {value: ["encoded_cfi", "book"]} __argnames__ : {value: ["encoded_cfi", "book"]}
}); });
View.prototype.display_book = function display_book(book, initial_cfi, i nitial_toc_node) { View.prototype.display_book = function display_book(book, initial_cfi, i nitial_toc_node, initial_bookpos) {
var self = this; var self = this;
var is_current_book, pos, unkey, name, cfi, q, ρσ_unpack, cfiname, i nternal_cfi, navigated, sd, c; var is_current_book, pos, unkey, name, cfi, q, ρσ_unpack, cfiname, i nternal_cfi, navigated, sd, c;
self.hide_overlays(); self.hide_overlays();
self.iframe.focus(); self.iframe.focus();
is_current_book = self.book && (self.book.key === book.key || typeof self.book.key === "object" && ρσ_equals(self.book.key, book.key)); is_current_book = self.book && (self.book.key === book.key || typeof self.book.key === "object" && ρσ_equals(self.book.key, book.key));
self.book_load_started = true;
if (!is_current_book) { if (!is_current_book) {
self.iframe_wrapper.reset(); self.iframe_wrapper.reset();
self.content_popup_overlay.iframe_wrapper.reset(); self.content_popup_overlay.iframe_wrapper.reset();
self.loaded_resources = Object.create(null); self.loaded_resources = Object.create(null);
self.content_popup_overlay.loaded_resources = Object.create(null ); self.content_popup_overlay.loaded_resources = Object.create(null );
self.timers.start_book(book); self.timers.start_book(book);
} }
self.book = current_book.book = book; self.book = current_book.book = book;
if (runtime.is_standalone_viewer) { if (runtime.is_standalone_viewer) {
add_book_to_recently_viewed(book); add_book_to_recently_viewed(book);
skipping to change at line 28891 skipping to change at line 29319
if (cfiname && internal_cfi) { if (cfiname && internal_cfi) {
name = cfiname; name = cfiname;
ρσ_unpack = ["cfi", internal_cfi]; ρσ_unpack = ["cfi", internal_cfi];
pos.type = ρσ_unpack[0]; pos.type = ρσ_unpack[0];
pos.cfi = ρσ_unpack[1]; pos.cfi = ρσ_unpack[1];
} }
navigated = false; navigated = false;
if (typeof initial_toc_node === "number") { if (typeof initial_toc_node === "number") {
navigated = self.goto_toc_node(initial_toc_node); navigated = self.goto_toc_node(initial_toc_node);
} }
if (!navigated && typeof initial_bookpos === "number") {
navigated = true;
self.goto_book_position(initial_bookpos);
}
if (!navigated) { if (!navigated) {
ρσ_interpolate_kwargs.call(self, self.show_name, [name].concat([ ρσ_desugar_kwargs({initial_position: pos})])); ρσ_interpolate_kwargs.call(self, self.show_name, [name].concat([ ρσ_desugar_kwargs({initial_position: pos})]));
} }
sd = get_session_data(); sd = get_session_data();
c = sd.get("controls_help_shown_count", 0); c = sd.get("controls_help_shown_count", 0);
if (c < 2) { if (c < 2) {
show_controls_help(); show_controls_help();
sd.set("controls_help_shown_count", c + 1); sd.set("controls_help_shown_count", c + 1);
} }
}; };
if (!View.prototype.display_book.__argnames__) Object.defineProperties(V iew.prototype.display_book, { if (!View.prototype.display_book.__argnames__) Object.defineProperties(V iew.prototype.display_book, {
__argnames__ : {value: ["book", "initial_cfi", "initial_toc_node"]} __argnames__ : {value: ["book", "initial_cfi", "initial_toc_node", " initial_bookpos"]}
}); });
View.prototype.redisplay_book = function redisplay_book() { View.prototype.redisplay_book = function redisplay_book() {
var self = this; var self = this;
var sd; var sd;
sd = get_session_data(); sd = get_session_data();
self.keyboard_shortcut_map = create_shortcut_map(sd.get("keyboard_sh ortcuts")); self.keyboard_shortcut_map = create_shortcut_map(sd.get("keyboard_sh ortcuts"));
if (ui_operations.export_shortcut_map) { if (ui_operations.export_shortcut_map) {
ui_operations.export_shortcut_map(self.keyboard_shortcut_map); ui_operations.export_shortcut_map(self.keyboard_shortcut_map);
} }
self.book_scrollbar.apply_visibility(); self.book_scrollbar.apply_visibility();
skipping to change at line 29029 skipping to change at line 29461
var self = this; var self = this;
var chapter_start_page, total_length, page, chapter_frac, chapter_na me, chapter_length, chapter_end_page, num_pages, name; var chapter_start_page, total_length, page, chapter_frac, chapter_na me, chapter_length, chapter_end_page, num_pages, name;
if (!self.book || !self.book.manifest) { if (!self.book || !self.book.manifest) {
return; return;
} }
chapter_start_page = 0; chapter_start_page = 0;
total_length = self.book.manifest.spine_length; total_length = self.book.manifest.spine_length;
page = total_length * frac; page = total_length * frac;
chapter_frac = 0; chapter_frac = 0;
chapter_name = null; chapter_name = null;
var ρσ_Iter3 = ρσ_Iterable(self.book.manifest.spine); var ρσ_Iter4 = ρσ_Iterable(self.book.manifest.spine);
for (var ρσ_Index3 = 0; ρσ_Index3 < ρσ_Iter3.length; ρσ_Index3++) { for (var ρσ_Index4 = 0; ρσ_Index4 < ρσ_Iter4.length; ρσ_Index4++) {
name = ρσ_Iter3[ρσ_Index3]; name = ρσ_Iter4[ρσ_Index4];
chapter_length = ρσ_exists.d((ρσ_expr_temp = self.book.manifest. files)[(typeof name === "number" && name < 0) ? ρσ_expr_temp.length + name : nam e]).length || 0; chapter_length = ρσ_exists.d((ρσ_expr_temp = self.book.manifest. files)[(typeof name === "number" && name < 0) ? ρσ_expr_temp.length + name : nam e]).length || 0;
chapter_end_page = chapter_start_page + chapter_length; chapter_end_page = chapter_start_page + chapter_length;
if (chapter_start_page <= page && page <= chapter_end_page) { if (chapter_start_page <= page && page <= chapter_end_page) {
num_pages = chapter_end_page - chapter_start_page - 1; num_pages = chapter_end_page - chapter_start_page - 1;
if (num_pages > 0) { if (num_pages > 0) {
chapter_frac = (page - chapter_start_page) / num_pages; chapter_frac = (page - chapter_start_page) / num_pages;
} else { } else {
chapter_frac = 0; chapter_frac = 0;
} }
chapter_name = name; chapter_name = name;
skipping to change at line 29065 skipping to change at line 29497
ρσ_d["type"] = "frac"; ρσ_d["type"] = "frac";
ρσ_d["frac"] = chapter_frac; ρσ_d["frac"] = chapter_frac;
ρσ_d["replace_history"] = true; ρσ_d["replace_history"] = true;
return ρσ_d; return ρσ_d;
}).call(this)})])); }).call(this)})]));
} }
}; };
if (!View.prototype.goto_frac.__argnames__) Object.defineProperties(View .prototype.goto_frac, { if (!View.prototype.goto_frac.__argnames__) Object.defineProperties(View .prototype.goto_frac, {
__argnames__ : {value: ["frac"]} __argnames__ : {value: ["frac"]}
}); });
View.prototype.goto_book_position = function goto_book_position(bpos) {
var self = this;
var val;
val = max(0, min(1e3 * float(bpos) / self.current_position_data.book
_length, 1));
return self.goto_frac(val);
};
if (!View.prototype.goto_book_position.__argnames__) Object.defineProper
ties(View.prototype.goto_book_position, {
__argnames__ : {value: ["bpos"]}
});
View.prototype.on_scroll_to_anchor = function on_scroll_to_anchor(data) { View.prototype.on_scroll_to_anchor = function on_scroll_to_anchor(data) {
var self = this; var self = this;
ρσ_interpolate_kwargs.call(self, self.show_name, [data.name].concat( [ρσ_desugar_kwargs({initial_position: (function(){ ρσ_interpolate_kwargs.call(self, self.show_name, [data.name].concat( [ρσ_desugar_kwargs({initial_position: (function(){
var ρσ_d = Object.create(null); var ρσ_d = Object.create(null);
ρσ_d["type"] = "anchor"; ρσ_d["type"] = "anchor";
ρσ_d["anchor"] = data.frag; ρσ_d["anchor"] = data.frag;
ρσ_d["replace_history"] = false; ρσ_d["replace_history"] = false;
return ρσ_d; return ρσ_d;
}).call(this)})])); }).call(this)})]));
}; };
if (!View.prototype.on_scroll_to_anchor.__argnames__) Object.definePrope rties(View.prototype.on_scroll_to_anchor, { if (!View.prototype.on_scroll_to_anchor.__argnames__) Object.definePrope rties(View.prototype.on_scroll_to_anchor, {
__argnames__ : {value: ["data"]} __argnames__ : {value: ["data"]}
}); });
View.prototype.goto_bookpos = function goto_bookpos(bookpos) { View.prototype.goto_cfi = function goto_cfi(bookpos) {
var self = this; var self = this;
var ρσ_unpack, cfiname, internal_cfi, pos, name; var ρσ_unpack, cfiname, internal_cfi, pos, name;
ρσ_unpack = self.parse_cfi(bookpos, self.book); ρσ_unpack = self.parse_cfi(bookpos, self.book);
ρσ_unpack = ρσ_unpack_asarray(2, ρσ_unpack); ρσ_unpack = ρσ_unpack_asarray(2, ρσ_unpack);
cfiname = ρσ_unpack[0]; cfiname = ρσ_unpack[0];
internal_cfi = ρσ_unpack[1]; internal_cfi = ρσ_unpack[1];
if (cfiname && internal_cfi) { if (cfiname && internal_cfi) {
pos = (function(){ pos = (function(){
var ρσ_d = Object.create(null); var ρσ_d = Object.create(null);
ρσ_d["replace_history"] = true; ρσ_d["replace_history"] = true;
skipping to change at line 29100 skipping to change at line 29541
}).call(this); }).call(this);
name = cfiname; name = cfiname;
ρσ_unpack = ["cfi", internal_cfi]; ρσ_unpack = ["cfi", internal_cfi];
pos.type = ρσ_unpack[0]; pos.type = ρσ_unpack[0];
pos.cfi = ρσ_unpack[1]; pos.cfi = ρσ_unpack[1];
ρσ_interpolate_kwargs.call(self, self.show_name, [name].concat([ ρσ_desugar_kwargs({initial_position: pos})])); ρσ_interpolate_kwargs.call(self, self.show_name, [name].concat([ ρσ_desugar_kwargs({initial_position: pos})]));
return true; return true;
} }
return false; return false;
}; };
if (!View.prototype.goto_bookpos.__argnames__) Object.defineProperties(V iew.prototype.goto_bookpos, { if (!View.prototype.goto_cfi.__argnames__) Object.defineProperties(View. prototype.goto_cfi, {
__argnames__ : {value: ["bookpos"]} __argnames__ : {value: ["bookpos"]}
}); });
View.prototype.goto_named_destination = function goto_named_destination( name, frag) { View.prototype.goto_named_destination = function goto_named_destination( name, frag) {
var self = this; var self = this;
var spine, idx; var spine, idx;
if (self.currently_showing.name === name) { if (self.currently_showing.name === name) {
ρσ_interpolate_kwargs.call(self.iframe_wrapper, self.iframe_wrap per.send_message, ["scroll_to_anchor"].concat([ρσ_desugar_kwargs({frag: frag})]) ); ρσ_interpolate_kwargs.call(self.iframe_wrapper, self.iframe_wrap per.send_message, ["scroll_to_anchor"].concat([ρσ_desugar_kwargs({frag: frag})]) );
} else { } else {
spine = self.book.manifest.spine; spine = self.book.manifest.spine;
idx = spine.indexOf(name); idx = spine.indexOf(name);
skipping to change at line 29142 skipping to change at line 29583
var toc, found; var toc, found;
toc = self.book.manifest.toc; toc = self.book.manifest.toc;
found = false; found = false;
function process_node(x) { function process_node(x) {
var c; var c;
if (x.id === node_id) { if (x.id === node_id) {
self.goto_named_destination(x.dest || "", x.frag || ""); self.goto_named_destination(x.dest || "", x.frag || "");
found = true; found = true;
return; return;
} }
var ρσ_Iter4 = ρσ_Iterable(x.children); var ρσ_Iter5 = ρσ_Iterable(x.children);
for (var ρσ_Index4 = 0; ρσ_Index4 < ρσ_Iter4.length; ρσ_Index4++ for (var ρσ_Index5 = 0; ρσ_Index5 < ρσ_Iter5.length; ρσ_Index5++
) { ) {
c = ρσ_Iter4[ρσ_Index4]; c = ρσ_Iter5[ρσ_Index5];
process_node(c); process_node(c);
} }
}; };
if (!process_node.__argnames__) Object.defineProperties(process_node , { if (!process_node.__argnames__) Object.defineProperties(process_node , {
__argnames__ : {value: ["x"]} __argnames__ : {value: ["x"]}
}); });
if (toc) { if (toc) {
process_node(toc); process_node(toc);
} }
skipping to change at line 29330 skipping to change at line 29771
hcc = ρσ_unpack[1]; hcc = ρσ_unpack[1];
has_clock = hca || hcb || hcc; has_clock = hca || hcb || hcc;
if (textc && !textb && !texta) { if (textc && !textb && !texta) {
div.firstChild.style.display = "block"; div.firstChild.style.display = "block";
div.firstChild.nextSibling.style.display = "block"; div.firstChild.nextSibling.style.display = "block";
} else if (!texta && !textc && textb) { } else if (!texta && !textc && textb) {
div.firstChild.style.display = "block"; div.firstChild.style.display = "block";
div.lastChild.style.display = "block"; div.lastChild.style.display = "block";
} }
} else { } else {
var ρσ_Iter5 = ρσ_Iterable(div.childNodes); var ρσ_Iter6 = ρσ_Iterable(div.childNodes);
for (var ρσ_Index5 = 0; ρσ_Index5 < ρσ_Iter5.length; ρσ_Inde for (var ρσ_Index6 = 0; ρσ_Index6 < ρσ_Iter6.length; ρσ_Inde
x5++) { x6++) {
c = ρσ_Iter5[ρσ_Index5]; c = ρσ_Iter6[ρσ_Index6];
c.style.display = "none"; c.style.display = "none";
} }
} }
}; };
if (!render_template.__argnames__) Object.defineProperties(render_te mplate, { if (!render_template.__argnames__) Object.defineProperties(render_te mplate, {
__argnames__ : {value: ["div", "sz_attr", "name"]} __argnames__ : {value: ["div", "sz_attr", "name"]}
}); });
div = document.getElementById("book-bottom-margin"); div = document.getElementById("book-bottom-margin");
if (div) { if (div) {
skipping to change at line 29405 skipping to change at line 29846
if (!View.prototype.show_spine_item_stage2.__argnames__) Object.definePr operties(View.prototype.show_spine_item_stage2, { if (!View.prototype.show_spine_item_stage2.__argnames__) Object.definePr operties(View.prototype.show_spine_item_stage2, {
__argnames__ : {value: ["resource_data"]} __argnames__ : {value: ["resource_data"]}
}); });
View.prototype.on_content_loaded = function on_content_loaded(data) { View.prototype.on_content_loaded = function on_content_loaded(data) {
var self = this; var self = this;
self.processing_spine_item_display = false; self.processing_spine_item_display = false;
self.hide_loading(); self.hide_loading();
self.set_progress_frac(data.progress_frac, data.file_progress_frac); self.set_progress_frac(data.progress_frac, data.file_progress_frac);
self.update_header_footer(); self.update_header_footer();
window.scrollTo(0, 0); window.scrollTo(0, 0);
if (self.book_load_started) {
self.book_load_started = false;
if (ui_operations.clear_history) {
ui_operations.clear_history();
}
}
}; };
if (!View.prototype.on_content_loaded.__argnames__) Object.definePropert ies(View.prototype.on_content_loaded, { if (!View.prototype.on_content_loaded.__argnames__) Object.definePropert ies(View.prototype.on_content_loaded, {
__argnames__ : {value: ["data"]} __argnames__ : {value: ["data"]}
}); });
View.prototype.set_progress_frac = function set_progress_frac(progress_f rac, file_progress_frac) { View.prototype.set_progress_frac = function set_progress_frac(progress_f rac, file_progress_frac) {
var self = this; var self = this;
self.current_progress_frac = progress_frac || 0; self.current_progress_frac = progress_frac || 0;
self.current_file_progress_frac = file_progress_frac || 0; self.current_file_progress_frac = file_progress_frac || 0;
self.book_scrollbar.sync_to_contents(self.current_progress_frac); self.book_scrollbar.sync_to_contents(self.current_progress_frac);
}; };
skipping to change at line 29456 skipping to change at line 29903
var traceback = ρσ_modules.traceback; var traceback = ρσ_modules.traceback;
var E = ρσ_modules.elementmaker.E; var E = ρσ_modules.elementmaker.E;
var _ = ρσ_modules.gettext.gettext; var _ = ρσ_modules.gettext.gettext;
var install = ρσ_modules.gettext.install; var install = ρσ_modules.gettext.install;
var initialize = ρσ_modules.initialize; var initialize = ρσ_modules.initialize;
var ajax = ρσ_modules.ajax.ajax; var ajax = ρσ_modules.ajax.ajax;
var workaround_qt_bug = ρσ_modules.ajax.workaround_qt_bug;
var get_session_data = ρσ_modules["book_list.globals"].get_session_data;
var set_session_data = ρσ_modules["book_list.globals"].set_session_data; var set_session_data = ρσ_modules["book_list.globals"].set_session_data;
var library_data = ρσ_modules["book_list.library_data"].library_data; var library_data = ρσ_modules["book_list.library_data"].library_data;
var get_color = ρσ_modules["book_list.theme"].get_color; var get_color = ρσ_modules["book_list.theme"].get_color;
var get_widget_css = ρσ_modules.dom.get_widget_css; var get_widget_css = ρσ_modules.dom.get_widget_css;
var set_css = ρσ_modules.dom.set_css; var set_css = ρσ_modules.dom.set_css;
var create_modal_container = ρσ_modules.modals.create_modal_container; var create_modal_container = ρσ_modules.modals.create_modal_container;
var from_python = ρσ_modules.qt.from_python; var from_python = ρσ_modules.qt.from_python;
var to_python = ρσ_modules.qt.to_python; var to_python = ρσ_modules.qt.to_python;
var new_book = ρσ_modules["read_book.db"].new_book; var new_book = ρσ_modules["read_book.db"].new_book;
var footnotes_main = ρσ_modules["read_book.footnotes"].main; var footnotes_main = ρσ_modules["read_book.footnotes"].main;
var runtime = ρσ_modules["read_book.globals"].runtime; var runtime = ρσ_modules["read_book.globals"].runtime;
var ui_operations = ρσ_modules["read_book.globals"].ui_operations; var ui_operations = ρσ_modules["read_book.globals"].ui_operations;
var set_system_colors = ρσ_modules["read_book.globals"].set_system_color s;
var iframe_main = ρσ_modules["read_book.iframe"].main; var iframe_main = ρσ_modules["read_book.iframe"].main;
var add_standalone_viewer_shortcuts = ρσ_modules["read_book.shortcuts"]. add_standalone_viewer_shortcuts; var add_standalone_viewer_shortcuts = ρσ_modules["read_book.shortcuts"]. add_standalone_viewer_shortcuts;
var View = ρσ_modules["read_book.view"].View; var View = ρσ_modules["read_book.view"].View;
var session_defaults = ρσ_modules.session.session_defaults;
var local_storage = ρσ_modules.session.local_storage; var local_storage = ρσ_modules.session.local_storage;
var session_defaults = ρσ_modules.session.session_defaults;
var encode_query_with_path = ρσ_modules.utils.encode_query_with_path; var encode_query_with_path = ρσ_modules.utils.encode_query_with_path;
var parse_url_params = ρσ_modules.utils.parse_url_params; var parse_url_params = ρσ_modules.utils.parse_url_params;
var FAKE_HOST = ρσ_modules["viewer.constants"].FAKE_HOST; var FAKE_HOST = ρσ_modules["viewer.constants"].FAKE_HOST;
var FAKE_PROTOCOL = ρσ_modules["viewer.constants"].FAKE_PROTOCOL; var FAKE_PROTOCOL = ρσ_modules["viewer.constants"].FAKE_PROTOCOL;
var READER_BACKGROUND_URL = ρσ_modules["viewer.constants"].READER_BACKGR OUND_URL; var READER_BACKGROUND_URL = ρσ_modules["viewer.constants"].READER_BACKGR OUND_URL;
runtime.is_standalone_viewer = true; runtime.is_standalone_viewer = true;
runtime.FAKE_HOST = FAKE_HOST; runtime.FAKE_HOST = FAKE_HOST;
runtime.SANDBOX_HOST = FAKE_HOST.rpartition(".")[0] + ".sandbox"; runtime.SANDBOX_HOST = FAKE_HOST.rpartition(".")[0] + ".sandbox";
runtime.FAKE_PROTOCOL = FAKE_PROTOCOL; runtime.FAKE_PROTOCOL = FAKE_PROTOCOL;
add_standalone_viewer_shortcuts();
book = null; book = null;
view = null; view = null;
function file_received(name, file_data, proceed, end_type, xhr, ev) { function file_received(name, file_data, proceed, end_type, xhr, ev) {
var result; var result;
end_type = workaround_qt_bug(xhr, end_type);
if (end_type === "abort") { if (end_type === "abort") {
return; return;
} }
if (end_type !== "load") { if (end_type !== "load") {
show_error(_("Failed to load file from book"), _("Could not load the file: {} with error: {}").format(name, xhr.error_html)); show_error(_("Failed to load file from book"), _("Could not load the file: {} with error: {}").format(name, xhr.error_html));
return; return;
} }
if (!xhr.responseType || xhr.responseType === "text") { if (!xhr.responseType || xhr.responseType === "text") {
result = xhr.responseText; result = xhr.responseText;
} else if (xhr.responseType === "blob") { } else if (xhr.responseType === "blob") {
skipping to change at line 29541 skipping to change at line 29991
xhr.responseType = "blob"; xhr.responseType = "blob";
} }
xhr.send(); xhr.send();
}; };
if (!get_file.__argnames__) Object.defineProperties(get_file, { if (!get_file.__argnames__) Object.defineProperties(get_file, {
__argnames__ : {value: ["book", "name", "proceed"]} __argnames__ : {value: ["book", "name", "proceed"]}
}); });
function mathjax_file_received(name, proceed, end_type, xhr, ev) { function mathjax_file_received(name, proceed, end_type, xhr, ev) {
var result; var result;
end_type = workaround_qt_bug(xhr, end_type);
if (end_type === "abort") { if (end_type === "abort") {
return; return;
} }
if (end_type !== "load") { if (end_type !== "load") {
show_error(_("Failed to load MathJax file"), _("Could not load t he file: {} with error: {}").format(name, xhr.error_html)); show_error(_("Failed to load MathJax file"), _("Could not load t he file: {} with error: {}").format(name, xhr.error_html));
return; return;
} }
if (!xhr.responseType || xhr.responseType === "text") { if (!xhr.responseType || xhr.responseType === "text") {
result = xhr.responseText; result = xhr.responseText;
} else if (xhr.responseType === "blob" || xhr.responseType === "json ") { } else if (xhr.responseType === "blob" || xhr.responseType === "json ") {
skipping to change at line 29589 skipping to change at line 30040
if (!get_mathjax_manifest.__argnames__) Object.defineProperties(get_math jax_manifest, { if (!get_mathjax_manifest.__argnames__) Object.defineProperties(get_math jax_manifest, {
__argnames__ : {value: ["proceed"]} __argnames__ : {value: ["proceed"]}
}); });
function get_mathjax_files_stage2(proceed) { function get_mathjax_files_stage2(proceed) {
var xhr, filename; var xhr, filename;
if (!get_mathjax_files_stage2.files_to_get.length) { if (!get_mathjax_files_stage2.files_to_get.length) {
proceed(get_mathjax_files_stage2.file_data); proceed(get_mathjax_files_stage2.file_data);
return; return;
} }
var ρσ_Iter0 = ρσ_Iterable(get_mathjax_files_stage2.files_to_get); var ρσ_Iter1 = ρσ_Iterable(get_mathjax_files_stage2.files_to_get);
for (var ρσ_Index0 = 0; ρσ_Index0 < ρσ_Iter0.length; ρσ_Index0++) { for (var ρσ_Index1 = 0; ρσ_Index1 < ρσ_Iter1.length; ρσ_Index1++) {
filename = ρσ_Iter0[ρσ_Index0]; filename = ρσ_Iter1[ρσ_Index1];
xhr = ρσ_interpolate_kwargs.call(this, ajax, ["mathjax/" + ρσ_st r.format("{}", filename) + "", mathjax_file_received.bind(null, filename, procee d)].concat([ρσ_desugar_kwargs({ok_code: 0})])); xhr = ρσ_interpolate_kwargs.call(this, ajax, ["mathjax/" + ρσ_st r.format("{}", filename) + "", mathjax_file_received.bind(null, filename, procee d)].concat([ρσ_desugar_kwargs({ok_code: 0})]));
xhr.responseType = "blob"; xhr.responseType = "blob";
xhr.send(); xhr.send();
} }
}; };
if (!get_mathjax_files_stage2.__argnames__) Object.defineProperties(get_ mathjax_files_stage2, { if (!get_mathjax_files_stage2.__argnames__) Object.defineProperties(get_ mathjax_files_stage2, {
__argnames__ : {value: ["proceed"]} __argnames__ : {value: ["proceed"]}
}); });
function get_mathjax_files(proceed) { function get_mathjax_files(proceed) {
skipping to change at line 29640 skipping to change at line 30091
}; };
if (!update_url_state.__argnames__) Object.defineProperties(update_url_s tate, { if (!update_url_state.__argnames__) Object.defineProperties(update_url_s tate, {
__argnames__ : {value: ["replace"]} __argnames__ : {value: ["replace"]}
}); });
function on_pop_state() { function on_pop_state() {
var data; var data;
if (view && view.currently_showing) { if (view && view.currently_showing) {
data = parse_url_params(); data = parse_url_params();
if (data.bookpos && data.bookpos.startswith("epubcfi(/")) { if (data.bookpos && data.bookpos.startswith("epubcfi(/")) {
view.goto_bookpos(data.bookpos); view.goto_cfi(data.bookpos);
} }
} }
}; };
function show_error(title, msg, details) { function show_error(title, msg, details) {
to_python.show_error(title, msg, details); to_python.show_error(title, msg, details);
}; };
if (!show_error.__argnames__) Object.defineProperties(show_error, { if (!show_error.__argnames__) Object.defineProperties(show_error, {
__argnames__ : {value: ["title", "msg", "details"]} __argnames__ : {value: ["title", "msg", "details"]}
}); });
function manifest_received(key, initial_cfi, initial_toc_node, pathtoebo ok, end_type, xhr, ev) { function manifest_received(key, initial_cfi, initial_toc_node, initial_b ookpos, pathtoebook, end_type, xhr, ev) {
var data; var data;
end_type = workaround_qt_bug(xhr, end_type);
if (end_type === "load") { if (end_type === "load") {
book = new_book(key, Object.create(null)); book = new_book(key, Object.create(null));
data = xhr.response; data = xhr.response;
book.manifest = data[0]; book.manifest = data[0];
book.metadata = book.manifest.metadata = data[1]; book.metadata = book.manifest.metadata = data[1];
book.manifest.pathtoebook = pathtoebook; book.manifest.pathtoebook = pathtoebook;
book.stored_files = Object.create(null); book.stored_files = Object.create(null);
book.is_complete = true; book.is_complete = true;
delete book.manifest["metadata"]; delete book.manifest["metadata"];
delete book.manifest["last_read_positions"]; delete book.manifest["last_read_positions"];
view.display_book(book, initial_cfi, initial_toc_node); view.display_book(book, initial_cfi, initial_toc_node, initial_b ookpos);
} else { } else {
show_error(_("Could not open book"), _("Failed to load book mani fest, click \"Show details\" for more info"), xhr.error_html || null); show_error(_("Could not open book"), _("Failed to load book mani fest, click \"Show details\" for more info"), xhr.error_html || null);
} }
}; };
if (!manifest_received.__argnames__) Object.defineProperties(manifest_re ceived, { if (!manifest_received.__argnames__) Object.defineProperties(manifest_re ceived, {
__argnames__ : {value: ["key", "initial_cfi", "initial_toc_node", "p athtoebook", "end_type", "xhr", "ev"]} __argnames__ : {value: ["key", "initial_cfi", "initial_toc_node", "i nitial_bookpos", "pathtoebook", "end_type", "xhr", "ev"]}
}); });
function SessionData() { function SessionData() {
if (this.ρσ_object_id === undefined) Object.defineProperty(this, "ρσ _object_id", {"value":++ρσ_object_counter}); if (this.ρσ_object_id === undefined) Object.defineProperty(this, "ρσ _object_id", {"value":++ρσ_object_counter});
SessionData.prototype.__bind_methods__.call(this); SessionData.prototype.__bind_methods__.call(this);
SessionData.prototype.__init__.apply(this, arguments); SessionData.prototype.__init__.apply(this, arguments);
} }
Object.defineProperty(SessionData.prototype, "__bind_methods__", {value: function () { Object.defineProperty(SessionData.prototype, "__bind_methods__", {value: function () {
this.get = SessionData.prototype.get.bind(this); this.get = SessionData.prototype.get.bind(this);
this.set = SessionData.prototype.set.bind(this); this.set = SessionData.prototype.set.bind(this);
skipping to change at line 29816 skipping to change at line 30268
var sd; var sd;
sd = new SessionData(prefs); sd = new SessionData(prefs);
set_session_data(sd); set_session_data(sd);
local_storage.storage = new LocalStorage(local_storage_data); local_storage.storage = new LocalStorage(local_storage_data);
}; };
if (!create_session_data.__argnames__) Object.defineProperties(create_se ssion_data, { if (!create_session_data.__argnames__) Object.defineProperties(create_se ssion_data, {
__argnames__ : {value: ["prefs", "local_storage_data"]} __argnames__ : {value: ["prefs", "local_storage_data"]}
}); });
var create_view = from_python((function() { var create_view = from_python((function() {
var ρσ_anonfunc = function create_view(prefs, local_storage, all_fon var ρσ_anonfunc = function create_view(prefs, local_storage, field_m
t_families, field_metadata, ui_font_family, ui_font_sz, show_home_page_on_ready) etadata, ui_data) {
{ set_system_colors(ui_data.system_colors);
runtime.all_font_families = all_font_families; runtime.all_font_families = ui_data.all_font_families;
library_data.field_metadata = field_metadata; library_data.field_metadata = field_metadata;
document.documentElement.style.fontFamily = "\"" + ρσ_str.format document.documentElement.style.fontFamily = "\"" + ρσ_str.format
("{}", ui_font_family) + "\", sans-serif"; ("{}", ui_data.ui_font_family) + "\", sans-serif";
document.documentElement.style.fontSize = ui_font_sz; document.documentElement.style.fontSize = ui_data.ui_font_sz;
if (view === null) { if (view === null) {
create_session_data(prefs, local_storage); create_session_data(prefs, local_storage);
view = new View(document.getElementById("view")); view = new View(document.getElementById("view"));
if (show_home_page_on_ready) { if (ui_data.show_home_page_on_ready) {
view.overlay.open_book(false); view.overlay.open_book(false);
} }
} }
}; };
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["prefs", "local_storage", "all_font_fami __argnames__ : {value: ["prefs", "local_storage", "field_metadat
lies", "field_metadata", "ui_font_family", "ui_font_sz", "show_home_page_on_read a", "ui_data"]}
y"]} });
return ρσ_anonfunc;
})());
var set_system_palette = from_python((function() {
var ρσ_anonfunc = function set_system_palette(system_colors) {
set_system_colors(system_colors);
if (view) {
view.update_color_scheme();
}
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc,
{
__argnames__ : {value: ["system_colors"]}
}); });
return ρσ_anonfunc; return ρσ_anonfunc;
})()); })());
var show_home_page = from_python(function show_home_page() { var show_home_page = from_python(function show_home_page() {
view.overlay.open_book(false); view.overlay.open_book(false);
}); });
var start_book_load = from_python((function() { var start_book_load = from_python((function() {
var ρσ_anonfunc = function start_book_load(key, initial_cfi, initial _toc_node, pathtoebook) { var ρσ_anonfunc = function start_book_load(key, initial_cfi, initial _toc_node, initial_bookpos, pathtoebook) {
var xhr; var xhr;
xhr = ρσ_interpolate_kwargs.call(this, ajax, ["manifest", manife st_received.bind(null, key, initial_cfi, initial_toc_node, pathtoebook)].concat( [ρσ_desugar_kwargs({ok_code: 0})])); xhr = ρσ_interpolate_kwargs.call(this, ajax, ["manifest", manife st_received.bind(null, key, initial_cfi, initial_toc_node, initial_bookpos, path toebook)].concat([ρσ_desugar_kwargs({ok_code: 0})]));
xhr.responseType = "json"; xhr.responseType = "json";
xhr.send(); xhr.send();
}; };
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["key", "initial_cfi", "initial_toc_node" , "pathtoebook"]} __argnames__ : {value: ["key", "initial_cfi", "initial_toc_node" , "initial_bookpos", "pathtoebook"]}
}); });
return ρσ_anonfunc; return ρσ_anonfunc;
})()); })());
var goto_toc_node = from_python((function() { var goto_toc_node = from_python((function() {
var ρσ_anonfunc = function goto_toc_node(node_id) { var ρσ_anonfunc = function goto_toc_node(node_id) {
view.goto_toc_node(node_id); view.goto_toc_node(node_id);
}; };
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["node_id"]} __argnames__ : {value: ["node_id"]}
}); });
return ρσ_anonfunc; return ρσ_anonfunc;
})()); })());
var goto_cfi = from_python((function() { var goto_cfi = from_python((function() {
var ρσ_anonfunc = function goto_cfi(cfi) { var ρσ_anonfunc = function goto_cfi(cfi) {
view.goto_bookpos(cfi); view.goto_cfi(cfi);
}; };
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["cfi"]} __argnames__ : {value: ["cfi"]}
}); });
return ρσ_anonfunc; return ρσ_anonfunc;
})()); })());
var full_screen_state_changed = from_python((function() { var full_screen_state_changed = from_python((function() {
var ρσ_anonfunc = function full_screen_state_changed(viewer_in_full_ screen) { var ρσ_anonfunc = function full_screen_state_changed(viewer_in_full_ screen) {
runtime.viewer_in_full_screen = viewer_in_full_screen; runtime.viewer_in_full_screen = viewer_in_full_screen;
skipping to change at line 29918 skipping to change at line 30384
if (img) { if (img) {
img.src = READER_BACKGROUND_URL + "?" + (new Date).getTime() ; img.src = READER_BACKGROUND_URL + "?" + (new Date).getTime() ;
} }
}; };
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, { if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
__argnames__ : {value: ["img_id"]} __argnames__ : {value: ["img_id"]}
}); });
return ρσ_anonfunc; return ρσ_anonfunc;
})()); })());
var trigger_shortcut = from_python((function() {
var ρσ_anonfunc = function trigger_shortcut(which) {
if (view) {
view.on_handle_shortcut((function(){
var ρσ_d = Object.create(null);
ρσ_d["name"] = which;
return ρσ_d;
}).call(this));
}
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc,
{
__argnames__ : {value: ["which"]}
});
return ρσ_anonfunc;
})());
function onerror(msg, script_url, line_number, column_number, error_obje ct) { function onerror(msg, script_url, line_number, column_number, error_obje ct) {
var fname, details; var fname, details;
if (!error_object) { if (!error_object) {
return false; return false;
} }
fname = (ρσ_expr_temp = script_url.rpartition("/"))[ρσ_expr_temp.len gth-1] || script_url; fname = (ρσ_expr_temp = script_url.rpartition("/"))[ρσ_expr_temp.len gth-1] || script_url;
msg += "<br><span style=\"font-size:smaller\">" + "Error at {}:{}:{} ".format(fname, line_number, column_number || "") + "</span>"; msg += "<br><span style=\"font-size:smaller\">" + "Error at {}:{}:{} ".format(fname, line_number, column_number || "") + "</span>";
details = ""; details = "";
console.log(error_object); console.log(error_object);
details = traceback.format_exception(error_object).join(""); details = traceback.format_exception(error_object).join("");
skipping to change at line 29940 skipping to change at line 30422
}; };
if (!onerror.__argnames__) Object.defineProperties(onerror, { if (!onerror.__argnames__) Object.defineProperties(onerror, {
__argnames__ : {value: ["msg", "script_url", "line_number", "column_ number", "error_object"]} __argnames__ : {value: ["msg", "script_url", "line_number", "column_ number", "error_object"]}
}); });
if (window === window.top) { if (window === window.top) {
TRANSLATIONS_DATA = __TRANSLATIONS_DATA__; TRANSLATIONS_DATA = __TRANSLATIONS_DATA__;
if (TRANSLATIONS_DATA) { if (TRANSLATIONS_DATA) {
install(TRANSLATIONS_DATA); install(TRANSLATIONS_DATA);
} }
add_standalone_viewer_shortcuts();
ui_operations.get_file = get_file; ui_operations.get_file = get_file;
ui_operations.get_mathjax_files = get_mathjax_files; ui_operations.get_mathjax_files = get_mathjax_files;
ui_operations.update_url_state = update_url_state; ui_operations.update_url_state = update_url_state;
ui_operations.show_error = show_error; ui_operations.show_error = show_error;
ui_operations.redisplay_book = function () { ui_operations.redisplay_book = function () {
view.redisplay_book(); view.redisplay_book();
}; };
ui_operations.reload_book = function () { ui_operations.reload_book = function () {
to_python.reload_book(); to_python.reload_book();
}; };
skipping to change at line 29968 skipping to change at line 30451
})(); })();
ui_operations.update_color_scheme = function () { ui_operations.update_color_scheme = function () {
view.update_color_scheme(); view.update_color_scheme();
}; };
ui_operations.update_font_size = function () { ui_operations.update_font_size = function () {
view.update_font_size(); view.update_font_size();
}; };
ui_operations.focus_iframe = function () { ui_operations.focus_iframe = function () {
view.focus_iframe(); view.focus_iframe();
}; };
ui_operations.goto_bookpos = (function() { ui_operations.goto_cfi = (function() {
var ρσ_anonfunc = function (cfi) { var ρσ_anonfunc = function (cfi) {
return view.goto_bookpos(cfi); return view.goto_cfi(cfi);
}; };
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfu nc, { if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfu nc, {
__argnames__ : {value: ["cfi"]} __argnames__ : {value: ["cfi"]}
}); });
return ρσ_anonfunc; return ρσ_anonfunc;
})(); })();
ui_operations.goto_frac = (function() { ui_operations.goto_frac = (function() {
var ρσ_anonfunc = function (frac) { var ρσ_anonfunc = function (frac) {
return view.goto_frac(frac); return view.goto_frac(frac);
}; };
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfu nc, { if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfu nc, {
__argnames__ : {value: ["frac"]} __argnames__ : {value: ["frac"]}
}); });
return ρσ_anonfunc; return ρσ_anonfunc;
})(); })();
ui_operations.goto_book_position = (function() {
var ρσ_anonfunc = function (bpos) {
return view.goto_book_position(bpos);
};
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfu
nc, {
__argnames__ : {value: ["bpos"]}
});
return ρσ_anonfunc;
})();
ui_operations.toggle_toc = function () { ui_operations.toggle_toc = function () {
to_python.toggle_toc(); to_python.toggle_toc();
}; };
ui_operations.toggle_bookmarks = function () { ui_operations.toggle_bookmarks = function () {
to_python.toggle_bookmarks(); to_python.toggle_bookmarks();
}; };
ui_operations.toggle_inspector = function () { ui_operations.toggle_inspector = function () {
to_python.toggle_inspector(); to_python.toggle_inspector();
}; };
ui_operations.reset_interface = function () {
var sd, defaults, m;
sd = get_session_data();
defaults = session_defaults();
m = sd.get("standalone_misc_settings", Object.create(null));
delete m.show_actions_toolbar;
sd.set("standalone_misc_settings", m);
sd.set("book_scrollbar", false);
view.book_scrollbar.apply_visibility();
sd.set("header", defaults.header);
sd.set("footer", defaults.footer);
view.update_header_footer();
to_python.reset_interface();
};
ui_operations.toggle_lookup = function () { ui_operations.toggle_lookup = function () {
to_python.toggle_lookup(); to_python.toggle_lookup();
}; };
ui_operations.selection_changed = (function() { ui_operations.selection_changed = (function() {
var ρσ_anonfunc = function (selected_text) { var ρσ_anonfunc = function (selected_text) {
to_python.selection_changed(selected_text); to_python.selection_changed(selected_text);
}; };
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfu nc, { if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfu nc, {
__argnames__ : {value: ["selected_text"]} __argnames__ : {value: ["selected_text"]}
}); });
skipping to change at line 30106 skipping to change at line 30612
to_python.export_shortcut_map(smap); to_python.export_shortcut_map(smap);
}; };
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfu nc, { if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfu nc, {
__argnames__ : {value: ["smap"]} __argnames__ : {value: ["smap"]}
}); });
return ρσ_anonfunc; return ρσ_anonfunc;
})(); })();
ui_operations.print_book = function () { ui_operations.print_book = function () {
to_python.print_book(); to_python.print_book();
}; };
ui_operations.clear_history = function () {
to_python.clear_history();
};
document.body.appendChild(ρσ_interpolate_kwargs.call(E, E.div, [ρσ_d esugar_kwargs({id: "view"})])); document.body.appendChild(ρσ_interpolate_kwargs.call(E, E.div, [ρσ_d esugar_kwargs({id: "view"})]));
window.onerror = onerror; window.onerror = onerror;
create_modal_container(); create_modal_container();
document.head.appendChild(E.style(get_widget_css())); document.head.appendChild(E.style(get_widget_css()));
ρσ_interpolate_kwargs.call(this, set_css, [document.body].concat([ρσ _desugar_kwargs({background_color: get_color("window-background"), color: get_co lor("window-foreground")})])); ρσ_interpolate_kwargs.call(this, set_css, [document.body].concat([ρσ _desugar_kwargs({background_color: get_color("window-background"), color: get_co lor("window-foreground")})]));
setTimeout(function () { setTimeout(function () {
window.onpopstate = on_pop_state; window.onpopstate = on_pop_state;
}, 0); }, 0);
} else { } else {
div = document.getElementById("calibre-viewer-footnote-iframe"); div = document.getElementById("calibre-viewer-footnote-iframe");
if (div) { if (div) {
footnotes_main(); footnotes_main();
} else { } else {
iframe_main(); iframe_main();
} }
add_standalone_viewer_shortcuts();
} }
})(); })();
})(); })();
 End of changes. 174 change blocks. 
283 lines changed or deleted 857 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)