return obj.readyState == 4 || obj.readyState == 0 || !obj.readyState;
}
+function open_article_callback() {
+ if (xmlhttp_rpc.readyState == 4) {
+ try {
+
+ if (xmlhttp_rpc.responseXML) {
+ var link = xmlhttp_rpc.responseXML.getElementsByTagName("link")[0];
+
+ if (link) {
+ window.open(link.firstChild.nodeValue, "_blank");
+ }
+ }
+
+ } catch (e) {
+ exception_error("open_article_callback", e);
+ }
+ }
+}
+
function logout_callback() {
var container = document.getElementById('notify');
if (xmlhttp.readyState == 4) {
}
}
+ if (keycode == 86) { // v
+ if (getActiveArticleId()) {
+ openArticleInNewWindow(getActiveArticleId());
+ }
+ }
+
if (typeof localHotkeyHandler != 'undefined') {
try {
return localHotkeyHandler(e);
return false;
}
+
+function openArticleInNewWindow(id) {
+ try {
+
+ if (!xmlhttp_ready(xmlhttp_rpc)) {
+ printLockingError();
+ return
+ }
+
+ debug("openArticleInNewWindow: " + id);
+
+ var query = "backend.php?op=rpc&subop=getArticleLink&id=" + id;
+
+ debug(query);
+
+ xmlhttp_rpc.open("GET", query, true);
+ xmlhttp_rpc.onreadystatechange=open_article_callback;
+ xmlhttp_rpc.send(null);
+
+ } catch (e) {
+ exception_error("openArticleInNewWindow", e);
+ }
+}
}
+ if ($subop == "getArticleLink") {
+
+ $id = db_escape_string($_GET["id"]);
+
+ $result = db_query($link, "SELECT link FROM ttrss_entries, ttrss_user_entries
+ WHERE id = '$id' AND id = ref_id AND owner_uid = '".$_SESSION['uid']."'");
+
+ if (db_num_rows($result) == 1) {
+ $link = strip_tags(db_fetch_result($result, 0, "link"));
+ print "<rpc-reply><link>$link</link></rpc-reply>";
+ } else {
+ print "<rpc-reply><error>Article not found</error></rpc-reply>";
+ }
+ }
+
if ($subop == "setArticleTags") {
$id = db_escape_string($_GET["id"]);