mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-19 18:11:30 +00:00
getMainContext() and related JS-stuff
This commit is contained in:
@@ -111,7 +111,7 @@ function viewfeed(feed, skip, subop, doc, is_cat, subop_param) {
|
|||||||
query = query + "&ts=" + timestamp
|
query = query + "&ts=" + timestamp
|
||||||
}
|
}
|
||||||
|
|
||||||
parent.debug(query);
|
debug(query);
|
||||||
|
|
||||||
headlines_frame.location.href = query;
|
headlines_frame.location.href = query;
|
||||||
|
|
||||||
|
|||||||
38
functions.js
38
functions.js
@@ -413,8 +413,13 @@ function setActiveFeedId(id) {
|
|||||||
|
|
||||||
var xmlhttp_rpc = Ajax.getTransport();
|
var xmlhttp_rpc = Ajax.getTransport();
|
||||||
|
|
||||||
function parse_counters(reply, f_document, title_obj, scheduled_call) {
|
function parse_counters(reply, scheduled_call) {
|
||||||
try {
|
try {
|
||||||
|
var f_document = getMainContext().frames["feeds-frame"].document;
|
||||||
|
var title_obj = getMainContext();
|
||||||
|
|
||||||
|
debug("F_DOC: " + f_document + ", T_OBJ: " + title_obj);
|
||||||
|
|
||||||
for (var l = 0; l < reply.childNodes.length; l++) {
|
for (var l = 0; l < reply.childNodes.length; l++) {
|
||||||
if (!reply.childNodes[l] ||
|
if (!reply.childNodes[l] ||
|
||||||
typeof(reply.childNodes[l].getAttribute) == "undefined") {
|
typeof(reply.childNodes[l].getAttribute) == "undefined") {
|
||||||
@@ -498,9 +503,6 @@ function parse_counters(reply, f_document, title_obj, scheduled_call) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// this one is called from feedlist context
|
|
||||||
// thus title_obj passed to parse_counters is parent (e.g. main ttrss window)
|
|
||||||
|
|
||||||
function all_counters_callback() {
|
function all_counters_callback() {
|
||||||
if (xmlhttp_rpc.readyState == 4) {
|
if (xmlhttp_rpc.readyState == 4) {
|
||||||
try {
|
try {
|
||||||
@@ -515,9 +517,9 @@ function all_counters_callback() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var reply = xmlhttp_rpc.responseXML.firstChild;
|
var reply = xmlhttp_rpc.responseXML.firstChild;
|
||||||
var f_document = parent.frames["feeds-frame"].document;
|
// var f_document = parent.frames["feeds-frame"].document;
|
||||||
|
|
||||||
parse_counters(reply, f_document, parent);
|
parse_counters(reply);
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
exception_error("all_counters_callback", e);
|
exception_error("all_counters_callback", e);
|
||||||
@@ -1054,4 +1056,28 @@ function filterCR(e)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getMainContext() {
|
||||||
|
if (parent.window != window) {
|
||||||
|
return parent.window;
|
||||||
|
} else {
|
||||||
|
return this.window;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function debug(msg) {
|
||||||
|
var ctx = getMainContext();
|
||||||
|
|
||||||
|
var c = ctx.document.getElementById('debug_output');
|
||||||
|
if (c && c.style.display == "block") {
|
||||||
|
while (c.lastChild != 'undefined' && c.childNodes.length > 20) {
|
||||||
|
c.removeChild(c.lastChild);
|
||||||
|
}
|
||||||
|
|
||||||
|
var d = new Date();
|
||||||
|
var ts = leading_zero(d.getHours()) + ":" + leading_zero(d.getMinutes()) +
|
||||||
|
":" + leading_zero(d.getSeconds());
|
||||||
|
c.innerHTML = "<li>[" + ts + "] " + msg + "</li>" + c.innerHTML;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
23
tt-rss.js
23
tt-rss.js
@@ -95,9 +95,7 @@ function refetch_callback() {
|
|||||||
return fatalError(error_code, reply.getAttribute("error-msg"));
|
return fatalError(error_code, reply.getAttribute("error-msg"));
|
||||||
}
|
}
|
||||||
|
|
||||||
var f_document = window.frames["feeds-frame"].document;
|
parse_counters(reply, true);
|
||||||
|
|
||||||
parse_counters(reply, f_document, window, true);
|
|
||||||
|
|
||||||
debug("refetch_callback: done");
|
debug("refetch_callback: done");
|
||||||
|
|
||||||
@@ -582,20 +580,6 @@ function toggleDispRead() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function debug(msg) {
|
|
||||||
var c = document.getElementById('debug_output');
|
|
||||||
if (c && c.style.display == "block") {
|
|
||||||
while (c.lastChild != 'undefined' && c.childNodes.length > 20) {
|
|
||||||
c.removeChild(c.lastChild);
|
|
||||||
}
|
|
||||||
|
|
||||||
var d = new Date();
|
|
||||||
var ts = leading_zero(d.getHours()) + ":" + leading_zero(d.getMinutes()) +
|
|
||||||
":" + leading_zero(d.getSeconds());
|
|
||||||
c.innerHTML = "<li>[" + ts + "] " + msg + "</li>" + c.innerHTML;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function fatalError(code, message) {
|
function fatalError(code, message) {
|
||||||
try {
|
try {
|
||||||
var fe = document.getElementById("fatal_error");
|
var fe = document.getElementById("fatal_error");
|
||||||
@@ -615,6 +599,11 @@ function getInitParam(key) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function storeInitParam(key, value) {
|
function storeInitParam(key, value) {
|
||||||
|
try {
|
||||||
|
init_params[key] = value;
|
||||||
new Ajax.Request("backend.php?op=rpc&subop=storeParam&key=" +
|
new Ajax.Request("backend.php?op=rpc&subop=storeParam&key=" +
|
||||||
param_escape(key) + "&value=" + param_escape(value));
|
param_escape(key) + "&value=" + param_escape(value));
|
||||||
|
} catch (e) {
|
||||||
|
exception_error("storeInitParam", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user