simplify error handling
* less convoluted exception dialogs * use window.onerror for the majority of exception catching/reporting * remove most of now useless try/catch blocks * report stacktrace instead of manually specified error locations
This commit is contained in:
@@ -686,16 +686,6 @@ class Pref_Prefs extends Handler_Protected {
|
||||
|
||||
print " ";
|
||||
|
||||
/* $checked = $_SESSION["prefs_show_advanced"] ? "checked='1'" : "";
|
||||
|
||||
print "<input onclick='toggleAdvancedPrefs()'
|
||||
id='prefs_show_advanced'
|
||||
dojoType=\"dijit.form.CheckBox\"
|
||||
$checked
|
||||
type=\"checkbox\"></input>
|
||||
<label for='prefs_show_advanced'>" .
|
||||
__("Show additional preferences") . "</label>"; */
|
||||
|
||||
PluginHost::getInstance()->run_hooks(PluginHost::HOOK_PREFS_TAB_SECTION,
|
||||
"hook_prefs_tab_section", "prefPrefsPrefsOutside");
|
||||
|
||||
|
||||
@@ -1917,7 +1917,7 @@
|
||||
$attributes, $include_all_cats = true, $root_id = false, $nest_level = 0) {
|
||||
|
||||
if (!$root_id) {
|
||||
print "<select id=\"$id\" name=\"$id\" default=\"$default_id\" onchange=\"catSelectOnChange(this)\" $attributes>";
|
||||
print "<select id=\"$id\" name=\"$id\" default=\"$default_id\" $attributes>";
|
||||
}
|
||||
|
||||
if ($root_id)
|
||||
|
||||
@@ -1902,7 +1902,7 @@
|
||||
WHERE owner_uid = '".$_SESSION["uid"]."' ORDER BY caption");
|
||||
|
||||
print "<select default=\"$value\" name=\"" . htmlspecialchars($name) .
|
||||
"\" $attributes onchange=\"labelSelectOnChange(this)\" >";
|
||||
"\" $attributes>";
|
||||
|
||||
while ($line = db_fetch_assoc($result)) {
|
||||
|
||||
|
||||
@@ -302,7 +302,7 @@ require(["dojo/_base/declare", "dojo/dom-construct", "dijit/Tree", "dijit/Menu"]
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
exception_error("expandParentNodes", e);
|
||||
exception_error(e);
|
||||
}
|
||||
},
|
||||
findNodeParentsAndExpandThem: function(feed, is_cat, root, parents) {
|
||||
@@ -341,7 +341,7 @@ require(["dojo/_base/declare", "dojo/dom-construct", "dijit/Tree", "dijit/Menu"]
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
exception_error("findNodeParentsAndExpandThem", e);
|
||||
exception_error(e);
|
||||
}
|
||||
},
|
||||
selectFeed: function(feed, is_cat) {
|
||||
|
||||
@@ -8,9 +8,6 @@ function selectTableRow(r, do_select) {
|
||||
}
|
||||
|
||||
function selectTableRowById(elem_id, check_id, do_select) {
|
||||
|
||||
try {
|
||||
|
||||
var row = $(elem_id);
|
||||
|
||||
if (row) {
|
||||
@@ -22,8 +19,5 @@ function selectTableRowById(elem_id, check_id, do_select) {
|
||||
if (check) {
|
||||
check.checked = do_select;
|
||||
}
|
||||
} catch (e) {
|
||||
exception_error("selectTableRowById", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,17 +8,11 @@ var _viewfeed_timeout = false;
|
||||
var counters_last_request = 0;
|
||||
var _counters_prev = [];
|
||||
|
||||
/*function viewCategory(cat) {
|
||||
viewfeed({feed: cat, is_cat: true});
|
||||
return false;
|
||||
}*/
|
||||
|
||||
function resetCounterCache() {
|
||||
_counters_prev = [];
|
||||
}
|
||||
|
||||
function loadMoreHeadlines() {
|
||||
try {
|
||||
console.log("loadMoreHeadlines");
|
||||
|
||||
var offset = 0;
|
||||
@@ -51,13 +45,9 @@ function loadMoreHeadlines() {
|
||||
|
||||
viewfeed({feed: getActiveFeedId(), is_cat: activeFeedIsCat(), offset: offset, infscroll_req: true});
|
||||
|
||||
} catch (e) {
|
||||
exception_error("viewNextFeedPage", e);
|
||||
}
|
||||
}
|
||||
|
||||
function cleanup_memory(root) {
|
||||
try {
|
||||
var dijits = dojo.query("[widgetid]", dijit.byId(root).domNode).map(dijit.byNode);
|
||||
|
||||
dijits.each(function (d) {
|
||||
@@ -67,14 +57,9 @@ function cleanup_memory(root) {
|
||||
$$("#" + root + " *").each(function (i) {
|
||||
i.parentNode ? i.parentNode.removeChild(i) : true;
|
||||
});
|
||||
} catch (e) {
|
||||
console.log("cleanup_memory: exception");
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
|
||||
function viewfeed(params) {
|
||||
try {
|
||||
var feed = params.feed;
|
||||
var is_cat = params.is_cat;
|
||||
var offset = params.offset;
|
||||
@@ -185,19 +170,19 @@ function viewfeed(params) {
|
||||
new Ajax.Request("backend.php", {
|
||||
parameters: query,
|
||||
onComplete: function(transport) {
|
||||
try {
|
||||
setFeedExpandoIcon(feed, is_cat, 'images/blank_icon.gif');
|
||||
headlines_callback2(transport, offset, background, infscroll_req);
|
||||
PluginHost.run(PluginHost.HOOK_FEED_LOADED, [feed, is_cat]);
|
||||
} catch (e) {
|
||||
exception_error(e);
|
||||
}
|
||||
} });
|
||||
}, timeout_ms); // Wait 250ms
|
||||
|
||||
} catch (e) {
|
||||
exception_error("viewfeed", e);
|
||||
}
|
||||
}
|
||||
|
||||
function feedlist_init() {
|
||||
try {
|
||||
console.log("in feedlist init");
|
||||
|
||||
loading_set_progress(50);
|
||||
@@ -216,14 +201,10 @@ function feedlist_init() {
|
||||
request_counters(true);
|
||||
timeout();
|
||||
|
||||
} catch (e) {
|
||||
exception_error("feedlist/init", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function request_counters(force) {
|
||||
try {
|
||||
var date = new Date();
|
||||
var timestamp = Math.round(date.getTime() / 1000);
|
||||
|
||||
@@ -242,20 +223,12 @@ function request_counters(force) {
|
||||
new Ajax.Request("backend.php", {
|
||||
parameters: query,
|
||||
onComplete: function(transport) {
|
||||
try {
|
||||
handle_rpc_json(transport);
|
||||
} catch (e) {
|
||||
exception_error("request_counters", e);
|
||||
}
|
||||
} });
|
||||
|
||||
} else {
|
||||
console.log("request_counters: rate limit reached: " + (timestamp - counters_last_request));
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
exception_error("request_counters", e);
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE: this implementation is incomplete
|
||||
@@ -289,7 +262,6 @@ function counter_is_equal(a, b) {
|
||||
|
||||
|
||||
function parse_counters(elems) {
|
||||
try {
|
||||
for (var l = 0; l < elems.length; l++) {
|
||||
|
||||
if (_counters_prev[l] && counter_is_equal(elems[l], _counters_prev[l])) {
|
||||
@@ -340,10 +312,6 @@ function parse_counters(elems) {
|
||||
hideOrShowFeeds(getInitParam("hide_read_feeds") == 1);
|
||||
|
||||
_counters_prev = elems;
|
||||
|
||||
} catch (e) {
|
||||
exception_error("parse_counters", e);
|
||||
}
|
||||
}
|
||||
|
||||
function getFeedUnread(feed, is_cat) {
|
||||
@@ -405,15 +373,10 @@ function getFeedValue(feed, is_cat, key) {
|
||||
}
|
||||
|
||||
function setFeedUnread(feed, is_cat, unread) {
|
||||
try {
|
||||
var tree = dijit.byId("feedTree");
|
||||
|
||||
if (tree && tree.model)
|
||||
return tree.model.setFeedUnread(feed, is_cat, unread);
|
||||
|
||||
} catch (e) {
|
||||
exception_error("setFeedUnread", e);
|
||||
}
|
||||
}
|
||||
|
||||
function setFeedValue(feed, is_cat, key, value) {
|
||||
@@ -429,50 +392,31 @@ function setFeedValue(feed, is_cat, key, value) {
|
||||
}
|
||||
|
||||
function selectFeed(feed, is_cat) {
|
||||
try {
|
||||
var tree = dijit.byId("feedTree");
|
||||
|
||||
if (tree) return tree.selectFeed(feed, is_cat);
|
||||
|
||||
} catch (e) {
|
||||
exception_error("selectFeed", e);
|
||||
}
|
||||
}
|
||||
|
||||
function setFeedIcon(feed, is_cat, src) {
|
||||
try {
|
||||
var tree = dijit.byId("feedTree");
|
||||
|
||||
if (tree) return tree.setFeedIcon(feed, is_cat, src);
|
||||
|
||||
} catch (e) {
|
||||
exception_error("setFeedIcon", e);
|
||||
}
|
||||
}
|
||||
|
||||
function setFeedExpandoIcon(feed, is_cat, src) {
|
||||
try {
|
||||
var tree = dijit.byId("feedTree");
|
||||
|
||||
if (tree) return tree.setFeedExpandoIcon(feed, is_cat, src);
|
||||
|
||||
} catch (e) {
|
||||
exception_error("setFeedIcon", e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function getNextUnreadFeed(feed, is_cat) {
|
||||
try {
|
||||
var tree = dijit.byId("feedTree");
|
||||
var nuf = tree.model.getNextUnreadFeed(feed, is_cat);
|
||||
|
||||
if (nuf)
|
||||
return tree.model.store.getValue(nuf, 'bare_id');
|
||||
|
||||
} catch (e) {
|
||||
exception_error("getNextUnreadFeed", e);
|
||||
}
|
||||
}
|
||||
|
||||
function catchupCurrentFeed(mode) {
|
||||
@@ -480,8 +424,6 @@ function catchupCurrentFeed(mode) {
|
||||
}
|
||||
|
||||
function catchupFeedInGroup(id) {
|
||||
try {
|
||||
|
||||
var title = getFeedName(id);
|
||||
|
||||
var str = __("Mark all articles in %s as read?").replace("%s", title);
|
||||
@@ -533,14 +475,9 @@ function catchupFeedInGroup(id) {
|
||||
|
||||
//return viewCurrentFeed('MarkAllReadGR:' + id);
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
exception_error("catchupFeedInGroup", e);
|
||||
}
|
||||
}
|
||||
|
||||
function catchupFeed(feed, is_cat, mode) {
|
||||
try {
|
||||
if (is_cat == undefined) is_cat = false;
|
||||
|
||||
var str = false;
|
||||
@@ -596,13 +533,9 @@ function catchupFeed(feed, is_cat, mode) {
|
||||
notify("");
|
||||
} });
|
||||
|
||||
} catch (e) {
|
||||
exception_error("catchupFeed", e);
|
||||
}
|
||||
}
|
||||
|
||||
function decrementFeedCounter(feed, is_cat) {
|
||||
try {
|
||||
var ctr = getFeedUnread(feed, is_cat);
|
||||
|
||||
if (ctr > 0) {
|
||||
@@ -623,9 +556,6 @@ function decrementFeedCounter(feed, is_cat) {
|
||||
}
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
exception_error("decrement_feed_counter", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
369
js/functions.js
369
js/functions.js
@@ -30,23 +30,18 @@ Array.prototype.remove = function(s) {
|
||||
}
|
||||
};
|
||||
|
||||
/* create console.log if it doesn't exist */
|
||||
|
||||
if (!window.console) console = {};
|
||||
console.log = console.log || function(msg) { };
|
||||
console.warn = console.warn || function(msg) { };
|
||||
console.error = console.error || function(msg) { };
|
||||
function report_error(message, filename, lineno, colno, error) {
|
||||
exception_error(error);
|
||||
}
|
||||
|
||||
function exception_error(location, e, ext_info) {
|
||||
var msg = format_exception_error(location, e);
|
||||
function exception_error(e, e_compat) {
|
||||
if (typeof e == "string") e = e_compat;
|
||||
|
||||
if (!ext_info) ext_info = false;
|
||||
if (!e) return; // no exception object, nothing to report.
|
||||
|
||||
try {
|
||||
|
||||
if (ext_info)
|
||||
ext_info = JSON.stringify(ext_info);
|
||||
|
||||
try {
|
||||
new Ajax.Request("backend.php", {
|
||||
parameters: {op: "rpc", method: "log", logmsg: msg},
|
||||
@@ -54,14 +49,17 @@ function exception_error(location, e, ext_info) {
|
||||
console.log(transport.responseText);
|
||||
} });
|
||||
|
||||
} catch (eii) {
|
||||
console.log("Exception while trying to log the error.");
|
||||
console.log(eii);
|
||||
} catch (e) {
|
||||
console.error("Exception while trying to log the error.", e);
|
||||
}
|
||||
|
||||
var msg = e.toString();
|
||||
|
||||
msg += "<p>"+ __("The error will be reported to the configured log destination.") +
|
||||
"</p>";
|
||||
|
||||
console.error(msg);
|
||||
|
||||
var content = "<div class=\"fatalError\">" +
|
||||
"<pre>" + msg + "</pre>";
|
||||
|
||||
@@ -71,13 +69,10 @@ function exception_error(location, e, ext_info) {
|
||||
content += "<textarea style=\"display : none\" name=\"message\">" + msg + "</textarea>";
|
||||
content += "<textarea style=\"display : none\" name=\"params\">N/A</textarea>";
|
||||
|
||||
if (ext_info) {
|
||||
content += "<div><b>Additional information:</b></div>" +
|
||||
"<textarea name=\"xinfo\" readonly=\"1\">" + ext_info + "</textarea>";
|
||||
}
|
||||
|
||||
if (e) {
|
||||
content += "<div><b>Stack trace:</b></div>" +
|
||||
"<textarea name=\"stack\" readonly=\"1\">" + e.stack + "</textarea>";
|
||||
}
|
||||
|
||||
content += "</form>";
|
||||
|
||||
@@ -121,51 +116,13 @@ function exception_error(location, e, ext_info) {
|
||||
dialog.show();
|
||||
|
||||
} catch (ei) {
|
||||
console.log("Exception while trying to report an exception. Oh boy.");
|
||||
console.log(ei);
|
||||
console.log("Original exception:");
|
||||
console.log(e);
|
||||
console.error("Exception while trying to report an exception:", ei);
|
||||
console.error("Original exception:", e);
|
||||
|
||||
msg += "\n\nAdditional exception caught while trying to show the error dialog.\n\n" + format_exception_error('exception_error', ei);
|
||||
|
||||
try {
|
||||
new Ajax.Request("backend.php", {
|
||||
parameters: {op: "rpc", method: "log", logmsg: msg},
|
||||
onComplete: function (transport) {
|
||||
console.log(transport.responseText);
|
||||
} });
|
||||
|
||||
} catch (eii) {
|
||||
console.log("Third exception while trying to log the error! Seriously?");
|
||||
console.log(eii);
|
||||
alert("Exception occured while trying to report an exception.\n" +
|
||||
ei.stack + "\n\nOriginal exception:\n" + e.stack);
|
||||
}
|
||||
|
||||
msg += "\n\nThe error will be reported to the configured log destination.";
|
||||
|
||||
alert(msg);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function format_exception_error(location, e) {
|
||||
var msg;
|
||||
|
||||
if (e.fileName) {
|
||||
var base_fname = e.fileName.substring(e.fileName.lastIndexOf("/") + 1);
|
||||
|
||||
msg = "Exception: " + e.name + ", " + e.message +
|
||||
"\nFunction: " + location + "()" +
|
||||
"\nLocation: " + base_fname + ":" + e.lineNumber;
|
||||
|
||||
} else if (e.description) {
|
||||
msg = "Exception: " + e.description + "\nFunction: " + location + "()";
|
||||
} else {
|
||||
msg = "Exception: " + e + "\nFunction: " + location + "()";
|
||||
}
|
||||
|
||||
console.error("EXCEPTION: " + msg);
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
function param_escape(arg) {
|
||||
@@ -432,14 +389,10 @@ function getURLParam(param){
|
||||
}
|
||||
|
||||
function closeInfoBox(cleanup) {
|
||||
try {
|
||||
dialog = dijit.byId("infoBox");
|
||||
|
||||
if (dialog) dialog.hide();
|
||||
|
||||
} catch (e) {
|
||||
//exception_error("closeInfoBox", e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -462,7 +415,6 @@ function displayDlg(title, id, param, callback) {
|
||||
}
|
||||
|
||||
function infobox_callback2(transport, title) {
|
||||
try {
|
||||
var dialog = false;
|
||||
|
||||
if (dijit.byId("infoBox")) {
|
||||
@@ -497,9 +449,6 @@ function infobox_callback2(transport, title) {
|
||||
dialog.show();
|
||||
|
||||
notify("");
|
||||
} catch (e) {
|
||||
exception_error("infobox_callback2", e);
|
||||
}
|
||||
}
|
||||
|
||||
function getInitParam(key) {
|
||||
@@ -511,8 +460,6 @@ function setInitParam(key, value) {
|
||||
}
|
||||
|
||||
function fatalError(code, msg, ext_info) {
|
||||
try {
|
||||
|
||||
if (code == 6) {
|
||||
window.location.href = "index.php";
|
||||
} else if (code == 5) {
|
||||
@@ -551,15 +498,9 @@ function fatalError(code, msg, ext_info) {
|
||||
|
||||
return false;
|
||||
|
||||
} catch (e) {
|
||||
exception_error("fatalError", e);
|
||||
}
|
||||
}
|
||||
|
||||
function filterDlgCheckAction(sender) {
|
||||
|
||||
try {
|
||||
|
||||
var action = sender.value;
|
||||
|
||||
var action_param = $("filterDlg_paramBox");
|
||||
@@ -588,11 +529,6 @@ function filterDlgCheckAction(sender) {
|
||||
} else {
|
||||
Element.hide(action_param);
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
exception_error("filterDlgCheckAction", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -601,7 +537,6 @@ function explainError(code) {
|
||||
}
|
||||
|
||||
function loading_set_progress(p) {
|
||||
try {
|
||||
loading_progress += p;
|
||||
|
||||
if (dijit.byId("loading_bar"))
|
||||
@@ -610,9 +545,6 @@ function loading_set_progress(p) {
|
||||
if (loading_progress >= 90)
|
||||
remove_splash();
|
||||
|
||||
} catch (e) {
|
||||
exception_error("loading_set_progress", e);
|
||||
}
|
||||
}
|
||||
|
||||
function remove_splash() {
|
||||
@@ -624,26 +556,6 @@ function remove_splash() {
|
||||
}
|
||||
}
|
||||
|
||||
function transport_error_check(transport) {
|
||||
try {
|
||||
if (transport.responseXML) {
|
||||
var error = transport.responseXML.getElementsByTagName("error")[0];
|
||||
|
||||
if (error) {
|
||||
var code = error.getAttribute("error-code");
|
||||
var msg = error.getAttribute("error-msg");
|
||||
if (code != 0) {
|
||||
fatalError(code, msg);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
exception_error("check_for_error_xml", e);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function strip_tags(s) {
|
||||
return s.replace(/<\/?[^>]+(>|$)/g, "");
|
||||
}
|
||||
@@ -656,7 +568,6 @@ function truncate_string(s, length) {
|
||||
}
|
||||
|
||||
function hotkey_prefix_timeout() {
|
||||
try {
|
||||
|
||||
var date = new Date();
|
||||
var ts = Math.round(date.getTime() / 1000);
|
||||
@@ -670,13 +581,9 @@ function hotkey_prefix_timeout() {
|
||||
|
||||
setTimeout(hotkey_prefix_timeout, 1000);
|
||||
|
||||
} catch (e) {
|
||||
exception_error("hotkey_prefix_timeout", e);
|
||||
}
|
||||
}
|
||||
|
||||
function uploadIconHandler(rc) {
|
||||
try {
|
||||
switch (rc) {
|
||||
case 0:
|
||||
notify_info("Upload complete.");
|
||||
@@ -693,16 +600,9 @@ function uploadIconHandler(rc) {
|
||||
notify_error("Upload failed.");
|
||||
break;
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
exception_error("uploadIconHandler", e);
|
||||
}
|
||||
}
|
||||
|
||||
function removeFeedIcon(id) {
|
||||
|
||||
try {
|
||||
|
||||
if (confirm(__("Remove stored feed icon?"))) {
|
||||
var query = "backend.php?op=pref-feeds&method=removeicon&feed_id=" + param_escape(id);
|
||||
|
||||
@@ -723,15 +623,9 @@ function removeFeedIcon(id) {
|
||||
}
|
||||
|
||||
return false;
|
||||
} catch (e) {
|
||||
exception_error("removeFeedIcon", e);
|
||||
}
|
||||
}
|
||||
|
||||
function uploadFeedIcon() {
|
||||
|
||||
try {
|
||||
|
||||
var file = $("icon_file");
|
||||
|
||||
if (file.value.length == 0) {
|
||||
@@ -744,16 +638,10 @@ function uploadFeedIcon() {
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
} catch (e) {
|
||||
exception_error("uploadFeedIcon", e);
|
||||
}
|
||||
}
|
||||
|
||||
function addLabel(select, callback) {
|
||||
|
||||
try {
|
||||
|
||||
var caption = prompt(__("Please enter label caption:"), "");
|
||||
|
||||
if (caption != undefined) {
|
||||
@@ -787,13 +675,9 @@ function addLabel(select, callback) {
|
||||
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
exception_error("addLabel", e);
|
||||
}
|
||||
}
|
||||
|
||||
function quickAddFeed() {
|
||||
try {
|
||||
var query = "backend.php?op=feeds&method=quickAddFeed";
|
||||
|
||||
// overlapping widgets
|
||||
@@ -892,7 +776,8 @@ function quickAddFeed() {
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
exception_error("subscribeToFeed", e, transport);
|
||||
console.error(transport.responseText);
|
||||
exception_error(e);
|
||||
}
|
||||
|
||||
} });
|
||||
@@ -902,13 +787,9 @@ function quickAddFeed() {
|
||||
href: query});
|
||||
|
||||
dialog.show();
|
||||
} catch (e) {
|
||||
exception_error("quickAddFeed", e);
|
||||
}
|
||||
}
|
||||
|
||||
function createNewRuleElement(parentNode, replaceNode) {
|
||||
try {
|
||||
var form = document.forms["filter_new_rule_form"];
|
||||
|
||||
//form.reg_exp.value = form.reg_exp.value.replace(/(<([^>]+)>)/ig,"");
|
||||
@@ -947,16 +828,12 @@ function createNewRuleElement(parentNode, replaceNode) {
|
||||
parentNode.appendChild(li);
|
||||
}
|
||||
} catch (e) {
|
||||
exception_error("createNewRuleElement", e);
|
||||
exception_error(e);
|
||||
}
|
||||
} });
|
||||
} catch (e) {
|
||||
exception_error("createNewRuleElement", e);
|
||||
}
|
||||
}
|
||||
|
||||
function createNewActionElement(parentNode, replaceNode) {
|
||||
try {
|
||||
var form = document.forms["filter_new_action_form"];
|
||||
|
||||
if (form.action_id.value == 7) {
|
||||
@@ -1000,17 +877,13 @@ function createNewActionElement(parentNode, replaceNode) {
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
exception_error("createNewActionElement", e);
|
||||
exception_error(e);
|
||||
}
|
||||
} });
|
||||
} catch (e) {
|
||||
exception_error("createNewActionElement", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function addFilterRule(replaceNode, ruleStr) {
|
||||
try {
|
||||
if (dijit.byId("filterNewRuleDlg"))
|
||||
dijit.byId("filterNewRuleDlg").destroyRecursive();
|
||||
|
||||
@@ -1030,13 +903,9 @@ function addFilterRule(replaceNode, ruleStr) {
|
||||
href: query});
|
||||
|
||||
rule_dlg.show();
|
||||
} catch (e) {
|
||||
exception_error("addFilterRule", e);
|
||||
}
|
||||
}
|
||||
|
||||
function addFilterAction(replaceNode, actionStr) {
|
||||
try {
|
||||
if (dijit.byId("filterNewActionDlg"))
|
||||
dijit.byId("filterNewActionDlg").destroyRecursive();
|
||||
|
||||
@@ -1056,13 +925,9 @@ function addFilterAction(replaceNode, actionStr) {
|
||||
href: query});
|
||||
|
||||
rule_dlg.show();
|
||||
} catch (e) {
|
||||
exception_error("addFilterAction", e);
|
||||
}
|
||||
}
|
||||
|
||||
function editFilterTest(query) {
|
||||
try {
|
||||
|
||||
if (dijit.byId("filterTestDlg"))
|
||||
dijit.byId("filterTestDlg").destroyRecursive();
|
||||
@@ -1137,7 +1002,7 @@ function editFilterTest(query) {
|
||||
console.log("getTestResults: dialog closed, bailing out.");
|
||||
}
|
||||
} catch (e) {
|
||||
exception_error("editFilterTest/inner", e);
|
||||
exception_error(e);
|
||||
}
|
||||
|
||||
} });
|
||||
@@ -1150,13 +1015,9 @@ function editFilterTest(query) {
|
||||
|
||||
test_dlg.show();
|
||||
|
||||
} catch (e) {
|
||||
exception_error("editFilterTest", e);
|
||||
}
|
||||
}
|
||||
|
||||
function quickAddFilter() {
|
||||
try {
|
||||
var query = "";
|
||||
if (!inPreferences()) {
|
||||
query = "backend.php?op=pref-filters&method=newfilter&feed=" +
|
||||
@@ -1290,9 +1151,6 @@ function quickAddFilter() {
|
||||
|
||||
dialog.show();
|
||||
|
||||
} catch (e) {
|
||||
exception_error("quickAddFilter", e);
|
||||
}
|
||||
}
|
||||
|
||||
function resetPubSub(feed_id, title) {
|
||||
@@ -1349,8 +1207,6 @@ function unsubscribeFeed(feed_id, title) {
|
||||
|
||||
function backend_sanity_check_callback(transport) {
|
||||
|
||||
try {
|
||||
|
||||
if (sanity_check_done) {
|
||||
fatalError(11, "Sanity check request received twice. This can indicate "+
|
||||
"presence of Firebug or some other disrupting extension. "+
|
||||
@@ -1393,41 +1249,9 @@ function backend_sanity_check_callback(transport) {
|
||||
|
||||
init_second_stage();
|
||||
|
||||
} catch (e) {
|
||||
exception_error("backend_sanity_check_callback", e, transport);
|
||||
}
|
||||
}
|
||||
|
||||
/*function has_local_storage() {
|
||||
try {
|
||||
return 'sessionStorage' in window && window['sessionStorage'] != null;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
} */
|
||||
|
||||
function catSelectOnChange(elem) {
|
||||
try {
|
||||
/* var value = elem[elem.selectedIndex].value;
|
||||
var def = elem.getAttribute('default');
|
||||
|
||||
if (value == "ADD_CAT") {
|
||||
|
||||
if (def)
|
||||
dropboxSelect(elem, def);
|
||||
else
|
||||
elem.selectedIndex = 0;
|
||||
|
||||
quickAddCat(elem);
|
||||
} */
|
||||
|
||||
} catch (e) {
|
||||
exception_error("catSelectOnChange", e);
|
||||
}
|
||||
}
|
||||
|
||||
function quickAddCat(elem) {
|
||||
try {
|
||||
var cat = prompt(__("Please enter category title:"));
|
||||
|
||||
if (cat) {
|
||||
@@ -1450,15 +1274,9 @@ function quickAddCat(elem) {
|
||||
} });
|
||||
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
exception_error("quickAddCat", e);
|
||||
}
|
||||
}
|
||||
|
||||
function genUrlChangeKey(feed, is_cat) {
|
||||
|
||||
try {
|
||||
var ok = confirm(__("Generate new syndication address for this feed?"));
|
||||
|
||||
if (ok) {
|
||||
@@ -1493,49 +1311,10 @@ function genUrlChangeKey(feed, is_cat) {
|
||||
}
|
||||
} });
|
||||
}
|
||||
} catch (e) {
|
||||
exception_error("genUrlChangeKey", e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function labelSelectOnChange(elem) {
|
||||
try {
|
||||
/* var value = elem[elem.selectedIndex].value;
|
||||
var def = elem.getAttribute('default');
|
||||
|
||||
if (value == "ADD_LABEL") {
|
||||
|
||||
if (def)
|
||||
dropboxSelect(elem, def);
|
||||
else
|
||||
elem.selectedIndex = 0;
|
||||
|
||||
addLabel(elem, function(transport) {
|
||||
|
||||
try {
|
||||
|
||||
var response = transport.responseXML;
|
||||
var select = response.getElementsByTagName("select")[0];
|
||||
var options = select.getElementsByTagName("option");
|
||||
|
||||
dropbox_replace_options(elem, options);
|
||||
|
||||
notify('');
|
||||
} catch (e) {
|
||||
exception_error("addLabel", e);
|
||||
}
|
||||
});
|
||||
} */
|
||||
|
||||
} catch (e) {
|
||||
exception_error("labelSelectOnChange", e);
|
||||
}
|
||||
}
|
||||
|
||||
function dropbox_replace_options(elem, options) {
|
||||
|
||||
try {
|
||||
while (elem.hasChildNodes())
|
||||
elem.removeChild(elem.firstChild);
|
||||
|
||||
@@ -1561,15 +1340,10 @@ function dropbox_replace_options(elem, options) {
|
||||
|
||||
// Chrome doesn't seem to just select stuff when you pass new Option(x, y, true)
|
||||
if (sel_idx >= 0) elem.selectedIndex = sel_idx;
|
||||
|
||||
} catch (e) {
|
||||
exception_error("dropbox_replace_options", e);
|
||||
}
|
||||
}
|
||||
|
||||
// mode = all, none, invert
|
||||
function selectTableRows(id, mode) {
|
||||
try {
|
||||
var rows = $(id).rows;
|
||||
|
||||
for (var i = 0; i < rows.length; i++) {
|
||||
@@ -1621,16 +1395,11 @@ function selectTableRows(id, mode) {
|
||||
}
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
exception_error("selectTableRows", e);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function getSelectedTableRowIds(id) {
|
||||
var rows = [];
|
||||
|
||||
try {
|
||||
var elem_rows = $(id).rows;
|
||||
|
||||
for (var i = 0; i < elem_rows.length; i++) {
|
||||
@@ -1640,15 +1409,10 @@ function getSelectedTableRowIds(id) {
|
||||
}
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
exception_error("getSelectedTableRowIds", e);
|
||||
}
|
||||
|
||||
return rows;
|
||||
}
|
||||
|
||||
function editFeed(feed, event) {
|
||||
try {
|
||||
if (feed <= 0)
|
||||
return alert(__("You can't edit this kind of feed."));
|
||||
|
||||
@@ -1685,14 +1449,9 @@ function editFeed(feed, event) {
|
||||
href: query});
|
||||
|
||||
dialog.show();
|
||||
|
||||
} catch (e) {
|
||||
exception_error("editFeed", e);
|
||||
}
|
||||
}
|
||||
|
||||
function feedBrowser() {
|
||||
try {
|
||||
var query = "backend.php?op=feeds&method=feedBrowser";
|
||||
|
||||
if (dijit.byId("feedAddDlg"))
|
||||
@@ -1761,7 +1520,8 @@ function feedBrowser() {
|
||||
onComplete: function (transport) {
|
||||
notify('');
|
||||
updateFeedList();
|
||||
} });
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
alert(__("No feeds are selected."));
|
||||
@@ -1799,7 +1559,8 @@ function feedBrowser() {
|
||||
Element.hide(dijit.byId('feed_archive_remove').domNode);
|
||||
}
|
||||
|
||||
} });
|
||||
}
|
||||
});
|
||||
},
|
||||
removeFromArchive: function () {
|
||||
var selected = this.getSelectedFeedIds();
|
||||
@@ -1812,13 +1573,15 @@ function feedBrowser() {
|
||||
Element.show('feed_browser_spinner');
|
||||
|
||||
var query = "?op=rpc&method=remarchive&ids=" +
|
||||
param_escape(selected.toString());;
|
||||
param_escape(selected.toString());
|
||||
;
|
||||
|
||||
new Ajax.Request("backend.php", {
|
||||
parameters: query,
|
||||
onComplete: function (transport) {
|
||||
dialog.update();
|
||||
} });
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -1827,17 +1590,13 @@ function feedBrowser() {
|
||||
this.subscribe();
|
||||
}
|
||||
},
|
||||
href: query});
|
||||
href: query
|
||||
});
|
||||
|
||||
dialog.show();
|
||||
|
||||
} catch (e) {
|
||||
exception_error("editFeed", e);
|
||||
}
|
||||
}
|
||||
|
||||
function showFeedsWithErrors() {
|
||||
try {
|
||||
var query = "backend.php?op=pref-feeds&method=feedsWithErrors";
|
||||
|
||||
if (dijit.byId("errorFeedsDlg"))
|
||||
@@ -1884,63 +1643,6 @@ function showFeedsWithErrors() {
|
||||
href: query});
|
||||
|
||||
dialog.show();
|
||||
|
||||
} catch (e) {
|
||||
exception_error("showFeedsWithErrors", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* new support functions for SelectByTag */
|
||||
|
||||
function get_all_tags(selObj){
|
||||
try {
|
||||
if( !selObj ) return "";
|
||||
|
||||
var result = "";
|
||||
var len = selObj.options.length;
|
||||
|
||||
for (var i=0; i < len; i++){
|
||||
if (selObj.options[i].selected) {
|
||||
result += selObj[i].value + "%2C"; // is really a comma
|
||||
}
|
||||
}
|
||||
|
||||
if (result.length > 0){
|
||||
result = result.substr(0, result.length-3); // remove trailing %2C
|
||||
}
|
||||
|
||||
return(result);
|
||||
|
||||
} catch (e) {
|
||||
exception_error("get_all_tags", e);
|
||||
}
|
||||
}
|
||||
|
||||
function get_radio_checked(radioObj) {
|
||||
try {
|
||||
if (!radioObj) return "";
|
||||
|
||||
var len = radioObj.length;
|
||||
|
||||
if (len == undefined){
|
||||
if(radioObj.checked){
|
||||
return(radioObj.value);
|
||||
} else {
|
||||
return("");
|
||||
}
|
||||
}
|
||||
|
||||
for( var i=0; i < len; i++ ){
|
||||
if( radioObj[i].checked ){
|
||||
return( radioObj[i].value);
|
||||
}
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
exception_error("get_radio_checked", e);
|
||||
}
|
||||
return("");
|
||||
}
|
||||
|
||||
function get_timestamp() {
|
||||
@@ -1949,7 +1651,6 @@ function get_timestamp() {
|
||||
}
|
||||
|
||||
function helpDialog(topic) {
|
||||
try {
|
||||
var query = "backend.php?op=backend&method=help&topic=" + param_escape(topic);
|
||||
|
||||
if (dijit.byId("helpDlg"))
|
||||
@@ -1963,10 +1664,6 @@ function helpDialog(topic) {
|
||||
});
|
||||
|
||||
dialog.show();
|
||||
|
||||
} catch (e) {
|
||||
exception_error("helpDialog", e);
|
||||
}
|
||||
}
|
||||
|
||||
function htmlspecialchars_decode (string, quote_style) {
|
||||
|
||||
331
js/prefs.js
331
js/prefs.js
@@ -25,25 +25,22 @@ function updateFeedList(sort_key) {
|
||||
}
|
||||
|
||||
function checkInactiveFeeds() {
|
||||
try {
|
||||
new Ajax.Request("backend.php", {
|
||||
parameters: "?op=pref-feeds&method=getinactivefeeds",
|
||||
onComplete: function (transport) {
|
||||
if (parseInt(transport.responseText) > 0) {
|
||||
Element.show(dijit.byId("pref_feeds_inactive_btn").domNode);
|
||||
}
|
||||
} });
|
||||
|
||||
} catch (e) {
|
||||
exception_error("checkInactiveFeeds", e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function updateUsersList(sort_key) {
|
||||
try {
|
||||
var user_search = $("user_search");
|
||||
var search = "";
|
||||
if (user_search) { search = user_search.value; }
|
||||
if (user_search) {
|
||||
search = user_search.value;
|
||||
}
|
||||
|
||||
var query = "?op=pref-users&sort="
|
||||
+ param_escape(sort_key) +
|
||||
@@ -55,17 +52,11 @@ function updateUsersList(sort_key) {
|
||||
dijit.byId('userConfigTab').attr('content', transport.responseText);
|
||||
selectTab("userConfig", true)
|
||||
notify("");
|
||||
} });
|
||||
|
||||
} catch (e) {
|
||||
exception_error("updateUsersList", e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function addUser() {
|
||||
|
||||
try {
|
||||
|
||||
var login = prompt(__("Please enter login:"), "");
|
||||
|
||||
if (login == null) {
|
||||
@@ -87,16 +78,13 @@ function addUser() {
|
||||
onComplete: function (transport) {
|
||||
notify_callback2(transport);
|
||||
updateUsersList();
|
||||
} });
|
||||
|
||||
} catch (e) {
|
||||
exception_error("addUser", e);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function editUser(id, event) {
|
||||
|
||||
try {
|
||||
var query = "backend.php?op=pref-users&method=edit&id=" +
|
||||
param_escape(id);
|
||||
|
||||
@@ -118,21 +106,17 @@ function editUser(id, event) {
|
||||
onComplete: function (transport) {
|
||||
dialog.hide();
|
||||
updateUsersList();
|
||||
}});
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
href: query});
|
||||
href: query
|
||||
});
|
||||
|
||||
dialog.show();
|
||||
|
||||
} catch (e) {
|
||||
exception_error("editUser", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function editFilter(id) {
|
||||
try {
|
||||
|
||||
var query = "backend.php?op=pref-filters&method=edit&id=" + param_escape(id);
|
||||
|
||||
@@ -199,16 +183,25 @@ function editFilter(id) {
|
||||
parameters: query,
|
||||
onComplete: function (transport) {
|
||||
updateFilterList();
|
||||
} });
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
addAction: function() { addFilterAction(); },
|
||||
addRule: function() { addFilterRule(); },
|
||||
addAction: function () {
|
||||
addFilterAction();
|
||||
},
|
||||
addRule: function () {
|
||||
addFilterRule();
|
||||
},
|
||||
deleteAction: function () {
|
||||
$$("#filterDlg_Actions li[class*=Selected]").each(function(e) { e.parentNode.removeChild(e) });
|
||||
$$("#filterDlg_Actions li[class*=Selected]").each(function (e) {
|
||||
e.parentNode.removeChild(e)
|
||||
});
|
||||
},
|
||||
deleteRule: function () {
|
||||
$$("#filterDlg_Matches li[class*=Selected]").each(function(e) { e.parentNode.removeChild(e) });
|
||||
$$("#filterDlg_Matches li[class*=Selected]").each(function (e) {
|
||||
e.parentNode.removeChild(e)
|
||||
});
|
||||
},
|
||||
execute: function () {
|
||||
if (this.validate()) {
|
||||
@@ -224,19 +217,17 @@ function editFilter(id) {
|
||||
onComplete: function (transport) {
|
||||
dialog.hide();
|
||||
updateFilterList();
|
||||
}});
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
href: query});
|
||||
href: query
|
||||
});
|
||||
|
||||
dialog.show();
|
||||
|
||||
|
||||
} catch (e) {
|
||||
exception_error("editFilter", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function getSelectedLabels() {
|
||||
var tree = dijit.byId("labelTree");
|
||||
var items = tree.model.getCheckedItems();
|
||||
@@ -322,8 +313,6 @@ function removeSelectedLabels() {
|
||||
|
||||
function removeSelectedUsers() {
|
||||
|
||||
try {
|
||||
|
||||
var sel_rows = getSelectedUsers();
|
||||
|
||||
if (sel_rows.length > 0) {
|
||||
@@ -340,7 +329,8 @@ function removeSelectedUsers() {
|
||||
parameters: query,
|
||||
onComplete: function (transport) {
|
||||
updateUsersList();
|
||||
} });
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@@ -348,17 +338,11 @@ function removeSelectedUsers() {
|
||||
alert(__("No users are selected."));
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
exception_error("removeSelectedUsers", e);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function removeSelectedFilters() {
|
||||
|
||||
try {
|
||||
|
||||
var sel_rows = getSelectedFilters();
|
||||
|
||||
if (sel_rows.length > 0) {
|
||||
@@ -375,24 +359,18 @@ function removeSelectedFilters() {
|
||||
parameters: query,
|
||||
onComplete: function (transport) {
|
||||
updateFilterList();
|
||||
} });
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
alert(__("No filters are selected."));
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
exception_error("removeSelectedFilters", e);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
function removeSelectedFeeds() {
|
||||
|
||||
try {
|
||||
|
||||
var sel_rows = getSelectedFeeds();
|
||||
|
||||
if (sel_rows.length > 0) {
|
||||
@@ -412,17 +390,14 @@ function removeSelectedFeeds() {
|
||||
parameters: query,
|
||||
onComplete: function (transport) {
|
||||
updateFeedList();
|
||||
} });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
} else {
|
||||
alert(__("No feeds are selected."));
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
exception_error("removeSelectedFeeds", e);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -505,8 +480,6 @@ function editSelectedUser() {
|
||||
|
||||
function resetSelectedUserPass() {
|
||||
|
||||
try {
|
||||
|
||||
var rows = getSelectedUsers();
|
||||
|
||||
if (rows.length == 0) {
|
||||
@@ -533,19 +506,14 @@ function resetSelectedUserPass() {
|
||||
parameters: query,
|
||||
onComplete: function (transport) {
|
||||
notify_info(transport.responseText, true);
|
||||
} });
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
} catch (e) {
|
||||
exception_error("resetSelectedUserPass", e);
|
||||
}
|
||||
}
|
||||
|
||||
function selectedUserDetails() {
|
||||
|
||||
try {
|
||||
|
||||
var rows = getSelectedUsers();
|
||||
|
||||
if (rows.length == 0) {
|
||||
@@ -572,13 +540,10 @@ function selectedUserDetails() {
|
||||
execute: function () {
|
||||
dialog.hide();
|
||||
},
|
||||
href: query});
|
||||
href: query
|
||||
});
|
||||
|
||||
dialog.show();
|
||||
|
||||
} catch (e) {
|
||||
exception_error("selectedUserDetails", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -646,8 +611,6 @@ function editSelectedFeed() {
|
||||
}
|
||||
|
||||
function editSelectedFeeds() {
|
||||
|
||||
try {
|
||||
var rows = getSelectedFeeds();
|
||||
|
||||
if (rows.length == 0) {
|
||||
@@ -712,14 +675,16 @@ function editSelectedFeeds() {
|
||||
this.getChildByName('cache_images').attr('disabled') == false) {
|
||||
query = query + "&cache_images=false";
|
||||
}
|
||||
} catch (e) { }
|
||||
} catch (e) {
|
||||
}
|
||||
|
||||
try {
|
||||
if (!query.match("&hide_images=") &&
|
||||
this.getChildByName('hide_images').attr('disabled') == false) {
|
||||
query = query + "&hide_images=false";
|
||||
}
|
||||
} catch (e) { }
|
||||
} catch (e) {
|
||||
}
|
||||
|
||||
if (!query.match("&include_in_digest=") &&
|
||||
this.getChildByName('include_in_digest').attr('disabled') == false) {
|
||||
@@ -745,22 +710,20 @@ function editSelectedFeeds() {
|
||||
onComplete: function (transport) {
|
||||
dialog.hide();
|
||||
updateFeedList();
|
||||
}});
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
content: transport.responseText});
|
||||
content: transport.responseText
|
||||
});
|
||||
|
||||
dialog.show();
|
||||
|
||||
} });
|
||||
|
||||
} catch (e) {
|
||||
exception_error("editSelectedFeeds", e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function opmlImportComplete(iframe) {
|
||||
try {
|
||||
if (!iframe.contentDocument.body.innerHTML) return false;
|
||||
|
||||
Element.show(iframe);
|
||||
@@ -787,13 +750,10 @@ function opmlImportComplete(iframe) {
|
||||
updateLabelList();
|
||||
this.hide();
|
||||
},
|
||||
content: content});
|
||||
content: content
|
||||
});
|
||||
|
||||
dialog.show();
|
||||
|
||||
} catch (e) {
|
||||
exception_error("opmlImportComplete", e);
|
||||
}
|
||||
}
|
||||
|
||||
function opmlImport() {
|
||||
@@ -854,7 +814,6 @@ function updateSystemList() {
|
||||
}
|
||||
|
||||
function selectTab(id, noupdate, method) {
|
||||
try {
|
||||
if (!noupdate) {
|
||||
notify_progress("Loading, please wait...");
|
||||
|
||||
@@ -876,15 +835,9 @@ function selectTab(id, noupdate, method) {
|
||||
dijit.byId("pref-tabs").selectChild(tab);
|
||||
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
exception_error("selectTab", e);
|
||||
}
|
||||
}
|
||||
|
||||
function init_second_stage() {
|
||||
try {
|
||||
|
||||
document.onkeydown = pref_hotkey_handler;
|
||||
loading_set_progress(50);
|
||||
notify("");
|
||||
@@ -905,15 +858,12 @@ function init_second_stage() {
|
||||
}
|
||||
|
||||
setTimeout(hotkey_prefix_timeout, 5*1000);
|
||||
|
||||
} catch (e) {
|
||||
exception_error("init_second_stage", e);
|
||||
}
|
||||
}
|
||||
|
||||
function init() {
|
||||
|
||||
try {
|
||||
window.onerror = function (message, filename, lineno, colno, error) {
|
||||
report_error(message, filename, lineno, colno, error);
|
||||
};
|
||||
|
||||
require(["dojo/_base/kernel",
|
||||
"dojo/ready",
|
||||
@@ -950,6 +900,7 @@ function init() {
|
||||
"fox/PrefLabelTree"], function (dojo, ready, parser) {
|
||||
|
||||
ready(function () {
|
||||
try {
|
||||
parser.parse();
|
||||
|
||||
loading_set_progress(50);
|
||||
@@ -957,21 +908,23 @@ function init() {
|
||||
var clientTzOffset = new Date().getTimezoneOffset() * 60;
|
||||
|
||||
new Ajax.Request("backend.php", {
|
||||
parameters: {op: "rpc", method: "sanityCheck",
|
||||
clientTzOffset: clientTzOffset },
|
||||
parameters: {
|
||||
op: "rpc", method: "sanityCheck",
|
||||
clientTzOffset: clientTzOffset
|
||||
},
|
||||
onComplete: function (transport) {
|
||||
backend_sanity_check_callback(transport);
|
||||
} });
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
} catch (e) {
|
||||
exception_error("init", e);
|
||||
exception_error(e);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function validatePrefsReset() {
|
||||
try {
|
||||
var ok = confirm(__("Reset to defaults?"));
|
||||
|
||||
if (ok) {
|
||||
@@ -988,16 +941,11 @@ function validatePrefsReset() {
|
||||
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
exception_error("validatePrefsReset", e);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
function pref_hotkey_handler(e) {
|
||||
try {
|
||||
|
||||
if (e.target.nodeName == "INPUT" || e.target.nodeName == "TEXTAREA") return;
|
||||
|
||||
@@ -1077,14 +1025,9 @@ function pref_hotkey_handler(e) {
|
||||
default:
|
||||
console.log("unhandled action: " + hotkey_action + "; hotkey: " + hotkey);
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
exception_error("hotkey_handler", e);
|
||||
}
|
||||
}
|
||||
|
||||
function removeCategory(id, item) {
|
||||
try {
|
||||
|
||||
var ok = confirm(__("Remove category %s? Any nested feeds would be placed into Uncategorized.").replace("%s", item.name));
|
||||
|
||||
@@ -1099,11 +1042,8 @@ function removeCategory(id, item) {
|
||||
onComplete: function (transport) {
|
||||
notify('');
|
||||
updateFeedList();
|
||||
} });
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
exception_error("removeCategory", e);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1136,7 +1076,6 @@ function removeSelectedCategories() {
|
||||
}
|
||||
|
||||
function createCategory() {
|
||||
try {
|
||||
var title = prompt(__("Category title:"));
|
||||
|
||||
if (title) {
|
||||
@@ -1151,16 +1090,12 @@ function createCategory() {
|
||||
onComplete: function (transport) {
|
||||
notify('');
|
||||
updateFeedList();
|
||||
} });
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
exception_error("createCategory", e);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function showInactiveFeeds() {
|
||||
try {
|
||||
var query = "backend.php?op=pref-feeds&method=inactiveFeeds";
|
||||
|
||||
if (dijit.byId("inactiveFeedsDlg"))
|
||||
@@ -1193,7 +1128,8 @@ function showInactiveFeeds() {
|
||||
notify('');
|
||||
dialog.hide();
|
||||
updateFeedList();
|
||||
} });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
} else {
|
||||
@@ -1204,19 +1140,13 @@ function showInactiveFeeds() {
|
||||
if (this.validate()) {
|
||||
}
|
||||
},
|
||||
href: query});
|
||||
href: query
|
||||
});
|
||||
|
||||
dialog.show();
|
||||
|
||||
} catch (e) {
|
||||
exception_error("showInactiveFeeds", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function opmlRegenKey() {
|
||||
|
||||
try {
|
||||
var ok = confirm(__("Replace current OPML publishing address with a new one?"));
|
||||
|
||||
if (ok) {
|
||||
@@ -1245,28 +1175,21 @@ function opmlRegenKey() {
|
||||
} else {
|
||||
notify_error("Could not change feed URL.");
|
||||
}
|
||||
} });
|
||||
}
|
||||
} catch (e) {
|
||||
exception_error("opmlRegenKey", e);
|
||||
});
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function feedActionChange() {
|
||||
try {
|
||||
var chooser = $("feedActionChooser");
|
||||
var opid = chooser[chooser.selectedIndex].value;
|
||||
|
||||
chooser.selectedIndex = 0;
|
||||
feedActionGo(opid);
|
||||
} catch (e) {
|
||||
exception_error("feedActionChange", e);
|
||||
}
|
||||
}
|
||||
|
||||
function feedActionGo(op) {
|
||||
try {
|
||||
if (op == "facEdit") {
|
||||
|
||||
var rows = getSelectedFeeds();
|
||||
@@ -1297,11 +1220,6 @@ function feedActionGo(op) {
|
||||
if (op == "facUnsubscribe") {
|
||||
removeSelectedFeeds();
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
exception_error("feedActionGo", e);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function clearFeedArticles(feed_id) {
|
||||
@@ -1365,7 +1283,6 @@ function rescore_all_feeds() {
|
||||
}
|
||||
|
||||
function labelColorReset() {
|
||||
try {
|
||||
var labels = getSelectedLabels();
|
||||
|
||||
if (labels.length > 0) {
|
||||
@@ -1379,25 +1296,20 @@ function labelColorReset() {
|
||||
parameters: query,
|
||||
onComplete: function (transport) {
|
||||
updateLabelList();
|
||||
} });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
} else {
|
||||
alert(__("No labels are selected."));
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
exception_error("labelColorReset", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function inPreferences() {
|
||||
return true;
|
||||
}
|
||||
|
||||
function editProfiles() {
|
||||
try {
|
||||
|
||||
if (dijit.byId("profileEditDlg"))
|
||||
dijit.byId("profileEditDlg").destroyRecursive();
|
||||
@@ -1428,7 +1340,8 @@ function editProfiles() {
|
||||
onComplete: function (transport) {
|
||||
notify('');
|
||||
editProfiles();
|
||||
} });
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@@ -1453,7 +1366,8 @@ function editProfiles() {
|
||||
parameters: query,
|
||||
onComplete: function (transport) {
|
||||
window.location.reload();
|
||||
} });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
} else {
|
||||
@@ -1472,7 +1386,8 @@ function editProfiles() {
|
||||
onComplete: function (transport) {
|
||||
notify('');
|
||||
editProfiles();
|
||||
} });
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
},
|
||||
@@ -1480,12 +1395,10 @@ function editProfiles() {
|
||||
if (this.validate()) {
|
||||
}
|
||||
},
|
||||
href: query});
|
||||
href: query
|
||||
});
|
||||
|
||||
dialog.show();
|
||||
} catch (e) {
|
||||
exception_error("editProfiles", e);
|
||||
}
|
||||
}
|
||||
|
||||
function activatePrefProfile() {
|
||||
@@ -1536,56 +1449,41 @@ function clearFeedAccessKeys() {
|
||||
}
|
||||
|
||||
function resetFilterOrder() {
|
||||
try {
|
||||
notify_progress("Loading, please wait...");
|
||||
|
||||
new Ajax.Request("backend.php", {
|
||||
parameters: "?op=pref-filters&method=filtersortreset",
|
||||
onComplete: function (transport) {
|
||||
updateFilterList();
|
||||
} });
|
||||
|
||||
|
||||
} catch (e) {
|
||||
exception_error("resetFilterOrder");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
function resetFeedOrder() {
|
||||
try {
|
||||
notify_progress("Loading, please wait...");
|
||||
|
||||
new Ajax.Request("backend.php", {
|
||||
parameters: "?op=pref-feeds&method=feedsortreset",
|
||||
onComplete: function (transport) {
|
||||
updateFeedList();
|
||||
} });
|
||||
|
||||
|
||||
} catch (e) {
|
||||
exception_error("resetFeedOrder");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function resetCatOrder() {
|
||||
try {
|
||||
notify_progress("Loading, please wait...");
|
||||
|
||||
new Ajax.Request("backend.php", {
|
||||
parameters: "?op=pref-feeds&method=catsortreset",
|
||||
onComplete: function (transport) {
|
||||
updateFeedList();
|
||||
} });
|
||||
|
||||
|
||||
} catch (e) {
|
||||
exception_error("resetCatOrder");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function editCat(id, item, event) {
|
||||
try {
|
||||
var new_name = prompt(__('Rename category to:'), item.name);
|
||||
|
||||
if (new_name && new_name != item.name) {
|
||||
@@ -1601,16 +1499,12 @@ function editCat(id, item, event) {
|
||||
},
|
||||
onComplete: function (transport) {
|
||||
updateFeedList();
|
||||
} });
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
exception_error("editCat", e);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function editLabel(id, event) {
|
||||
try {
|
||||
var query = "backend.php?op=pref-labels&method=edit&id=" +
|
||||
param_escape(id);
|
||||
|
||||
@@ -1668,21 +1562,18 @@ function editLabel(id, event) {
|
||||
parameters: query,
|
||||
onComplete: function (transport) {
|
||||
updateFilterList();
|
||||
} });
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
href: query});
|
||||
href: query
|
||||
});
|
||||
|
||||
dialog.show();
|
||||
|
||||
} catch (e) {
|
||||
exception_error("editLabel", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function customizeCSS() {
|
||||
try {
|
||||
var query = "backend.php?op=pref-prefs&method=customizeCSS";
|
||||
|
||||
if (dijit.byId("cssEditDlg"))
|
||||
@@ -1699,24 +1590,18 @@ function customizeCSS() {
|
||||
onComplete: function (transport) {
|
||||
notify('');
|
||||
window.location.reload();
|
||||
} });
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
href: query});
|
||||
href: query
|
||||
});
|
||||
|
||||
dialog.show();
|
||||
|
||||
} catch (e) {
|
||||
exception_error("customizeCSS", e);
|
||||
}
|
||||
}
|
||||
|
||||
function insertSSLserial(value) {
|
||||
try {
|
||||
dijit.byId("SSL_CERT_SERIAL").attr('value', value);
|
||||
} catch (e) {
|
||||
exception_error("insertSSLcerial", e);
|
||||
}
|
||||
}
|
||||
|
||||
function gotoExportOpml(filename, settings) {
|
||||
@@ -1726,7 +1611,6 @@ function gotoExportOpml(filename, settings) {
|
||||
|
||||
|
||||
function batchSubscribe() {
|
||||
try {
|
||||
var query = "backend.php?op=pref-feeds&method=batchSubscribe";
|
||||
|
||||
// overlapping widgets
|
||||
@@ -1749,35 +1633,17 @@ function batchSubscribe() {
|
||||
notify("");
|
||||
updateFeedList();
|
||||
dialog.hide();
|
||||
} });
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
href: query});
|
||||
href: query
|
||||
});
|
||||
|
||||
dialog.show();
|
||||
} catch (e) {
|
||||
exception_error("batchSubscribe", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function toggleAdvancedPrefs() {
|
||||
try {
|
||||
notify_progress("Loading, please wait...");
|
||||
|
||||
new Ajax.Request("backend.php", {
|
||||
parameters: "?op=pref-prefs&method=toggleadvanced",
|
||||
onComplete: function(transport) {
|
||||
updatePrefsList();
|
||||
} });
|
||||
|
||||
} catch (e) {
|
||||
exception_error("toggleAdvancedPrefs", e);
|
||||
}
|
||||
}
|
||||
|
||||
function clearPluginData(name) {
|
||||
try {
|
||||
if (confirm(__("Clear stored data for this plugin?"))) {
|
||||
notify_progress("Loading, please wait...");
|
||||
|
||||
@@ -1788,9 +1654,6 @@ function clearPluginData(name) {
|
||||
updatePrefsList();
|
||||
} });
|
||||
}
|
||||
} catch (e) {
|
||||
exception_error("clearPluginData", e);
|
||||
}
|
||||
}
|
||||
|
||||
function clearSqlLog() {
|
||||
|
||||
115
js/tt-rss.js
115
js/tt-rss.js
@@ -21,15 +21,10 @@ function activeFeedIsCat() {
|
||||
}
|
||||
|
||||
function getActiveFeedId() {
|
||||
try {
|
||||
return _active_feed_id;
|
||||
} catch (e) {
|
||||
exception_error("getActiveFeedId", e);
|
||||
}
|
||||
}
|
||||
|
||||
function setActiveFeedId(id, is_cat) {
|
||||
try {
|
||||
hash_set('f', id);
|
||||
hash_set('c', is_cat ? 1 : 0);
|
||||
|
||||
@@ -42,17 +37,10 @@ function setActiveFeedId(id, is_cat) {
|
||||
selectFeed(id, is_cat);
|
||||
|
||||
PluginHost.run(PluginHost.HOOK_FEED_SET_ACTIVE, _active_article_id);
|
||||
} catch (e) {
|
||||
exception_error("setActiveFeedId", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function updateFeedList() {
|
||||
try {
|
||||
|
||||
// $("feeds-holder").innerHTML = "<div id=\"feedlistLoading\">" +
|
||||
// __("Loading, please wait...") + "</div>";
|
||||
|
||||
Element.show("feedlistLoading");
|
||||
|
||||
@@ -109,20 +97,16 @@ function updateFeedList() {
|
||||
dojo.disconnect(tmph);
|
||||
Element.hide("feedlistLoading");
|
||||
|
||||
try {
|
||||
feedlist_init();
|
||||
|
||||
// var node = dijit.byId("feedTree")._itemNodesMap['FEED:-2'][0].domNode
|
||||
// menu.bindDomNode(node);
|
||||
|
||||
loading_set_progress(25);
|
||||
} catch (e) {
|
||||
exception_error(e);
|
||||
}
|
||||
});
|
||||
|
||||
tree.startup();
|
||||
|
||||
|
||||
} catch (e) {
|
||||
exception_error("updateFeedList", e);
|
||||
}
|
||||
}
|
||||
|
||||
function catchupAllFeeds() {
|
||||
@@ -218,8 +202,10 @@ function genericSanityCheck() {
|
||||
|
||||
|
||||
function init() {
|
||||
try {
|
||||
//dojo.registerModulePath("fox", "../../js/");
|
||||
|
||||
window.onerror = function(message, filename, lineno, colno, error) {
|
||||
report_error(message, filename, lineno, colno, error);
|
||||
};
|
||||
|
||||
require(["dojo/_base/kernel",
|
||||
"dojo/ready",
|
||||
@@ -258,6 +244,7 @@ function init() {
|
||||
|
||||
ready(function() {
|
||||
|
||||
try {
|
||||
parser.parse();
|
||||
|
||||
if (!genericSanityCheck())
|
||||
@@ -275,23 +262,24 @@ function init() {
|
||||
init_hotkey_actions();
|
||||
|
||||
new Ajax.Request("backend.php", {
|
||||
parameters: {op: "rpc", method: "sanityCheck", hasAudio: hasAudio,
|
||||
parameters: {
|
||||
op: "rpc", method: "sanityCheck", hasAudio: hasAudio,
|
||||
hasMp3: hasMp3,
|
||||
clientTzOffset: clientTzOffset,
|
||||
hasSandbox: hasSandbox},
|
||||
hasSandbox: hasSandbox
|
||||
},
|
||||
onComplete: function (transport) {
|
||||
backend_sanity_check_callback(transport);
|
||||
} });
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
} catch (e) {
|
||||
exception_error("init", e);
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
exception_error(e);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
function init_hotkey_actions() {
|
||||
@@ -587,8 +575,6 @@ function init_hotkey_actions() {
|
||||
}
|
||||
|
||||
function init_second_stage() {
|
||||
|
||||
try {
|
||||
updateFeedList();
|
||||
closeArticlePanel();
|
||||
|
||||
@@ -659,14 +645,9 @@ function init_second_stage() {
|
||||
console.log("scheduling simple feed updater...");
|
||||
window.setTimeout(update_random_feed, 30*1000);
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
exception_error("init_second_stage", e);
|
||||
}
|
||||
}
|
||||
|
||||
function quickMenuGo(opid) {
|
||||
try {
|
||||
switch (opid) {
|
||||
case "qmcPrefs":
|
||||
gotoPreferences();
|
||||
@@ -747,14 +728,9 @@ function quickMenuGo(opid) {
|
||||
default:
|
||||
console.log("quickMenuGo: unknown action: " + opid);
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
exception_error("quickMenuGo", e);
|
||||
}
|
||||
}
|
||||
|
||||
function toggleDispRead() {
|
||||
try {
|
||||
|
||||
var hide = !(getInitParam("hide_read_feeds") == "1");
|
||||
|
||||
@@ -770,9 +746,6 @@ function toggleDispRead() {
|
||||
onComplete: function(transport) {
|
||||
} });
|
||||
|
||||
} catch (e) {
|
||||
exception_error("toggleDispRead", e);
|
||||
}
|
||||
}
|
||||
|
||||
function parse_runtime_info(data) {
|
||||
@@ -825,7 +798,6 @@ function parse_runtime_info(data) {
|
||||
}
|
||||
|
||||
function collapse_feedlist() {
|
||||
try {
|
||||
Element.toggle("feeds-holder");
|
||||
|
||||
var splitter = $("feeds-holder_splitter");
|
||||
@@ -833,10 +805,6 @@ function collapse_feedlist() {
|
||||
Element.visible("feeds-holder") ? splitter.show() : splitter.hide();
|
||||
|
||||
dijit.byId("main").resize();
|
||||
|
||||
} catch (e) {
|
||||
exception_error("collapse_feedlist", e);
|
||||
}
|
||||
}
|
||||
|
||||
function viewModeChanged() {
|
||||
@@ -875,7 +843,6 @@ function rescoreCurrentFeed() {
|
||||
}
|
||||
|
||||
function hotkey_handler(e) {
|
||||
try {
|
||||
|
||||
if (e.target.nodeName == "INPUT" || e.target.nodeName == "TEXTAREA") return;
|
||||
|
||||
@@ -954,10 +921,6 @@ function hotkey_handler(e) {
|
||||
action();
|
||||
return false;
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
exception_error("hotkey_handler", e);
|
||||
}
|
||||
}
|
||||
|
||||
function inPreferences() {
|
||||
@@ -965,15 +928,6 @@ function inPreferences() {
|
||||
}
|
||||
|
||||
function reverseHeadlineOrder() {
|
||||
try {
|
||||
|
||||
/* var query_str = "?op=rpc&method=togglepref&key=REVERSE_HEADLINES";
|
||||
|
||||
new Ajax.Request("backend.php", {
|
||||
parameters: query_str,
|
||||
onComplete: function(transport) {
|
||||
viewCurrentFeed();
|
||||
} }); */
|
||||
|
||||
var toolbar = document.forms["main_toolbar_form"];
|
||||
var order_by = dijit.getEnclosingWidget(toolbar.order_by);
|
||||
@@ -989,9 +943,6 @@ function reverseHeadlineOrder() {
|
||||
|
||||
viewCurrentFeed();
|
||||
|
||||
} catch (e) {
|
||||
exception_error("reverseHeadlineOrder", e);
|
||||
}
|
||||
}
|
||||
|
||||
function handle_rpc_json(transport, scheduled_call) {
|
||||
@@ -1065,15 +1016,13 @@ function handle_rpc_json(transport, scheduled_call) {
|
||||
else
|
||||
notify_error("Communication problem with server.");
|
||||
|
||||
console.log(e);
|
||||
//exception_error("handle_rpc_json", e, transport);
|
||||
console.error(e);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function switchPanelMode(wide) {
|
||||
try {
|
||||
if (isCdmMode()) return;
|
||||
|
||||
article_id = getActiveArticleId();
|
||||
@@ -1121,15 +1070,9 @@ function switchPanelMode(wide) {
|
||||
onComplete: function(transport) {
|
||||
console.log(transport.responseText);
|
||||
} });
|
||||
|
||||
|
||||
} catch (e) {
|
||||
exception_error("switchPanelMode", e);
|
||||
}
|
||||
}
|
||||
|
||||
function update_random_feed() {
|
||||
try {
|
||||
console.log("in update_random_feed");
|
||||
|
||||
new Ajax.Request("backend.php", {
|
||||
@@ -1138,26 +1081,14 @@ function update_random_feed() {
|
||||
handle_rpc_json(transport, true);
|
||||
window.setTimeout(update_random_feed, 30*1000);
|
||||
} });
|
||||
|
||||
} catch (e) {
|
||||
exception_error("update_random_feed", e);
|
||||
}
|
||||
}
|
||||
|
||||
function hash_get(key) {
|
||||
try {
|
||||
kv = window.location.hash.substring(1).toQueryParams();
|
||||
return kv[key];
|
||||
} catch (e) {
|
||||
exception_error("hash_get", e);
|
||||
}
|
||||
}
|
||||
function hash_set(key, value) {
|
||||
try {
|
||||
kv = window.location.hash.substring(1).toQueryParams();
|
||||
kv[key] = value;
|
||||
window.location.hash = $H(kv).toQueryString();
|
||||
} catch (e) {
|
||||
exception_error("hash_set", e);
|
||||
}
|
||||
}
|
||||
|
||||
269
js/viewfeed.js
269
js/viewfeed.js
@@ -1,5 +1,3 @@
|
||||
var article_cache = new Array();
|
||||
|
||||
var _active_article_id = 0;
|
||||
|
||||
var vgroup_last_feed = false;
|
||||
@@ -21,7 +19,6 @@ var _catchup_request_sent = false;
|
||||
var has_storage = 'sessionStorage' in window && window['sessionStorage'] !== null;
|
||||
|
||||
function headlines_callback2(transport, offset, background, infscroll_req) {
|
||||
try {
|
||||
handle_rpc_json(transport);
|
||||
|
||||
console.log("headlines_callback2 [offset=" + offset + "] B:" + background + " I:" + infscroll_req);
|
||||
@@ -237,14 +234,9 @@ function headlines_callback2(transport, offset, background, infscroll_req) {
|
||||
}
|
||||
|
||||
notify("");
|
||||
|
||||
} catch (e) {
|
||||
exception_error("headlines_callback2", e, transport);
|
||||
}
|
||||
}
|
||||
|
||||
function render_article(article) {
|
||||
try {
|
||||
cleanup_memory("content-insert");
|
||||
|
||||
dijit.byId("headlines-wrap-inner").addChild(
|
||||
@@ -264,15 +256,9 @@ function render_article(article) {
|
||||
try {
|
||||
c.focus();
|
||||
} catch (e) { };
|
||||
|
||||
} catch (e) {
|
||||
exception_error("render_article", e);
|
||||
}
|
||||
}
|
||||
|
||||
function showArticleInHeadlines(id, noexpand) {
|
||||
|
||||
try {
|
||||
var row = $("RROW-" + id);
|
||||
if (!row) return;
|
||||
|
||||
@@ -284,14 +270,9 @@ function showArticleInHeadlines(id, noexpand) {
|
||||
selectArticles('none');
|
||||
|
||||
markHeadline(id);
|
||||
|
||||
} catch (e) {
|
||||
exception_error("showArticleInHeadlines", e);
|
||||
}
|
||||
}
|
||||
|
||||
function article_callback2(transport, id) {
|
||||
try {
|
||||
console.log("article_callback2 " + id);
|
||||
|
||||
handle_rpc_json(transport);
|
||||
@@ -331,13 +312,9 @@ function article_callback2(transport, id) {
|
||||
request_counters(unread_in_buffer == 0);
|
||||
|
||||
notify("");
|
||||
} catch (e) {
|
||||
exception_error("article_callback2", e, transport);
|
||||
}
|
||||
}
|
||||
|
||||
function view(id, activefeed, noexpand) {
|
||||
try {
|
||||
var oldrow = $("RROW-" + getActiveArticleId());
|
||||
if (oldrow) oldrow.removeClassName("active");
|
||||
|
||||
@@ -415,13 +392,9 @@ function view(id, activefeed, noexpand) {
|
||||
|
||||
return false;
|
||||
|
||||
} catch (e) {
|
||||
exception_error("view", e);
|
||||
}
|
||||
}
|
||||
|
||||
function toggleMark(id, client_only) {
|
||||
try {
|
||||
var query = "?op=rpc&id=" + id + "&method=mark";
|
||||
|
||||
var row = $("RROW-" + id);
|
||||
@@ -464,16 +437,12 @@ function toggleMark(id, client_only) {
|
||||
parameters: query,
|
||||
onComplete: function (transport) {
|
||||
handle_rpc_json(transport);
|
||||
} });
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
exception_error("toggleMark", e);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function togglePub(id, client_only, no_effects, note) {
|
||||
try {
|
||||
var query = "?op=rpc&id=" + id + "&method=publ";
|
||||
|
||||
if (note != undefined) {
|
||||
@@ -528,15 +497,9 @@ function togglePub(id, client_only, no_effects, note) {
|
||||
} });
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
exception_error("togglePub", e);
|
||||
}
|
||||
}
|
||||
|
||||
function moveToPost(mode, noscroll, noexpand) {
|
||||
|
||||
try {
|
||||
|
||||
var rows = getLoadedArticleIds();
|
||||
|
||||
var prev_id = false;
|
||||
@@ -630,13 +593,9 @@ function moveToPost(mode, noscroll, noexpand) {
|
||||
}
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
exception_error("moveToPost", e);
|
||||
}
|
||||
}
|
||||
|
||||
function toggleSelected(id, force_on) {
|
||||
try {
|
||||
var row = $("RROW-" + id);
|
||||
|
||||
if (row) {
|
||||
@@ -653,13 +612,9 @@ function toggleSelected(id, force_on) {
|
||||
}
|
||||
|
||||
updateSelectedPrompt();
|
||||
} catch (e) {
|
||||
exception_error("toggleSelected", e);
|
||||
}
|
||||
}
|
||||
|
||||
function updateSelectedPrompt() {
|
||||
try {
|
||||
var count = getSelectedArticleIds2().size();
|
||||
var elem = $("selected_prompt");
|
||||
|
||||
@@ -673,14 +628,9 @@ function updateSelectedPrompt() {
|
||||
Element.hide(elem);
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
exception_error("updateSelectedPrompt", e);
|
||||
}
|
||||
}
|
||||
|
||||
function toggleUnread(id, cmode, effect) {
|
||||
try {
|
||||
|
||||
var row = $("RROW-" + id);
|
||||
if (row) {
|
||||
var tmpClassName = row.className;
|
||||
@@ -718,15 +668,9 @@ function toggleUnread(id, cmode, effect) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
exception_error("toggleUnread", e);
|
||||
}
|
||||
}
|
||||
|
||||
function selectionRemoveLabel(id, ids) {
|
||||
try {
|
||||
|
||||
if (!ids) ids = getSelectedArticleIds2();
|
||||
|
||||
if (ids.length == 0) {
|
||||
@@ -746,15 +690,9 @@ function selectionRemoveLabel(id, ids) {
|
||||
show_labels_in_headlines(transport);
|
||||
} });
|
||||
|
||||
} catch (e) {
|
||||
exception_error("selectionAssignLabel", e);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function selectionAssignLabel(id, ids) {
|
||||
try {
|
||||
|
||||
if (!ids) ids = getSelectedArticleIds2();
|
||||
|
||||
if (ids.length == 0) {
|
||||
@@ -773,15 +711,9 @@ function selectionAssignLabel(id, ids) {
|
||||
handle_rpc_json(transport);
|
||||
show_labels_in_headlines(transport);
|
||||
} });
|
||||
|
||||
} catch (e) {
|
||||
exception_error("selectionAssignLabel", e);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function selectionToggleUnread(set_state, callback, no_error, ids) {
|
||||
try {
|
||||
var rows = ids ? ids : getSelectedArticleIds2();
|
||||
|
||||
if (rows.length == 0 && !no_error) {
|
||||
@@ -837,16 +769,10 @@ function selectionToggleUnread(set_state, callback, no_error, ids) {
|
||||
} });
|
||||
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
exception_error("selectionToggleUnread", e);
|
||||
}
|
||||
}
|
||||
|
||||
// sel_state ignored
|
||||
function selectionToggleMarked(sel_state, callback, no_error, ids) {
|
||||
try {
|
||||
|
||||
var rows = ids ? ids : getSelectedArticleIds2();
|
||||
|
||||
if (rows.length == 0 && !no_error) {
|
||||
@@ -871,16 +797,10 @@ function selectionToggleMarked(sel_state, callback, no_error, ids) {
|
||||
} });
|
||||
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
exception_error("selectionToggleMarked", e);
|
||||
}
|
||||
}
|
||||
|
||||
// sel_state ignored
|
||||
function selectionTogglePublished(sel_state, callback, no_error, ids) {
|
||||
try {
|
||||
|
||||
var rows = ids ? ids : getSelectedArticleIds2();
|
||||
|
||||
if (rows.length == 0 && !no_error) {
|
||||
@@ -904,10 +824,6 @@ function selectionTogglePublished(sel_state, callback, no_error, ids) {
|
||||
} });
|
||||
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
exception_error("selectionToggleMarked", e);
|
||||
}
|
||||
}
|
||||
|
||||
function getSelectedArticleIds2() {
|
||||
@@ -939,8 +855,6 @@ function getLoadedArticleIds() {
|
||||
|
||||
// mode = all,none,unread,invert,marked,published
|
||||
function selectArticles(mode, query) {
|
||||
try {
|
||||
|
||||
if (!query) query = "#headlines-frame > div[id*=RROW]";
|
||||
|
||||
var children = $$(query);
|
||||
@@ -995,16 +909,10 @@ function selectArticles(mode, query) {
|
||||
});
|
||||
|
||||
updateSelectedPrompt();
|
||||
|
||||
} catch (e) {
|
||||
exception_error("selectArticles", e);
|
||||
}
|
||||
}
|
||||
|
||||
function deleteSelection() {
|
||||
|
||||
try {
|
||||
|
||||
var rows = getSelectedArticleIds2();
|
||||
|
||||
if (rows.length == 0) {
|
||||
@@ -1037,17 +945,12 @@ function deleteSelection() {
|
||||
onComplete: function (transport) {
|
||||
handle_rpc_json(transport);
|
||||
viewCurrentFeed();
|
||||
} });
|
||||
|
||||
} catch (e) {
|
||||
exception_error("deleteSelection", e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function archiveSelection() {
|
||||
|
||||
try {
|
||||
|
||||
var rows = getSelectedArticleIds2();
|
||||
|
||||
if (rows.length == 0) {
|
||||
@@ -1092,15 +995,10 @@ function archiveSelection() {
|
||||
viewCurrentFeed();
|
||||
} });
|
||||
|
||||
} catch (e) {
|
||||
exception_error("archiveSelection", e);
|
||||
}
|
||||
}
|
||||
|
||||
function catchupSelection() {
|
||||
|
||||
try {
|
||||
|
||||
var rows = getSelectedArticleIds2();
|
||||
|
||||
if (rows.length == 0) {
|
||||
@@ -1120,10 +1018,6 @@ function catchupSelection() {
|
||||
}
|
||||
|
||||
selectionToggleUnread(false, 'viewCurrentFeed()', true);
|
||||
|
||||
} catch (e) {
|
||||
exception_error("catchupSelection", e);
|
||||
}
|
||||
}
|
||||
|
||||
function editArticleTags(id) {
|
||||
@@ -1163,7 +1057,7 @@ function editArticleTags(id) {
|
||||
if (tooltip) tooltip.attr('label', data.content_full);
|
||||
}
|
||||
} catch (e) {
|
||||
exception_error("editArticleTags/inner", e);
|
||||
exception_error(e);
|
||||
}
|
||||
|
||||
}});
|
||||
@@ -1185,7 +1079,6 @@ function editArticleTags(id) {
|
||||
}
|
||||
|
||||
function cdmScrollToArticleId(id, force) {
|
||||
try {
|
||||
var ctr = $("headlines-frame");
|
||||
var e = $("RROW-" + id);
|
||||
|
||||
@@ -1197,10 +1090,6 @@ function cdmScrollToArticleId(id, force) {
|
||||
// expanded cdm has a 4px margin now
|
||||
ctr.scrollTop = parseInt(e.offsetTop) - 4;
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
exception_error("cdmScrollToArticleId", e);
|
||||
}
|
||||
}
|
||||
|
||||
function setActiveArticleId(id) {
|
||||
@@ -1223,7 +1112,6 @@ function postMouseOut(id) {
|
||||
}
|
||||
|
||||
function unpackVisibleHeadlines() {
|
||||
try {
|
||||
if (!isCdmMode() || !getInitParam("cdm_expanded")) return;
|
||||
|
||||
$$("#headlines-frame span.cencw[id]").each(
|
||||
@@ -1244,10 +1132,6 @@ function unpackVisibleHeadlines() {
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
} catch (e) {
|
||||
exception_error("unpackVisibleHeadlines", e);
|
||||
}
|
||||
}
|
||||
|
||||
function headlines_scroll_handler(e) {
|
||||
@@ -1351,17 +1235,12 @@ function headlines_scroll_handler(e) {
|
||||
}
|
||||
|
||||
function openNextUnreadFeed() {
|
||||
try {
|
||||
var is_cat = activeFeedIsCat();
|
||||
var nuf = getNextUnreadFeed(getActiveFeedId(), is_cat);
|
||||
if (nuf) viewfeed({feed: nuf, is_cat: is_cat});
|
||||
} catch (e) {
|
||||
exception_error("openNextUnreadFeed", e);
|
||||
}
|
||||
}
|
||||
|
||||
function catchupBatchedArticles() {
|
||||
try {
|
||||
if (catchup_id_batch.length > 0 && !_infscroll_request_sent && !_catchup_request_sent) {
|
||||
|
||||
console.log("catchupBatchedArticles: working");
|
||||
@@ -1394,18 +1273,13 @@ function catchupBatchedArticles() {
|
||||
|
||||
updateFloatingTitle(true);
|
||||
|
||||
} });
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
exception_error("catchupBatchedArticles", e);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function catchupRelativeToArticle(below, id) {
|
||||
|
||||
try {
|
||||
|
||||
if (!id) id = getActiveArticleId();
|
||||
|
||||
if (!id) {
|
||||
@@ -1462,18 +1336,14 @@ function catchupRelativeToArticle(below, id) {
|
||||
parameters: query,
|
||||
onComplete: function (transport) {
|
||||
handle_rpc_json(transport);
|
||||
} });
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
exception_error("catchupRelativeToArticle", e);
|
||||
}
|
||||
}
|
||||
|
||||
function cdmCollapseArticle(event, id, unmark) {
|
||||
try {
|
||||
if (unmark == undefined) unmark = true;
|
||||
|
||||
var row = $("RROW-" + id);
|
||||
@@ -1508,14 +1378,9 @@ function cdmCollapseArticle(event, id, unmark) {
|
||||
$("floatingTitle").style.visibility = "hidden";
|
||||
$("floatingTitle").setAttribute("data-article-id", 0);
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
exception_error("cdmCollapseArticle", e);
|
||||
}
|
||||
}
|
||||
|
||||
function cdmExpandArticle(id, noexpand) {
|
||||
try {
|
||||
console.log("cdmExpandArticle " + id);
|
||||
|
||||
var row = $("RROW-" + id);
|
||||
@@ -1580,10 +1445,6 @@ function cdmExpandArticle(id, noexpand) {
|
||||
|
||||
PluginHost.run(PluginHost.HOOK_ARTICLE_EXPANDED, id);
|
||||
|
||||
} catch (e) {
|
||||
exception_error("cdmExpandArticle", e);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1592,7 +1453,6 @@ function getArticleUnderPointer() {
|
||||
}
|
||||
|
||||
function scrollArticle(offset) {
|
||||
try {
|
||||
if (!isCdmMode()) {
|
||||
var ci = $("content-insert");
|
||||
if (ci) {
|
||||
@@ -1605,13 +1465,9 @@ function scrollArticle(offset) {
|
||||
}
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
exception_error("scrollArticle", e);
|
||||
}
|
||||
}
|
||||
|
||||
function show_labels_in_headlines(transport) {
|
||||
try {
|
||||
var data = JSON.parse(transport.responseText);
|
||||
|
||||
if (data) {
|
||||
@@ -1621,13 +1477,9 @@ function show_labels_in_headlines(transport) {
|
||||
});
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
exception_error("show_labels_in_headlines", e);
|
||||
}
|
||||
}
|
||||
|
||||
function cdmClicked(event, id) {
|
||||
try {
|
||||
//var shift_key = event.shiftKey;
|
||||
|
||||
if (!event.ctrlKey && !event.metaKey) {
|
||||
@@ -1663,7 +1515,8 @@ function cdmClicked(event, id) {
|
||||
parameters: query,
|
||||
onComplete: function (transport) {
|
||||
handle_rpc_json(transport);
|
||||
} });
|
||||
}
|
||||
});
|
||||
|
||||
return !event.shiftKey;
|
||||
}
|
||||
@@ -1687,15 +1540,10 @@ function cdmClicked(event, id) {
|
||||
var unread_in_buffer = $$("#headlines-frame > div[id*=RROW][class*=Unread]").length
|
||||
request_counters(unread_in_buffer == 0);
|
||||
|
||||
} catch (e) {
|
||||
exception_error("cdmClicked");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function hlClicked(event, id) {
|
||||
try {
|
||||
if (event.which == 2) {
|
||||
view(id);
|
||||
return true;
|
||||
@@ -1708,10 +1556,6 @@ function hlClicked(event, id) {
|
||||
view(id);
|
||||
return false;
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
exception_error("hlClicked");
|
||||
}
|
||||
}
|
||||
|
||||
function openArticleInNewWindow(id) {
|
||||
@@ -1749,8 +1593,6 @@ function getRelativePostIds(id, limit) {
|
||||
|
||||
var tmp = [];
|
||||
|
||||
try {
|
||||
|
||||
if (!limit) limit = 6; //3
|
||||
|
||||
var ids = getLoadedArticleIds();
|
||||
@@ -1765,17 +1607,11 @@ function getRelativePostIds(id, limit) {
|
||||
}
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
exception_error("getRelativePostIds", e);
|
||||
}
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
function correctHeadlinesOffset(id) {
|
||||
|
||||
try {
|
||||
|
||||
var container = $("headlines-frame");
|
||||
var row = $("RROW-" + id);
|
||||
|
||||
@@ -1798,20 +1634,11 @@ function correctHeadlinesOffset(id) {
|
||||
|
||||
container.scrollTop = row.offsetTop + row.offsetHeight - viewport;
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
exception_error("correctHeadlinesOffset", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function headlineActionsChange(elem) {
|
||||
try {
|
||||
eval(elem.value);
|
||||
elem.attr('value', 'false');
|
||||
} catch (e) {
|
||||
exception_error("headlineActionsChange", e);
|
||||
}
|
||||
}
|
||||
|
||||
function closeArticlePanel() {
|
||||
@@ -1822,7 +1649,6 @@ function closeArticlePanel() {
|
||||
}
|
||||
|
||||
function initFloatingMenu() {
|
||||
try {
|
||||
if (!dijit.byId("floatingMenu")) {
|
||||
|
||||
var menu = new dijit.Menu({
|
||||
@@ -1834,26 +1660,23 @@ function initFloatingMenu() {
|
||||
|
||||
menu.startup();
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
exception_error("initFloatingMenu", e);
|
||||
}
|
||||
}
|
||||
|
||||
function headlinesMenuCommon(menu) {
|
||||
try {
|
||||
|
||||
menu.addChild(new dijit.MenuItem({
|
||||
label: __("Open original article"),
|
||||
onClick: function (event) {
|
||||
openArticleInNewWindow(this.getParent().currentTarget.getAttribute("data-article-id"));
|
||||
}}));
|
||||
}
|
||||
}));
|
||||
|
||||
menu.addChild(new dijit.MenuItem({
|
||||
label: __("Display article URL"),
|
||||
onClick: function (event) {
|
||||
displayArticleUrl(this.getParent().currentTarget.getAttribute("data-article-id"));
|
||||
}}));
|
||||
}
|
||||
}));
|
||||
|
||||
menu.addChild(new dijit.MenuSeparator());
|
||||
|
||||
@@ -1867,7 +1690,8 @@ function headlinesMenuCommon(menu) {
|
||||
ids = ids.size() != 0 && ids.indexOf(id) != -1 ? ids : [id];
|
||||
|
||||
selectionToggleUnread(undefined, false, true, ids);
|
||||
}}));
|
||||
}
|
||||
}));
|
||||
|
||||
menu.addChild(new dijit.MenuItem({
|
||||
label: __("Toggle starred"),
|
||||
@@ -1878,7 +1702,8 @@ function headlinesMenuCommon(menu) {
|
||||
ids = ids.size() != 0 && ids.indexOf(id) != -1 ? ids : [id];
|
||||
|
||||
selectionToggleMarked(undefined, false, true, ids);
|
||||
}}));
|
||||
}
|
||||
}));
|
||||
|
||||
menu.addChild(new dijit.MenuItem({
|
||||
label: __("Toggle published"),
|
||||
@@ -1889,7 +1714,8 @@ function headlinesMenuCommon(menu) {
|
||||
ids = ids.size() != 0 && ids.indexOf(id) != -1 ? ids : [id];
|
||||
|
||||
selectionTogglePublished(undefined, false, true, ids);
|
||||
}}));
|
||||
}
|
||||
}));
|
||||
|
||||
menu.addChild(new dijit.MenuSeparator());
|
||||
|
||||
@@ -1897,13 +1723,15 @@ function headlinesMenuCommon(menu) {
|
||||
label: __("Mark above as read"),
|
||||
onClick: function (event) {
|
||||
catchupRelativeToArticle(0, this.getParent().currentTarget.getAttribute("data-article-id"));
|
||||
}}));
|
||||
}
|
||||
}));
|
||||
|
||||
menu.addChild(new dijit.MenuItem({
|
||||
label: __("Mark below as read"),
|
||||
onClick: function (event) {
|
||||
catchupRelativeToArticle(1, this.getParent().currentTarget.getAttribute("data-article-id"));
|
||||
}}));
|
||||
}
|
||||
}));
|
||||
|
||||
|
||||
var labels = dijit.byId("feedTree").model.getItemsInCategory(-2);
|
||||
@@ -1934,7 +1762,8 @@ function headlinesMenuCommon(menu) {
|
||||
ids = ids.size() != 0 && ids.indexOf(id) != -1 ? ids : [id];
|
||||
|
||||
selectionAssignLabel(this.labelId, ids);
|
||||
}}));
|
||||
}
|
||||
}));
|
||||
|
||||
labelDelMenu.addChild(new dijit.MenuItem({
|
||||
label: name,
|
||||
@@ -1947,7 +1776,8 @@ function headlinesMenuCommon(menu) {
|
||||
ids = ids.size() != 0 && ids.indexOf(id) != -1 ? ids : [id];
|
||||
|
||||
selectionRemoveLabel(this.labelId, ids);
|
||||
}}));
|
||||
}
|
||||
}));
|
||||
|
||||
});
|
||||
|
||||
@@ -1962,15 +1792,9 @@ function headlinesMenuCommon(menu) {
|
||||
}));
|
||||
|
||||
}
|
||||
|
||||
|
||||
} catch (e) {
|
||||
exception_error("headlinesMenuCommon", e);
|
||||
}
|
||||
}
|
||||
|
||||
function initHeadlinesMenu() {
|
||||
try {
|
||||
if (!dijit.byId("headlinesMenu")) {
|
||||
|
||||
var menu = new dijit.Menu({
|
||||
@@ -2032,10 +1856,6 @@ function initHeadlinesMenu() {
|
||||
|
||||
menu.startup();
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
exception_error("initHeadlinesMenu", e);
|
||||
}
|
||||
}
|
||||
|
||||
function cache_set(id, obj) {
|
||||
@@ -2064,16 +1884,11 @@ function cache_delete(id) {
|
||||
}
|
||||
|
||||
function cancelSearch() {
|
||||
try {
|
||||
_search_query = "";
|
||||
viewCurrentFeed();
|
||||
} catch (e) {
|
||||
exception_error("cancelSearch", e);
|
||||
}
|
||||
}
|
||||
|
||||
function setSelectionScore() {
|
||||
try {
|
||||
var ids = getSelectedArticleIds2();
|
||||
|
||||
if (ids.length > 0) {
|
||||
@@ -2106,19 +1921,16 @@ function setSelectionScore() {
|
||||
}
|
||||
});
|
||||
}
|
||||
} });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
} else {
|
||||
alert(__("No articles are selected."));
|
||||
}
|
||||
} catch (e) {
|
||||
exception_error("setSelectionScore", e);
|
||||
}
|
||||
}
|
||||
|
||||
function updateScore(id) {
|
||||
try {
|
||||
var pic = $$("#RROW-" + id + " .hlScorePic")[0];
|
||||
|
||||
if (pic) {
|
||||
@@ -2137,16 +1949,12 @@ function updateScore(id) {
|
||||
pic.setAttribute("score", reply["score"]);
|
||||
pic.setAttribute("title", reply["score"]);
|
||||
}
|
||||
} });
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
exception_error("updateScore", e);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function changeScore(id, pic) {
|
||||
try {
|
||||
var score = pic.getAttribute("score");
|
||||
|
||||
var new_score = prompt(__("Please enter new score for this article:"), score);
|
||||
@@ -2166,15 +1974,12 @@ function changeScore(id, pic) {
|
||||
pic.setAttribute("score", new_score);
|
||||
pic.setAttribute("title", new_score);
|
||||
}
|
||||
} });
|
||||
}
|
||||
} catch (e) {
|
||||
exception_error("changeScore", e);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function displayArticleUrl(id) {
|
||||
try {
|
||||
var query = "op=rpc&method=getlinktitlebyid&id=" + param_escape(id);
|
||||
|
||||
new Ajax.Request("backend.php", {
|
||||
@@ -2185,26 +1990,18 @@ function displayArticleUrl(id) {
|
||||
if (reply && reply.link) {
|
||||
prompt(__("Article URL:"), reply.link);
|
||||
}
|
||||
} });
|
||||
} catch (e) {
|
||||
exception_error("changeScore", e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function scrollToRowId(id) {
|
||||
try {
|
||||
var row = $(id);
|
||||
|
||||
if (row)
|
||||
$("headlines-frame").scrollTop = row.offsetTop - 4;
|
||||
|
||||
} catch (e) {
|
||||
exception_error("scrollToRowId", e);
|
||||
}
|
||||
}
|
||||
|
||||
function updateFloatingTitle(unread_only) {
|
||||
try {
|
||||
if (!isCdmMode()) return;
|
||||
|
||||
var hf = $("headlines-frame");
|
||||
@@ -2253,10 +2050,6 @@ function updateFloatingTitle(unread_only) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
exception_error("updateFloatingTitle", e);
|
||||
}
|
||||
}
|
||||
|
||||
function catchupCurrentBatchIfNeeded() {
|
||||
|
||||
Reference in New Issue
Block a user