diff options
Diffstat (limited to 'js/Feeds.js')
-rw-r--r-- | js/Feeds.js | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/js/Feeds.js b/js/Feeds.js index 5a2dee5cf..33a1fa3dc 100644 --- a/js/Feeds.js +++ b/js/Feeds.js @@ -117,15 +117,21 @@ const Feeds = { }, reloadCurrent: function(method) { if (this.getActive() != undefined) { - console.log("reloadCurrent: " + method); + console.log("reloadCurrent", this.getActive(), this.activeIsCat(), method); this.open({feed: this.getActive(), is_cat: this.activeIsCat(), method: method}); } - return false; // block unneeded form submits }, openDefaultFeed: function() { this.open({feed: this._default_feed_id}); }, + onViewModeChanged: function() { + // TODO: is this still needed? + App.find("body").setAttribute("view-mode", + dijit.byId("toolbar-main").getValues().view_mode); + + return Feeds.reloadCurrent(''); + }, openNextUnread: function() { const is_cat = this.activeIsCat(); const nuf = this.getNextUnread(this.getActive(), is_cat); @@ -236,12 +242,12 @@ const Feeds = { //document.onkeypress = (event) => { return App.hotkeyHandler(event) }; window.onresize = () => { Headlines.scrollHandler(); } - /* global hash_get */ - const hash_feed_id = hash_get('f'); - const hash_feed_is_cat = hash_get('c') == "1"; + const hash = App.Hash.get(); + + console.log('got hash', hash); - if (hash_feed_id != undefined) { - this.open({feed: hash_feed_id, is_cat: hash_feed_is_cat}); + if (hash.f != undefined) { + this.open({feed: parseInt(hash.f), is_cat: parseInt(hash.c)}); } else { this.openDefaultFeed(); } @@ -305,9 +311,12 @@ const Feeds = { setActive: function(id, is_cat) { console.log('setActive', id, is_cat); - /* global hash_set */ - hash_set('f', id); - hash_set('c', is_cat ? 1 : 0); + if ('requestIdleCallback' in window) + window.requestIdleCallback(() => { + App.Hash.set({f: id, c: is_cat ? 1 : 0}); + }); + else + App.Hash.set({f: id, c: is_cat ? 1 : 0}); this._active_feed_id = id; this._active_feed_is_cat = is_cat; @@ -366,10 +375,7 @@ const Feeds = { }, 10 * 1000); } - //Form.enable("toolbar-main"); - - let query = Object.assign({op: "feeds", method: "view", feed: feed}, - dojo.formToObject("toolbar-main")); + let query = {...{op: "feeds", method: "view", feed: feed}, ...dojo.formToObject("toolbar-main")}; if (method) query.m = method; @@ -612,7 +618,7 @@ const Feeds = { {class: 'alt-info pull-left', onclick: "window.open('https://tt-rss.org/wiki/SearchSyntax')"})} ` : ''} - ${App.FormFields.submit_tag(__('Search'), {onclick: "App.dialogOf(this).execute()"})} + ${App.FormFields.submit_tag(App.FormFields.icon("search") + " " + __('Search'), {onclick: "App.dialogOf(this).execute()"})} ${App.FormFields.cancel_dialog_tag(__('Cancel'))} </footer> </form> |