2019-05-01 18:24:45 +02:00
|
|
|
require(['dojo/_base/kernel', 'dojo/ready'], function (dojo, ready) {
|
|
|
|
ready(function () {
|
|
|
|
this.prev_feed = null;
|
|
|
|
PluginHost.register(PluginHost.HOOK_FEED_SET_ACTIVE, (feed) => {
|
|
|
|
if (feed[0] == this.prev_feed)
|
|
|
|
return;
|
|
|
|
|
|
|
|
const toolbar = document.forms["toolbar-main"];
|
|
|
|
const order_by = dijit.getEnclosingWidget(toolbar.order_by);
|
|
|
|
const view_mode = dijit.getEnclosingWidget(toolbar.view_mode);
|
|
|
|
|
|
|
|
prev_prefs = {
|
|
|
|
order_by: order_by.attr("value"),
|
|
|
|
view_mode: view_mode.attr("value"),
|
|
|
|
};
|
|
|
|
prev_key = "ttrss:feedprefs:"+prev_feed;
|
|
|
|
localStorage.setItem(prev_key, JSON.stringify(prev_prefs));
|
|
|
|
|
|
|
|
this.prev_feed = feed[0];
|
|
|
|
|
|
|
|
key = "ttrss:feedprefs:"+feed[0];
|
|
|
|
data = localStorage.getItem(key);
|
|
|
|
console.log
|
|
|
|
if (data) {
|
|
|
|
prefs = JSON.parse(data);
|
2019-05-01 18:38:17 +02:00
|
|
|
//console.log("plugin:feedprefs: "+key+" => "+data);
|
2019-05-01 18:24:45 +02:00
|
|
|
if (prefs.order_by)
|
|
|
|
order_by.attr("value", prefs.order_by);
|
|
|
|
if (prefs.view_mode)
|
|
|
|
view_mode.attr("value", prefs.view_mode);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|