1
0
mirror of https://github.com/mrclay/minify.git synced 2025-08-13 09:34:54 +02:00

Moved examples and tests to combined web folder. Unfortunately I didn't do this with SVN move and the server wouldn't let me rollback to do this.

This commit is contained in:
Steve Clay
2008-02-28 22:32:56 +00:00
parent 041ea14cc4
commit b04ff4c6e9
37 changed files with 4566 additions and 0 deletions

66
web/examples/1/index.php Normal file
View File

@@ -0,0 +1,66 @@
<?php
require '../../config.php';
ob_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Minify Example 1</title>
<link rel="stylesheet" type="text/css" href="m.php?f=test.css&amp;v=3" />
<style type="text/css">
#cssFail {
width:2.8em;
overflow:hidden;
}
</style>
</head>
<body>
<?php if (! $minifyCachePath): ?>
<p><strong>Note:</strong> You should <em>always</em> enable caching using
<code>Minify::useServerCache()</code>. For the examples this can be set in
<code>config.php</code>. Notice that minifying jquery.js takes several seconds!.</p>
<?php endif; ?>
<h1>Minify Example 1</h1>
<p>This is an example of Minify serving a directory of single css/js files.
Each file is minified and sent with HTTP encoding (browser-permitting). </p>
<ul>
<li id="cssFail"><span>FAIL</span>PASS</li>
<li id="jsFail1">FAIL</li>
<li id="jsFail2">FAIL</li>
</ul>
<p><a href="">Link to this page (F5 can trigger no-cache headers)</a></p>
<script type="text/javascript" src="m.php?f=jquery-1.2.3.js&amp;v=1"></script>
<script type="text/javascript" src="m.php?f=test+space.js"></script>
<script type="text/javascript">
$(function () {
if ( 1 < 2 ) {
$('#jsFail2').html('PASS');
}
});
</script>
</body>
</html>
<?php
$content = ob_get_clean();
require 'Minify.php';
if ($minifyCachePath) {
Minify::useServerCache($minifyCachePath);
}
Minify::serve('Page', array(
'content' => $content
,'id' => __FILE__
,'lastModifiedTime' => filemtime(__FILE__)
// also minify the CSS/JS inside the HTML
,'minifyAll' => true
));

3408
web/examples/1/jquery-1.2.3.js vendored Normal file

File diff suppressed because it is too large Load Diff

50
web/examples/1/m.php Normal file
View File

@@ -0,0 +1,50 @@
<?php
/**
* This script will serve a single js/css file in this directory. Here we place
* the front-end-controller logic in user code, then use the "Files" controller
* to minify the file. Alternately, we could have created a custom controller
* with the same logic and passed it to Minify::handleRequest().
*/
require '../../config.php';
/**
* The Files controller only "knows" HTML, CSS, and JS files. Other files
* would only be trim()ed and sent as plain/text.
*/
$serveExtensions = array('css', 'js');
// set HTTP Expires header if GET 'v' is sent
$cacheUntil = isset($_GET['v'])
? (time() + 86400 * 30)
: null;
// serve
if (isset($_GET['f'])) {
$filename = basename($_GET['f']); // remove any naughty bits
$filenamePattern = '/[^\'"\\/\\\\]+\\.(?:'
.implode('|', $serveExtensions). ')$/';
if (preg_match($filenamePattern, $filename)
&& file_exists(dirname(__FILE__) . '/' . $filename)) {
require 'Minify.php';
if ($minifyCachePath) {
Minify::useServerCache($minifyCachePath);
}
// The Files controller serves an array of files, but here we just
// need one.
Minify::serve('Files', array(
dirname(__FILE__) . '/' . $filename
), array(
'cacheUntil' => $cacheUntil
));
exit();
}
}
header("HTTP/1.0 404 Not Found");
echo "HTTP/1.0 404 Not Found";

View File

@@ -0,0 +1,5 @@
$(function () {
$('#jsFail1').html('PASS');
});

19
web/examples/1/test.css Normal file
View File

@@ -0,0 +1,19 @@
/* Test file to minify */
/* Minify copyright notice here... */
h1 {
color: #00cc00;
font-size: 20px;
}
ul, li {
padding:0;
margin:0;
display:block;
font-family: monospace;
}
#cssFail span {
display: none;
}

29
web/test/_inc.php Normal file
View File

@@ -0,0 +1,29 @@
<?php
require '../config.php';
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', 1);
header('Content-Type: text/plain');
$thisDir = dirname(__FILE__);
/**
* pTest - PHP Unit Tester
* @param mixed $test Condition to test, evaluated as boolean
* @param string $message Descriptive message to output upon test
* @url http://www.sitepoint.com/blogs/2007/08/13/ptest-php-unit-tester-in-9-lines-of-code/
*/
function assertTrue($test, $message)
{
static $count;
if (!isset($count)) $count = array('pass'=>0, 'fail'=>0, 'total'=>0);
$mode = $test ? 'pass' : 'fail';
printf("%s: %s (%d of %d tests run so far have %sed)\n",
strtoupper($mode), $message, ++$count[$mode], ++$count['total'], $mode);
return (bool)$test;
}
?>

3
web/test/css/caio.css Normal file
View File

@@ -0,0 +1,3 @@
/*/*/ a{}
.foo {color:red}
/* blah */

1
web/test/css/caio.min.css vendored Normal file
View File

@@ -0,0 +1 @@
/*/*/a{}.foo{color:red}/**/

View File

@@ -0,0 +1,6 @@
/* block comments get removed */
/* comments containing the word "copyright" are left in, though */
/* but all other comments are removed */

View File

@@ -0,0 +1 @@
/* comments containing the word "copyright" are left in, though */

1
web/test/css/comments.min.css vendored Normal file
View File

@@ -0,0 +1 @@
/* comments containing the word "copyright" are left in, though */

31
web/test/css/hacks.css Normal file
View File

@@ -0,0 +1,31 @@
/* hide from ie5/mac \*/ a{}
.foo {color:red}
/* necessary comment */
/* comment */
/* feed to ie5/mac \*//*/
@import "ie5mac.css";
/* necessary comment */
/* comment */
/*/ hide from nav4 */
.foo {display:block;}
/* necessary comment */
/* comment */
/*/ feed to nav *//*/
.foo {display:crazy;}
/* necessary comment */
/* comment */
div {
width: 140px;
width/* */:/**/100px;
width: /**/100px;
}
html>/**/body {}

1
web/test/css/hacks.min Normal file
View File

@@ -0,0 +1 @@
/*\*/a{}.foo{color:red}/**//*\*//*/@import "ie5mac.css";/**//*/*/.foo{display:block}/**//*/*//*/.foo{display:crazy}/**/div{width:140px;width/**/:/**/100px;width:/**/100px}html>/**/body{}

1
web/test/css/hacks.min.css vendored Normal file
View File

@@ -0,0 +1 @@
/*\*/a{}.foo{color:red}/**//*\*//*/@import "ie5mac.css";/**//*/*/.foo{display:block}/**//*/*//*/.foo{display:crazy}/**/div{width:140px;width/**/:/**/100px;width:/**/100px}html>/**/body{}

9
web/test/css/paths.css Normal file
View File

@@ -0,0 +1,9 @@
@import "foo.css";
@import 'bar/foo.css';
@import '/css/foo.css';
@import 'http://foo.com/css/foo.css';
@import url(./foo.css);
@import url("/css/foo.css");
@import url(/css2/foo.css);
foo {background:url('bar/foo.png')}
foo {background:url('http://foo.com/css/foo.css');}

1
web/test/css/paths.min Normal file
View File

@@ -0,0 +1 @@
@import "../foo.css";@import '../bar/foo.css';@import '/css/foo.css';@import 'http://foo.com/css/foo.css';@import url(.././foo.css);@import url("/css/foo.css");@import url(/css2/foo.css);foo{background:url('../bar/foo.png')}foo{background:url('http://foo.com/css/foo.css')}

1
web/test/css/paths.min.css vendored Normal file
View File

@@ -0,0 +1 @@
@import "../foo.css";@import '../bar/foo.css';@import '/css/foo.css';@import 'http://foo.com/css/foo.css';@import url(.././foo.css);@import url("/css/foo.css");@import url(/css2/foo.css);foo{background:url('../bar/foo.png')}foo{background:url('http://foo.com/css/foo.css')}

1
web/test/css/readme.txt Normal file
View File

@@ -0,0 +1 @@
Test suite from http://search.cpan.org/~gtermars/CSS-Minifier-XS/

21
web/test/css/styles.css Normal file
View File

@@ -0,0 +1,21 @@
/* some CSS to try to exercise things in general */
@import url( more.css );
body, td, th {
font-family: Verdana, "Bitstream Vera Sans", sans-serif;
font-size : 12px;
}
.nav {
margin-left: 20%;
}
#main-nav {
background-color: red;
border: 1px solid #00ff77;
}
div#content h1 + p {
padding-top: 0;
margin-top: 0;
}

1
web/test/css/styles.min Normal file
View File

@@ -0,0 +1 @@
@import url(more.css);body,td,th{font-family:Verdana, "Bitstream Vera Sans",sans-serif;font-size:12px}.nav{margin-left:20%}#main-nav{background-color:red;border:1px solid #0f7}div#content h1+p{padding-top:0;margin-top:0}

1
web/test/css/styles.min.css vendored Normal file
View File

@@ -0,0 +1 @@
@import url(more.css);body,td,th{font-family:Verdana, "Bitstream Vera Sans",sans-serif;font-size:12px}.nav{margin-left:20%}#main-nav{background-color:red;border:1px solid #0f7}div#content h1+p{padding-top:0;margin-top:0}

434
web/test/css/subsilver.css Normal file
View File

@@ -0,0 +1,434 @@
/* Based on the original Style Sheet for the fisubsilver v2 Theme for phpBB version 2+
Edited by Daz - http://www.forumimages.com - last updated 26-06-03 */
/* The content of the posts (body of text) */
/* General page style */
/* begin suggest post */
.float-l{
float: left;
}
.form-suggest{
height:200px;
background:#DEE2D0;
vertical-align: top;
}
.form-input input{
font-size: 10px;
}
.hide{
display:none;
}
.form-input textarea{
font-size: 11px;
width: 350px;
}
.form-label{
font-size: 10px;
font-weight: bold;
line-height: 25px;
padding-right: 10px;
text-align: right;
width: 100px;
color: #39738F;
}
.font-9{
font-size: 9px;
}
.form-topic{
font-weight:bold;
}
.form-error{
color:red;
}
.inline{
display: inline;
}
.space-10{
clear: both;
font-size: 10px;
height: 10px;
line-height: 10px;
}
.suggest-success{
color:green;
padding-left:10px;
font-size:11px;
font-weight:bold;
}
.top{
vertical-align: top;
}
/* end suggest post */
table td{
padding:3px;
}
a:link,a:active,a:visited,a.postlink{
color: #006699;
text-decoration: none;
}
a:hover{
color: #DD6900;
}
a.admin:hover,a.mod:hover{
color: #DD6900;
}
a.but,a.but:hover,a.but:visited{
color: #000000;
text-decoration: none;
}
a.topictitle:visited{
color: #5493B4;
}
a.topictitle:hover{
color: #DD6900;
}
body{
color: #000000;
font: 11px Verdana,Arial,Helvetica,sans-serif;
margin: 0 10px 10px 10px;
padding: 0;
overflow:auto;
}
/* General font families for common tags */
font,th,td,p{
font: 12px Verdana,Arial,Helvetica,sans-serif;
}
/* Form elements */
form{
display: inline;
}
hr{
border: 0px solid #FFFFFF;
border-top-width: 1px;
height: 0px;
}
/* Gets rid of the need for border="0" on hyperlinked images */
img{
border: 0 solid;
}
input{
font: 11px Verdana,Arial,Helvetica,sans-serif;
}
input.button,input.liteoption,.fakebut{
background: #FAFAFA;
border: 1px solid #000000;
font-size: 11px;
}
input.catbutton{
background: #FAFAFA;
border: 1px solid #000000;
font-size: 10px;
}
input.mainoption{
background: #FAFAFA;
border: 1px solid #000000;
font-size: 11px;
font-weight: bold;
}
input.post,textarea.post{
background: #FFFFFF;
border: 1px solid #000000;
font: 11px Verdana,Arial,Helvetica,sans-serif;
padding-bottom: 2px;
padding-left: 2px;
}
select{
background: #FFFFFF;
font: 11px Verdana,Arial,Helvetica,sans-serif;
}
table{
text-align: left;
}
td{
vertical-align: middle;
}
/* Category gradients*/
td.cat{
background-color: #C2C6BA;
font-weight: bold;
height: 20px;
letter-spacing: 1px;
text-indent: 4px;
}
td.genmed,.genmed{
font-size: 11px;
}
/* This is for the table cell above the Topics,Post & Last posts on the index.php */
td.rowpic{
background: #C2C6BA;
}
td.spacerow{
background: #E5E6E2;
}
/* Table Header cells */
th{
background-color: #FADD31;
background-image: url(images/cellpic3.gif);
background-repeat: repeat-x;
color: #68685E;
font-size: 11px;
font-weight: bold;
line-height:16px;
height: 16px;
padding-left: 8px;
padding-right: 8px;
text-align: center;
white-space: nowrap;
}
/* Admin & Moderator Colours MODification */
.admin,.mod{
font-size: 11px;
font-weight: bold;
}
.admin,a.admin,a.admin:visited{
color: #FFA34F;
}
/* This is the border line & background colour round the entire page */
.bodyline{
background: #FFFFFF;
border: 1px solid #98AAB1;
}
.center{
text-align: center;
}
/* Code blocks */
.code{
background: #FAFAFA;
border: 1px solid #D1D7DC;
color: #006600;
font: 12px Courier,"Courier New",sans-serif;
padding: 5px;
}
/* This is for the error messages that pop up */
.errorline{
background: #E5E6E2;
border: 1px solid #8F8B8B;
color:#D92A2A;
}
.explaintitle{
color: #5C81B1;
font-size: 11px;
font-weight: bold;
}
/* This is the outline round the main forum tables */
.forumline{
background: #FFFFFF;
}
/* General text */
.gensmall{
font-size: 10px;
}
.h1-font{
color: #006699;
display: inline;
font: bold 13px Verdana, Arial, Helvetica, sans-serif;
margin: 0;
text-decoration: none;
}
.h2-font{
display: inline;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 11px;
}
.height1{
height: 1px;
}
.height22{
height: 22px;
}
.height25{
height: 25px;
}
.height28{
height: 28px;
}
.height30{
height: 30px;
}
.height40{
height: 40px;
}
/* This is the line in the posting page which shows the rollover
help line. Colour value in row2 */
.helpline{
border: 0 solid;
font-size: 10px;
}
.imgfolder{
margin: 1px 4px 1px 4px;
}
.imgspace{
margin-left: 1px;
margin-right: 2px;
}
/* Specify the space around images */
.imgtopic,.imgicon{
margin-left: 3px;
}
.left{
text-align: left;
}
/* The largest text used in the index page title and toptic title etc. */
.maintitle,h1,h2{
color: #5C81B1;
font: bold 20px/120% "Trebuchet MS",Verdana,Arial,Helvetica,sans-serif;
text-decoration: none;
}
.maxwidth{
width: 100%;
}
.mod,a.mod,a.mod:visited{
color: #006600;
}
/* Name of poster in viewmsg.php and viewtopic.php and other places */
.name{
font-size: 11px;
font-weight: bold;
}
/* Used for the navigation text,(Page 1,2,3 etc) and the navigation bar when in a forum */
.nav{
font-size: 11px;
font-weight: bold;
}
.nowrap{
white-space: nowrap;
}
.postbody{
font-size: 12px;
line-height: 125%;
}
.postbody a{
text-decoration: underline;
}
/* Location,number of posts,post date etc */
.postdetails{
color: #00396A;
font-size: 10px;
}
/* Quote blocks */
.quote{
background: #F3F3EF;
border: 1px solid #C2C6BA;
color: #006699;
font-size: 11px;
line-height: 125%;
}
.right{
text-align: right;
}
/* Main table cell colours and backgrounds */
.row1{
background: #F0F0EB;
}
.row2,.helpline{
background: #E5E6E2;
}
.row3{
background: #DBDBD4;
}
.subtitle,h2{
font: bold 18px/180% "Trebuchet MS",Verdana,Arial,Helvetica,sans-serif;
text-decoration: none;
}
/* titles for the topics:could specify viewed link colour too */
.topictitle {
color: #000000;
font-size: 11px;
font-weight: bold;
}
.underline{
text-decoration: underline;
}
.top{
vertical-align:top;
}
.image-hspace{
margin-right:3px;
}
.clear{
clear:both;
}

View File

@@ -0,0 +1 @@
.float-l{float:left}.form-suggest{height:200px;background:#DEE2D0;vertical-align:top}.form-input input{font-size:10px}.hide{display:none}.form-input textarea{font-size:11px;width:350px}.form-label{font-size:10px;font-weight:bold;line-height:25px;padding-right:10px;text-align:right;width:100px;color: #39738F}.font-9{font-size:9px}.form-topic{font-weight:bold}.form-error{color:red}.inline{display:inline}.space-10{clear:both;font-size:10px;height:10px;line-height:10px}.suggest-success{color:green;padding-left:10px;font-size:11px;font-weight:bold}.top{vertical-align:top}table td{padding:3px}a:link,a:active,a:visited,a.postlink{color: #069;text-decoration:none}a:hover{color: #DD6900}a.admin:hover,a.mod:hover{color: #DD6900}a.but,a.but:hover,a.but:visited{color: #000;text-decoration:none}a.topictitle:visited{color: #5493B4}a.topictitle:hover{color: #DD6900}body{color: #000;font:11px Verdana,Arial,Helvetica,sans-serif;margin:0 10px 10px 10px;padding:0;overflow:auto}font,th,td,p{font:12px Verdana,Arial,Helvetica,sans-serif}form{display:inline}hr{border:0px solid #FFF;border-top-width:1px;height:0px}img{border:0 solid}input{font:11px Verdana,Arial,Helvetica,sans-serif}input.button,input.liteoption,.fakebut{background: #FAFAFA;border:1px solid #000;font-size:11px}input.catbutton{background: #FAFAFA;border:1px solid #000;font-size:10px}input.mainoption{background: #FAFAFA;border:1px solid #000;font-size:11px;font-weight:bold}input.post,textarea.post{background: #FFF;border:1px solid #000;font:11px Verdana,Arial,Helvetica,sans-serif;padding-bottom:2px;padding-left:2px}select{background: #FFF;font:11px Verdana,Arial,Helvetica,sans-serif}table{text-align:left}td{vertical-align:middle}td.cat{background-color: #C2C6BA;font-weight:bold;height:20px;letter-spacing:1px;text-indent:4px}td.genmed,.genmed{font-size:11px}td.rowpic{background: #C2C6BA}td.spacerow{background: #E5E6E2}th{background-color: #FADD31;background-image:url(images/cellpic3.gif);background-repeat:repeat-x;color: #68685E;font-size:11px;font-weight:bold;line-height:16px;height:16px;padding-left:8px;padding-right:8px;text-align:center;white-space:nowrap}.admin,.mod{font-size:11px;font-weight:bold}.admin,a.admin,a.admin:visited{color: #FFA34F}.bodyline{background: #FFF;border:1px solid #98AAB1}.center{text-align:center}.code{background: #FAFAFA;border:1px solid #D1D7DC;color: #060;font:12px Courier,"Courier New",sans-serif;padding:5px}.errorline{background: #E5E6E2;border:1px solid #8F8B8B;color:#D92A2A}.explaintitle{color: #5C81B1;font-size:11px;font-weight:bold}.forumline{background: #FFF}.gensmall{font-size:10px}.h1-font{color: #069;display:inline;font:bold 13px Verdana,Arial,Helvetica,sans-serif;margin:0;text-decoration:none}.h2-font{display:inline;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:11px}.height1{height:1px}.height22{height:22px}.height25{height:25px}.height28{height:28px}.height30{height:30px}.height40{height:40px}.helpline{border:0 solid;font-size:10px}.imgfolder{margin:1px 4px 1px 4px}.imgspace{margin-left:1px;margin-right:2px}.imgtopic,.imgicon{margin-left:3px}.left{text-align:left}.maintitle,h1,h2{color: #5C81B1;font:bold 20px/120% "Trebuchet MS",Verdana,Arial,Helvetica,sans-serif;text-decoration:none}.maxwidth{width:100%}.mod,a.mod,a.mod:visited{color: #060}.name{font-size:11px;font-weight:bold}.nav{font-size:11px;font-weight:bold}.nowrap{white-space:nowrap}.postbody{font-size:12px;line-height:125%}.postbody a{text-decoration:underline}.postdetails{color: #00396A;font-size:10px}.quote{background: #F3F3EF;border:1px solid #C2C6BA;color: #069;font-size:11px;line-height:125%}.right{text-align:right}.row1{background: #F0F0EB}.row2,.helpline{background: #E5E6E2}.row3{background: #DBDBD4}.subtitle,h2{font:bold 18px/180% "Trebuchet MS",Verdana,Arial,Helvetica,sans-serif;text-decoration:none}.topictitle{color: #000;font-size:11px;font-weight:bold}.underline{text-decoration:underline}.top{vertical-align:top}.image-hspace{margin-right:3px}.clear{clear:both}

1
web/test/css/subsilver.min.css vendored Normal file
View File

@@ -0,0 +1 @@
.float-l{float:left}.form-suggest{height:200px;background:#DEE2D0;vertical-align:top}.form-input input{font-size:10px}.hide{display:none}.form-input textarea{font-size:11px;width:350px}.form-label{font-size:10px;font-weight:bold;line-height:25px;padding-right:10px;text-align:right;width:100px;color: #39738F}.font-9{font-size:9px}.form-topic{font-weight:bold}.form-error{color:red}.inline{display:inline}.space-10{clear:both;font-size:10px;height:10px;line-height:10px}.suggest-success{color:green;padding-left:10px;font-size:11px;font-weight:bold}.top{vertical-align:top}table td{padding:3px}a:link,a:active,a:visited,a.postlink{color: #069;text-decoration:none}a:hover{color: #DD6900}a.admin:hover,a.mod:hover{color: #DD6900}a.but,a.but:hover,a.but:visited{color: #000;text-decoration:none}a.topictitle:visited{color: #5493B4}a.topictitle:hover{color: #DD6900}body{color: #000;font:11px Verdana,Arial,Helvetica,sans-serif;margin:0 10px 10px 10px;padding:0;overflow:auto}font,th,td,p{font:12px Verdana,Arial,Helvetica,sans-serif}form{display:inline}hr{border:0px solid #FFF;border-top-width:1px;height:0px}img{border:0 solid}input{font:11px Verdana,Arial,Helvetica,sans-serif}input.button,input.liteoption,.fakebut{background: #FAFAFA;border:1px solid #000;font-size:11px}input.catbutton{background: #FAFAFA;border:1px solid #000;font-size:10px}input.mainoption{background: #FAFAFA;border:1px solid #000;font-size:11px;font-weight:bold}input.post,textarea.post{background: #FFF;border:1px solid #000;font:11px Verdana,Arial,Helvetica,sans-serif;padding-bottom:2px;padding-left:2px}select{background: #FFF;font:11px Verdana,Arial,Helvetica,sans-serif}table{text-align:left}td{vertical-align:middle}td.cat{background-color: #C2C6BA;font-weight:bold;height:20px;letter-spacing:1px;text-indent:4px}td.genmed,.genmed{font-size:11px}td.rowpic{background: #C2C6BA}td.spacerow{background: #E5E6E2}th{background-color: #FADD31;background-image:url(images/cellpic3.gif);background-repeat:repeat-x;color: #68685E;font-size:11px;font-weight:bold;line-height:16px;height:16px;padding-left:8px;padding-right:8px;text-align:center;white-space:nowrap}.admin,.mod{font-size:11px;font-weight:bold}.admin,a.admin,a.admin:visited{color: #FFA34F}.bodyline{background: #FFF;border:1px solid #98AAB1}.center{text-align:center}.code{background: #FAFAFA;border:1px solid #D1D7DC;color: #060;font:12px Courier,"Courier New",sans-serif;padding:5px}.errorline{background: #E5E6E2;border:1px solid #8F8B8B;color:#D92A2A}.explaintitle{color: #5C81B1;font-size:11px;font-weight:bold}.forumline{background: #FFF}.gensmall{font-size:10px}.h1-font{color: #069;display:inline;font:bold 13px Verdana,Arial,Helvetica,sans-serif;margin:0;text-decoration:none}.h2-font{display:inline;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:11px}.height1{height:1px}.height22{height:22px}.height25{height:25px}.height28{height:28px}.height30{height:30px}.height40{height:40px}.helpline{border:0 solid;font-size:10px}.imgfolder{margin:1px 4px 1px 4px}.imgspace{margin-left:1px;margin-right:2px}.imgtopic,.imgicon{margin-left:3px}.left{text-align:left}.maintitle,h1,h2{color: #5C81B1;font:bold 20px/120% "Trebuchet MS",Verdana,Arial,Helvetica,sans-serif;text-decoration:none}.maxwidth{width:100%}.mod,a.mod,a.mod:visited{color: #060}.name{font-size:11px;font-weight:bold}.nav{font-size:11px;font-weight:bold}.nowrap{white-space:nowrap}.postbody{font-size:12px;line-height:125%}.postbody a{text-decoration:underline}.postdetails{color: #00396A;font-size:10px}.quote{background: #F3F3EF;border:1px solid #C2C6BA;color: #069;font-size:11px;line-height:125%}.right{text-align:right}.row1{background: #F0F0EB}.row2,.helpline{background: #E5E6E2}.row3{background: #DBDBD4}.subtitle,h2{font:bold 18px/180% "Trebuchet MS",Verdana,Arial,Helvetica,sans-serif;text-decoration:none}.topictitle{color: #000;font-size:11px;font-weight:bold}.underline{text-decoration:underline}.top{vertical-align:top}.image-hspace{margin-right:3px}.clear{clear:both}

91
web/test/html/before.html Normal file
View File

@@ -0,0 +1,91 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
<head>
<!-- comments get removed -->
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<meta name="author" content="Dave Shea" />
<!-- also whitespace around block or undisplayed elements -->
<meta name="keywords" content="design, css, cascading, style, sheets, xhtml, graphic design, w3c, web standards, visual, display" />
<meta name="description" content="A demonstration of what can be accomplished visually through CSS-based design." />
<meta name="robots" content="all" />
<title>css Zen Garden: The Beauty in CSS Design</title>
<!-- to correct the unsightly Flash of Unstyled Content. http://www.bluerobot.com/web/css/fouc.asp -->
<script type="text/javascript"><!--
// js comment inside SCRIPT element
var is = {
ie: navigator.appName == 'Microsoft Internet Explorer',
java: navigator.javaEnabled(),
ns: navigator.appName == 'Netscape',
ua: navigator.userAgent.toLowerCase(),
version: parseFloat(navigator.appVersion.substr(21)) ||
parseFloat(navigator.appVersion),
win: navigator.platform == 'Win32'
}
is.mac = is.ua.indexOf('mac') >= 0;
if (is.ua.indexOf('opera') >= 0) {
is.ie = is.ns = false;
is.opera = true;
}
if (is.ua.indexOf('gecko') >= 0) {
is.ie = is.ns = false;
is.gecko = true;
}
// --></script>
<script type="text/javascript">
//<![CDATA[
var i = 0;
while (++i < 10)
{
// ...
}
//]]>
</script>
<script type="text/javascript">
/* <![CDATA[ */ i = 1; /* ]]> */
</script>
<script type="text/javascript">
(i < 1); /* CDATA needed */
</script>
<!--[if IE 6]>
<style type="text/css">
/* copyright: you'll need CDATA for this -- < & */
body {background:white;}
</style>
<![endif]-->
<style type="text/css" title="currentStyle" media="screen">
@import "/001/001.css";
/*\*/ css hack {} /* */
/* normal CSS comment */
/*/*/ css hack {} /* */
css hack {
display/**/:/**/none;
display:none;
}
</style>
<link
rel="Shortcut Icon"
type="image/x-icon"
href="http://www.csszengarden.com/favicon.ico" />
<link
rel="alternate"
type="application/rss+xml"
title="RSS"
href="http://www.csszengarden.com/zengarden.xml" />
</head>
<body id="css-zen-garden">
<div id="container">
<div id="pageHeader">
<h1><span>css Zen Garden</span></h1>
<h2><span>The Beauty of <acronym title="Cascading Style Sheets">CSS</acronym> Design</span></h2>
</div>
<pre>
White space is important here!
</pre>
<div id="quickSummary">
<p class="p1"><span>A demonstration of what can be accomplished visually through <acronym title="Cascading Style Sheets">CSS</acronym>-based design. Select any style sheet from the list to load it into this page.</span></p>
<p class="p2"><span>Download the sample <a href="/zengarden-sample.html" title="This page's source HTML code, not to be modified.">html file</a> and <a href="/zengarden-sample.css" title="This page's sample CSS, the file you may modify.">css file</a></span></p>
</div>
</div>
</body>
</html>

View File

@@ -0,0 +1,13 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" ><head><meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /><meta name="author" content="Dave Shea" /><meta name="keywords" content="design, css, cascading, style, sheets, xhtml, graphic design, w3c, web standards, visual, display" /><meta name="description" content="A demonstration of what can be accomplished visually through CSS-based design." /><meta name="robots" content="all" /><title>css Zen Garden: The Beauty in CSS Design</title><script type="text/javascript">var is={ie:navigator.appName=='Microsoft Internet Explorer',java:navigator.javaEnabled(),ns:navigator.appName=='Netscape',ua:navigator.userAgent.toLowerCase(),version:parseFloat(navigator.appVersion.substr(21))||parseFloat(navigator.appVersion),win:navigator.platform=='Win32'}
is.mac=is.ua.indexOf('mac')>=0;if(is.ua.indexOf('opera')>=0){is.ie=is.ns=false;is.opera=true;}
if(is.ua.indexOf('gecko')>=0){is.ie=is.ns=false;is.gecko=true;}</script><script type="text/javascript">/*<![CDATA[*/var i=0;while(++i<10)
{}/*]]>*/</script><script type="text/javascript">i=1;</script><script type="text/javascript">/*<![CDATA[*/(i<1);/*]]>*/</script><!--[if IE 6]><style type="text/css">/*<![CDATA[*//* copyright: you'll need CDATA for this -- < & */body{background:white}/*]]>*/</style><![endif]--><style type="text/css" title="currentStyle" media="screen">@import "/001/001.css";/*\*/css hack{}/**//*/*/css hack{}/**/css hack{display/**/:/**/none;display:none}</style><link
rel="Shortcut Icon"
type="image/x-icon"
href="http://www.csszengarden.com/favicon.ico" /><link
rel="alternate"
type="application/rss+xml"
title="RSS"
href="http://www.csszengarden.com/zengarden.xml" /></head><body id="css-zen-garden"><div id="container"><div id="pageHeader"><h1><span>css Zen Garden</span></h1><h2><span>The Beauty of <acronym title="Cascading Style Sheets">CSS</acronym> Design</span></h2></div><pre>
White space is important here!
</pre><div id="quickSummary"><p class="p1"><span>A demonstration of what can be accomplished visually through <acronym title="Cascading Style Sheets">CSS</acronym>-based design. Select any style sheet from the list to load it into this page.</span></p><p class="p2"><span>Download the sample <a href="/zengarden-sample.html" title="This page's source HTML code, not to be modified.">html file</a> and <a href="/zengarden-sample.css" title="This page's sample CSS, the file you may modify.">css file</a></span></p></div></div></body></html>

32
web/test/js/before.js Normal file
View File

@@ -0,0 +1,32 @@
// is.js
// (c) 2001 Douglas Crockford
// 2001 June 3
// is
// The -is- object is used to identify the browser. Every browser edition
// identifies itself, but there is no standard way of doing it, and some of
// the identification is deceptive. This is because the authors of web
// browsers are liars. For example, Microsoft's IE browsers claim to be
// Mozilla 4. Netscape 6 claims to be version 5.
var is = {
ie: navigator.appName == 'Microsoft Internet Explorer',
java: navigator.javaEnabled(),
ns: navigator.appName == 'Netscape',
ua: navigator.userAgent.toLowerCase(),
version: parseFloat(navigator.appVersion.substr(21)) ||
parseFloat(navigator.appVersion),
win: navigator.platform == 'Win32'
}
is.mac = is.ua.indexOf('mac') >= 0;
if (is.ua.indexOf('opera') >= 0) {
is.ie = is.ns = false;
is.opera = true;
}
if (is.ua.indexOf('gecko') >= 0) {
is.ie = is.ns = false;
is.gecko = true;
}

3
web/test/js/before.min.js vendored Normal file
View File

@@ -0,0 +1,3 @@
var is={ie:navigator.appName=='Microsoft Internet Explorer',java:navigator.javaEnabled(),ns:navigator.appName=='Netscape',ua:navigator.userAgent.toLowerCase(),version:parseFloat(navigator.appVersion.substr(21))||parseFloat(navigator.appVersion),win:navigator.platform=='Win32'}
is.mac=is.ua.indexOf('mac')>=0;if(is.ua.indexOf('opera')>=0){is.ie=is.ns=false;is.opera=true;}
if(is.ua.indexOf('gecko')>=0){is.ie=is.ns=false;is.gecko=true;}

View File

@@ -0,0 +1,168 @@
var MrClay = window.MrClay || {};
/**
* Simplified access to/manipulation of the query string
*
* Based on: http://adamv.com/dev/javascript/files/querystring.js
* Design pattern: http://www.litotes.demon.co.uk/js_info/private_static.html#wConst
*/
MrClay.QueryString = function(){
/**
* @static
* @private
*/
var parse = function(str) {
var assignments = str.split('&')
,obj = {}
,propValue;
for (var i = 0, l = assignments.length; i < l; ++i) {
propValue = assignments[i].split('=');
if (propValue.length > 2
|| -1 != propValue[0].indexOf('+')
|| propValue[0] == ''
) {
continue;
}
if (propValue.length == 1) {
propValue[1] = propValue[0];
}
obj[unescape(propValue[0])] = unescape(propValue[1].replace(/\+/g, ' '));
}
return obj;
};
/**
* Constructor (MrClay.QueryString becomes this)
*
* @param mixed A window object, a query string, or empty (default current window)
*/
function construct_(spec) {
spec = spec || window;
if (typeof spec == 'object') {
// get querystring from window
this.window = spec;
spec = spec.location.search.substr(1);
} else {
this.window = window;
}
this.vars = parse(spec);
}
/**
* Reload the window
*
* @static
* @public
* @param object vars Specify querystring vars only if you wish to replace them
* @param object window_ window to be reloaded (current window by default)
*/
construct_.reload = function(vars, window_) {
window_ = window_ || window;
vars = vars || (new MrClay.QueryString(window_)).vars;
var l = window_.location
,currUrl = l.href
,s = MrClay.QueryString.toString(vars)
,newUrl = l.protocol + '//' + l.hostname + l.pathname
+ (s ? '?' + s : '') + l.hash;
if (currUrl == newUrl) {
l.reload();
} else {
l.assign(newUrl);
}
};
/**
* Get the value of a querystring var
*
* @static
* @public
* @param string key
* @param mixed default_ value to return if key not found
* @param object window_ window to check (current window by default)
* @return mixed
*/
construct_.get = function(key, default_, window_) {
window_ = window_ || window;
return (new MrClay.QueryString(window_)).get(key, default_);
};
/**
* Reload the page setting one or multiple querystring vars
*
* @static
* @public
* @param mixed key object of query vars/values, or a string key for a single
* assignment
* @param mixed null for multiple settings, the value to assign for single
* @param object window_ window to reload (current window by default)
*/
construct_.set = function(key, value, window_) {
window_ = window_ || window;
(new MrClay.QueryString(window_)).set(key, value).reload();
};
/**
* Convert an object of query vars/values to a querystring
*
* @static
* @public
* @param object query vars/values
* @return string
*/
construct_.toString = function(vars) {
var pieces = [];
for (var prop in vars) {
pieces.push(escape(prop) + '=' + escape(vars[prop]));
}
return pieces.join('&');
};
/**
* @public
*/
construct_.prototype.reload = function() {
MrClay.QueryString.reload(this.vars, this.window);
return this;
};
/**
* @public
*/
construct_.prototype.get = function(key, default_) {
if (typeof default_ == 'undefined') {
default_ = null;
}
return (this.vars[key] == null)
? default_
: this.vars[key];
};
/**
* @public
*/
construct_.prototype.set = function(key, value) {
var obj = {};
if (typeof key == 'string') {
obj[key] = value;
} else {
obj = key;
}
for (var prop in obj) {
if (obj[prop] == null) {
delete this.vars[prop];
} else {
this.vars[prop] = obj[prop];
}
}
return this;
};
/**
* @public
*/
construct_.prototype.toString = function() {
return QueryString.toString(this.vars);
};
return construct_;
}(); // define and execute

24
web/test/minify/email.js Normal file
View File

@@ -0,0 +1,24 @@
// http://mrclay.org/
(function(){
var
reMailto = /^mailto:my_name_is_(\S+)_and_the_domain_is_(\S+)$/,
reRemoveTitleIf = /^my name is/,
oo = window.onload,
fixHrefs = function() {
var i = 0, l, m;
while (l = document.links[i++]) {
// require phrase in href property
if (m = l.href.match(reMailto)) {
l.href = 'mailto:' + m[1] + '@' + m[2];
if (reRemoveTitleIf.test(l.title)) {
l.title = '';
}
}
}
};
// end var
window.onload = function() {
oo && oo();
fixHrefs();
};
})();

32
web/test/packer/before.js Normal file
View File

@@ -0,0 +1,32 @@
// is.js
// (c) 2001 Douglas Crockford
// 2001 June 3
// is
// The -is- object is used to identify the browser. Every browser edition
// identifies itself, but there is no standard way of doing it, and some of
// the identification is deceptive. This is because the authors of web
// browsers are liars. For example, Microsoft's IE browsers claim to be
// Mozilla 4. Netscape 6 claims to be version 5.
var is = {
ie: navigator.appName == 'Microsoft Internet Explorer',
java: navigator.javaEnabled(),
ns: navigator.appName == 'Netscape',
ua: navigator.userAgent.toLowerCase(),
version: parseFloat(navigator.appVersion.substr(21)) ||
parseFloat(navigator.appVersion),
win: navigator.platform == 'Win32'
}
is.mac = is.ua.indexOf('mac') >= 0;
if (is.ua.indexOf('opera') >= 0) {
is.ie = is.ns = false;
is.opera = true;
}
if (is.ua.indexOf('gecko') >= 0) {
is.ie = is.ns = false;
is.gecko = true;
}

1
web/test/packer/before.min.js vendored Normal file
View File

@@ -0,0 +1 @@
eval(function(p,a,c,k,e,d){e=function(c){return c.toString(36)};if(!''.replace(/^/,String)){while(c--){d[c.toString(a)]=k[c]||c.toString(a)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('j 1={5:2.7==\'m k i\',g:2.h(),6:2.7==\'l\',3:2.u.s(),t:9(2.b.r(q))||9(2.b),n:2.o==\'p\'}1.a=1.3.4(\'a\')>=0;d(1.3.4(\'c\')>=0){1.5=1.6=e;1.c=8}d(1.3.4(\'f\')>=0){1.5=1.6=e;1.f=8}',31,31,'|is|navigator|ua|indexOf|ie|ns|appName|true|parseFloat|mac|appVersion|opera|if|false|gecko|java|javaEnabled|Explorer|var|Internet|Netscape|Microsoft|win|platform|Win32|21|substr|toLowerCase|version|userAgent'.split('|'),0,{}))

32
web/test/test_CSS.php Normal file
View File

@@ -0,0 +1,32 @@
<?php
require '_inc.php';
require 'Minify/CSS.php';
// build test file list
$d = dir(dirname(__FILE__) . '/css');
while (false !== ($entry = $d->read())) {
if (preg_match('/^([\w\\-]+)\.css$/', $entry, $m)) {
$list[] = $m[1];
}
}
$d->close();
foreach ($list as $item) {
$options = ($item === 'paths')
? array('prependRelativePath' => '../')
: array();
$src = file_get_contents($thisDir . '/css/' . $item . '.css');
$minExpected = file_get_contents($thisDir . '/css/' . $item . '.min.css');
$minOutput = Minify_CSS::minify($src, $options);
assertTrue($minExpected === $minOutput, 'Minify_CSS : ' . $item);
if ($minExpected !== $minOutput) {
echo "\n---Source\n\n{$src}";
echo "\n---Expected\n\n{$minExpected}";
echo "\n---Output\n\n{$minOutput}\n\n\n\n";
}
}

22
web/test/test_HTML.php Normal file
View File

@@ -0,0 +1,22 @@
<?php
require '_inc.php';
require 'Minify/HTML.php';
require 'Minify/CSS.php';
require 'Minify/Javascript.php';
$src = file_get_contents($thisDir . '/html/before.html');
$minExpected = file_get_contents($thisDir . '/html/before.min.html');
$minOutput = Minify_HTML::minify($src, array(
'cssMinifier' => array('Minify_CSS', 'minify')
,'jsMinifier' => array('Minify_Javascript', 'minify')
));
$passed = assertTrue($minExpected === $minOutput, 'Minify_HTML');
echo "\n---Output: " .strlen($minOutput). " bytes\n\n{$minOutput}";
if (! $passed) {
echo "\n\n\n\n---Expected: " .strlen($minExpected). " bytes\n\n{$minExpected}";
}
echo "\n\n---Source: " .strlen($src). " bytes\n\n{$src}";

View File

@@ -0,0 +1,16 @@
<?php
require '_inc.php';
require 'Minify/Javascript.php';
$src = file_get_contents($thisDir . '/js/before.js');
$minExpected = file_get_contents($thisDir . '/js/before.min.js');;
$minOutput = Minify_Javascript::minify($src);
$passed = assertTrue($minExpected == $minOutput, 'Minify_Javascript converts before.js to before.min.js');
echo "\n---Output: " .strlen($minOutput). " bytes\n\n{$minOutput}";
if (! $passed) {
echo "\n\n\n\n---Expected: " .strlen($minExpected). " bytes\n\n{$minExpected}";
}
echo "\n\n---Source: " .strlen($src). " bytes\n\n{$src}";

23
web/test/test_Minify.php Normal file
View File

@@ -0,0 +1,23 @@
<?php
require '_inc.php';
/**
* Note: All Minify classes are E_STRICT except for Cache_Lite_File.
*/
error_reporting(E_ALL);
require 'Minify.php';
// cache output files on filesystem
if ($minifyCachePath) {
Minify::useServerCache($minifyCachePath);
}
//Minify::$cacheUnencodedVersion = false;
// serve an array of files as one
Minify::serve('Files', array(
$thisDir . '/minify/email.js'
,$thisDir . '/minify/QueryString.js'
));

16
web/test/test_Packer.php Normal file
View File

@@ -0,0 +1,16 @@
<?php
require '_inc.php';
require 'Minify/Packer.php';
$src = file_get_contents($thisDir . '/packer/before.js');
$minExpected = file_get_contents($thisDir . '/packer/before.min.js');
$minOutput = Minify_Packer::minify($src);
$passed = assertTrue($minExpected === $minOutput, 'Minify_Packer');
echo "\n---Output: " .strlen($minOutput). " bytes\n\n{$minOutput}";
if (! $passed) {
echo "\n\n\n\n---Expected: " .strlen($minExpected). " bytes\n\n{$minExpected}";
}
echo "\n\n---Source: " .strlen($src). " bytes\n\n{$src}";