summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2018-12-03 15:46:54 +0300
committerAndrew Dolgov <[email protected]>2018-12-03 15:46:54 +0300
commit4cb3a601a0fbeb0bf98c932bd5af8a3cffa8ab64 (patch)
treeed3dae8894591be12287b3cce3ff5b4cc6d1ce0e /include
parentcd0a39ea4cb7137aef5b225bdc4472d207a48e62 (diff)
parent98986ce066764158c045c3e23b69e98183b94236 (diff)
Merge branch 'js-objects' into weblate-integration
Diffstat (limited to 'include')
-rw-r--r--include/feedbrowser.php8
-rwxr-xr-xinclude/functions.php63
-rw-r--r--include/login_form.php76
3 files changed, 44 insertions, 103 deletions
diff --git a/include/feedbrowser.php b/include/feedbrowser.php
index 8ebeb20cc..4f37241ea 100644
--- a/include/feedbrowser.php
+++ b/include/feedbrowser.php
@@ -53,12 +53,10 @@
$site_url = htmlspecialchars($line["site_url"]);
$subscribers = $line["subscribers"];
- $check_box = "<input onclick='toggleSelectListRow2(this)'
+ $check_box = "<input onclick='Lists.onRowChecked(this)'
dojoType=\"dijit.form.CheckBox\"
type=\"checkbox\" \">";
- $class = ($feedctr % 2) ? "even" : "odd";
-
$site_url = "<a target=\"_blank\" rel=\"noopener noreferrer\"
href=\"$site_url\">
<span class=\"fb_feedTitle\">".
@@ -75,11 +73,9 @@
$feed_url = htmlspecialchars($line["feed_url"]);
$site_url = htmlspecialchars($line["site_url"]);
- $check_box = "<input onclick='toggleSelectListRow2(this)' dojoType=\"dijit.form.CheckBox\"
+ $check_box = "<input onclick='Lists.onRowChecked(this)' dojoType=\"dijit.form.CheckBox\"
type=\"checkbox\">";
- $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 = "&nbsp;<span class='subscribers'>($archived)</span>";
diff --git a/include/functions.php b/include/functions.php
index f6d09fe67..dcb2e7518 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",
@@ -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);
@@ -2615,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
diff --git a/include/login_form.php b/include/login_form.php
index bb142f6c5..cdf70803b 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);
@@ -19,67 +19,49 @@
<script type="text/javascript">
require({cache:{}});
- Event.observe(window, 'load', function() {
- init();
- });
</script>
</head>
<body class="claro ttrss_main ttrss_login">
<script type="text/javascript">
-function init() {
-
- require(['dojo/parser','dijit/form/Button','dijit/form/CheckBox','dijit/form/Form',
- 'dijit/form/Select','dijit/form/TextBox','dijit/form/ValidationTextBox'],function(parser){
- parser.parse();
- //show tooltip node only after this widget is instaniated.
- dojo.query('div[dojoType="dijit.Tooltip"]').style({
- display:''
- });
- fetchProfiles();
- dijit.byId("bw_limit").attr("checked", getCookie("ttrss_bwlimit") == 'true');
- document.forms.loginForm.login.focus();
- });
-
-}
+require(['dojo/parser', "dojo/ready", 'dijit/form/Button','dijit/form/CheckBox','dijit/form/Form',
+ 'dijit/form/Select','dijit/form/TextBox','dijit/form/ValidationTextBox'],function(parser, ready){
+ ready(function() {
+ parser.parse();
+
+ //show tooltip node only after this widget is instaniated.
+ dojo.query('div[dojoType="dijit.Tooltip"]').style({
+ display:''
+ });
+
+ fetchProfiles();
+ dijit.byId("bw_limit").attr("checked", Cookie.get("ttrss_bwlimit") == 'true');
+ document.forms.loginForm.login.focus();
+ });
+});
function fetchProfiles() {
- try {
- var query = "op=getProfiles&login=" + param_escape(document.forms["loginForm"].login.value);
-
- if (query) {
- new Ajax.Request("public.php", {
- parameters: query,
- onComplete: function(transport) {
- if (transport.responseText.match("select")) {
- $('profile_box').innerHTML = transport.responseText;
- //dojo.parser.parse('profile_box');
- }
- } });
- }
-
- } catch (e) {
- exception_error("fetchProfiles", e);
- }
+ const query = "op=getProfiles&login=" + encodeURIComponent(document.forms["loginForm"].login.value);
+
+ new Ajax.Request("public.php", {
+ parameters: query,
+ onComplete: function(transport) {
+ if (transport.responseText.match("select")) {
+ $('profile_box').innerHTML = transport.responseText;
+ //dojo.parser.parse('profile_box');
+ }
+ } });
}
-
function gotoRegForm() {
window.location.href = "register.php";
return false;
}
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);
- }
+ Cookie.set("ttrss_bwlimit", elem.checked,
+ <?php print SESSION_COOKIE_LIFETIME ?>);
}
</script>
@@ -142,7 +124,7 @@ function bwLimitChange(elem) {
</div>
<div dojoType="dijit.Tooltip" connectId="bw_limit_label" position="below" style="display:none">
-<?php echo __("Does not display images in articles, reduces automatic refreshes."); ?>
+ <?php echo __("Does not display images in articles, reduces automatic refreshes."); ?>
</div>
<?php if (SESSION_COOKIE_LIFETIME > 0) { ?>