JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
added support for ie6
authorJason Woofenden <jason283@herkamire.com>
Wed, 17 Dec 2008 20:01:24 +0000 (15:01 -0500)
committerJason Woofenden <jason283@herkamire.com>
Wed, 17 Dec 2008 20:01:24 +0000 (15:01 -0500)
.htaccess
code/ie_detect.php [new file with mode: 0644]
css_mangler.php [new file with mode: 0644]
index.html
tasks.css

index a7bee83..6f5c6ec 100644 (file)
--- a/.htaccess
+++ b/.htaccess
@@ -6,3 +6,4 @@ RewriteEngine  on
 RewriteRule    ^$  /run.php
 RewriteRule    ^[^/]*\.html$  /run.php
 RewriteRule    ^[^/.]*$  /run.php
+RewriteRule    ^[^/]*.css$  /css_mangler.php [L]
diff --git a/code/ie_detect.php b/code/ie_detect.php
new file mode 100644 (file)
index 0000000..904cbb8
--- /dev/null
@@ -0,0 +1,9 @@
+<?php
+
+# return true if user_agent is IE5.5 or IE6
+function ie5or6() {
+       $agent = $_SERVER['HTTP_USER_AGENT'];
+       return (strpos($agent, 'MSIE 5.') || strpos($agent, 'MSIE 5.') || strpos($agent, 'MSIE 6.'));
+}
+
+?>
diff --git a/css_mangler.php b/css_mangler.php
new file mode 100644 (file)
index 0000000..03e55f9
--- /dev/null
@@ -0,0 +1,27 @@
+<?php
+
+require_once('code/wfpl/file.php');
+require_once('code/ie_detect.php');
+
+# this file is meant to act as a filter for .css files. it removes all lines
+# containing "remove this line for IE 5.5 and 6"
+
+# see also: .htaccess style.css
+
+function css_mangler() {
+       $file = $_SERVER['REDIRECT_URL'];
+
+       $file = substr($file, 1);
+
+       header('Content-Type: text/css');
+
+       if(ie5or6()) {
+               echo(ereg_replace("\n[^\n]*remove this line for IE 5.5 and 6[^\n]*\n", "\n", read_whole_file($file)));
+       } else {
+               readfile($file);
+       }
+}
+
+css_mangler();
+
+?>
index 806ce88..41b508a 100644 (file)
@@ -43,7 +43,7 @@
     <h4>Queued tasks</h4>
     <div>Jason hasn't started on these yet, so you can change them if you want. At some point you'll also be able to prioritize them.</div>
     <!--~queue_row start~-->
-    <div class="task_link"><div class="updown"><div class="updown_links"> <a href="tasks?tasks_edit_id=~task_id~&amp;bump=down">later</a> <a href="tasks?tasks_edit_id=~task_id~&amp;bump=up">sooner</a> <a href="tasks?tasks_edit_id=~task_id~&amp;bump=bottom">last</a> <a href="tasks?tasks_edit_id=~task_id~&amp;bump=top">first</a></div></div> ~client.html~ <a href="tasks?tasks_id=~task_id~">#~task_id~: ~task_title.html~</a> (~task_price.money~)</div>
+    <div class="task_link"><span class="updown"><div class="updown_links"> <a href="tasks?tasks_edit_id=~task_id~&amp;bump=down">later</a> <a href="tasks?tasks_edit_id=~task_id~&amp;bump=up">sooner</a> <a href="tasks?tasks_edit_id=~task_id~&amp;bump=bottom">last</a> <a href="tasks?tasks_edit_id=~task_id~&amp;bump=top">first</a></div></span> ~client.html~ <a href="tasks?tasks_id=~task_id~">#~task_id~: ~task_title.html~</a> (~task_price.money~)</div>
     <!--~end~-->
   <!--~end~-->
 
index 6adaf9c..d3c63f8 100644 (file)
--- a/tasks.css
+++ b/tasks.css
        background: #fff url(images/updown.png) right 50% no-repeat;
        padding: 5px 20px 5px 5px;
        text-align: right;
+       /* This looks _horrible_ on ie6, but it works
+       remove this line for IE 5.5 and 6 */
 }
 
 .updown:hover .updown_links {
+       /* remove this line for IE 5.5 and 6
+       */
        right: -1px;
 }