From 2f85b50e3607b2b159989c493ac8f8c46a389559 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 2 Dec 2018 10:16:25 +0300 Subject: remove toggleSelectListRow2() --- include/feedbrowser.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/feedbrowser.php b/include/feedbrowser.php index 8ebeb20cc..a0b1b6e8f 100644 --- a/include/feedbrowser.php +++ b/include/feedbrowser.php @@ -53,12 +53,10 @@ $site_url = htmlspecialchars($line["site_url"]); $subscribers = $line["subscribers"]; - $check_box = ""; - $class = ($feedctr % 2) ? "even" : "odd"; - $site_url = " ". @@ -75,11 +73,9 @@ $feed_url = htmlspecialchars($line["feed_url"]); $site_url = htmlspecialchars($line["site_url"]); - $check_box = ""; - $class = ($feedctr % 2) ? "even" : "odd"; - if ($line['articles_archived'] > 0) { $archived = sprintf(_ngettext("%d archived article", "%d archived articles", (int) $line['articles_archived']), $line['articles_archived']); $archived = " ($archived)"; -- cgit v1.2.3 From 874560db547f718b82d77657dc019d840c30e0ed Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 2 Dec 2018 10:33:58 +0300 Subject: remove obsolete row selection functions move getUrlParam() to Utils --- include/feedbrowser.php | 4 ++-- include/functions.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/feedbrowser.php b/include/feedbrowser.php index a0b1b6e8f..4f37241ea 100644 --- a/include/feedbrowser.php +++ b/include/feedbrowser.php @@ -53,7 +53,7 @@ $site_url = htmlspecialchars($line["site_url"]); $subscribers = $line["subscribers"]; - $check_box = ""; @@ -73,7 +73,7 @@ $feed_url = htmlspecialchars($line["feed_url"]); $site_url = htmlspecialchars($line["site_url"]); - $check_box = ""; if ($line['articles_archived'] > 0) { diff --git a/include/functions.php b/include/functions.php index f6d09fe67..2ec42c7ee 100755 --- a/include/functions.php +++ b/include/functions.php @@ -1244,7 +1244,7 @@ "g t" => "goto_tagcloud", "g *p" => "goto_prefs", // "other" => array( - "(9)|Tab" => "select_article_cursor", // tab + "r" => "select_article_cursor", "c l" => "create_label", "c f" => "create_filter", "c s" => "collapse_sidebar", -- cgit v1.2.3 From f89924f7a19871e26d5805a6c1863903c6e474bf Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 2 Dec 2018 18:38:27 +0300 Subject: set use strict on JS modules; remove some mostly useless stuff like get_minified_js() --- include/functions.php | 49 ------------------------------------------------- include/login_form.php | 2 +- 2 files changed, 1 insertion(+), 50 deletions(-) (limited to 'include') diff --git a/include/functions.php b/include/functions.php index 2ec42c7ee..baed6fb20 100755 --- a/include/functions.php +++ b/include/functions.php @@ -1310,9 +1310,6 @@ $data['last_article_id'] = Article::getLastArticleId(); $data['cdm_expanded'] = get_pref('CDM_EXPANDED'); - $data['dep_ts'] = calculate_dep_timestamp(); - $data['reload_on_ts_change'] = !defined('_NO_RELOAD_ON_TS_CHANGE'); - $data["labels"] = Labels::get_all_labels($_SESSION["uid"]); if (CHECK_FOR_UPDATES && !$disable_update_check && $_SESSION["last_version_check"] + 86400 + rand(-1000, 1000) < time()) { @@ -2379,52 +2376,6 @@ return in_array($interface, class_implements($class)); } - function get_minified_js($files) { - - $rv = ''; - - foreach ($files as $js) { - if (!isset($_GET['debug'])) { - $cached_file = CACHE_DIR . "/js/".basename($js); - - if (file_exists($cached_file) && is_readable($cached_file) && filemtime($cached_file) >= filemtime("js/$js")) { - - list($header, $contents) = explode("\n", file_get_contents($cached_file), 2); - - if ($header && $contents) { - list($htag, $hversion) = explode(":", $header); - - if ($htag == "tt-rss" && $hversion == VERSION) { - $rv .= $contents; - continue; - } - } - } - - $minified = JShrink\Minifier::minify(file_get_contents("js/$js")); - file_put_contents($cached_file, "tt-rss:" . VERSION . "\n" . $minified); - $rv .= $minified; - - } else { - $rv .= file_get_contents("js/$js"); // no cache in debug mode - } - } - - return $rv; - } - - function calculate_dep_timestamp() { - $files = array_merge(glob("js/*.js"), glob("css/*.css")); - - $max_ts = -1; - - foreach ($files as $file) { - if (filemtime($file) > $max_ts) $max_ts = filemtime($file); - } - - return $max_ts; - } - function T_js_decl($s1, $s2) { if ($s1 && $s2) { $s1 = preg_replace("/\n/", "", $s1); diff --git a/include/login_form.php b/include/login_form.php index bb142f6c5..9c3a9b375 100644 --- a/include/login_form.php +++ b/include/login_form.php @@ -10,7 +10,7 @@ foreach (array("lib/prototype.js", "lib/dojo/dojo.js", "lib/dojo/tt-rss-layer.js", - "js/functions.js", + "js/common.js", "errors.php?mode=js") as $jsfile) { echo javascript_tag($jsfile); -- cgit v1.2.3 From d9c5c93cef313127b9b5010fbe279fdbddedadec Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 2 Dec 2018 20:07:57 +0300 Subject: move some more stuff out of common.js rework client-side cookie functions a bit limit dojo cachebust based on server scripts modification time remove param_escape() --- include/functions.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'include') diff --git a/include/functions.php b/include/functions.php index baed6fb20..dcb2e7518 100755 --- a/include/functions.php +++ b/include/functions.php @@ -2566,3 +2566,15 @@ function arr_qmarks($arr) { return str_repeat('?,', count($arr) - 1) . '?'; } + + function get_scripts_timestamp() { + $files = glob("js/*.js"); + $ts = 0; + + foreach ($files as $file) { + $file_ts = filemtime($file); + if ($file_ts > $ts) $ts = $file_ts; + } + + return $ts; + } \ No newline at end of file -- cgit v1.2.3 From e905ce7ea983e425de85282ce7d24fb9f64402d4 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 3 Dec 2018 09:26:26 +0300 Subject: fix login --- include/login_form.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/login_form.php b/include/login_form.php index 9c3a9b375..844314d5e 100644 --- a/include/login_form.php +++ b/include/login_form.php @@ -38,7 +38,7 @@ function init() { display:'' }); fetchProfiles(); - dijit.byId("bw_limit").attr("checked", getCookie("ttrss_bwlimit") == 'true'); + dijit.byId("bw_limit").attr("checked", Cookie.get("ttrss_bwlimit") == 'true'); document.forms.loginForm.login.focus(); }); @@ -46,7 +46,7 @@ function init() { function fetchProfiles() { try { - var query = "op=getProfiles&login=" + param_escape(document.forms["loginForm"].login.value); + var query = "op=getProfiles&login=" + encodeURIComponent(document.forms["loginForm"].login.value); if (query) { new Ajax.Request("public.php", { -- cgit v1.2.3 From 84affc7b1d71769038dfd25d74e40d6bf744e5fb Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 3 Dec 2018 09:33:44 +0300 Subject: rework dojo singleton modules to better work with phpstorm completion (ugh) - declare() is not needed there anyway remove event.observe from login form (not needed) load pluginhost via amd --- include/login_form.php | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) (limited to 'include') diff --git a/include/login_form.php b/include/login_form.php index 844314d5e..1eb5d26d4 100644 --- a/include/login_form.php +++ b/include/login_form.php @@ -19,30 +19,27 @@ @@ -139,7 +124,7 @@ function bwLimitChange(elem) {
- +
0) { ?> -- cgit v1.2.3