|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
'use strict'
|
|
|
|
|
/* global dijit,__ */
|
|
|
|
|
|
|
|
|
|
let App;
|
|
|
|
|
let Utils;
|
|
|
|
|
let CommonDialogs;
|
|
|
|
|
let Filters;
|
|
|
|
@ -9,19 +10,11 @@ let Headlines;
|
|
|
|
|
let Article;
|
|
|
|
|
let ArticleCache;
|
|
|
|
|
|
|
|
|
|
const App = {
|
|
|
|
|
global_unread: -1,
|
|
|
|
|
_widescreen_mode: false,
|
|
|
|
|
hotkey_actions: {},
|
|
|
|
|
init: function() {
|
|
|
|
|
|
|
|
|
|
window.onerror = function (message, filename, lineno, colno, error) {
|
|
|
|
|
report_error(message, filename, lineno, colno, error);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
require(["dojo/_base/kernel",
|
|
|
|
|
"dojo/_base/declare",
|
|
|
|
|
"dojo/ready",
|
|
|
|
|
"dojo/parser",
|
|
|
|
|
"fox/AppBase",
|
|
|
|
|
"dojo/_base/loader",
|
|
|
|
|
"dojo/_base/html",
|
|
|
|
|
"dojo/query",
|
|
|
|
@ -61,11 +54,19 @@ const App = {
|
|
|
|
|
"fox/Article",
|
|
|
|
|
"fox/ArticleCache",
|
|
|
|
|
"fox/FeedStoreModel",
|
|
|
|
|
"fox/FeedTree"], function (dojo, ready, parser) {
|
|
|
|
|
"fox/FeedTree"], function (dojo, declare, ready, parser, AppBase) {
|
|
|
|
|
|
|
|
|
|
ready(function () {
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
const _App = declare("fox.App", AppBase, {
|
|
|
|
|
global_unread: -1,
|
|
|
|
|
_widescreen_mode: false,
|
|
|
|
|
hotkey_actions: {},
|
|
|
|
|
constructor: function () {
|
|
|
|
|
window.onerror = function (message, filename, lineno, colno, error) {
|
|
|
|
|
report_error(message, filename, lineno, colno, error);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Utils = fox.Utils();
|
|
|
|
|
CommonDialogs = fox.CommonDialogs();
|
|
|
|
|
Filters = fox.CommonFilters();
|
|
|
|
@ -76,11 +77,11 @@ const App = {
|
|
|
|
|
|
|
|
|
|
parser.parse();
|
|
|
|
|
|
|
|
|
|
if (!App.genericSanityCheck())
|
|
|
|
|
return false;
|
|
|
|
|
if (!this.genericSanityCheck())
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
Utils.setLoadingProgress(30);
|
|
|
|
|
App.initHotkeyActions();
|
|
|
|
|
this.initHotkeyActions();
|
|
|
|
|
|
|
|
|
|
const a = document.createElement('audio');
|
|
|
|
|
const hasAudio = !!a.canPlayType;
|
|
|
|
@ -98,21 +99,14 @@ const App = {
|
|
|
|
|
xhrPost("backend.php", params, (transport) => {
|
|
|
|
|
try {
|
|
|
|
|
Utils.backendSanityCallback(transport);
|
|
|
|
|
} catch (e) {
|
|
|
|
|
console.error(e);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
exception_error(e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
initSecondStage: function () {
|
|
|
|
|
this.enableCsrfSupport();
|
|
|
|
|
|
|
|
|
|
Feeds.reload();
|
|
|
|
|
Article.close();
|
|
|
|
|
|
|
|
|
@ -126,15 +120,15 @@ const App = {
|
|
|
|
|
dojo.connect(dijit.byId('feeds-holder'), 'resize',
|
|
|
|
|
function (args) {
|
|
|
|
|
if (args && args.w >= 0) {
|
|
|
|
|
Cookie.set("ttrss_fh_width", args.w, getInitParam("cookie_lifetime"));
|
|
|
|
|
Cookie.set("ttrss_fh_width", args.w, App.getInitParam("cookie_lifetime"));
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
dojo.connect(dijit.byId('content-insert'), 'resize',
|
|
|
|
|
function (args) {
|
|
|
|
|
if (args && args.w >= 0 && args.h >= 0) {
|
|
|
|
|
Cookie.set("ttrss_ci_width", args.w, getInitParam("cookie_lifetime"));
|
|
|
|
|
Cookie.set("ttrss_ci_height", args.h, getInitParam("cookie_lifetime"));
|
|
|
|
|
Cookie.set("ttrss_ci_width", args.w, App.getInitParam("cookie_lifetime"));
|
|
|
|
|
Cookie.set("ttrss_ci_height", args.h, App.getInitParam("cookie_lifetime"));
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
@ -143,10 +137,10 @@ const App = {
|
|
|
|
|
const toolbar = document.forms["main_toolbar_form"];
|
|
|
|
|
|
|
|
|
|
dijit.getEnclosingWidget(toolbar.view_mode).attr('value',
|
|
|
|
|
getInitParam("default_view_mode"));
|
|
|
|
|
App.getInitParam("default_view_mode"));
|
|
|
|
|
|
|
|
|
|
dijit.getEnclosingWidget(toolbar.order_by).attr('value',
|
|
|
|
|
getInitParam("default_view_order_by"));
|
|
|
|
|
App.getInitParam("default_view_order_by"));
|
|
|
|
|
|
|
|
|
|
const hash_feed_id = hash_get('f');
|
|
|
|
|
const hash_feed_is_cat = hash_get('c') == "1";
|
|
|
|
@ -159,12 +153,12 @@ const App = {
|
|
|
|
|
|
|
|
|
|
ArticleCache.clear();
|
|
|
|
|
|
|
|
|
|
this._widescreen_mode = getInitParam("widescreen");
|
|
|
|
|
this._widescreen_mode = App.getInitParam("widescreen");
|
|
|
|
|
this.switchPanelMode(this._widescreen_mode);
|
|
|
|
|
|
|
|
|
|
Headlines.initScrollHandler();
|
|
|
|
|
|
|
|
|
|
if (getInitParam("simple_update")) {
|
|
|
|
|
if (App.getInitParam("simple_update")) {
|
|
|
|
|
console.log("scheduling simple feed updater...");
|
|
|
|
|
window.setInterval(() => { Feeds.updateRandom() }, 30 * 1000);
|
|
|
|
|
}
|
|
|
|
@ -194,7 +188,7 @@ const App = {
|
|
|
|
|
return Feeds.reloadCurrent('');
|
|
|
|
|
},
|
|
|
|
|
isCombinedMode: function() {
|
|
|
|
|
return getInitParam("combined_display_mode");
|
|
|
|
|
return App.getInitParam("combined_display_mode");
|
|
|
|
|
},
|
|
|
|
|
hotkeyHandler(event) {
|
|
|
|
|
if (event.target.nodeName == "INPUT" || event.target.nodeName == "TEXTAREA") return;
|
|
|
|
@ -370,7 +364,7 @@ const App = {
|
|
|
|
|
this.hotkey_actions["feed_debug_update"] = function () {
|
|
|
|
|
if (!Feeds.activeIsCat() && parseInt(Feeds.getActive()) > 0) {
|
|
|
|
|
window.open("backend.php?op=feeds&method=update_debugger&feed_id=" + Feeds.getActive() +
|
|
|
|
|
"&csrf_token=" + getInitParam("csrf_token"));
|
|
|
|
|
"&csrf_token=" + App.getInitParam("csrf_token"));
|
|
|
|
|
} else {
|
|
|
|
|
alert("You can't debug this kind of feed.");
|
|
|
|
|
}
|
|
|
|
@ -483,8 +477,8 @@ const App = {
|
|
|
|
|
const value = App.isCombinedMode() ? "false" : "true";
|
|
|
|
|
|
|
|
|
|
xhrPost("backend.php", {op: "rpc", method: "setpref", key: "COMBINED_DISPLAY_MODE", value: value}, () => {
|
|
|
|
|
setInitParam("combined_display_mode",
|
|
|
|
|
!getInitParam("combined_display_mode"));
|
|
|
|
|
App.setInitParam("combined_display_mode",
|
|
|
|
|
!App.getInitParam("combined_display_mode"));
|
|
|
|
|
|
|
|
|
|
Article.close();
|
|
|
|
|
Feeds.reloadCurrent();
|
|
|
|
@ -493,10 +487,10 @@ const App = {
|
|
|
|
|
this.hotkey_actions["toggle_cdm_expanded"] = function () {
|
|
|
|
|
Notify.progress("Loading, please wait...");
|
|
|
|
|
|
|
|
|
|
const value = getInitParam("cdm_expanded") ? "false" : "true";
|
|
|
|
|
const value = App.getInitParam("cdm_expanded") ? "false" : "true";
|
|
|
|
|
|
|
|
|
|
xhrPost("backend.php", {op: "rpc", method: "setpref", key: "CDM_EXPANDED", value: value}, () => {
|
|
|
|
|
setInitParam("cdm_expanded", !getInitParam("cdm_expanded"));
|
|
|
|
|
App.setInitParam("cdm_expanded", !App.getInitParam("cdm_expanded"));
|
|
|
|
|
Feeds.reloadCurrent();
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
@ -575,7 +569,14 @@ const App = {
|
|
|
|
|
isPrefs: function() {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
App = new _App();
|
|
|
|
|
} catch (e) {
|
|
|
|
|
exception_error(e);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
function hash_get(key) {
|
|
|
|
|
const kv = window.location.hash.substring(1).toQueryParams();
|
|
|
|
|