Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Added an ATOM feed of changes, tidied a few other bits

  • Loading branch information...
commit 9549ed7c0a0e0dcf04a9fd80863a743021a4decb 1 parent 366813d
Richard Bradshaw authored
253 .htaccess
... ... @@ -1,4 +1,10 @@
  1 +<Files .htaccess>
  2 + order allow,deny
  3 + deny from all
  4 +</Files>
1 5 <IfModule mod_rewrite.c>
  6 +Options +FollowSymlinks
  7 +
2 8 RewriteEngine on
3 9
4 10 RewriteRule ^(demos) - [L]
@@ -7,99 +13,202 @@ RewriteRule ^favicon.ico - [L]
7 13 RewriteRule ^([A-Za-z0-9-_/\.\?]+)\/$ /?section=$1 [L]
8 14 </IfModule>
9 15
  16 +Options -MultiViews
  17 +
  18 +<IfModule mod_headers.c>
  19 + Header set X-Author "Focal Strategy"
  20 + Header set X-UA-Compatible "IE=Edge,chrome=1"
  21 + # mod_headers can't match by content-type, but we don't want to send this header on *everything*...
  22 + <FilesMatch "\.(js|css|gif|png|jpe?g|pdf|xml|oga|ogg|m4a|ogv|mp4|m4v|webm|svg|svgz|eot|ttf|otf|woff|ico|webp|appcache|manifest|htc|crx|xpi|safariextz|vcf)$" >
  23 + Header unset X-UA-Compatible
  24 + Header unset X-Author
  25 + </FilesMatch>
  26 +</IfModule>
  27 +
  28 +<FilesMatch "^feed.xml$">
  29 +#works on Dreamhost, but not local
  30 +SetHandler application/x-httpd-php5
  31 +</FilesMatch>
  32 +
  33 +
  34 +# ----------------------------------------------------------------------
  35 +# Proper MIME type for all files
  36 +# ----------------------------------------------------------------------
  37 +
  38 +
  39 +# JavaScript
  40 +# Normalize to standard type (it's sniffed in IE anyways)
  41 +# tools.ietf.org/html/rfc4329#section-7.2
  42 +AddType application/javascript js
  43 +
  44 +# Audio
  45 +AddType audio/ogg oga ogg
  46 +AddType audio/mp4 m4a
  47 +
  48 +# Video
  49 +AddType video/ogg ogv
  50 +AddType video/mp4 mp4 m4v
  51 +AddType video/webm webm
  52 +
  53 +# SVG.
  54 +# Required for svg webfonts on iPad
  55 +# twitter.com/FontSquirrel/status/14855840545
  56 +AddType image/svg+xml svg svgz
  57 +AddEncoding gzip svgz
  58 +
  59 +# Webfonts
  60 +AddType application/vnd.ms-fontobject eot
  61 +AddType application/x-font-ttf ttf ttc
  62 +AddType font/opentype otf
  63 +AddType application/x-font-woff woff
  64 +
  65 +# Assorted types
  66 +AddType image/x-icon ico
  67 +AddType image/webp webp
  68 +AddType text/cache-manifest appcache manifest
  69 +AddType text/x-component htc
  70 +AddType application/x-chrome-extension crx
  71 +AddType application/x-xpinstall xpi
  72 +AddType application/octet-stream safariextz
  73 +AddType text/x-vcard vcf
  74 +
  75 +# ----------------------------------------------------------------------
  76 +# Gzip compression
  77 +# ----------------------------------------------------------------------
  78 +
  79 +<IfModule mod_deflate.c>
  80 +
  81 +# Force deflate for mangled headers developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping/
10 82 <IfModule mod_setenvif.c>
11   - <IfModule mod_headers.c>
12   - BrowserMatch MSIE ie
13   - Header set X-UA-Compatible "IE=Edge,chrome=1" env=ie
14   - </IfModule>
  83 + <IfModule mod_headers.c>
  84 + SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
  85 + RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
  86 + </IfModule>
  87 +</IfModule>
  88 +
  89 +# HTML, TXT, CSS, JavaScript, JSON, XML, HTC:
  90 +<IfModule filter_module>
  91 + FilterDeclare COMPRESS
  92 + FilterProvider COMPRESS DEFLATE resp=Content-Type $text/html
  93 + FilterProvider COMPRESS DEFLATE resp=Content-Type $text/css
  94 + FilterProvider COMPRESS DEFLATE resp=Content-Type $text/plain
  95 + FilterProvider COMPRESS DEFLATE resp=Content-Type $text/xml
  96 + FilterProvider COMPRESS DEFLATE resp=Content-Type $text/x-component
  97 + FilterProvider COMPRESS DEFLATE resp=Content-Type $application/javascript
  98 + FilterProvider COMPRESS DEFLATE resp=Content-Type $application/json
  99 + FilterProvider COMPRESS DEFLATE resp=Content-Type $application/xml
  100 + FilterProvider COMPRESS DEFLATE resp=Content-Type $application/xhtml+xml
  101 + FilterProvider COMPRESS DEFLATE resp=Content-Type $application/rss+xml
  102 + FilterProvider COMPRESS DEFLATE resp=Content-Type $application/atom+xml
  103 + FilterProvider COMPRESS DEFLATE resp=Content-Type $application/vnd.ms-fontobject
  104 + FilterProvider COMPRESS DEFLATE resp=Content-Type $image/svg+xml
  105 + FilterProvider COMPRESS DEFLATE resp=Content-Type $application/x-font-ttf
  106 + FilterProvider COMPRESS DEFLATE resp=Content-Type $font/opentype
  107 + FilterChain COMPRESS
  108 + FilterProtocol COMPRESS DEFLATE change=yes;byteranges=no
  109 +</IfModule>
  110 +
  111 +<IfModule !mod_filter.c>
  112 + # Legacy versions of Apache
  113 + AddOutputFilterByType DEFLATE text/html text/plain text/css application/json
  114 + AddOutputFilterByType DEFLATE application/javascript
  115 + AddOutputFilterByType DEFLATE text/xml application/xml text/x-component
  116 + AddOutputFilterByType DEFLATE application/xhtml+xml application/rss+xml application/atom+xml
  117 + AddOutputFilterByType DEFLATE image/svg+xml application/vnd.ms-fontobject application/x-font-ttf font/opentype
  118 +</IfModule>
15 119 </IfModule>
16 120
  121 +# ----------------------------------------------------------------------
  122 +# Expires headers (for better cache control)
  123 +# ----------------------------------------------------------------------
  124 +
  125 +# These are pretty far-future expires headers.
  126 +# They assume you control versioning with cachebusting query params like
  127 +# <script src="application.js?20100608">
  128 +# Additionally, consider that outdated proxies may miscache
  129 +# www.stevesouders.com/blog/2008/08/23/revving-filenames-dont-use-querystring/
  130 +
  131 +# If you don't use filenames to version, lower the CSS and JS to something like
  132 +# "access plus 1 week" or so.
  133 +
17 134 <IfModule mod_expires.c>
18   - Header set cache-control: public
19 135 ExpiresActive on
20 136
21 137 # Perhaps better to whitelist expires rules? Perhaps.
22   - ExpiresDefault "access plus 1 month"
  138 + ExpiresDefault "access plus 60 seconds"
23 139
24   -# cache.manifest needs re-reqeusts in FF 3.6 (thx Remy ~Introducing HTML5)
  140 +# cache.appcache needs re-requests in FF 3.6 (thanks Remy ~Introducing HTML5)
25 141 ExpiresByType text/cache-manifest "access plus 0 seconds"
26 142
27   -# your document html
28   - ExpiresByType text/html "access"
  143 +# Your document html
  144 + ExpiresByType text/html "access plus 0 seconds"
  145 +
  146 +# Data
  147 + ExpiresByType text/xml "access plus 60 seconds"
  148 + ExpiresByType application/xml "access plus 60 seconds"
  149 + ExpiresByType application/json "access plus 0 seconds"
29 150
30   -# rss feed
  151 +# Feed
31 152 ExpiresByType application/rss+xml "access plus 1 hour"
32   -
33   -# favicon (cannot be renamed)
34   - ExpiresByType image/vnd.microsoft.icon "access plus 1 week"
35   -
36   -# media: images, video, audio
37   - ExpiresByType image/gif "access plus 1 year"
38   - ExpiresByType image/png "access plus 1 year"
39   - ExpiresByType image/jpg "access plus 1 year"
40   - ExpiresByType image/jpeg "access plus 1 year"
41   - ExpiresByType video/ogg "access plus 1 year"
42   - ExpiresByType audio/ogg "access plus 1 year"
43   - ExpiresByType video/mp4 "access plus 1 year"
44   -
45   -# css3 PIE
46   - ExpiresByType text/x-component "access plus 1 year"
47   -
48   -# webfonts
49   - ExpiresByType font/ttf "access plus 1 year"
50   - ExpiresByType font/woff "access plus 1 year"
51   - ExpiresByType image/svg+xml "access plus 1 year"
  153 + ExpiresByType application/atom+xml "access plus 1 hour"
  154 +
  155 +# Favicon (cannot be renamed)
  156 + ExpiresByType image/x-icon "access plus 1 week"
  157 +
  158 +# Media: images, video, audio
  159 + ExpiresByType image/gif "access plus 1 month"
  160 + ExpiresByType image/png "access plus 1 month"
  161 + ExpiresByType image/jpg "access plus 1 month"
  162 + ExpiresByType image/jpeg "access plus 1 month"
  163 + ExpiresByType video/ogg "access plus 1 month"
  164 + ExpiresByType audio/ogg "access plus 1 month"
  165 + ExpiresByType video/mp4 "access plus 1 month"
  166 + ExpiresByType video/webm "access plus 1 month"
  167 +
  168 +# HTC files (css3pie)
  169 + ExpiresByType text/x-component "access plus 1 month"
  170 +
  171 +# Webfonts
  172 + ExpiresByType font/truetype "access plus 1 month"
  173 + ExpiresByType font/opentype "access plus 1 month"
  174 + ExpiresByType application/x-font-woff "access plus 1 month"
  175 + ExpiresByType image/svg+xml "access plus 1 month"
  176 + ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
  177 +
  178 +# CSS and JavaScript
  179 + ExpiresByType text/css "access plus 1 year"
  180 + ExpiresByType application/javascript "access plus 1 year"
  181 +
  182 + <IfModule mod_headers.c>
  183 + Header append Cache-Control "public"
  184 + </IfModule>
52 185
53   -# css and javascript
54   - ExpiresByType text/css "access plus 1 week"
55   - ExpiresByType application/javascript "access plus 1 week"
56   - ExpiresByType text/javascript "access plus 1 week"
57 186 </IfModule>
58 187
59   -Header unset ETag
60   -FileETag None
61   -
62   -Header set X-Author "Focal Strategy"
63   -
64   -<Files .htaccess>
65   -order allow,deny
66   -deny from all
67   -</Files>
68   -
69   -IndexIgnore *
70   -Options -Indexes
71   -
72   -Options -MultiViews
73 188
74   -ErrorDocument 404 /errorpages/notfound.php
75 189
76   -<IfModule mod_deflate.c>
77   -# html, xml, css, and js:
78   - AddOutputFilterByType DEFLATE text/x-component text/html text/plain text/xml text/css application/x-javascript text/javascript application/javascript application/json
  190 +# ----------------------------------------------------------------------
  191 +# ETag removal
  192 +# ----------------------------------------------------------------------
79 193
80   -# webfonts and svg:
81   - <FilesMatch "\.(ttf|otf|eot|svg)$" >
82   - SetOutputFilter DEFLATE
83   - </FilesMatch>
  194 +# FileETag None is not enough for every server.
  195 +<IfModule mod_headers.c>
  196 + Header unset ETag
84 197 </IfModule>
85 198
86   -# video
87   -AddType video/ogg ogg ogv
88   -AddType video/mp4 mp4
  199 +# Since we're sending far-future expires, we don't need ETags for
  200 +# static content.
  201 +# developer.yahoo.com/performance/rules.html#etags
  202 +FileETag None
89 203
90   -# Proper svg serving. Required for svg webfonts on iPad
91   -# twitter.com/FontSquirrel/status/14855840545
92   -AddType image/svg+xml svg svgz
  204 +# ----------------------------------------------------------------------
  205 +# UTF-8 encoding
  206 +# ----------------------------------------------------------------------
93 207
94   -# webfonts
95   -AddType application/vnd.ms-fontobject eot
96   -AddType font/ttf ttf
97   -AddType font/otf otf
98   -AddType font/x-woff woff
  208 +# Use UTF-8 encoding for anything served text/plain or text/html
  209 +AddDefaultCharset utf-8
99 210
100   -AddType text/x-component .htc
  211 +# Force UTF-8 for a number of file formats
  212 +AddCharset utf-8 .html .css .js .xml .json .rss .atom
101 213
102   -# use utf-8 encoding for anything served text/plain or text/html
103   -AddDefaultCharset utf-8
104   -# force utf-8 for a number of file formats
105   -AddCharset utf-8 .html .css .js .xml .json .rss
  214 +Options -Indexes
4 constants.php
... ... @@ -1,8 +1,8 @@
1 1 <?
2 2
3 3 $titles = array(
4   - "accordions" => "CSS3 Accordions | CSS3 transitions, transforms and animations | CSS3 transitions, transforms and animations",
5   - "animations" => "CSS3 Animations | CSS3 transitions, transforms and animations | CSS3 transitions, transforms and animations",
  4 + "accordions" => "CSS3 Accordions | CSS3 transitions, transforms and animations",
  5 + "animations" => "CSS3 Animations | CSS3 transitions, transforms and animations",
6 6 "cfimg" => "Crossfading Images | CSS3 transitions, transforms and animations",
7 7 "cfimg1" => "Crossfading Images on hover | CSS3 transitions, transforms and animations",
8 8 "cfimg2" => "Crossfading Images on button press | CSS3 transitions, transforms and animations",
8 demos/filters-and-fades.php
@@ -53,7 +53,7 @@
53 53 filter:grayscale(1);
54 54 }
55 55
56   - #thumbs img:hover, #thumbs a:target img {
  56 + #thumbs img:hover, #thumbs a:target img, #thumbs img.active {
57 57 -webkit-filter:grayscale(0);
58 58 -moz-filter:grayscale(0);
59 59 -ms-filter:grayscale(0);
@@ -80,9 +80,11 @@
80 80
81 81 $(function(){
82 82 $("#thumbs").on("click", "img", function(e){
83   - e.preventDefault();
84   - window.location.hash = $(this).parent("a").attr("id");
  83 + $("#thumbs img").removeClass("active");
  84 + $(this).addClass("active");
  85 +
85 86 $("#main").css("background-image","url("+$(this).attr("src")+")");
  87 + return false;
86 88 });
87 89 });
88 90 </script>
80 feed.xml
... ... @@ -0,0 +1,80 @@
  1 +<?
  2 +include($_SERVER['DOCUMENT_ROOT']."/constants.php");
  3 +
  4 +function get_dir_contents($web_directory) {
  5 + $directory = $_SERVER['DOCUMENT_ROOT'].$web_directory;
  6 + if(file_exists($directory)) {
  7 + $myDirectory = opendir($directory);
  8 +
  9 + while($entryName = readdir($myDirectory)) {
  10 + if (substr($entryName, 0, 1) != "."){
  11 + $dirArray[] = $entryName;
  12 + }
  13 + }
  14 + sort($dirArray, SORT_NUMERIC);
  15 +
  16 + return $dirArray;
  17 + }
  18 +}
  19 +
  20 +$systemfiles = array("index.php", "indexcontents.php", "constants.php", "contents.php", "feed.php", "footer.php");
  21 +
  22 +$files = get_dir_contents("/");
  23 +
  24 +$feedarray = array();
  25 +
  26 +foreach ($files as $filename) {
  27 + $ext = pathinfo($filename, PATHINFO_EXTENSION);
  28 +
  29 + if ($ext == "php" && !in_array($filename, $systemfiles)) {
  30 +
  31 + $feedarray[$filename] = filemtime($filename);
  32 +
  33 + }
  34 +}
  35 +
  36 +arsort($feedarray);
  37 +
  38 +foreach ($feedarray as $page => $modified) {
  39 + $mostrecent = $modified;
  40 + break;
  41 +}
  42 +
  43 +echo "<?xml version=\"1.0\" encoding=\"utf-8\"?> <?xml-stylesheet type=\"text/xsl\" href=\"/atom2html.xslt\"?> <feed xmlns=\"http://www.w3.org/2005/Atom\">";
  44 +?>
  45 + <title>CSS3 Transitions, Transforms and Animations</title>
  46 + <subtitle>Examples and practical uses by Rich Bradshaw</subtitle>
  47 + <link href="http://css3.bradshawenterprises.com/feed.php" rel="self" />
  48 + <link href="http://css3.bradshawenterprises.com/" />
  49 + <id>tag:css3.bradshawenterprises.com,2012-02-12:/20120212161845979</id>
  50 +
  51 + <updated><?= date(DATE_ATOM, $mostrecent )?></updated>
  52 +
  53 +
  54 +<? foreach ($feedarray as $page => $modified) {
  55 + $realpage = str_replace(".php","",$page);
  56 +
  57 + $linktopage = "http://css3.bradshawenterprises.com/".$realpage."/";
  58 +
  59 + ?>
  60 +
  61 + <entry>
  62 + <author>
  63 + <name>Rich Bradshaw</name>
  64 + </author>
  65 +
  66 + <title type="html"><![CDATA[Updated: <?= $titles[$realpage] ?>]]></title>
  67 +
  68 + <link rel="alternate" type="text/html" href="<?= $linktopage ?>" />
  69 +
  70 + <id>tag:css3.bradshawenterprises.com,2012:</id>
  71 +
  72 + <updated><?= date(DATE_ATOM, $modified) ?></updated>
  73 + <published><?= date(DATE_ATOM, $modified) ?></published>
  74 +
  75 + <content type="html"><![CDATA[I've just updated the content on my CSS3 transitions, transforms and animations page. Have a look at the page that's changed/been added <a href="<?= $linktopage ?>">here</a>.]]></content>
  76 + </entry>
  77 +
  78 +<? } ?>
  79 +
  80 +</feed>
2  index.php
@@ -26,6 +26,8 @@
26 26 });
27 27 });
28 28 </script>
  29 +
  30 + <link rel=alternate type=application/atom+xml href=/feed.xml />
29 31 <meta name="viewport" content="width=device-width,maximum-scale=1.0" />
30 32 </head>
31 33 <body>

0 comments on commit 9549ed7

Please sign in to comment.
Something went wrong with that request. Please try again.