cvs: phpweb / sitewide.css userprefs.js /include layout.inc
| From: | Gabor Hojtsy | Date: | Sat, 23 Aug 2003 17:33:21 +0000 |
| Subject: | cvs: phpweb / sitewide.css userprefs.js /include layout.inc | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-20567@lists.php.net to get a copy of this message | ||
goba Sat Aug 23 13:33:21 2003 EDT
Modified files:
/phpweb sitewide.css userprefs.js
/phpweb/include layout.inc
Log:
Set the background image in client scripting, so it will work
properly for www.php.net too. Also use convinience functions
to save a few bytes.
Index: phpweb/sitewide.css
diff -u phpweb/sitewide.css:1.25 phpweb/sitewide.css:1.26
--- phpweb/sitewide.css:1.25 Sat Aug 23 09:36:51 2003
+++ phpweb/sitewide.css Sat Aug 23 13:33:20 2003
@@ -120,10 +120,12 @@
/* Layout styling and helpers --------------------------------------------- */
#layout_2, #layout_3 {
- background: url(/images/leftbar.png) top left repeat-y;
+ /* Background image will be set in client side script */
+ background-position top left;
+ background-repeat: repeat-y;
}
#layout_3_helper {
- /* Background to the right */
+ /* TODO: Background to the right */
}
.cleaner {
Index: phpweb/userprefs.js
diff -u phpweb/userprefs.js:1.5 phpweb/userprefs.js:1.6
--- phpweb/userprefs.js:1.5 Sat Jun 14 14:28:56 2003
+++ phpweb/userprefs.js Sat Aug 23 13:33:20 2003
@@ -1,3 +1,10 @@
+// Default document onload function
+function runOnLoad()
+{
+ addImages();
+ searchHistory();
+}
+
// Get a value of one cookie set by it's name
// Impmentation from the JS 1.3 Client Guide by Netscape
function getCookie(Name)
@@ -71,22 +78,23 @@
}
}
-// Make images appear by the side of TOC items on the manual pages
+// Make images appear by the side of TOC items on the manual pages,
+// and let sidebar background images properly display on all sites.
// This is not a user based function, but a mirror based one. Only
-// php.net has images on a different server. But for performance
+// php.net has images on a different server. For performance
// reasons, the code is implemented to run on the client side.
-function tocImages()
+function addImages()
{
+ // Check if we are on the master site or not
+ staticContent = (location.hostname == "www.php.net" ||
+ location.hostname == "php.net") ?
+ "http://static.php.net/www.php.net/" :
"/";
+
// If DOM is supported, get the <div>s
if (document.getElementsByTagName) {
divs = document.getElementsByTagName("div");
- // Check if we are on the master site or not
- staticContent = (location.hostname == "www.php.net" ||
- location.hostname == "php.net") ?
- "http://static.php.net/www.php.net/" :
"/";
-
// Change the style of every div tag which is in
// the "toci" or "toca" class, modifying the class
// according to the hostname
@@ -98,4 +106,21 @@
}
}
}
-}
\ No newline at end of file
+
+ // Check for an element with a given ID
+ if (document.getElementById) {
+
+ layout_2 = document.getElementById("layout_2");
+ layout_3 = document.getElementById("layout_3");
+
+ // Two column layout
+ if (layout_2) {
+ layout_2.style.backgroundImage = "url(" + staticContent +
"images/leftbar.png)";
+ }
+
+ // Three column layout
+ else if (layout_3) {
+ layout_3.style.backgroundImage = "url(" + staticContent +
"images/leftbar.png)";
+ }
+ }
+}
Index: phpweb/include/layout.inc
diff -u phpweb/include/layout.inc:1.190 phpweb/include/layout.inc:1.191
--- phpweb/include/layout.inc:1.190 Sat Aug 23 09:36:52 2003
+++ phpweb/include/layout.inc Sat Aug 23 13:33:20 2003
@@ -1,5 +1,5 @@
<?php
-/* $Id: layout.inc,v 1.190 2003/08/23 13:36:52 goba Exp $ */
+/* $Id: layout.inc,v 1.191 2003/08/23 17:33:20 goba Exp $ */
// Set the static content root differently on php.net
$_SERVER['STATIC_ROOT'] = ($MYSITE == 'http://www.php.net/') ?
@@ -80,7 +80,7 @@
// Decide on onload event handler
if (!isset($config['onload'])) {
- $config['onload'] = "searchHistory(); tocImages();";
+ $config['onload'] = "runOnLoad();";
}
// Explicit language setting means that we should put that into the form
@@ -398,7 +398,7 @@
$SEARCH_BASE, $ONLOAD;
// If no onload event is specified, restore the last search
- if (empty($ONLOAD)) { $ONLOAD = "searchHistory(); tocImages();"; }
+ if (empty($ONLOAD)) { $ONLOAD = "runOnLoad();"; }
// Guess what base to use for this page (the first two are just
// for BC reasons, until we migrate all the code to use the last one)