]> git.wh0rd.org Git - tt-rss.git/commitdiff
optimize loading of external libraries a bit
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Wed, 20 Mar 2013 16:33:46 +0000 (20:33 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Wed, 20 Mar 2013 16:33:46 +0000 (20:33 +0400)
fix bold text in Unread articles

cdm.css
include/functions.php
index.php
lib/position.js [deleted file]
prefs.php
tt-rss.css

diff --git a/cdm.css b/cdm.css
index 0d0a007be58c67afeabcbcc2ff3108143ec279a7..b793ee058a8c842c9daaedde6414552525e7c67e 100644 (file)
--- a/cdm.css
+++ b/cdm.css
@@ -151,3 +151,7 @@ div.cdmHeader div.hlFeed, div.cdmHeader div.hlFeed a {
 div.cdmContentInner p {
        max-width : 650px;
 }
+
+.Unread div.cdmHeader {
+       font-weight : bold;
+}
index 66054c23b0346d39bde062f5e7f63dbbb9cdbbd2..d9a3a5963988bf86761e6d45e7a52c6d4b1cd628 100644 (file)
                return $rv;
        }
 
+       function stylesheet_tag($filename) {
+               $timestamp = filemtime($filename);
+
+               echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"$filename?$timestamp\"/>\n";
+       }
+
+       function javascript_tag($filename) {
+               $query = "";
+
+               if (!(strpos($filename, "?") === FALSE)) {
+                       $query = substr($filename, strpos($filename, "?")+1);
+                       $filename = substr($filename, 0, strpos($filename, "?"));
+               }
+
+               $timestamp = filemtime($filename);
+
+               if ($query) $timestamp .= "&$query";
+
+               echo "<script type=\"text/javascript\" charset=\"utf-8\" src=\"$filename?$timestamp\"></script>\n";
+       }
+
 ?>
index 68d6fc753eef0c63d1ab92f512eb5efa47aa257e..6d9608a38439e95565bd1669542b5dbffafc7ff0 100644 (file)
--- a/index.php
+++ b/index.php
@@ -44,8 +44,6 @@
 
        login_sequence($link);
 
-       $dt_add = time();
-
        no_cache_incantation();
 
        header('Content-Type: text/html; charset=utf-8');
 <html>
 <head>
        <title>Tiny Tiny RSS</title>
-       <link rel="stylesheet" type="text/css" href="lib/dijit/themes/claro/claro.css"/>
-       <link rel="stylesheet" type="text/css" href="tt-rss.css?<?php echo $dt_add ?>"/>
-       <link rel="stylesheet" type="text/css" href="cdm.css?<?php echo $dt_add ?>"/>
+
+       <?php echo stylesheet_tag("lib/dijit/themes/claro/claro.css"); ?>
+       <?php echo stylesheet_tag("tt-rss.css"); ?>
+       <?php echo stylesheet_tag("cdm.css"); ?>
 
        <?php print_user_stylesheet($link) ?>
 
 
        <link rel="shortcut icon" type="image/png" href="images/favicon.png"/>
 
-       <script type="text/javascript" src="lib/prototype.js"></script>
-       <script type="text/javascript" src="lib/scriptaculous/scriptaculous.js?load=effects,dragdrop,controls"></script>
-       <script type="text/javascript" src="lib/dojo/dojo.js"></script>
-       <script type="text/javascript" src="lib/dijit/dijit.js"></script>
-       <script type="text/javascript" src="lib/dojo/tt-rss-layer.js"></script>
+       <?php
+       foreach (array("lib/prototype.js",
+                               "lib/scriptaculous/scriptaculous.js?load=effects,dragdrop,controls",
+                               "lib/dojo/dojo.js",
+                               "lib/dijit/dijit.js",
+                               "lib/dojo/tt-rss-layer.js",
+                               "localized_js.php",
+                               "errors.php?mode=js") as $jsfile) {
+
+               echo javascript_tag($jsfile);
 
-       <script type="text/javascript" charset="utf-8" src="localized_js.php?<?php echo $dt_add ?>"></script>
-       <script type="text/javascript" charset="utf-8" src="errors.php?mode=js"></script>
+       } ?>
 
        <script type="text/javascript">
        <?php
diff --git a/lib/position.js b/lib/position.js
deleted file mode 100644 (file)
index 43ea85f..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/* http://textsnippets.com/posts/show/835 */
-
-Position.GetWindowSize = function(w) {
-        w = w ? w : window;
-        var width = w.innerWidth || (w.document.documentElement.clientWidth || w.document.body.clientWidth);
-        var height = w.innerHeight || (w.document.documentElement.clientHeight || w.document.body.clientHeight);
-        return [width, height];
-};
-
-/* http://textsnippets.com/posts/show/836 */
-
-Position.Center = function(element, parent) {
-        var w, h, pw, ph;
-        var d = Element.getDimensions(element);
-        w = d.width;
-        h = d.height;
-        Position.prepare();
-        if (!parent) {
-                var ws = Position.GetWindowSize();
-                pw = ws[0];
-                ph = ws[1];
-        } else {
-                pw = parent.offsetWidth;
-                ph = parent.offsetHeight;
-        }
-        element.style.top = (ph/2) - (h/2) -  Position.deltaY + "px";
-        element.style.left = (pw/2) - (w/2) -  Position.deltaX + "px";
-};
-
-
-
index a47d00bce29416fd2d6421b2aaa5dd4818a58932..cda53751b891d6c93f391af93c7379b4fb7f17d0 100644 (file)
--- a/prefs.php
+++ b/prefs.php
@@ -15,8 +15,6 @@
 
        login_sequence($link);
 
-       $dt_add = time();
-
        no_cache_incantation();
 
        header('Content-Type: text/html; charset=utf-8');
 <html>
 <head>
        <title>Tiny Tiny RSS : <?php echo __("Preferences") ?></title>
-       <link rel="stylesheet" type="text/css" href="lib/dijit/themes/claro/claro.css"/>
-       <link rel="stylesheet" type="text/css" href="tt-rss.css?<?php echo $dt_add ?>"/>
+
+       <?php echo stylesheet_tag("lib/dijit/themes/claro/claro.css"); ?>
+       <?php echo stylesheet_tag("tt-rss.css"); ?>
 
        <?php print_user_stylesheet($link) ?>
 
        <link rel="shortcut icon" type="image/png" href="images/favicon.png"/>
 
-       <script type="text/javascript" src="lib/prototype.js"></script>
-       <script type="text/javascript" src="lib/position.js"></script>
-       <script type="text/javascript" src="lib/scriptaculous/scriptaculous.js?load=effects,dragdrop,controls"></script>
-       <script type="text/javascript" src="lib/dojo/dojo.js"></script>
-       <script type="text/javascript" src="lib/dijit/dijit.js"></script>
-       <script type="text/javascript" src="lib/dojo/tt-rss-layer.js"></script>
+       <?php
+       foreach (array("lib/prototype.js",
+                               "lib/scriptaculous/scriptaculous.js?load=effects,dragdrop,controls",
+                               "lib/dojo/dojo.js",
+                               "lib/dijit/dijit.js",
+                               "lib/dojo/tt-rss-layer.js",
+                               "localized_js.php",
+                               "errors.php?mode=js") as $jsfile) {
+
+               echo javascript_tag($jsfile);
 
-       <script type="text/javascript" charset="utf-8" src="localized_js.php?<?php echo $dt_add ?>"></script>
+       } ?>
 
        <script type="text/javascript">
        <?php
index 2d152b04976375f111da93e60d940245dc34ff48..99cd9958bf24d6ef894e2002b8702ffa50f2c2be 100644 (file)
@@ -184,7 +184,6 @@ a:hover {
 
 .even.Unread.Selected {
        background : #fff7d5 ! important;
-       font-weight : bold;
        border-width : 0px 0px 1px 0px;
        border-style : solid;
        border-color : #e7d796;
@@ -192,7 +191,6 @@ a:hover {
 
 .odd.Unread.Selected {
        background : #fff7d5 ! important;
-       font-weight : bold;
        border-width : 0px 0px 1px 0px;
        border-style : solid;
        border-color : #e7d796;
@@ -244,7 +242,6 @@ a:hover {
 
 .even.Unread {
        background : #f0f0f0;
-       font-weight : bold;
        border-width : 0px 0px 1px 0px;
        border-style : solid;
        border-color : #c0c0c0;
@@ -252,7 +249,6 @@ a:hover {
 }
 
 .odd.Unread {
-       font-weight : bold;
        border-width : 0px 0px 1px 0px;
        border-style : solid;
        border-color : #c0c0c0;
@@ -1193,3 +1189,7 @@ span.collapseBtn {
 div.postContent p {
        max-width : 650px;
 }
+
+.Unread div.hlTitle {
+       font-weight : bold;
+}