add low bandwidth mode (less automatic requests in the background)
This commit is contained in:
parent
d16d57ff2b
commit
a598370dde
6 changed files with 47 additions and 4 deletions
10
backend.php
10
backend.php
|
@ -206,9 +206,11 @@
|
||||||
catchupArticleById($link, $id, 0);
|
catchupArticleById($link, $id, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($cids as $cid) {
|
if (!$_SESSION["bw_limit"]) {
|
||||||
if ($cid) {
|
foreach ($cids as $cid) {
|
||||||
outputArticleXML($link, $cid, $feed_id, false);
|
if ($cid) {
|
||||||
|
outputArticleXML($link, $cid, $feed_id, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -280,7 +282,7 @@
|
||||||
|
|
||||||
if ($_GET["debug"]) $timing_info = print_checkpoint("10", $timing_info);
|
if ($_GET["debug"]) $timing_info = print_checkpoint("10", $timing_info);
|
||||||
|
|
||||||
if (is_array($topmost_article_ids) && !get_pref($link, 'COMBINED_DISPLAY_MODE')) {
|
if (is_array($topmost_article_ids) && !get_pref($link, 'COMBINED_DISPLAY_MODE') && !$_SESSION["bw_limit"]) {
|
||||||
print "<articles>";
|
print "<articles>";
|
||||||
foreach ($topmost_article_ids as $id) {
|
foreach ($topmost_article_ids as $id) {
|
||||||
outputArticleXML($link, $id, $feed, false);
|
outputArticleXML($link, $id, $feed, false);
|
||||||
|
|
|
@ -537,6 +537,8 @@ function request_counters() {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
if (getInitParam("bw_limit") == "1") return;
|
||||||
|
|
||||||
var date = new Date();
|
var date = new Date();
|
||||||
var timestamp = Math.round(date.getTime() / 1000);
|
var timestamp = Math.round(date.getTime() / 1000);
|
||||||
|
|
||||||
|
|
|
@ -1848,6 +1848,7 @@
|
||||||
$_POST["password"] = "";
|
$_POST["password"] = "";
|
||||||
|
|
||||||
$_SESSION["language"] = $_POST["language"];
|
$_SESSION["language"] = $_POST["language"];
|
||||||
|
$_SESSION["bw_limit"] = !!$_POST["bw_limit"];
|
||||||
|
|
||||||
header("Location: " . $_SERVER["REQUEST_URI"]);
|
header("Location: " . $_SERVER["REQUEST_URI"]);
|
||||||
exit;
|
exit;
|
||||||
|
@ -3014,6 +3015,9 @@
|
||||||
print "<param key=\"hide_feedlist\" value=\"" .
|
print "<param key=\"hide_feedlist\" value=\"" .
|
||||||
(int) get_pref($link, "HIDE_FEEDLIST") . "\"/>";
|
(int) get_pref($link, "HIDE_FEEDLIST") . "\"/>";
|
||||||
|
|
||||||
|
print "<param key=\"bw_limit\" value=\"".
|
||||||
|
(int) $_SESSION["bw_limit"]."\"/>";
|
||||||
|
|
||||||
print "</init-params>";
|
print "</init-params>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,12 @@ function init() {
|
||||||
|
|
||||||
var login = document.forms["loginForm"].login;
|
var login = document.forms["loginForm"].login;
|
||||||
|
|
||||||
|
var limit_set = getCookie("ttrss_bwlimit");
|
||||||
|
|
||||||
|
if (limit_set == "true") {
|
||||||
|
document.forms["loginForm"].bw_limit.checked = true;
|
||||||
|
}
|
||||||
|
|
||||||
login.focus();
|
login.focus();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -37,6 +43,18 @@ function languageChange(elem) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function bwLimitChange(elem) {
|
||||||
|
try {
|
||||||
|
var limit_set = elem.checked;
|
||||||
|
|
||||||
|
setCookie("ttrss_bwlimit", limit_set,
|
||||||
|
<?php print SESSION_COOKIE_LIFETIME ?>);
|
||||||
|
|
||||||
|
} catch (e) {
|
||||||
|
exception_error("bwLimitChange", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function validateLoginForm(f) {
|
function validateLoginForm(f) {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
@ -100,6 +118,7 @@ window.onload = init;
|
||||||
<input type="checkbox" name="remember_me" id="remember_me">
|
<input type="checkbox" name="remember_me" id="remember_me">
|
||||||
<label for="remember_me">Remember me on this computer</label>
|
<label for="remember_me">Remember me on this computer</label>
|
||||||
</td></tr> -->
|
</td></tr> -->
|
||||||
|
|
||||||
<tr><td colspan="2" align="right" class="innerLoginCell">
|
<tr><td colspan="2" align="right" class="innerLoginCell">
|
||||||
|
|
||||||
<?php if (defined('_ENABLE_REGISTRATION')) { ?>
|
<?php if (defined('_ENABLE_REGISTRATION')) { ?>
|
||||||
|
@ -111,6 +130,18 @@ window.onload = init;
|
||||||
<input type="hidden" name="rt"
|
<input type="hidden" name="rt"
|
||||||
value="<?php if ($return_to != 'none') { echo $return_to; } ?>">
|
value="<?php if ($return_to != 'none') { echo $return_to; } ?>">
|
||||||
</td></tr>
|
</td></tr>
|
||||||
|
|
||||||
|
<tr><td colspan="2" align="right" class="innerLoginCell">
|
||||||
|
|
||||||
|
<div class="small">
|
||||||
|
<input name="bw_limit" id="bw_limit" type="checkbox"
|
||||||
|
onchange="bwLimitChange(this)">
|
||||||
|
<label for="bw_limit">
|
||||||
|
<?php echo __("Limit bandwidth use") ?></label></div>
|
||||||
|
|
||||||
|
</td></tr>
|
||||||
|
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
</td>
|
</td>
|
||||||
</tr><tr>
|
</tr><tr>
|
||||||
|
|
|
@ -259,6 +259,8 @@ function viewfeed(feed, subop) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function timeout() {
|
function timeout() {
|
||||||
|
if (getInitParam("bw_limit") == "1") return;
|
||||||
|
|
||||||
scheduleFeedUpdate(false);
|
scheduleFeedUpdate(false);
|
||||||
|
|
||||||
var refresh_time = getInitParam("feeds_frame_refresh");
|
var refresh_time = getInitParam("feeds_frame_refresh");
|
||||||
|
|
|
@ -1562,6 +1562,8 @@ function preload_article_callback(transport) {
|
||||||
|
|
||||||
function preloadArticleUnderPointer(id) {
|
function preloadArticleUnderPointer(id) {
|
||||||
try {
|
try {
|
||||||
|
if (getInitParam("bw_limit") == "1") return;
|
||||||
|
|
||||||
if (post_under_pointer == id && !cache_check(id)) {
|
if (post_under_pointer == id && !cache_check(id)) {
|
||||||
|
|
||||||
debug("trying to preload article " + id);
|
debug("trying to preload article " + id);
|
||||||
|
|
Loading…
Reference in a new issue