SECURITY Removed various PHP files from sapphire/thirdparty to reduce XSS attack surface (see r98027 and r98028)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@98029 467b73ca-7a2a-4603-9d3b-597d59a354a9
@ -1,86 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
|
||||
<title>Test for jQuery validate() plugin</title>
|
||||
<link rel="stylesheet" type="text/css" media="screen" href="css/screen.css" />
|
||||
<style type="text/css">
|
||||
.warning { color: red; }
|
||||
</style>
|
||||
<script src="../lib/jquery.js" type="text/javascript"></script>
|
||||
<script src="../lib/jquery.form.js" type="text/javascript"></script>
|
||||
<script src="../jquery.validate.js" type="text/javascript"></script>
|
||||
|
||||
<script src="js/cmxforms.js" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
jQuery(function() {
|
||||
// show a simple loading indicator
|
||||
var loader = jQuery('<div id="loader"><img src="images/loading.gif" alt="loading..." /></div>')
|
||||
.css({position: "relative", top: "1em", left: "25em"})
|
||||
.appendTo("body")
|
||||
.hide();
|
||||
jQuery().ajaxStart(function() {
|
||||
loader.show();
|
||||
}).ajaxStop(function() {
|
||||
loader.hide();
|
||||
}).ajaxError(function(a, b, e) {
|
||||
throw e;
|
||||
});
|
||||
|
||||
var v = jQuery("#form").validate({
|
||||
submitHandler: function(form) {
|
||||
jQuery(form).ajaxSubmit({
|
||||
target: "#result"
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
jQuery("#reset").click(function() {
|
||||
v.resetForm();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1 id="banner"><a href="http://bassistance.de/jquery-plugins/jquery-plugin-validation/">jQuery Validation Plugin</a> Demo</h1>
|
||||
<div id="main">
|
||||
|
||||
<form method="post" class="cmxform" id="form" action="form.php">
|
||||
<fieldset>
|
||||
<legend>Login Form (Enter "foobar" as password)</legend>
|
||||
<p>
|
||||
<label for="user">Username</label>
|
||||
<input id="user" name="user" title="Please enter your username (at least 3 characters)" class="required" minlength="3" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="pass">Password</label>
|
||||
<input type="password" name="password" id="password" class="required" minlength"5" />
|
||||
</p>
|
||||
<p>
|
||||
<input class="submit" type="submit" value="Login"/>
|
||||
</p>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
<div id="result">Please login!</div>
|
||||
|
||||
<br/>
|
||||
|
||||
<button id="reset">Programmatically reset above form!</button>
|
||||
|
||||
<p>Backend file: <a href="form.php">form.phps</a></p>
|
||||
|
||||
<a href="index.html">Back to main page</a>
|
||||
|
||||
</div>
|
||||
|
||||
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
_uacct = "UA-2623402-1";
|
||||
urchinTracker();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -1,27 +0,0 @@
|
||||
$(function(){
|
||||
$("#refreshimg").click(function(){
|
||||
$.post('newsession.php');
|
||||
$("#captchaimage").load('image_req.php');
|
||||
return false;
|
||||
});
|
||||
|
||||
$("#captchaform").validate({
|
||||
rules: {
|
||||
captcha: {
|
||||
required: true,
|
||||
remote: "process.php"
|
||||
}
|
||||
},
|
||||
messages: {
|
||||
captcha: "Correct captcha is required. Click the captcha to generate a new one"
|
||||
},
|
||||
submitHandler: function() {
|
||||
alert("Correct captcha!");
|
||||
},
|
||||
success: function(label) {
|
||||
label.addClass("valid").text("Valid captcha!")
|
||||
},
|
||||
onkeyup: false
|
||||
});
|
||||
|
||||
});
|
@ -1,6 +0,0 @@
|
||||
<?php
|
||||
|
||||
// Echo the image - timestamp appended to prevent caching
|
||||
echo '<a href="index.php" onclick="refreshimg(); return false;" title="Click to refresh image"><img src="images/image.jpg?' . time() . '" width="132" height="46" alt="Captcha image" /></a>';
|
||||
|
||||
?>
|
@ -1 +0,0 @@
|
||||
AddType application/x-httpd-php .jpg
|
Before Width: | Height: | Size: 1.5 KiB |
@ -1,35 +0,0 @@
|
||||
<?php
|
||||
|
||||
// Begin the session
|
||||
session_start();
|
||||
|
||||
// If the session is not present, set the variable to an error message
|
||||
if(!isset($_SESSION['captcha_id']))
|
||||
$str = 'ERROR!';
|
||||
// Else if it is present, set the variable to the session contents
|
||||
else
|
||||
$str = $_SESSION['captcha_id'];
|
||||
|
||||
// Set the content type
|
||||
//header('Content-type: image/png');
|
||||
header('Cache-control: no-cache');
|
||||
|
||||
// Create an image from button.png
|
||||
$image = imagecreatefrompng('button.png');
|
||||
|
||||
// Set the font colour
|
||||
$colour = imagecolorallocate($image, 183, 178, 152);
|
||||
|
||||
// Set the font
|
||||
$font = '../fonts/Anorexia.ttf';
|
||||
|
||||
// Set a random integer for the rotation between -15 and 15 degrees
|
||||
$rotate = rand(-15, 15);
|
||||
|
||||
// Create an image using our original image and adding the detail
|
||||
imagettftext($image, 14, $rotate, 18, 30, $colour, $font, $str);
|
||||
|
||||
// Output the image as a png
|
||||
imagepng($image);
|
||||
|
||||
?>
|
@ -1,66 +0,0 @@
|
||||
<?php
|
||||
|
||||
// Make the page validate
|
||||
ini_set('session.use_trans_sid', '0');
|
||||
|
||||
// Include the random string file
|
||||
require 'rand.php';
|
||||
|
||||
// Begin the session
|
||||
session_start();
|
||||
|
||||
// Set the session contents
|
||||
$_SESSION['captcha_id'] = $str;
|
||||
|
||||
?>
|
||||
<!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" lang="en">
|
||||
|
||||
<head>
|
||||
<title>AJAX CAPTCHA</title>
|
||||
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
|
||||
<meta name="keywords" content="AJAX,JHR,PHP,CAPTCHA,download,PHP CAPTCHA,AJAX CAPTCHA,AJAX PHP CAPTCHA,download AJAX CAPTCHA,download AJAX PHP CAPTCHA" />
|
||||
<meta name="description" content="An AJAX CAPTCHA script, written in PHP" />
|
||||
|
||||
<script type="text/javascript" src="../../lib/jquery.js"></script>
|
||||
<script type="text/javascript" src="../../jquery.validate.js"></script>
|
||||
<script type="text/javascript" src="captcha.js"></script>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="style.css" />
|
||||
<style type="text/css">
|
||||
img { border: 1px solid #eee; }
|
||||
p#statusgreen { font-size: 1.2em; background-color: #fff; color: #0a0; }
|
||||
p#statusred { font-size: 1.2em; background-color: #fff; color: #a00; }
|
||||
fieldset label { display: block; }
|
||||
fieldset div#captchaimage { float: left; margin-right: 15px; }
|
||||
fieldset input#captcha { width: 25%; border: 1px solid #ddd; padding: 2px; }
|
||||
fieldset input#submit { display: block; margin: 2% 0% 0% 0%; }
|
||||
#captcha.success {
|
||||
border: 1px solid #49c24f;
|
||||
background: #bcffbf;
|
||||
}
|
||||
#captcha.error {
|
||||
border: 1px solid #c24949;
|
||||
background: #ffbcbc;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1><acronym title="Asynchronous JavaScript And XML">AJAX</acronym> <acronym title="Completely Automated Public Turing test to tell Computers and Humans Apart">CAPTCHA</acronym>, based on <a href="http://psyrens.com/captcha/">http://psyrens.com/captcha/</a></h1>
|
||||
|
||||
<form id="captchaform" action="">
|
||||
<fieldset>
|
||||
<div id="captchaimage"><a href="<?php echo $_SERVER['PHP_SELF']; ?>" id="refreshimg" title="Click to refresh image"><img src="images/image.php?<?php echo time(); ?>" width="132" height="46" alt="Captcha image" /></a></div>
|
||||
<label for="captcha">Enter the characters as seen on the image above (case insensitive):</label>
|
||||
<input type="text" maxlength="6" name="captcha" id="captcha" />
|
||||
<input type="submit" name="submit" id="submit" value="Check" />
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
<p>If you can't decipher the text on the image, click it to dynamically generate a new one.</p>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
@ -1,12 +0,0 @@
|
||||
<?php
|
||||
|
||||
// Include the random string file
|
||||
require 'rand.php';
|
||||
|
||||
// Begin a new session
|
||||
session_start();
|
||||
|
||||
// Set the session contents
|
||||
$_SESSION['captcha_id'] = $str;
|
||||
|
||||
?>
|
@ -1,14 +0,0 @@
|
||||
<?php
|
||||
|
||||
// Begin the session
|
||||
session_start();
|
||||
|
||||
// To avoid case conflicts, make the input uppercase and check against the session value
|
||||
// If it's correct, echo '1' as a string
|
||||
if(strtoupper($_GET['captcha']) == $_SESSION['captcha_id'])
|
||||
echo 'true';
|
||||
// Else echo '0' as a string
|
||||
else
|
||||
echo 'false';
|
||||
|
||||
?>
|
11
thirdparty/jquery-validate/demo/captcha/rand.php
vendored
@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
// Create a random string, leaving out 'o' to avoid confusion with '0'
|
||||
$char = strtoupper(substr(str_shuffle('abcdefghjkmnpqrstuvwxyz'), 0, 4));
|
||||
|
||||
// Concatenate the random string onto the random numbers
|
||||
// The font 'Anorexia' doesn't have a character for '8', so the numbers will only go up to 7
|
||||
// '0' is left out to avoid confusion with 'O'
|
||||
$str = rand(1, 7) . rand(1, 7) . $char;
|
||||
|
||||
?>
|
140
thirdparty/jquery-validate/demo/captcha/style.css
vendored
@ -1,140 +0,0 @@
|
||||
body {
|
||||
margin: 3% 5%;
|
||||
padding: 0;
|
||||
background-color: #fff;
|
||||
color: #333;
|
||||
font: 0.9em/1.3 Helvetica, Arial, Verdana, Sans-serif;
|
||||
}
|
||||
|
||||
a:link, a:visited {
|
||||
background-color: #fff;
|
||||
color: #333;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
a:hover, a:focus, a:active {
|
||||
background-color: #ffb;
|
||||
color: #454545;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin: 2% 0%;
|
||||
padding: 1%;
|
||||
border-bottom: 1px solid #ddd;
|
||||
background-color: #f8f8f8;
|
||||
color: #666;
|
||||
font: normal 1.5em Helvetica, Arial, Verdana, Sans-serif;
|
||||
}
|
||||
|
||||
h2 {
|
||||
margin: 2% 0%;
|
||||
padding: 1%;
|
||||
border-bottom: 1px solid #ddd;
|
||||
background-color: #f8f8f8;
|
||||
color: #666;
|
||||
font: normal 1.3em Helvetica, Arial, Verdana, Sans-serif;
|
||||
}
|
||||
|
||||
h3 {
|
||||
margin: 2% 0%;
|
||||
padding: 1%;
|
||||
border-bottom: 1px solid #ddd;
|
||||
background-color: #f8f8f8;
|
||||
color: #666;
|
||||
font: normal 1.2em Helvetica, Arial, Verdana, Sans-serif;
|
||||
}
|
||||
|
||||
table {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
table th {
|
||||
border: 1px solid #ddd;
|
||||
font-weight: bold;
|
||||
text-align: left;
|
||||
padding: 1%;
|
||||
}
|
||||
|
||||
table td {
|
||||
border: 1px solid #ddd;
|
||||
padding: 1%;
|
||||
}
|
||||
|
||||
dl, dt, dd {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
form {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
fieldset {
|
||||
border: 1px solid #ddd;
|
||||
margin: 0% 0% 2% 0%;
|
||||
padding: 2%;
|
||||
}
|
||||
|
||||
fieldset legend {
|
||||
margin: 0;
|
||||
padding: 0 4px;
|
||||
background-color: inherit;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
code {
|
||||
font: 1em "Courier New", Courier, Monospace;
|
||||
}
|
||||
|
||||
pre code {
|
||||
font: 1.1em "Courier New", Courier, Monospace;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
|
||||
img {
|
||||
border: 1px solid #eee;
|
||||
}
|
||||
|
||||
p#statusgreen {
|
||||
font-size: 1.2em;
|
||||
background-color: #fff;
|
||||
color: #0a0;
|
||||
}
|
||||
|
||||
p#statusred {
|
||||
font-size: 1.2em;
|
||||
background-color: #fff;
|
||||
color: #a00;
|
||||
}
|
||||
|
||||
fieldset label {
|
||||
display: block;
|
||||
}
|
||||
|
||||
fieldset label.error {
|
||||
color: red;
|
||||
}
|
||||
|
||||
fieldset label.valid {
|
||||
color: green;
|
||||
}
|
||||
|
||||
fieldset div#captchaimage {
|
||||
float: left;
|
||||
margin-right: 15px;
|
||||
}
|
||||
|
||||
fieldset input#captcha {
|
||||
width: 25%;
|
||||
border: 1px solid #ddd;
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
fieldset input#submit {
|
||||
display: block;
|
||||
margin: 2% 0% 0% 0%;
|
||||
}
|
15
thirdparty/jquery-validate/demo/css/chili.css
vendored
@ -1,15 +0,0 @@
|
||||
.jscom, .mix htcom { color: #4040c2; }
|
||||
.com { color: green; }
|
||||
.regexp { color: maroon; }
|
||||
.string { color: teal; }
|
||||
.keywords { color: blue; }
|
||||
.global { color: #008; }
|
||||
.numbers { color: #880; }
|
||||
.comm { color: green; }
|
||||
.tag { color: blue; }
|
||||
.entity { color: blue; }
|
||||
.string { color: teal; }
|
||||
.aname { color: maroon; }
|
||||
.avalue { color: maroon; }
|
||||
.jquery { color: #00a; }
|
||||
.plugin { color: red; }
|
46
thirdparty/jquery-validate/demo/css/cmxform.css
vendored
@ -1,46 +0,0 @@
|
||||
/**********************************
|
||||
|
||||
Name: cmxform Styles
|
||||
|
||||
***********************************/
|
||||
form.cmxform {
|
||||
width: 370px;
|
||||
font-size: 1.0em;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
form.cmxform legend {
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
form.cmxform legend, form.cmxform label {
|
||||
color: #333;
|
||||
}
|
||||
|
||||
form.cmxform fieldset {
|
||||
border: none;
|
||||
border-top: 1px solid #C9DCA6;
|
||||
background: url(../images/cmxform-fieldset.gif) left bottom repeat-x;
|
||||
background-color: #F8FDEF;
|
||||
}
|
||||
|
||||
form.cmxform fieldset fieldset {
|
||||
background: none;
|
||||
}
|
||||
|
||||
form.cmxform fieldset p, form.cmxform fieldset fieldset {
|
||||
padding: 5px 10px 7px;
|
||||
background: url(../images/cmxform-divider.gif) left bottom repeat-x;
|
||||
}
|
||||
|
||||
form.cmxform label.error, label.error {
|
||||
/* remove the next line when you have trouble in IE6 with labels in list */
|
||||
color: red;
|
||||
font-style: italic
|
||||
}
|
||||
div.error { display: none; }
|
||||
input { border: 1px solid black; }
|
||||
input.checkbox { border: none }
|
||||
input:focus { border: 1px dotted black; }
|
||||
input.error { border: 1px dotted red; }
|
||||
form.cmxform .gray * { color: gray; }
|
@ -1,55 +0,0 @@
|
||||
/**********************************
|
||||
|
||||
Use: cmxform template
|
||||
|
||||
***********************************/
|
||||
form.cmxform fieldset {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
form.cmxform legend {
|
||||
padding: 0 2px;
|
||||
font-weight: bold;
|
||||
_margin: 0 -7px; /* IE Win */
|
||||
}
|
||||
|
||||
form.cmxform label {
|
||||
display: inline-block;
|
||||
line-height: 1.8;
|
||||
vertical-align: top;
|
||||
cursor: hand;
|
||||
}
|
||||
|
||||
form.cmxform fieldset p {
|
||||
list-style: none;
|
||||
padding: 5px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
form.cmxform fieldset fieldset {
|
||||
border: none;
|
||||
margin: 3px 0 0;
|
||||
}
|
||||
|
||||
form.cmxform fieldset fieldset legend {
|
||||
padding: 0 0 5px;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
form.cmxform fieldset fieldset label {
|
||||
display: block;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
form.cmxform label { width: 100px; } /* Width of labels */
|
||||
form.cmxform fieldset fieldset label { margin-left: 103px; } /* Width plus 3 (html space) */
|
||||
form.cmxform label.error {
|
||||
margin-left: 103px;
|
||||
width: 220px;
|
||||
}
|
||||
|
||||
form.cmxform input.submit {
|
||||
margin-left: 103px;
|
||||
}
|
||||
|
||||
/*\*//*/ form.cmxform legend { display: inline-block; } /* IE Mac legend fix */
|
21
thirdparty/jquery-validate/demo/css/core.css
vendored
@ -1,21 +0,0 @@
|
||||
body, div { font-family: 'lucida grande', helvetica, verdana, arial, sans-serif }
|
||||
body { margin: 0; padding: 0; font-size: small; color: #333 }
|
||||
h1, h2 { font-family: 'trebuchet ms', verdana, arial; padding: 10px; margin: 0 }
|
||||
h1 { font-size: large }
|
||||
#main { padding: 1em; }
|
||||
#banner { padding: 15px; background-color: #06b; color: white; font-size: large; border-bottom: 1px solid #ccc;
|
||||
background: url(../images/bg.gif) repeat-x; text-align: center }
|
||||
#banner a { color: white; }
|
||||
|
||||
p { margin: 10px 0; }
|
||||
|
||||
li { margin-left: 10px; }
|
||||
|
||||
h3 { margin: 1em 0 0; }
|
||||
|
||||
h1 { font-size: 2em; }
|
||||
h2 { font-size: 1.8em; }
|
||||
h3 { font-size: 1.6em; }
|
||||
h4 { font-size: 1.4em; }
|
||||
h5 { font-size: 1.2em; }
|
||||
|
61
thirdparty/jquery-validate/demo/css/reset.css
vendored
@ -1,61 +0,0 @@
|
||||
/**********************************
|
||||
|
||||
Use: Reset Styles for all browsers
|
||||
|
||||
***********************************/
|
||||
|
||||
body, p, blockquote {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
a img, iframe { border: none; }
|
||||
|
||||
/* Headers
|
||||
------------------------------*/
|
||||
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-size: 100%;
|
||||
}
|
||||
|
||||
/* Lists
|
||||
------------------------------*/
|
||||
|
||||
ul, ol, dl, li, dt, dd {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* Links
|
||||
------------------------------*/
|
||||
|
||||
a, a:link {}
|
||||
a:visited {}
|
||||
a:hover {}
|
||||
a:active {}
|
||||
|
||||
/* Forms
|
||||
------------------------------*/
|
||||
|
||||
form, fieldset {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
fieldset { border: 1px solid #000; }
|
||||
|
||||
legend {
|
||||
padding: 0;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
input, textarea, select {
|
||||
margin: 0;
|
||||
padding: 1px;
|
||||
font-size: 100%;
|
||||
font-family: inherit;
|
||||
}
|
||||
|
||||
select { padding: 0; }
|
11
thirdparty/jquery-validate/demo/css/screen.css
vendored
@ -1,11 +0,0 @@
|
||||
/**********************************
|
||||
|
||||
Use: Main Screen Import
|
||||
|
||||
***********************************/
|
||||
|
||||
@import "reset.css";
|
||||
@import "core.css";
|
||||
|
||||
@import "cmxformTemplate.css";
|
||||
@import "cmxform.css";
|
@ -1,95 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
|
||||
<title>jQuery validation plug-in - comment form example</title>
|
||||
|
||||
<link rel="stylesheet" type="text/css" media="screen" href="css/screen.css" />
|
||||
|
||||
<script src="../lib/jquery.js" type="text/javascript"></script>
|
||||
<script src="../jquery.validate.js" type="text/javascript"></script>
|
||||
<script src="../lib/jquery.metadata.js" type="text/javascript"></script>
|
||||
|
||||
<!-- for styling the form -->
|
||||
<script src="js/cmxforms.js" type="text/javascript"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$("#commentForm").validate({meta: "validate"});
|
||||
$("#commentForm2").validate();
|
||||
$("#commentForm3").validate({
|
||||
messages: {
|
||||
email: {
|
||||
required: 'Enter this!'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
<style type="text/css">
|
||||
form { width: 500px; }
|
||||
form label { width: 250px; }
|
||||
form label.error,
|
||||
form input.submit { margin-left: 253px; }
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1 id="banner"><a href="http://bassistance.de/jquery-plugins/jquery-plugin-validation/">jQuery Validation Plugin</a> Demo</h1>
|
||||
<div id="main">
|
||||
|
||||
<p>Take a look at the source to see how messages can be customized with metadata.</p>
|
||||
|
||||
<!-- Custom messages with custom "meta" setting -->
|
||||
<form class="cmxform" id="commentForm" method="post" action="">
|
||||
<fieldset>
|
||||
<legend>Please enter your email address</legend>
|
||||
<p>
|
||||
|
||||
<label for="cemail">E-Mail *</label>
|
||||
<input id="cemail" name="email" class="{validate:{required:true, email:true, messages:{required:'Please enter your email address', email:'Please enter a valid email address'}}}"/>
|
||||
</p>
|
||||
<p>
|
||||
<input class="submit" type="submit" value="Submit"/>
|
||||
</p>
|
||||
</fieldset>
|
||||
</form>
|
||||
<!-- Custom messages with default "meta" setting -->
|
||||
<form class="cmxform" id="commentForm2" method="post" action="">
|
||||
<fieldset>
|
||||
<legend>Please enter your email address</legend>
|
||||
<p>
|
||||
|
||||
<label for="cemail">E-Mail *</label>
|
||||
<input id="cemail" name="email" class="{required:true, email:true, messages:{required:'Please enter your email address', email:'Please enter a valid email address'}}"/>
|
||||
</p>
|
||||
<p>
|
||||
<input class="submit" type="submit" value="Submit"/>
|
||||
</p>
|
||||
</fieldset>
|
||||
</form>
|
||||
<!-- Custom message for "required" in metadata is overriden by a validate option -->
|
||||
<form class="cmxform" id="commentForm3" method="post" action="">
|
||||
<fieldset>
|
||||
<legend>Please enter your email address</legend>
|
||||
<p>
|
||||
|
||||
<label for="cemail">E-Mail *</label>
|
||||
<input id="cemail" name="email" class="{required:true, email:true, messages:{email:'Please enter a valid email address'}}"/>
|
||||
</p>
|
||||
<p>
|
||||
<input class="submit" type="submit" value="Submit"/>
|
||||
</p>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
<a href="index.html">Back to main page</a>
|
||||
|
||||
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>
|
||||
<script type="text/javascript">_uacct = "UA-2623402-1";urchinTracker();</script>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,123 +0,0 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
|
||||
<title>Test for jQuery validate() plugin</title>
|
||||
|
||||
<link rel="stylesheet" type="text/css" media="screen" href="css/screen.css" />
|
||||
|
||||
<script src="../lib/jquery.js" type="text/javascript"></script>
|
||||
<script src="../jquery.validate.js" type="text/javascript"></script>
|
||||
|
||||
<script src="js/cmxforms.js" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
// extend the current rules with new groovy ones
|
||||
|
||||
// this one requires the text "buga", we define a default message, too
|
||||
$.validator.addMethod("buga", function(value) {
|
||||
return value == "buga";
|
||||
}, 'Please enter "buga"!');
|
||||
|
||||
// this one requires the value to be the same as the first parameter
|
||||
$.validator.methods.equal = function(value, element, param) {
|
||||
return value == param;
|
||||
};
|
||||
|
||||
$().ready(function() {
|
||||
var validator = $("#texttests").bind("invalid-form.validate", function() {
|
||||
$("#summary").html("Your form contains " + validator.numberOfInvalids() + " errors, see details below.");
|
||||
}).validate({
|
||||
debug: true,
|
||||
errorElement: "em",
|
||||
errorContainer: $("#warning, #summary"),
|
||||
errorPlacement: function(error, element) {
|
||||
error.appendTo( element.parent("td").next("td") );
|
||||
},
|
||||
success: function(label) {
|
||||
label.text("ok!").addClass("success");
|
||||
},
|
||||
rules: {
|
||||
number: {
|
||||
required:true,
|
||||
minLength:3,
|
||||
maxLength:15,
|
||||
number:true
|
||||
},
|
||||
secret: "buga",
|
||||
math: {
|
||||
equal: 11
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
<style type="text/css">
|
||||
form.cmxform { width: 50em; }
|
||||
em.error {
|
||||
background:url("images/unchecked.gif") no-repeat 0px 0px;
|
||||
padding-left: 16px;
|
||||
}
|
||||
em.success {
|
||||
background:url("images/checked.gif") no-repeat 0px 0px;
|
||||
padding-left: 16px;
|
||||
}
|
||||
|
||||
form.cmxform label.error {
|
||||
margin-left: auto;
|
||||
width: 250px;
|
||||
}
|
||||
em.error { color: black; }
|
||||
#warning { display: none; }
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1 id="banner"><a href="http://bassistance.de/jquery-plugins/jquery-plugin-validation/">jQuery Validation Plugin</a> Demo</h1>
|
||||
<div id="main">
|
||||
|
||||
<form class="cmxform" id="texttests" method="get" action="foo.html">
|
||||
<h2 id="summary"></h2>
|
||||
|
||||
<fieldset>
|
||||
<legend>Example with custom methods and heavily customized error display</legend>
|
||||
<table>
|
||||
<tr>
|
||||
<td><label for="number">textarea</label></td>
|
||||
<td><input id="number" name="number"
|
||||
title="Please enter a number with at least 3 and max 15 characters!" />
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="secret">Secret</label></td>
|
||||
<td><input name="secret" id="secret" /></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="math">7 + 4 = </label></td>
|
||||
<td><input id="math" name="math" title="Please enter the correct result!" /></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
<input class="submit" type="submit" value="Submit"/>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
<h3 id="warning">Your form contains tons of errors! Please try again.</h3>
|
||||
|
||||
<p><a href="index.html">Back to main page</a></p>
|
||||
|
||||
</div>
|
||||
|
||||
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
_uacct = "UA-2623402-1";
|
||||
urchinTracker();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
151
thirdparty/jquery-validate/demo/dynamic-totals.html
vendored
@ -1,151 +0,0 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
|
||||
<title>jQuery validation plug-in - dynamic forms demo</title>
|
||||
|
||||
<link rel="stylesheet" type="text/css" media="screen" href="css/screen.css" />
|
||||
|
||||
<script src="../lib/jquery.js" type="text/javascript"></script>
|
||||
<script src="../jquery.validate.js" type="text/javascript"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
// only for demo purposes
|
||||
$.validator.setDefaults({
|
||||
submitHandler: function() {
|
||||
alert("submitted!");
|
||||
}
|
||||
});
|
||||
$.validator.messages.max = jQuery.format("Your totals musn't exceed {0}!");
|
||||
|
||||
$.validator.addMethod("quantity", function(value, element) {
|
||||
return !this.optional(element) && !this.optional($(element).parent().prev().children("select")[0]);
|
||||
}, "Please select both the item and its amount.");
|
||||
|
||||
$().ready(function() {
|
||||
$("#orderform").validate({
|
||||
errorPlacement: function(error, element) {
|
||||
error.appendTo( element.parent().next() );
|
||||
},
|
||||
highlight: function(element, errorClass) {
|
||||
$(element).addClass(errorClass).parent().prev().children("select").addClass(errorClass);
|
||||
}
|
||||
});
|
||||
|
||||
var template = jQuery.format($("#template").val());
|
||||
function addRow() {
|
||||
$(template(i++)).appendTo("#orderitems tbody");
|
||||
}
|
||||
|
||||
var i = 1;
|
||||
// start with one row
|
||||
addRow();
|
||||
// add more rows on click
|
||||
$("#add").click(addRow);
|
||||
|
||||
// check keyup on quantity inputs to update totals field
|
||||
$("#orderform").delegate("keyup", "input.quantity", function(event) {
|
||||
var totals = 0;
|
||||
$("#orderitems input.quantity").each(function() {
|
||||
totals += +this.value;
|
||||
});
|
||||
$("#totals").attr("value", totals).valid();
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
<style type="text/css">
|
||||
form.cmxform { width: 50em; }
|
||||
em.error {
|
||||
background:url("images/unchecked.gif") no-repeat 0px 0px;
|
||||
padding-left: 16px;
|
||||
}
|
||||
em.success {
|
||||
background:url("images/checked.gif") no-repeat 0px 0px;
|
||||
padding-left: 16px;
|
||||
}
|
||||
|
||||
form.cmxform label.error {
|
||||
margin-left: auto;
|
||||
width: 250px;
|
||||
}
|
||||
form.cmxform input.submit {
|
||||
margin-left: 0;
|
||||
}
|
||||
em.error { color: black; }
|
||||
#warning { display: none; }
|
||||
select.error {
|
||||
border: 1px dotted red;
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1 id="banner"><a href="http://bassistance.de/jquery-plugins/jquery-plugin-validation/">jQuery Validation Plugin</a> Demo</h1>
|
||||
<div id="main">
|
||||
|
||||
<textarea style="display:none" id="template">
|
||||
<tr>
|
||||
<td>
|
||||
<label>{0}. Item</label>
|
||||
</td>
|
||||
<td class='type'>
|
||||
<select name="item-type-{0}">
|
||||
<option value="">Select...</option>
|
||||
<option value="0">Learning jQuery</option>
|
||||
<option value="1">jQuery Reference Guide</option>
|
||||
<option value="2">jQuery Cookbook</option>
|
||||
<option vlaue="3">jQuery In Action</option>
|
||||
<option value="4">jQuery For Designers</option>
|
||||
</select>
|
||||
</td>
|
||||
<td class='quantity'>
|
||||
<input size='4' class="quantity" min="1" id="item-quantity-{0}" name="item-quantity-{0}" />
|
||||
</td>
|
||||
<td class='quantity-error'></td>
|
||||
</tr>
|
||||
</textarea>
|
||||
|
||||
<form id="orderform" class="cmxform" method="get" action="foo.html">
|
||||
<h2 id="summary"></h2>
|
||||
|
||||
<fieldset>
|
||||
<legend>Example with custom methods and heavily customized error display</legend>
|
||||
<table id="orderitems">
|
||||
<tbody>
|
||||
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="2"><label>Totals (max 25)</label></td>
|
||||
<td class="totals"><input id="totals" name="totals" value="0" max="25" readonly="readonly" size='4' /></td>
|
||||
<td class="totals-error"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"> </td>
|
||||
<td><input class="submit" type="submit" value="Submit"/></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
<button id="add">Add another input to the form</button>
|
||||
|
||||
<h1 id="warning">Your form contains tons of errors! Please try again.</h1>
|
||||
|
||||
<p><a href="index.html">Back to main page</a></p>
|
||||
|
||||
</div>
|
||||
|
||||
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
_uacct = "UA-2623402-1";
|
||||
urchinTracker();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -1,162 +0,0 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
|
||||
<title>Test for jQuery validate() plugin</title>
|
||||
|
||||
<link rel="stylesheet" type="text/css" media="screen" href="css/screen.css" />
|
||||
|
||||
<script src="../lib/jquery.js" type="text/javascript"></script>
|
||||
<script src="../lib/jquery.metadata.js" type="text/javascript"></script>
|
||||
<script src="../jquery.validate.js" type="text/javascript"></script>
|
||||
|
||||
<script src="js/cmxforms.js" type="text/javascript"></script>
|
||||
<style type="text/css">
|
||||
.cmxform fieldset p.error label { color: red; }
|
||||
div.container {
|
||||
background-color: #eee;
|
||||
border: 1px solid red;
|
||||
margin: 5px;
|
||||
padding: 5px;
|
||||
}
|
||||
div.container ol li {
|
||||
list-style-type: disc;
|
||||
margin-left: 20px;
|
||||
}
|
||||
div.container { display: none }
|
||||
.container label.error {
|
||||
display: inline;
|
||||
}
|
||||
form.cmxform { width: 30em; }
|
||||
form.cmxform label.error {
|
||||
display: block;
|
||||
margin-left: 1em;
|
||||
width: auto;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script type="text/javascript">
|
||||
// only for demo purposes
|
||||
$.validator.setDefaults({
|
||||
submitHandler: function() {
|
||||
alert("submitted! (skipping validation for cancel button)");
|
||||
}
|
||||
});
|
||||
|
||||
$().ready(function() {
|
||||
$("#form1").validate({
|
||||
errorLabelContainer: $("#form1 div.error")
|
||||
});
|
||||
|
||||
var container = $('div.container');
|
||||
// validate the form when it is submitted
|
||||
var validator = $("#form2").validate({
|
||||
errorContainer: container,
|
||||
errorLabelContainer: $("ol", container),
|
||||
wrapper: 'li',
|
||||
meta: "validate"
|
||||
});
|
||||
|
||||
$(".cancel").click(function() {
|
||||
validator.resetForm();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1 id="banner"><a href="http://bassistance.de/jquery-plugins/jquery-plugin-validation/">jQuery Validation Plugin</a> Demo</h1>
|
||||
<div id="main">
|
||||
|
||||
<form method="get" class="cmxform" id="form1" action="">
|
||||
<fieldset>
|
||||
<legend>Login Form</legend>
|
||||
<p>
|
||||
<label>Username</label>
|
||||
<input name="user" title="Please enter your username (at least 3 characters)" class="{required:true,minlength:3}" />
|
||||
</p>
|
||||
<p>
|
||||
<label>Password</label>
|
||||
<input type="password" maxlength="12" name="password" title="Please enter your password, between 5 and 12 characters" class="{required:true,minlength:5}" />
|
||||
</p>
|
||||
<div class="error">
|
||||
</div>
|
||||
<p>
|
||||
<input class="submit" type="submit" value="Login"/>
|
||||
</p>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
<!-- our error container -->
|
||||
<div class="container">
|
||||
<h4>There are serious errors in your form submission, please see below for details.</h4>
|
||||
<ol>
|
||||
<li><label for="email" class="error">Please enter your email address</label></li>
|
||||
<li><label for="phone" class="error">Please enter your phone <b>number</b> (between 2 and 8 characters)</label></li>
|
||||
<li><label for="address" class="error">Please enter your address (at least 3 characters)</label></li>
|
||||
<li><label for="avatar" class="error">Please select an image (png, jpg, jpeg, gif)</label></li>
|
||||
<li><label for="cv" class="error">Please select a document (doc, docx, txt, pdf)</label></li>
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
<form class="cmxform" id="form2" method="get" action="">
|
||||
<fieldset>
|
||||
<legend>Validating a complete form</legend>
|
||||
<p>
|
||||
<label for="email">Email</label>
|
||||
<input id="email" name="email" class="{validate:{required:true,email:true}}" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="agree">Favorite Color</label>
|
||||
<select id="color" name="color" title="Please select your favorite color!" class="{validate:{required:true}}">
|
||||
<option></option>
|
||||
<option>Red</option>
|
||||
<option>Blue</option>
|
||||
<option>Yellow</option>
|
||||
</select>
|
||||
</p>
|
||||
<p>
|
||||
<label for="phone">Phone</label>
|
||||
<input id="phone" name="phone" class="some styles {validate:{required:true,number:true, rangelength:[2,8]}}" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="address">Address</label>
|
||||
<input id="address" name="address" class="some other styles {validate:{required:true,minlength:3}}" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="avatar">Avatar</label>
|
||||
<input type="file" id="avatar" name="avatar" class="{validate:{required:true,accept:true}}" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="agree">Please agree to our policy</label>
|
||||
<input type="checkbox" class="checkbox" id="agree" title="Please agree to our policy!" name="agree" class="{validate:{required:true}}" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="cv">CV</label>
|
||||
<input type="file" id="cv" name="cv" class="{validate:{required:true,accept:'docx?|txt|pdf'}}" />
|
||||
</p>
|
||||
<p>
|
||||
<input class="submit" type="submit" value="Submit"/>
|
||||
<input class="cancel" type="submit" value="Cancel"/>
|
||||
</p>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
<div class="container">
|
||||
<h4>There are serious errors in your form submission, please see details above the form!</h4>
|
||||
</div>
|
||||
|
||||
<a href="index.html">Back to main page</a>
|
||||
|
||||
</div>
|
||||
|
||||
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
_uacct = "UA-2623402-1";
|
||||
urchinTracker();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
55
thirdparty/jquery-validate/demo/example.html
vendored
@ -1,55 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
|
||||
<title>jQuery validation plug-in - comment form example</title>
|
||||
|
||||
<link rel="stylesheet" type="text/css" media="screen" href="css/screen.css" />
|
||||
|
||||
<script src="../lib/jquery.js" type="text/javascript"></script>
|
||||
<script src="../jquery.validate.js" type="text/javascript"></script>
|
||||
|
||||
<!-- for styling the form -->
|
||||
<script src="js/cmxforms.js" type="text/javascript"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$("#commentForm").validate();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style type="text/css">
|
||||
#commentForm { width: 500px; }
|
||||
#commentForm label { width: 250px; }
|
||||
#commentForm label.error, #commentForm input.submit { margin-left: 253px; }
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<form class="cmxform" id="commentForm" method="post" action="">
|
||||
<fieldset>
|
||||
<legend>Please provide your name, email address (won't be published) and a comment</legend>
|
||||
<p>
|
||||
<label for="cname">Name (required, at least 2 characters)</label>
|
||||
<input id="cname" name="name" class="required" minlength="2" />
|
||||
<p>
|
||||
<label for="cemail">E-Mail (required)</label>
|
||||
<input id="cemail" name="email" class="required email" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="curl">URL (optional)</label>
|
||||
<input id="curl" name="url" class="url" value="" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="ccomment">Your comment (required)</label>
|
||||
<textarea id="ccomment" name="comment" class="required"></textarea>
|
||||
</p>
|
||||
<p>
|
||||
<input class="submit" type="submit" value="Submit"/>
|
||||
</p>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
</body>
|
||||
</html>
|
10
thirdparty/jquery-validate/demo/form.php
vendored
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
// wait a second to simulate a some latency
|
||||
usleep(500000);
|
||||
$user = $_REQUEST['user'];
|
||||
$pw = $_REQUEST['password'];
|
||||
if($user && $pw && $pw == "foobar")
|
||||
echo "Hi $user, welcome back.";
|
||||
else
|
||||
echo "Your password is wrong (must be foobar).";
|
||||
?>
|
10
thirdparty/jquery-validate/demo/form.phps
vendored
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
// wait a second to simulate a some latency
|
||||
usleep(500000);
|
||||
$user = $_REQUEST['user'];
|
||||
$pw = $_REQUEST['password'];
|
||||
if($user && $pw && $pw == "foobar")
|
||||
echo "Hi $user, welcome back.";
|
||||
else
|
||||
echo "Your password is wrong (must be foobar).";
|
||||
?>
|
BIN
thirdparty/jquery-validate/demo/images/bg.gif
vendored
Before Width: | Height: | Size: 1.1 KiB |
BIN
thirdparty/jquery-validate/demo/images/checked.gif
vendored
Before Width: | Height: | Size: 220 B |
Before Width: | Height: | Size: 43 B |
Before Width: | Height: | Size: 314 B |
BIN
thirdparty/jquery-validate/demo/images/loading.gif
vendored
Before Width: | Height: | Size: 418 B |
BIN
thirdparty/jquery-validate/demo/images/unchecked.gif
vendored
Before Width: | Height: | Size: 223 B |
235
thirdparty/jquery-validate/demo/index.html
vendored
@ -1,235 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
|
||||
<title>jQuery validation plug-in - main demo</title>
|
||||
|
||||
<link rel="stylesheet" type="text/css" media="screen" href="css/screen.css" />
|
||||
|
||||
<script src="../lib/jquery.js" type="text/javascript"></script>
|
||||
<script src="../jquery.validate.js" type="text/javascript"></script>
|
||||
|
||||
<script src="js/cmxforms.js" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
$.validator.setDefaults({
|
||||
submitHandler: function() { alert("submitted!"); }
|
||||
});
|
||||
|
||||
$().ready(function() {
|
||||
// validate the comment form when it is submitted
|
||||
$("#commentForm").validate();
|
||||
|
||||
// validate signup form on keyup and submit
|
||||
$("#signupForm").validate({
|
||||
rules: {
|
||||
firstname: "required",
|
||||
lastname: "required",
|
||||
username: {
|
||||
required: true,
|
||||
minlength: 2
|
||||
},
|
||||
password: {
|
||||
required: true,
|
||||
minlength: 5
|
||||
},
|
||||
confirm_password: {
|
||||
required: true,
|
||||
minlength: 5,
|
||||
equalTo: "#password"
|
||||
},
|
||||
email: {
|
||||
required: true,
|
||||
email: true
|
||||
},
|
||||
topic: {
|
||||
required: "#newsletter:checked",
|
||||
minlength: 2
|
||||
},
|
||||
agree: "required"
|
||||
},
|
||||
messages: {
|
||||
firstname: "Please enter your firstname",
|
||||
lastname: "Please enter your lastname",
|
||||
username: {
|
||||
required: "Please enter a username",
|
||||
minlength: "Your username must consist of at least 2 characters"
|
||||
},
|
||||
password: {
|
||||
required: "Please provide a password",
|
||||
minlength: "Your password must be at least 5 characters long"
|
||||
},
|
||||
confirm_password: {
|
||||
required: "Please provide a password",
|
||||
minlength: "Your password must be at least 5 characters long",
|
||||
equalTo: "Please enter the same password as above"
|
||||
},
|
||||
email: "Please enter a valid email address",
|
||||
agree: "Please accept our policy"
|
||||
}
|
||||
});
|
||||
|
||||
// propose username by combining first- and lastname
|
||||
$("#username").focus(function() {
|
||||
var firstname = $("#firstname").val();
|
||||
var lastname = $("#lastname").val();
|
||||
if(firstname && lastname && !this.value) {
|
||||
this.value = firstname + "." + lastname;
|
||||
}
|
||||
});
|
||||
|
||||
// check if confirm password is still valid after password changed
|
||||
$("#password").blur(function() {
|
||||
$("#confirm_password").valid();
|
||||
});
|
||||
|
||||
//code to hide topic selection, disable for demo
|
||||
var newsletter = $("#newsletter");
|
||||
// newsletter topics are optional, hide at first
|
||||
var inital = newsletter.is(":checked");
|
||||
var topics = $("#newsletter_topics")[inital ? "removeClass" : "addClass"]("gray");
|
||||
var topicInputs = topics.find("input").attr("disabled", !inital);
|
||||
// show when newsletter is checked
|
||||
newsletter.click(function() {
|
||||
topics[this.checked ? "removeClass" : "addClass"]("gray");
|
||||
topicInputs.attr("disabled", !this.checked);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<style type="text/css">
|
||||
#commentForm { width: 500px; }
|
||||
#commentForm label { width: 250px; }
|
||||
#commentForm label.error, #commentForm input.submit { margin-left: 253px; }
|
||||
#signupForm { width: 670px; }
|
||||
#signupForm label.error {
|
||||
margin-left: 10px;
|
||||
width: auto;
|
||||
display: inline;
|
||||
}
|
||||
#newsletter_topics label.error {
|
||||
display: none;
|
||||
margin-left: 103px;
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1 id="banner"><a href="http://bassistance.de/jquery-plugins/jquery-plugin-validation/">jQuery Validation Plugin</a> Demo</h1>
|
||||
<div id="main">
|
||||
|
||||
<p>Default submitHandler is set to display an alert into of submitting the form</p>
|
||||
|
||||
<form class="cmxform" id="commentForm" method="get" action="">
|
||||
<fieldset>
|
||||
<legend>Please provide your name, email address (won't be published) and a comment</legend>
|
||||
<p>
|
||||
<label for="cname">Name (required, at least 2 characters)</label>
|
||||
<input id="cname" name="name" class="required" minlength="2" />
|
||||
<p>
|
||||
<label for="cemail">E-Mail (required)</label>
|
||||
<input id="cemail" name="email" class="required email" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="curl">URL (optional)</label>
|
||||
<input id="curl" name="url" class="url" value="" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="ccomment">Your comment (required)</label>
|
||||
<textarea id="ccomment" name="comment" class="required"></textarea>
|
||||
</p>
|
||||
<p>
|
||||
<input class="submit" type="submit" value="Submit"/>
|
||||
</p>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
<form class="cmxform" id="signupForm" method="get" action="">
|
||||
<fieldset>
|
||||
<legend>Validating a complete form</legend>
|
||||
<p>
|
||||
<label for="firstname">Firstname</label>
|
||||
<input id="firstname" name="firstname" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="lastname">Lastname</label>
|
||||
<input id="lastname" name="lastname" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="username">Username</label>
|
||||
<input id="username" name="username" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="password">Password</label>
|
||||
<input id="password" name="password" type="password" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="confirm_password">Confirm password</label>
|
||||
<input id="confirm_password" name="confirm_password" type="password" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="email">Email</label>
|
||||
<input id="email" name="email" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="agree">Please agree to our policy</label>
|
||||
<input type="checkbox" class="checkbox" id="agree" name="agree" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="newsletter">I'd like to receive the newsletter</label>
|
||||
<input type="checkbox" class="checkbox" id="newsletter" name="newsletter" />
|
||||
</p>
|
||||
<fieldset id="newsletter_topics">
|
||||
<legend>Topics (select at least two) - note: would be hidden when newsletter isn't selected, but is visible here for the demo</legend>
|
||||
<label for="topic_marketflash">
|
||||
<input type="checkbox" id="topic_marketflash" value="marketflash" name="topic" />
|
||||
Marketflash
|
||||
</label>
|
||||
<label for="topic_fuzz">
|
||||
<input type="checkbox" id="topic_fuzz" value="fuzz" name="topic" />
|
||||
Latest fuzz
|
||||
</label>
|
||||
<label for="topic_digester">
|
||||
<input type="checkbox" id="topic_digester" value="digester" name="topic" />
|
||||
Mailing list digester
|
||||
</label>
|
||||
<label for="topic" class="error">Please select at least two topics you'd like to receive.</label>
|
||||
</fieldset>
|
||||
<p>
|
||||
<input class="submit" type="submit" value="Submit"/>
|
||||
</p>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
<h3>Syntetic examples</h3>
|
||||
<ul>
|
||||
<li><a href="errorcontainer-demo.html">Error message containers in action</a></li>
|
||||
<li><a href="custom-messages-metadata-demo.html">Custom Messages as Metadata</a></li>
|
||||
<li><a href="radio-checkbox-select-demo.html">Radio and checkbox buttons and selects</a></li>
|
||||
<li><a href="ajaxSubmit-intergration-demo.html">Integration with Form Plugin (AJAX submit)</a></li>
|
||||
<li><a href="custom-methods-demo.html">Custom methods and message display.</a></li>
|
||||
<li><a href="dynamic-totals.html">Dynamic forms</a></li>
|
||||
</ul>
|
||||
<h3>Real-world examples</h3>
|
||||
<ul>
|
||||
<li><a href="milk/">Remember The Milk signup form</a></li>
|
||||
<li><a href="marketo/">Marketo signup form</a></li>
|
||||
<li><a href="multipart/">Buy and Sell a House multipart form</a></li>
|
||||
<li><a href="captcha/">Remote captcha validation</a></li>
|
||||
</ul>
|
||||
|
||||
<h3>Testsuite</h3>
|
||||
<ul>
|
||||
<li><a href="../test/">Validation Testsuite</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
_uacct = "UA-2623402-1";
|
||||
urchinTracker();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -1 +0,0 @@
|
||||
eval(function(p,a,c,k,e,d){e=function(c){return(c<a?"":e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);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;}('8={3b:"1.6",2o:"1B.1Y,1B.23,1B.2e",2i:"",2H:1a,12:"",2C:1a,Z:"",2a:\'<H V="$0">$$</H>\',R:"&#F;",1j:"&#F;&#F;&#F;&#F;",1f:"&#F;<1W/>",3c:5(){9 $(y).39("1k")[0]},I:{},N:{}};(5($){$(5(){5 1J(l,a){5 2I(A,h){4 3=(1v h.3=="1h")?h.3:h.3.1w;k.1m({A:A,3:"("+3+")",u:1+(3.c(/\\\\./g,"%").c(/\\[.*?\\]/g,"%").3a(/\\((?!\\?)/g)||[]).u,z:(h.z)?h.z:8.2a})}5 2z(){4 1E=0;4 1x=x 2A;Q(4 i=0;i<k.u;i++){4 3=k[i].3;3=3.c(/\\\\\\\\|\\\\(\\d+)/g,5(m,1F){9!1F?m:"\\\\"+(1E+1+1t(1F))});1x.1m(3);1E+=k[i].u}4 1w=1x.3d("|");9 x 1u(1w,(a.3g)?"2j":"g")}5 1S(o){9 o.c(/&/g,"&3h;").c(/</g,"&3e;")}5 1R(o){9 o.c(/ +/g,5(1X){9 1X.c(/ /g,R)})}5 G(o){o=1S(o);7(R){o=1R(o)}9 o}5 2m(2E){4 i=0;4 j=1;4 h;19(h=k[i++]){4 1b=D;7(1b[j]){4 1U=/(\\\\\\$)|(?:\\$\\$)|(?:\\$(\\d+))/g;4 z=h.z.c(1U,5(m,1V,K){4 3f=\'\';7(1V){9"$"}v 7(!K){9 G(1b[j])}v 7(K=="0"){9 h.A}v{9 G(1b[j+1t(K,10)])}});4 1A=D[D.u-2];4 2h=D[D.u-1];4 2G=2h.2v(11,1A);11=1A+2E.u;14+=G(2G)+z;9 z}v{j+=h.u}}}4 R=8.R;4 k=x 2A;Q(4 A 2r a.k){2I(A,a.k[A])}4 14="";4 11=0;l.c(2z(),2m);4 2y=l.2v(11,l.u);14+=G(2y);9 14}5 2B(X){7(!8.N[X]){4 Y=\'<Y 32="1p" 33="p/2u"\'+\' 30="\'+X+\'">\';8.N[X]=1H;7($.31.34){4 W=J.1L(Y);4 $W=$(W);$("2d").1O($W)}v{$("2d").1O(Y)}}}5 1q(e,a){4 l=e&&e.1g&&e.1g[0]&&e.1g[0].37;7(!l)l="";l=l.c(/\\r\\n?/g,"\\n");4 C=1J(l,a);7(8.1j){C=C.c(/\\t/g,8.1j)}7(8.1f){C=C.c(/\\n/g,8.1f)}$(e).38(C)}5 1o(q,13){4 1l={12:8.12,2x:q+".1d",Z:8.Z,2w:q+".2u"};4 B;7(13&&1v 13=="2l")B=$.35(1l,13);v B=1l;9{a:B.12+B.2x,1p:B.Z+B.2w}}7($.2q)$.2q({36:"2l.15"});4 2n=x 1u("\\\\b"+8.2i+"\\\\b","2j");4 1e=[];$(8.2o).2D(5(){4 e=y;4 1n=$(e).3i("V");7(!1n){9}4 q=$.3u(1n.c(2n,""));7(\'\'!=q){1e.1m(e);4 f=1o(q,e.15);7(8.2H||e.15){7(!8.N[f.a]){1D{8.N[f.a]=1H;$.3v(f.a,5(M){M.f=f.a;8.I[f.a]=M;7(8.2C){2B(f.1p)}$("."+q).2D(5(){4 f=1o(q,y.15);7(M.f==f.a){1q(y,M)}})})}1I(3s){3t("a 3w Q: "+q+\'@\'+3z)}}}v{4 a=8.I[f.a];7(a){1q(e,a)}}}});7(J.1i&&J.1i.29){5 22(p){7(\'\'==p){9""}1z{4 16=(x 3A()).2k()}19(p.3x(16)>-1);p=p.c(/\\<1W[^>]*?\\>/3y,16);4 e=J.1L(\'<1k>\');e.3l=p;p=e.3m.c(x 1u(16,"g"),\'\\r\\n\');9 p}4 T="";4 18=1G;$(1e).3j().G("1k").U("2c",5(){18=y}).U("1M",5(){7(18==y)T=J.1i.29().3k});$("3n").U("3q",5(){7(\'\'!=T){2p.3r.3o(\'3p\',22(T));2V.2R=1a}}).U("2c",5(){T=""}).U("1M",5(){18=1G})}})})(1Z);8.I["1Y.1d"]={k:{2M:{3:/\\/\\*[^*]*\\*+(?:[^\\/][^*]*\\*+)*\\//},25:{3:/\\<!--(?:.|\\n)*?--\\>/},2f:{3:/\\/\\/.*/},2P:{3:/2L|2T|2J|2O|2N|2X|2K|2Z|2U|2S|2W|2Y|2Q|51|c-50/},53:{3:/\\/[^\\/\\\\\\n]*(?:\\\\.[^\\/\\\\\\n]*)*\\/[52]*/},1h:{3:/(?:\\\'[^\\\'\\\\\\n]*(?:\\\\.[^\\\'\\\\\\n]*)*\\\')|(?:\\"[^\\"\\\\\\n]*(?:\\\\.[^\\"\\\\\\n]*)*\\")/},27:{3:/\\b[+-]?(?:\\d*\\.?\\d+|\\d+\\.?\\d*)(?:[1r][+-]?\\d+)?\\b/},4X:{3:/\\b(D|1N|1K|1I|2t|2s|4W|1z|v|1a|Q|5|7|2r|4Z|x|1G|9|1Q|y|1H|1D|1v|4|4Y|19|59)\\b/},1y:{3:/\\b(58|2k|2p|5b|5a|55|J|54|57|1t|56|4L|4K|4N|4M|4H|4G|4J)\\b/},1C:{3:/(?:\\<\\w+)|(?:\\>)|(?:\\<\\/\\w+\\>)|(?:\\/\\>)/},26:{3:/\\s+\\w+(?=\\s*=)/},20:{3:/([\\"\\\'])(?:(?:[^\\1\\\\\\r\\n]*?(?:\\1\\1|\\\\.))*[^\\1\\\\\\r\\n]*?)\\1/},21:{3:/&[\\w#]+?;/},4I:{3:/(\\$|1Z)/}}};8.I["23.1d"]={k:{25:{3:/\\<!--(?:.|\\n)*?--\\>/},1h:{3:/(?:\\\'[^\\\'\\\\\\n]*(?:\\\\.[^\\\'\\\\\\n]*)*\\\')|(?:\\"[^\\"\\\\\\n]*(?:\\\\.[^\\"\\\\\\n]*)*\\")/},27:{3:/\\b[+-]?(?:\\d*\\.?\\d+|\\d+\\.?\\d*)(?:[1r][+-]?\\d+)?\\b/},1C:{3:/(?:\\<\\w+)|(?:\\>)|(?:\\<\\/\\w+\\>)|(?:\\/\\>)/},26:{3:/\\s+\\w+(?=\\s*=)/},20:{3:/([\\"\\\'])(?:(?:[^\\1\\\\\\r\\n]*?(?:\\1\\1|\\\\.))*[^\\1\\\\\\r\\n]*?)\\1/},21:{3:/&[\\w#]+?;/}}};8.I["2e.1d"]={k:{4S:{3:/\\/\\*[^*]*\\*+([^\\/][^*]*\\*+)*\\//},2f:{3:/(?:\\/\\/.*)|(?:[^\\\\]\\#.*)/},4V:{3:/\\\'[^\\\'\\\\]*(?:\\\\.[^\\\'\\\\]*)*\\\'/},4U:{3:/\\"[^\\"\\\\]*(?:\\\\.[^\\"\\\\]*)*\\"/},4P:{3:/\\b(?:[4O][2b][1s][1s]|[4R][4Q][2b][1P]|[5c][5v][1s][5u][1P])\\b/},5x:{3:/\\b[+-]?(\\d*\\.?\\d+|\\d+\\.?\\d*)([1r][+-]?\\d+)?\\b/},5y:{3:/\\b(?:5z|5w(?:5A|5E(?:5F(?:17|1c)|5G(?:17|1c))|17|1T|5B|5C|5D(?:17|1T|1c)|1c)|P(?:5h(?:5k|5j)|5e(?:5d|5g(?:5f|5l)|5r|E(?:5t|5s)|5n(?:5m|5p)|L(?:3X|3W)|O(?:S|3Y(?:3T|3S|3V))|3U|S(?:44|47|46)|41))|40)\\b/},1y:{3:/(?:\\$43|\\$42|\\$3R|\\$3G|\\$3F|\\$3I|\\$3H|\\$3C|\\$3B|\\$3D)\\b/},28:{3:/\\b(?:3O|3N|3P|3K|3J|3M|3L|48|4v|1N|1K|1I|4u|V|4x|4w|2t|4r|2s|4q|1z|4t|v|4s|4D|4C|4F|4E|4z|4y|4B|4A|4p|4d|2F|2F|4g|Q|4f|5|1y|7|4a|4m|4l|4o|4i|4k|x|4j|4h|4n|4b|4c|49|4e|3Q|3E|9|45|1Q|y|3Z|1D|5o|5q|4|19|5i)\\b/},2g:{3:/\\$(\\w+)/,z:\'<H V="28">$</H><H V="2g">$1</H>\'},1C:{3:/(?:\\<\\?[24][4T][24])|(?:\\<\\?)|(?:\\?\\>)/}}}',62,353,'|||exp|var|function||if|ChiliBook|return|recipe||replace||el|path||step|||steps|ingredients|||str|text|recipeName||||length|else||new|this|replacement|stepName|settings|dish|arguments||160|filter|span|recipes|document|||recipeLoaded|required|||for|replaceSpace||insidePRE|bind|class|domLink|stylesheetPath|link|stylesheetFolder||lastIndex|recipeFolder|options|perfect|chili|newline|ERROR|downPRE|while|false|aux|WARNING|js|codes|replaceNewLine|childNodes|string|selection|replaceTab|pre|settingsDef|push|elClass|getPath|stylesheet|makeDish|eE|Ll|parseInt|RegExp|typeof|source|exps|global|do|offset|code|tag|try|prevLength|aNum|null|true|catch|cook|case|createElement|mouseup|break|append|Ee|switch|replaceSpaces|escapeHTML|NOTICE|pattern|escaped|br|spaces|mix|jQuery|avalue|entity|preformatted|xml|Pp|htcom|aname|numbers|keyword|createRange|defaultReplacement|Uu|mousedown|head|php|com|variable|input|elementClass|gi|valueOf|object|chef|selectClass|elementPath|window|metaobjects|in|default|continue|css|substring|stylesheetFile|recipeFile|lastUnmatched|knowHow|Array|checkCSS|stylesheetLoading|each|matched|extends|unmatched|recipeLoading|prepareStep|unblockUI|ajaxSubmit|silverlight|jscom|unblock|block|plugin|clearFields|returnValue|fieldValue|blockUI|formSerialize|event|resetForm|ajaxForm|clearForm|fieldSerialize|href|browser|rel|type|msie|extend|selector|data|html|next|match|version|getPRE|join|lt|bit|ignoreCase|amp|attr|parents|htmlText|innerHTML|innerText|body|setData|Text|copy|clipboardData|recipeNotAvailable|alert|trim|getJSON|unavailable|indexOf|ig|recipePath|Date|_SESSION|_SERVER|php_errormsg|require_once|_GET|_FILES|_REQUEST|_POST|__METHOD__|__LINE__|and|abstract|__FILE__|__CLASS__|__FUNCTION__|require|_ENV|END|CONT|PREFIX|START|OCALSTATEDIR|IBDIR|UTPUT_HANDLER_|throw|__COMPILER_HALT_OFFSET__|VERSION|_COOKIE|GLOBALS|API|static|YSCONFDIR|HLIB_SUFFIX|array|protected|implements|print|private|exit|public|foreach|final|or|isset|old_function|list|include_once|include|php_user_filter|interface|exception|die|declare|elseif|echo|cfunction|as|const|clone|endswitch|endif|eval|endwhile|enddeclare|empty|endforeach|endfor|isNaN|NaN|jquery|Infinity|clearTimeout|setTimeout|clearInterval|setInterval|Nn|value|Rr|Tt|mlcom|Hh|string2|string1|delete|keywords|void|instanceof|content|taconite|gim|regexp|escape|constructor|parseFloat|unescape|toString|with|prototype|element|Ff|BINDIR|HP_|PATH|CONFIG_FILE_|EAR_|xor|INSTALL_DIR|EXTENSION_DIR|SCAN_DIR|MAX|INT_|unset|SIZE|use|DATADIR|XTENSION_DIR|OL|Ss|Aa|E_|number|const1|DEFAULT_INCLUDE_PATH|ALL|PARSE|STRICT|USER_|CO|MPILE_|RE_'.split('|'),0,{}))
|
24
thirdparty/jquery-validate/demo/js/cmxforms.js
vendored
@ -1,24 +0,0 @@
|
||||
// apply inline-box only for mozilla
|
||||
if( jQuery.browser.mozilla ) {
|
||||
// do when DOM is ready
|
||||
$( function() {
|
||||
// search form, hide it, search labels to modify, filter classes nocmx and error
|
||||
$( 'form.cmxform' ).hide().find( 'p>label:not(.nocmx):not(.error)' ).each( function() {
|
||||
var $this = $(this);
|
||||
var labelContent = $this.html();
|
||||
var labelWidth = document.defaultView.getComputedStyle( this, '' ).getPropertyValue( 'width' );
|
||||
// create block element with width of label
|
||||
var labelSpan = $("<span>")
|
||||
.css("display", "block")
|
||||
.width(labelWidth)
|
||||
.html(labelContent);
|
||||
// change display to mozilla specific inline-box
|
||||
$this.css("display", "-moz-inline-box")
|
||||
// remove children
|
||||
.empty()
|
||||
// add span element
|
||||
.append(labelSpan);
|
||||
// show form again
|
||||
}).end().show();
|
||||
});
|
||||
};
|
BIN
thirdparty/jquery-validate/demo/login/images/bg.gif
vendored
Before Width: | Height: | Size: 89 B |
Before Width: | Height: | Size: 442 B |
Before Width: | Height: | Size: 664 B |
Before Width: | Height: | Size: 121 B |
76
thirdparty/jquery-validate/demo/login/index.html
vendored
@ -1,76 +0,0 @@
|
||||
<!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" lang="en">
|
||||
<head>
|
||||
<title>Login Form with Email Password Link</title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||
<link rel="stylesheet" type="text/css" media="screen" href="screen.css" />
|
||||
|
||||
<script type="text/javascript" src="../../lib/jquery.js"></script>
|
||||
<script type="text/javascript" src="../../jquery.validate.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
$(function() {
|
||||
// highlight
|
||||
var elements = $("input[type!='submit'], textarea, select");
|
||||
elements.focus(function(){
|
||||
$(this).parents('li').addClass('highlight');
|
||||
});
|
||||
elements.blur(function(){
|
||||
$(this).parents('li').removeClass('highlight');
|
||||
});
|
||||
|
||||
$("#forgotpassword").click(function() {
|
||||
$("#password").removeClass("required");
|
||||
$("#login").submit();
|
||||
$("#password").addClass("required");
|
||||
return false;
|
||||
});
|
||||
|
||||
$("#login").validate()
|
||||
});
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div id="page">
|
||||
|
||||
<div id="header">
|
||||
<h1>Login</h1>
|
||||
</div>
|
||||
|
||||
<div id="content">
|
||||
<p id="status"></p>
|
||||
<form action="" method="get" id="login">
|
||||
<fieldset>
|
||||
<legend>User details</legend>
|
||||
<ul>
|
||||
<li>
|
||||
<label for="email"><span class="required">Email address</span></label>
|
||||
<input id="email" name="email" class="text required email" type="text" />
|
||||
<label for="email" class="error">This must be a valid email address</label>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<label for="password"><span class="required">Password</span></label>
|
||||
<input name="password" type="password" class="text required" id="password" minlength="4" maxlength="20" />
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<label class="centered info"><a id="forgotpassword" href="#">Email my password...</a></label>
|
||||
</li>
|
||||
</ul>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="submit">
|
||||
<input type="submit" class="button" value="Login..." />
|
||||
</fieldset>
|
||||
|
||||
<div class="clear"></div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
457
thirdparty/jquery-validate/demo/login/screen.css
vendored
@ -1,457 +0,0 @@
|
||||
/*******************************************************************************
|
||||
********************************************************************************
|
||||
**
|
||||
* - GENERAL
|
||||
*
|
||||
* - PAGE CONTAINERS
|
||||
*
|
||||
* - HEADER
|
||||
*
|
||||
* - CONTENT
|
||||
**
|
||||
********************************************************************************
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
/* GENERAL ------------------------------------------------------------------ */
|
||||
|
||||
html
|
||||
{
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
/* Zero default margin & padding around common elements */
|
||||
body, dd, dl, dt, form, h1, h2, h3, h4, h5, h6, ul, ol, li, p
|
||||
{
|
||||
margin: 0;
|
||||
border: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
body
|
||||
{
|
||||
height: 100%;
|
||||
background-color: #333333;
|
||||
background-image: url(images/bg.gif);
|
||||
background-position: 0% 0;
|
||||
color: #000000;
|
||||
line-height: 1.5;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
font-size: 62.5%;
|
||||
text-align: center;
|
||||
overflow:auto;
|
||||
}
|
||||
|
||||
a:link
|
||||
{
|
||||
color: #003399;
|
||||
}
|
||||
|
||||
a:visited
|
||||
{
|
||||
color: #B266B2;
|
||||
}
|
||||
|
||||
a:hover
|
||||
{
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* PAGE CONTAINERS ---------------------------------------------------------- */
|
||||
|
||||
#page
|
||||
{
|
||||
width: 636px;
|
||||
w\idth: 600px;
|
||||
min-height: 100%;
|
||||
margin: 17px auto;
|
||||
padding: 0 18px;
|
||||
background-image: url(images/page.gif);
|
||||
background-repeat: repeat-y;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
* html #page
|
||||
{
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* HEADER ------------------------------------------------------------------- */
|
||||
|
||||
#header
|
||||
{
|
||||
height: 90px;
|
||||
background-color: #B2DD32;
|
||||
background-image: url(images/header1.jpg);
|
||||
background-repeat: repeat-x;
|
||||
}
|
||||
|
||||
h1
|
||||
{
|
||||
padding: 0 35px;
|
||||
font-size: 2.2em;
|
||||
font-weight: normal;
|
||||
line-height: 82px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* CONTENT ------------------------------------------------------------------ */
|
||||
|
||||
#content
|
||||
{
|
||||
padding: 0 25px;
|
||||
}
|
||||
|
||||
p
|
||||
{
|
||||
font-size:1.1em;
|
||||
margin-top: 1.5em;
|
||||
}
|
||||
|
||||
form
|
||||
{
|
||||
margin-top: 1.5em;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*** MASTER FORM WIDTHS - CUSTOMIZE THIS TO CHANGE THE FORM LAYOUT ***/
|
||||
|
||||
/*
|
||||
form width: 550px
|
||||
left column: 190px / 180px + 10px padding
|
||||
mid column: 200px
|
||||
right column: 160px
|
||||
*/
|
||||
|
||||
form{
|
||||
width:550px !important;
|
||||
}
|
||||
|
||||
fieldset.submit
|
||||
{
|
||||
padding-left: 190px !important;
|
||||
}
|
||||
|
||||
form label{
|
||||
padding:0px 10px;
|
||||
width: 160px;
|
||||
}
|
||||
|
||||
form label.error,
|
||||
form input.submit
|
||||
{
|
||||
margin-left:180px !important;
|
||||
}
|
||||
|
||||
form fieldset fieldset label.error
|
||||
{
|
||||
margin-left:0px !important;
|
||||
width:200px !important;
|
||||
}
|
||||
|
||||
|
||||
form .centered{
|
||||
margin-left:180px !important;
|
||||
width:200px !important;
|
||||
}
|
||||
|
||||
form .text,
|
||||
form .button,
|
||||
form .group,
|
||||
form .control,
|
||||
form .submit,
|
||||
form textarea,
|
||||
form select
|
||||
{
|
||||
width: 200px !important;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*** FIELDSETS AND LEGENDS ***/
|
||||
|
||||
form{
|
||||
width:550px;
|
||||
margin-bottom:25px;
|
||||
clear:both;
|
||||
}
|
||||
|
||||
form fieldset
|
||||
{
|
||||
margin: 0 0 1.5em 0;
|
||||
padding: 0 0 10px 0px;
|
||||
|
||||
border: 1px solid #BFBAB0;
|
||||
|
||||
background-color: #F2EFE9;
|
||||
background-image: url(images/fieldset_gradient.jpg);
|
||||
background-repeat: repeat-x;
|
||||
|
||||
background-color: #fff;
|
||||
background-image: url(images/fieldset-gradient-02.jpg);
|
||||
background-position:bottom;
|
||||
|
||||
float: left;
|
||||
clear: both;
|
||||
width: 100%;
|
||||
|
||||
}
|
||||
|
||||
form fieldset.submit
|
||||
{
|
||||
padding: 0px 10px 10px 190px;
|
||||
border-style: none;
|
||||
|
||||
background-color: transparent;
|
||||
background-image: none;
|
||||
|
||||
float: none;
|
||||
width: auto;
|
||||
|
||||
}
|
||||
|
||||
form legend
|
||||
{
|
||||
color: #000000;
|
||||
|
||||
font-size:1.3em;
|
||||
font-weight: bold;
|
||||
font-variant:small-caps;
|
||||
|
||||
margin-left: 1em;
|
||||
padding:0px 5px;
|
||||
}
|
||||
|
||||
form fieldset p{
|
||||
margin:10px 0px 0px 10px;
|
||||
}
|
||||
|
||||
/*** FORM BLOCKS ***/
|
||||
|
||||
form ul
|
||||
{
|
||||
padding:5px 10px;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
form li
|
||||
{
|
||||
width: 100%;
|
||||
|
||||
padding:5px 0px 10px 0;
|
||||
border-top:1px dotted #ccc;
|
||||
|
||||
display:block;
|
||||
float: left;
|
||||
clear: left;
|
||||
}
|
||||
|
||||
form li:first-child
|
||||
{
|
||||
border:none;
|
||||
}
|
||||
|
||||
|
||||
/*** FORM BLOCK ELEMENTS ***/
|
||||
|
||||
form label
|
||||
{
|
||||
padding:0px 10px;
|
||||
width: 160px;
|
||||
float: left;
|
||||
}
|
||||
|
||||
form .error{
|
||||
color: #c00;
|
||||
}
|
||||
|
||||
form label.error
|
||||
{
|
||||
color: #c00;
|
||||
|
||||
font-size: 100%;
|
||||
font-weight: bold;
|
||||
font-variant:small-caps;
|
||||
|
||||
width:308px;
|
||||
display: none;
|
||||
|
||||
margin:8px 0px 0px 180px;
|
||||
padding:3px 0px 0px 5px;
|
||||
border-top:1px dotted #ccc;
|
||||
|
||||
clear:both;
|
||||
}
|
||||
|
||||
form label.info{
|
||||
font-size: 100%;
|
||||
font-weight: bold;
|
||||
font-variant:small-caps;
|
||||
|
||||
margin:8px 0px 0px 180px;
|
||||
padding:3px 0px 0px 5px;
|
||||
}
|
||||
|
||||
form fieldset fieldset,
|
||||
form .group
|
||||
{
|
||||
width:200px;
|
||||
|
||||
margin: 0;
|
||||
border:none;
|
||||
|
||||
background:none;
|
||||
|
||||
float:left;
|
||||
clear: none;
|
||||
|
||||
}
|
||||
|
||||
form fieldset fieldset label
|
||||
{
|
||||
width:auto !important;
|
||||
white-space:nowrap;
|
||||
padding:0px;
|
||||
margin:0px;
|
||||
display:block;
|
||||
clear:both;
|
||||
}
|
||||
|
||||
form label label.error{
|
||||
margin-left:0px;
|
||||
}
|
||||
|
||||
form label.centered{
|
||||
padding:0px 0px;
|
||||
width:200px !important;
|
||||
}
|
||||
|
||||
/* see also the error class at the foot of the page */
|
||||
|
||||
form fieldset fieldset label.spaced
|
||||
{
|
||||
margin-bottom:3px;
|
||||
}
|
||||
|
||||
/*** FORM ELEMENT COLUMNS ***/
|
||||
|
||||
.col-1,
|
||||
fieldset fieldset.col-1 label
|
||||
{
|
||||
width:100%;
|
||||
}
|
||||
|
||||
.col-2,
|
||||
fieldset fieldset.col-2 label
|
||||
{
|
||||
width:50%;
|
||||
}
|
||||
|
||||
.col-3,
|
||||
fieldset fieldset.col-3 label
|
||||
{
|
||||
width:33%;
|
||||
}
|
||||
|
||||
.col-4,
|
||||
fieldset fieldset.col-4 label
|
||||
{
|
||||
width:25%;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*** FORM ELEMENTS ***/
|
||||
|
||||
form input.submit{
|
||||
margin:10px 0px 10px 180px;
|
||||
padding:0px 2px;
|
||||
}
|
||||
|
||||
form input, textarea, select,
|
||||
form label
|
||||
{
|
||||
font-size:1.1em;
|
||||
line-height:1.6em;
|
||||
}
|
||||
|
||||
form input, textarea, select
|
||||
{
|
||||
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||
}
|
||||
|
||||
form .input[type="text"],
|
||||
form textarea
|
||||
{
|
||||
padding:1px;
|
||||
}
|
||||
|
||||
form .input[type="radio"],
|
||||
form .input[type="checkbox"]
|
||||
{
|
||||
margin:0px;
|
||||
padding:0px;
|
||||
position:relative;
|
||||
top:3px;
|
||||
}
|
||||
|
||||
/*** SUPPORTING CLASSES ***/
|
||||
|
||||
form label.required{
|
||||
background-image:url(images/required_star.gif);
|
||||
background-position:right;
|
||||
background-repeat:no-repeat;
|
||||
}
|
||||
|
||||
form span.required{
|
||||
padding-right:15px;
|
||||
}
|
||||
|
||||
form .clean
|
||||
{
|
||||
border:none;
|
||||
}
|
||||
|
||||
form .info{
|
||||
padding-top:0.5em;
|
||||
font-size:80%;
|
||||
line-height:100%;
|
||||
color:#aaa;
|
||||
}
|
||||
|
||||
form .indent{
|
||||
padding:2px 20px;
|
||||
width:auto !important;
|
||||
white-space:nowrap;
|
||||
padding-left: 25px !important;
|
||||
}
|
||||
|
||||
form label.disabled{
|
||||
color:#aaa;
|
||||
}
|
||||
|
||||
form .highlight{
|
||||
background-color:#e2e2e2;
|
||||
}
|
||||
|
||||
.off{
|
||||
display:none !important;
|
||||
}
|
||||
|
||||
.clear{
|
||||
clear:both;
|
||||
}
|
||||
|
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
$request = trim(strtolower($_REQUEST['email']));
|
||||
$emails = array('glen@marketo.com', 'george@bush.gov', 'me@god.com', 'aboutface@cooper.com', 'steam@valve.com', 'bill@gates.com');
|
||||
$valid = 'true';
|
||||
foreach($emails as $email) {
|
||||
if( strtolower($email) == $request )
|
||||
$valid = 'false';
|
||||
}
|
||||
echo $valid;
|
||||
?>
|
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
$request = trim(strtolower($_REQUEST['value']));
|
||||
$emails = array('glen@marketo.com', 'george@bush.gov', 'me@god.com', 'aboutface@cooper.com', 'steam@valve.com', 'bill@gates.com');
|
||||
$valid = 'true';
|
||||
foreach($emails as $email) {
|
||||
if( strtolower($email) == $request )
|
||||
$valid = 'false';
|
||||
}
|
||||
echo $valid;
|
||||
?>
|
35
thirdparty/jquery-validate/demo/marketo/ie6.css
vendored
@ -1,35 +0,0 @@
|
||||
img.png {
|
||||
background-image: expression(
|
||||
this.runtimeStyle.backgroundImage = "none",
|
||||
this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.src + "', sizingMethod='image')",
|
||||
this.src = "images/blank.gif"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
.hidden {
|
||||
display:none
|
||||
}
|
||||
|
||||
|
||||
|
||||
div.login { width: 120px;}
|
||||
div.nav-global LI,
|
||||
div.nav-global LI A { display:inline !important; zoom: 1;}
|
||||
|
||||
div.nav-global LI A:hover,
|
||||
div.nav-left li a:hover { text-decoration: none;}
|
||||
|
||||
div.buttonSubmit { height: 36px;}
|
||||
|
||||
div.buttonSubmit input { position: absolute;}
|
||||
|
||||
div.offerHeader {margin-left: 3px;}
|
||||
|
||||
#col-left { height: 340px;}
|
||||
|
||||
span#cancellation {
|
||||
position: relative;
|
||||
top: 20px;
|
||||
}
|
Before Width: | Height: | Size: 137 B |
Before Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 799 B |
Before Width: | Height: | Size: 4.4 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 8.2 KiB |
Before Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 4.6 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 793 B |
Before Width: | Height: | Size: 845 B |
Before Width: | Height: | Size: 234 B |
247
thirdparty/jquery-validate/demo/marketo/index.html
vendored
@ -1,247 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/2000/REC-xhtml1-200000126/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="title" content="Subscription Signup | Marketo" />
|
||||
<meta name="robots" content="index, follow" />
|
||||
<meta name="description" content="Marketo Search Marketing application" />
|
||||
<meta name="keywords" content="Marketo, Search Marketing" />
|
||||
<meta name="language" content="en" />
|
||||
<title>Subscription Signup | Marketo</title>
|
||||
|
||||
<link rel="shortcut icon" href="/favicon.ico" />
|
||||
|
||||
<script src="../../lib/jquery.js" type="text/javascript"></script>
|
||||
<script src="../../jquery.validate.js" type="text/javascript"></script>
|
||||
|
||||
<script type="text/javascript" src="jquery.maskedinput.js"></script>
|
||||
<script type="text/javascript" src="mktSignup.js"></script>
|
||||
|
||||
<link rel="stylesheet" type="text/css" media="screen" href="stylesheet.css" />
|
||||
</head>
|
||||
<body>
|
||||
<!--[if lte IE 6]>
|
||||
<link rel="stylesheet" type="text/css" media="all" href="ie6.css" />
|
||||
<![endif]-->
|
||||
|
||||
<!-- start page wrapper --><div id="letterbox">
|
||||
|
||||
<!-- start header container -->
|
||||
<div id="header-background">
|
||||
<div class="nav-global-container">
|
||||
|
||||
<div class="login"><a href="#"><span></span>Customer Login</a></div>
|
||||
<div class="logo"><a href="#"><img src="images/logo_marketo.gif" width="168" height="73" alt="Marketo" /></a></div>
|
||||
<div class="nav-global">
|
||||
<ul>
|
||||
<li><a href="#" class="nav-g01"><span></span>Home</a></li>
|
||||
<li><a href="#" class="nav-g02"><span></span>Products</a></li>
|
||||
<li><a href="#" class="nav-g04"><span></span>B2B Marketing Resources</a></li>
|
||||
|
||||
<li><a href="#" class="nav-g05"><span></span>About Marketo</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- end header container -->
|
||||
<div class="line-grey-tier"></div>
|
||||
|
||||
<!-- start page container 2 div-->
|
||||
<div id="page-container" class="resize"><div id="page-content-inner" class="resize">
|
||||
|
||||
<!-- start col-main -->
|
||||
|
||||
<div id="col-main" class="resize" style="">
|
||||
|
||||
|
||||
|
||||
<!-- start main content -->
|
||||
<div class="main-content resize">
|
||||
|
||||
<div class="action-container" style="display:none;"></div>
|
||||
|
||||
|
||||
<h1>Step 1 of 2 </h1>
|
||||
<p>
|
||||
</p>
|
||||
<br clear="all" />
|
||||
<div>
|
||||
<form id="profileForm" type="actionForm" action="step2.htm" method="get" >
|
||||
|
||||
|
||||
<div class="error" style="display:none;">
|
||||
<img src="images/warning.gif" alt="Warning!" width="24" height="24" style="float:left; margin: -5px 10px 0px 0px; " />
|
||||
|
||||
<span></span>.<br clear="all"/>
|
||||
</div>
|
||||
|
||||
|
||||
<table cellpadding="0" cellspacing="0" border="0">
|
||||
<tr>
|
||||
<td class="label"><label for="co_name">Company Name:</label></td>
|
||||
<td class="field">
|
||||
<input id="co_name" class="required" maxlength="40" name="co_name" size="20" type="text" tabindex="1" value="" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><label for="co_url">Company URL:</label></td>
|
||||
<td class="field">
|
||||
<input id="co_url" class="required defaultInvalid url" maxlength="40" name="co_url" style="width:163px" type="text" tabindex="2" value="http://" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td/><td/>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><label for="first_name">First Name:</label></td>
|
||||
<td class="field">
|
||||
<input id="first_name" class="required" maxlength="40" name="first_name" size="20" type="text" tabindex="3" value="" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><label for="last_name">Last Name:</label></td>
|
||||
<td class="field">
|
||||
<input id="last_name" class="required" maxlength="40" name="last_name" size="20" type="text" tabindex="4" value="" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><label for="address1">Company Address:</label></td>
|
||||
<td class="field">
|
||||
<input maxlength="40" class="required" name="address1" size="20" type="text" tabindex="5" value="" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"></td>
|
||||
<td class="field">
|
||||
<input maxlength="40" name="address2" size="20" type="text" tabindex="6" value="" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><label for="city">City:</label></td>
|
||||
<td class="field">
|
||||
<input maxlength="40" class="required" name="city" size="20" type="text" tabindex="7" value="" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><label for="state">State:</label></td>
|
||||
<td class="field">
|
||||
<select id="state" class="required" name="state" style="margin-left: 4px;" tabindex="8">
|
||||
<option value="">Choose State:</option>
|
||||
<option value="AL">Alabama</option><option value="AK">Alaska</option><option value="AZ">Arizona</option><option value="AR">Arkansas</option><option value="CA">California</option><option value="CO">Colorado</option><option value="CT">Connecticut</option><option value="DE">Delaware</option><option value="FL">Florida</option><option value="GA">Georgia</option><option value="HI">Hawaii</option><option value="ID">Idaho</option><option value="IL">Illinois</option><option value="IN">Indiana</option><option value="IA">Iowa</option><option value="KS">Kansas</option><option value="KY">Kentucky</option><option value="LA">Louisiana</option><option value="ME">Maine</option><option value="MD">Maryland</option><option value="MA">Massachusetts</option><option value="MI">Michigan</option><option value="MN">Minnesota</option><option value="MS">Mississippi</option><option value="MO">Missouri</option><option value="MT">Montana</option><option value="NE">Nebraska</option><option value="NV">Nevada</option><option value="NH">New Hampshire</option><option value="NJ">New Jersey</option><option value="NM">New Mexico</option><option value="NY">New York</option><option value="NC">North Carolina</option><option value="ND">North Dakota</option><option value="OH">Ohio</option><option value="OK">Oklahoma</option><option value="OR">Oregon</option><option value="PA">Pennsylvania</option><option value="RI">Rhode Island</option><option value="SC">South Carolina</option><option value="SD">South Dakota</option><option value="TN">Tennessee</option><option value="TX">Texas</option><option value="UT">Utah</option><option value="VT">Vermont</option><option value="VA">Virginia</option><option value="WA">Washington</option><option value="WV">West Virginia</option><option value="WI">Wisconsin</option><option value="WY">Wyoming</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="label"><label for="zip">Zip:</label></td>
|
||||
<td class="field">
|
||||
<input maxlength="10" name="zip" style="width: 100px" type="text" class="required zipcode" tabindex="9" value="" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><label for="phone">Phone:</label></td>
|
||||
<td class="field">
|
||||
<input id="phone" maxlength="14" name="phone" type="text" class="required phone" tabindex="10" value="" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<h2 style="border-bottom: 1px solid #CCCCCC;">Login Information</h2>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td class="label"><label for="email">Email:</label></td>
|
||||
<td class="field">
|
||||
<input id="email" class="required email" remote="emails.php" maxlength="40" name="email" size="20" type="text" tabindex="11" value="" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="label"><label for="password1">Password:</label></td>
|
||||
<td class="field">
|
||||
<input id="password1" class="required password" maxlength="40" name="password1" size="20" type="password" tabindex="12" value="" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><label for="password2">Retype Password:</label></td>
|
||||
<td class="field">
|
||||
<input id="password2" class="required" equalTo="#password1" maxlength="40" name="password2" size="20" type="password" tabindex="13" value="" />
|
||||
<div class="formError"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>
|
||||
<div class="buttonSubmit">
|
||||
<span></span>
|
||||
<input class="formButton" type="submit" value="Next" style="width: 140px" tabindex="14" />
|
||||
</div>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table><br /><br />
|
||||
</form>
|
||||
<br clear="all"/>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div> <!-- end main content -->
|
||||
<br />
|
||||
</div> <!-- end col-main -->
|
||||
|
||||
<!-- start left col -->
|
||||
<div id="col-left" class="nav-left-back empty resize" style="position: absolute; min-height: 450px;">
|
||||
<div class="col-left-header-tab" style="position: absolute;">Signup</div>
|
||||
<div class="nav-left">
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="left-nav-callout png" style="top: 15px; margin-bottom: 100px;">
|
||||
<img src="images/left-nav-callout-long.png" class="png" alt="" />
|
||||
<h6>Sign Up Process</h6>
|
||||
<a style="background-image: url(images/step1-24.gif); font-weight: normal; text-decoration: none; cursor: default;">Sign up with a valid credit card.</a>
|
||||
<a style="background-image: url(images/step2-24.gif); font-weight: normal; text-decoration: none; cursor: default;">Connect to your Google AdWords account. You will need your AdWords Customer ID.</a>
|
||||
<a style="background-image: url(images/step3-24.gif); font-weight: normal; text-decoration: none; cursor: default;">Start your 30 day trial. No payments until trial ends.</a>
|
||||
</div>
|
||||
|
||||
<div class="footerAddress">
|
||||
<b>Marketo Inc.</b><br />
|
||||
1710 S. Amphlett Blvd.<br />
|
||||
San Mateo, CA 94402 USA<br />
|
||||
</div>
|
||||
<br clear="all"/>
|
||||
</div> <!-- end left col -->
|
||||
|
||||
</div> </div> <!-- end page container 2 divs-->
|
||||
|
||||
<div id="footer-container" align="center">
|
||||
<div class="footer">
|
||||
<ul>
|
||||
<li><a href="..">Home</a></li>
|
||||
<li class="line-off"><a href="step2.htm">Second step</a></li>
|
||||
</ul>
|
||||
</div></div>
|
||||
|
||||
|
||||
|
||||
<!-- end page wrapper -->
|
||||
</div>
|
||||
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
_uacct = "UA-2623402-1";
|
||||
urchinTracker();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -1,267 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2007 Josh Bush (digitalbush.com)
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
* files (the "Software"), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use,
|
||||
* copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following
|
||||
* conditions:
|
||||
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Version: 1.1
|
||||
* Release: 2007-09-08
|
||||
*/
|
||||
(function($) {
|
||||
//Helper Functions for Caret positioning
|
||||
function getCaretPosition(ctl){
|
||||
var res = {begin: 0, end: 0 };
|
||||
if (ctl.setSelectionRange){
|
||||
res.begin = ctl.selectionStart;
|
||||
res.end = ctl.selectionEnd;
|
||||
}else if (document.selection && document.selection.createRange){
|
||||
var range = document.selection.createRange();
|
||||
res.begin = 0 - range.duplicate().moveStart('character', -100000);
|
||||
res.end = res.begin + range.text.length;
|
||||
}
|
||||
return res;
|
||||
};
|
||||
|
||||
function setCaretPosition(ctl, pos){
|
||||
if(ctl.setSelectionRange){
|
||||
ctl.focus();
|
||||
ctl.setSelectionRange(pos,pos);
|
||||
}else if (ctl.createTextRange){
|
||||
var range = ctl.createTextRange();
|
||||
range.collapse(true);
|
||||
range.moveEnd('character', pos);
|
||||
range.moveStart('character', pos);
|
||||
range.select();
|
||||
}
|
||||
};
|
||||
|
||||
//Predefined character definitions
|
||||
var charMap={
|
||||
'9':"[0-9]",
|
||||
'a':"[A-Za-z]",
|
||||
'*':"[A-Za-z0-9]"
|
||||
};
|
||||
|
||||
//Helper method to inject character definitions
|
||||
$.mask={
|
||||
addPlaceholder : function(c,r){
|
||||
charMap[c]=r;
|
||||
}
|
||||
};
|
||||
|
||||
$.fn.unmask=function(){
|
||||
return this.trigger("unmask");
|
||||
};
|
||||
|
||||
//Main Method
|
||||
$.fn.mask = function(mask,settings) {
|
||||
settings = $.extend({
|
||||
placeholder: "_",
|
||||
completed: null
|
||||
}, settings);
|
||||
|
||||
//Build Regex for format validation
|
||||
var reString="^";
|
||||
for(var i=0;i<mask.length;i++)
|
||||
reString+=(charMap[mask.charAt(i)] || ("\\"+mask.charAt(i)));
|
||||
reString+="$";
|
||||
var re = new RegExp(reString);
|
||||
|
||||
return this.each(function(){
|
||||
var input=$(this);
|
||||
var buffer=new Array(mask.length);
|
||||
var locked=new Array(mask.length);
|
||||
|
||||
//Build buffer layout from mask
|
||||
for(var i=0;i<mask.length;i++){
|
||||
locked[i]=charMap[mask.charAt(i)]==null;
|
||||
buffer[i]=locked[i]?mask.charAt(i):settings.placeholder;
|
||||
}
|
||||
|
||||
/*Event Bindings*/
|
||||
function focusEvent(){
|
||||
checkVal();
|
||||
writeBuffer();
|
||||
setTimeout(function(){
|
||||
setCaretPosition(input[0],0);
|
||||
},0);
|
||||
};
|
||||
input.bind("focus",focusEvent);
|
||||
|
||||
input.bind("blur",checkVal);
|
||||
|
||||
//Paste events for IE and Mozilla thanks to Kristinn Sigmundsson
|
||||
if ($.browser.msie)
|
||||
this.onpaste= function(){setTimeout(checkVal,0);};
|
||||
else if ($.browser.mozilla)
|
||||
this.addEventListener('input',checkVal,false);
|
||||
|
||||
var ignore=false; //Variable for ignoring control keys
|
||||
|
||||
function keydownEvent(e){
|
||||
var pos=getCaretPosition(this);
|
||||
var k = e.keyCode;
|
||||
ignore=(k < 16 || (k > 16 && k < 32 ) || (k > 32 && k < 41));
|
||||
|
||||
//delete selection before proceeding
|
||||
if((pos.begin-pos.end)!=0 && (!ignore || k==8 || k==46)){
|
||||
clearBuffer(pos.begin,pos.end);
|
||||
}
|
||||
//backspace and delete get special treatment
|
||||
if(k==8){//backspace
|
||||
while(pos.begin-->=0){
|
||||
if(!locked[pos.begin]){
|
||||
buffer[pos.begin]=settings.placeholder;
|
||||
if($.browser.opera){
|
||||
//Opera won't let you cancel the backspace, so we'll let it backspace over a dummy character.
|
||||
writeBuffer(pos.begin);
|
||||
setCaretPosition(this,pos.begin+1);
|
||||
}else{
|
||||
writeBuffer();
|
||||
setCaretPosition(this,pos.begin);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}else if(k==46){//delete
|
||||
clearBuffer(pos.begin,pos.begin+1);
|
||||
writeBuffer();
|
||||
setCaretPosition(this,pos.begin);
|
||||
return false;
|
||||
}else if (k==27){
|
||||
clearBuffer(0,mask.length);
|
||||
writeBuffer();
|
||||
setCaretPosition(this,0);
|
||||
return false;
|
||||
}
|
||||
|
||||
};
|
||||
input.bind("keydown",keydownEvent);
|
||||
|
||||
function keypressEvent(e){
|
||||
if(ignore){
|
||||
ignore=false;
|
||||
return;
|
||||
}
|
||||
e=e||window.event;
|
||||
var k=e.charCode||e.keyCode||e.which;
|
||||
|
||||
var pos=getCaretPosition(this);
|
||||
var caretPos=pos.begin;
|
||||
|
||||
if(e.ctrlKey || e.altKey){//Ignore
|
||||
return true;
|
||||
}else if ((k>=41 && k<=122) ||k==32 || k>186){//typeable characters
|
||||
while(pos.begin<mask.length){
|
||||
var reString=charMap[mask.charAt(pos.begin)];
|
||||
var match;
|
||||
if(reString){
|
||||
var reChar=new RegExp(reString);
|
||||
match=String.fromCharCode(k).match(reChar);
|
||||
}else{//we're on a mask char, go forward and try again
|
||||
pos.begin+=1;
|
||||
pos.end=pos.begin;
|
||||
caretPos+=1;
|
||||
continue;
|
||||
}
|
||||
|
||||
if(match)
|
||||
buffer[pos.begin]=String.fromCharCode(k);
|
||||
else
|
||||
return false;//reject char
|
||||
|
||||
while(++caretPos<mask.length){//seek forward to next typable position
|
||||
if(!locked[caretPos])
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}else
|
||||
return false;
|
||||
|
||||
writeBuffer();
|
||||
if(settings.completed && caretPos>=buffer.length)
|
||||
settings.completed.call(input);
|
||||
else
|
||||
setCaretPosition(this,caretPos);
|
||||
|
||||
return false;
|
||||
};
|
||||
input.bind("keypress",keypressEvent);
|
||||
|
||||
/*Helper Methods*/
|
||||
function clearBuffer(start,end){
|
||||
for(var i=start;i<end;i++){
|
||||
if(!locked[i])
|
||||
buffer[i]=settings.placeholder;
|
||||
}
|
||||
};
|
||||
|
||||
function writeBuffer(pos){
|
||||
var s="";
|
||||
for(var i=0;i<mask.length;i++){
|
||||
s+=buffer[i];
|
||||
if(i==pos)
|
||||
s+=settings.placeholder;
|
||||
}
|
||||
input.val(s);
|
||||
return s;
|
||||
};
|
||||
|
||||
function checkVal(){
|
||||
//try to place charcters where they belong
|
||||
var test=input.val();
|
||||
var pos=0;
|
||||
for(var i=0;i<mask.length;i++){
|
||||
if(!locked[i]){
|
||||
while(pos++<test.length){
|
||||
//Regex Test each char here.
|
||||
var reChar=new RegExp(charMap[mask.charAt(i)]);
|
||||
if(test.charAt(pos-1).match(reChar)){
|
||||
buffer[i]=test.charAt(pos-1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var s=writeBuffer();
|
||||
if(!s.match(re)){
|
||||
input.val("");
|
||||
clearBuffer(0,mask.length);
|
||||
}
|
||||
};
|
||||
|
||||
input.one("unmask",function(){
|
||||
input.unbind("focus",focusEvent);
|
||||
input.unbind("blur",checkVal);
|
||||
input.unbind("keydown",keydownEvent);
|
||||
input.unbind("keypress",keypressEvent);
|
||||
if ($.browser.msie)
|
||||
this.onpaste= null;
|
||||
else if ($.browser.mozilla)
|
||||
this.removeEventListener('input',checkVal,false);
|
||||
});
|
||||
|
||||
});
|
||||
};
|
||||
})(jQuery);
|
125
thirdparty/jquery-validate/demo/marketo/mktSignup.js
vendored
@ -1,125 +0,0 @@
|
||||
$(document).ready(function(){
|
||||
|
||||
jQuery.validator.addMethod("password", function( value, element ) {
|
||||
var result = this.optional(element) || value.length >= 6 && /\d/.test(value) && /[a-z]/i.test(value);
|
||||
if (!result) {
|
||||
element.value = "";
|
||||
var validator = this;
|
||||
setTimeout(function() {
|
||||
validator.blockFocusCleanup = true;
|
||||
element.focus();
|
||||
validator.blockFocusCleanup = false;
|
||||
}, 1);
|
||||
}
|
||||
return result;
|
||||
}, "Your password must be at least 6 characters long and contain at least one number and one character.");
|
||||
|
||||
// a custom method making the default value for companyurl ("http://") invalid, without displaying the "invalid url" message
|
||||
jQuery.validator.addMethod("defaultInvalid", function(value, element) {
|
||||
return value != element.defaultValue;
|
||||
}, "");
|
||||
|
||||
jQuery.validator.addMethod("billingRequired", function(value, element) {
|
||||
if ($("#bill_to_co").is(":checked"))
|
||||
return $(element).parents(".subTable").length;
|
||||
return !this.optional(element);
|
||||
}, "");
|
||||
|
||||
jQuery.validator.messages.required = "";
|
||||
$("form").validate({
|
||||
invalidHandler: function(e, validator) {
|
||||
var errors = validator.numberOfInvalids();
|
||||
if (errors) {
|
||||
var message = errors == 1
|
||||
? 'You missed 1 field. It has been highlighted below'
|
||||
: 'You missed ' + errors + ' fields. They have been highlighted below';
|
||||
$("div.error span").html(message);
|
||||
$("div.error").show();
|
||||
} else {
|
||||
$("div.error").hide();
|
||||
}
|
||||
},
|
||||
onkeyup: false,
|
||||
submitHandler: function() {
|
||||
$("div.error").hide();
|
||||
alert("submit! use link below to go to the other step");
|
||||
},
|
||||
messages: {
|
||||
password2: {
|
||||
required: " ",
|
||||
equalTo: "Please enter the same password as above"
|
||||
},
|
||||
email: {
|
||||
required: " ",
|
||||
email: "Please enter a valid email address, example: you@yourdomain.com",
|
||||
remote: jQuery.validator.format("{0} is already taken, please enter a different address.")
|
||||
}
|
||||
},
|
||||
debug:true
|
||||
});
|
||||
|
||||
$(".resize").vjustify();
|
||||
$("div.buttonSubmit").hoverClass("buttonSubmitHover");
|
||||
|
||||
if ($.browser.safari) {
|
||||
$("body").addClass("safari");
|
||||
}
|
||||
|
||||
$("input.phone").mask("(999) 999-9999");
|
||||
$("input.zipcode").mask("99999");
|
||||
var creditcard = $("#creditcard").mask("9999 9999 9999 9999");
|
||||
|
||||
$("#cc_type").change(
|
||||
function() {
|
||||
switch ($(this).val()){
|
||||
case 'amex':
|
||||
creditcard.unmask().mask("9999 999999 99999");
|
||||
break;
|
||||
default:
|
||||
creditcard.unmask().mask("9999 9999 9999 9999");
|
||||
break;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
// toggle optional billing address
|
||||
var subTableDiv = $("div.subTableDiv");
|
||||
var toggleCheck = $("input.toggleCheck");
|
||||
toggleCheck.is(":checked")
|
||||
? subTableDiv.hide()
|
||||
: subTableDiv.show();
|
||||
$("input.toggleCheck").click(function() {
|
||||
if (this.checked == true) {
|
||||
subTableDiv.slideUp("medium");
|
||||
$("form").valid();
|
||||
} else {
|
||||
subTableDiv.slideDown("medium");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
$.fn.vjustify = function() {
|
||||
var maxHeight=0;
|
||||
$(".resize").css("height","auto");
|
||||
this.each(function(){
|
||||
if (this.offsetHeight > maxHeight) {
|
||||
maxHeight = this.offsetHeight;
|
||||
}
|
||||
});
|
||||
this.each(function(){
|
||||
$(this).height(maxHeight);
|
||||
if (this.offsetHeight > maxHeight) {
|
||||
$(this).height((maxHeight-(this.offsetHeight-maxHeight)));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$.fn.hoverClass = function(classname) {
|
||||
return this.hover(function() {
|
||||
$(this).addClass(classname);
|
||||
}, function() {
|
||||
$(this).removeClass(classname);
|
||||
});
|
||||
};
|
291
thirdparty/jquery-validate/demo/marketo/step2.htm
vendored
@ -1,291 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/2000/REC-xhtml1-200000126/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="title" content="Subscription Signup | Marketo" />
|
||||
<meta name="robots" content="index, follow" />
|
||||
<meta name="description" content="Marketo Search Marketing application" />
|
||||
<meta name="keywords" content="Marketo, Search Marketing" />
|
||||
<meta name="language" content="en" />
|
||||
<title>Subscription Signup | Marketo</title>
|
||||
|
||||
<link rel="shortcut icon" href="/favicon.ico" />
|
||||
|
||||
|
||||
<script src="../../lib/jquery.js" type="text/javascript"></script>
|
||||
<script src="../../lib/jquery.metadata.js" type="text/javascript"></script>
|
||||
<script src="../../lib/jquery.ajaxQueue.js" type="text/javascript"></script>
|
||||
<script src="../../lib/jquery.delegate.js" type="text/javascript"></script>
|
||||
<script src="../../jquery.validate.js" type="text/javascript"></script>
|
||||
|
||||
<script type="text/javascript" src="jquery.maskedinput.js"></script>
|
||||
<script type="text/javascript" src="mktSignup.js"></script>
|
||||
|
||||
<link rel="stylesheet" type="text/css" media="screen" href="stylesheet.css" />
|
||||
</head>
|
||||
<body>
|
||||
<!--[if lte IE 6]>
|
||||
<link rel="stylesheet" type="text/css" media="all" href="ie6.css" />
|
||||
<![endif]-->
|
||||
|
||||
|
||||
|
||||
<!-- start page wrapper --><div id="letterbox">
|
||||
|
||||
<!-- start header container -->
|
||||
<div id="header-background">
|
||||
<div class="nav-global-container">
|
||||
|
||||
<div class="login"><a href="https://app.marketo.com"><span></span>Customer Login</a></div>
|
||||
<div class="logo"><a href="#"><img src="images/logo_marketo.gif" width="168" height="73" alt="Marketo" /></a></div>
|
||||
<div class="nav-global">
|
||||
<ul>
|
||||
<li><a href="#" class="nav-g01"><span></span>Home</a></li>
|
||||
<li><a href="#" class="nav-g02"><span></span>Products</a></li>
|
||||
<li><a href="#" class="nav-g04"><span></span>B2B Marketing Resources</a></li>
|
||||
|
||||
<li><a href="#" class="nav-g05"><span></span>About Marketo</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- end header container -->
|
||||
<div class="line-grey-tier"></div>
|
||||
|
||||
<!-- start page container 2 div-->
|
||||
<div id="page-container" class="resize"><div id="page-content-inner" class="resize">
|
||||
|
||||
<!-- start col-main -->
|
||||
|
||||
<div id="col-main" class="resize" style="">
|
||||
|
||||
|
||||
|
||||
<!-- start main content -->
|
||||
<div class="main-content resize">
|
||||
|
||||
<div class="action-container" style="display:none;"></div>
|
||||
|
||||
|
||||
<h1>Step 2 of 2</h1>
|
||||
<h2>Billing Information</h2>
|
||||
<p>
|
||||
</p>
|
||||
<br clear="all" />
|
||||
<div>
|
||||
<form id="billingForm" action="" method="get" >
|
||||
|
||||
<div class="error" style="display:none;">
|
||||
<img src="images/warning.gif" alt="Warning!" width="24" height="24" style="float:left; margin: -5px 10px 0px 0px; " />
|
||||
|
||||
<span></span>.<br clear="all" />
|
||||
</div>
|
||||
<table cellpadding="0" cellspacing="0" border="0">
|
||||
<tr>
|
||||
<td class="label" style="vertical-align: top; padding-top: 8px;">Billing Address:</td>
|
||||
<td class="field" style="font-weight: normal">
|
||||
<div class="billingAddressControl">
|
||||
|
||||
<input type="checkbox" id="bill_to_co" name="bill_to_co" class="toggleCheck" checked="checked" style="width: auto;" tabindex="1" />
|
||||
<label for="bill_to_co" style="cursor:pointer">Same as Company Address</label>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="subTable">
|
||||
<td colspan="2">
|
||||
<div style="background-color: #EEEEEE; border: 1px solid #CCCCCC; padding: 10px;" class="subTableDiv">
|
||||
<table cellpadding="0" cellspacing="0" border="0">
|
||||
<tr>
|
||||
<td class="label"><label for="bill_first_name">First Name:</label></td>
|
||||
<td class="field">
|
||||
<input maxlength="40" class="billingRequired" name="bill_first_name" size="20" type="text" tabindex="2" value="" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><label for="bill_last_name">Last Name:</label></td>
|
||||
<td class="field">
|
||||
<input maxlength="40" class="billingRequired" name="bill_last_name" size="20" type="text" tabindex="3" value="" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><label for="bill_email">Email:</label></td>
|
||||
<td class="field">
|
||||
<input maxlength="40" class="billingRequired email" remote="emails.php" name="email" size="20" type="text" tabindex="4" value="" />
|
||||
<div class="formError"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><label for="bill_address1">Address:</label></td>
|
||||
<td class="field">
|
||||
<input maxlength="40" class="billingRequired" name="bill_address1" size="20" type="text" tabindex="5" value="" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"></td>
|
||||
<td class="field">
|
||||
<input maxlength="40" name="bill_address2" size="20" type="text" tabindex="6" value="" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><label for="bill_city">City:</label></td>
|
||||
<td class="field">
|
||||
<input maxlength="40" class="billingRequired" name="bill_city" size="20" type="text" tabindex="7" value="" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><label for="bill_state">State:</label></td>
|
||||
<td class="field">
|
||||
<select id="bill_state" class="billingRequired" name="bill_state" style="margin-left: 4px;" tabindex="8">
|
||||
<option value="">Choose State</option>
|
||||
<option value="AL">Alabama</option><option value="AK">Alaska</option><option value="AZ">Arizona</option><option value="AR">Arkansas</option><option value="CA">California</option><option value="CO">Colorado</option><option value="CT">Connecticut</option><option value="DE">Delaware</option><option value="FL">Florida</option><option value="GA">Georgia</option><option value="HI">Hawaii</option><option value="ID">Idaho</option><option value="IL">Illinois</option><option value="IN">Indiana</option><option value="IA">Iowa</option><option value="KS">Kansas</option><option value="KY">Kentucky</option><option value="LA">Louisiana</option><option value="ME">Maine</option><option value="MD">Maryland</option><option value="MA">Massachusetts</option><option value="MI">Michigan</option><option value="MN">Minnesota</option><option value="MS">Mississippi</option><option value="MO">Missouri</option><option value="MT">Montana</option><option value="NE">Nebraska</option><option value="NV">Nevada</option><option value="NH">New Hampshire</option><option value="NJ">New Jersey</option><option value="NM">New Mexico</option><option value="NY">New York</option><option value="NC">North Carolina</option><option value="ND">North Dakota</option><option value="OH">Ohio</option><option value="OK">Oklahoma</option><option value="OR">Oregon</option><option value="PA">Pennsylvania</option><option value="RI">Rhode Island</option><option value="SC">South Carolina</option><option value="SD">South Dakota</option><option value="TN">Tennessee</option><option value="TX">Texas</option><option value="UT">Utah</option><option value="VT">Vermont</option><option value="VA">Virginia</option><option value="WA">Washington</option><option value="WV">West Virginia</option><option value="WI">Wisconsin</option><option value="WY">Wyoming</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="label"><label for="bill_zip">Zip:</label></td>
|
||||
<td class="field">
|
||||
<input maxlength="10" class="billingRequired zipcode" name="bill_zip" style="width: 100px" type="text" class="zipcode" tabindex="9" value="" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="label"><label for="bill_phone">Phone:</label></td>
|
||||
<td class="field">
|
||||
<input maxlength="14" class="billingRequired phone" name="bill_phone" style="width: 100px" type="text" class="phone" tabindex="10" value="" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">Credit Card Type:</td>
|
||||
<td class="field">
|
||||
<select id="cc_type" class="required" name="cc_type" class="creditCardType" tabindex="11">
|
||||
<option value="">Choose Credit Card</option>
|
||||
<option value="amex">American Express</option>
|
||||
<option value="discover">Discover</option>
|
||||
<option value="mastercard">MasterCard</option>
|
||||
<option value="visa">Visa</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">Expiration:</td>
|
||||
<td class="field">
|
||||
<select id="cc_exp_month" name="cc_exp_month" title="ExpirationMonth" tabindex="12">
|
||||
<option value="01">01 - Jan</option>
|
||||
<option value="02">02 - Feb</option>
|
||||
<option value="03">03 - Mar</option>
|
||||
<option value="04">04 - Apr</option>
|
||||
<option value="05">05 - May</option>
|
||||
<option value="06">06 - Jun</option>
|
||||
<option value="07">07 - Jul</option>
|
||||
<option value="08">08 - Aug</option>
|
||||
<option value="09">09 - Sep</option>
|
||||
<option value="10">10 - Oct</option>
|
||||
<option value="11">11 - Nov</option>
|
||||
<option value="12">12 - Dec</option>
|
||||
</select>
|
||||
<select id="cc_exp_year" name="cc_exp_year" title="ExpirationYear" tabindex="13">
|
||||
<option value="2007">2007</option>
|
||||
<option value="2008" selected="selected">2008</option>
|
||||
<option value="2009">2009</option>
|
||||
<option value="2010">2010</option>
|
||||
<option value="2011">2011</option>
|
||||
<option value="2012">2012</option>
|
||||
<option value="2013">2013</option>
|
||||
<option value="2014">2014</option>
|
||||
<option value="2015">2015</option>
|
||||
<option value="2016">2016</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><label for="credit_card">Credit Card Number:</label></td>
|
||||
<td class="field">
|
||||
<input maxlength="40" id="creditcard" class="required" name="credit_card" size="20" type="text" tabindex="14" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><label for="cc_cvv">Security Code:</label></td>
|
||||
<td class="field">
|
||||
<input id="ccNumber" class="required" maxlength="4" name="cc_cvv" style="width: 30px;" type="text" style="vertical-align: top;" tabindex="16" value="" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>
|
||||
<div class="buttonSubmit">
|
||||
<span></span>
|
||||
<input class="formButton" type="submit" value="Finish" style="width: 180px" />
|
||||
</div><br clear="all"/>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<br clear="all" />
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div> <!-- end main content -->
|
||||
<br />
|
||||
</div> <!-- end col-main -->
|
||||
|
||||
<!-- start left col -->
|
||||
<div id="col-left" class="nav-left-back empty resize" style="position: absolute; min-height: 450px;">
|
||||
<div class="col-left-header-tab" style="position: absolute;">Signup</div>
|
||||
<div class="nav-left">
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="left-nav-callout png" style="top: 15px; margin-bottom: 100px;">
|
||||
<img src="images/left-nav-callout-long.png" class="png" alt="" />
|
||||
<h6>Sign Up Process</h6>
|
||||
<a style="background-image: url(images/step1-24.gif); font-weight: normal; text-decoration: none; cursor: default;">Sign up with a valid credit card.</a>
|
||||
<a style="background-image: url(images/step2-24.gif); font-weight: normal; text-decoration: none; cursor: default;">Connect to your Google AdWords account. You will need your AdWords Customer ID.</a>
|
||||
|
||||
<a target="_blank" style="background-image: url(images/step3-24.gif); font-weight: normal; text-decoration: none; cursor: default;">Start your 30 day trial. No payments until trial ends.</a>
|
||||
</div>
|
||||
|
||||
<div class="footerAddress">
|
||||
<b>Marketo Inc.</b><br />
|
||||
1710 S. Amphlett Blvd.<br />
|
||||
San Mateo, CA 94402 USA<br />
|
||||
</div>
|
||||
<br clear="all"/>
|
||||
</div> <!-- end left col -->
|
||||
|
||||
</div> </div> <!-- end page container 2 divs-->
|
||||
|
||||
<div id="footer-container" align="center">
|
||||
<div class="footer">
|
||||
<ul>
|
||||
<li><a href="..">Home</a></li>
|
||||
<li class="line-off"><a href=".">Back to first step</a></li>
|
||||
</ul>
|
||||
</div></div>
|
||||
|
||||
|
||||
|
||||
<!-- end page wrapper -->
|
||||
</div>
|
||||
|
||||
|
||||
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
_uacct = "UA-2623402-1";
|
||||
urchinTracker();
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
1179
thirdparty/jquery-validate/demo/marketo/stylesheet.css
vendored
@ -1,1179 +0,0 @@
|
||||
:-moz-any-link :focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
:focus {
|
||||
-moz-outline-style: none;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
body {
|
||||
font-size: 80%;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-family: tahoma, geneva, sans-serif;
|
||||
background-color: #000000;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #0653AB;
|
||||
outline: 0px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
outline: 0px;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
img {
|
||||
border: 0px;
|
||||
}
|
||||
|
||||
/* s1.0 - Page Containers */
|
||||
#letterbox {
|
||||
margin: 10px auto;
|
||||
width: 883px;
|
||||
background-color: #364158;
|
||||
border: 8px solid #D4D4D4;
|
||||
padding: 1px 1px 10px 1px;
|
||||
}
|
||||
|
||||
#header-background {
|
||||
background: url(images/back_nav_blue.gif) repeat-x;
|
||||
margin: 0px auto;
|
||||
padding: 0px;
|
||||
height: 73px;
|
||||
width: 883px;
|
||||
border-top: 4px solid #CCEAFE;
|
||||
border-bottom: 4px solid #D4D4D4;
|
||||
}
|
||||
|
||||
#page-container {
|
||||
width: 866px;
|
||||
margin: 0px auto;
|
||||
margin-top: 33px; /* pad from top menu to actions buts*/
|
||||
margin-bottom: -11px;
|
||||
padding-top: 8px;
|
||||
padding-bottom: 8px;
|
||||
background-color: #D4D4D4; /* light grey*/
|
||||
border-right: 1px solid #464646;
|
||||
}
|
||||
|
||||
#page-content-inner {
|
||||
width: 849px;
|
||||
margin: 0px auto;
|
||||
border-top: 1px solid #9F9FA0;
|
||||
border-left: 1px solid #A2A09A;
|
||||
background-color: #F4F1E9;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#page-content-inner #col-left {
|
||||
width: 210px;
|
||||
float: left;
|
||||
background-color: #F4F1E9;
|
||||
}
|
||||
|
||||
#page-content-inner #col-main {
|
||||
width: 639px;
|
||||
background-color: #ffffff;
|
||||
position: absolute;
|
||||
right: 0px;
|
||||
top: 0px;
|
||||
}
|
||||
|
||||
#footer-container {
|
||||
width: 866px;
|
||||
position: relative;
|
||||
left: 8px;
|
||||
padding: 2px 0px 10px 0px;
|
||||
background-color: #D4D4D4; /* light grey*/
|
||||
}
|
||||
|
||||
/* s2.0 - Global navigation bar */
|
||||
.nav-global-container {
|
||||
width: 880px;
|
||||
margin: 0px auto;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
* html .nav-global-container { /* ie6 fix*/
|
||||
margin-bottom: -6px;
|
||||
}
|
||||
|
||||
.login {
|
||||
position: absolute;
|
||||
right: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.login a,.login a span {
|
||||
display: block;
|
||||
height: 18px;
|
||||
font-size: 11px;
|
||||
background: url(images/login-sprite.gif) right -5px no-repeat;
|
||||
text-decoration: none;
|
||||
font-weight: bold;
|
||||
padding: 5px 10px 5px 10px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.login a:hover {
|
||||
color: #000000;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
div.login a span {
|
||||
background-position: left -105px;
|
||||
width: 4px;
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
padding: 5px 0px 5px 0px;;
|
||||
}
|
||||
|
||||
div.login a:hover span {
|
||||
|
||||
}
|
||||
|
||||
.logo {
|
||||
float: left;
|
||||
margin: 0px 0px -5px 0px; /* neg marging for ie6 */
|
||||
}
|
||||
|
||||
.logo img {
|
||||
border: 0px;
|
||||
margin-left: -1px;
|
||||
}
|
||||
|
||||
.nav-global {
|
||||
float: left;
|
||||
width: 645px;
|
||||
margin: 40px 0px 0px 40px;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.nav-global ul {
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.nav-global li {
|
||||
float: left;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
div.nav-global li a,div.nav-global li a span {
|
||||
background-image: url(images/tab-sprite.gif);
|
||||
background-position: right 100px;
|
||||
background-repeat: no-repeat;
|
||||
height: 32px;
|
||||
color: #666666;
|
||||
text-decoration: none;
|
||||
font: bold 16px 'trebuchet ms';
|
||||
margin-right: 15px;
|
||||
display: block;
|
||||
position: relative;
|
||||
padding: 7px 15px 0px 15px;
|
||||
}
|
||||
|
||||
div.nav-global li a:hover {
|
||||
background-position: right 0px;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
div.nav-global li a:hover span {
|
||||
background-position: left -100px;
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
div.nav-global li a span {
|
||||
background-position: left 150px;
|
||||
width: 4px;
|
||||
position: absolute;
|
||||
left: 0px;
|
||||
top: 0px;
|
||||
padding: 7px 0px 0px 0px;
|
||||
}
|
||||
|
||||
body.safari div.nav-global li a span {
|
||||
display: none;
|
||||
}
|
||||
|
||||
div.nav-global li a.on,div.nav-global li a.on:hover {
|
||||
background-position: right -55px;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
div.nav-global li a.on span,div.nav-global li a.on:hover span {
|
||||
background-position: left -155px;
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
div.action-container {
|
||||
position: relative;
|
||||
top: -45px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
div.action-icon-container {
|
||||
position: absolute;
|
||||
top: -17px;
|
||||
left: -17px;
|
||||
z-index: 10;
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
div.action-icon {
|
||||
border: 0px;
|
||||
position: absolute;
|
||||
top: -0px;
|
||||
left: 0px;
|
||||
}
|
||||
|
||||
div.action-button-container {
|
||||
height: 106px;
|
||||
width: 180px;
|
||||
overflow: hidden;
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
z-index: 5;
|
||||
}
|
||||
|
||||
img.action-icon {
|
||||
border: 0px;
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
z-index: 0
|
||||
}
|
||||
|
||||
div.action-text {
|
||||
z-index: 20;
|
||||
color: #FFFFFF;
|
||||
position: absolute;
|
||||
left: 40px;
|
||||
top: 12px;
|
||||
font: 14px tahoma, geneva;
|
||||
padding-top: 30px;
|
||||
}
|
||||
|
||||
div.bigbuttons {
|
||||
top: -20px;
|
||||
}
|
||||
|
||||
div.action-header {
|
||||
z-index: 21;
|
||||
position: absolute;
|
||||
left: 40px;
|
||||
top: 10px;
|
||||
}
|
||||
|
||||
div.action-header b {
|
||||
font: bold 17px tahoma, geneva;
|
||||
display: block;
|
||||
margin-bottom: 10px;
|
||||
color: #0b2c89;
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
width: 130px;
|
||||
}
|
||||
|
||||
div.action-header b.shadow {
|
||||
top: 1px;
|
||||
left: 1px;
|
||||
color: #d5d5d5;
|
||||
}
|
||||
|
||||
img.action-button {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
div.hover img.action-button {
|
||||
top: -131px;
|
||||
}
|
||||
|
||||
div.on img.action-button {
|
||||
top: -261px;
|
||||
}
|
||||
|
||||
/* s3.0 - top of content Action Buttons */
|
||||
.action-buttons {
|
||||
width: 100%; /* ie6 requires */
|
||||
}
|
||||
|
||||
.action-buttons ul {
|
||||
position: relative;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
.action-buttons li {
|
||||
position: relative; /* ie6 fix */
|
||||
float: left;
|
||||
list-style: none;
|
||||
text-align: center;
|
||||
line-height: 16px;
|
||||
margin: -61px 0px 0px 0px;
|
||||
}
|
||||
|
||||
.action-home li {
|
||||
margin: -49px 0px 0px 0px;
|
||||
}
|
||||
|
||||
.action-buttons a {
|
||||
display: block;
|
||||
height: 110px;
|
||||
width: 175px;
|
||||
padding: 14px 0px 0px 25px;
|
||||
text-decoration: none;
|
||||
font-size: 12px;
|
||||
font-weight: bold;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.action-buttons li span {
|
||||
color: #053880;
|
||||
line-height: 47px;
|
||||
font-size: 17px;
|
||||
}
|
||||
|
||||
div.action-bottom {
|
||||
margin: 15px 0px 10px 0px;
|
||||
float: left;
|
||||
}
|
||||
|
||||
div.action-bottom a {
|
||||
height: 61px;
|
||||
width: 178px;
|
||||
border: 0px;
|
||||
background: url(images/action-bottom.gif) no-repeat 0px 0px;
|
||||
color: #0b2c89;
|
||||
float: left;
|
||||
position: relative;
|
||||
font: bold 17px tahoma, geneva;
|
||||
text-decoration: none;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
div.action-bottom a span {
|
||||
position: absolute;
|
||||
top: 15px;
|
||||
left: 40px;
|
||||
}
|
||||
|
||||
div.action-bottom a span.shadow {
|
||||
top: 16px;
|
||||
left: 41px;
|
||||
color: #d4d4d4;
|
||||
}
|
||||
|
||||
.line-grey {
|
||||
background: url(images/line-grey.gif) 0 0 repeat-x;
|
||||
height: 2px;
|
||||
margin: 8px 25px 20px 0;
|
||||
}
|
||||
|
||||
/* s4.0 - Home Hero Area */
|
||||
.hero-background {
|
||||
position: relative;
|
||||
width: 880px;
|
||||
background: url(images/back_home-hero.jpg) 10px 0px no-repeat;
|
||||
height: 211px;
|
||||
margin: -20px 0px 45px 0px;
|
||||
}
|
||||
|
||||
.hero-text {
|
||||
float: right;
|
||||
width: 626px;
|
||||
margin-top: 26px;
|
||||
}
|
||||
|
||||
.hero-text a { /* Sign Up Now Button */
|
||||
padding: 5px 32px 0px 0px;
|
||||
float: right;
|
||||
}
|
||||
|
||||
.hero-text h1 {
|
||||
font-size: 2.3em;
|
||||
line-height: 1.2em;
|
||||
color: #333333;
|
||||
font-family: Trebuchet MS;
|
||||
margin: 12px 0px 10px 10px;
|
||||
}
|
||||
|
||||
.hero-text h2 {
|
||||
margin: 0px;
|
||||
font-weight: normal;
|
||||
font-size: 1.35em;
|
||||
margin: 5px 0px 13px 10px
|
||||
}
|
||||
|
||||
/* s4.1 - Home Left Header tab */
|
||||
.col-left-header-tab {
|
||||
position: relative; /* ie6 fix */
|
||||
background: url(images/tab_green.gif) 0 0 no-repeat;
|
||||
height: 30px;
|
||||
width: 166px;
|
||||
text-align: center;
|
||||
color: #ffffff;
|
||||
font: 20px 'trebuchet ms';
|
||||
padding-top: 2px;
|
||||
margin-top: -41px;
|
||||
margin-left: 20px;
|
||||
line-height: 29px;
|
||||
margin-bottom: 8px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.col-left-header-tab a {
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
.callout-green {
|
||||
background: url(images/back_green-fade.gif) 0 0 repeat-x;
|
||||
font-size: 1.2em;
|
||||
padding: 10px 15px 20px 13px;
|
||||
color: #303B52;
|
||||
line-height: 1.4em;
|
||||
}
|
||||
|
||||
/* s4.2 - Home Left Quote */
|
||||
.callout-tan {
|
||||
color: #666666;
|
||||
}
|
||||
|
||||
.callout-tan h1 {
|
||||
background: #F4F1E9 url(images/back_tan-fade.gif) 0 0 repeat-y;
|
||||
font-size: 1.1em;
|
||||
text-align: center;
|
||||
margin: 0px;
|
||||
padding: 11px 5px 11px 2px;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.callout-tan p {
|
||||
margin: 0px;
|
||||
margin-top: 5px;
|
||||
line-height: 1.4em;
|
||||
padding: 5px 10px 7px 13px;
|
||||
}
|
||||
|
||||
.callout-tan p img {
|
||||
float: left;
|
||||
margin: 5px 10px 5px 0px;
|
||||
}
|
||||
|
||||
.callout-tan div {
|
||||
text-align: left;
|
||||
padding: 5px 10px 7px 0px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/* s4.3 - purple home boxes */
|
||||
.box-purple {
|
||||
background: #C6C8E3 url(images/back_home-icons.png) 0px 0px repeat-x;
|
||||
border-left: 1px solid #ffffff;
|
||||
color: #333333;
|
||||
width: 581px;
|
||||
padding: 10px 15px 20px 15px;
|
||||
}
|
||||
|
||||
div.box-purple a {
|
||||
|
||||
}
|
||||
|
||||
.box-purple h1 {
|
||||
font-size: 1.5em;
|
||||
margin: 10px 0px -15px 0px;
|
||||
}
|
||||
|
||||
.box-purple li {
|
||||
margin: 0px 0px 0px -23px;
|
||||
line-height: 1.6em;
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
.box-purple div {
|
||||
padding: 0px 0px 0px 110px;
|
||||
}
|
||||
|
||||
.icon-text01 {
|
||||
background-image: url(images/icon_search-engine-market.png);
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
* html .icon-text01 {
|
||||
width: 460px; /* must have a width or heigh tag for ie6*/
|
||||
background-image: none;
|
||||
filter: progid : DXImageTransform . Microsoft .
|
||||
AlphaImageLoader(src = "images/icon_search-engine-market.png",
|
||||
sizingMethod = "crop");
|
||||
}
|
||||
|
||||
.icon-text02 {
|
||||
background: url(images/icon_landing-pages.png) 0 0 no-repeat;
|
||||
}
|
||||
|
||||
* html .icon-text02 {
|
||||
width: 460px; /* must have a width or heigh tag for ie6*/
|
||||
background-image: none;
|
||||
filter: progid : DXImageTransform . Microsoft .
|
||||
AlphaImageLoader(src = "images/icon_landing-pages.png", sizingMethod =
|
||||
"crop");
|
||||
}
|
||||
|
||||
.icon-text03 {
|
||||
background: url(images/icon_salesforce.png) 0 0 no-repeat;
|
||||
}
|
||||
|
||||
* html .icon-text03 {
|
||||
width: 460px; /* must have a width or heigh tag for ie6*/
|
||||
background-image: none;
|
||||
filter: progid : DXImageTransform . Microsoft .
|
||||
AlphaImageLoader(src = "images/icon_salesforce.png", sizingMethod =
|
||||
"crop");
|
||||
}
|
||||
|
||||
/* s4.4 - news home boxes */
|
||||
.callout-news {
|
||||
color: #555555;
|
||||
float: left;
|
||||
width: 49%;
|
||||
margin: 10px 1px 0px 0px;
|
||||
padding-bottom: 20px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.line-news-r {
|
||||
border-right: 1px solid #D4D4D4;
|
||||
}
|
||||
|
||||
.callout-news h1 {
|
||||
background-color: #EEEEEE;
|
||||
font-size: 1.2em;
|
||||
margin: 0px;
|
||||
padding: 11px 5px 11px 15px;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.callout-news p {
|
||||
margin: 10px 0px 0px 10px;
|
||||
padding: 0px 10px 7px 20px;
|
||||
background: url(images/news.gif) no-repeat left 1px;
|
||||
}
|
||||
|
||||
.callout-news p a {
|
||||
|
||||
}
|
||||
|
||||
.callout-news ul {
|
||||
list-style-type: none;
|
||||
padding: 0;
|
||||
margin: 10px 0 0 10px;
|
||||
}
|
||||
|
||||
.callout-news li {
|
||||
background: url(images/icon_news.gif) no-repeat left 2px;
|
||||
padding: 0px 5px 5px 20px;
|
||||
}
|
||||
|
||||
.callout-news li a {
|
||||
display: block;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.callout-news div {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
#scrollup {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
height: 440px;
|
||||
width: 200px
|
||||
}
|
||||
|
||||
.headline {
|
||||
position: absolute;
|
||||
top: 600px;
|
||||
left: 5px;
|
||||
height: 585px;
|
||||
width: 190px;
|
||||
font: normal 12px tahoma, geneva !important;
|
||||
}
|
||||
|
||||
div.more {
|
||||
margin: 5px 0px 0px 0px;
|
||||
padding: 0px 10px 0px 0px;
|
||||
letter-spacing: inherit;
|
||||
}
|
||||
|
||||
div.more a {
|
||||
background: transparent url(images/arrow_r-blue.gif) no-repeat right 2px
|
||||
;
|
||||
font-weight: bold;
|
||||
padding: 0px 20px 0px 0px;
|
||||
font-weight: bold;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
div.more a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
/* sX.0 - Left Nav */
|
||||
.nav-left-back {
|
||||
background: url(images/back_nav_side.gif) 0 0 repeat-x;
|
||||
}
|
||||
|
||||
div.empty {
|
||||
background: #F1F0E5 url(images/back_green-fade.gif) 0 0 repeat-x;
|
||||
}
|
||||
|
||||
div.empty div.callout-green {
|
||||
|
||||
}
|
||||
|
||||
.nav-left {
|
||||
padding-top: 12px;
|
||||
/*background: url(images/logo_marketo_square.gif) 0 0 no-repeat;*/
|
||||
width: 210px;
|
||||
}
|
||||
|
||||
.nav-left ul {
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.nav-left li a {
|
||||
display: block;
|
||||
height: 24px;
|
||||
text-decoration: none;
|
||||
font-size: 12px;
|
||||
font-weight: bold;
|
||||
color: #ffffff;
|
||||
border-top: 1px solid #B3D38D;
|
||||
border-bottom: 1px solid #7CA84E;
|
||||
border-left: 1px solid #97B973;
|
||||
padding: 6px 0px 0px 20px;
|
||||
}
|
||||
|
||||
.nav-left a:hover,.nav-left a.active:hover,#nav-left-sub a:hover {
|
||||
color: #4C6F28;
|
||||
background-color: #F4F1E9;
|
||||
}
|
||||
|
||||
.nav-left a.open {
|
||||
background-image: url(images/arrow_d-green.gif);
|
||||
background-repeat: no-repeat;
|
||||
background-position: 6px 11px;
|
||||
}
|
||||
|
||||
.nav-left-header-tab {
|
||||
position: relative; /* ie6 fix */
|
||||
background: url(images/tab_green.gif) 0 0 no-repeat;
|
||||
height: 32px;
|
||||
width: 166px;
|
||||
text-align: center;
|
||||
color: #ffffff;
|
||||
margin: -41px 0px 0px 22px;
|
||||
line-height: 22px;
|
||||
margin-bottom: 8px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
div.empty div.nav-left-header-tab {
|
||||
background: url(images/tab_green2.gif) 0 0 no-repeat;
|
||||
}
|
||||
|
||||
.nav-left a.active {
|
||||
/* background: url(images/arrow_d-green.gif) 5px 10px no-repeat; */
|
||||
display: block;
|
||||
height: 24px;
|
||||
text-decoration: none;
|
||||
font-size: 12px;
|
||||
font-weight: bold;
|
||||
background-color: #F4F1E9;
|
||||
color: #4C6F28;
|
||||
border-top: 1px solid #D1E5BB;
|
||||
border-bottom: 1px solid #B0CB95;
|
||||
border-left: 1px solid #DADADA;
|
||||
padding: 6px 0px 0px 20px;
|
||||
}
|
||||
|
||||
#nav-left-sub a {
|
||||
display: block;
|
||||
height: 24px;
|
||||
text-decoration: none;
|
||||
font-size: 12px;
|
||||
font-weight: bold;
|
||||
background-color: #D6E8C4;
|
||||
color: #4C6F28;
|
||||
border-top: 1px solid #D6E8C4;
|
||||
border-bottom: 1px solid #B0CB95;
|
||||
border-left: 1px solid #97B973;
|
||||
border-right: 1px solid #8DBE5A;
|
||||
padding: 6px 0px 0px 30px;
|
||||
}
|
||||
|
||||
* html #nav-left-sub { /* ie6 fix */
|
||||
margin-top: -1px;
|
||||
}
|
||||
|
||||
*+html #nav-left-sub { /* ie7 fix */
|
||||
margin-top: -1px;
|
||||
}
|
||||
|
||||
#nav-left-sub a.active-page {
|
||||
display: block;
|
||||
height: 24px;
|
||||
text-decoration: none;
|
||||
font-size: 12px;
|
||||
font-weight: bold;
|
||||
background-color: #ffffff;
|
||||
color: #666666;
|
||||
border-top: 0px solid #7CA84E;
|
||||
border-bottom: 1px solid #B0CB95;
|
||||
border-left: 1px solid #97B973;
|
||||
border-right: 0px solid #8DBE5A;
|
||||
padding: 6px 0px 0px 30px;
|
||||
cursor: default; /* turns off hand icon for link */
|
||||
}
|
||||
|
||||
/* sX.0 - Main Content */
|
||||
.main-content {
|
||||
color: #666666;
|
||||
position: absolute;
|
||||
right: 20px;
|
||||
padding-top: 20px;
|
||||
width: 585px;
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
|
||||
div.main-content div.main-content {
|
||||
|
||||
}
|
||||
|
||||
.main-content h1 {
|
||||
color: #5890D1;
|
||||
font-size: 1.9em;
|
||||
font-family: Trebuchet MS;
|
||||
border-bottom: 1px solid #cccccc;
|
||||
margin: 0px 10px 0px 0px;
|
||||
}
|
||||
|
||||
.main-content h2 {
|
||||
color: #666666;
|
||||
font-size: 1.3em;
|
||||
font-weight: normal;
|
||||
margin: 10px 10px 5px 0px;
|
||||
}
|
||||
|
||||
.main-content p {
|
||||
margin: 10px 10px 10px 0px;
|
||||
line-height: 1.55em;
|
||||
}
|
||||
|
||||
/* sX.1 - Main Content Sub Styles */
|
||||
.sub-grey {
|
||||
border-top: 1px solid #D4D4D4;
|
||||
border-bottom: 1px solid #D4D4D4;
|
||||
background-color: #F4F4F4;
|
||||
margin: 10px 10px 0px 0px;
|
||||
padding: 0px 10px 20px 15px;
|
||||
}
|
||||
|
||||
.sub-white {
|
||||
margin: 10px 10px 0px 0px;
|
||||
padding: 0px 10px 20px 15px;
|
||||
}
|
||||
|
||||
img.screen-grab-r {
|
||||
margin-right: -8px;
|
||||
text-align: right;
|
||||
padding: 0px 0px 0px 10px;
|
||||
}
|
||||
|
||||
div.main-content a.screenshot {
|
||||
float: right;
|
||||
padding: 10px 10px 0px 0px
|
||||
}
|
||||
|
||||
.content-foot {
|
||||
border-top: 1px solid #D4D4D4;
|
||||
font-size: .9em;
|
||||
line-height: 1.45em;
|
||||
margin: 10px 20px 0px 0px;
|
||||
padding: 10px 10px 30px 0px;
|
||||
}
|
||||
|
||||
div.main-content ul {
|
||||
position: relative;
|
||||
left: -25px;
|
||||
}
|
||||
|
||||
div.main-content li {
|
||||
margin-bottom: 5px;
|
||||
list-style-type: disc
|
||||
}
|
||||
|
||||
div.main-content li a {
|
||||
color: #6A6CB0;
|
||||
}
|
||||
|
||||
/* sX.0 - Footer */
|
||||
div.footer {
|
||||
color: #666666;
|
||||
font-size: .85em;
|
||||
font-weight: normal;
|
||||
height: 18px;
|
||||
margin: 0px auto;
|
||||
font-family: Tahoma, Geneva, sans-serif;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.footer ul {
|
||||
list-style-type: none;
|
||||
}
|
||||
|
||||
.footer li {
|
||||
float: left;
|
||||
border-right: 1px solid #666666;
|
||||
padding: 0px 7px 0px 7px;
|
||||
margin-top: 3px;
|
||||
}
|
||||
|
||||
.footer a {
|
||||
color: #666666;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.footer a:hover {
|
||||
color: #0653AB;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.footer li.line-off {
|
||||
border-right: 0px solid #ffffff;
|
||||
}
|
||||
|
||||
div.footer strong {
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
/* sX.0 - General Colors */
|
||||
.line-grey,.line-grey-tier {
|
||||
border-top: 1px solid #A3A3A2;
|
||||
}
|
||||
|
||||
.line-grey-tier {
|
||||
padding-bottom: 25px;
|
||||
}
|
||||
|
||||
.bottom {
|
||||
height: 10px;
|
||||
}
|
||||
|
||||
div.p10bottom {
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
.clear {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
table.grid {
|
||||
background: #EEEEEE;
|
||||
}
|
||||
|
||||
table.grid th {
|
||||
background-color: #F4F4F4;
|
||||
}
|
||||
|
||||
table.grid td {
|
||||
background-color: #FFFFFF;
|
||||
}
|
||||
|
||||
div.buttonSubmit {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
div.buttonSubmit input,div.buttonSubmit span {
|
||||
height: 36px;
|
||||
position: relative;
|
||||
background-image: url(images/button-submit.gif);
|
||||
background-repeat: no-repeat;
|
||||
background-position: right 0px;
|
||||
float: left;
|
||||
color: #FFFFFF;
|
||||
font-weight: bold;
|
||||
padding: 0px 15px 2px 15px;
|
||||
margin: 20px 0px 20px 0px;
|
||||
border: 0px;
|
||||
cursor: pointer;
|
||||
z-index: 5;
|
||||
}
|
||||
|
||||
div.buttonSubmit input {
|
||||
width: auto;
|
||||
}
|
||||
|
||||
div.buttonSubmit span {
|
||||
width: 4px;
|
||||
position: absolute;
|
||||
left: 0px;
|
||||
top: 0px;
|
||||
background-position: left -36px;
|
||||
padding: 0px 0px 0px 0px;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
body.safari div.buttonSubmit span {
|
||||
display: none
|
||||
}
|
||||
|
||||
div.buttonSubmitHover input {
|
||||
background-position: right -72px;
|
||||
}
|
||||
|
||||
div.buttonSubmitHover span {
|
||||
background-position: left -108px;
|
||||
}
|
||||
|
||||
a.demoLink {
|
||||
padding: 1px 10px 0px 17px;
|
||||
height: 24px;
|
||||
background: url(images/bullet_triangle_blue.gif) no-repeat 0px 4px;
|
||||
display: block;
|
||||
float: left;
|
||||
}
|
||||
|
||||
div.callout-tan a {
|
||||
background: none;
|
||||
color: #0653AB;
|
||||
margin: auto;
|
||||
display: block;
|
||||
}
|
||||
|
||||
div.callout-tan a:hover {
|
||||
background: none;
|
||||
color: #0653AB;
|
||||
}
|
||||
|
||||
label.error {
|
||||
display: block;
|
||||
color: red;
|
||||
font-style: italic;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
input.error {
|
||||
border: 2px solid red;
|
||||
}
|
||||
|
||||
p.demoBlock {
|
||||
border-bottom: 1px solid #DDDDDD;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
div.left-nav-callout {
|
||||
height: 200px;
|
||||
width: 190px;
|
||||
top: 55px;
|
||||
left: 5px;
|
||||
position: relative;
|
||||
padding-left: 9px;
|
||||
padding-top: 13px;
|
||||
}
|
||||
|
||||
div.left-nav-callout img.png {
|
||||
position: absolute;
|
||||
z-index: 0;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
}
|
||||
|
||||
div.left-nav-callout h6 {
|
||||
font: bold 14px tahoma, geneva;
|
||||
color: #333333;
|
||||
height: 36px;
|
||||
padding-left: 5px;
|
||||
margin: 0px;
|
||||
position: relative;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
div.left-nav-callout a {
|
||||
background: url(images/monitor24.gif) no-repeat 0px center;
|
||||
padding: 5px 0px 5px 30px;
|
||||
display: block;
|
||||
font: bold 12px tahoma, geneva;
|
||||
color: #336699;
|
||||
margin-bottom: 5px;
|
||||
position: relative;
|
||||
z-index: 10;
|
||||
width: 140px;
|
||||
}
|
||||
|
||||
form table td {
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
form table input {
|
||||
width: 200px;
|
||||
padding: 3px;
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
textarea {
|
||||
width: 400px
|
||||
}
|
||||
|
||||
td.label {
|
||||
width: 150px;
|
||||
}
|
||||
|
||||
tr.required td.label {
|
||||
font-weight: bold;
|
||||
background: url(/images/forms/backRequiredGray.gif) no-repeat right
|
||||
center;
|
||||
}
|
||||
|
||||
div.subTableDiv {
|
||||
width: 500px;
|
||||
}
|
||||
|
||||
div.subTableDiv td.label {
|
||||
width: 135px;
|
||||
}
|
||||
|
||||
ul#homeBlog li div.description {
|
||||
display: none;
|
||||
}
|
||||
|
||||
td.field input.error, td.field select.error, tr.errorRow td.field input,tr.errorRow td.field select {
|
||||
border: 2px solid red;
|
||||
background-color: #FFFFD5;
|
||||
margin: 0px;
|
||||
color: red;
|
||||
}
|
||||
|
||||
tr td.field div.formError {
|
||||
display: none;
|
||||
color: #FF0000;
|
||||
}
|
||||
|
||||
tr.errorRow td.field div.formError {
|
||||
display: block;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
div.error {
|
||||
color: red;
|
||||
}
|
||||
|
||||
div.error a {
|
||||
color: #336699;
|
||||
font-size: 12px;
|
||||
text-decoration: underline
|
||||
}
|
||||
|
||||
div.tooltip {
|
||||
position: absolute;
|
||||
left: 30px;
|
||||
bottom: 0px;
|
||||
display: none; /* in case javascript is disabled */
|
||||
width: 170px;
|
||||
background-color: #F4F1E9;
|
||||
z-index: 100;
|
||||
padding: 10px;
|
||||
border: 1px solid #CCCCCC;
|
||||
}
|
||||
|
||||
div.offerbox {
|
||||
width: 125px;
|
||||
float: left;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
div.offerbox h3 {
|
||||
font: bold 17px tahoma, geneva;
|
||||
color: #333333;
|
||||
height: 55px;
|
||||
margin: 0px auto;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
div.offerbox h4 {
|
||||
height: 100px;
|
||||
font: normal 13px tahoma, geneva;
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
div.offerbox h5 {
|
||||
font: bold 14px tahoma, geneva;
|
||||
margin: 0px;
|
||||
height: 55px;
|
||||
}
|
||||
|
||||
div.offerbox h5 small {
|
||||
float: left;
|
||||
font-weight: normal;
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
div.offerbox div.learnmore {
|
||||
padding-left: 25px;
|
||||
}
|
||||
|
||||
div#marketoEditions {
|
||||
background: url(images/buynowBack.gif) no-repeat;
|
||||
width: 584px;
|
||||
height: 376px;
|
||||
float: left;
|
||||
position: relative;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
div.offerHeader {
|
||||
background: #0D8BBD;
|
||||
position: absolute;
|
||||
top: 20px;
|
||||
width: 266px;
|
||||
height: 34px;
|
||||
border: 1px solid #e1e4e2;
|
||||
}
|
||||
|
||||
div.offerHeader span {
|
||||
font: 20px 'trebuchet ms';
|
||||
color: #FFFFFF;
|
||||
position: absolute;
|
||||
left: 0px;
|
||||
top: 0px;
|
||||
}
|
||||
|
||||
div.offerHeader span.shadow {
|
||||
font: 20px 'trebuchet ms';
|
||||
color: #333333;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
div.offerbox div.buttonSubmit {
|
||||
margin: 5px 0px 0px 10px;
|
||||
}
|
||||
|
||||
div.footerAddress {
|
||||
position: absolute;
|
||||
bottom: 30px;
|
||||
left: 20px;
|
||||
color: #666666;
|
||||
font-size: 11px;
|
||||
display: none;
|
||||
}
|
BIN
thirdparty/jquery-validate/demo/milk/bg.gif
vendored
Before Width: | Height: | Size: 73 B |
10
thirdparty/jquery-validate/demo/milk/emails.php
vendored
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
$request = trim(strtolower($_REQUEST['email']));
|
||||
$emails = array('glen@marketo.com', 'george@bush.gov', 'me@god.com', 'aboutface@cooper.com', 'steam@valve.com', 'bill@gates.com');
|
||||
$valid = 'true';
|
||||
foreach($emails as $email) {
|
||||
if( strtolower($email) == $request )
|
||||
$valid = '"Thats already taken."';
|
||||
}
|
||||
echo $valid;
|
||||
?>
|
10
thirdparty/jquery-validate/demo/milk/emails.phps
vendored
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
$request = trim(strtolower($_REQUEST['value']));
|
||||
$emails = array('glen@marketo.com', 'george@bush.gov', 'me@god.com', 'aboutface@cooper.com', 'steam@valve.com', 'bill@gates.com');
|
||||
$valid = 'true';
|
||||
foreach($emails as $email) {
|
||||
if( strtolower($email) == $request )
|
||||
$valid = 'false';
|
||||
}
|
||||
echo $valid;
|
||||
?>
|
235
thirdparty/jquery-validate/demo/milk/index.html
vendored
@ -1,235 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
|
||||
<title>Remember The Milk signup form - jQuery Validate plugin demo - with friendly permission from the RTM team</title>
|
||||
|
||||
<link rel="stylesheet" type="text/css" media="screen" href="milk.css" />
|
||||
<link rel="stylesheet" type="text/css" media="screen" href="../css/chili.css" />
|
||||
|
||||
<script src="../../lib/jquery.js" type="text/javascript"></script>
|
||||
<script src="../../jquery.validate.js" type="text/javascript"></script>
|
||||
|
||||
<style type="text/css">
|
||||
pre { text-align: left; }
|
||||
</style>
|
||||
|
||||
<script id="demo" type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
// validate signup form on keyup and submit
|
||||
var validator = $("#signupform").validate({
|
||||
rules: {
|
||||
firstname: "required",
|
||||
lastname: "required",
|
||||
username: {
|
||||
required: true,
|
||||
minlength: 2,
|
||||
remote: "users.php"
|
||||
},
|
||||
password: {
|
||||
required: true,
|
||||
minlength: 5
|
||||
},
|
||||
password_confirm: {
|
||||
required: true,
|
||||
minlength: 5,
|
||||
equalTo: "#password"
|
||||
},
|
||||
email: {
|
||||
required: true,
|
||||
email: true,
|
||||
remote: "emails.php"
|
||||
},
|
||||
dateformat: "required",
|
||||
terms: "required"
|
||||
},
|
||||
messages: {
|
||||
firstname: "Enter your firstname",
|
||||
lastname: "Enter your lastname",
|
||||
username: {
|
||||
required: "Enter a username",
|
||||
minlength: jQuery.format("Enter at least {0} characters"),
|
||||
remote: jQuery.format("{0} is already in use")
|
||||
},
|
||||
password: {
|
||||
required: "Provide a password",
|
||||
rangelength: jQuery.format("Enter at least {0} characters")
|
||||
},
|
||||
password_confirm: {
|
||||
required: "Repeat your password",
|
||||
minlength: jQuery.format("Enter at least {0} characters"),
|
||||
equalTo: "Enter the same password as above"
|
||||
},
|
||||
email: {
|
||||
required: "Please enter a valid email address",
|
||||
minlength: "Please enter a valid email address",
|
||||
remote: jQuery.format("{0} is already in use")
|
||||
},
|
||||
dateformat: "Choose your preferred dateformat",
|
||||
terms: " "
|
||||
},
|
||||
// the errorPlacement has to take the table layout into account
|
||||
errorPlacement: function(error, element) {
|
||||
if ( element.is(":radio") )
|
||||
error.appendTo( element.parent().next().next() );
|
||||
else if ( element.is(":checkbox") )
|
||||
error.appendTo ( element.next() );
|
||||
else
|
||||
error.appendTo( element.parent().next() );
|
||||
},
|
||||
// specifying a submitHandler prevents the default submit, good for the demo
|
||||
submitHandler: function() {
|
||||
alert("submitted!");
|
||||
},
|
||||
// set this class to error-labels to indicate valid fields
|
||||
success: function(label) {
|
||||
// set as text for IE
|
||||
label.html(" ").addClass("checked");
|
||||
}
|
||||
});
|
||||
|
||||
// propose username by combining first- and lastname
|
||||
$("#username").focus(function() {
|
||||
var firstname = $("#firstname").val();
|
||||
var lastname = $("#lastname").val();
|
||||
if(firstname && lastname && !this.value) {
|
||||
this.value = firstname + "." + lastname;
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1 id="banner"><a href="http://bassistance.de/jquery-plugins/jquery-plugin-validation/">jQuery Validation Plugin</a> Demo</h1>
|
||||
<div id="main">
|
||||
|
||||
<div id="content">
|
||||
|
||||
<div id="header">
|
||||
<div id="headerlogo"><img src="milk.png" alt="Remember The Milk" /></div>
|
||||
</div>
|
||||
<div style="clear: both;"><div></div></div>
|
||||
|
||||
|
||||
<div class="content">
|
||||
<div id="signupbox">
|
||||
<div id="signuptab">
|
||||
<ul>
|
||||
<li id="signupcurrent"><a href=" ">Signup</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="signupwrap">
|
||||
<form id="signupform" autocomplete="off" method="get" action="">
|
||||
<table>
|
||||
<tr>
|
||||
<td class="label"><label id="lfirstname" for="firstname">First Name</label></td>
|
||||
<td class="field"><input id="firstname" name="firstname" type="text" value="" maxlength="100" /></td>
|
||||
<td class="status"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><label id="llastname" for="lastname">Last Name</label></td>
|
||||
<td class="field"><input id="lastname" name="lastname" type="text" value="" maxlength="100" /></td>
|
||||
<td class="status"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><label id="lusername" for="username">Username</label></td>
|
||||
<td class="field"><input id="username" name="username" type="text" value="" maxlength="50" /></td>
|
||||
<td class="status"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><label id="lpassword" for="password">Password</label></td>
|
||||
<td class="field"><input id="password" name="password" type="password" maxlength="50" value="" /></td>
|
||||
<td class="status"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><label id="lpassword_confirm" for="password_confirm">Confirm Password</label></td>
|
||||
<td class="field"><input id="password_confirm" name="password_confirm" type="password" maxlength="50" value="" /></td>
|
||||
<td class="status"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><label id="lemail" for="email">Email Address</label></td>
|
||||
<td class="field"><input id="email" name="email" type="text" value="" maxlength="150" /></td>
|
||||
<td class="status"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><label>Which Looks Right</label></td>
|
||||
<td class="field" colspan="2" style="vertical-align: top; padding-top: 2px;">
|
||||
<table>
|
||||
<tbody>
|
||||
|
||||
<tr>
|
||||
<td style="padding-right: 5px;">
|
||||
<input id="dateformat_eu" name="dateformat" type="radio" value="0" />
|
||||
<label id="ldateformat_eu" for="dateformat_eu">14/02/07</label>
|
||||
</td>
|
||||
<td style="padding-left: 5px;">
|
||||
<input id="dateformat_am" name="dateformat" type="radio" value="1" />
|
||||
<label id="ldateformat_am" for="dateformat_am">02/14/07</label>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="label"> </td>
|
||||
<td class="field" colspan="2">
|
||||
<div id="termswrap">
|
||||
<input id="terms" type="checkbox" name="terms" />
|
||||
<label id="lterms" for="terms">I have read and accept the Terms of Use.</label>
|
||||
</div> <!-- /termswrap -->
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label"><label id="lsignupsubmit" for="signupsubmit">Signup</label></td>
|
||||
<td class="field" colspan="2">
|
||||
<input id="signupsubmit" name="signup" type="submit" value="Signup" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
_uacct = "UA-2623402-1";
|
||||
urchinTracker();
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$("<a href='#'>Show script used on this page</a><br/>").appendTo("body").click(function() {
|
||||
script.toggle();
|
||||
return false;
|
||||
});
|
||||
$("<a href='#'>Show serverside script</a>").appendTo("body").click(function() {
|
||||
serverscript.toggle();
|
||||
return false;
|
||||
});
|
||||
var script = $("<code class='mix'>").html( $("#demo").html() ).wrap("<pre></pre>").parent().hide().appendTo("body");
|
||||
var serverscript;
|
||||
$.get("users.phps", function(response) {
|
||||
serverscript = $("<pre>").hide().html( response ).appendTo("body");
|
||||
})
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
<script src="../js/chili-1.7.pack.js" type="text/javascript"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
BIN
thirdparty/jquery-validate/demo/milk/left_white.png
vendored
Before Width: | Height: | Size: 538 B |
236
thirdparty/jquery-validate/demo/milk/milk.css
vendored
@ -1,236 +0,0 @@
|
||||
/* GENERAL ELEMENTS */
|
||||
|
||||
* { margin: 0; padding: 0; }
|
||||
|
||||
body, input, select, textarea { font-family: verdana, arial, helvetica, sans-serif; font-size: 11px; }
|
||||
body { color: #333; background-color: #fff; text-align: center; }
|
||||
|
||||
a:link { color:#0060BF; text-decoration: underline; }
|
||||
a:visited { color:#0060BF; text-decoration: underline; }
|
||||
a:active { color:#0060BF; text-decoration: underline; }
|
||||
a:hover { color:#000000; text-decoration: underline; }
|
||||
|
||||
h1, h2, h3, h4, h5, h6 { font-family: "Lucida Grande", "Lucida Sans Unicode", geneva, verdana, arial, helvetica, sans-serif; font-weight: bold; color: #666; }
|
||||
h1 { font-size: 1.8em; margin: 0em 0em 0.6em 0em; color: #EC5800; }
|
||||
h2 { font-size: 1.5em; margin: 1.2em 0em 0.4em 0em; }
|
||||
h3 { font-size: 1.4em; margin: 1.2em 0em 0.4em 0em; color: #EC5800; }
|
||||
h4 { font-size: 1.2em; margin: 1.2em 0em 0.4em 0em; }
|
||||
h5 { font-size: 1.0em; margin: 1.2em 0em 0.4em 0em; }
|
||||
h6 { font-size: 0.8em; margin: 1.2em 0em 0.4em 0em; }
|
||||
|
||||
img { border: 0px; }
|
||||
|
||||
p { font-size: 1.0em; line-height: 1.3em; margin: 1.2em 0em 1.2em 0em; }
|
||||
li > p { margin-top: 0.2em; }
|
||||
pre { font-family: monospace; font-size: 1.0em; }
|
||||
strong, b { font-weight: bold; }
|
||||
|
||||
/* PAGE ELEMENTS */
|
||||
|
||||
/* Content */
|
||||
|
||||
#content { margin: 0em auto; width: 765px; padding: 10px 0 10px 0; text-align: left; /* Win IE5 */ }
|
||||
.content { margin-left: 4.5em; margin-right: 4.5em; }
|
||||
.content ol, .content ul, .content li { font-size: 1.0em; line-height: 1.3em; margin: 0.2em 0 0.1em 1.5em; }
|
||||
.content ol.terms li { margin-bottom: 1em; }
|
||||
|
||||
/* Header */
|
||||
|
||||
#header { padding-bottom: 10em; }
|
||||
#headerlogo { float: left; }
|
||||
#headerlogo img { width: 188px; height: 83px; }
|
||||
#headernav { float: right; }
|
||||
|
||||
label { font-weight: bold; }
|
||||
#reminders label { font-weight: normal; }
|
||||
|
||||
table.tabbedtable { padding-left: 3em; }
|
||||
table.tabbedtable td { padding-bottom: 5px; }
|
||||
table.tabbedtable label { text-align: right; padding-right: 9px; }
|
||||
.hiddenlabel { visibility: hidden; }
|
||||
.largelink { border: 1px solid #cacaca; padding: 10px; background-color: #E8EEF7; font-size: 1.2em; font-weight: bold; }
|
||||
.largelinkwrap { padding-top: 10px; padding-bottom: 10px; }
|
||||
|
||||
|
||||
|
||||
#signuptab {
|
||||
float:left;
|
||||
width:100%;
|
||||
background:#fff url("bg.gif") repeat-x bottom;
|
||||
font-size: 1.0em;
|
||||
line-height: normal;
|
||||
}
|
||||
#signuptab ul {
|
||||
margin:0;
|
||||
padding: 0px 10px 0px 10px;
|
||||
list-style:none;
|
||||
}
|
||||
#signuptab li {
|
||||
float:left;
|
||||
background:url("left_white.png") no-repeat left top;
|
||||
margin:0;
|
||||
padding:0 3px 0 9px;
|
||||
border-bottom:1px solid #CACACA;
|
||||
}
|
||||
#signuptab a {
|
||||
float:left;
|
||||
display:block;
|
||||
width:.1em;
|
||||
background:url("right_white.png") no-repeat right top;
|
||||
padding:2px 15px 0px 6px;
|
||||
text-decoration:none;
|
||||
font-weight:bold;
|
||||
color:#fff;
|
||||
white-space: nowrap;
|
||||
}
|
||||
#signuptab > ul a {width:auto;}
|
||||
/* Commented Backslash Hack hides rule from IE5-Mac \*/
|
||||
#signuptab a {float:none;}
|
||||
/* End IE5-Mac hack */
|
||||
#signuptab a:hover {
|
||||
color:#333;
|
||||
}
|
||||
#signuptab #signupcurrent {
|
||||
background-position:0 -150px;
|
||||
border-width:0;
|
||||
}
|
||||
#signuptab #signupcurrent a {
|
||||
background-position:100% -150px;
|
||||
padding-bottom:1px;
|
||||
color:#000;
|
||||
}
|
||||
#signuptab li:hover, #signuptab li:hover a {
|
||||
background-position:0% -150px;
|
||||
color:#000;
|
||||
}
|
||||
#signuptab li:hover a {
|
||||
background-position:100% -150px;
|
||||
}
|
||||
|
||||
/* Signup box */
|
||||
|
||||
#signupbox {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
margin: 0em auto;
|
||||
}
|
||||
|
||||
#signupwrap {
|
||||
border: 1px solid #CACACA;
|
||||
border-top: 0;
|
||||
text-align: left;
|
||||
padding: 35px 10px 20px 30px;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
/* Unsupported browsers */
|
||||
|
||||
.orange_rbcontent { padding: 0.4em; }
|
||||
.orange_rbroundbox { width: 100%; }
|
||||
|
||||
#unsupported {
|
||||
font-weight: bold;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
/*#content {
|
||||
padding-top: 15px;
|
||||
}*/
|
||||
|
||||
/* Signup form */
|
||||
|
||||
#signupform table {
|
||||
border-spacing: 0px;
|
||||
border-collapse: collapse;
|
||||
empty-cells: show;
|
||||
}
|
||||
|
||||
#signupform .label {
|
||||
padding-top: 2px;
|
||||
padding-right: 8px;
|
||||
vertical-align: top;
|
||||
text-align: right;
|
||||
width: 125px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
#signupform .field {
|
||||
padding-bottom: 10px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
#signupform .status {
|
||||
padding-top: 2px;
|
||||
padding-left: 8px;
|
||||
vertical-align: top;
|
||||
width: 246px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
#signupform .textfield {
|
||||
width: 150px;
|
||||
}
|
||||
|
||||
#signupform label.error {
|
||||
background:url("../images/unchecked.gif") no-repeat 0px 0px;
|
||||
padding-left: 16px;
|
||||
padding-bottom: 2px;
|
||||
font-weight: bold;
|
||||
color: #EA5200;
|
||||
}
|
||||
|
||||
#signupform label.checked {
|
||||
background:url("../images/checked.gif") no-repeat 0px 0px;
|
||||
}
|
||||
|
||||
#signupform .success_msg {
|
||||
font-weight: bold;
|
||||
color: #0060BF;
|
||||
margin-left: 19px;
|
||||
}
|
||||
|
||||
#signupform #dateformatStatus, #signupform #termsStatus {
|
||||
margin-left: 6px;
|
||||
}
|
||||
|
||||
#signupform #dateformat_eu {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
#signupform #ldateformat_eu {
|
||||
font-weight: normal;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
#signupform #dateformat_am {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
#signupform #ldateformat_am {
|
||||
font-weight: normal;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
#signupform #termswrap {
|
||||
float: left;
|
||||
}
|
||||
|
||||
#signupform #terms {
|
||||
vertical-align: middle;
|
||||
float: left;
|
||||
display: block;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
#signupform #lterms {
|
||||
font-weight: normal;
|
||||
vertical-align: middle;
|
||||
float: left;
|
||||
display: block;
|
||||
width: 350px;
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
#signupform #lsignupsubmit {
|
||||
visibility: hidden;
|
||||
}
|
BIN
thirdparty/jquery-validate/demo/milk/milk.png
vendored
Before Width: | Height: | Size: 5.0 KiB |
BIN
thirdparty/jquery-validate/demo/milk/right_white.png
vendored
Before Width: | Height: | Size: 1.5 KiB |
12
thirdparty/jquery-validate/demo/milk/users.php
vendored
@ -1,12 +0,0 @@
|
||||
<?php
|
||||
$request = trim(strtolower($_REQUEST['username']));
|
||||
//sleep(2);
|
||||
usleep(150000);
|
||||
$users = array('asdf', 'Peter', 'Peter2', 'George');
|
||||
$valid = 'true';
|
||||
foreach($users as $user) {
|
||||
if( strtolower($user) == $request )
|
||||
$valid = 'false';
|
||||
}
|
||||
echo $valid;
|
||||
?>
|
10
thirdparty/jquery-validate/demo/milk/users.phps
vendored
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
$request = trim(strtolower($_REQUEST['value']));
|
||||
$users = array('asdf', 'Peter', 'Peter2', 'George');
|
||||
$valid = 'true';
|
||||
foreach($users as $user) {
|
||||
if( strtolower($user) == $request )
|
||||
$valid = 'false';
|
||||
}
|
||||
echo $valid;
|
||||
?>
|
412
thirdparty/jquery-validate/demo/multipart/index.html
vendored
@ -1,412 +0,0 @@
|
||||
<!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" lang="en">
|
||||
<head>
|
||||
|
||||
<title>jQuery accordion form with validation</title>
|
||||
|
||||
<link rel="stylesheet" href="../assets/demo_blue.css" type="text/css" />
|
||||
|
||||
<script type="text/javascript" src="../../lib/jquery.js"></script>
|
||||
<script type="text/javascript" src="../../jquery.validate.js"></script>
|
||||
<script type="text/javascript" src="js/jquery.maskedinput-1.0.js"></script>
|
||||
<script type="text/javascript" src="js/ui.core.js"></script>
|
||||
<script type="text/javascript" src="js/ui.accordion.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
|
||||
$("#recordClientPhone").mask("(999) 999-9999");
|
||||
$("#recordClientPhoneAlt").mask("(999) 999-9999");
|
||||
$("#recordClientZip").mask("99999");
|
||||
$("#recordPropertyZip").mask("99999");
|
||||
$("#recordPurchaseZip").mask("99999");
|
||||
|
||||
// add * to required field labels
|
||||
$('label.required').append(' <strong>*</strong> ');
|
||||
|
||||
// accordion functions
|
||||
var accordion = $("#stepForm").accordion();
|
||||
var current = 0;
|
||||
|
||||
$.validator.addMethod("pageRequired", function(value, element) {
|
||||
var $element = $(element)
|
||||
function match(index) {
|
||||
return current == index && $(element).parents("#sf" + (index + 1)).length;
|
||||
}
|
||||
if (match(0) || match(1) || match(2)) {
|
||||
return !this.optional(element);
|
||||
}
|
||||
return "dependency-mismatch";
|
||||
}, $.validator.messages.required)
|
||||
|
||||
var v = $("#cmaForm").validate({
|
||||
errorClass: "warning",
|
||||
onkeyup: false,
|
||||
onblur: false,
|
||||
submitHandler: function() {
|
||||
alert("Submitted, thanks!");
|
||||
}
|
||||
});
|
||||
|
||||
// back buttons do not need to run validation
|
||||
$("#sf2 .prevbutton").click(function(){
|
||||
accordion.accordion("activate", 0);
|
||||
current = 0;
|
||||
});
|
||||
$("#sf3 .prevbutton").click(function(){
|
||||
accordion.accordion("activate", 1);
|
||||
current = 1;
|
||||
});
|
||||
// these buttons all run the validation, overridden by specific targets above
|
||||
$(".open2").click(function() {
|
||||
if (v.form()) {
|
||||
accordion.accordion("activate", 2);
|
||||
current = 2;
|
||||
}
|
||||
});
|
||||
$(".open1").click(function() {
|
||||
if (v.form()) {
|
||||
accordion.accordion("activate", 1);
|
||||
current = 1;
|
||||
}
|
||||
});
|
||||
$(".open0").click(function() {
|
||||
if (v.form()) {
|
||||
accordion.accordion("activate", 0);
|
||||
current = 0;
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
<link rel="stylesheet" type="text/css" media="screen" href="style.css" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="wrap">
|
||||
<div id="main">
|
||||
|
||||
<h1 class="top bottom"><span>Help me</span> Buy and Sell a House</h1>
|
||||
<h2>This form is quick & easy to complete - in only 3 steps!</h2>
|
||||
<form name="cmaForm" id="cmaForm" method="post">
|
||||
<input type="hidden" name="recordRequestPrimaryServiceID" id="recordRequestPrimaryServiceID" value="100" />
|
||||
<input type="hidden" name="recordClientServices" id="recordClientServices" value="1,3" />
|
||||
<ul id="stepForm" class="ui-accordion-container">
|
||||
<li id="sf1"><a href='#' class="ui-accordion-link"> </a>
|
||||
<div>
|
||||
<fieldset><legend> Step 1 of 3 </legend>
|
||||
<div class="requiredNotice">*Required Field</div>
|
||||
<h3 class="stepHeader">Tell us about the property you're buying</h3>
|
||||
<label for="recordPurchaseMetRealtor" class="input required">Are you currently working with a<br />
|
||||
real estate agent? </label> No: <input name="recordPurchaseMetRealtor" type="radio" checked="checked" class="inputclass" value="0" /> Yes: <input name="recordPurchaseMetRealtor" type="radio" class="inputclass pageRequired" value="1" title="Please choose Yes or No" />
|
||||
<div class="formspacer"></div>
|
||||
<label for="recordPurchaseTimeFrameID" class="input required">When would you like to move?</label> <select name="recordPurchaseTimeFrameID" id="recordPurchaseTimeFrameID" class="inputclass pageRequired" title="Select a Time Frame">
|
||||
<option value="">-Select-</option>
|
||||
<option value="1">Less than 3 months</option>
|
||||
<option value="2">3-6 months</option>
|
||||
<option value="3">6-9 months</option>
|
||||
<option value="4">9-12 months</option>
|
||||
<option value="5">Over 12 months</option>
|
||||
</select> <br />
|
||||
<label for="recordPurchasePriceRangeID" class="input required">Purchase price range:</label> <select name="recordPurchasePriceRangeID" id="recordPurchasePriceRangeID" class="inputclass pageRequired" title="Select a Price Range">
|
||||
<option value="">-Select-</option>
|
||||
<option value="1"></option>
|
||||
<option value="2">$75,000 - $100,000</option>
|
||||
<option value="3">$100,000 - $125,000</option>
|
||||
<option value="4">$125,000 - $150,000</option>
|
||||
<option value="5">$150,000 - $200,000</option>
|
||||
<option value="6">$200,000 - $250,000</option>
|
||||
<option value="7">$250,000 - $300,000</option>
|
||||
<option value="8">$300,000 - $350,000</option>
|
||||
<option value="9">$350,000 - $400,000</option>
|
||||
<option value="10">$400,000 - $500,000</option>
|
||||
<option value="11">$500,000 - $700,000</option>
|
||||
<option value="12">$700,000 - $900,000</option>
|
||||
<option value="13">> $900,000</option>
|
||||
</select> <br />
|
||||
<label for="recordPurchaseState" class="input required">State:</label> <select name="recordPurchaseState" id="recordPurchaseState" class="inputclass pageRequired" title="Select a State">
|
||||
<option value="">-Select-</option>
|
||||
<option value="AL">Alabama</option>
|
||||
<option value="AK">Alaska</option>
|
||||
<option value="AZ">Arizona</option>
|
||||
<option value="AR">Arkansas</option>
|
||||
<option value="CA">California</option>
|
||||
<option value="CO">Colorado</option>
|
||||
<option value="CT">Connecticut</option>
|
||||
<option value="DE">Delaware</option>
|
||||
<option value="DC">Dist of Columbia</option>
|
||||
<option value="FL">Florida</option>
|
||||
<option value="GA">Georgia</option>
|
||||
<option value="HI">Hawaii</option>
|
||||
<option value="ID">Idaho</option>
|
||||
<option value="IL">Illinois</option>
|
||||
<option value="IN">Indiana</option>
|
||||
<option value="IA">Iowa</option>
|
||||
<option value="KS">Kansas</option>
|
||||
<option value="KY">Kentucky</option>
|
||||
<option value="LA">Louisiana</option>
|
||||
<option value="ME">Maine</option>
|
||||
<option value="MD">Maryland</option>
|
||||
<option value="MA">Massachusetts</option>
|
||||
<option value="MI">Michigan</option>
|
||||
<option value="MN">Minnesota</option>
|
||||
<option value="MS">Mississippi</option>
|
||||
<option value="MO">Missouri</option>
|
||||
<option value="MT">Montana</option>
|
||||
<option value="NE">Nebraska</option>
|
||||
<option value="NV">Nevada</option>
|
||||
<option value="NH">New Hampshire</option>
|
||||
<option value="NJ">New Jersey</option>
|
||||
<option value="NM">New Mexico</option>
|
||||
<option value="NY">New York</option>
|
||||
<option value="NC">North Carolina</option>
|
||||
<option value="ND">North Dakota</option>
|
||||
<option value="OH">Ohio</option>
|
||||
<option value="OK">Oklahoma</option>
|
||||
<option value="OR">Oregon</option>
|
||||
<option value="PA" selected="selected">Pennsylvania</option>
|
||||
<option value="RI">Rhode Island</option>
|
||||
<option value="SC">South Carolina</option>
|
||||
<option value="SD">South Dakota</option>
|
||||
<option value="TN">Tennessee</option>
|
||||
<option value="TX">Texas</option>
|
||||
<option value="UT">Utah</option>
|
||||
<option value="VT">Vermont</option>
|
||||
<option value="VA">Virginia</option>
|
||||
<option value="WA">Washington</option>
|
||||
<option value="WV">West Virginia</option>
|
||||
<option value="WI">Wisconsin</option>
|
||||
<option value="WY">Wyoming</option>
|
||||
</select> <br />
|
||||
|
||||
<label for="recordPurchasePropertyTypeID" class="input">Desired property type:</label> <select name="recordPurchasePropertyTypeID" id="recordPurchasePropertyTypeID" class="inputclass" title="Select a Property Type">
|
||||
<option value="">-Select-</option>
|
||||
<option value="1">Single Family Detached</option>
|
||||
<option value="2">Condo</option>
|
||||
<option value="3">Townhouse</option>
|
||||
<option value="4">Rental</option>
|
||||
<option value="5">Multi-Family</option>
|
||||
<option value="6">Vacation Home</option>
|
||||
<option value="7">Other</option>
|
||||
</select> <br />
|
||||
<div class="buttonWrapper"><input name="formNext1" type="button" class="open1 nextbutton" value="Next" alt="Next" title="Next" /></div>
|
||||
</fieldset>
|
||||
</div>
|
||||
</li>
|
||||
<li id="sf2">
|
||||
<a href='#' class="ui-accordion-link">
|
||||
</a>
|
||||
<div>
|
||||
<fieldset><legend> Step 2 of 3 </legend>
|
||||
<div class="requiredNotice">*Required Field</div>
|
||||
<h3 class="stepHeader">Tell us about the property you're selling</h3>
|
||||
<label for="recordClientTimeFrameID" class="input required">When would you like to sell?</label> <select name="recordClientTimeFrameID" id="recordClientTimeFrameID" class="inputclass pageRequired" title="Select a Time Frame">
|
||||
<option value="">-Select-</option>
|
||||
<option value="1">Less than 3 months</option>
|
||||
<option value="2">3-6 months</option>
|
||||
<option value="3">6-9 months</option>
|
||||
<option value="4">9-12 months</option>
|
||||
<option value="5">Over 12 months</option>
|
||||
</select> <br />
|
||||
<label for="recordClientHomeTypeID" class="input required">Type of property you are selling:</label> <select name="recordClientHomeTypeID" id="recordClientHomeTypeID" class="inputclass pageRequired" title="Select a Property Type">
|
||||
<option value="">-Select-</option>
|
||||
<option value="1">Single Family Detached</option>
|
||||
<option value="2">Condo</option>
|
||||
<option value="3">Townhouse</option>
|
||||
<option value="4">Rental</option>
|
||||
<option value="5">Multi-Family</option>
|
||||
<option value="6">Vacation Home</option>
|
||||
<option value="7">Other</option>
|
||||
</select> <br />
|
||||
<label for="recordPropertyAddress1" class="input required">Property Street Address:</label> <input name="recordPropertyAddress1" id="recordPropertyAddress1" class="inputclass pageRequired" title="Street Address is required" maxlength="254" onblur="recordClientAddress1.value = this.value" /><br />
|
||||
<label for="recordPropertyAddress2" class="input">Address (2):</label> <input name="recordPropertyAddress2" id="recordPropertyAddress2" class="inputclass" maxlength="254" onblur="recordClientAddress2.value = this.value" /><br />
|
||||
<label for="recordPropertyCity" class="input required">City:</label> <input name="recordPropertyCity" id="recordPropertyCity" class="inputclass pageRequired" title="City is required" maxlength="254" onblur="recordClientCity.value = this.value" /><br />
|
||||
<label for="recordPropertyState" class="input required">State:</label> <select name="recordPropertyState" id="recordPropertyState" class="inputclass pageRequired" title="Select a State" onchange="recordClientState.value = this.value">
|
||||
<option value="">-Select-</option>
|
||||
<option value="AL">Alabama</option>
|
||||
<option value="AK">Alaska</option>
|
||||
<option value="AZ">Arizona</option>
|
||||
<option value="AR">Arkansas</option>
|
||||
<option value="CA">California</option>
|
||||
<option value="CO">Colorado</option>
|
||||
<option value="CT">Connecticut</option>
|
||||
<option value="DE">Delaware</option>
|
||||
<option value="DC">Dist of Columbia</option>
|
||||
<option value="FL">Florida</option>
|
||||
<option value="GA">Georgia</option>
|
||||
<option value="HI">Hawaii</option>
|
||||
<option value="ID">Idaho</option>
|
||||
<option value="IL">Illinois</option>
|
||||
<option value="IN">Indiana</option>
|
||||
<option value="IA">Iowa</option>
|
||||
<option value="KS">Kansas</option>
|
||||
<option value="KY">Kentucky</option>
|
||||
<option value="LA">Louisiana</option>
|
||||
<option value="ME">Maine</option>
|
||||
<option value="MD">Maryland</option>
|
||||
<option value="MA">Massachusetts</option>
|
||||
<option value="MI">Michigan</option>
|
||||
<option value="MN">Minnesota</option>
|
||||
<option value="MS">Mississippi</option>
|
||||
<option value="MO">Missouri</option>
|
||||
<option value="MT">Montana</option>
|
||||
<option value="NE">Nebraska</option>
|
||||
<option value="NV">Nevada</option>
|
||||
<option value="NH">New Hampshire</option>
|
||||
<option value="NJ">New Jersey</option>
|
||||
<option value="NM">New Mexico</option>
|
||||
<option value="NY">New York</option>
|
||||
<option value="NC">North Carolina</option>
|
||||
<option value="ND">North Dakota</option>
|
||||
<option value="OH">Ohio</option>
|
||||
<option value="OK">Oklahoma</option>
|
||||
<option value="OR">Oregon</option>
|
||||
<option value="PA" selected="selected">Pennsylvania</option>
|
||||
<option value="RI">Rhode Island</option>
|
||||
<option value="SC">South Carolina</option>
|
||||
<option value="SD">South Dakota</option>
|
||||
<option value="TN">Tennessee</option>
|
||||
<option value="TX">Texas</option>
|
||||
<option value="UT">Utah</option>
|
||||
<option value="VT">Vermont</option>
|
||||
<option value="VA">Virginia</option>
|
||||
<option value="WA">Washington</option>
|
||||
<option value="WV">West Virginia</option>
|
||||
<option value="WI">Wisconsin</option>
|
||||
<option value="WY">Wyoming</option>
|
||||
</select> <br />
|
||||
<label for="recordPropertyZip" class="input required">Zip:</label> <input name="recordPropertyZip" id="recordPropertyZip" class="inputclass pageRequired" title="Zip Code is required" maxlength="254" onblur="recordClientZip.value = this.value" /><br />
|
||||
|
||||
<label for="recordClientPropertyValueID" class="input required">Estimated Market Value:</label> <select name="recordClientPropertyValueID" id="recordClientPropertyValueID" class="inputclass pageRequired" title="Select a Price Range">
|
||||
<option value="">-Select-</option>
|
||||
<option value="1">Less Than $75K</option>
|
||||
<option value="2">$75-$100K</option>
|
||||
<option value="3">$100-$125K</option>
|
||||
<option value="4">$125-$150K</option>
|
||||
<option value="5">$150-$200K</option>
|
||||
<option value="6">$200-$250K</option>
|
||||
<option value="7">$250-$300K</option>
|
||||
<option value="8">$300-$350K</option>
|
||||
<option value="9">$350-$400K</option>
|
||||
<option value="10">$400-$500K</option>
|
||||
<option value="11">$500-$700K</option>
|
||||
<option value="12">$700-$900K</option>
|
||||
<option value="13">Over $900K</option>
|
||||
</select> <br />
|
||||
<label for="recordPropertyBedroomsID" class="input">Bedrooms:</label> <select name="recordPropertyBedroomsID" id="recordPropertyBedroomsID" class="inputclass">
|
||||
<option value="">-Select-</option>
|
||||
<option value="1">1</option>
|
||||
<option value="2">2</option>
|
||||
<option value="3">3</option>
|
||||
<option value="4">4</option>
|
||||
<option value="5">5+</option>
|
||||
</select> <br />
|
||||
<label for="recordPropertyBathroomsId" class="input">Bathrooms:</label> <select name="recordPropertyBathroomsId" id="recordPropertyBathroomsId" class="inputclass">
|
||||
<option value="">-Select-</option>
|
||||
<option value="1">1</option>
|
||||
<option value="2">1.5</option>
|
||||
<option value="3">2</option>
|
||||
<option value="4">2.5</option>
|
||||
<option value="5">3</option>
|
||||
<option value="6">3.5</option>
|
||||
<option value="7">4+</option>
|
||||
</select> <br />
|
||||
<label for="recordPropertyAgeId" class="input">Approx. Age of Home:</label> <select name="recordPropertyAgeId" id="recordPropertyAgeId" class="inputclass">
|
||||
<option value="">-Select-</option>
|
||||
<option value="1">Less Than 1 year</option>
|
||||
<option value="2">1-5 years</option>
|
||||
<option value="3">6-10 years</option>
|
||||
<option value="4">11-15 years</option>
|
||||
<option value="5">More than 15 years</option>
|
||||
</select> <br />
|
||||
<label for="recordPropertySqFt" class="input">Approx. Square Footage:</label> <input name="recordPropertySqFt" id="recordPropertySqFt" class="inputclass" maxlength="254" /><br />
|
||||
<div class="buttonWrapper"><input name="formBack0" type="button" class="open0 prevbutton" value="Back" alt="Back" title="Back" /> <input name="formNext2" type="button" class="open2 nextbutton" value="Next" alt="Next" title="Next" /></div>
|
||||
</fieldset>
|
||||
</div>
|
||||
</li>
|
||||
<li id="sf3">
|
||||
<a href='#' class="ui-accordion-link">
|
||||
</a>
|
||||
<div>
|
||||
<fieldset><legend> Step 3 of 3 </legend>
|
||||
<div class="requiredNotice">*Required Field</div>
|
||||
<h3 class="stepHeader">Tell us about yourself</h3>
|
||||
<label for="recordClientNameFirst" class="input required">First Name:</label> <input name="recordClientNameFirst" id="recordClientNameFirst" class="inputclass pageRequired" title="First Name is required" maxlength="254" /> <br />
|
||||
<label for="recordClientNameLast" class="input required">Last Name:</label> <input name="recordClientNameLast" id="recordClientNameLast" class="inputclass pageRequired" maxlength="254" title="Last Name is required" /> <br />
|
||||
<label for="recordClientAddress1" class="input required">Current Address:</label> <input name="recordClientAddress1" id="recordClientAddress1" class="inputclass pageRequired" maxlength="254" title="Address is required" /> <br />
|
||||
<label for="recordClientAddress2" class="input">Address (2):</label> <input name="recordClientAddress2" id="recordClientAddress2" class="inputclass" maxlength="254" /> <br />
|
||||
<label for="recordClientCity" class="input required">City:</label> <input name="recordClientCity" id="recordClientCity" class="inputclass pageRequired" maxlength="254" title="City is required" /> <br />
|
||||
<label for="recordClientState" class="input required">State:</label> <select name="recordClientState" id="recordClientState" class="inputclass pageRequired" title="Select a State">
|
||||
<option value="">-Select-</option>
|
||||
<option value="AL">Alabama</option>
|
||||
<option value="AK">Alaska</option>
|
||||
<option value="AZ">Arizona</option>
|
||||
<option value="AR">Arkansas</option>
|
||||
<option value="CA">California</option>
|
||||
<option value="CO">Colorado</option>
|
||||
<option value="CT">Connecticut</option>
|
||||
<option value="DE">Delaware</option>
|
||||
<option value="DC">Dist of Columbia</option>
|
||||
<option value="FL">Florida</option>
|
||||
<option value="GA">Georgia</option>
|
||||
<option value="HI">Hawaii</option>
|
||||
<option value="ID">Idaho</option>
|
||||
<option value="IL">Illinois</option>
|
||||
<option value="IN">Indiana</option>
|
||||
<option value="IA">Iowa</option>
|
||||
<option value="KS">Kansas</option>
|
||||
<option value="KY">Kentucky</option>
|
||||
<option value="LA">Louisiana</option>
|
||||
<option value="ME">Maine</option>
|
||||
<option value="MD">Maryland</option>
|
||||
<option value="MA">Massachusetts</option>
|
||||
<option value="MI">Michigan</option>
|
||||
<option value="MN">Minnesota</option>
|
||||
<option value="MS">Mississippi</option>
|
||||
<option value="MO">Missouri</option>
|
||||
<option value="MT">Montana</option>
|
||||
<option value="NE">Nebraska</option>
|
||||
<option value="NV">Nevada</option>
|
||||
<option value="NH">New Hampshire</option>
|
||||
<option value="NJ">New Jersey</option>
|
||||
<option value="NM">New Mexico</option>
|
||||
<option value="NY">New York</option>
|
||||
<option value="NC">North Carolina</option>
|
||||
<option value="ND">North Dakota</option>
|
||||
<option value="OH">Ohio</option>
|
||||
<option value="OK">Oklahoma</option>
|
||||
<option value="OR">Oregon</option>
|
||||
<option value="PA" selected="selected">Pennsylvania</option>
|
||||
<option value="RI">Rhode Island</option>
|
||||
<option value="SC">South Carolina</option>
|
||||
<option value="SD">South Dakota</option>
|
||||
<option value="TN">Tennessee</option>
|
||||
<option value="TX">Texas</option>
|
||||
<option value="UT">Utah</option>
|
||||
<option value="VT">Vermont</option>
|
||||
<option value="VA">Virginia</option>
|
||||
<option value="WA">Washington</option>
|
||||
<option value="WV">West Virginia</option>
|
||||
<option value="WI">Wisconsin</option>
|
||||
<option value="WY">Wyoming</option>
|
||||
</select> <br />
|
||||
<label for="recordClientZip" class="input required">Zip:</label> <input name="recordClientZip" id="recordClientZip" class="inputclass pageRequired" maxlength="12" title="Zip Code is required" /> <br />
|
||||
<label for="recordClientPhone" class="input required">Phone Number:</label> <input name="recordClientPhone" id="recordClientPhone" class="inputclass pageRequired" maxlength="254" title="Phone Number is required" /> <br />
|
||||
<label for="recordClientPhoneAlt" class="input">Alternate Number:</label> <input name="recordClientPhoneAlt" id="recordClientPhoneAlt" class="inputclass" maxlength="254" /> <br />
|
||||
<label for="recordClientEmail" class="input required">Email Address:</label> <input name="recordClientEmail" id="recordClientEmail" class="inputclass pageRequired email" maxlength="254" title="Email address is required" /> <br />
|
||||
<label for="recordClientEmail1" class="input required">Confirm Email:</label> <input name="recordClientEmail1" id="recordClientEmail1" class="inputclass pageRequired" equalTo:"'#recordClientEmail" maxlength="254" title="Please confirm your email address" /> <br />
|
||||
<br />
|
||||
<p class="formDisclaimer">This is a sample form, no information is sent anywhere.</p>
|
||||
<div class="buttonWrapper"><input name="formBack1" type="button" class="open1 prevbutton" value="Back" alt="Back" title="Back" /> <input name="submit" type="submit" id="submit" value="Submit" class="submitbutton" alt="Submit" title="Submit"></div>
|
||||
</fieldset>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,246 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2007 Josh Bush (digitalbush.com)
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
* files (the "Software"), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use,
|
||||
* copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following
|
||||
* conditions:
|
||||
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Version: 1.0
|
||||
* Release: 2007-07-25
|
||||
*/
|
||||
(function($) {
|
||||
//Helper Functions for Caret positioning
|
||||
function getCaretPosition(ctl){
|
||||
var res = {begin: 0, end: 0 };
|
||||
if (ctl.setSelectionRange){
|
||||
res.begin = ctl.selectionStart;
|
||||
res.end = ctl.selectionEnd;
|
||||
}else if (document.selection && document.selection.createRange){
|
||||
var range = document.selection.createRange();
|
||||
res.begin = 0 - range.duplicate().moveStart('character', -100000);
|
||||
res.end = res.begin + range.text.length;
|
||||
}
|
||||
return res;
|
||||
};
|
||||
|
||||
function setCaretPosition(ctl, pos){
|
||||
if(ctl.setSelectionRange){
|
||||
ctl.focus();
|
||||
ctl.setSelectionRange(pos,pos);
|
||||
}else if (ctl.createTextRange){
|
||||
var range = ctl.createTextRange();
|
||||
range.collapse(true);
|
||||
range.moveEnd('character', pos);
|
||||
range.moveStart('character', pos);
|
||||
range.select();
|
||||
}
|
||||
};
|
||||
|
||||
//Predefined character definitions
|
||||
var charMap={
|
||||
'9':"[0-9]",
|
||||
'a':"[A-Za-z]",
|
||||
'*':"[A-Za-z0-9]"
|
||||
};
|
||||
|
||||
//Helper method to inject character definitions
|
||||
$.mask={
|
||||
addPlaceholder : function(c,r){
|
||||
charMap[c]=r;
|
||||
}
|
||||
};
|
||||
|
||||
//Main Method
|
||||
$.fn.mask = function(mask,settings) {
|
||||
settings = $.extend({
|
||||
placeholder: "_",
|
||||
completed: null
|
||||
}, settings);
|
||||
|
||||
//Build Regex for format validation
|
||||
var reString="^";
|
||||
for(var i=0;i<mask.length;i++)
|
||||
reString+=(charMap[mask.charAt(i)] || ("\\"+mask.charAt(i)));
|
||||
reString+="$";
|
||||
var re = new RegExp(reString);
|
||||
|
||||
return this.each(function(){
|
||||
var input=$(this);
|
||||
var buffer=new Array(mask.length);
|
||||
var locked=new Array(mask.length);
|
||||
|
||||
//Build buffer layout from mask
|
||||
for(var i=0;i<mask.length;i++){
|
||||
locked[i]=charMap[mask.charAt(i)]==null;
|
||||
buffer[i]=locked[i]?mask.charAt(i):settings.placeholder;
|
||||
}
|
||||
|
||||
/*Event Bindings*/
|
||||
input.focus(function(){
|
||||
checkVal();
|
||||
writeBuffer();
|
||||
setCaretPosition(this,0);
|
||||
});
|
||||
|
||||
input.blur(checkVal);
|
||||
|
||||
//Paste events for IE and Mozilla thanks to Kristinn Sigmundsson
|
||||
if ($.browser.msie)
|
||||
this.onpaste= function(){setTimeout(checkVal,0);};
|
||||
else if ($.browser.mozilla)
|
||||
this.addEventListener('input',checkVal,false);
|
||||
|
||||
var ignore=false; //Variable for ignoring control keys
|
||||
|
||||
input.keydown(function(e){
|
||||
var pos=getCaretPosition(this);
|
||||
var k = e.keyCode;
|
||||
ignore=(k < 16 || (k > 16 && k < 32 ) || (k > 32 && k < 41));
|
||||
|
||||
//delete selection before proceeding
|
||||
if((pos.begin-pos.end)!=0 && (!ignore || k==8 || k==46)){
|
||||
clearBuffer(pos.begin,pos.end);
|
||||
}
|
||||
//backspace and delete get special treatment
|
||||
if(k==8){//backspace
|
||||
while(pos.begin-->=0){
|
||||
if(!locked[pos.begin]){
|
||||
buffer[pos.begin]=settings.placeholder;
|
||||
if($.browser.opera){
|
||||
//Opera won't let you cancel the backspace, so we'll let it backspace over a dummy character.
|
||||
writeBuffer(pos.begin);
|
||||
setCaretPosition(this,pos.begin+1);
|
||||
}else{
|
||||
writeBuffer();
|
||||
setCaretPosition(this,pos.begin);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}else if(k==46){//delete
|
||||
clearBuffer(pos.begin,pos.begin+1);
|
||||
writeBuffer();
|
||||
setCaretPosition(this,pos.begin);
|
||||
return false;
|
||||
}else if (k==27){
|
||||
clearBuffer(0,mask.length);
|
||||
writeBuffer();
|
||||
setCaretPosition(this,0);
|
||||
return false;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
input.keypress(function(e){
|
||||
if(ignore){
|
||||
ignore=false;
|
||||
return;
|
||||
}
|
||||
e=e||window.event;
|
||||
var k=e.charCode||e.keyCode||e.which;
|
||||
|
||||
var pos=getCaretPosition(this);
|
||||
var caretPos=pos.begin;
|
||||
|
||||
if(e.ctrlKey || e.altKey){//Ignore
|
||||
return true;
|
||||
}else if ((k>=41 && k<=122) ||k==32 || k>186){//typeable characters
|
||||
while(pos.begin<mask.length){
|
||||
var reString=charMap[mask.charAt(pos.begin)];
|
||||
var match;
|
||||
if(reString){
|
||||
var reChar=new RegExp(reString);
|
||||
match=String.fromCharCode(k).match(reChar);
|
||||
}else{//we're on a mask char, go forward and try again
|
||||
pos.begin+=1;
|
||||
pos.end=pos.begin;
|
||||
caretPos+=1;
|
||||
continue;
|
||||
}
|
||||
|
||||
if(match)
|
||||
buffer[pos.begin]=String.fromCharCode(k);
|
||||
else
|
||||
return false;//reject char
|
||||
|
||||
while(++caretPos<mask.length){//seek forward to next typable position
|
||||
if(!locked[caretPos])
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}else
|
||||
return false;
|
||||
|
||||
writeBuffer();
|
||||
if(settings.completed && caretPos>=buffer.length)
|
||||
settings.completed.call(input);
|
||||
else
|
||||
setCaretPosition(this,caretPos);
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
/*Helper Methods*/
|
||||
function clearBuffer(start,end){
|
||||
for(var i=start;i<end;i++){
|
||||
if(!locked[i])
|
||||
buffer[i]=settings.placeholder;
|
||||
}
|
||||
};
|
||||
|
||||
function writeBuffer(pos){
|
||||
var s="";
|
||||
for(var i=0;i<mask.length;i++){
|
||||
s+=buffer[i];
|
||||
if(i==pos)
|
||||
s+=settings.placeholder;
|
||||
}
|
||||
input.val(s);
|
||||
return s;
|
||||
};
|
||||
|
||||
function checkVal(){
|
||||
//try to place charcters where they belong
|
||||
var test=input.val();
|
||||
var pos=0;
|
||||
for(var i=0;i<mask.length;i++){
|
||||
if(!locked[i]){
|
||||
while(pos++<test.length){
|
||||
//Regex Test each char here.
|
||||
var reChar=new RegExp(charMap[mask.charAt(i)]);
|
||||
if(test.charAt(pos-1).match(reChar)){
|
||||
buffer[i]=test.charAt(pos-1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var s=writeBuffer();
|
||||
if(!s.match(re)){
|
||||
input.val("");
|
||||
clearBuffer(0,mask.length);
|
||||
}
|
||||
};
|
||||
});
|
||||
};
|
||||
})(jQuery);
|
@ -1,477 +0,0 @@
|
||||
/*
|
||||
* jQuery UI Accordion 1.7.1
|
||||
*
|
||||
* Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
|
||||
* Dual licensed under the MIT (MIT-LICENSE.txt)
|
||||
* and GPL (GPL-LICENSE.txt) licenses.
|
||||
*
|
||||
* http://docs.jquery.com/UI/Accordion
|
||||
*
|
||||
* Depends:
|
||||
* ui.core.js
|
||||
*/
|
||||
(function($) {
|
||||
|
||||
$.widget("ui.accordion", {
|
||||
|
||||
_init: function() {
|
||||
|
||||
var o = this.options, self = this;
|
||||
this.running = 0;
|
||||
|
||||
// if the user set the alwaysOpen option on init
|
||||
// then we need to set the collapsible option
|
||||
// if they set both on init, collapsible will take priority
|
||||
if (o.collapsible == $.ui.accordion.defaults.collapsible &&
|
||||
o.alwaysOpen != $.ui.accordion.defaults.alwaysOpen) {
|
||||
o.collapsible = !o.alwaysOpen;
|
||||
}
|
||||
|
||||
if ( o.navigation ) {
|
||||
var current = this.element.find("a").filter(o.navigationFilter);
|
||||
if ( current.length ) {
|
||||
if ( current.filter(o.header).length ) {
|
||||
this.active = current;
|
||||
} else {
|
||||
this.active = current.parent().parent().prev();
|
||||
current.addClass("ui-accordion-content-active");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.element.addClass("ui-accordion ui-widget ui-helper-reset");
|
||||
|
||||
// in lack of child-selectors in CSS we need to mark top-LIs in a UL-accordion for some IE-fix
|
||||
if (this.element[0].nodeName == "UL") {
|
||||
this.element.children("li").addClass("ui-accordion-li-fix");
|
||||
}
|
||||
|
||||
this.headers = this.element.find(o.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all")
|
||||
.bind("mouseenter.accordion", function(){ $(this).addClass('ui-state-hover'); })
|
||||
.bind("mouseleave.accordion", function(){ $(this).removeClass('ui-state-hover'); })
|
||||
.bind("focus.accordion", function(){ $(this).addClass('ui-state-focus'); })
|
||||
.bind("blur.accordion", function(){ $(this).removeClass('ui-state-focus'); });
|
||||
|
||||
this.headers
|
||||
.next()
|
||||
.addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom");
|
||||
|
||||
this.active = this._findActive(this.active || o.active).toggleClass("ui-state-default").toggleClass("ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top");
|
||||
this.active.next().addClass('ui-accordion-content-active');
|
||||
|
||||
//Append icon elements
|
||||
$("<span/>").addClass("ui-icon " + o.icons.header).prependTo(this.headers);
|
||||
this.active.find(".ui-icon").toggleClass(o.icons.header).toggleClass(o.icons.headerSelected);
|
||||
|
||||
// IE7-/Win - Extra vertical space in lists fixed
|
||||
if ($.browser.msie) {
|
||||
this.element.find('a').css('zoom', '1');
|
||||
}
|
||||
|
||||
this.resize();
|
||||
|
||||
//ARIA
|
||||
this.element.attr('role','tablist');
|
||||
|
||||
this.headers
|
||||
.attr('role','tab')
|
||||
.bind('keydown', function(event) { return self._keydown(event); })
|
||||
.next()
|
||||
.attr('role','tabpanel');
|
||||
|
||||
this.headers
|
||||
.not(this.active || "")
|
||||
.attr('aria-expanded','false')
|
||||
.attr("tabIndex", "-1")
|
||||
.next()
|
||||
.hide();
|
||||
|
||||
// make sure at least one header is in the tab order
|
||||
if (!this.active.length) {
|
||||
this.headers.eq(0).attr('tabIndex','0');
|
||||
} else {
|
||||
this.active
|
||||
.attr('aria-expanded','true')
|
||||
.attr('tabIndex', '0');
|
||||
}
|
||||
|
||||
// only need links in taborder for Safari
|
||||
if (!$.browser.safari)
|
||||
this.headers.find('a').attr('tabIndex','-1');
|
||||
|
||||
if (o.event) {
|
||||
this.headers.bind((o.event) + ".accordion", function(event) { return self._clickHandler.call(self, event, this); });
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
destroy: function() {
|
||||
var o = this.options;
|
||||
|
||||
this.element
|
||||
.removeClass("ui-accordion ui-widget ui-helper-reset")
|
||||
.removeAttr("role")
|
||||
.unbind('.accordion')
|
||||
.removeData('accordion');
|
||||
|
||||
this.headers
|
||||
.unbind(".accordion")
|
||||
.removeClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-corner-top")
|
||||
.removeAttr("role").removeAttr("aria-expanded").removeAttr("tabindex");
|
||||
|
||||
this.headers.find("a").removeAttr("tabindex");
|
||||
this.headers.children(".ui-icon").remove();
|
||||
var contents = this.headers.next().css("display", "").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active");
|
||||
if (o.autoHeight || o.fillHeight) {
|
||||
contents.css("height", "");
|
||||
}
|
||||
},
|
||||
|
||||
_setData: function(key, value) {
|
||||
if(key == 'alwaysOpen') { key = 'collapsible'; value = !value; }
|
||||
$.widget.prototype._setData.apply(this, arguments);
|
||||
},
|
||||
|
||||
_keydown: function(event) {
|
||||
|
||||
var o = this.options, keyCode = $.ui.keyCode;
|
||||
|
||||
if (o.disabled || event.altKey || event.ctrlKey)
|
||||
return;
|
||||
|
||||
var length = this.headers.length;
|
||||
var currentIndex = this.headers.index(event.target);
|
||||
var toFocus = false;
|
||||
|
||||
switch(event.keyCode) {
|
||||
case keyCode.RIGHT:
|
||||
case keyCode.DOWN:
|
||||
toFocus = this.headers[(currentIndex + 1) % length];
|
||||
break;
|
||||
case keyCode.LEFT:
|
||||
case keyCode.UP:
|
||||
toFocus = this.headers[(currentIndex - 1 + length) % length];
|
||||
break;
|
||||
case keyCode.SPACE:
|
||||
case keyCode.ENTER:
|
||||
return this._clickHandler({ target: event.target }, event.target);
|
||||
}
|
||||
|
||||
if (toFocus) {
|
||||
$(event.target).attr('tabIndex','-1');
|
||||
$(toFocus).attr('tabIndex','0');
|
||||
toFocus.focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
},
|
||||
|
||||
resize: function() {
|
||||
|
||||
var o = this.options, maxHeight;
|
||||
|
||||
if (o.fillSpace) {
|
||||
|
||||
if($.browser.msie) { var defOverflow = this.element.parent().css('overflow'); this.element.parent().css('overflow', 'hidden'); }
|
||||
maxHeight = this.element.parent().height();
|
||||
if($.browser.msie) { this.element.parent().css('overflow', defOverflow); }
|
||||
|
||||
this.headers.each(function() {
|
||||
maxHeight -= $(this).outerHeight();
|
||||
});
|
||||
|
||||
var maxPadding = 0;
|
||||
this.headers.next().each(function() {
|
||||
maxPadding = Math.max(maxPadding, $(this).innerHeight() - $(this).height());
|
||||
}).height(Math.max(0, maxHeight - maxPadding))
|
||||
.css('overflow', 'auto');
|
||||
|
||||
} else if ( o.autoHeight ) {
|
||||
maxHeight = 0;
|
||||
this.headers.next().each(function() {
|
||||
maxHeight = Math.max(maxHeight, $(this).outerHeight());
|
||||
}).height(maxHeight);
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
activate: function(index) {
|
||||
// call clickHandler with custom event
|
||||
var active = this._findActive(index)[0];
|
||||
this._clickHandler({ target: active }, active);
|
||||
},
|
||||
|
||||
_findActive: function(selector) {
|
||||
return selector
|
||||
? typeof selector == "number"
|
||||
? this.headers.filter(":eq(" + selector + ")")
|
||||
: this.headers.not(this.headers.not(selector))
|
||||
: selector === false
|
||||
? $([])
|
||||
: this.headers.filter(":eq(0)");
|
||||
},
|
||||
|
||||
_clickHandler: function(event, target) {
|
||||
|
||||
var o = this.options;
|
||||
if (o.disabled) return false;
|
||||
|
||||
// called only when using activate(false) to close all parts programmatically
|
||||
if (!event.target && o.collapsible) {
|
||||
this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all")
|
||||
.find(".ui-icon").removeClass(o.icons.headerSelected).addClass(o.icons.header);
|
||||
this.active.next().addClass('ui-accordion-content-active');
|
||||
var toHide = this.active.next(),
|
||||
data = {
|
||||
options: o,
|
||||
newHeader: $([]),
|
||||
oldHeader: o.active,
|
||||
newContent: $([]),
|
||||
oldContent: toHide
|
||||
},
|
||||
toShow = (this.active = $([]));
|
||||
this._toggle(toShow, toHide, data);
|
||||
return false;
|
||||
}
|
||||
|
||||
// get the click target
|
||||
var clicked = $(event.currentTarget || target);
|
||||
var clickedIsActive = clicked[0] == this.active[0];
|
||||
|
||||
// if animations are still active, or the active header is the target, ignore click
|
||||
if (this.running || (!o.collapsible && clickedIsActive)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// switch classes
|
||||
this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all")
|
||||
.find(".ui-icon").removeClass(o.icons.headerSelected).addClass(o.icons.header);
|
||||
this.active.next().addClass('ui-accordion-content-active');
|
||||
if (!clickedIsActive) {
|
||||
clicked.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top")
|
||||
.find(".ui-icon").removeClass(o.icons.header).addClass(o.icons.headerSelected);
|
||||
clicked.next().addClass('ui-accordion-content-active');
|
||||
}
|
||||
|
||||
// find elements to show and hide
|
||||
var toShow = clicked.next(),
|
||||
toHide = this.active.next(),
|
||||
data = {
|
||||
options: o,
|
||||
newHeader: clickedIsActive && o.collapsible ? $([]) : clicked,
|
||||
oldHeader: this.active,
|
||||
newContent: clickedIsActive && o.collapsible ? $([]) : toShow.find('> *'),
|
||||
oldContent: toHide.find('> *')
|
||||
},
|
||||
down = this.headers.index( this.active[0] ) > this.headers.index( clicked[0] );
|
||||
|
||||
this.active = clickedIsActive ? $([]) : clicked;
|
||||
this._toggle(toShow, toHide, data, clickedIsActive, down);
|
||||
|
||||
return false;
|
||||
|
||||
},
|
||||
|
||||
_toggle: function(toShow, toHide, data, clickedIsActive, down) {
|
||||
|
||||
var o = this.options, self = this;
|
||||
|
||||
this.toShow = toShow;
|
||||
this.toHide = toHide;
|
||||
this.data = data;
|
||||
|
||||
var complete = function() { if(!self) return; return self._completed.apply(self, arguments); };
|
||||
|
||||
// trigger changestart event
|
||||
this._trigger("changestart", null, this.data);
|
||||
|
||||
// count elements to animate
|
||||
this.running = toHide.size() === 0 ? toShow.size() : toHide.size();
|
||||
|
||||
if (o.animated) {
|
||||
|
||||
var animOptions = {};
|
||||
|
||||
if ( o.collapsible && clickedIsActive ) {
|
||||
animOptions = {
|
||||
toShow: $([]),
|
||||
toHide: toHide,
|
||||
complete: complete,
|
||||
down: down,
|
||||
autoHeight: o.autoHeight || o.fillSpace
|
||||
};
|
||||
} else {
|
||||
animOptions = {
|
||||
toShow: toShow,
|
||||
toHide: toHide,
|
||||
complete: complete,
|
||||
down: down,
|
||||
autoHeight: o.autoHeight || o.fillSpace
|
||||
};
|
||||
}
|
||||
|
||||
if (!o.proxied) {
|
||||
o.proxied = o.animated;
|
||||
}
|
||||
|
||||
if (!o.proxiedDuration) {
|
||||
o.proxiedDuration = o.duration;
|
||||
}
|
||||
|
||||
o.animated = $.isFunction(o.proxied) ?
|
||||
o.proxied(animOptions) : o.proxied;
|
||||
|
||||
o.duration = $.isFunction(o.proxiedDuration) ?
|
||||
o.proxiedDuration(animOptions) : o.proxiedDuration;
|
||||
|
||||
var animations = $.ui.accordion.animations,
|
||||
duration = o.duration,
|
||||
easing = o.animated;
|
||||
|
||||
if (!animations[easing]) {
|
||||
animations[easing] = function(options) {
|
||||
this.slide(options, {
|
||||
easing: easing,
|
||||
duration: duration || 700
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
animations[easing](animOptions);
|
||||
|
||||
} else {
|
||||
|
||||
if (o.collapsible && clickedIsActive) {
|
||||
toShow.toggle();
|
||||
} else {
|
||||
toHide.hide();
|
||||
toShow.show();
|
||||
}
|
||||
|
||||
complete(true);
|
||||
|
||||
}
|
||||
|
||||
toHide.prev().attr('aria-expanded','false').attr("tabIndex", "-1").blur();
|
||||
toShow.prev().attr('aria-expanded','true').attr("tabIndex", "0").focus();
|
||||
|
||||
},
|
||||
|
||||
_completed: function(cancel) {
|
||||
|
||||
var o = this.options;
|
||||
|
||||
this.running = cancel ? 0 : --this.running;
|
||||
if (this.running) return;
|
||||
|
||||
if (o.clearStyle) {
|
||||
this.toShow.add(this.toHide).css({
|
||||
height: "",
|
||||
overflow: ""
|
||||
});
|
||||
}
|
||||
|
||||
this._trigger('change', null, this.data);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
$.extend($.ui.accordion, {
|
||||
version: "1.7.1",
|
||||
defaults: {
|
||||
active: null,
|
||||
alwaysOpen: true, //deprecated, use collapsible
|
||||
animated: 'slide',
|
||||
autoHeight: true,
|
||||
clearStyle: false,
|
||||
collapsible: false,
|
||||
event: "click",
|
||||
fillSpace: false,
|
||||
header: "> li > :first-child,> :not(li):even",
|
||||
icons: {
|
||||
header: "ui-icon-triangle-1-e",
|
||||
headerSelected: "ui-icon-triangle-1-s"
|
||||
},
|
||||
navigation: false,
|
||||
navigationFilter: function() {
|
||||
return this.href.toLowerCase() == location.href.toLowerCase();
|
||||
}
|
||||
},
|
||||
animations: {
|
||||
slide: function(options, additions) {
|
||||
options = $.extend({
|
||||
easing: "swing",
|
||||
duration: 300
|
||||
}, options, additions);
|
||||
if ( !options.toHide.size() ) {
|
||||
options.toShow.animate({height: "show"}, options);
|
||||
return;
|
||||
}
|
||||
if ( !options.toShow.size() ) {
|
||||
options.toHide.animate({height: "hide"}, options);
|
||||
return;
|
||||
}
|
||||
var overflow = options.toShow.css('overflow'),
|
||||
percentDone,
|
||||
showProps = {},
|
||||
hideProps = {},
|
||||
fxAttrs = [ "height", "paddingTop", "paddingBottom" ],
|
||||
originalWidth;
|
||||
// fix width before calculating height of hidden element
|
||||
var s = options.toShow;
|
||||
originalWidth = s[0].style.width;
|
||||
s.width( parseInt(s.parent().width(),10) - parseInt(s.css("paddingLeft"),10) - parseInt(s.css("paddingRight"),10) - (parseInt(s.css("borderLeftWidth"),10) || 0) - (parseInt(s.css("borderRightWidth"),10) || 0) );
|
||||
|
||||
$.each(fxAttrs, function(i, prop) {
|
||||
hideProps[prop] = 'hide';
|
||||
|
||||
var parts = ('' + $.css(options.toShow[0], prop)).match(/^([\d+-.]+)(.*)$/);
|
||||
showProps[prop] = {
|
||||
value: parts[1],
|
||||
unit: parts[2] || 'px'
|
||||
};
|
||||
});
|
||||
options.toShow.css({ height: 0, overflow: 'hidden' }).show();
|
||||
options.toHide.filter(":hidden").each(options.complete).end().filter(":visible").animate(hideProps,{
|
||||
step: function(now, settings) {
|
||||
// only calculate the percent when animating height
|
||||
// IE gets very inconsistent results when animating elements
|
||||
// with small values, which is common for padding
|
||||
if (settings.prop == 'height') {
|
||||
percentDone = (settings.now - settings.start) / (settings.end - settings.start);
|
||||
}
|
||||
|
||||
options.toShow[0].style[settings.prop] =
|
||||
(percentDone * showProps[settings.prop].value) + showProps[settings.prop].unit;
|
||||
},
|
||||
duration: options.duration,
|
||||
easing: options.easing,
|
||||
complete: function() {
|
||||
if ( !options.autoHeight ) {
|
||||
options.toShow.css("height", "");
|
||||
}
|
||||
options.toShow.css("width", originalWidth);
|
||||
options.toShow.css({overflow: overflow});
|
||||
options.complete();
|
||||
}
|
||||
});
|
||||
},
|
||||
bounceslide: function(options) {
|
||||
this.slide(options, {
|
||||
easing: options.down ? "easeOutBounce" : "swing",
|
||||
duration: options.down ? 1000 : 200
|
||||
});
|
||||
},
|
||||
easeslide: function(options) {
|
||||
this.slide(options, {
|
||||
easing: "easeinout",
|
||||
duration: 700
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
})(jQuery);
|
@ -1,519 +0,0 @@
|
||||
/*
|
||||
* jQuery UI 1.7.1
|
||||
*
|
||||
* Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
|
||||
* Dual licensed under the MIT (MIT-LICENSE.txt)
|
||||
* and GPL (GPL-LICENSE.txt) licenses.
|
||||
*
|
||||
* http://docs.jquery.com/UI
|
||||
*/
|
||||
;jQuery.ui || (function($) {
|
||||
|
||||
var _remove = $.fn.remove,
|
||||
isFF2 = $.browser.mozilla && (parseFloat($.browser.version) < 1.9);
|
||||
|
||||
//Helper functions and ui object
|
||||
$.ui = {
|
||||
version: "1.7.1",
|
||||
|
||||
// $.ui.plugin is deprecated. Use the proxy pattern instead.
|
||||
plugin: {
|
||||
add: function(module, option, set) {
|
||||
var proto = $.ui[module].prototype;
|
||||
for(var i in set) {
|
||||
proto.plugins[i] = proto.plugins[i] || [];
|
||||
proto.plugins[i].push([option, set[i]]);
|
||||
}
|
||||
},
|
||||
call: function(instance, name, args) {
|
||||
var set = instance.plugins[name];
|
||||
if(!set || !instance.element[0].parentNode) { return; }
|
||||
|
||||
for (var i = 0; i < set.length; i++) {
|
||||
if (instance.options[set[i][0]]) {
|
||||
set[i][1].apply(instance.element, args);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
contains: function(a, b) {
|
||||
return document.compareDocumentPosition
|
||||
? a.compareDocumentPosition(b) & 16
|
||||
: a !== b && a.contains(b);
|
||||
},
|
||||
|
||||
hasScroll: function(el, a) {
|
||||
|
||||
//If overflow is hidden, the element might have extra content, but the user wants to hide it
|
||||
if ($(el).css('overflow') == 'hidden') { return false; }
|
||||
|
||||
var scroll = (a && a == 'left') ? 'scrollLeft' : 'scrollTop',
|
||||
has = false;
|
||||
|
||||
if (el[scroll] > 0) { return true; }
|
||||
|
||||
// TODO: determine which cases actually cause this to happen
|
||||
// if the element doesn't have the scroll set, see if it's possible to
|
||||
// set the scroll
|
||||
el[scroll] = 1;
|
||||
has = (el[scroll] > 0);
|
||||
el[scroll] = 0;
|
||||
return has;
|
||||
},
|
||||
|
||||
isOverAxis: function(x, reference, size) {
|
||||
//Determines when x coordinate is over "b" element axis
|
||||
return (x > reference) && (x < (reference + size));
|
||||
},
|
||||
|
||||
isOver: function(y, x, top, left, height, width) {
|
||||
//Determines when x, y coordinates is over "b" element
|
||||
return $.ui.isOverAxis(y, top, height) && $.ui.isOverAxis(x, left, width);
|
||||
},
|
||||
|
||||
keyCode: {
|
||||
BACKSPACE: 8,
|
||||
CAPS_LOCK: 20,
|
||||
COMMA: 188,
|
||||
CONTROL: 17,
|
||||
DELETE: 46,
|
||||
DOWN: 40,
|
||||
END: 35,
|
||||
ENTER: 13,
|
||||
ESCAPE: 27,
|
||||
HOME: 36,
|
||||
INSERT: 45,
|
||||
LEFT: 37,
|
||||
NUMPAD_ADD: 107,
|
||||
NUMPAD_DECIMAL: 110,
|
||||
NUMPAD_DIVIDE: 111,
|
||||
NUMPAD_ENTER: 108,
|
||||
NUMPAD_MULTIPLY: 106,
|
||||
NUMPAD_SUBTRACT: 109,
|
||||
PAGE_DOWN: 34,
|
||||
PAGE_UP: 33,
|
||||
PERIOD: 190,
|
||||
RIGHT: 39,
|
||||
SHIFT: 16,
|
||||
SPACE: 32,
|
||||
TAB: 9,
|
||||
UP: 38
|
||||
}
|
||||
};
|
||||
|
||||
// WAI-ARIA normalization
|
||||
if (isFF2) {
|
||||
var attr = $.attr,
|
||||
removeAttr = $.fn.removeAttr,
|
||||
ariaNS = "http://www.w3.org/2005/07/aaa",
|
||||
ariaState = /^aria-/,
|
||||
ariaRole = /^wairole:/;
|
||||
|
||||
$.attr = function(elem, name, value) {
|
||||
var set = value !== undefined;
|
||||
|
||||
return (name == 'role'
|
||||
? (set
|
||||
? attr.call(this, elem, name, "wairole:" + value)
|
||||
: (attr.apply(this, arguments) || "").replace(ariaRole, ""))
|
||||
: (ariaState.test(name)
|
||||
? (set
|
||||
? elem.setAttributeNS(ariaNS,
|
||||
name.replace(ariaState, "aaa:"), value)
|
||||
: attr.call(this, elem, name.replace(ariaState, "aaa:")))
|
||||
: attr.apply(this, arguments)));
|
||||
};
|
||||
|
||||
$.fn.removeAttr = function(name) {
|
||||
return (ariaState.test(name)
|
||||
? this.each(function() {
|
||||
this.removeAttributeNS(ariaNS, name.replace(ariaState, ""));
|
||||
}) : removeAttr.call(this, name));
|
||||
};
|
||||
}
|
||||
|
||||
//jQuery plugins
|
||||
$.fn.extend({
|
||||
remove: function() {
|
||||
// Safari has a native remove event which actually removes DOM elements,
|
||||
// so we have to use triggerHandler instead of trigger (#3037).
|
||||
$("*", this).add(this).each(function() {
|
||||
$(this).triggerHandler("remove");
|
||||
});
|
||||
return _remove.apply(this, arguments );
|
||||
},
|
||||
|
||||
enableSelection: function() {
|
||||
return this
|
||||
.attr('unselectable', 'off')
|
||||
.css('MozUserSelect', '')
|
||||
.unbind('selectstart.ui');
|
||||
},
|
||||
|
||||
disableSelection: function() {
|
||||
return this
|
||||
.attr('unselectable', 'on')
|
||||
.css('MozUserSelect', 'none')
|
||||
.bind('selectstart.ui', function() { return false; });
|
||||
},
|
||||
|
||||
scrollParent: function() {
|
||||
var scrollParent;
|
||||
if(($.browser.msie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) {
|
||||
scrollParent = this.parents().filter(function() {
|
||||
return (/(relative|absolute|fixed)/).test($.curCSS(this,'position',1)) && (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));
|
||||
}).eq(0);
|
||||
} else {
|
||||
scrollParent = this.parents().filter(function() {
|
||||
return (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));
|
||||
}).eq(0);
|
||||
}
|
||||
|
||||
return (/fixed/).test(this.css('position')) || !scrollParent.length ? $(document) : scrollParent;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//Additional selectors
|
||||
$.extend($.expr[':'], {
|
||||
data: function(elem, i, match) {
|
||||
return !!$.data(elem, match[3]);
|
||||
},
|
||||
|
||||
focusable: function(element) {
|
||||
var nodeName = element.nodeName.toLowerCase(),
|
||||
tabIndex = $.attr(element, 'tabindex');
|
||||
return (/input|select|textarea|button|object/.test(nodeName)
|
||||
? !element.disabled
|
||||
: 'a' == nodeName || 'area' == nodeName
|
||||
? element.href || !isNaN(tabIndex)
|
||||
: !isNaN(tabIndex))
|
||||
// the element and all of its ancestors must be visible
|
||||
// the browser may report that the area is hidden
|
||||
&& !$(element)['area' == nodeName ? 'parents' : 'closest'](':hidden').length;
|
||||
},
|
||||
|
||||
tabbable: function(element) {
|
||||
var tabIndex = $.attr(element, 'tabindex');
|
||||
return (isNaN(tabIndex) || tabIndex >= 0) && $(element).is(':focusable');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// $.widget is a factory to create jQuery plugins
|
||||
// taking some boilerplate code out of the plugin code
|
||||
function getter(namespace, plugin, method, args) {
|
||||
function getMethods(type) {
|
||||
var methods = $[namespace][plugin][type] || [];
|
||||
return (typeof methods == 'string' ? methods.split(/,?\s+/) : methods);
|
||||
}
|
||||
|
||||
var methods = getMethods('getter');
|
||||
if (args.length == 1 && typeof args[0] == 'string') {
|
||||
methods = methods.concat(getMethods('getterSetter'));
|
||||
}
|
||||
return ($.inArray(method, methods) != -1);
|
||||
}
|
||||
|
||||
$.widget = function(name, prototype) {
|
||||
var namespace = name.split(".")[0];
|
||||
name = name.split(".")[1];
|
||||
|
||||
// create plugin method
|
||||
$.fn[name] = function(options) {
|
||||
var isMethodCall = (typeof options == 'string'),
|
||||
args = Array.prototype.slice.call(arguments, 1);
|
||||
|
||||
// prevent calls to internal methods
|
||||
if (isMethodCall && options.substring(0, 1) == '_') {
|
||||
return this;
|
||||
}
|
||||
|
||||
// handle getter methods
|
||||
if (isMethodCall && getter(namespace, name, options, args)) {
|
||||
var instance = $.data(this[0], name);
|
||||
return (instance ? instance[options].apply(instance, args)
|
||||
: undefined);
|
||||
}
|
||||
|
||||
// handle initialization and non-getter methods
|
||||
return this.each(function() {
|
||||
var instance = $.data(this, name);
|
||||
|
||||
// constructor
|
||||
(!instance && !isMethodCall &&
|
||||
$.data(this, name, new $[namespace][name](this, options))._init());
|
||||
|
||||
// method call
|
||||
(instance && isMethodCall && $.isFunction(instance[options]) &&
|
||||
instance[options].apply(instance, args));
|
||||
});
|
||||
};
|
||||
|
||||
// create widget constructor
|
||||
$[namespace] = $[namespace] || {};
|
||||
$[namespace][name] = function(element, options) {
|
||||
var self = this;
|
||||
|
||||
this.namespace = namespace;
|
||||
this.widgetName = name;
|
||||
this.widgetEventPrefix = $[namespace][name].eventPrefix || name;
|
||||
this.widgetBaseClass = namespace + '-' + name;
|
||||
|
||||
this.options = $.extend({},
|
||||
$.widget.defaults,
|
||||
$[namespace][name].defaults,
|
||||
$.metadata && $.metadata.get(element)[name],
|
||||
options);
|
||||
|
||||
this.element = $(element)
|
||||
.bind('setData.' + name, function(event, key, value) {
|
||||
if (event.target == element) {
|
||||
return self._setData(key, value);
|
||||
}
|
||||
})
|
||||
.bind('getData.' + name, function(event, key) {
|
||||
if (event.target == element) {
|
||||
return self._getData(key);
|
||||
}
|
||||
})
|
||||
.bind('remove', function() {
|
||||
return self.destroy();
|
||||
});
|
||||
};
|
||||
|
||||
// add widget prototype
|
||||
$[namespace][name].prototype = $.extend({}, $.widget.prototype, prototype);
|
||||
|
||||
// TODO: merge getter and getterSetter properties from widget prototype
|
||||
// and plugin prototype
|
||||
$[namespace][name].getterSetter = 'option';
|
||||
};
|
||||
|
||||
$.widget.prototype = {
|
||||
_init: function() {},
|
||||
destroy: function() {
|
||||
this.element.removeData(this.widgetName)
|
||||
.removeClass(this.widgetBaseClass + '-disabled' + ' ' + this.namespace + '-state-disabled')
|
||||
.removeAttr('aria-disabled');
|
||||
},
|
||||
|
||||
option: function(key, value) {
|
||||
var options = key,
|
||||
self = this;
|
||||
|
||||
if (typeof key == "string") {
|
||||
if (value === undefined) {
|
||||
return this._getData(key);
|
||||
}
|
||||
options = {};
|
||||
options[key] = value;
|
||||
}
|
||||
|
||||
$.each(options, function(key, value) {
|
||||
self._setData(key, value);
|
||||
});
|
||||
},
|
||||
_getData: function(key) {
|
||||
return this.options[key];
|
||||
},
|
||||
_setData: function(key, value) {
|
||||
this.options[key] = value;
|
||||
|
||||
if (key == 'disabled') {
|
||||
this.element
|
||||
[value ? 'addClass' : 'removeClass'](
|
||||
this.widgetBaseClass + '-disabled' + ' ' +
|
||||
this.namespace + '-state-disabled')
|
||||
.attr("aria-disabled", value);
|
||||
}
|
||||
},
|
||||
|
||||
enable: function() {
|
||||
this._setData('disabled', false);
|
||||
},
|
||||
disable: function() {
|
||||
this._setData('disabled', true);
|
||||
},
|
||||
|
||||
_trigger: function(type, event, data) {
|
||||
var callback = this.options[type],
|
||||
eventName = (type == this.widgetEventPrefix
|
||||
? type : this.widgetEventPrefix + type);
|
||||
|
||||
event = $.Event(event);
|
||||
event.type = eventName;
|
||||
|
||||
// copy original event properties over to the new event
|
||||
// this would happen if we could call $.event.fix instead of $.Event
|
||||
// but we don't have a way to force an event to be fixed multiple times
|
||||
if (event.originalEvent) {
|
||||
for (var i = $.event.props.length, prop; i;) {
|
||||
prop = $.event.props[--i];
|
||||
event[prop] = event.originalEvent[prop];
|
||||
}
|
||||
}
|
||||
|
||||
this.element.trigger(event, data);
|
||||
|
||||
return !($.isFunction(callback) && callback.call(this.element[0], event, data) === false
|
||||
|| event.isDefaultPrevented());
|
||||
}
|
||||
};
|
||||
|
||||
$.widget.defaults = {
|
||||
disabled: false
|
||||
};
|
||||
|
||||
|
||||
/** Mouse Interaction Plugin **/
|
||||
|
||||
$.ui.mouse = {
|
||||
_mouseInit: function() {
|
||||
var self = this;
|
||||
|
||||
this.element
|
||||
.bind('mousedown.'+this.widgetName, function(event) {
|
||||
return self._mouseDown(event);
|
||||
})
|
||||
.bind('click.'+this.widgetName, function(event) {
|
||||
if(self._preventClickEvent) {
|
||||
self._preventClickEvent = false;
|
||||
event.stopImmediatePropagation();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
// Prevent text selection in IE
|
||||
if ($.browser.msie) {
|
||||
this._mouseUnselectable = this.element.attr('unselectable');
|
||||
this.element.attr('unselectable', 'on');
|
||||
}
|
||||
|
||||
this.started = false;
|
||||
},
|
||||
|
||||
// TODO: make sure destroying one instance of mouse doesn't mess with
|
||||
// other instances of mouse
|
||||
_mouseDestroy: function() {
|
||||
this.element.unbind('.'+this.widgetName);
|
||||
|
||||
// Restore text selection in IE
|
||||
($.browser.msie
|
||||
&& this.element.attr('unselectable', this._mouseUnselectable));
|
||||
},
|
||||
|
||||
_mouseDown: function(event) {
|
||||
// don't let more than one widget handle mouseStart
|
||||
// TODO: figure out why we have to use originalEvent
|
||||
event.originalEvent = event.originalEvent || {};
|
||||
if (event.originalEvent.mouseHandled) { return; }
|
||||
|
||||
// we may have missed mouseup (out of window)
|
||||
(this._mouseStarted && this._mouseUp(event));
|
||||
|
||||
this._mouseDownEvent = event;
|
||||
|
||||
var self = this,
|
||||
btnIsLeft = (event.which == 1),
|
||||
elIsCancel = (typeof this.options.cancel == "string" ? $(event.target).parents().add(event.target).filter(this.options.cancel).length : false);
|
||||
if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
this.mouseDelayMet = !this.options.delay;
|
||||
if (!this.mouseDelayMet) {
|
||||
this._mouseDelayTimer = setTimeout(function() {
|
||||
self.mouseDelayMet = true;
|
||||
}, this.options.delay);
|
||||
}
|
||||
|
||||
if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
|
||||
this._mouseStarted = (this._mouseStart(event) !== false);
|
||||
if (!this._mouseStarted) {
|
||||
event.preventDefault();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// these delegates are required to keep context
|
||||
this._mouseMoveDelegate = function(event) {
|
||||
return self._mouseMove(event);
|
||||
};
|
||||
this._mouseUpDelegate = function(event) {
|
||||
return self._mouseUp(event);
|
||||
};
|
||||
$(document)
|
||||
.bind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
|
||||
.bind('mouseup.'+this.widgetName, this._mouseUpDelegate);
|
||||
|
||||
// preventDefault() is used to prevent the selection of text here -
|
||||
// however, in Safari, this causes select boxes not to be selectable
|
||||
// anymore, so this fix is needed
|
||||
($.browser.safari || event.preventDefault());
|
||||
|
||||
event.originalEvent.mouseHandled = true;
|
||||
return true;
|
||||
},
|
||||
|
||||
_mouseMove: function(event) {
|
||||
// IE mouseup check - mouseup happened when mouse was out of window
|
||||
if ($.browser.msie && !event.button) {
|
||||
return this._mouseUp(event);
|
||||
}
|
||||
|
||||
if (this._mouseStarted) {
|
||||
this._mouseDrag(event);
|
||||
return event.preventDefault();
|
||||
}
|
||||
|
||||
if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
|
||||
this._mouseStarted =
|
||||
(this._mouseStart(this._mouseDownEvent, event) !== false);
|
||||
(this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event));
|
||||
}
|
||||
|
||||
return !this._mouseStarted;
|
||||
},
|
||||
|
||||
_mouseUp: function(event) {
|
||||
$(document)
|
||||
.unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
|
||||
.unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);
|
||||
|
||||
if (this._mouseStarted) {
|
||||
this._mouseStarted = false;
|
||||
this._preventClickEvent = (event.target == this._mouseDownEvent.target);
|
||||
this._mouseStop(event);
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
_mouseDistanceMet: function(event) {
|
||||
return (Math.max(
|
||||
Math.abs(this._mouseDownEvent.pageX - event.pageX),
|
||||
Math.abs(this._mouseDownEvent.pageY - event.pageY)
|
||||
) >= this.options.distance
|
||||
);
|
||||
},
|
||||
|
||||
_mouseDelayMet: function(event) {
|
||||
return this.mouseDelayMet;
|
||||
},
|
||||
|
||||
// These are placeholder methods, to be overriden by extending plugin
|
||||
_mouseStart: function(event) {},
|
||||
_mouseDrag: function(event) {},
|
||||
_mouseStop: function(event) {},
|
||||
_mouseCapture: function(event) { return true; }
|
||||
};
|
||||
|
||||
$.ui.mouse.defaults = {
|
||||
cancel: null,
|
||||
distance: 1,
|
||||
delay: 0
|
||||
};
|
||||
|
||||
})(jQuery);
|
705
thirdparty/jquery-validate/demo/multipart/style.css
vendored
@ -1,705 +0,0 @@
|
||||
/********************************************
|
||||
AUTHOR: Erwin Aligam
|
||||
WEBSITE: http://www.styleshout.com/
|
||||
TEMPLATE NAME: Techmania 1.0
|
||||
TEMPLATE CODE: S-0003
|
||||
VERSION: 1.1
|
||||
*******************************************/
|
||||
/********************************************
|
||||
HTML ELEMENTS
|
||||
********************************************/ /* Top elements */
|
||||
/** { margin:0; padding: 0; }*/
|
||||
body {
|
||||
background-color: #000;
|
||||
color: #555;
|
||||
font: 78%/ 1.6 Verdana, 'Trebuchet MS', arial, sans-serif;
|
||||
text-align: center;
|
||||
margin: 15px 0;
|
||||
}
|
||||
|
||||
/* links */
|
||||
a {
|
||||
color: #213540;
|
||||
background: inherit;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
color: #3e4255;
|
||||
text-decoration: underline;
|
||||
background: inherit;
|
||||
}
|
||||
|
||||
/* headers */
|
||||
h1,h2,h3 {
|
||||
font-family: 'Trebuchet MS', Arial, sans-serif;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 1.5em;
|
||||
margin: 10px 15px;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 1.3em;
|
||||
text-transform: uppercase;
|
||||
color: #339900;
|
||||
margin: 10px 15px;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 1.1em;
|
||||
color: #333;
|
||||
margin: 16px 0 0 18px;
|
||||
}
|
||||
|
||||
h1,h2,h3 {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
p {
|
||||
line-height: 1.4em;
|
||||
padding: 0 15px;
|
||||
}
|
||||
|
||||
p.error {
|
||||
color: #CC0033;
|
||||
}
|
||||
|
||||
ul,ol {
|
||||
margin: 10px 6px;
|
||||
padding: 0 15px;
|
||||
color: #006699;
|
||||
}
|
||||
|
||||
ul span,ol span {
|
||||
color: #666666;
|
||||
}
|
||||
|
||||
/* images */
|
||||
img {
|
||||
border: 2px solid #CCC;
|
||||
}
|
||||
|
||||
img.float-right {
|
||||
margin: 5px 0px 10px 10px;
|
||||
}
|
||||
|
||||
img.float-left {
|
||||
margin: 5px 10px 10px 0px;
|
||||
}
|
||||
|
||||
code {
|
||||
margin: 5px 0;
|
||||
padding: 10px;
|
||||
text-align: left;
|
||||
display: block;
|
||||
overflow: auto;
|
||||
font: 500 1em/ 1.5em 'Lucida Console', 'courier new', monospace;
|
||||
/* white-space: pre; */
|
||||
background: #FAFAFA;
|
||||
border: 1px solid #EAEAEA;
|
||||
border-left: 5px solid #72A545;
|
||||
}
|
||||
|
||||
acronym {
|
||||
cursor: help;
|
||||
border-bottom: 1px solid #777;
|
||||
}
|
||||
|
||||
blockquote {
|
||||
margin: 15px;
|
||||
padding: 0 0 0 32px;
|
||||
background: #FAFAFA url(quote.gif) no-repeat 5px 10px !important;
|
||||
background-position: 8px 10px;
|
||||
border: 1px solid #EAEAEA;
|
||||
border-left: 5px solid #72A545;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/* form elements */
|
||||
fieldset {
|
||||
margin: 12px 12px 18px;
|
||||
padding-left: 6px;
|
||||
border: 1px solid #004080;
|
||||
color: #006699;
|
||||
}
|
||||
|
||||
fieldset fieldset {
|
||||
border: 1px solid #9ea190;
|
||||
margin: 17px 14px;
|
||||
}
|
||||
|
||||
form {
|
||||
margin: 10px 15px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
label {
|
||||
font-weight: bold;
|
||||
margin: 5px 3px 0 0;
|
||||
width: 160px;
|
||||
text-align: right;
|
||||
float: left;
|
||||
}
|
||||
|
||||
legend {
|
||||
font-size: 1.2em;
|
||||
padding: 0 12px;
|
||||
font-weight: 900;
|
||||
background-color: #F9F9F9;
|
||||
}
|
||||
|
||||
fieldset fieldset legend {
|
||||
font-size: 1em;
|
||||
color: #1a2129;
|
||||
padding: 0 18px;
|
||||
margin-left: 75px;
|
||||
}
|
||||
|
||||
input {
|
||||
padding: 3px;
|
||||
margin: 4px 0;
|
||||
border: 1px solid #CFCED3;
|
||||
font: normal 1em Verdana, sans-serif;
|
||||
color: #777;
|
||||
}
|
||||
|
||||
textarea {
|
||||
width: 400px;
|
||||
padding: 4px;
|
||||
font: normal 1em Verdana, sans-serif;
|
||||
border: 1px solid #eee;
|
||||
height: 100px;
|
||||
display: block;
|
||||
color: #777;
|
||||
}
|
||||
|
||||
input.button {
|
||||
margin: 0;
|
||||
font: bold 12px Arial, Sans-serif;
|
||||
border: 1px solid #EAEAEA;
|
||||
padding: 3px 4px;
|
||||
background: #CCC url(buttonbg.gif) repeat-x left bottom;
|
||||
color: #333; /* color: #339900; */
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
input.submitbutton {
|
||||
background-color: #006699;
|
||||
color: #FFF;
|
||||
background-image: none;
|
||||
font-weight: 900;
|
||||
border: 1px solid #EAEAEA;
|
||||
margin: 0 0 0 200px;
|
||||
}
|
||||
|
||||
/* search */
|
||||
#sidebar #search {
|
||||
background: #f2f2f2;
|
||||
margin: 0 15px;
|
||||
padding: 5px 0;
|
||||
}
|
||||
|
||||
#sidebar #search img {
|
||||
vertical-align: bottom;
|
||||
}
|
||||
|
||||
#sidebar #search .textbox {
|
||||
background: #FFF url(input.png) no-repeat top left;
|
||||
border: 1px solid #EAEAEA;
|
||||
font-size: 11px;
|
||||
padding: 3px;
|
||||
width: 110px;
|
||||
}
|
||||
|
||||
#sidebar #search input.searchbutton {
|
||||
margin: 0;
|
||||
font: bold 100% Arial, Sans-serif;
|
||||
border: 1px solid #CCC;
|
||||
background: #CCC url(buttonbg.gif) repeat-x left bottom;
|
||||
padding: 1px;
|
||||
height: 25px;
|
||||
color: #333;
|
||||
width: 55px;
|
||||
}
|
||||
|
||||
/*****************************
|
||||
LAYOUT
|
||||
******************************/
|
||||
#wrap {
|
||||
margin: 0 auto;
|
||||
padding: 0;
|
||||
text-align: left;
|
||||
background-color: #FFF;
|
||||
width: 790px;
|
||||
}
|
||||
|
||||
#content-wrap {
|
||||
clear: both;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 790px;
|
||||
}
|
||||
|
||||
/* header */
|
||||
#header {
|
||||
position: relative;
|
||||
clear: left;
|
||||
width: 790px;
|
||||
height: 137px;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
background: #000 url(headerbg.jpg) no-repeat left bottom;
|
||||
}
|
||||
|
||||
#header h1#logo-text {
|
||||
float: right;
|
||||
margin: 39px 58px 0 0;
|
||||
padding: 0;
|
||||
font: bolder 3.2em 'Trebuchet MS', Arial, Sans-serif;
|
||||
letter-spacing: -2px;
|
||||
color: #FFF;
|
||||
text-transform: none;
|
||||
/* change the values of top and right to adjust the position of the logo*/
|
||||
top: 35px;
|
||||
right: 30px;
|
||||
}
|
||||
|
||||
#header h2#slogan {
|
||||
float: right;
|
||||
margin: 0 38px 0 0;
|
||||
padding: 0;
|
||||
font: bold 1.5em 'Trebuchet MS', Arial, Sans-serif;
|
||||
text-transform: none;
|
||||
letter-spacing: 1px;
|
||||
color: #FFF;
|
||||
clear: both;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
#header h1#logo-text span {
|
||||
color: #CFCED3;
|
||||
}
|
||||
|
||||
/* menu tabs */
|
||||
#header #header-tabs {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 25px;
|
||||
background: #000;
|
||||
font: bold 1.1em Verdana, Tahoma, 'Trebuchet MS', Sans-serif;
|
||||
}
|
||||
|
||||
#header-tabs ul {
|
||||
margin: 0;
|
||||
padding: 2px 0px 0px 0px;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
#header-tabs li {
|
||||
display: inline;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#header-tabs a {
|
||||
float: left;
|
||||
background: url(tableft.gif) no-repeat left top;
|
||||
margin: 0;
|
||||
padding: 0 0 0 4px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#header-tabs a span {
|
||||
float: left;
|
||||
display: block;
|
||||
background: url(tabright.gif) no-repeat right top;
|
||||
padding: 7px 15px 4px 8px;
|
||||
color: #CCC;
|
||||
}
|
||||
|
||||
/* Commented Backslash Hack hides rule from IE5-Mac \*/
|
||||
#header-tabs a span {
|
||||
float: none;
|
||||
}
|
||||
|
||||
/* End IE5-Mac hack */
|
||||
#header-tabs a:hover span {
|
||||
color: #FFF;
|
||||
}
|
||||
|
||||
#header-tabs a:hover {
|
||||
background-position: 0% -42px;
|
||||
}
|
||||
|
||||
#header-tabs a:hover span {
|
||||
background-position: 100% -42px;
|
||||
}
|
||||
|
||||
#header-tabs #current a {
|
||||
background-position: 0% -42px;
|
||||
}
|
||||
|
||||
#header-tabs #current a span {
|
||||
background-position: 100% -42px;
|
||||
color: #FFF;
|
||||
}
|
||||
|
||||
/* main content */
|
||||
#main {
|
||||
width: 748px;
|
||||
margin: 0;
|
||||
padding: 8px 16px;
|
||||
background-color: #F9F9F9;
|
||||
border-left: 5px solid #000;
|
||||
border-right: 5px solid #000;
|
||||
}
|
||||
|
||||
#main h1 {
|
||||
padding: 8px 0 3px 25px;
|
||||
text-transform: none;
|
||||
border-bottom: 2px solid #f2f2f2;
|
||||
color: #339900;
|
||||
}
|
||||
|
||||
/* sidebar */
|
||||
#sidebar { /* float: right;
|
||||
width: 245px;
|
||||
margin: 0 0 10px 0; padding: 0;
|
||||
background-color: inherit; */
|
||||
display: none;
|
||||
}
|
||||
|
||||
#sidebar h1 {
|
||||
padding: 8px 0px 3px 25px;
|
||||
background: url(square_arrow.gif) no-repeat 0% .7em;
|
||||
text-transform: none;
|
||||
color: #339900;
|
||||
}
|
||||
|
||||
#sidebar ul.sidemenu {
|
||||
list-style: none;
|
||||
margin: 10px 15px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#sidebar ul.sidemenu li {
|
||||
margin-bottom: 1px;
|
||||
border: 1px solid #f2f2f2;
|
||||
}
|
||||
|
||||
#sidebar ul.sidemenu a {
|
||||
display: block;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
text-decoration: none;
|
||||
padding: 2px 5px 2px 10px;
|
||||
background: #f2f2f2;
|
||||
border-left: 5px solid #CCC;
|
||||
min-height: 18px;
|
||||
}
|
||||
|
||||
* html body #sidebar ul.sidemenu a {
|
||||
height: 18px;
|
||||
}
|
||||
|
||||
#sidebar ul.sidemenu a:hover {
|
||||
padding: 2px 5px 2px 10px;
|
||||
background: #f2f2f2;
|
||||
color: #339900;
|
||||
border-left: 5px solid #72A545;
|
||||
}
|
||||
|
||||
/* footer */
|
||||
#footer {
|
||||
clear: both;
|
||||
height: 40px;
|
||||
color: #CCC;
|
||||
background: #000;
|
||||
margin: 0;
|
||||
font-size: 92%;
|
||||
}
|
||||
|
||||
#footer a {
|
||||
text-decoration: none;
|
||||
font-weight: bold;
|
||||
color: #FFF;
|
||||
}
|
||||
|
||||
#footer #footer-left {
|
||||
width: 68%;
|
||||
float: left;
|
||||
text-align: left;
|
||||
margin: 0;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
#footer #footer-right {
|
||||
width: 25%;
|
||||
float: right;
|
||||
text-align: right;
|
||||
margin: 0;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
/* alignment classes */
|
||||
.float-left {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.float-right {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.align-left {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.align-right {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
/* additional classes */
|
||||
.clear {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.hide {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.gray {
|
||||
color: #CCC;
|
||||
}
|
||||
|
||||
.comments {
|
||||
color: #333;
|
||||
background: #FFF;
|
||||
text-align: right;
|
||||
border-top: 1px dashed #EFF0F1;
|
||||
border-bottom: 1px dashed #EFF0F1;
|
||||
padding: 5px 0;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
html {
|
||||
min-height: 100.1%;
|
||||
}
|
||||
|
||||
/* ------ one ------------*/
|
||||
body .mainText {
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
#demoText h1,.mainText h1 {
|
||||
font-size: 130%;
|
||||
color: #0099FF;
|
||||
text-decoration: none;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
margin: 5px 4px 5px 24px;
|
||||
background: none;
|
||||
padding: 0;
|
||||
border: none;
|
||||
text-transform: capitalize;
|
||||
}
|
||||
|
||||
.mainText h2 {
|
||||
font-size: 110%;
|
||||
color: #000033;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
text-decoration: none;
|
||||
background: none;
|
||||
margin: 4px 32px 6px 22px;
|
||||
text-transform: capitalize;
|
||||
}
|
||||
|
||||
.mainText h3 {
|
||||
font-size: 120%;
|
||||
font-weight: 900;
|
||||
margin: 14px 0 0 0;
|
||||
text-align: center;
|
||||
color: #000033;
|
||||
}
|
||||
|
||||
.mainText table {
|
||||
width: 95%;
|
||||
border: 1px solid #0099FF;
|
||||
border-collapse: collapse;
|
||||
margin: 18px 7px;
|
||||
}
|
||||
|
||||
.mainText table td {
|
||||
background-color: #99CCFF;
|
||||
color: #000033;
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
.mainText table th {
|
||||
background-color: #000033;
|
||||
color: #99CCFF;
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
.mainText .linkPar a {
|
||||
color: #000033;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.mainText .linkPar a:hover {
|
||||
color: #660033;
|
||||
text-decoration: none;
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
.pusher {
|
||||
cursor: pointer;
|
||||
padding: 3px 10px 3px 22px;
|
||||
font-weight: 900;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
/* ------------- form specific styles are here -------------- */
|
||||
fieldset {
|
||||
margin: 0;
|
||||
border: 1px solid #C3DE00;
|
||||
padding: 10px;
|
||||
/*border:none;
|
||||
padding:0;*/
|
||||
color: #7563A5;
|
||||
}
|
||||
|
||||
legend {
|
||||
background-color: #FFFFFF;
|
||||
text-align: center;
|
||||
color: #097981;
|
||||
padding: 0 12px;
|
||||
}
|
||||
|
||||
label {
|
||||
text-align: right;
|
||||
width: 298px;
|
||||
border-right: 1px dotted #099;
|
||||
padding-right: 5px;
|
||||
margin: 0 0 8px 0;
|
||||
float: left;
|
||||
clear: left;
|
||||
display: block;
|
||||
color: #7563A5;
|
||||
}
|
||||
|
||||
label.checkbox,label.textarea {
|
||||
border: none;
|
||||
}
|
||||
|
||||
label.lgfield {
|
||||
border: none;
|
||||
text-align: center;
|
||||
clear: both;
|
||||
float: none;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
fieldset input,fieldset select,fieldset textarea {
|
||||
margin-left: 10px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
select.longfield {
|
||||
margin: 0 0 0 115px;
|
||||
}
|
||||
|
||||
input [type="radio"],input [type="checkbox"] {
|
||||
margin: 2px 0 0 4px;
|
||||
}
|
||||
|
||||
textarea {
|
||||
width: 250px;
|
||||
float: left;
|
||||
}
|
||||
|
||||
/*Get Help Form Styles*/
|
||||
p.formDisclaimer {
|
||||
text-align: center;
|
||||
margin: 32px 24px 12px 0;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
div.buttonWrapper {
|
||||
margin: 28px 0 14px 0;
|
||||
clear: both;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.formspacer {
|
||||
height: 1em;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.hideField {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.pushOpen {
|
||||
height: 18em;
|
||||
}
|
||||
|
||||
/* ----- error message for field validation ----- */
|
||||
#stepForm label.warning {
|
||||
text-align: left;
|
||||
width: auto;
|
||||
padding: 0;
|
||||
margin: 0 0 0 10px;
|
||||
float: none;
|
||||
clear: none;
|
||||
display: inline;
|
||||
color: #CC3366;
|
||||
font-size: 10px;
|
||||
border: none;
|
||||
border-top: 1px dotted #CC3366;
|
||||
}
|
||||
|
||||
div.requiredNotice {
|
||||
width: 140px;
|
||||
float: right;
|
||||
margin: 0 24px 0 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
h3.stepHeader {
|
||||
text-align: left;
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
margin: 0 0 24px 24px;
|
||||
color: #676cac;
|
||||
}
|
||||
|
||||
ul#stepForm,ul#stepForm li {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
ul#stepForm li {
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
/* Form Buttons */
|
||||
input.submitbutton,.nextbutton,.prevbutton {
|
||||
width: 100px;
|
||||
height: 40px;
|
||||
background-color: #663399;
|
||||
padding: 4px;
|
||||
border: 1px solid #339933;
|
||||
cursor: pointer;
|
||||
text-align: center;
|
||||
color: #FFFFFF;
|
||||
margin: 7px;
|
||||
}
|
||||
|
||||
input.submitbutton {
|
||||
background-color: #006699;
|
||||
}
|
@ -1,160 +0,0 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
|
||||
<title>Test for jQuery validate() plugin</title>
|
||||
|
||||
<link rel="stylesheet" type="text/css" media="screen" href="css/screen.css" />
|
||||
|
||||
<script src="../lib/jquery.js" type="text/javascript"></script>
|
||||
<script src="../lib/jquery.metadata.js" type="text/javascript"></script>
|
||||
<script src="../jquery.validate.js" type="text/javascript"></script>
|
||||
|
||||
<script src="js/cmxforms.js" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
// only for demo purposes
|
||||
$.validator.setDefaults({
|
||||
submitHandler: function() {
|
||||
alert("submitted!");
|
||||
}
|
||||
});
|
||||
|
||||
$.metadata.setType("attr", "validate");
|
||||
|
||||
$(document).ready(function() {
|
||||
$("#form1").validate();
|
||||
$("#selecttest").validate();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style type="text/css">
|
||||
.block { display: block; }
|
||||
form.cmxform label.error { display: none; }
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1 id="banner"><a href="http://bassistance.de/jquery-plugins/jquery-plugin-validation/">jQuery Validation Plugin</a> Demo</h1>
|
||||
<div id="main">
|
||||
|
||||
<form class="cmxform" id="form1" method="get" action="">
|
||||
<fieldset>
|
||||
<legend>Validating a form with a radio and checkbox buttons</legend>
|
||||
<fieldset>
|
||||
<legend>Gender</legend>
|
||||
<label for="gender_male">
|
||||
<input type="radio" id="gender_male" value="m" name="gender" validate="required:true" />
|
||||
Male
|
||||
</label>
|
||||
<label for="gender_female">
|
||||
<input type="radio" id="gender_female" value="f" name="gender"/>
|
||||
Female
|
||||
</label>
|
||||
<label for="gender" class="error">Please select your gender</label>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend>Family</legend>
|
||||
<label for="family_single">
|
||||
<input type="radio" id="family_single" value="s" name="family" validate="required:true" />
|
||||
Single
|
||||
</label>
|
||||
<label for="family_married">
|
||||
<input type="radio" id="family_married" value="m" name="family" />
|
||||
Married
|
||||
</label>
|
||||
<label for="family_divorced">
|
||||
<input type="radio" id="family_divorced" value="d" name="family" />
|
||||
Divorced
|
||||
</label>
|
||||
<label for="family_weird">
|
||||
<input type="radio" id="family_weird" value="w" name="family" />
|
||||
Something weird
|
||||
</label>
|
||||
<label for="family" class="error">Please select your family status.</label>
|
||||
</fieldset>
|
||||
<p>
|
||||
<label for="agree">Please agree to our policy</label>
|
||||
<input type="checkbox" class="checkbox" id="agree" name="agree" validate="required:true" />
|
||||
<br/>
|
||||
<label for="agree" class="error block">Please agree to our policy!</label>
|
||||
</p>
|
||||
<fieldset>
|
||||
<legend>Spam</legend>
|
||||
<label for="spam_email">
|
||||
<input type="checkbox" class="checkbox" id="spam_email" value="email" name="spam[]" validate="required:true, minlength:2" />
|
||||
Spam via E-Mail
|
||||
</label>
|
||||
<label for="spam_phone">
|
||||
<input type="checkbox" class="checkbox" id="spam_phone" value="phone" name="spam[]" />
|
||||
Spam via Phone
|
||||
</label>
|
||||
<label for="spam_mail">
|
||||
<input type="checkbox" class="checkbox" id="spam_mail" value="mail" name="spam[]" />
|
||||
Spam via Mail
|
||||
</label>
|
||||
<label for="spam[]" class="error">Please select at least two types of spam.</label>
|
||||
</fieldset>
|
||||
<p>
|
||||
<input class="submit" type="submit" value="Submit"/>
|
||||
</p>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
<form id="selecttest">
|
||||
<h2>Some tests with selects</h2>
|
||||
<p>
|
||||
<label for="jungle">Please select a jungle noun</label><br/>
|
||||
<select id="jungle" name="jungle" title="Please select something!" validate="required:true">
|
||||
<option value=""></option>
|
||||
<option value="1">Buga</option>
|
||||
<option value="2">Baga</option>
|
||||
<option value="3">Oi</option>
|
||||
</select>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="fruit">Please select at least two fruits</label><br/>
|
||||
<select id="fruit" name="fruit" title="Please select at least two fruits" validate="required:true, minlength:2" multiple="multiple">
|
||||
<option value="b">Banana</option>
|
||||
<option value="a">Apple</option>
|
||||
<option value="p">Peach</option>
|
||||
<option value="t">Turtle</option>
|
||||
</select>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="vegetables">Please select no more than two vergetables</label><br/>
|
||||
<select id="vegetables" name="vegetables" title="Please select no more than two vergetables" validate="required:true, maxlength:2" multiple="multiple">
|
||||
<option value="p">Potato</option>
|
||||
<option value="t">Tomato</option>
|
||||
<option value="s">Salad</option>
|
||||
</select>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="cars">Please select at least two cars, but no more than three</label><br/>
|
||||
<select id="cars" name="cars" title="Please select at least two cars, but no more than three" validate="required:true, rangelength:[2,3]" multiple="multiple">
|
||||
<option value="m_sl">Mercedes SL</option>
|
||||
<option value="o_c">Opel Corsa</option>
|
||||
<option value="vw_p">VW Polo</option>
|
||||
<option value="t_s">Titanic Skoda</option>
|
||||
</select>
|
||||
</p>
|
||||
|
||||
<p><input type="submit" value="Validate Selecttests"/></p>
|
||||
</form>
|
||||
|
||||
<a href="index.html">Back to main page</a>
|
||||
|
||||
</div>
|
||||
|
||||
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
_uacct = "UA-2623402-1";
|
||||
urchinTracker();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
157
thirdparty/jquery-validate/demo/tabs/index.html
vendored
@ -1,157 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<title>jQuery UI tabs integration demo</title>
|
||||
|
||||
<link rel="stylesheet" type="text/css" media="screen" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/themes/base/jquery-ui.css" />
|
||||
|
||||
<script src="../../lib/jquery.js" type="text/javascript"></script>
|
||||
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/jquery-ui.min.js" type="text/javascript"></script>
|
||||
<script src="../../jquery.validate.js" type="text/javascript"></script>
|
||||
|
||||
<script id="demo" type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
var tabs = $("#tabs").tabs();
|
||||
var validator = $("#signupform").validate({
|
||||
groups: {
|
||||
birthdate: "birthdateDay birthdateMonth birthdateYear"
|
||||
},
|
||||
errorPlacement: function(label, element) {
|
||||
if (/^birthdate/.test(element[0].name)) {
|
||||
label.insertAfter("#birthdateYear");
|
||||
} else {
|
||||
label.insertAfter(element);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// validate the other two selects when one changes to update the whole group
|
||||
var birthdaySelects = $("#birthdateGroup select").click(function() {
|
||||
birthdaySelects.not(this).valid();
|
||||
})
|
||||
|
||||
// overwrite focusInvalid to activate tab with invalid elements
|
||||
validator.focusInvalid = function() {
|
||||
if( this.settings.focusInvalid ) {
|
||||
try {
|
||||
var focused = $(this.findLastActive() || this.errorList.length && this.errorList[0].element || []).filter(":visible");
|
||||
tabs.tabs("select", tabs.find(">div").index(focused.parent().parent()));
|
||||
focused.focus();
|
||||
} catch(e) {
|
||||
// ignore IE throwing errors when focusing hidden elements
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
</script>
|
||||
|
||||
<style>
|
||||
body { font-size: 65.2% }
|
||||
label { display: inline-block; width: 8em; }
|
||||
label.error { color: red; margin-left: 0.5em; width: 20em; }
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<form id="signupform">
|
||||
|
||||
<div id="tabs">
|
||||
<ul>
|
||||
<li><a href="#logindata">Login data</a></li>
|
||||
<li><a href="#personaldata">Personal data</a></li>
|
||||
<li><a href="#subscriptions">Subscriptions</a></li>
|
||||
</ul>
|
||||
<div id="logindata">
|
||||
<p>
|
||||
<label for="username">Username</label>
|
||||
<input id="username" name="username" class="required" minlength="3" maxlength="20" type="text" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="email">Email address</label>
|
||||
<input id="email" name="email" class="required email" type="text" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="password">Password</label>
|
||||
<input name="password" type="password" class="required" id="password" minlength="4" maxlength="50" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="confirmpassword">Confirm Password</label>
|
||||
<input name="confirmpassword" type="password" class="required" equalTo="#password" id="confirmpassword" />
|
||||
</p>
|
||||
</div>
|
||||
<div id="personaldata">
|
||||
<p>
|
||||
<label for="street">Street</label>
|
||||
<input id="street" name="street" class="required" minlength="3" maxlength="50" type="text" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="city">City</label>
|
||||
<input id="city" name="city" class="required" minlength="3" maxlength="50" type="text" />
|
||||
</p>
|
||||
<p id="birthdateGroup">
|
||||
<label for="birthdateDay">Birthdate</label>
|
||||
<select id="birthdateDay" name="birthdateDay" class="required">
|
||||
<option value="">Day</option>
|
||||
<option>1</option>
|
||||
<option>2</option>
|
||||
<option>3</option>
|
||||
<option>...</option>
|
||||
</select>
|
||||
<select id="birthdateMonth" name="birthdateMonth" class="required">
|
||||
<option value="">Month</option>
|
||||
<option>1</option>
|
||||
<option>2</option>
|
||||
<option>3</option>
|
||||
<option>4</option>
|
||||
<option>5</option>
|
||||
<option>6</option>
|
||||
<option>7</option>
|
||||
<option>8</option>
|
||||
<option>9</option>
|
||||
<option>10</option>
|
||||
<option>11</option>
|
||||
<option>12</option>
|
||||
</select>
|
||||
<select id="birthdateYear" name="birthdateYear" class="required">
|
||||
<option value="">Year</option>
|
||||
<option>1950</option>
|
||||
<option>1951</option>
|
||||
<option>1952</option>
|
||||
<option>1953</option>
|
||||
<option>1954</option>
|
||||
<option>1955</option>
|
||||
<option>...</option>
|
||||
</select>
|
||||
</p>
|
||||
</div>
|
||||
<div id="subscriptions">
|
||||
<p>
|
||||
<label for="weekly">Weekly Newsletter</label>
|
||||
<input id="weekly" name="weekly" type="checkbox" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="updates">Product Updates</label>
|
||||
<input id="updates" name="updates" type="checkbox" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="terms">Terms and conditions</label>
|
||||
<input id="terms" name="terms" class="required" type="checkbox" />
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="submit" />
|
||||
</form>
|
||||
|
||||
|
||||
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
_uacct = "UA-2623402-1";
|
||||
urchinTracker();
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,75 +0,0 @@
|
||||
<!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>jQuery Validation plugin: integration with TinyMCE</title>
|
||||
|
||||
<script type="text/javascript" src="../../lib/jquery.js"></script>
|
||||
<script type="text/javascript" src="../../jquery.validate.js"></script>
|
||||
<script type="text/javascript" src="tiny_mce.js"></script>
|
||||
<script type="text/javascript">
|
||||
tinyMCE.init({
|
||||
mode : "textareas",
|
||||
theme : "simple",
|
||||
// update validation status on change
|
||||
onchange_callback: function(editor) {
|
||||
tinyMCE.triggerSave();
|
||||
$("#" + editor.id).valid();
|
||||
}
|
||||
});
|
||||
$(function() {
|
||||
var validator = $("#myform").submit(function() {
|
||||
// update underlying textarea before submit validation
|
||||
tinyMCE.triggerSave();
|
||||
}).validate({
|
||||
rules: {
|
||||
title: "required",
|
||||
content: "required"
|
||||
},
|
||||
errorPlacement: function(label, element) {
|
||||
// position error label after generated textarea
|
||||
if (element.is("textarea")) {
|
||||
label.insertAfter(element.next());
|
||||
} else {
|
||||
label.insertAfter(element)
|
||||
}
|
||||
}
|
||||
});
|
||||
validator.focusInvalid = function() {
|
||||
// put focus on tinymce on submit validation
|
||||
if( this.settings.focusInvalid ) {
|
||||
try {
|
||||
var toFocus = $(this.findLastActive() || this.errorList.length && this.errorList[0].element || []);
|
||||
if (toFocus.is("textarea")) {
|
||||
tinyMCE.get(toFocus.attr("id")).focus();
|
||||
} else {
|
||||
toFocus.filter(":visible").focus();
|
||||
}
|
||||
} catch(e) {
|
||||
// ignore IE throwing errors when focusing hidden elements
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<!-- /TinyMCE -->
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<form id="myform" action="">
|
||||
<h3>TinyMCE and Validation Plugin integration example</h3>
|
||||
|
||||
<label>Some other field</label>
|
||||
<input name="title" />
|
||||
|
||||
<br/>
|
||||
|
||||
<label>Some richt text</label>
|
||||
<textarea id="content" name="content" rows="15" cols="80" style="width: 80%"></textarea>
|
||||
|
||||
<br />
|
||||
<input type="submit" name="save" value="Submit" />
|
||||
</form>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1 +0,0 @@
|
||||
(function(){var DOM=tinymce.DOM;tinymce.ThemeManager.requireLangPack('simple');tinymce.create('tinymce.themes.SimpleTheme',{init:function(ed,url){var t=this,states=['Bold','Italic','Underline','Strikethrough','InsertUnorderedList','InsertOrderedList'],s=ed.settings;t.editor=ed;ed.onInit.add(function(){ed.onNodeChange.add(function(ed,cm){tinymce.each(states,function(c){cm.get(c.toLowerCase()).setActive(ed.queryCommandState(c));});});ed.dom.loadCSS(url+"/skins/"+s.skin+"/content.css");});DOM.loadCSS((s.editor_css?ed.documentBaseURI.toAbsolute(s.editor_css):'')||url+"/skins/"+s.skin+"/ui.css");},renderUI:function(o){var t=this,n=o.targetNode,ic,tb,ed=t.editor,cf=ed.controlManager,sc;n=DOM.insertAfter(DOM.create('span',{id:ed.id+'_container','class':'mceEditor '+ed.settings.skin+'SimpleSkin'}),n);n=sc=DOM.add(n,'table',{cellPadding:0,cellSpacing:0,'class':'mceLayout'});n=tb=DOM.add(n,'tbody');n=DOM.add(tb,'tr');n=ic=DOM.add(DOM.add(n,'td'),'div',{'class':'mceIframeContainer'});n=DOM.add(DOM.add(tb,'tr',{'class':'last'}),'td',{'class':'mceToolbar mceLast',align:'center'});tb=t.toolbar=cf.createToolbar("tools1");tb.add(cf.createButton('bold',{title:'simple.bold_desc',cmd:'Bold'}));tb.add(cf.createButton('italic',{title:'simple.italic_desc',cmd:'Italic'}));tb.add(cf.createButton('underline',{title:'simple.underline_desc',cmd:'Underline'}));tb.add(cf.createButton('strikethrough',{title:'simple.striketrough_desc',cmd:'Strikethrough'}));tb.add(cf.createSeparator());tb.add(cf.createButton('undo',{title:'simple.undo_desc',cmd:'Undo'}));tb.add(cf.createButton('redo',{title:'simple.redo_desc',cmd:'Redo'}));tb.add(cf.createSeparator());tb.add(cf.createButton('cleanup',{title:'simple.cleanup_desc',cmd:'mceCleanup'}));tb.add(cf.createSeparator());tb.add(cf.createButton('insertunorderedlist',{title:'simple.bullist_desc',cmd:'InsertUnorderedList'}));tb.add(cf.createButton('insertorderedlist',{title:'simple.numlist_desc',cmd:'InsertOrderedList'}));tb.renderTo(n);return{iframeContainer:ic,editorContainer:ed.id+'_container',sizeContainer:sc,deltaHeight:-20};},getInfo:function(){return{longname:'Simple theme',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.ThemeManager.add('simple',tinymce.themes.SimpleTheme);})();
|
Before Width: | Height: | Size: 1.4 KiB |
@ -1,11 +0,0 @@
|
||||
tinyMCE.addI18n('en.simple',{
|
||||
bold_desc:"Bold (Ctrl+B)",
|
||||
italic_desc:"Italic (Ctrl+I)",
|
||||
underline_desc:"Underline (Ctrl+U)",
|
||||
striketrough_desc:"Strikethrough",
|
||||
bullist_desc:"Unordered list",
|
||||
numlist_desc:"Ordered list",
|
||||
undo_desc:"Undo (Ctrl+Z)",
|
||||
redo_desc:"Redo (Ctrl+Y)",
|
||||
cleanup_desc:"Cleanup messy code"
|
||||
});
|
@ -1,32 +0,0 @@
|
||||
/* Reset */
|
||||
.defaultSimpleSkin table, .defaultSimpleSkin tbody, .defaultSimpleSkin a, .defaultSimpleSkin img, .defaultSimpleSkin tr, .defaultSimpleSkin div, .defaultSimpleSkin td, .defaultSimpleSkin iframe, .defaultSimpleSkin span, .defaultSimpleSkin * {border:0; margin:0; padding:0; background:transparent; white-space:nowrap; text-decoration:none; font-weight:normal; cursor:default; color:#000}
|
||||
|
||||
/* Containers */
|
||||
.defaultSimpleSkin {position:relative}
|
||||
.defaultSimpleSkin table.mceLayout {background:#F0F0EE; border:1px solid #CCC;}
|
||||
.defaultSimpleSkin iframe {display:block; background:#FFF; border-bottom:1px solid #CCC;}
|
||||
.defaultSimpleSkin .mceToolbar {height:24px;}
|
||||
|
||||
/* Layout */
|
||||
.defaultSimpleSkin span.mceIcon, .defaultSimpleSkin img.mceIcon {display:block; width:20px; height:20px}
|
||||
.defaultSimpleSkin .mceIcon {background:url(../../img/icons.gif) no-repeat 20px 20px}
|
||||
|
||||
/* Button */
|
||||
.defaultSimpleSkin .mceButton {display:block; border:1px solid #F0F0EE; width:20px; height:20px}
|
||||
.defaultSimpleSkin a.mceButtonEnabled:hover {border:1px solid #0A246A; background-color:#B2BBD0}
|
||||
.defaultSimpleSkin a.mceButtonActive {border:1px solid #0A246A; background-color:#C2CBE0}
|
||||
.defaultSimpleSkin .mceButtonDisabled span {opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)}
|
||||
|
||||
/* Separator */
|
||||
.defaultSimpleSkin .mceSeparator {display:block; background:url(../../img/icons.gif) -180px 0; width:2px; height:20px; margin:0 2px 0 4px}
|
||||
|
||||
/* Theme */
|
||||
.defaultSimpleSkin span.mce_bold {background-position:0 0}
|
||||
.defaultSimpleSkin span.mce_italic {background-position:-60px 0}
|
||||
.defaultSimpleSkin span.mce_underline {background-position:-140px 0}
|
||||
.defaultSimpleSkin span.mce_strikethrough {background-position:-120px 0}
|
||||
.defaultSimpleSkin span.mce_undo {background-position:-160px 0}
|
||||
.defaultSimpleSkin span.mce_redo {background-position:-100px 0}
|
||||
.defaultSimpleSkin span.mce_cleanup {background-position:-40px 0}
|
||||
.defaultSimpleSkin span.mce_insertunorderedlist {background-position:-20px 0}
|
||||
.defaultSimpleSkin span.mce_insertorderedlist {background-position:-80px 0}
|
71
thirdparty/jquery-validate/test/events.html
vendored
@ -1,71 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
|
||||
<title>Test for jQuery validate() plugin</title>
|
||||
|
||||
<link rel="stylesheet" type="text/css" media="screen" href="css/screen.css" />
|
||||
<script src="../lib/jquery.js" type="text/javascript"></script>
|
||||
<script src="firebug/firebug.js" type="text/javascript"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
$().ready(function() {
|
||||
var handler = {
|
||||
focusin: function() {
|
||||
$(this).addClass("focus");
|
||||
},
|
||||
focusout: function() {
|
||||
$(this).removeClass("focus");
|
||||
}
|
||||
}
|
||||
$("#commentForm").delegate("focusin focusout", ":text, textarea", function(event) {
|
||||
/*
|
||||
this.addClass("focus").one("blur", function() {
|
||||
$(this).removeClass("focus");
|
||||
});
|
||||
*/
|
||||
handler[event.type].call(this, arguments);
|
||||
});
|
||||
$("#remove").click(function() {
|
||||
$("#commentForm").unbind("focusin");
|
||||
})
|
||||
});
|
||||
</script>
|
||||
|
||||
<style type="text/css">
|
||||
#commentForm { width: 500px; }
|
||||
#commentForm label { width: 250px; display: block; float: left; }
|
||||
#commentForm label.error, #commentForm input.submit { margin-left: 253px; }
|
||||
.focus { background-color: red; }
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<form class="cmxform" id="commentForm" method="get" action="">
|
||||
<fieldset>
|
||||
<legend>A simple comment form with submit validation and default messages</legend>
|
||||
<p>
|
||||
<label for="cname">Name (required, at least 2 characters)</label>
|
||||
<input id="cname" name="name" class="some other styles {required:true,minLength:2}" />
|
||||
<p>
|
||||
<label for="cemail">E-Mail (required)</label>
|
||||
<input id="cemail" name="email" class="{required:true,email:true}" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="curl">URL (optional)</label>
|
||||
<input id="curl" name="url" class="{url:true}" value="" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="ccomment">Your comment (required)</label>
|
||||
<textarea id="ccomment" name="comment" class="{required:true}"></textarea>
|
||||
</p>
|
||||
<p>
|
||||
<input class="submit" type="submit" value="Submit"/>
|
||||
</p>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
<button id="remove">Remove focus handler</button>
|
||||
|
||||
</body>
|
||||
</html>
|
Before Width: | Height: | Size: 457 B |
209
thirdparty/jquery-validate/test/firebug/firebug.css
vendored
@ -1,209 +0,0 @@
|
||||
|
||||
html, body {
|
||||
margin: 0;
|
||||
background: #FFFFFF;
|
||||
font-family: Lucida Grande, Tahoma, sans-serif;
|
||||
font-size: 11px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.toolbar {
|
||||
height: 14px;
|
||||
border-top: 1px solid ThreeDHighlight;
|
||||
border-bottom: 1px solid ThreeDShadow;
|
||||
padding: 2px 6px;
|
||||
background: ThreeDFace;
|
||||
}
|
||||
|
||||
.toolbarRight {
|
||||
position: absolute;
|
||||
top: 4px;
|
||||
right: 6px;
|
||||
}
|
||||
|
||||
#log {
|
||||
overflow: auto;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#commandLine {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 18px;
|
||||
border: none;
|
||||
border-top: 1px solid ThreeDShadow;
|
||||
}
|
||||
|
||||
/************************************************************************************************/
|
||||
|
||||
.logRow {
|
||||
position: relative;
|
||||
border-bottom: 1px solid #D7D7D7;
|
||||
padding: 2px 4px 1px 6px;
|
||||
background-color: #FFFFFF;
|
||||
}
|
||||
|
||||
.logRow-command {
|
||||
font-family: Monaco, monospace;
|
||||
color: blue;
|
||||
}
|
||||
|
||||
.objectBox-null {
|
||||
padding: 0 2px;
|
||||
border: 1px solid #666666;
|
||||
background-color: #888888;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
.objectBox-string {
|
||||
font-family: Monaco, monospace;
|
||||
color: red;
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
.objectBox-number {
|
||||
color: #000088;
|
||||
}
|
||||
|
||||
.objectBox-function {
|
||||
font-family: Monaco, monospace;
|
||||
color: DarkGreen;
|
||||
}
|
||||
|
||||
.objectBox-object {
|
||||
color: DarkGreen;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/************************************************************************************************/
|
||||
|
||||
.logRow-info,
|
||||
.logRow-error,
|
||||
.logRow-warning {
|
||||
background: #FFFFFF no-repeat 2px 2px;
|
||||
padding-left: 20px;
|
||||
padding-bottom: 3px;
|
||||
}
|
||||
|
||||
.logRow-info {
|
||||
background-image: url(infoIcon.png);
|
||||
}
|
||||
|
||||
.logRow-warning {
|
||||
background-color: cyan;
|
||||
background-image: url(warningIcon.png);
|
||||
}
|
||||
|
||||
.logRow-error {
|
||||
background-color: LightYellow;
|
||||
background-image: url(errorIcon.png);
|
||||
}
|
||||
|
||||
.errorMessage {
|
||||
vertical-align: top;
|
||||
color: #FF0000;
|
||||
}
|
||||
|
||||
.objectBox-sourceLink {
|
||||
position: absolute;
|
||||
right: 4px;
|
||||
top: 2px;
|
||||
padding-left: 8px;
|
||||
font-family: Lucida Grande, sans-serif;
|
||||
font-weight: bold;
|
||||
color: #0000FF;
|
||||
}
|
||||
|
||||
/************************************************************************************************/
|
||||
|
||||
.logRow-group {
|
||||
background: #EEEEEE;
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.logGroup {
|
||||
background: #EEEEEE;
|
||||
}
|
||||
|
||||
.logGroupBox {
|
||||
margin-left: 24px;
|
||||
border-top: 1px solid #D7D7D7;
|
||||
border-left: 1px solid #D7D7D7;
|
||||
}
|
||||
|
||||
/************************************************************************************************/
|
||||
|
||||
.selectorTag,
|
||||
.selectorId,
|
||||
.selectorClass {
|
||||
font-family: Monaco, monospace;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.selectorTag {
|
||||
color: #0000FF;
|
||||
}
|
||||
|
||||
.selectorId {
|
||||
color: DarkBlue;
|
||||
}
|
||||
|
||||
.selectorClass {
|
||||
color: red;
|
||||
}
|
||||
|
||||
/************************************************************************************************/
|
||||
|
||||
.objectBox-element {
|
||||
font-family: Monaco, monospace;
|
||||
color: #000088;
|
||||
}
|
||||
|
||||
.nodeChildren {
|
||||
margin-left: 16px;
|
||||
}
|
||||
|
||||
.nodeTag {
|
||||
color: blue;
|
||||
}
|
||||
|
||||
.nodeValue {
|
||||
color: #FF0000;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.nodeText,
|
||||
.nodeComment {
|
||||
margin: 0 2px;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.nodeText {
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.nodeComment {
|
||||
color: DarkGreen;
|
||||
}
|
||||
|
||||
/************************************************************************************************/
|
||||
|
||||
.propertyNameCell {
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.propertyName {
|
||||
font-weight: bold;
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
<!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>Firebug</title>
|
||||
<link rel="stylesheet" type="text/css" href="firebug.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="toolbar" class="toolbar">
|
||||
<a href="#" onclick="parent.console.clear()">Clear</a>
|
||||
<span class="toolbarRight">
|
||||
<a href="#" onclick="parent.console.close()">Close</a>
|
||||
</span>
|
||||
</div>
|
||||
<div id="log"></div>
|
||||
<input type="text" id="commandLine">
|
||||
|
||||
<script>parent.onFirebugReady(document);</script>
|
||||
</body>
|
||||
</html>
|
672
thirdparty/jquery-validate/test/firebug/firebug.js
vendored
@ -1,672 +0,0 @@
|
||||
|
||||
if (!("console" in window) || !("firebug" in console)) {
|
||||
(function()
|
||||
{
|
||||
window.console =
|
||||
{
|
||||
log: function()
|
||||
{
|
||||
logFormatted(arguments, "");
|
||||
},
|
||||
|
||||
debug: function()
|
||||
{
|
||||
logFormatted(arguments, "debug");
|
||||
},
|
||||
|
||||
info: function()
|
||||
{
|
||||
logFormatted(arguments, "info");
|
||||
},
|
||||
|
||||
warn: function()
|
||||
{
|
||||
logFormatted(arguments, "warning");
|
||||
},
|
||||
|
||||
error: function()
|
||||
{
|
||||
logFormatted(arguments, "error");
|
||||
},
|
||||
|
||||
assert: function(truth, message)
|
||||
{
|
||||
if (!truth)
|
||||
{
|
||||
var args = [];
|
||||
for (var i = 1; i < arguments.length; ++i)
|
||||
args.push(arguments[i]);
|
||||
|
||||
logFormatted(args.length ? args : ["Assertion Failure"], "error");
|
||||
throw message ? message : "Assertion Failure";
|
||||
}
|
||||
},
|
||||
|
||||
dir: function(object)
|
||||
{
|
||||
var html = [];
|
||||
|
||||
var pairs = [];
|
||||
for (var name in object)
|
||||
{
|
||||
try
|
||||
{
|
||||
pairs.push([name, object[name]]);
|
||||
}
|
||||
catch (exc)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
pairs.sort(function(a, b) { return a[0] < b[0] ? -1 : 1; });
|
||||
|
||||
html.push('<table>');
|
||||
for (var i = 0; i < pairs.length; ++i)
|
||||
{
|
||||
var name = pairs[i][0], value = pairs[i][1];
|
||||
|
||||
html.push('<tr>',
|
||||
'<td class="propertyNameCell"><span class="propertyName">',
|
||||
escapeHTML(name), '</span></td>', '<td><span class="propertyValue">');
|
||||
appendObject(value, html);
|
||||
html.push('</span></td></tr>');
|
||||
}
|
||||
html.push('</table>');
|
||||
|
||||
logRow(html, "dir");
|
||||
},
|
||||
|
||||
dirxml: function(node)
|
||||
{
|
||||
var html = [];
|
||||
|
||||
appendNode(node, html);
|
||||
logRow(html, "dirxml");
|
||||
},
|
||||
|
||||
group: function()
|
||||
{
|
||||
logRow(arguments, "group", pushGroup);
|
||||
},
|
||||
|
||||
groupEnd: function()
|
||||
{
|
||||
logRow(arguments, "", popGroup);
|
||||
},
|
||||
|
||||
time: function(name)
|
||||
{
|
||||
timeMap[name] = (new Date()).getTime();
|
||||
},
|
||||
|
||||
timeEnd: function(name)
|
||||
{
|
||||
if (name in timeMap)
|
||||
{
|
||||
var delta = (new Date()).getTime() - timeMap[name];
|
||||
logFormatted([name+ ":", delta+"ms"]);
|
||||
delete timeMap[name];
|
||||
}
|
||||
},
|
||||
|
||||
count: function()
|
||||
{
|
||||
this.warn(["count() not supported."]);
|
||||
},
|
||||
|
||||
trace: function()
|
||||
{
|
||||
this.warn(["trace() not supported."]);
|
||||
},
|
||||
|
||||
profile: function()
|
||||
{
|
||||
this.warn(["profile() not supported."]);
|
||||
},
|
||||
|
||||
profileEnd: function()
|
||||
{
|
||||
},
|
||||
|
||||
clear: function()
|
||||
{
|
||||
consoleBody.innerHTML = "";
|
||||
},
|
||||
|
||||
open: function()
|
||||
{
|
||||
toggleConsole(true);
|
||||
},
|
||||
|
||||
close: function()
|
||||
{
|
||||
if (frameVisible)
|
||||
toggleConsole();
|
||||
}
|
||||
};
|
||||
|
||||
// ********************************************************************************************
|
||||
|
||||
var consoleFrame = null;
|
||||
var consoleBody = null;
|
||||
var commandLine = null;
|
||||
|
||||
var frameVisible = false;
|
||||
var messageQueue = [];
|
||||
var groupStack = [];
|
||||
var timeMap = {};
|
||||
|
||||
var clPrefix = ">>> ";
|
||||
|
||||
var isFirefox = navigator.userAgent.indexOf("Firefox") != -1;
|
||||
var isIE = navigator.userAgent.indexOf("MSIE") != -1;
|
||||
var isOpera = navigator.userAgent.indexOf("Opera") != -1;
|
||||
var isSafari = navigator.userAgent.indexOf("AppleWebKit") != -1;
|
||||
|
||||
// ********************************************************************************************
|
||||
|
||||
function toggleConsole(forceOpen)
|
||||
{
|
||||
frameVisible = forceOpen || !frameVisible;
|
||||
if (consoleFrame)
|
||||
consoleFrame.style.visibility = frameVisible ? "visible" : "hidden";
|
||||
else
|
||||
waitForBody();
|
||||
}
|
||||
|
||||
function focusCommandLine()
|
||||
{
|
||||
toggleConsole(true);
|
||||
if (commandLine)
|
||||
commandLine.focus();
|
||||
}
|
||||
|
||||
function waitForBody()
|
||||
{
|
||||
if (document.body)
|
||||
createFrame();
|
||||
else
|
||||
setTimeout(waitForBody, 200);
|
||||
}
|
||||
|
||||
function createFrame()
|
||||
{
|
||||
if (consoleFrame)
|
||||
return;
|
||||
|
||||
window.onFirebugReady = function(doc)
|
||||
{
|
||||
window.onFirebugReady = null;
|
||||
|
||||
var toolbar = doc.getElementById("toolbar");
|
||||
toolbar.onmousedown = onSplitterMouseDown;
|
||||
|
||||
commandLine = doc.getElementById("commandLine");
|
||||
addEvent(commandLine, "keydown", onCommandLineKeyDown);
|
||||
|
||||
addEvent(doc, isIE || isSafari ? "keydown" : "keypress", onKeyDown);
|
||||
|
||||
consoleBody = doc.getElementById("log");
|
||||
layout();
|
||||
flush();
|
||||
}
|
||||
|
||||
var baseURL = getFirebugURL();
|
||||
|
||||
consoleFrame = document.createElement("iframe");
|
||||
consoleFrame.setAttribute("src", baseURL+"/firebug.html");
|
||||
consoleFrame.setAttribute("frameBorder", "0");
|
||||
consoleFrame.style.visibility = (frameVisible ? "visible" : "hidden");
|
||||
consoleFrame.style.zIndex = "2147483647";
|
||||
consoleFrame.style.position = "fixed";
|
||||
consoleFrame.style.width = "100%";
|
||||
consoleFrame.style.left = "0";
|
||||
consoleFrame.style.bottom = "0";
|
||||
consoleFrame.style.height = "200px";
|
||||
document.body.appendChild(consoleFrame);
|
||||
}
|
||||
|
||||
function getFirebugURL()
|
||||
{
|
||||
var scripts = document.getElementsByTagName("script");
|
||||
for (var i = 0; i < scripts.length; ++i)
|
||||
{
|
||||
if (scripts[i].src.indexOf("firebug.js") != -1)
|
||||
{
|
||||
var lastSlash = scripts[i].src.lastIndexOf("/");
|
||||
return scripts[i].src.substr(0, lastSlash);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function evalCommandLine()
|
||||
{
|
||||
var text = commandLine.value;
|
||||
commandLine.value = "";
|
||||
|
||||
logRow([clPrefix, text], "command");
|
||||
|
||||
var value;
|
||||
try
|
||||
{
|
||||
value = eval(text);
|
||||
}
|
||||
catch (exc)
|
||||
{
|
||||
}
|
||||
|
||||
console.log(value);
|
||||
}
|
||||
|
||||
function layout()
|
||||
{
|
||||
var toolbar = consoleBody.ownerDocument.getElementById("toolbar");
|
||||
var height = consoleFrame.offsetHeight - (toolbar.offsetHeight + commandLine.offsetHeight);
|
||||
consoleBody.style.top = toolbar.offsetHeight + "px";
|
||||
consoleBody.style.height = height + "px";
|
||||
|
||||
commandLine.style.top = (consoleFrame.offsetHeight - commandLine.offsetHeight) + "px";
|
||||
}
|
||||
|
||||
function logRow(message, className, handler)
|
||||
{
|
||||
if (consoleBody)
|
||||
writeMessage(message, className, handler);
|
||||
else
|
||||
{
|
||||
messageQueue.push([message, className, handler]);
|
||||
waitForBody();
|
||||
}
|
||||
}
|
||||
|
||||
function flush()
|
||||
{
|
||||
var queue = messageQueue;
|
||||
messageQueue = [];
|
||||
|
||||
for (var i = 0; i < queue.length; ++i)
|
||||
writeMessage(queue[i][0], queue[i][1], queue[i][2]);
|
||||
}
|
||||
|
||||
function writeMessage(message, className, handler)
|
||||
{
|
||||
var isScrolledToBottom =
|
||||
consoleBody.scrollTop + consoleBody.offsetHeight >= consoleBody.scrollHeight;
|
||||
|
||||
if (!handler)
|
||||
handler = writeRow;
|
||||
|
||||
handler(message, className);
|
||||
|
||||
if (isScrolledToBottom)
|
||||
consoleBody.scrollTop = consoleBody.scrollHeight - consoleBody.offsetHeight;
|
||||
}
|
||||
|
||||
function appendRow(row)
|
||||
{
|
||||
var container = groupStack.length ? groupStack[groupStack.length-1] : consoleBody;
|
||||
container.appendChild(row);
|
||||
}
|
||||
|
||||
function writeRow(message, className)
|
||||
{
|
||||
var row = consoleBody.ownerDocument.createElement("div");
|
||||
row.className = "logRow" + (className ? " logRow-"+className : "");
|
||||
row.innerHTML = message.join("");
|
||||
appendRow(row);
|
||||
}
|
||||
|
||||
function pushGroup(message, className)
|
||||
{
|
||||
logFormatted(message, className);
|
||||
|
||||
var groupRow = consoleBody.ownerDocument.createElement("div");
|
||||
groupRow.className = "logGroup";
|
||||
var groupRowBox = consoleBody.ownerDocument.createElement("div");
|
||||
groupRowBox.className = "logGroupBox";
|
||||
groupRow.appendChild(groupRowBox);
|
||||
appendRow(groupRowBox);
|
||||
groupStack.push(groupRowBox);
|
||||
}
|
||||
|
||||
function popGroup()
|
||||
{
|
||||
groupStack.pop();
|
||||
}
|
||||
|
||||
// ********************************************************************************************
|
||||
|
||||
function logFormatted(objects, className)
|
||||
{
|
||||
var html = [];
|
||||
|
||||
var format = objects[0];
|
||||
var objIndex = 0;
|
||||
|
||||
if (typeof(format) != "string")
|
||||
{
|
||||
format = "";
|
||||
objIndex = -1;
|
||||
}
|
||||
|
||||
var parts = parseFormat(format);
|
||||
for (var i = 0; i < parts.length; ++i)
|
||||
{
|
||||
var part = parts[i];
|
||||
if (part && typeof(part) == "object")
|
||||
{
|
||||
var object = objects[++objIndex];
|
||||
part.appender(object, html);
|
||||
}
|
||||
else
|
||||
appendText(part, html);
|
||||
}
|
||||
|
||||
for (var i = objIndex+1; i < objects.length; ++i)
|
||||
{
|
||||
appendText(" ", html);
|
||||
|
||||
var object = objects[i];
|
||||
if (typeof(object) == "string")
|
||||
appendText(object, html);
|
||||
else
|
||||
appendObject(object, html);
|
||||
}
|
||||
|
||||
logRow(html, className);
|
||||
}
|
||||
|
||||
function parseFormat(format)
|
||||
{
|
||||
var parts = [];
|
||||
|
||||
var reg = /((^%|[^\\]%)(\d+)?(\.)([a-zA-Z]))|((^%|[^\\]%)([a-zA-Z]))/;
|
||||
var appenderMap = {s: appendText, d: appendInteger, i: appendInteger, f: appendFloat};
|
||||
|
||||
for (var m = reg.exec(format); m; m = reg.exec(format))
|
||||
{
|
||||
var type = m[8] ? m[8] : m[5];
|
||||
var appender = type in appenderMap ? appenderMap[type] : appendObject;
|
||||
var precision = m[3] ? parseInt(m[3]) : (m[4] == "." ? -1 : 0);
|
||||
|
||||
parts.push(format.substr(0, m[0][0] == "%" ? m.index : m.index+1));
|
||||
parts.push({appender: appender, precision: precision});
|
||||
|
||||
format = format.substr(m.index+m[0].length);
|
||||
}
|
||||
|
||||
parts.push(format);
|
||||
|
||||
return parts;
|
||||
}
|
||||
|
||||
function escapeHTML(value)
|
||||
{
|
||||
function replaceChars(ch)
|
||||
{
|
||||
switch (ch)
|
||||
{
|
||||
case "<":
|
||||
return "<";
|
||||
case ">":
|
||||
return ">";
|
||||
case "&":
|
||||
return "&";
|
||||
case "'":
|
||||
return "'";
|
||||
case '"':
|
||||
return """;
|
||||
}
|
||||
return "?";
|
||||
};
|
||||
return String(value).replace(/[<>&"']/g, replaceChars);
|
||||
}
|
||||
|
||||
function objectToString(object)
|
||||
{
|
||||
try
|
||||
{
|
||||
return object+"";
|
||||
}
|
||||
catch (exc)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// ********************************************************************************************
|
||||
|
||||
function appendText(object, html)
|
||||
{
|
||||
html.push(escapeHTML(objectToString(object)));
|
||||
}
|
||||
|
||||
function appendNull(object, html)
|
||||
{
|
||||
html.push('<span class="objectBox-null">', escapeHTML(objectToString(object)), '</span>');
|
||||
}
|
||||
|
||||
function appendString(object, html)
|
||||
{
|
||||
html.push('<span class="objectBox-string">"', escapeHTML(objectToString(object)),
|
||||
'"</span>');
|
||||
}
|
||||
|
||||
function appendInteger(object, html)
|
||||
{
|
||||
html.push('<span class="objectBox-number">', escapeHTML(objectToString(object)), '</span>');
|
||||
}
|
||||
|
||||
function appendFloat(object, html)
|
||||
{
|
||||
html.push('<span class="objectBox-number">', escapeHTML(objectToString(object)), '</span>');
|
||||
}
|
||||
|
||||
function appendFunction(object, html)
|
||||
{
|
||||
var reName = /function ?(.*?)\(/;
|
||||
var m = reName.exec(objectToString(object));
|
||||
var name = m ? m[1] : "function";
|
||||
html.push('<span class="objectBox-function">', escapeHTML(name), '()</span>');
|
||||
}
|
||||
|
||||
function appendObject(object, html)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (object == undefined)
|
||||
appendNull("undefined", html);
|
||||
else if (object == null)
|
||||
appendNull("null", html);
|
||||
else if (typeof object == "string")
|
||||
appendString(object, html);
|
||||
else if (typeof object == "number")
|
||||
appendInteger(object, html);
|
||||
else if (typeof object == "function")
|
||||
appendFunction(object, html);
|
||||
else if (object.nodeType == 1)
|
||||
appendSelector(object, html);
|
||||
else if (typeof object == "object")
|
||||
appendObjectFormatted(object, html);
|
||||
else
|
||||
appendText(object, html);
|
||||
}
|
||||
catch (exc)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
function appendObjectFormatted(object, html)
|
||||
{
|
||||
var text = objectToString(object);
|
||||
var reObject = /\[object (.*?)\]/;
|
||||
|
||||
var m = reObject.exec(text);
|
||||
html.push('<span class="objectBox-object">', m ? m[1] : text, '</span>')
|
||||
}
|
||||
|
||||
function appendSelector(object, html)
|
||||
{
|
||||
html.push('<span class="objectBox-selector">');
|
||||
|
||||
html.push('<span class="selectorTag">', escapeHTML(object.nodeName.toLowerCase()), '</span>');
|
||||
if (object.id)
|
||||
html.push('<span class="selectorId">#', escapeHTML(object.id), '</span>');
|
||||
if (object.className)
|
||||
html.push('<span class="selectorClass">.', escapeHTML(object.className), '</span>');
|
||||
|
||||
html.push('</span>');
|
||||
}
|
||||
|
||||
function appendNode(node, html)
|
||||
{
|
||||
if (node.nodeType == 1)
|
||||
{
|
||||
html.push(
|
||||
'<div class="objectBox-element">',
|
||||
'<<span class="nodeTag">', node.nodeName.toLowerCase(), '</span>');
|
||||
|
||||
for (var i = 0; i < node.attributes.length; ++i)
|
||||
{
|
||||
var attr = node.attributes[i];
|
||||
if (!attr.specified)
|
||||
continue;
|
||||
|
||||
html.push(' <span class="nodeName">', attr.nodeName.toLowerCase(),
|
||||
'</span>="<span class="nodeValue">', escapeHTML(attr.nodeValue),
|
||||
'</span>"')
|
||||
}
|
||||
|
||||
if (node.firstChild)
|
||||
{
|
||||
html.push('></div><div class="nodeChildren">');
|
||||
|
||||
for (var child = node.firstChild; child; child = child.nextSibling)
|
||||
appendNode(child, html);
|
||||
|
||||
html.push('</div><div class="objectBox-element"></<span class="nodeTag">',
|
||||
node.nodeName.toLowerCase(), '></span></div>');
|
||||
}
|
||||
else
|
||||
html.push('/></div>');
|
||||
}
|
||||
else if (node.nodeType == 3)
|
||||
{
|
||||
html.push('<div class="nodeText">', escapeHTML(node.nodeValue),
|
||||
'</div>');
|
||||
}
|
||||
}
|
||||
|
||||
// ********************************************************************************************
|
||||
|
||||
function addEvent(object, name, handler)
|
||||
{
|
||||
if (document.all)
|
||||
object.attachEvent("on"+name, handler);
|
||||
else
|
||||
object.addEventListener(name, handler, false);
|
||||
}
|
||||
|
||||
function removeEvent(object, name, handler)
|
||||
{
|
||||
if (document.all)
|
||||
object.detachEvent("on"+name, handler);
|
||||
else
|
||||
object.removeEventListener(name, handler, false);
|
||||
}
|
||||
|
||||
function cancelEvent(event)
|
||||
{
|
||||
if (document.all)
|
||||
event.cancelBubble = true;
|
||||
else
|
||||
event.stopPropagation();
|
||||
}
|
||||
|
||||
function onError(msg, href, lineNo)
|
||||
{
|
||||
var html = [];
|
||||
|
||||
var lastSlash = href.lastIndexOf("/");
|
||||
var fileName = lastSlash == -1 ? href : href.substr(lastSlash+1);
|
||||
|
||||
html.push(
|
||||
'<span class="errorMessage">', msg, '</span>',
|
||||
'<div class="objectBox-sourceLink">', fileName, ' (line ', lineNo, ')</div>'
|
||||
);
|
||||
|
||||
logRow(html, "error");
|
||||
};
|
||||
|
||||
function onKeyDown(event)
|
||||
{
|
||||
if (event.keyCode == 123)
|
||||
toggleConsole();
|
||||
else if ((event.keyCode == 108 || event.keyCode == 76) && event.shiftKey
|
||||
&& (event.metaKey || event.ctrlKey))
|
||||
focusCommandLine();
|
||||
else
|
||||
return;
|
||||
|
||||
cancelEvent(event);
|
||||
}
|
||||
|
||||
function onSplitterMouseDown(event)
|
||||
{
|
||||
if (isSafari || isOpera)
|
||||
return;
|
||||
|
||||
addEvent(document, "mousemove", onSplitterMouseMove);
|
||||
addEvent(document, "mouseup", onSplitterMouseUp);
|
||||
|
||||
for (var i = 0; i < frames.length; ++i)
|
||||
{
|
||||
addEvent(frames[i].document, "mousemove", onSplitterMouseMove);
|
||||
addEvent(frames[i].document, "mouseup", onSplitterMouseUp);
|
||||
}
|
||||
}
|
||||
|
||||
function onSplitterMouseMove(event)
|
||||
{
|
||||
var win = document.all
|
||||
? event.srcElement.ownerDocument.parentWindow
|
||||
: event.target.ownerDocument.defaultView;
|
||||
|
||||
var clientY = event.clientY;
|
||||
if (win != win.parent)
|
||||
clientY += win.frameElement ? win.frameElement.offsetTop : 0;
|
||||
|
||||
var height = consoleFrame.offsetTop + consoleFrame.clientHeight;
|
||||
var y = height - clientY;
|
||||
|
||||
consoleFrame.style.height = y + "px";
|
||||
layout();
|
||||
}
|
||||
|
||||
function onSplitterMouseUp(event)
|
||||
{
|
||||
removeEvent(document, "mousemove", onSplitterMouseMove);
|
||||
removeEvent(document, "mouseup", onSplitterMouseUp);
|
||||
|
||||
for (var i = 0; i < frames.length; ++i)
|
||||
{
|
||||
removeEvent(frames[i].document, "mousemove", onSplitterMouseMove);
|
||||
removeEvent(frames[i].document, "mouseup", onSplitterMouseUp);
|
||||
}
|
||||
}
|
||||
|
||||
function onCommandLineKeyDown(event)
|
||||
{
|
||||
if (event.keyCode == 13)
|
||||
evalCommandLine();
|
||||
else if (event.keyCode == 27)
|
||||
commandLine.value = "";
|
||||
}
|
||||
|
||||
window.onerror = onError;
|
||||
addEvent(document, isIE || isSafari ? "keydown" : "keypress", onKeyDown);
|
||||
|
||||
if (document.documentElement.getAttribute("debug") == "true")
|
||||
toggleConsole(true);
|
||||
})();
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
|
||||
if (!("console" in window) || !("firebug" in console))
|
||||
{
|
||||
var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
|
||||
"group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
|
||||
|
||||
window.console = {};
|
||||
for (var i = 0; i < names.length; ++i)
|
||||
window.console[names[i]] = function() {}
|
||||
}
|
BIN
thirdparty/jquery-validate/test/firebug/infoIcon.png
vendored
Before Width: | Height: | Size: 524 B |
Before Width: | Height: | Size: 516 B |
261
thirdparty/jquery-validate/test/index.html
vendored
@ -1,261 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html id="html">
|
||||
<head>
|
||||
<title>jQuery - Validation Test Suite</title>
|
||||
<link rel="Stylesheet" media="screen" href="qunit/testsuite.css" />
|
||||
<script type="text/javascript" src="../lib/jquery.js"></script>
|
||||
<script type="text/javascript" src="../lib/jquery.form.js"></script>
|
||||
<script type="text/javascript" src="qunit/testrunner.js"></script>
|
||||
<script type="text/javascript" src="../lib/jquery.metadata.js"></script>
|
||||
<script type="text/javascript" src="../jquery.validate.js"></script>
|
||||
<script type="text/javascript" src="../additional-methods.js"></script>
|
||||
<script type="text/javascript" src="test.js"></script>
|
||||
<script type="text/javascript" src="rules.js"></script>
|
||||
<script type="text/javascript" src="messages.js"></script>
|
||||
<script type="text/javascript" src="methods.js"></script>
|
||||
</head>
|
||||
<body id="body">
|
||||
<h1><a href="http://bassistance.de/jquery-plugins/jquery-plugin-validation/">jQuery Validation Plugin</a> Test Suite</h1>
|
||||
<h2 id="banner"></h2>
|
||||
<h2 id="userAgent"></h2>
|
||||
|
||||
<!-- Test HTML -->
|
||||
<div id="other" style="display:none;">
|
||||
<input type="password" name="pw1" id="pw1" value="engfeh" />
|
||||
<input type="password" name="pw2" id="pw2" value="" />
|
||||
</div>
|
||||
<div id="main" style="display:none;">
|
||||
<p id="firstp">See <a id="simon1" href="http://simon.incutio.com/archive/2003/03/25/#getElementsBySelector" rel="bookmark">this blog entry</a> for more information.</p>
|
||||
<p id="ap">
|
||||
Here are some links in a normal paragraph: <a id="google" href="http://www.google.com/" title="Google!">Google</a>,
|
||||
<a id="groups" href="http://groups.google.com/">Google Groups</a>.
|
||||
This link has <code><a href="#" id="anchor1">class="blog"</a></code>:
|
||||
<a href="http://diveintomark.org/" class="blog" hreflang="en" id="mark">diveintomark</a>
|
||||
|
||||
</p>
|
||||
<div id="foo">
|
||||
<p id="sndp">Everything inside the red border is inside a div with <code>id="foo"</code>.</p>
|
||||
<p lang="en" id="en">This is a normal link: <a id="yahoo" href="http://www.yahoo.com/" class="blogTest">Yahoo</a></p>
|
||||
<p id="sap">This link has <code><a href="#2" id="anchor2">class="blog"</a></code>: <a href="http://simon.incutio.com/" class="blog link" id="simon">Simon Willison's Weblog</a></p>
|
||||
|
||||
</div>
|
||||
<p id="first">Try them out:</p>
|
||||
<ul id="firstUL"></ul>
|
||||
<ol id="empty"></ol>
|
||||
|
||||
<form id="testForm1">
|
||||
<input class="{required:true,minlength:2}" title="buga" name="firstname" id="firstname" />
|
||||
<label id="errorFirstname" for="firstname" class="error">error for firstname</label>
|
||||
<input class="{required:true}" title="buga" name="lastname" id="lastname" />
|
||||
<input class="{required:true}" title="something" name="something" id="something" value="something" />
|
||||
</form>
|
||||
|
||||
<form id="testForm1clean">
|
||||
<input title="buga" name="firstname" id="firstnamec" />
|
||||
<label id="errorFirstname" for="firstname" class="error">error for firstname</label>
|
||||
<input title="buga" name="lastname" id="lastnamec" />
|
||||
<input name="username" id="usernamec" />
|
||||
</form>
|
||||
|
||||
<form id="userForm">
|
||||
<input class="{required:true}" name="username" id="username" />
|
||||
<input type="submit" name="submitButton" value="submitButtonValue" />
|
||||
</form>
|
||||
|
||||
<form method="post" id="signupForm" action="../demo/form.php">
|
||||
<input id="user" name="user" title="Please enter your username (at least 3 characters)" class="{required:true,minlength:3}" />
|
||||
<input type="password" name="password" id="password" class="{required:true,minlength:5}" />
|
||||
</form>
|
||||
|
||||
<form id="testForm2">
|
||||
<input class="{required:true}" type="radio" name="agree" id="agb" />
|
||||
<label for="agree" id="agreeLabel" class="xerror">error for agb</label>
|
||||
</form>
|
||||
|
||||
<form id="testForm3">
|
||||
<select class="{required:true}" name="meal" id="meal" >
|
||||
<option value="">Please select...</option>
|
||||
<option value="1">Food</option>
|
||||
<option value="2">Milk</option>
|
||||
</select>
|
||||
</form>
|
||||
<div class="error" id="errorContainer">
|
||||
<ul>
|
||||
<li class="error" id="errorWrapper">
|
||||
<label for="meal" id="mealLabel" class="error">error for meal</label>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<form id="testForm4">
|
||||
<input class="{foo:true}" name="f1" id="f1" />
|
||||
<input class="{bar:true}" name="f2" id="f2" />
|
||||
</form>
|
||||
|
||||
<form id="testForm5">
|
||||
<input class="{equalTo:'#x2'}" value="x" name="x1" id="x1" />
|
||||
<input class="{equalTo:'#x1'}" value="y" name="x2" id="x2" />
|
||||
</form>
|
||||
|
||||
<form id="testForm6">
|
||||
<input class="{required:true,minlength:2}" type="checkbox" name="check" id="form6check1" />
|
||||
<input type="checkbox" name="check" id="form6check2" />
|
||||
</form>
|
||||
|
||||
<form id="testForm7">
|
||||
<select class="{required:true,minlength:2}" name="selectf7" id="selectf7" multiple="multiple">
|
||||
<option id="optionxa" value="0">0</option>
|
||||
<option id="optionxb" value="1">1</option>
|
||||
<option id="optionxc" value="2">2</option>
|
||||
<option id="optionxd" value="3">3</option>
|
||||
</select>
|
||||
</form>
|
||||
|
||||
<form id="dateRangeForm">
|
||||
<input id="fromDate" name="fromDate" class="requiredDateRange" value="x" />
|
||||
<input id="toDate" name="toDate" class="requiredDateRange" value="y" />
|
||||
<span class="errorContainer"></span>
|
||||
</form>
|
||||
|
||||
<form id="testForm8">
|
||||
<input id="form8input" class="{required:true,number:true,rangelength:[2,8]}" name="abc" />
|
||||
<input type="radio" name="radio1"/>
|
||||
</form>
|
||||
|
||||
<form id="testForm9">
|
||||
<input id="testEmail9" class="{required:true,email:true,messages:{required:'required',email:'email'}}" />
|
||||
</form>
|
||||
|
||||
<div id="simplecontainer">
|
||||
<h3></h3>
|
||||
</div>
|
||||
|
||||
<div id="container"></div>
|
||||
|
||||
<ol id="labelcontainer"></ol>
|
||||
|
||||
<form id="elementsOrder">
|
||||
<select class="required" name="order1" id="order1"><option value="">none</option></select>
|
||||
<input class="required" name="order2" id="order2"/>
|
||||
<input class="required" name="order3" type="checkbox" id="order3"/>
|
||||
<input class="required" name="order4" id="order4"/>
|
||||
<input class="required" name="order5" type="radio" id="order5"/>
|
||||
<input class="required" name="order6" id="order6"/>
|
||||
<ul id="orderContainer">
|
||||
</ul>
|
||||
</form>
|
||||
|
||||
<form id="form" action="formaction">
|
||||
<input type="text" name="action" value="Test" id="text1"/>
|
||||
<input type="text" name="text2" value=" " id="text1b"/>
|
||||
<input type="text" name="text2" value="T " id="text1c"/>
|
||||
<input type="text" name="text2" value="T" id="text2"/>
|
||||
<input type="text" name="text2" value="TestTestTest" id="text3"/>
|
||||
|
||||
<input type="text" name="action" value="0" id="value1"/>
|
||||
<input type="text" name="text2" value="10" id="value2"/>
|
||||
<input type="text" name="text2" value="1000" id="value3"/>
|
||||
|
||||
<input type="radio" name="radio1" id="radio1"/>
|
||||
<input type="radio" name="radio1" id="radio1a"/>
|
||||
<input type="radio" name="radio2" id="radio2" checked="checked"/>
|
||||
<input type="radio" name="radio" id="radio3"/>
|
||||
<input type="radio" name="radio" id="radio4" checked="checked"/>
|
||||
|
||||
<input type="checkbox" name="check" id="check1" checked="checked"/>
|
||||
<input type="checkbox" name="check" id="check1b" />
|
||||
|
||||
<input type="checkbox" name="check2" id="check2"/>
|
||||
|
||||
<input type="checkbox" name="check3" id="check3" checked="checked"/>
|
||||
<input type="checkbox" name="check3" checked="checked"/>
|
||||
<input type="checkbox" name="check3" checked="checked"/>
|
||||
<input type="checkbox" name="check3" checked="checked"/>
|
||||
<input type="checkbox" name="check3" checked="checked"/>
|
||||
|
||||
<input type="hidden" name="hidden" id="hidden1"/>
|
||||
<input type="text" style="display:none;" name="foo[bar]" id="hidden2"/>
|
||||
|
||||
<input type="text" readonly="readonly" id="name" name="name" value="name" />
|
||||
|
||||
<button name="button">Button</button>
|
||||
|
||||
<textarea id="area1" name="area1"">foobar</textarea>
|
||||
|
||||
|
||||
<textarea id="area2" name="area2"></textarea>
|
||||
|
||||
<select name="select1" id="select1">
|
||||
<option id="option1a" value="">Nothing</option>
|
||||
<option id="option1b" value="1">1</option>
|
||||
<option id="option1c" value="2">2</option>
|
||||
<option id="option1d" value="3">3</option>
|
||||
</select>
|
||||
<select name="select2" id="select2">
|
||||
<option id="option2a" value="">Nothing</option>
|
||||
<option id="option2b" value="1">1</option>
|
||||
<option id="option2c" value="2">2</option>
|
||||
<option id="option2d" selected="selected" value="3">3</option>
|
||||
</select>
|
||||
<select name="select3" id="select3" multiple="multiple">
|
||||
<option id="option3a" value="">Nothing</option>
|
||||
<option id="option3b" selected="selected" value="1">1</option>
|
||||
<option id="option3c" selected="selected" value="2">2</option>
|
||||
<option id="option3d" value="3">3</option>
|
||||
</select>
|
||||
<select name="select4" id="select4" multiple="multiple">
|
||||
<option id="option4a" selected="selected" value="1">1</option>
|
||||
<option id="option4b" selected="selected" value="2">2</option>
|
||||
<option id="option4c" selected="selected" value="3">3</option>
|
||||
<option id="option4d" selected="selected" value="4">4</option>
|
||||
<option id="option4e" selected="selected" value="5">5</option>
|
||||
</select>
|
||||
<select name="select5" id="select5" multiple="multiple">
|
||||
<option id="option5a" value="0">0</option>
|
||||
<option id="option5b" value="1">1</option>
|
||||
<option id="option5c" value="2">2</option>
|
||||
<option id="option5d" value="3">3</option>
|
||||
</select>
|
||||
</form>
|
||||
|
||||
<form id="v2">
|
||||
<input id="v2-i1" name="v2-i1" class="required" />
|
||||
<input id="v2-i2" name="v2-i2" class="required email" />
|
||||
<input id="v2-i3" name="v2-i3" class="url" />
|
||||
<input id="v2-i4" name="v2-i4" class="required" minlength="2" />
|
||||
<input id="v2-i5" name="v2-i5" class="required" minlength="2" maxlength="5" customMethod1="123" />
|
||||
<input id="v2-i6" name="v2-i6" class="required customMethod2 {maxlength: 5}" minlength="2" />
|
||||
<input id="v2-i7" name="v2-i7" />
|
||||
</form>
|
||||
|
||||
<form id="checkables">
|
||||
<input type="checkbox" id="checkable1" name="checkablesgroup" class="required" />
|
||||
<input type="checkbox" id="checkable2" name="checkablesgroup" />
|
||||
<input type="checkbox" id="checkable3" name="checkablesgroup" />
|
||||
</form>
|
||||
|
||||
|
||||
<form id="subformRequired">
|
||||
<div class="billingAddressControl">
|
||||
<input type="checkbox" id="bill_to_co" name="bill_to_co" class="toggleCheck" checked="checked" style="width: auto;" tabindex="1" />
|
||||
<label for="bill_to_co" style="cursor:pointer">Same as Company Address</label>
|
||||
</div>
|
||||
<div id="subform">
|
||||
<input maxlength="40" class="billingRequired" name="bill_first_name" size="20" type="text" tabindex="2" value="" />
|
||||
</div>
|
||||
<input id="co_name" class="required" maxlength="40" name="co_name" size="20" type="text" tabindex="1" value="" />
|
||||
</form>
|
||||
|
||||
<form id="withTitle">
|
||||
<input class="required" name="hastitle" type="text" title="fromtitle" />
|
||||
</form>
|
||||
|
||||
<form id="ccform" method="get" action="">
|
||||
<input id="cardnumber" name="cardnumber" />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<ol id="tests"></ol>
|
||||
|
||||
</body>
|
||||
</html>
|
188
thirdparty/jquery-validate/test/large.html
vendored
@ -1,188 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
|
||||
<title>Test for jQuery validate() plugin</title>
|
||||
|
||||
<link rel="stylesheet" type="text/css" media="screen" href="css/screen.css" />
|
||||
<script src="../lib/jquery.js" type="text/javascript"></script>
|
||||
<script src="../lib/jquery.metadata.js" type="text/javascript"></script>
|
||||
<script src="../lib/jquery.ajaxQueue.js" type="text/javascript"></script>
|
||||
<script src="../jquery.validate.js" type="text/javascript"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
$().ready(function() {
|
||||
$("#commentForm").validate();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style type="text/css">
|
||||
#commentForm { width: 500px; }
|
||||
#commentForm label { width: 250px; display: block; float: left; }
|
||||
#commentForm label.error, #commentForm input.submit { margin-left: 253px; }
|
||||
.focus { background-color: red; }
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<form class="cmxform" id="commentForm" method="get" action="">
|
||||
<fieldset>
|
||||
<legend>A simple comment form with submit validation and default messages</legend>
|
||||
<p>
|
||||
<label for="cname-x0">Name (required, at least 2 characters)</label>
|
||||
<input id="cname-x0" name="name-x0" class="some other styles {required:true,minLength:2}" />
|
||||
<p>
|
||||
<label for="cemail-x0">E-Mail (required)</label>
|
||||
<input id="cemail-x0" name="email-x0" class="{required:true,email:true}" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="curl-x0">URL (optional)</label>
|
||||
<input id="curl-x0" name="url-x0" class="{url:true}" value="" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="ccomment-x0">Your comment (required)</label>
|
||||
<textarea id="ccomment-x0" name="comment-x0" class="{required:true}"></textarea>
|
||||
</p>
|
||||
<p>
|
||||
<label for="cname-x1">Name (required, at least 2 characters)</label>
|
||||
<input class="some other styles {required:true,minLength:2}" name="name-x1" id="cname-x1"/>
|
||||
</p><p>
|
||||
<label for="cemail-x1">E-Mail (required)</label>
|
||||
<input class="{required:true,email:true}" name="email-x1" id="cemail-x1"/>
|
||||
</p>
|
||||
<p>
|
||||
<label for="curl-x1">URL (optional)</label>
|
||||
<input value="" class="{url:true}" name="url-x1" id="curl-x1"/>
|
||||
</p>
|
||||
<p>
|
||||
<label for="ccomment-x1">Your comment (required)</label>
|
||||
<textarea class="{required:true}" name="comment-x1" id="ccomment-x1"></textarea>
|
||||
</p>
|
||||
<p>
|
||||
<label for="cname-x2">Name (required, at least 2 characters)</label>
|
||||
<input class="some other styles {required:true,minLength:2}" name="name-x2" id="cname-x2"/>
|
||||
</p><p>
|
||||
<label for="cemail-x2">E-Mail (required)</label>
|
||||
<input class="{required:true,email:true}" name="email-x2" id="cemail-x2"/>
|
||||
</p>
|
||||
<p>
|
||||
<label for="curl-x2">URL (optional)</label>
|
||||
<input value="" class="{url:true}" name="url-x2" id="curl-x2"/>
|
||||
</p>
|
||||
<p>
|
||||
<label for="ccomment-x2">Your comment (required)</label>
|
||||
<textarea class="{required:true}" name="comment-x2" id="ccomment-x2"></textarea>
|
||||
</p>
|
||||
<p>
|
||||
<label for="cname-x3">Name (required, at least 2 characters)</label>
|
||||
<input class="some other styles {required:true,minLength:2}" name="name-x3" id="cname-x3"/>
|
||||
</p><p>
|
||||
<label for="cemail-x3">E-Mail (required)</label>
|
||||
<input class="{required:true,email:true}" name="email-x3" id="cemail-x3"/>
|
||||
</p>
|
||||
<p>
|
||||
<label for="curl-x3">URL (optional)</label>
|
||||
<input value="" class="{url:true}" name="url-x3" id="curl-x3"/>
|
||||
</p>
|
||||
<p>
|
||||
<label for="ccomment-x3">Your comment (required)</label>
|
||||
<textarea class="{required:true}" name="comment-x3" id="ccomment-x3"></textarea>
|
||||
</p>
|
||||
<p>
|
||||
<label for="cname-x4">Name (required, at least 2 characters)</label>
|
||||
<input class="some other styles {required:true,minLength:2}" name="name-x4" id="cname-x4"/>
|
||||
</p><p>
|
||||
<label for="cemail-x4">E-Mail (required)</label>
|
||||
<input class="{required:true,email:true}" name="email-x4" id="cemail-x4"/>
|
||||
</p>
|
||||
<p>
|
||||
<label for="curl-x4">URL (optional)</label>
|
||||
<input value="" class="{url:true}" name="url-x4" id="curl-x4"/>
|
||||
</p>
|
||||
<p>
|
||||
<label for="ccomment-x4">Your comment (required)</label>
|
||||
<textarea class="{required:true}" name="comment-x4" id="ccomment-x4"></textarea>
|
||||
</p>
|
||||
<p>
|
||||
<label for="cname-x5">Name (required, at least 2 characters)</label>
|
||||
<input class="some other styles {required:true,minLength:2}" name="name-x5" id="cname-x5"/>
|
||||
</p><p>
|
||||
<label for="cemail-x5">E-Mail (required)</label>
|
||||
<input class="{required:true,email:true}" name="email-x5" id="cemail-x5"/>
|
||||
</p>
|
||||
<p>
|
||||
<label for="curl-x5">URL (optional)</label>
|
||||
<input value="" class="{url:true}" name="url-x5" id="curl-x5"/>
|
||||
</p>
|
||||
<p>
|
||||
<label for="ccomment-x5">Your comment (required)</label>
|
||||
<textarea class="{required:true}" name="comment-x5" id="ccomment-x5"></textarea>
|
||||
</p>
|
||||
<p>
|
||||
<label for="cname-x6">Name (required, at least 2 characters)</label>
|
||||
<input class="some other styles {required:true,minLength:2}" name="name-x6" id="cname-x6"/>
|
||||
</p><p>
|
||||
<label for="cemail-x6">E-Mail (required)</label>
|
||||
<input class="{required:true,email:true}" name="email-x6" id="cemail-x6"/>
|
||||
</p>
|
||||
<p>
|
||||
<label for="curl-x6">URL (optional)</label>
|
||||
<input value="" class="{url:true}" name="url-x6" id="curl-x6"/>
|
||||
</p>
|
||||
<p>
|
||||
<label for="ccomment-x6">Your comment (required)</label>
|
||||
<textarea class="{required:true}" name="comment-x6" id="ccomment-x6"></textarea>
|
||||
</p>
|
||||
<p>
|
||||
<label for="cname-x7">Name (required, at least 2 characters)</label>
|
||||
<input class="some other styles {required:true,minLength:2}" name="name-x7" id="cname-x7"/>
|
||||
</p><p>
|
||||
<label for="cemail-x7">E-Mail (required)</label>
|
||||
<input class="{required:true,email:true}" name="email-x7" id="cemail-x7"/>
|
||||
</p>
|
||||
<p>
|
||||
<label for="curl-x7">URL (optional)</label>
|
||||
<input value="" class="{url:true}" name="url-x7" id="curl-x7"/>
|
||||
</p>
|
||||
<p>
|
||||
<label for="ccomment-x7">Your comment (required)</label>
|
||||
<textarea class="{required:true}" name="comment-x7" id="ccomment-x7"></textarea>
|
||||
</p>
|
||||
<p>
|
||||
<label for="cname-x8">Name (required, at least 2 characters)</label>
|
||||
<input class="some other styles {required:true,minLength:2}" name="name-x8" id="cname-x8"/>
|
||||
</p><p>
|
||||
<label for="cemail-x8">E-Mail (required)</label>
|
||||
<input class="{required:true,email:true}" name="email-x8" id="cemail-x8"/>
|
||||
</p>
|
||||
<p>
|
||||
<label for="curl-x8">URL (optional)</label>
|
||||
<input value="" class="{url:true}" name="url-x8" id="curl-x8"/>
|
||||
</p>
|
||||
<p>
|
||||
<label for="ccomment-x8">Your comment (required)</label>
|
||||
<textarea class="{required:true}" name="comment-x8" id="ccomment-x8"></textarea>
|
||||
</p>
|
||||
<p>
|
||||
<label for="cname-x9">Name (required, at least 2 characters)</label>
|
||||
<input class="some other styles {required:true,minLength:2}" name="name-x9" id="cname-x9"/>
|
||||
</p><p>
|
||||
<label for="cemail-x9">E-Mail (required)</label>
|
||||
<input class="{required:true,email:true}" name="email-x9" id="cemail-x9"/>
|
||||
</p>
|
||||
<p>
|
||||
<label for="curl-x9">URL (optional)</label>
|
||||
<input value="" class="{url:true}" name="url-x9" id="curl-x9"/>
|
||||
</p>
|
||||
<p>
|
||||
<label for="ccomment-x9">Your comment (required)</label>
|
||||
<textarea class="{required:true}" name="comment-x9" id="ccomment-x9"></textarea>
|
||||
</p>
|
||||
<p>
|
||||
<input class="submit" type="submit" value="Submit"/>
|
||||
</p>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
</body>
|
||||
</html>
|
62
thirdparty/jquery-validate/test/messages.js
vendored
@ -1,62 +0,0 @@
|
||||
module("messages");
|
||||
|
||||
test("predefined message not overwritten by addMethod(a, b, undefined)", function() {
|
||||
var message = "my custom message";
|
||||
$.validator.messages.custom = message;
|
||||
$.validator.addMethod("custom", function() {});
|
||||
same(message, $.validator.messages.custom);
|
||||
delete $.validator.messages.custom;
|
||||
delete $.validator.methods.custom;
|
||||
});
|
||||
|
||||
test("group error messages", function() {
|
||||
$.validator.addClassRules({
|
||||
requiredDateRange: {required:true, date:true, dateRange:true}
|
||||
});
|
||||
$.validator.addMethod("dateRange", function() {
|
||||
return new Date($("#fromDate").val()) < new Date($("#toDate").val());
|
||||
}, "Please specify a correct date range.");
|
||||
var form = $("#dateRangeForm");
|
||||
form.validate({
|
||||
groups: {
|
||||
dateRange: "fromDate toDate"
|
||||
},
|
||||
errorPlacement: function(error) {
|
||||
form.find(".errorContainer").append(error);
|
||||
}
|
||||
});
|
||||
ok( !form.valid() );
|
||||
equals( 1, form.find(".errorContainer *").length );
|
||||
equals( "Please enter a valid date.", form.find(".errorContainer label.error").text() );
|
||||
|
||||
$("#fromDate").val("12/03/2006");
|
||||
$("#toDate").val("12/01/2006");
|
||||
ok( !form.valid() );
|
||||
equals( "Please specify a correct date range.", form.find(".errorContainer label.error").text() );
|
||||
|
||||
$("#toDate").val("12/04/2006");
|
||||
ok( form.valid() );
|
||||
ok( form.find(".errorContainer label.error").is(":hidden") );
|
||||
});
|
||||
|
||||
test("read messages from metadata", function() {
|
||||
var form = $("#testForm9")
|
||||
form.validate();
|
||||
var e = $("#testEmail9")
|
||||
e.valid();
|
||||
equals( form.find("label").text(), "required" );
|
||||
e.val("bla").valid();
|
||||
equals( form.find("label").text(), "email" );
|
||||
});
|
||||
|
||||
|
||||
test("read messages from metadata, with meta option specified, but no metadata in there", function() {
|
||||
var form = $("#testForm1clean")
|
||||
form.validate({
|
||||
meta: "validate",
|
||||
rules: {
|
||||
firstname: "required"
|
||||
}
|
||||
});
|
||||
ok(!form.valid(), "not valid");
|
||||
});
|
553
thirdparty/jquery-validate/test/methods.js
vendored
@ -1,553 +0,0 @@
|
||||
function methodTest( methodName ) {
|
||||
var v = jQuery("#form").validate();
|
||||
var method = $.validator.methods[methodName];
|
||||
var element = $("#firstname")[0];
|
||||
return function(value) {
|
||||
element.value = value;
|
||||
return method.call( v, value, element );
|
||||
};
|
||||
}
|
||||
|
||||
module("methods");
|
||||
|
||||
test("default messages", function() {
|
||||
var m = $.validator.methods;
|
||||
$.each(m, function(key) {
|
||||
ok( jQuery.validator.messages[key], key + " has a default message." );
|
||||
});
|
||||
});
|
||||
|
||||
test("digit", function() {
|
||||
var method = methodTest("digits");
|
||||
ok( method( "123" ), "Valid digits" );
|
||||
ok(!method( "123.000" ), "Invalid digits" );
|
||||
ok(!method( "123.000,00" ), "Invalid digits" );
|
||||
ok(!method( "123.0.0,0" ), "Invalid digits" );
|
||||
ok(!method( "x123" ), "Invalid digits" );
|
||||
ok(!method( "100.100,0,0" ), "Invalid digits" );
|
||||
});
|
||||
|
||||
test("url", function() {
|
||||
var method = methodTest("url");
|
||||
ok( method( "http://bassistance.de/jquery/plugin.php?bla=blu" ), "Valid url" );
|
||||
ok( method( "https://bassistance.de/jquery/plugin.php?bla=blu" ), "Valid url" );
|
||||
ok( method( "ftp://bassistance.de/jquery/plugin.php?bla=blu" ), "Valid url" );
|
||||
ok( method( "http://www.føtex.dk/" ), "Valid url, danish unicode characters" );
|
||||
ok( method( "http://bösendorfer.de/" ), "Valid url, german unicode characters" );
|
||||
ok( method( "http://192.168.8.5" ), "Valid IP Address" )
|
||||
ok(!method( "http://192.168.8." ), "Invalid IP Address" )
|
||||
ok(!method( "http://bassistance" ), "Invalid url" ); // valid
|
||||
ok(!method( "http://bassistance." ), "Invalid url" ); // valid
|
||||
ok(!method( "http://bassistance,de" ), "Invalid url" );
|
||||
ok(!method( "http://bassistance;de" ), "Invalid url" );
|
||||
ok(!method( "http://.bassistancede" ), "Invalid url" );
|
||||
ok(!method( "bassistance.de" ), "Invalid url" );
|
||||
});
|
||||
|
||||
test("url2 (tld optional)", function() {
|
||||
var method = methodTest("url2");
|
||||
ok( method( "http://bassistance.de/jquery/plugin.php?bla=blu" ), "Valid url" );
|
||||
ok( method( "https://bassistance.de/jquery/plugin.php?bla=blu" ), "Valid url" );
|
||||
ok( method( "ftp://bassistance.de/jquery/plugin.php?bla=blu" ), "Valid url" );
|
||||
ok( method( "http://www.føtex.dk/" ), "Valid url, danish unicode characters" );
|
||||
ok( method( "http://bösendorfer.de/" ), "Valid url, german unicode characters" );
|
||||
ok( method( "http://192.168.8.5" ), "Valid IP Address" )
|
||||
ok(!method( "http://192.168.8." ), "Invalid IP Address" )
|
||||
ok( method( "http://bassistance" ), "Invalid url" );
|
||||
ok( method( "http://bassistance." ), "Invalid url" );
|
||||
ok(!method( "http://bassistance,de" ), "Invalid url" );
|
||||
ok(!method( "http://bassistance;de" ), "Invalid url" );
|
||||
ok(!method( "http://.bassistancede" ), "Invalid url" );
|
||||
ok(!method( "bassistance.de" ), "Invalid url" );
|
||||
});
|
||||
|
||||
test("email", function() {
|
||||
var method = methodTest("email");
|
||||
ok( method( "name@domain.tld" ), "Valid email" );
|
||||
ok( method( "name@domain.tl" ), "Valid email" );
|
||||
ok( method( "bart+bart@tokbox.com" ), "Valid email" );
|
||||
ok( method( "bart+bart@tokbox.travel" ), "Valid email" );
|
||||
ok( method( "n@d.tld" ), "Valid email" );
|
||||
ok( method( "ole@føtex.dk"), "Valid email" );
|
||||
ok( method( "jörn@bassistance.de"), "Valid email" );
|
||||
ok( method( "bla.blu@g.mail.com"), "Valid email" );
|
||||
ok( method( "\"Scott Gonzalez\"@example.com" ), "Valid email" );
|
||||
ok( method( "\"Scott González\"@example.com" ), "Valid email" );
|
||||
ok( method( "\"name.\"@domain.tld" ), "Valid email" ); // valid without top label
|
||||
ok( method( "\"name,\"@domain.tld" ), "Valid email" ); // valid without top label
|
||||
ok( method( "\"name;\"@domain.tld" ), "Valid email" ); // valid without top label
|
||||
ok(!method( "name" ), "Invalid email" );
|
||||
ok(!method( "name@" ), "Invalid email" );
|
||||
ok(!method( "name@domain" ), "Invalid email" );
|
||||
ok(!method( "name.@domain.tld" ), "Invalid email" );
|
||||
ok(!method( "name,@domain.tld" ), "Invalid email" );
|
||||
ok(!method( "name;@domain.tld" ), "Invalid email" );
|
||||
});
|
||||
|
||||
test("email2 (tld optional)", function() {
|
||||
var method = methodTest("email2");
|
||||
ok( method( "name@domain.tld" ), "Valid email" );
|
||||
ok( method( "name@domain.tl" ), "Valid email" );
|
||||
ok( method( "bart+bart@tokbox.com" ), "Valid email" );
|
||||
ok( method( "bart+bart@tokbox.travel" ), "Valid email" );
|
||||
ok( method( "n@d.tld" ), "Valid email" );
|
||||
ok( method( "ole@føtex.dk"), "Valid email" );
|
||||
ok( method( "jörn@bassistance.de"), "Valid email" );
|
||||
ok( method( "bla.blu@g.mail.com"), "Valid email" );
|
||||
ok( method( "\"Scott Gonzalez\"@example.com" ), "Valid email" );
|
||||
ok( method( "\"Scott González\"@example.com" ), "Valid email" );
|
||||
ok( method( "\"name.\"@domain.tld" ), "Valid email" ); // valid without top label
|
||||
ok( method( "\"name,\"@domain.tld" ), "Valid email" ); // valid without top label
|
||||
ok( method( "\"name;\"@domain.tld" ), "Valid email" ); // valid without top label
|
||||
ok(!method( "name" ), "Invalid email" );
|
||||
ok(!method( "name@" ), "Invalid email" );
|
||||
ok( method( "name@domain" ), "Invalid email" );
|
||||
ok(!method( "name.@domain.tld" ), "Invalid email" );
|
||||
ok(!method( "name,@domain.tld" ), "Invalid email" );
|
||||
ok(!method( "name;@domain.tld" ), "Invalid email" );
|
||||
});
|
||||
|
||||
test("number", function() {
|
||||
var method = methodTest("number");
|
||||
ok( method( "123" ), "Valid number" );
|
||||
ok( method( "-123" ), "Valid number" );
|
||||
ok( method( "123,000" ), "Valid number" );
|
||||
ok( method( "-123,000" ), "Valid number" );
|
||||
ok( method( "123,000.00" ), "Valid number" );
|
||||
ok( method( "-123,000.00" ), "Valid number" );
|
||||
ok(!method( "123.000,00" ), "Invalid number" );
|
||||
ok(!method( "123.0.0,0" ), "Invalid number" );
|
||||
ok(!method( "x123" ), "Invalid number" );
|
||||
ok(!method( "100.100,0,0" ), "Invalid number" );
|
||||
|
||||
ok( method( "" ), "Blank is valid" );
|
||||
ok( method( "123" ), "Valid decimal" );
|
||||
ok( method( "123000" ), "Valid decimal" );
|
||||
ok( method( "123000.12" ), "Valid decimal" );
|
||||
ok( method( "-123000.12" ), "Valid decimal" );
|
||||
ok( method( "123.000" ), "Valid decimal" );
|
||||
ok( method( "123,000.00" ), "Valid decimal" );
|
||||
ok( method( "-123,000.00" ), "Valid decimal" );
|
||||
ok(!method( "1230,000.00" ), "Invalid decimal" );
|
||||
ok(!method( "123.0.0,0" ), "Invalid decimal" );
|
||||
ok(!method( "x123" ), "Invalid decimal" );
|
||||
ok(!method( "100.100,0,0" ), "Invalid decimal" );
|
||||
});
|
||||
|
||||
test("numberDE", function() {
|
||||
var method = methodTest("numberDE");
|
||||
ok( method( "123" ), "Valid numberDE" );
|
||||
ok( method( "-123" ), "Valid numberDE" );
|
||||
ok( method( "123.000" ), "Valid numberDE" );
|
||||
ok( method( "-123.000" ), "Valid numberDE" );
|
||||
ok( method( "123.000,00" ), "Valid numberDE" );
|
||||
ok( method( "-123.000,00" ), "Valid numberDE" );
|
||||
ok(!method( "123,000.00" ), "Invalid numberDE" );
|
||||
ok(!method( "123,0,0.0" ), "Invalid numberDE" );
|
||||
ok(!method( "x123" ), "Invalid numberDE" );
|
||||
ok(!method( "100,100.0.0" ), "Invalid numberDE" );
|
||||
|
||||
ok( method( "" ), "Blank is valid" );
|
||||
ok( method( "123" ), "Valid decimalDE" );
|
||||
ok( method( "123000" ), "Valid decimalDE" );
|
||||
ok( method( "123000,12" ), "Valid decimalDE" );
|
||||
ok( method( "-123000,12" ), "Valid decimalDE" );
|
||||
ok( method( "123.000" ), "Valid decimalDE" );
|
||||
ok( method( "123.000,00" ), "Valid decimalDE" );
|
||||
ok( method( "-123.000,00" ), "Valid decimalDE" )
|
||||
ok(!method( "123.0.0,0" ), "Invalid decimalDE" );
|
||||
ok(!method( "x123" ), "Invalid decimalDE" );
|
||||
ok(!method( "100,100.0.0" ), "Invalid decimalDE" );
|
||||
});
|
||||
|
||||
test("date", function() {
|
||||
var method = methodTest("date");
|
||||
ok( method( "06/06/1990" ), "Valid date" );
|
||||
ok( method( "6/6/06" ), "Valid date" );
|
||||
ok(!method( "1990x-06-06" ), "Invalid date" );
|
||||
});
|
||||
|
||||
test("dateISO", function() {
|
||||
var method = methodTest("dateISO");
|
||||
ok( method( "1990-06-06" ), "Valid date" );
|
||||
ok( method( "1990/06/06" ), "Valid date" );
|
||||
ok( method( "1990-6-6" ), "Valid date" );
|
||||
ok( method( "1990/6/6" ), "Valid date" );
|
||||
ok(!method( "1990-106-06" ), "Invalid date" );
|
||||
ok(!method( "190-06-06" ), "Invalid date" );
|
||||
});
|
||||
|
||||
test("dateDE", function() {
|
||||
var method = methodTest("dateDE");
|
||||
ok( method( "03.06.1984" ), "Valid dateDE" );
|
||||
ok( method( "3.6.84" ), "Valid dateDE" );
|
||||
ok(!method( "6-6-06" ), "Invalid dateDE" );
|
||||
ok(!method( "1990-06-06" ), "Invalid dateDE" );
|
||||
ok(!method( "06/06/1990" ), "Invalid dateDE" );
|
||||
ok(!method( "6/6/06" ), "Invalid dateDE" );
|
||||
});
|
||||
|
||||
test("required", function() {
|
||||
var v = jQuery("#form").validate(),
|
||||
method = $.validator.methods.required,
|
||||
e = $('#text1, #text1b, #hidden2, #select1, #select2');
|
||||
ok( method.call( v, e[0].value, e[0]), "Valid text input" );
|
||||
ok(!method.call( v, e[1].value, e[1]), "Invalid text input" );
|
||||
ok(!method.call( v, e[1].value, e[2]), "Invalid text input" );
|
||||
|
||||
ok(!method.call( v, e[2].value, e[3]), "Invalid select" );
|
||||
ok( method.call( v, e[3].value, e[4]), "Valid select" );
|
||||
|
||||
e = $('#area1, #area2, #pw1, #pw2');
|
||||
ok( method.call( v, e[0].value, e[0]), "Valid textarea" );
|
||||
ok(!method.call( v, e[1].value, e[1]), "Invalid textarea" );
|
||||
ok( method.call( v, e[2].value, e[2]), "Valid password input" );
|
||||
ok(!method.call( v, e[3].value, e[3]), "Invalid password input" );
|
||||
|
||||
e = $('#radio1, #radio2, #radio3');
|
||||
ok(!method.call( v, e[0].value, e[0]), "Invalid radio" );
|
||||
ok( method.call( v, e[1].value, e[1]), "Valid radio" );
|
||||
ok( method.call( v, e[2].value, e[2]), "Valid radio" );
|
||||
|
||||
e = $('#check1, #check2');
|
||||
ok( method.call( v, e[0].value, e[0]), "Valid checkbox" );
|
||||
ok(!method.call( v, e[1].value, e[1]), "Invalid checkbox" );
|
||||
|
||||
e = $('#select1, #select2, #select3, #select4');
|
||||
ok(!method.call( v, e[0].value, e[0]), "Invalid select" );
|
||||
ok( method.call( v, e[1].value, e[1]), "Valid select" );
|
||||
ok( method.call( v, e[2].value, e[2]), "Valid select" );
|
||||
ok( method.call( v, e[3].value, e[3]), "Valid select" );
|
||||
});
|
||||
|
||||
test("required with dependencies", function() {
|
||||
var v = jQuery("#form").validate(),
|
||||
method = $.validator.methods.required,
|
||||
e = $('#hidden2, #select1, #area2, #radio1, #check2');
|
||||
ok( method.call( v, e[0].value, e[0], "asffsaa"), "Valid text input due to depencie not met" );
|
||||
ok(!method.call( v, e[0].value, e[0], "input"), "Invalid text input" );
|
||||
ok( method.call( v, e[0].value, e[0], function() { return false; }), "Valid text input due to depencie not met" );
|
||||
ok(!method.call( v, e[0].value, e[0], function() { return true; }), "Invalid text input" );
|
||||
ok( method.call( v, e[1].value, e[1], "asfsfa"), "Valid select due to dependency not met" );
|
||||
ok(!method.call( v, e[1].value, e[1], "input"), "Invalid select" );
|
||||
ok( method.call( v, e[2].value, e[2], "asfsafsfa"), "Valid textarea due to dependency not met" );
|
||||
ok(!method.call( v, e[2].value, e[2], "input"), "Invalid textarea" );
|
||||
ok( method.call( v, e[3].value, e[3], "asfsafsfa"), "Valid radio due to dependency not met" );
|
||||
ok(!method.call( v, e[3].value, e[3], "input"), "Invalid radio" );
|
||||
ok( method.call( v, e[4].value, e[4], "asfsafsfa"), "Valid checkbox due to dependency not met" );
|
||||
ok(!method.call( v, e[4].value, e[4], "input"), "Invalid checkbox" );
|
||||
});
|
||||
|
||||
test("minlength", function() {
|
||||
var v = jQuery("#form").validate(),
|
||||
method = $.validator.methods.minlength,
|
||||
param = 2,
|
||||
e = $('#text1, #text1c, #text2, #text3');
|
||||
ok( method.call( v, e[0].value, e[0], param), "Valid text input" );
|
||||
ok(!method.call( v, e[1].value, e[1], param), "Invalid text input" );
|
||||
ok(!method.call( v, e[2].value, e[2], param), "Invalid text input" );
|
||||
ok( method.call( v, e[3].value, e[3], param), "Valid text input" );
|
||||
|
||||
e = $('#check1, #check2, #check3');
|
||||
ok(!method.call( v, e[0].value, e[0], param), "Valid checkbox" );
|
||||
ok( method.call( v, e[1].value, e[1], param), "Valid checkbox" );
|
||||
ok( method.call( v, e[2].value, e[2], param), "Invalid checkbox" );
|
||||
|
||||
e = $('#select1, #select2, #select3, #select4, #select5');
|
||||
ok(method.call( v, e[0].value, e[0], param), "Valid select " + e[0].id );
|
||||
ok(!method.call( v, e[1].value, e[1], param), "Invalid select " + e[1].id );
|
||||
ok( method.call( v, e[2].value, e[2], param), "Valid select " + e[2].id );
|
||||
ok( method.call( v, e[3].value, e[3], param), "Valid select " + e[3].id );
|
||||
ok( method.call( v, e[4].value, e[4], param), "Valid select " + e[4].id );
|
||||
});
|
||||
|
||||
test("maxlength", function() {
|
||||
var v = jQuery("#form").validate();
|
||||
var method = $.validator.methods.maxlength,
|
||||
param = 4,
|
||||
e = $('#text1, #text2, #text3');
|
||||
ok( method.call( v, e[0].value, e[0], param), "Valid text input" );
|
||||
ok( method.call( v, e[1].value, e[1], param), "Valid text input" );
|
||||
ok(!method.call( v, e[2].value, e[2], param), "Invalid text input" );
|
||||
|
||||
e = $('#check1, #check2, #check3');
|
||||
ok( method.call( v, e[0].value, e[0], param), "Valid checkbox" );
|
||||
ok( method.call( v, e[1].value, e[1], param), "Invalid checkbox" );
|
||||
ok(!method.call( v, e[2].value, e[2], param), "Invalid checkbox" );
|
||||
|
||||
e = $('#select1, #select2, #select3, #select4');
|
||||
ok( method.call( v, e[0].value, e[0], param), "Valid select" );
|
||||
ok( method.call( v, e[1].value, e[1], param), "Valid select" );
|
||||
ok( method.call( v, e[2].value, e[2], param), "Valid select" );
|
||||
ok(!method.call( v, e[3].value, e[3], param), "Invalid select" );
|
||||
});
|
||||
|
||||
test("rangelength", function() {
|
||||
var v = jQuery("#form").validate();
|
||||
var method = $.validator.methods.rangelength,
|
||||
param = [2, 4],
|
||||
e = $('#text1, #text2, #text3');
|
||||
ok( method.call( v, e[0].value, e[0], param), "Valid text input" );
|
||||
ok(!method.call( v, e[1].value, e[1], param), "Invalid text input" );
|
||||
ok(!method.call( v, e[2].value, e[2], param), "Invalid text input" );
|
||||
});
|
||||
|
||||
test("min", function() {
|
||||
var v = jQuery("#form").validate();
|
||||
var method = $.validator.methods.min,
|
||||
param = 8,
|
||||
e = $('#value1, #value2, #value3');
|
||||
ok(!method.call( v, e[0].value, e[0], param), "Invalid text input" );
|
||||
ok( method.call( v, e[1].value, e[1], param), "Valid text input" );
|
||||
ok( method.call( v, e[2].value, e[2], param), "Valid text input" );
|
||||
});
|
||||
|
||||
test("max", function() {
|
||||
var v = jQuery("#form").validate();
|
||||
var method = $.validator.methods.max,
|
||||
param = 12,
|
||||
e = $('#value1, #value2, #value3');
|
||||
ok( method.call( v, e[0].value, e[0], param), "Valid text input" );
|
||||
ok( method.call( v, e[1].value, e[1], param), "Valid text input" );
|
||||
ok(!method.call( v, e[2].value, e[2], param), "Invalid text input" );
|
||||
});
|
||||
|
||||
test("range", function() {
|
||||
var v = jQuery("#form").validate();
|
||||
var method = $.validator.methods.range,
|
||||
param = [4,12],
|
||||
e = $('#value1, #value2, #value3');
|
||||
ok(!method.call( v, e[0].value, e[0], param), "Invalid text input" );
|
||||
ok( method.call( v, e[1].value, e[1], param), "Valid text input" );
|
||||
ok(!method.call( v, e[2].value, e[2], param), "Invalid text input" );
|
||||
});
|
||||
|
||||
test("equalTo", function() {
|
||||
var v = jQuery("#form").validate();
|
||||
var method = $.validator.methods.equalTo,
|
||||
e = $('#text1, #text2');
|
||||
ok( method.call( v, "Test", e[0], "#text1"), "Text input" );
|
||||
ok( method.call( v, "T", e[1], "#text2"), "Another one" );
|
||||
});
|
||||
|
||||
test("creditcard", function() {
|
||||
var method = methodTest("creditcard");
|
||||
ok( method( "446-667-651" ), "Valid creditcard number" );
|
||||
ok( !method( "asdf" ), "Invalid creditcard number" );
|
||||
});
|
||||
|
||||
test("accept", function() {
|
||||
var method = methodTest("accept");
|
||||
ok( method( "picture.gif" ), "Valid default accept type" );
|
||||
ok( method( "picture.jpg" ), "Valid default accept type" );
|
||||
ok( method( "picture.jpeg" ), "Valid default accept type" );
|
||||
ok( method( "picture.png" ), "Valid default accept type" );
|
||||
ok( !method( "picture.pgn" ), "Invalid default accept type" );
|
||||
|
||||
var v = jQuery("#form").validate(),
|
||||
method = function(value, param) {
|
||||
return $.validator.methods.accept.call(v, value, $('#text1')[0], param)
|
||||
};
|
||||
ok( method( "picture.doc", "doc"), "Valid custom accept type" );
|
||||
ok( method( "picture.pdf", "doc|pdf"), "Valid custom accept type" );
|
||||
ok( method( "picture.pdf", "pdf|doc"), "Valid custom accept type" );
|
||||
ok( !method( "picture.pdf", "doc"), "Invalid custom accept type" );
|
||||
ok( !method( "picture.doc", "pdf"), "Invalid custom accept type" );
|
||||
|
||||
ok( method( "picture.pdf", "doc,pdf"), "Valid custom accept type, comma seperated" );
|
||||
ok( method( "picture.pdf", "pdf,doc"), "Valid custom accept type, comma seperated" );
|
||||
ok( !method( "picture.pdf", "gop,top"), "Invalid custom accept type, comma seperated" );
|
||||
});
|
||||
|
||||
test("remote", function() {
|
||||
expect(5);
|
||||
stop();
|
||||
var e = $("#username");
|
||||
var v = $("#userForm").validate({
|
||||
rules: {
|
||||
username: {
|
||||
required: true,
|
||||
remote: "users.php"
|
||||
}
|
||||
},
|
||||
messages: {
|
||||
username: {
|
||||
required: "Please",
|
||||
remote: jQuery.validator.format("{0} in use")
|
||||
}
|
||||
},
|
||||
submitHandler: function() {
|
||||
ok( false, "submitHandler may never be called when validating only elements");
|
||||
}
|
||||
});
|
||||
$().ajaxStop(function() {
|
||||
ok( true, "There needs to be exactly one request." );
|
||||
equals( 1, v.size(), "There must be one error" );
|
||||
equals( "asdf in use", v.errorList[0].message );
|
||||
$().unbind("ajaxStop");
|
||||
start();
|
||||
});
|
||||
ok( !v.element(e), "invalid element, nothing entered yet" );
|
||||
e.val("asdf");
|
||||
ok( !v.element(e), "still invalid, because remote validation must block until it returns" );
|
||||
});
|
||||
|
||||
test("remote, customized ajax options", function() {
|
||||
expect(2);
|
||||
stop();
|
||||
var v = $("#userForm").validate({
|
||||
rules: {
|
||||
username: {
|
||||
required: true,
|
||||
remote: {
|
||||
url: "users.php",
|
||||
type: "post",
|
||||
beforeSend: function(request, settings) {
|
||||
same(settings.type, "post");
|
||||
same(settings.data, "username=asdf&email=email.com");
|
||||
},
|
||||
data: {
|
||||
email: function() {
|
||||
return "email.com";
|
||||
}
|
||||
},
|
||||
complete: function() {
|
||||
start();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
$("#username").val("asdf");
|
||||
$("#userForm").valid();
|
||||
});
|
||||
|
||||
|
||||
test("remote extensions", function() {
|
||||
expect(6);
|
||||
stop();
|
||||
var e = $("#username");
|
||||
var v = $("#userForm").validate({
|
||||
rules: {
|
||||
username: {
|
||||
required: true,
|
||||
remote: "users2.php"
|
||||
}
|
||||
},
|
||||
messages: {
|
||||
username: {
|
||||
required: "Please"
|
||||
}
|
||||
},
|
||||
submitHandler: function() {
|
||||
ok( false, "submitHandler may never be called when validating only elements");
|
||||
}
|
||||
});
|
||||
$().ajaxStop(function() {
|
||||
$().unbind("ajaxStop");
|
||||
ok( true, "There needs to be exactly one request." );
|
||||
equals( 1, v.size(), "There must be one error" );
|
||||
equals( v.errorList[0].message, "asdf is already taken, please try something else" );
|
||||
v.element(e);
|
||||
equals( v.errorList[0].message, "asdf is already taken, please try something else", "message doesn't change on revalidation" );
|
||||
start();
|
||||
});
|
||||
ok( !v.element(e), "invalid element, nothing entered yet" );
|
||||
e.val("asdf");
|
||||
ok( !v.element(e), "still invalid, because remote validation must block until it returns" );
|
||||
});
|
||||
|
||||
|
||||
module("additional methods");
|
||||
|
||||
test("phone (us)", function() {
|
||||
var method = methodTest("phone");
|
||||
ok( method( "1(212)-999-2345" ), "Valid us phone number" );
|
||||
ok( method( "212 999 2344" ), "Valid us phone number" );
|
||||
ok( method( "212-999-0983" ), "Valid us phone number" );
|
||||
ok(!method( "111-123-5434" ), "Invalid us phone number" );
|
||||
ok(!method( "212 123 4567" ), "Invalid us phone number" );
|
||||
});
|
||||
|
||||
test("dateITA", function() {
|
||||
var method = methodTest("dateITA");
|
||||
ok( method( "01/01/1900" ), "Valid date ITA" );
|
||||
ok(!method( "01/13/1990" ), "Invalid date ITA" );
|
||||
ok(!method( "01.01.1900" ), "Invalid date ITA" );
|
||||
});
|
||||
|
||||
test("time", function() {
|
||||
var method = methodTest("time");
|
||||
ok( method("00:00"), "Valid time, lower bound" );
|
||||
ok( method("23:59"), "Valid time, upper bound" );
|
||||
ok( !method("24:60"), "Invalid time" );
|
||||
ok( !method("24:00"), "Invalid time" );
|
||||
ok( !method("29:59"), "Invalid time" );
|
||||
ok( !method("30:00"), "Invalid time" );
|
||||
});
|
||||
|
||||
function testCardTypeByNumber(number, cardname, expected) {
|
||||
$("#cardnumber").val(number);
|
||||
var actual = $("#ccform").valid();
|
||||
equals(actual, expected, $.format("Expect card number {0} to validate to {1}, actually validated to ", number, expected));
|
||||
}
|
||||
|
||||
test('creditcardtypes, all', function() {
|
||||
$("#ccform").validate({
|
||||
rules: {
|
||||
cardnumber: {
|
||||
creditcard: true,
|
||||
creditcardtypes: {
|
||||
all: true
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
testCardTypeByNumber("4111-1111-1111-1111", "VISA", true)
|
||||
testCardTypeByNumber("5111-1111-1111-1118", "MasterCard", true)
|
||||
testCardTypeByNumber("6111-1111-1111-1116", "Discover", true)
|
||||
testCardTypeByNumber("3400-0000-0000-009", "AMEX", true);
|
||||
|
||||
testCardTypeByNumber("4111-1111-1111-1110", "VISA", false)
|
||||
testCardTypeByNumber("5432-1111-1111-1111", "MasterCard", false)
|
||||
testCardTypeByNumber("6611-6611-6611-6611", "Discover", false)
|
||||
testCardTypeByNumber("3777-7777-7777-7777", "AMEX", false)
|
||||
|
||||
});
|
||||
|
||||
test('creditcardtypes, visa', function() {
|
||||
$("#ccform").validate({
|
||||
rules: {
|
||||
cardnumber: {
|
||||
creditcard: true,
|
||||
creditcardtypes: {
|
||||
visa: true
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
testCardTypeByNumber("4111-1111-1111-1111", "VISA", true)
|
||||
testCardTypeByNumber("5111-1111-1111-1118", "MasterCard", false)
|
||||
testCardTypeByNumber("6111-1111-1111-1116", "Discover", false)
|
||||
testCardTypeByNumber("3400-0000-0000-009", "AMEX", false);
|
||||
});
|
||||
|
||||
test('creditcardtypes, mastercard', function() {
|
||||
$("#ccform").validate({
|
||||
rules: {
|
||||
cardnumber: {
|
||||
creditcard: true,
|
||||
creditcardtypes: {
|
||||
mastercard: true
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
testCardTypeByNumber("5111-1111-1111-1118", "MasterCard", true)
|
||||
testCardTypeByNumber("6111-1111-1111-1116", "Discover", false)
|
||||
testCardTypeByNumber("3400-0000-0000-009", "AMEX", false);
|
||||
testCardTypeByNumber("4111-1111-1111-1111", "VISA", false);
|
||||
});
|
267
thirdparty/jquery-validate/test/rules.js
vendored
@ -1,267 +0,0 @@
|
||||
module("rules");
|
||||
|
||||
test("rules() - internal - input", function() {
|
||||
var element = $('#firstname');
|
||||
var v = $('#testForm1').validate();
|
||||
same( element.rules(), { required: true, minlength: 2 } );
|
||||
});
|
||||
|
||||
test("rules(), ignore method:false", function() {
|
||||
var element = $('#firstnamec');
|
||||
var v = $('#testForm1clean').validate({
|
||||
rules: {
|
||||
firstname: { required: false, minlength: 2 }
|
||||
}
|
||||
});
|
||||
same( element.rules(), { minlength: 2 } );
|
||||
});
|
||||
|
||||
test("rules() - internal - select", function() {
|
||||
var element = $('#meal');
|
||||
var v = $('#testForm3').validate();
|
||||
same( element.rules(), {required: true} );
|
||||
});
|
||||
|
||||
test("rules() - external", function() {
|
||||
var element = $('#text1');
|
||||
var v = $('#form').validate({
|
||||
rules: {
|
||||
action: {date: true, min: 5}
|
||||
}
|
||||
});
|
||||
same( element.rules(), {date: true, min: 5} );
|
||||
});
|
||||
|
||||
test("rules() - external - complete form", function() {
|
||||
expect(1);
|
||||
|
||||
var methods = $.extend({}, $.validator.methods);
|
||||
var messages = $.extend({}, $.validator.messages);
|
||||
|
||||
$.validator.addMethod("verifyTest", function() {
|
||||
ok( true, "method executed" );
|
||||
return true;
|
||||
});
|
||||
var v = $('#form').validate({
|
||||
rules: {
|
||||
action: {verifyTest: true}
|
||||
}
|
||||
});
|
||||
v.form();
|
||||
|
||||
$.validator.methods = methods;
|
||||
$.validator.messages = messages;
|
||||
});
|
||||
|
||||
test("rules() - internal - input", function() {
|
||||
var element = $('#form8input');
|
||||
var v = $('#testForm8').validate();
|
||||
same( element.rules(), {required: true, number: true, rangelength: [2, 8]});
|
||||
});
|
||||
|
||||
test("rules(), merge min/max to range, minlength/maxlength to rangelength", function() {
|
||||
jQuery.validator.autoCreateRanges = true;
|
||||
var v = $("#testForm1clean").validate({
|
||||
rules: {
|
||||
firstname: {
|
||||
min: 5,
|
||||
max: 12
|
||||
},
|
||||
lastname: {
|
||||
minlength: 2,
|
||||
maxlength: 8
|
||||
}
|
||||
}
|
||||
});
|
||||
same( $("#firstnamec").rules(), {range: [5, 12]});
|
||||
|
||||
same( $("#lastnamec").rules(), {rangelength: [2, 8]} );
|
||||
jQuery.validator.autoCreateRanges = false;
|
||||
});
|
||||
|
||||
test("rules(), gurantee that required is at front", function() {
|
||||
$("#testForm1").validate();
|
||||
var v = $("#v2").validate();
|
||||
$("#subformRequired").validate();
|
||||
function flatRules(element) {
|
||||
var result = [];
|
||||
jQuery.each($(element).rules(), function(key, value) { result.push(key) });
|
||||
return result.join(" ");
|
||||
}
|
||||
equals( "required minlength", flatRules("#firstname") );
|
||||
equals( "required maxlength minlength", flatRules("#v2-i6") );
|
||||
equals( "required maxlength", flatRules("#co_name") );
|
||||
|
||||
reset();
|
||||
jQuery.validator.autoCreateRanges = true;
|
||||
v = $("#v2").validate();
|
||||
equals( "required rangelength", flatRules("#v2-i6") );
|
||||
|
||||
$("#subformRequired").validate({
|
||||
rules: {
|
||||
co_name: "required"
|
||||
}
|
||||
});
|
||||
$("#co_name").removeClass();
|
||||
equals( "required maxlength", flatRules("#co_name") );
|
||||
jQuery.validator.autoCreateRanges = false;
|
||||
});
|
||||
|
||||
test("rules(), evaluate dynamic parameters", function() {
|
||||
expect(2);
|
||||
var v = $("#testForm1clean").validate({
|
||||
rules: {
|
||||
firstname: {
|
||||
min: function(element) {
|
||||
equals( $("#firstnamec")[0], element );
|
||||
return 12;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
same( $("#firstnamec").rules(), {min:12});
|
||||
});
|
||||
|
||||
test("rules(), class and attribute combinations", function() {
|
||||
|
||||
$.validator.addMethod("customMethod1", function() {
|
||||
return false;
|
||||
}, "");
|
||||
$.validator.addMethod("customMethod2", function() {
|
||||
return false;
|
||||
}, "");
|
||||
var v = $("#v2").validate({
|
||||
rules: {
|
||||
'v2-i7': {
|
||||
required: true,
|
||||
minlength: 2,
|
||||
customMethod: true
|
||||
}
|
||||
}
|
||||
});
|
||||
same( $("#v2-i1").rules(), { required: true });
|
||||
same( $("#v2-i2").rules(), { required: true, email: true });
|
||||
same( $("#v2-i3").rules(), { url: true });
|
||||
same( $("#v2-i4").rules(), { required: true, minlength: 2 });
|
||||
same( $("#v2-i5").rules(), { required: true, minlength: 2, maxlength: 5, customMethod1: "123" });
|
||||
jQuery.validator.autoCreateRanges = true;
|
||||
same( $("#v2-i5").rules(), { required: true, customMethod1: "123", rangelength: [2, 5] });
|
||||
same( $("#v2-i6").rules(), { required: true, customMethod2: true, rangelength: [2, 5] });
|
||||
jQuery.validator.autoCreateRanges = false;
|
||||
same( $("#v2-i7").rules(), { required: true, minlength: 2, customMethod: true });
|
||||
|
||||
delete $.validator.methods.customMethod1;
|
||||
delete $.validator.messages.customMethod1;
|
||||
delete $.validator.methods.customMethod2;
|
||||
delete $.validator.messages.customMethod2;
|
||||
});
|
||||
|
||||
test("rules(), dependency checks", function() {
|
||||
var v = $("#testForm1clean").validate({
|
||||
rules: {
|
||||
firstname: {
|
||||
min: {
|
||||
param: 5,
|
||||
depends: function(el) {
|
||||
return /^a/.test($(el).val());
|
||||
}
|
||||
}
|
||||
},
|
||||
lastname: {
|
||||
max: {
|
||||
param: 12
|
||||
},
|
||||
email: {
|
||||
depends: function() { return true; }
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var rules = $("#firstnamec").rules();
|
||||
equals( 0, v.objectLength(rules) );
|
||||
|
||||
$("#firstnamec").val('ab');
|
||||
same( $("#firstnamec").rules(), {min:5});
|
||||
|
||||
same( $("#lastnamec").rules(), {max:12, email:true});
|
||||
});
|
||||
|
||||
test("rules(), add and remove", function() {
|
||||
$.validator.addMethod("customMethod1", function() {
|
||||
return false;
|
||||
}, "");
|
||||
$("#v2").validate();
|
||||
var removedAttrs = $("#v2-i5").removeClass("required").removeAttrs("minlength maxlength");
|
||||
same( $("#v2-i5").rules(), { customMethod1: "123" });
|
||||
|
||||
$("#v2-i5").addClass("required").attr(removedAttrs);
|
||||
same( $("#v2-i5").rules(), { required: true, minlength: 2, maxlength: 5, customMethod1: "123" });
|
||||
|
||||
$("#v2-i5").addClass("email").attr({min: 5});
|
||||
same( $("#v2-i5").rules(), { required: true, email: true, minlength: 2, maxlength: 5, min: 5, customMethod1: "123" });
|
||||
|
||||
$("#v2-i5").removeClass("required email").removeAttrs("minlength maxlength customMethod1 min");
|
||||
same( $("#v2-i5").rules(), {});
|
||||
|
||||
delete $.validator.methods.customMethod1;
|
||||
delete $.validator.messages.customMethod1;
|
||||
});
|
||||
|
||||
test("rules(), add and remove static rules", function() {
|
||||
var v = $("#testForm1clean").validate({
|
||||
rules: {
|
||||
firstname: "required date"
|
||||
}
|
||||
});
|
||||
same( $("#firstnamec").rules(), { required: true, date: true } );
|
||||
|
||||
$("#firstnamec").rules("remove", "date")
|
||||
same( $("#firstnamec").rules(), { required: true } );
|
||||
$("#firstnamec").rules("add", "email");
|
||||
same( $("#firstnamec").rules(), { required: true, email: true } );
|
||||
|
||||
$("#firstnamec").rules("remove", "required");
|
||||
same( $("#firstnamec").rules(), { email: true } );
|
||||
|
||||
same( $("#firstnamec").rules("remove"), { email: true } );
|
||||
same( $("#firstnamec").rules(), { } );
|
||||
|
||||
$("#firstnamec").rules("add", "required email");
|
||||
same( $("#firstnamec").rules(), { required: true, email: true } );
|
||||
|
||||
|
||||
same( $("#lastnamec").rules(), {} );
|
||||
$("#lastnamec").rules("add", "required");
|
||||
$("#lastnamec").rules("add", {
|
||||
minlength: 2
|
||||
});
|
||||
same( $("#lastnamec").rules(), { required: true, minlength: 2 } );
|
||||
|
||||
|
||||
var removedRules = $("#lastnamec").rules("remove", "required email");
|
||||
same( $("#lastnamec").rules(), { minlength: 2 } );
|
||||
$("#lastnamec").rules("add", removedRules);
|
||||
same( $("#lastnamec").rules(), { required: true, minlength: 2 } );
|
||||
});
|
||||
|
||||
test("rules(), add messages", function() {
|
||||
$("#firstnamec").attr("title", null);
|
||||
var v = $("#testForm1clean").validate({
|
||||
rules: {
|
||||
firstname: "required"
|
||||
}
|
||||
});
|
||||
$("#testForm1clean").valid();
|
||||
$("#firstnamec").valid();
|
||||
same( v.settings.messages.firstname, undefined );
|
||||
|
||||
$("#firstnamec").rules("add", {
|
||||
messages: {
|
||||
required: "required"
|
||||
}
|
||||
});
|
||||
|
||||
$("#firstnamec").valid();
|
||||
same( v.errorList[0] && v.errorList[0].message, "required" );
|
||||
});
|
444
thirdparty/jquery-validate/test/selects/index.html
vendored
@ -1,444 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
|
||||
<title>Fun with jQuery</title>
|
||||
|
||||
<script src="http://www.google.com/jsapi"></script>
|
||||
<script>
|
||||
google.load("jquery", "1");
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
$.fn.options = function(selector) {
|
||||
return this.each(function() {
|
||||
function container(select) {
|
||||
if (select.next().is(".option-container")) {
|
||||
return $(select).next();
|
||||
}
|
||||
return $('<select class="option-container" />').append(select.children()).insertAfter(select).hide();
|
||||
}
|
||||
var container = container($(this));
|
||||
$(this).empty().append(container.children(selector).clone());
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
$("#State").hide()
|
||||
|
||||
$("#Country").change(function() {
|
||||
var selected = this.options[this.selectedIndex].value;
|
||||
if (selected == "US") {
|
||||
$("#State").show().options(".state");
|
||||
} else if (selected == "CA") {
|
||||
$("#State").show().options(".province");
|
||||
} else {
|
||||
$("#State").hide();
|
||||
}
|
||||
}).change();
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
Mission:
|
||||
|
||||
<xmp>
|
||||
CODE
|
||||
|
||||
</xmp>
|
||||
|
||||
|
||||
<select size="1" id="Country" name="country">
|
||||
<option value="">Select One</option>
|
||||
|
||||
<option value="US" selected="selected">United States</option>
|
||||
<option value="CA">Canada</option>
|
||||
<option value="">----------</option>
|
||||
<option value="AF">Afghanistan</option>
|
||||
<option value="AL">Albania</option>
|
||||
<option value="DZ">Algeria</option>
|
||||
|
||||
<option value="AS">American Samoa</option>
|
||||
<option value="AD">Andorra</option>
|
||||
<option value="AO">Angola</option>
|
||||
<option value="AI">Anguilla</option>
|
||||
<option value="AQ">Antarctica</option>
|
||||
<option value="AG">Antigua and Barbuda</option>
|
||||
|
||||
<option value="AR">Argentina</option>
|
||||
<option value="AM">Armenia</option>
|
||||
<option value="AW">Aruba</option>
|
||||
<option value="AU">Australia</option>
|
||||
<option value="AT">Austria</option>
|
||||
<option value="AZ">Azerbaidjan</option>
|
||||
|
||||
<option value="BS">Bahamas</option>
|
||||
<option value="BH">Bahrain</option>
|
||||
<option value="BD">Bangladesh</option>
|
||||
<option value="BB">Barbados</option>
|
||||
<option value="BY">Belarus</option>
|
||||
<option value="BE">Belgium</option>
|
||||
|
||||
<option value="BZ">Belize</option>
|
||||
<option value="BJ">Benin</option>
|
||||
<option value="BM">Bermuda</option>
|
||||
<option value="BT">Bhutan</option>
|
||||
<option value="BO">Bolivia</option>
|
||||
<option value="BA">Bosnia-Herzegovina</option>
|
||||
|
||||
<option value="BW">Botswana</option>
|
||||
<option value="BV">Bouvet Island</option>
|
||||
<option value="BR">Brazil</option>
|
||||
<option value="IO">British Indian Ocean Territory</option>
|
||||
<option value="BN">Brunei Darussalam</option>
|
||||
<option value="BG">Bulgaria</option>
|
||||
|
||||
<option value="BF">Burkina Faso</option>
|
||||
<option value="BI">Burundi</option>
|
||||
<option value="KH">Cambodia</option>
|
||||
<option value="CM">Cameroon</option>
|
||||
<option value="CV">Cape Verde</option>
|
||||
<option value="KY">Cayman Islands</option>
|
||||
|
||||
<option value="CF">Central African Republic</option>
|
||||
<option value="TD">Chad</option>
|
||||
<option value="CL">Chile</option>
|
||||
<option value="CN">China</option>
|
||||
<option value="CX">Christmas Island</option>
|
||||
<option value="CC">Cocos (Keeling) Islands</option>
|
||||
|
||||
<option value="CO">Colombia</option>
|
||||
<option value="KM">Comoros</option>
|
||||
<option value="CG">Congo</option>
|
||||
<option value="CK">Cook Islands</option>
|
||||
<option value="CR">Costa Rica</option>
|
||||
<option value="HR">Croatia</option>
|
||||
|
||||
<option value="CU">Cuba</option>
|
||||
<option value="CY">Cyprus</option>
|
||||
<option value="CZ">Czech Republic</option>
|
||||
<option value="DK">Denmark</option>
|
||||
<option value="DJ">Djibouti</option>
|
||||
<option value="DM">Dominica</option>
|
||||
|
||||
<option value="DO">Dominican Republic</option>
|
||||
<option value="TP">East Timor</option>
|
||||
<option value="EC">Ecuador</option>
|
||||
<option value="EG">Egypt</option>
|
||||
<option value="SV">El Salvador</option>
|
||||
<option value="GQ">Equatorial Guinea</option>
|
||||
|
||||
<option value="ER">Eritrea</option>
|
||||
<option value="EE">Estonia</option>
|
||||
<option value="ET">Ethiopia</option>
|
||||
<option value="FK">Falkland Islands</option>
|
||||
<option value="FO">Faroe Islands</option>
|
||||
<option value="FJ">Fiji</option>
|
||||
|
||||
<option value="FI">Finland</option>
|
||||
<option value="CS">Former Czechoslovakia</option>
|
||||
<option value="SU">Former USSR</option>
|
||||
<option value="FR">France</option>
|
||||
<option value="FX">France (European Territory)</option>
|
||||
<option value="GF">French Guyana</option>
|
||||
|
||||
<option value="TF">French Southern Territories</option>
|
||||
<option value="GA">Gabon</option>
|
||||
<option value="GM">Gambia</option>
|
||||
<option value="GE">Georgia</option>
|
||||
<option value="DE">Germany</option>
|
||||
<option value="GH">Ghana</option>
|
||||
|
||||
<option value="GI">Gibraltar</option>
|
||||
<option value="GB">Great Britain</option>
|
||||
<option value="GR">Greece</option>
|
||||
<option value="GL">Greenland</option>
|
||||
<option value="GD">Grenada</option>
|
||||
<option value="GP">Guadeloupe (French)</option>
|
||||
|
||||
<option value="GU">Guam (USA)</option>
|
||||
<option value="GT">Guatemala</option>
|
||||
<option value="GN">Guinea</option>
|
||||
<option value="GW">Guinea Bissau</option>
|
||||
<option value="GY">Guyana</option>
|
||||
<option value="HT">Haiti</option>
|
||||
|
||||
<option value="HM">Heard and McDonald Islands</option>
|
||||
<option value="HN">Honduras</option>
|
||||
<option value="HK">Hong Kong</option>
|
||||
<option value="HU">Hungary</option>
|
||||
<option value="IS">Iceland</option>
|
||||
<option value="IN">India</option>
|
||||
|
||||
<option value="ID">Indonesia</option>
|
||||
<option value="INT">International</option>
|
||||
<option value="IR">Iran</option>
|
||||
<option value="IQ">Iraq</option>
|
||||
<option value="IE">Ireland</option>
|
||||
<option value="IL">Israel</option>
|
||||
|
||||
<option value="IT">Italy</option>
|
||||
<option value="CI">Ivory Coast (Cote D'Ivoire)</option>
|
||||
<option value="JM">Jamaica</option>
|
||||
<option value="JP">Japan</option>
|
||||
<option value="JO">Jordan</option>
|
||||
<option value="KZ">Kazakhstan</option>
|
||||
|
||||
<option value="KE">Kenya</option>
|
||||
<option value="KI">Kiribati</option>
|
||||
<option value="KW">Kuwait</option>
|
||||
<option value="KG">Kyrgyzstan</option>
|
||||
<option value="LA">Laos</option>
|
||||
<option value="LV">Latvia</option>
|
||||
|
||||
<option value="LB">Lebanon</option>
|
||||
<option value="LS">Lesotho</option>
|
||||
<option value="LR">Liberia</option>
|
||||
<option value="LY">Libya</option>
|
||||
<option value="LI">Liechtenstein</option>
|
||||
<option value="LT">Lithuania</option>
|
||||
|
||||
<option value="LU">Luxembourg</option>
|
||||
<option value="MO">Macau</option>
|
||||
<option value="MK">Macedonia</option>
|
||||
<option value="MG">Madagascar</option>
|
||||
<option value="MW">Malawi</option>
|
||||
<option value="MY">Malaysia</option>
|
||||
|
||||
<option value="MV">Maldives</option>
|
||||
<option value="ML">Mali</option>
|
||||
<option value="MT">Malta</option>
|
||||
<option value="MH">Marshall Islands</option>
|
||||
<option value="MQ">Martinique (French)</option>
|
||||
<option value="MR">Mauritania</option>
|
||||
|
||||
<option value="MU">Mauritius</option>
|
||||
<option value="YT">Mayotte</option>
|
||||
<option value="MX">Mexico</option>
|
||||
<option value="FM">Micronesia</option>
|
||||
<option value="MD">Moldavia</option>
|
||||
<option value="MC">Monaco</option>
|
||||
|
||||
<option value="MN">Mongolia</option>
|
||||
<option value="MS">Montserrat</option>
|
||||
<option value="MA">Morocco</option>
|
||||
<option value="MZ">Mozambique</option>
|
||||
<option value="MM">Myanmar</option>
|
||||
<option value="NA">Namibia</option>
|
||||
|
||||
<option value="NR">Nauru</option>
|
||||
<option value="NP">Nepal</option>
|
||||
<option value="NL">Netherlands</option>
|
||||
<option value="AN">Netherlands Antilles</option>
|
||||
<option value="NT">Neutral Zone</option>
|
||||
<option value="NC">New Caledonia (French)</option>
|
||||
|
||||
<option value="NZ">New Zealand</option>
|
||||
<option value="NI">Nicaragua</option>
|
||||
<option value="NE">Niger</option>
|
||||
<option value="NG">Nigeria</option>
|
||||
<option value="NU">Niue</option>
|
||||
<option value="NF">Norfolk Island</option>
|
||||
|
||||
<option value="KP">North Korea</option>
|
||||
<option value="MP">Northern Mariana Islands</option>
|
||||
<option value="NO">Norway</option>
|
||||
<option value="OM">Oman</option>
|
||||
<option value="PK">Pakistan</option>
|
||||
<option value="PW">Palau</option>
|
||||
|
||||
<option value="PA">Panama</option>
|
||||
<option value="PG">Papua New Guinea</option>
|
||||
<option value="PY">Paraguay</option>
|
||||
<option value="PE">Peru</option>
|
||||
<option value="PH">Philippines</option>
|
||||
<option value="PN">Pitcairn Island</option>
|
||||
|
||||
<option value="PL">Poland</option>
|
||||
<option value="PF">Polynesia (French)</option>
|
||||
<option value="PT">Portugal</option>
|
||||
<option value="PR">Puerto Rico</option>
|
||||
<option value="QA">Qatar</option>
|
||||
<option value="RE">Reunion (French)</option>
|
||||
|
||||
<option value="RO">Romania</option>
|
||||
<option value="RU">Russian Federation</option>
|
||||
<option value="RW">Rwanda</option>
|
||||
<option value="GS">S. Georgia & S. Sandwich Isls.</option>
|
||||
<option value="SH">Saint Helena</option>
|
||||
<option value="KN">Saint Kitts & Nevis Anguilla</option>
|
||||
|
||||
<option value="LC">Saint Lucia</option>
|
||||
<option value="PM">Saint Pierre and Miquelon</option>
|
||||
<option value="ST">Saint Tome (Sao Tome) and Principe</option>
|
||||
<option value="VC">Saint Vincent & Grenadines</option>
|
||||
<option value="WS">Samoa</option>
|
||||
<option value="SM">San Marino</option>
|
||||
|
||||
<option value="SA">Saudi Arabia</option>
|
||||
<option value="SN">Senegal</option>
|
||||
<option value="SC">Seychelles</option>
|
||||
<option value="SL">Sierra Leone</option>
|
||||
<option value="SG">Singapore</option>
|
||||
<option value="SK">Slovak Republic</option>
|
||||
|
||||
<option value="SI">Slovenia</option>
|
||||
<option value="SB">Solomon Islands</option>
|
||||
<option value="SO">Somalia</option>
|
||||
<option value="ZA">South Africa</option>
|
||||
<option value="KR">South Korea</option>
|
||||
<option value="ES">Spain</option>
|
||||
|
||||
<option value="LK">Sri Lanka</option>
|
||||
<option value="SD">Sudan</option>
|
||||
<option value="SR">Suriname</option>
|
||||
<option value="SJ">Svalbard and Jan Mayen Islands</option>
|
||||
<option value="SZ">Swaziland</option>
|
||||
<option value="SE">Sweden</option>
|
||||
|
||||
<option value="CH">Switzerland</option>
|
||||
<option value="SY">Syria</option>
|
||||
<option value="TJ">Tadjikistan</option>
|
||||
<option value="TW">Taiwan</option>
|
||||
<option value="TZ">Tanzania</option>
|
||||
<option value="TH">Thailand</option>
|
||||
|
||||
<option value="TG">Togo</option>
|
||||
<option value="TK">Tokelau</option>
|
||||
<option value="TO">Tonga</option>
|
||||
<option value="TT">Trinidad and Tobago</option>
|
||||
<option value="TN">Tunisia</option>
|
||||
<option value="TR">Turkey</option>
|
||||
|
||||
<option value="TM">Turkmenistan</option>
|
||||
<option value="TC">Turks and Caicos Islands</option>
|
||||
<option value="TV">Tuvalu</option>
|
||||
<option value="UG">Uganda</option>
|
||||
<option value="UA">Ukraine</option>
|
||||
<option value="AE">United Arab Emirates</option>
|
||||
|
||||
<option value="GB">United Kingdom</option>
|
||||
<option value="UY">Uruguay</option>
|
||||
<option value="MIL">USA Military</option>
|
||||
<option value="UM">USA Minor Outlying Islands</option>
|
||||
<option value="UZ">Uzbekistan</option>
|
||||
<option value="VU">Vanuatu</option>
|
||||
|
||||
<option value="VA">Vatican City State</option>
|
||||
<option value="VE">Venezuela</option>
|
||||
<option value="VN">Vietnam</option>
|
||||
<option value="VG">Virgin Islands (British)</option>
|
||||
<option value="VI">Virgin Islands (USA)</option>
|
||||
<option value="WF">Wallis and Futuna Islands</option>
|
||||
|
||||
<option value="EH">Western Sahara</option>
|
||||
<option value="YE">Yemen</option>
|
||||
<option value="YU">Yugoslavia</option>
|
||||
<option value="ZR">Zaire</option>
|
||||
<option value="ZM">Zambia</option>
|
||||
<option value="ZW">Zimbabwe</option>
|
||||
|
||||
</select>
|
||||
<br />
|
||||
|
||||
<select id="State" name="State">
|
||||
|
||||
<option value="" class="selectone">Select One</option>
|
||||
<option value="AB" class="province">Alberta</option>
|
||||
<option value="BC" class="province">British Columbia</option>
|
||||
<option value="MB" class="province">Manitoba</option>
|
||||
|
||||
<option value="NB" class="province">New Brunswick</option>
|
||||
<option value="NF" class="province">Newfoundland</option>
|
||||
<option value="NT" class="province">Northwest Territories</option>
|
||||
<option value="NS" class="province">Nova Scotia</option>
|
||||
<option value="NU" class="province">Nunavut</option>
|
||||
<option value="ON" class="province">Ontario</option>
|
||||
|
||||
<option value="PE" class="province">Prince Edward Island</option>
|
||||
<option value="QC" class="province">Quebec</option>
|
||||
<option value="SK" class="province">Saskatchewan</option>
|
||||
<option value="YT" class="province">Yukon Territory</option>
|
||||
|
||||
<option value="AK" class="state">Alaska</option>
|
||||
<option value="AL" class="state">Alabama</option>
|
||||
|
||||
<option value="AR" class="state">Arkansas</option>
|
||||
<option value="AZ" class="state">Arizona</option>
|
||||
<option value="CA" class="state">California</option>
|
||||
<option value="CO" class="state">Colorado</option>
|
||||
<option value="CT" class="state">Connecticut</option>
|
||||
<option value="DC" class="state">District of Columbia</option>
|
||||
|
||||
<option value="DE" class="state">Delaware</option>
|
||||
<option value="FL" class="state">Florida</option>
|
||||
<option value="GA" class="state">Georgia</option>
|
||||
<option value="HI" class="state">Hawaii</option>
|
||||
<option value="IA" class="state">Iowa</option>
|
||||
<option value="ID" class="state">Idaho</option>
|
||||
|
||||
<option value="IL" class="state">Illinois</option>
|
||||
<option value="IN" class="state">Indiana</option>
|
||||
<option value="KS" class="state">Kansas</option>
|
||||
<option value="KY" class="state">Kentucky</option>
|
||||
<option value="LA" class="state">Louisiana</option>
|
||||
<option value="MA" class="state">Massachusetts</option>
|
||||
|
||||
<option value="MD" class="state">Maryland</option>
|
||||
<option value="ME" class="state">Maine</option>
|
||||
<option value="MI" class="state">Michigan</option>
|
||||
<option value="MN" class="state">Minnesota</option>
|
||||
<option value="MO" class="state">Missouri</option>
|
||||
<option value="MS" class="state">Mississippi</option>
|
||||
|
||||
<option value="MT" class="state">Montana</option>
|
||||
<option value="NC" class="state">North Carolina</option>
|
||||
<option value="ND" class="state">North Dakota</option>
|
||||
<option value="NE" class="state">Nebraska</option>
|
||||
<option value="NH" class="state">New Hampshire</option>
|
||||
<option value="NJ" class="state">New Jersey</option>
|
||||
|
||||
<option value="NM" class="state">New Mexico</option>
|
||||
<option value="NV" class="state">Nevada</option>
|
||||
<option value="NY" class="state">New York</option>
|
||||
<option value="OH" class="state">Ohio</option>
|
||||
<option value="OK" class="state">Oklahoma</option>
|
||||
<option value="OR" class="state">Oregon</option>
|
||||
|
||||
<option value="PA" class="state">Pennsylvania</option>
|
||||
<option value="PR" class="state">Puerto Rico</option>
|
||||
<option value="RI" class="state">Rhode Island</option>
|
||||
<option value="SC" class="state">South Carolina</option>
|
||||
<option value="SD" class="state">South Dakota</option>
|
||||
<option value="TN" class="state">Tennessee</option>
|
||||
|
||||
<option value="TX" class="state">Texas</option>
|
||||
<option value="UT" class="state">Utah</option>
|
||||
<option value="VA" class="state">Virginia</option>
|
||||
<option value="VT" class="state">Vermont</option>
|
||||
<option value="WA" class="state">Washington</option>
|
||||
<option value="WI" class="state">Wisconsin</option>
|
||||
|
||||
<option value="WV" class="state">West Virginia</option>
|
||||
<option value="WY" class="state">Wyoming</option>
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
|
||||
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
_uacct = "UA-1499652-1";
|
||||
urchinTracker();
|
||||
</script></body>
|
||||
</html>
|
78
thirdparty/jquery-validate/test/tabs.html
vendored
@ -1,78 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
|
||||
<title>Test for jQuery validate() plugin</title>
|
||||
|
||||
<link rel="stylesheet" type="text/css" media="screen" href="../demo/css/screen.css" />
|
||||
<link rel="stylesheet" href="../../../themes/flora/flora.all.css" type="text/css" media="screen" title="Flora (Default)">
|
||||
|
||||
<script src="../lib/jquery.js" type="text/javascript"></script>
|
||||
<script src="../../../ui/current/ui.tabs.js" type="text/javascript"></script>
|
||||
<script type="text/javascript" src="../lib/jquery.metadata.js"></script>
|
||||
<script type="text/javascript" src="../jquery.validate.js"></script>
|
||||
<script src="firebug/firebug.js" type="text/javascript"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
$().ready(function() {
|
||||
$("#commentForm").validate({debug:true});
|
||||
$("#example > ul").tabs();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style type="text/css">
|
||||
form.cmxform { width: 470px; }
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<form class="cmxform" id="commentForm" method="get" action="">
|
||||
|
||||
<div id="example" class="flora">
|
||||
<ul>
|
||||
|
||||
<li><a href="#fragment-1"><span>One</span></a></li>
|
||||
<li><a href="#fragment-2"><span>Two</span></a></li>
|
||||
<li><a href="#fragment-3"><span>Three</span></a></li>
|
||||
</ul>
|
||||
<div id="fragment-1">
|
||||
<fieldset>
|
||||
<legend>A simple comment form with submit validation and default messages</legend>
|
||||
<p>
|
||||
<label for="cname">Name (required, at least 2 characters)</label>
|
||||
<input id="cname" name="name" class="some other styles {required:true,minLength:2}" />
|
||||
<p>
|
||||
<label for="cemail">E-Mail (required)</label>
|
||||
<input id="cemail" name="email" class="{required:true,email:true}" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="curl">URL (optional)</label>
|
||||
<input id="curl" name="url" class="{url:true}" value="" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="ccomment">Your comment (required)</label>
|
||||
<textarea id="ccomment" name="comment" class="{required:true}"></textarea>
|
||||
</p>
|
||||
</fieldset>
|
||||
|
||||
</div>
|
||||
<div id="fragment-2">
|
||||
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
|
||||
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
|
||||
</div>
|
||||
<div id="fragment-3">
|
||||
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
|
||||
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
|
||||
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
|
||||
</div>
|
||||
</div>
|
||||
<p>
|
||||
<input class="submit" type="submit" value="Submit"/>
|
||||
</p>
|
||||
|
||||
</form>
|
||||
|
||||
</body>
|
||||
</html>
|
1071
thirdparty/jquery-validate/test/test.js
vendored
@ -1,1071 +0,0 @@
|
||||
jQuery.validator.defaults.debug = true;
|
||||
|
||||
module("validator");
|
||||
|
||||
test("Constructor", function() {
|
||||
var v1 = $("#testForm1").validate();
|
||||
var v2 = $("#testForm1").validate();
|
||||
equals( v1, v2, "Calling validate() multiple times must return the same validator instance" );
|
||||
equals( v1.elements().length, 3, "validator elements" );
|
||||
});
|
||||
|
||||
test("validate() without elements, with non-form elements", function() {
|
||||
$("#doesn'texist").validate();
|
||||
});
|
||||
|
||||
test("valid() plugin method", function() {
|
||||
var form = $("#userForm");
|
||||
form.validate();
|
||||
ok ( !form.valid(), "Form isn't valid yet" );
|
||||
var input = $("#username");
|
||||
ok ( !input.valid(), "Input isn't valid either" );
|
||||
input.val("Hello world");
|
||||
ok ( form.valid(), "Form is now valid" );
|
||||
ok ( input.valid(), "Input is valid, too" );
|
||||
});
|
||||
|
||||
test("valid() plugin method", function() {
|
||||
var form = $("#testForm1");
|
||||
form.validate();
|
||||
var inputs = form.find("input");
|
||||
ok( !inputs.valid(), "all invalid" );
|
||||
inputs.not(":first").val("ok");
|
||||
ok( !inputs.valid(), "just one invalid" );
|
||||
inputs.val("ok");
|
||||
ok( inputs.valid(), "all valid" );
|
||||
});
|
||||
|
||||
test("valid() plugin method, special handling for checkable groups", function() {
|
||||
// rule is defined on first checkbox, must apply to others, too
|
||||
var checkable = $("#checkable2");
|
||||
ok( !checkable.valid(), "must be invalid, not checked yet" );
|
||||
checkable.attr("checked", true);
|
||||
ok( checkable.valid(), "valid, is now checked" );
|
||||
checkable.attr("checked", false);
|
||||
ok( !checkable.valid(), "invalid again" );
|
||||
$("#checkable3").attr("checked", true);
|
||||
ok( checkable.valid(), "valid, third box is checked" );
|
||||
});
|
||||
|
||||
test("addMethod", function() {
|
||||
expect( 3 );
|
||||
$.validator.addMethod("hi", function(value) {
|
||||
return value == "hi";
|
||||
}, "hi me too");
|
||||
var method = $.validator.methods.hi;
|
||||
e = $('#text1')[0];
|
||||
ok( !method(e.value, e), "Invalid" );
|
||||
e.value = "hi";
|
||||
ok( method(e.value, e), "Invalid" );
|
||||
ok( jQuery.validator.messages.hi == "hi me too", "Check custom message" );
|
||||
});
|
||||
|
||||
test("addMethod2", function() {
|
||||
expect( 4 );
|
||||
$.validator.addMethod("complicatedPassword", function(value, element, param) {
|
||||
return this.optional(element) || /\D/.test(value) && /\d/.test(value)
|
||||
}, "Your password must contain at least one number and one letter");
|
||||
var v = jQuery("#form").validate({
|
||||
rules: {
|
||||
action: { complicatedPassword: true }
|
||||
}
|
||||
});
|
||||
var rule = $.validator.methods.complicatedPassword,
|
||||
e = $('#text1')[0];
|
||||
e.value = "";
|
||||
ok( v.element(e) === undefined, "Rule is optional, valid" );
|
||||
equals( 0, v.size() );
|
||||
e.value = "ko";
|
||||
ok( !v.element(e), "Invalid, doesn't contain one of the required characters" );
|
||||
e.value = "ko1";
|
||||
ok( v.element(e) );
|
||||
});
|
||||
|
||||
test("form(): simple", function() {
|
||||
expect( 2 );
|
||||
var form = $('#testForm1')[0];
|
||||
var v = $(form).validate();
|
||||
ok( !v.form(), 'Invalid form' );
|
||||
$('#firstname').val("hi");
|
||||
$('#lastname').val("hi");
|
||||
ok( v.form(), 'Valid form' );
|
||||
});
|
||||
|
||||
test("form(): checkboxes: min/required", function() {
|
||||
expect( 3 );
|
||||
var form = $('#testForm6')[0];
|
||||
var v = $(form).validate();
|
||||
ok( !v.form(), 'Invalid form' );
|
||||
$('#form6check1').attr("checked", true);
|
||||
ok( !v.form(), 'Invalid form' );
|
||||
$('#form6check2').attr("checked", true);
|
||||
ok( v.form(), 'Valid form' );
|
||||
});
|
||||
test("form(): selects: min/required", function() {
|
||||
expect( 3 );
|
||||
var form = $('#testForm7')[0];
|
||||
var v = $(form).validate();
|
||||
ok( !v.form(), 'Invalid form' );
|
||||
$("#optionxa").attr("selected", true);
|
||||
ok( !v.form(), 'Invalid form' );
|
||||
$("#optionxb").attr("selected", true);
|
||||
ok( v.form(), 'Valid form' );
|
||||
});
|
||||
|
||||
test("form(): with equalTo", function() {
|
||||
expect( 2 );
|
||||
var form = $('#testForm5')[0];
|
||||
var v = $(form).validate();
|
||||
ok( !v.form(), 'Invalid form' );
|
||||
$('#x1, #x2').val("hi");
|
||||
ok( v.form(), 'Valid form' );
|
||||
});
|
||||
|
||||
test("check(): simple", function() {
|
||||
expect( 3 );
|
||||
var element = $('#firstname')[0];
|
||||
var v = $('#testForm1').validate();
|
||||
ok( v.size() == 0, 'No errors yet' );
|
||||
v.check(element);
|
||||
ok( v.size() == 1, 'error exists' );
|
||||
v.errorList = [];
|
||||
$('#firstname').val("hi");
|
||||
v.check(element);
|
||||
ok( !v.size() == 1, 'No more errors' );
|
||||
});
|
||||
|
||||
test("hide(): input", function() {
|
||||
expect( 3 );
|
||||
var errorLabel = $('#errorFirstname');
|
||||
var element = $('#firstname')[0];
|
||||
element.value ="bla";
|
||||
var v = $('#testForm1').validate();
|
||||
errorLabel.show();
|
||||
ok( errorLabel.is(":visible"), "Error label visible before validation" );
|
||||
ok( v.element(element) );
|
||||
ok( errorLabel.is(":hidden"), "Error label not visible after validation" );
|
||||
});
|
||||
|
||||
test("hide(): radio", function() {
|
||||
expect( 2 );
|
||||
var errorLabel = $('#agreeLabel');
|
||||
var element = $('#agb')[0];
|
||||
element.checked = true;
|
||||
var v = $('#testForm2').validate({ errorClass: "xerror" });
|
||||
errorLabel.show();
|
||||
ok( errorLabel.is(":visible"), "Error label visible after validation" );
|
||||
v.element(element);
|
||||
ok( errorLabel.is(":hidden"), "Error label not visible after hiding it" );
|
||||
});
|
||||
|
||||
test("hide(): errorWrapper", function() {
|
||||
expect(2);
|
||||
var errorLabel = $('#errorWrapper');
|
||||
var element = $('#meal')[0];
|
||||
element.selectedIndex = 1;
|
||||
|
||||
errorLabel.show();
|
||||
ok( errorLabel.is(":visible"), "Error label visible after validation" );
|
||||
var v = $('#testForm3').validate({ wrapper: "li", errorLabelContainer: $("#errorContainer") });
|
||||
v.element(element);
|
||||
ok( errorLabel.is(":hidden"), "Error label not visible after hiding it" );
|
||||
});
|
||||
|
||||
test("hide(): container", function() {
|
||||
expect(4);
|
||||
var errorLabel = $('#errorContainer');
|
||||
var element = $('#testForm3')[0];
|
||||
var v = $('#testForm3').validate({ errorWrapper: "li", errorContainer: $("#errorContainer") });
|
||||
v.form();
|
||||
ok( errorLabel.is(":visible"), "Error label visible after validation" );
|
||||
$('#meal')[0].selectedIndex = 1;
|
||||
v.form();
|
||||
ok( errorLabel.is(":hidden"), "Error label not visible after hiding it" );
|
||||
$('#meal')[0].selectedIndex = -1;
|
||||
v.element("#meal");
|
||||
ok( errorLabel.is(":visible"), "Error label visible after validation" );
|
||||
$('#meal')[0].selectedIndex = 1;
|
||||
v.element("#meal");
|
||||
ok( errorLabel.is(":hidden"), "Error label not visible after hiding it" );
|
||||
});
|
||||
|
||||
test("valid()", function() {
|
||||
expect(4);
|
||||
var errorList = [{name:"meal",message:"foo", element:$("#meal")[0]}];
|
||||
var v = $('#testForm3').validate();
|
||||
ok( v.valid(), "No errors, must be valid" );
|
||||
v.errorList = errorList;
|
||||
ok( !v.valid(), "One error, must be invalid" );
|
||||
reset();
|
||||
v = $('#testForm3').validate({ submitHandler: function() {
|
||||
ok( false, "Submit handler was called" );
|
||||
}});
|
||||
ok( v.valid(), "No errors, must be valid and returning true, even with the submit handler" );
|
||||
v.errorList = errorList;
|
||||
ok( !v.valid(), "One error, must be invalid, no call to submit handler" );
|
||||
});
|
||||
|
||||
test("submitHandler keeps submitting button", function() {
|
||||
$("#userForm").validate({
|
||||
debug: true,
|
||||
submitHandler: function(form) {
|
||||
// dunno how to test this better; this tests the implementation that uses a hidden input
|
||||
var hidden = $(form).find("input:hidden")[0];
|
||||
same(hidden.value, button.value)
|
||||
same(hidden.name, button.name)
|
||||
}
|
||||
});
|
||||
$("#username").val("bla");
|
||||
var button = $("#userForm :submit")[0]
|
||||
$(button).triggerHandler("click");
|
||||
$("#userForm").submit();
|
||||
});
|
||||
|
||||
test("showErrors()", function() {
|
||||
expect( 4 );
|
||||
var errorLabel = $('#errorFirstname').hide();
|
||||
var element = $('#firstname')[0];
|
||||
var v = $('#testForm1').validate();
|
||||
ok( errorLabel.is(":hidden") );
|
||||
equals( 0, $("label.error[for=lastname]").size() );
|
||||
v.showErrors({"firstname": "required", "lastname": "bla"});
|
||||
equals( true, errorLabel.is(":visible") );
|
||||
equals( true, $("label.error[for=lastname]").is(":visible") );
|
||||
});
|
||||
|
||||
test("showErrors(), allow empty string and null as default message", function() {
|
||||
$("#userForm").validate({
|
||||
rules: {
|
||||
username: {
|
||||
required: true,
|
||||
minlength: 3
|
||||
}
|
||||
},
|
||||
messages: {
|
||||
username: {
|
||||
required: "",
|
||||
minlength: "too short"
|
||||
}
|
||||
}
|
||||
});
|
||||
ok( !$("#username").valid() );
|
||||
equals( "", $("label.error[for=username]").text() );
|
||||
|
||||
$("#username").val("ab");
|
||||
ok( !$("#username").valid() );
|
||||
equals( "too short", $("label.error[for=username]").text() );
|
||||
|
||||
$("#username").val("abc");
|
||||
ok( $("#username").valid() );
|
||||
ok( $("label.error[for=username]").is(":hidden") );
|
||||
});
|
||||
|
||||
test("showErrors() - external messages", function() {
|
||||
expect( 4 );
|
||||
var methods = $.extend({}, $.validator.methods);
|
||||
var messages = $.extend({}, $.validator.messages);
|
||||
$.validator.addMethod("foo", function() { return false; });
|
||||
$.validator.addMethod("bar", function() { return false; });
|
||||
equals( 0, $("#testForm4 label.error[for=f1]").size() );
|
||||
equals( 0, $("#testForm4 label.error[for=f2]").size() );
|
||||
var form = $('#testForm4')[0];
|
||||
var v = $(form).validate({
|
||||
messages: {
|
||||
f1: "Please!",
|
||||
f2: "Wohoo!"
|
||||
}
|
||||
});
|
||||
v.form();
|
||||
equals( $("#testForm4 label.error[for=f1]").text(), "Please!" );
|
||||
equals( $("#testForm4 label.error[for=f2]").text(), "Wohoo!" );
|
||||
|
||||
$.validator.methods = methods;
|
||||
$.validator.messages = messages;
|
||||
});
|
||||
|
||||
test("showErrors() - custom handler", function() {
|
||||
expect(5);
|
||||
var v = $('#testForm1').validate({
|
||||
showErrors: function(errorMap, errorList) {
|
||||
equals( v, this );
|
||||
equals( v.errorList, errorList );
|
||||
equals( v.errorMap, errorMap );
|
||||
equals( "buga", errorMap.firstname );
|
||||
equals( "buga", errorMap.lastname );
|
||||
}
|
||||
});
|
||||
v.form();
|
||||
});
|
||||
|
||||
test("option: (un)highlight, default", function() {
|
||||
$("#testForm1").validate();
|
||||
var e = $("#firstname")
|
||||
ok( !e.hasClass("error") );
|
||||
ok( !e.hasClass("valid") );
|
||||
e.valid()
|
||||
ok( e.hasClass("error") );
|
||||
ok( !e.hasClass("valid") );
|
||||
e.val("hithere").valid()
|
||||
ok( !e.hasClass("error") );
|
||||
ok( e.hasClass("valid") );
|
||||
});
|
||||
|
||||
test("option: (un)highlight, nothing", function() {
|
||||
expect(3);
|
||||
$("#testForm1").validate({
|
||||
highlight: false,
|
||||
unhighlight: false
|
||||
});
|
||||
var e = $("#firstname")
|
||||
ok( !e.hasClass("error") );
|
||||
e.valid()
|
||||
ok( !e.hasClass("error") );
|
||||
e.valid()
|
||||
ok( !e.hasClass("error") );
|
||||
});
|
||||
|
||||
test("option: (un)highlight, custom", function() {
|
||||
expect(5);
|
||||
$("#testForm1clean").validate({
|
||||
highlight: function(element, errorClass) {
|
||||
equals( "invalid", errorClass );
|
||||
$(element).hide();
|
||||
},
|
||||
unhighlight: function(element, errorClass) {
|
||||
equals( "invalid", errorClass )
|
||||
$(element).show();
|
||||
},
|
||||
errorClass: "invalid",
|
||||
rules: {
|
||||
firstname: "required"
|
||||
}
|
||||
});
|
||||
var e = $("#firstnamec")
|
||||
ok( e.is(":visible") );
|
||||
e.valid()
|
||||
ok( !e.is(":visible") );
|
||||
e.val("hithere").valid()
|
||||
ok( e.is(":visible") );
|
||||
});
|
||||
|
||||
test("option: (un)highlight, custom2", function() {
|
||||
expect(6);
|
||||
$("#testForm1").validate({
|
||||
highlight: function(element, errorClass) {
|
||||
$(element).addClass(errorClass);
|
||||
$(element.form).find("label[for=" + element.id + "]").addClass(errorClass);
|
||||
},
|
||||
unhighlight: function(element, errorClass) {
|
||||
$(element).removeClass(errorClass);
|
||||
$(element.form).find("label[for=" + element.id + "]").removeClass(errorClass);
|
||||
},
|
||||
errorClass: "invalid"
|
||||
});
|
||||
var e = $("#firstname")
|
||||
var l = $("#errorFirstname")
|
||||
ok( !e.is(".invalid") );
|
||||
ok( !l.is(".invalid") );
|
||||
e.valid()
|
||||
ok( e.is(".invalid") );
|
||||
ok( l.is(".invalid") );
|
||||
e.val("hithere").valid()
|
||||
ok( !e.is(".invalid") );
|
||||
ok( !l.is(".invalid") );
|
||||
});
|
||||
|
||||
test("elements() order", function() {
|
||||
var container = $("#orderContainer");
|
||||
var v = $("#elementsOrder").validate({
|
||||
errorLabelContainer: container,
|
||||
wrap: "li"
|
||||
});
|
||||
isSet( v.elements().get(), q("order1", "order2", "order3", "order4", "order5", "order6"), "elements must be in document order" );
|
||||
v.form();
|
||||
same( container.children().map(function() {
|
||||
return $(this).attr("for");
|
||||
}).get(), ["order1", "order2", "order3", "order4", "order5", "order6"], "labels in error container must be in document order" );
|
||||
});
|
||||
|
||||
test("defaultMessage(), empty title is ignored", function() {
|
||||
var v = $("#userForm").validate();
|
||||
equals( "This field is required.", v.defaultMessage($("#username")[0], "required") );
|
||||
});
|
||||
|
||||
test("formatAndAdd", function() {
|
||||
expect(4);
|
||||
var v = $("#form").validate();
|
||||
var fakeElement = { form: $("#form")[0], name: "bar" };
|
||||
v.formatAndAdd(fakeElement, {method: "maxlength", parameters: 2})
|
||||
equals( "Please enter no more than 2 characters.", v.errorList[0].message );
|
||||
equals( "bar", v.errorList[0].element.name );
|
||||
|
||||
v.formatAndAdd(fakeElement, {method: "range", parameters:[2,4]})
|
||||
equals( "Please enter a value between 2 and 4.", v.errorList[1].message );
|
||||
|
||||
v.formatAndAdd(fakeElement, {method: "range", parameters:[0,4]})
|
||||
equals( "Please enter a value between 0 and 4.", v.errorList[2].message );
|
||||
});
|
||||
|
||||
test("formatAndAdd2", function() {
|
||||
expect(3);
|
||||
var v = $("#form").validate();
|
||||
var fakeElement = { form: $("#form")[0], name: "bar" };
|
||||
jQuery.validator.messages.test1 = function(param, element) {
|
||||
equals( v, this );
|
||||
equals( 0, param );
|
||||
return "element " + element.name + " is not valid";
|
||||
};
|
||||
v.formatAndAdd(fakeElement, {method: "test1", parameters: 0})
|
||||
equals( "element bar is not valid", v.errorList[0].message );
|
||||
});
|
||||
|
||||
test("error containers, simple", function() {
|
||||
expect(14);
|
||||
var container = $("#simplecontainer");
|
||||
var v = $("#form").validate({
|
||||
errorLabelContainer: container,
|
||||
showErrors: function() {
|
||||
container.find("h3").html( jQuery.validator.format("There are {0} errors in your form.", this.size()) );
|
||||
this.defaultShowErrors();
|
||||
}
|
||||
});
|
||||
|
||||
v.prepareForm();
|
||||
ok( v.valid(), "form is valid" );
|
||||
equals( 0, container.find("label").length, "There should be no error labels" );
|
||||
equals( "", container.find("h3").html() );
|
||||
|
||||
v.prepareForm();
|
||||
v.errorList = [{message:"bar", element: {name:"foo"}}, {message: "necessary", element: {name:"required"}}];
|
||||
ok( !v.valid(), "form is not valid after adding errors manually" );
|
||||
v.showErrors();
|
||||
equals( container.find("label").length, 2, "There should be two error labels" );
|
||||
ok( container.is(":visible"), "Check that the container is visible" );
|
||||
container.find("label").each(function() {
|
||||
ok( $(this).is(":visible"), "Check that each label is visible" );
|
||||
});
|
||||
equals( "There are 2 errors in your form.", container.find("h3").html() );
|
||||
|
||||
v.prepareForm();
|
||||
ok( v.valid(), "form is valid after a reset" );
|
||||
v.showErrors();
|
||||
equals( container.find("label").length, 2, "There should still be two error labels" );
|
||||
ok( container.is(":hidden"), "Check that the container is hidden" );
|
||||
container.find("label").each(function() {
|
||||
ok( $(this).is(":hidden"), "Check that each label is hidden" );
|
||||
});
|
||||
});
|
||||
|
||||
test("error containers, with labelcontainer I", function() {
|
||||
expect(16);
|
||||
var container = $("#container"),
|
||||
labelcontainer = $("#labelcontainer");
|
||||
var v = $("#form").validate({
|
||||
errorContainer: container,
|
||||
errorLabelContainer: labelcontainer,
|
||||
wrapper: "li"
|
||||
});
|
||||
|
||||
ok( v.valid(), "form is valid" );
|
||||
equals( 0, container.find("label").length, "There should be no error labels in the container" );
|
||||
equals( 0, labelcontainer.find("label").length, "There should be no error labels in the labelcontainer" );
|
||||
equals( 0, labelcontainer.find("li").length, "There should be no lis labels in the labelcontainer" );
|
||||
|
||||
v.errorList = [{message:"bar", element: {name:"foo"}}, {name: "required", message: "necessary", element: {name:"required"}}];
|
||||
ok( !v.valid(), "form is not valid after adding errors manually" );
|
||||
v.showErrors();
|
||||
equals( 0, container.find("label").length, "There should be no error label in the container" );
|
||||
equals( 2, labelcontainer.find("label").length, "There should be two error labels in the labelcontainer" );
|
||||
equals( 2, labelcontainer.find("li").length, "There should be two error lis in the labelcontainer" );
|
||||
ok( container.is(":visible"), "Check that the container is visible" );
|
||||
ok( labelcontainer.is(":visible"), "Check that the labelcontainer is visible" );
|
||||
var labels = labelcontainer.find("label").each(function() {
|
||||
ok( $(this).is(":visible"), "Check that each label is visible1" );
|
||||
equals( "li", $(this).parent()[0].tagName.toLowerCase(), "Check that each label is wrapped in an li" );
|
||||
ok( $(this).parent("li").is(":visible"), "Check that each parent li is visible" );
|
||||
});
|
||||
});
|
||||
|
||||
test("errorcontainer, show/hide only on submit", function() {
|
||||
expect(14);
|
||||
var container = $("#container");
|
||||
var labelContainer = $("#labelcontainer");
|
||||
var v = $("#testForm1").bind("invalid-form.validate", function() {
|
||||
ok( true, "invalid-form event triggered called" );
|
||||
}).validate({
|
||||
errorContainer: container,
|
||||
errorLabelContainer: labelContainer,
|
||||
showErrors: function() {
|
||||
container.html( jQuery.validator.format("There are {0} errors in your form.", this.numberOfInvalids()) );
|
||||
ok( true, "showErrors called" );
|
||||
this.defaultShowErrors();
|
||||
}
|
||||
});
|
||||
equals( "", container.html(), "must be empty" );
|
||||
equals( "", labelContainer.html(), "must be empty" );
|
||||
// validate whole form, both showErrors and invalidHandler must be called once
|
||||
// preferably invalidHandler first, showErrors second
|
||||
ok( !v.form(), "invalid form" );
|
||||
equals( 2, labelContainer.find("label").length );
|
||||
equals( "There are 2 errors in your form.", container.html() );
|
||||
ok( labelContainer.is(":visible"), "must be visible" );
|
||||
ok( container.is(":visible"), "must be visible" );
|
||||
|
||||
$("#firstname").val("hix").keyup();
|
||||
$("#testForm1").triggerHandler("keyup", [jQuery.event.fix({ type: "keyup", target: $("#firstname")[0] })]);
|
||||
equals( 1, labelContainer.find("label:visible").length );
|
||||
equals( "There are 1 errors in your form.", container.html() );
|
||||
|
||||
$("#lastname").val("abc");
|
||||
ok( v.form(), "Form now valid, trigger showErrors but not invalid-form" );
|
||||
});
|
||||
|
||||
test("option invalidHandler", function() {
|
||||
expect(1);
|
||||
var v = $("#testForm1clean").validate({
|
||||
invalidHandler: function() {
|
||||
ok( true, "invalid-form event triggered called" );
|
||||
start();
|
||||
}
|
||||
});
|
||||
$("#usernamec").val("asdf").rules("add", { required: true, remote: "users.php" });
|
||||
stop();
|
||||
$("#testForm1clean").submit();
|
||||
});
|
||||
|
||||
test("findByName()", function() {
|
||||
isSet( new $.validator({}, document.getElementById("form")).findByName(document.getElementById("radio1").name), $("#form").find("[name=radio1]") );
|
||||
});
|
||||
|
||||
test("focusInvalid()", function() {
|
||||
expect(1);
|
||||
var inputs = $("#testForm1 input").focus(function() {
|
||||
equals( inputs[0], this, "focused first element" );
|
||||
});
|
||||
var v = $("#testForm1").validate();
|
||||
v.form();
|
||||
// have to explicitly show input elements with error class, they are hidden by testsuite styles
|
||||
inputs.show();
|
||||
v.focusInvalid();
|
||||
});
|
||||
|
||||
test("findLastActive()", function() {
|
||||
expect(3);
|
||||
var v = $("#testForm1").validate();
|
||||
ok( !v.findLastActive() );
|
||||
v.form();
|
||||
v.focusInvalid();
|
||||
ok( !v.findLastActive() );
|
||||
try {
|
||||
$("#testForm1 input:last").trigger("focusin");
|
||||
//$("#testForm1").triggerEvent("focusin", $("#testForm1 input:last")[0]);
|
||||
v.focusInvalid();
|
||||
equals( lastInput, v.findLastActive() );
|
||||
} catch(e) {
|
||||
ok( true, "Ignore in IE" );
|
||||
}
|
||||
});
|
||||
|
||||
test("validating multiple checkboxes with 'required'", function() {
|
||||
expect(3);
|
||||
var checkboxes = $("#form input[name=check3]").attr("checked", false);
|
||||
equals(5, checkboxes.size());
|
||||
var v = $("#form").validate({
|
||||
rules: {
|
||||
check3: "required"
|
||||
}
|
||||
});
|
||||
v.form();
|
||||
equals(1, v.size());
|
||||
checkboxes.filter(":last").attr("checked", true);
|
||||
v.form();
|
||||
equals(0, v.size());
|
||||
});
|
||||
|
||||
test("dynamic form", function() {
|
||||
var counter = 0;
|
||||
function add() {
|
||||
$("<input class='{required:true}' name='list" + counter++ + "' />").appendTo("#testForm2");
|
||||
}
|
||||
function errors(expected, message) {
|
||||
equals(expected, v.size(), message );
|
||||
}
|
||||
var v = $("#testForm2").validate();
|
||||
v.form();
|
||||
errors(1);
|
||||
add();
|
||||
v.form();
|
||||
errors(2);
|
||||
add();
|
||||
v.form();
|
||||
errors(3);
|
||||
$("#testForm2 input[name=list1]").remove();
|
||||
v.form();
|
||||
errors(2);
|
||||
add();
|
||||
v.form();
|
||||
errors(3);
|
||||
$("#testForm2 input[name^=list]").remove();
|
||||
v.form();
|
||||
errors(1);
|
||||
$("#agb").attr("disabled", true);
|
||||
v.form();
|
||||
errors(0);
|
||||
$("#agb").attr("disabled", false);
|
||||
v.form();
|
||||
errors(1);
|
||||
});
|
||||
|
||||
test("idOrName()", function() {
|
||||
expect(4);
|
||||
var v = $("#testForm1").validate();
|
||||
equals( "form8input", v.idOrName( $("#form8input")[0] ) );
|
||||
equals( "check", v.idOrName( $("#form6check1")[0] ) );
|
||||
equals( "agree", v.idOrName( $("#agb")[0] ) );
|
||||
equals( "button", v.idOrName( $("#form :button")[0] ) );
|
||||
});
|
||||
|
||||
test("resetForm()", function() {
|
||||
function errors(expected, message) {
|
||||
equals(expected, v.size(), message );
|
||||
}
|
||||
var v = $("#testForm1").validate();
|
||||
v.form();
|
||||
errors(2);
|
||||
$("#firstname").val("hiy");
|
||||
v.resetForm();
|
||||
errors(0);
|
||||
equals("", $("#firstname").val(), "form plugin is included, therefor resetForm must also reset inputs, not only errors");
|
||||
});
|
||||
|
||||
test("message from title", function() {
|
||||
var v = $("#withTitle").validate();
|
||||
v.checkForm();
|
||||
equals(v.errorList[0].message, "fromtitle", "title not used");
|
||||
});
|
||||
|
||||
test("ignoreTitle", function() {
|
||||
var v = $("#withTitle").validate({ignoreTitle:true});
|
||||
v.checkForm();
|
||||
equals(v.errorList[0].message, $.validator.messages["required"], "title used when it should have been ignored");
|
||||
});
|
||||
|
||||
test("ajaxSubmit", function() {
|
||||
expect(1);
|
||||
stop();
|
||||
$("#user").val("Peter");
|
||||
$("#password").val("foobar");
|
||||
jQuery("#signupForm").validate({
|
||||
submitHandler: function(form) {
|
||||
jQuery(form).ajaxSubmit({
|
||||
success: function(response) {
|
||||
equals("Hi Peter, welcome back.", response);
|
||||
start();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
jQuery("#signupForm").triggerHandler("submit");
|
||||
});
|
||||
|
||||
|
||||
module("misc");
|
||||
|
||||
test("success option", function() {
|
||||
expect(7);
|
||||
equals( "", $("#firstname").val() );
|
||||
var v = $("#testForm1").validate({
|
||||
success: "valid"
|
||||
});
|
||||
var label = $("#testForm1 label");
|
||||
ok( label.is(".error") );
|
||||
ok( !label.is(".valid") );
|
||||
v.form();
|
||||
ok( label.is(".error") );
|
||||
ok( !label.is(".valid") );
|
||||
$("#firstname").val("hi");
|
||||
v.form();
|
||||
ok( label.is(".error") );
|
||||
ok( label.is(".valid") );
|
||||
});
|
||||
|
||||
test("success option2", function() {
|
||||
expect(5);
|
||||
equals( "", $("#firstname").val() );
|
||||
var v = $("#testForm1").validate({
|
||||
success: "valid"
|
||||
});
|
||||
var label = $("#testForm1 label");
|
||||
ok( label.is(".error") );
|
||||
ok( !label.is(".valid") );
|
||||
$("#firstname").val("hi");
|
||||
v.form();
|
||||
ok( label.is(".error") );
|
||||
ok( label.is(".valid") );
|
||||
});
|
||||
|
||||
test("success option3", function() {
|
||||
expect(5);
|
||||
equals( "", $("#firstname").val() );
|
||||
$("#errorFirstname").remove();
|
||||
var v = $("#testForm1").validate({
|
||||
success: "valid"
|
||||
});
|
||||
equals( 0, $("#testForm1 label").size() );
|
||||
$("#firstname").val("hi");
|
||||
v.form();
|
||||
var labels = $("#testForm1 label");
|
||||
equals( 3, labels.size() );
|
||||
ok( labels.eq(0).is(".valid") );
|
||||
ok( !labels.eq(1).is(".valid") );
|
||||
});
|
||||
|
||||
test("successlist", function() {
|
||||
var v = $("#form").validate({ success: "xyz" });
|
||||
v.form();
|
||||
equals(0, v.successList.length);
|
||||
});
|
||||
|
||||
test("success isn't called for optional elements", function() {
|
||||
expect(4);
|
||||
equals( "", $("#firstname").removeClass().val() );
|
||||
$("#something").remove();
|
||||
$("#lastname").remove();
|
||||
$("#errorFirstname").remove();
|
||||
var v = $("#testForm1").validate({
|
||||
success: function() {
|
||||
ok( false, "don't call success for optional elements!" );
|
||||
},
|
||||
rules: {
|
||||
firstname: "email"
|
||||
}
|
||||
});
|
||||
equals( 0, $("#testForm1 label").size() );
|
||||
v.form();
|
||||
equals( 0, $("#testForm1 label").size() );
|
||||
$("#firstname").valid();
|
||||
equals( 0, $("#testForm1 label").size() );
|
||||
});
|
||||
|
||||
test("all rules are evaluated even if one returns a dependency-mistmatch", function() {
|
||||
expect(6);
|
||||
equals( "", $("#firstname").removeClass().val() );
|
||||
$("#lastname").remove();
|
||||
$("#errorFirstname").remove();
|
||||
$.validator.addMethod("custom1", function() {
|
||||
ok( true, "custom method must be evaluated" );
|
||||
return true;
|
||||
}, "");
|
||||
var v = $("#testForm1").validate({
|
||||
rules: {
|
||||
firstname: {email:true, custom1: true}
|
||||
}
|
||||
});
|
||||
equals( 0, $("#testForm1 label").size() );
|
||||
v.form();
|
||||
equals( 0, $("#testForm1 label").size() );
|
||||
$("#firstname").valid();
|
||||
equals( 0, $("#testForm1 label").size() );
|
||||
|
||||
delete $.validator.methods.custom1;
|
||||
delete $.validator.messages.custom1;
|
||||
});
|
||||
|
||||
test("messages", function() {
|
||||
var m = jQuery.validator.messages;
|
||||
equals( "Please enter no more than 0 characters.", m.maxlength(0) );
|
||||
equals( "Please enter at least 1 characters.", m.minlength(1) );
|
||||
equals( "Please enter a value between 1 and 2 characters long.", m.rangelength([1, 2]) );
|
||||
equals( "Please enter a value less than or equal to 1.", m.max(1) );
|
||||
equals( "Please enter a value greater than or equal to 0.", m.min(0) );
|
||||
equals( "Please enter a value between 1 and 2.", m.range([1, 2]) );
|
||||
});
|
||||
|
||||
test("jQuery.validator.format", function() {
|
||||
equals( "Please enter a value between 0 and 1.", jQuery.validator.format("Please enter a value between {0} and {1}.", 0, 1) );
|
||||
equals( "0 is too fast! Enter a value smaller then 0 and at least -15", jQuery.validator.format("{0} is too fast! Enter a value smaller then {0} and at least {1}", 0, -15) );
|
||||
var template = jQuery.validator.format("{0} is too fast! Enter a value smaller then {0} and at least {1}");
|
||||
equals( "0 is too fast! Enter a value smaller then 0 and at least -15", template(0, -15) );
|
||||
template = jQuery.validator.format("Please enter a value between {0} and {1}.");
|
||||
equals( "Please enter a value between 1 and 2.", template([1, 2]) );
|
||||
});
|
||||
|
||||
test("option: ignore", function() {
|
||||
var v = $("#testForm1").validate({
|
||||
ignore: "[name=lastname]"
|
||||
});
|
||||
v.form();
|
||||
equals( 1, v.size() );
|
||||
});
|
||||
|
||||
test("option: subformRequired", function() {
|
||||
jQuery.validator.addMethod("billingRequired", function(value, element) {
|
||||
if ($("#bill_to_co").is(":checked"))
|
||||
return $(element).parents("#subform").length;
|
||||
return !this.optional(element);
|
||||
}, "");
|
||||
var v = $("#subformRequired").validate();
|
||||
v.form();
|
||||
equals( 1, v.size() );
|
||||
$("#bill_to_co").attr("checked", false);
|
||||
v.form();
|
||||
equals( 2, v.size() );
|
||||
|
||||
delete $.validator.methods.billingRequired;
|
||||
delete $.validator.messages.billingRequired;
|
||||
});
|
||||
|
||||
module("expressions");
|
||||
|
||||
test("expression: :blank", function() {
|
||||
var e = $("#lastname")[0];
|
||||
equals( 1, $(e).filter(":blank").length );
|
||||
e.value = " ";
|
||||
equals( 1, $(e).filter(":blank").length );
|
||||
e.value = " "
|
||||
equals( 1, $(e).filter(":blank").length );
|
||||
e.value= " a ";
|
||||
equals( 0, $(e).filter(":blank").length );
|
||||
});
|
||||
|
||||
test("expression: :filled", function() {
|
||||
var e = $("#lastname")[0];
|
||||
equals( 0, $(e).filter(":filled").length );
|
||||
e.value = " ";
|
||||
equals( 0, $(e).filter(":filled").length );
|
||||
e.value = " "
|
||||
equals( 0, $(e).filter(":filled").length );
|
||||
e.value= " a ";
|
||||
equals( 1, $(e).filter(":filled").length );
|
||||
});
|
||||
|
||||
test("expression: :unchecked", function() {
|
||||
var e = $("#check2")[0];
|
||||
equals( 1, $(e).filter(":unchecked").length );
|
||||
e.checked = true;
|
||||
equals( 0, $(e).filter(":unchecked").length );
|
||||
e.checked = false;
|
||||
equals( 1, $(e).filter(":unchecked").length );
|
||||
});
|
||||
|
||||
module("events");
|
||||
|
||||
test("validate on blur", function() {
|
||||
function errors(expected, message) {
|
||||
equals(v.size(), expected, message );
|
||||
}
|
||||
function labels(expected) {
|
||||
equals(v.errors().filter(":visible").size(), expected);
|
||||
}
|
||||
function blur(target) {
|
||||
target.trigger("focusout");
|
||||
}
|
||||
$("#errorFirstname").hide();
|
||||
var e = $("#firstname");
|
||||
var v = $("#testForm1").validate();
|
||||
$("#something").val("");
|
||||
blur(e);
|
||||
errors(0, "No value yet, required is skipped on blur");
|
||||
labels(0);
|
||||
e.val("h");
|
||||
blur(e);
|
||||
errors(1, "Required was ignored, but as something was entered, check other rules, minlength isn't met");
|
||||
labels(1);
|
||||
e.val("hh");
|
||||
blur(e);
|
||||
errors(0, "All is fine");
|
||||
labels(0);
|
||||
e.val("");
|
||||
v.form();
|
||||
errors(3, "Submit checks all rules, both fields invalid");
|
||||
labels(3);
|
||||
blur(e);
|
||||
errors(1, "Blurring the field results in emptying the error list first, then checking the invalid field: its still invalid, don't remove the error" );
|
||||
labels(3);
|
||||
e.val("h");
|
||||
blur(e);
|
||||
errors(1, "Entering a single character fulfills required, but not minlength: 2, still invalid");
|
||||
labels(3);
|
||||
e.val("hh");
|
||||
blur(e);
|
||||
errors(0, "Both required and minlength are met, no errors left");
|
||||
labels(2);
|
||||
});
|
||||
|
||||
test("validate on keyup", function() {
|
||||
function errors(expected, message) {
|
||||
equals(expected, v.size(), message );
|
||||
}
|
||||
function keyup(target) {
|
||||
target.trigger("keyup");
|
||||
}
|
||||
var e = $("#firstname");
|
||||
var v = $("#testForm1").validate();
|
||||
keyup(e);
|
||||
errors(0, "No value, no errors");
|
||||
e.val("a");
|
||||
keyup(e);
|
||||
errors(0, "Value, but not invalid");
|
||||
e.val("");
|
||||
v.form();
|
||||
errors(2, "Both invalid");
|
||||
keyup(e);
|
||||
errors(1, "Only one field validated, still invalid");
|
||||
e.val("hh");
|
||||
keyup(e);
|
||||
errors(0, "Not invalid anymore");
|
||||
e.val("h");
|
||||
keyup(e);
|
||||
errors(1, "Field didn't loose focus, so validate again, invalid");
|
||||
e.val("hh");
|
||||
keyup(e);
|
||||
errors(0, "Valid");
|
||||
});
|
||||
|
||||
test("validate on not keyup, only blur", function() {
|
||||
function errors(expected, message) {
|
||||
equals(expected, v.size(), message );
|
||||
}
|
||||
var e = $("#firstname");
|
||||
var v = $("#testForm1").validate({
|
||||
onkeyup: false
|
||||
});
|
||||
errors(0);
|
||||
e.val("a");
|
||||
e.trigger("keyup");
|
||||
e.keyup();
|
||||
errors(0);
|
||||
e.trigger("focusout");
|
||||
errors(1);
|
||||
});
|
||||
|
||||
test("validate on keyup and blur", function() {
|
||||
function errors(expected, message) {
|
||||
equals(expected, v.size(), message );
|
||||
}
|
||||
var e = $("#firstname");
|
||||
var v = $("#testForm1").validate();
|
||||
errors(0);
|
||||
e.val("a");
|
||||
e.trigger("keyup");
|
||||
errors(0);
|
||||
e.trigger("focusout");
|
||||
errors(1);
|
||||
});
|
||||
|
||||
test("validate email on keyup and blur", function() {
|
||||
function errors(expected, message) {
|
||||
equals(expected, v.size(), message );
|
||||
}
|
||||
var e = $("#firstname");
|
||||
var v = $("#testForm1").validate();
|
||||
v.form();
|
||||
errors(2);
|
||||
e.val("a");
|
||||
e.trigger("keyup");
|
||||
errors(1);
|
||||
e.val("aa");
|
||||
e.trigger("keyup");
|
||||
errors(0);
|
||||
});
|
||||
|
||||
test("validate checkbox on click", function() {
|
||||
function errors(expected, message) {
|
||||
equals(expected, v.size(), message );
|
||||
}
|
||||
function trigger(element) {
|
||||
element.click();
|
||||
}
|
||||
var e = $("#check2");
|
||||
var v = $("#form").validate({
|
||||
rules: {
|
||||
check2: "required"
|
||||
}
|
||||
});
|
||||
trigger(e);
|
||||
errors(0);
|
||||
trigger(e);
|
||||
equals( false, v.form() );
|
||||
errors(1);
|
||||
trigger(e);
|
||||
errors(0);
|
||||
trigger(e);
|
||||
errors(1);
|
||||
});
|
||||
|
||||
test("validate multiple checkbox on click", function() {
|
||||
function errors(expected, message) {
|
||||
equals(expected, v.size(), message );
|
||||
}
|
||||
function trigger(element) {
|
||||
element.click();
|
||||
}
|
||||
var e1 = $("#check1").attr("checked", false);
|
||||
var e2 = $("#check1b");
|
||||
var v = $("#form").validate({
|
||||
rules: {
|
||||
check: {
|
||||
required: true,
|
||||
minlength: 2
|
||||
}
|
||||
}
|
||||
});
|
||||
trigger(e1);
|
||||
errors(0, "Minlength must be skipped");
|
||||
trigger(e2);
|
||||
errors(0);
|
||||
trigger(e2);
|
||||
equals( false, v.form() );
|
||||
errors(1);
|
||||
trigger(e2);
|
||||
errors(0);
|
||||
trigger(e2);
|
||||
errors(1);
|
||||
});
|
||||
|
||||
test("validate radio on click", function() {
|
||||
function errors(expected, message) {
|
||||
equals(expected, v.size(), message );
|
||||
}
|
||||
function trigger(element) {
|
||||
element.click();
|
||||
}
|
||||
var e1 = $("#radio1");
|
||||
var e2 = $("#radio1a");
|
||||
var v = $("#form").validate({
|
||||
rules: {
|
||||
radio1: "required"
|
||||
}
|
||||
});
|
||||
errors(0);
|
||||
equals( false, v.form() );
|
||||
errors(1);
|
||||
trigger(e2);
|
||||
errors(0);
|
||||
trigger(e1);
|
||||
errors(0);
|
||||
});
|
||||
|
||||
module("ajax");
|
||||
|
||||
test("check the serverside script works", function() {
|
||||
stop();
|
||||
$.getJSON("users.php", {value: 'asd'}, function(response) {
|
||||
ok( response, "yet available" );
|
||||
$.getJSON("users.php", {username: "asdf"}, function(response) {
|
||||
ok( !response, "already taken" );
|
||||
start();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test("check the serverside script works2", function() {
|
||||
stop();
|
||||
$.getJSON("users2.php", {value: 'asd'}, function(response) {
|
||||
ok( response, "yet available" );
|
||||
$.getJSON("users.php", {username: "asdf"}, function(response) {
|
||||
ok( !response, "asdf is already taken, please try something else" );
|
||||
start();
|
||||
});
|
||||
});
|
||||
});
|
11
thirdparty/jquery-validate/test/users.php
vendored
@ -1,11 +0,0 @@
|
||||
<?php
|
||||
$request = trim(strtolower($_REQUEST['username']));
|
||||
//sleep(1);
|
||||
$users = array('asdf', 'Peter', 'Peter2', 'George');
|
||||
$valid = 'true';
|
||||
foreach($users as $user) {
|
||||
if( strtolower($user) == $request )
|
||||
$valid = 'false';
|
||||
}
|
||||
echo $valid;
|
||||
?>
|
11
thirdparty/jquery-validate/test/users2.php
vendored
@ -1,11 +0,0 @@
|
||||
<?php
|
||||
$request = trim(strtolower($_REQUEST['username']));
|
||||
//sleep(1);
|
||||
$users = array('asdf', 'Peter', 'Peter2', 'George');
|
||||
$valid = 'true';
|
||||
foreach($users as $user) {
|
||||
if( strtolower($user) == $request )
|
||||
$valid = "'$user is already taken, please try something else'";
|
||||
}
|
||||
echo $valid;
|
||||
?>
|
30217
thirdparty/jsmin/test/ext-all-debug.js
vendored
3271
thirdparty/jsmin/test/prototype.js
vendored
@ -1,3271 +0,0 @@
|
||||
/* Prototype JavaScript framework, version 1.5.1
|
||||
* (c) 2005-2007 Sam Stephenson
|
||||
*
|
||||
* Prototype is freely distributable under the terms of an MIT-style license.
|
||||
* For details, see the Prototype web site: http://www.prototypejs.org/
|
||||
*
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
var Prototype = {
|
||||
Version: '1.5.1',
|
||||
|
||||
Browser: {
|
||||
IE: !!(window.attachEvent && !window.opera),
|
||||
Opera: !!window.opera,
|
||||
WebKit: navigator.userAgent.indexOf('AppleWebKit/') > -1,
|
||||
Gecko: navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') == -1
|
||||
},
|
||||
|
||||
BrowserFeatures: {
|
||||
XPath: !!document.evaluate,
|
||||
ElementExtensions: !!window.HTMLElement,
|
||||
SpecificElementExtensions:
|
||||
(document.createElement('div').__proto__ !==
|
||||
document.createElement('form').__proto__)
|
||||
},
|
||||
|
||||
ScriptFragment: '<script[^>]*>([\u0001-\uFFFF]*?)</script>',
|
||||
JSONFilter: /^\/\*-secure-\s*(.*)\s*\*\/\s*$/,
|
||||
|
||||
emptyFunction: function() { },
|
||||
K: function(x) { return x }
|
||||
}
|
||||
|
||||
var Class = {
|
||||
create: function() {
|
||||
return function() {
|
||||
this.initialize.apply(this, arguments);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var Abstract = new Object();
|
||||
|
||||
Object.extend = function(destination, source) {
|
||||
for (var property in source) {
|
||||
destination[property] = source[property];
|
||||
}
|
||||
return destination;
|
||||
}
|
||||
|
||||
Object.extend(Object, {
|
||||
inspect: function(object) {
|
||||
try {
|
||||
if (object === undefined) return 'undefined';
|
||||
if (object === null) return 'null';
|
||||
return object.inspect ? object.inspect() : object.toString();
|
||||
} catch (e) {
|
||||
if (e instanceof RangeError) return '...';
|
||||
throw e;
|
||||
}
|
||||
},
|
||||
|
||||
toJSON: function(object) {
|
||||
var type = typeof object;
|
||||
switch(type) {
|
||||
case 'undefined':
|
||||
case 'function':
|
||||
case 'unknown': return;
|
||||
case 'boolean': return object.toString();
|
||||
}
|
||||
if (object === null) return 'null';
|
||||
if (object.toJSON) return object.toJSON();
|
||||
if (object.ownerDocument === document) return;
|
||||
var results = [];
|
||||
for (var property in object) {
|
||||
var value = Object.toJSON(object[property]);
|
||||
if (value !== undefined)
|
||||
results.push(property.toJSON() + ': ' + value);
|
||||
}
|
||||
return '{' + results.join(', ') + '}';
|
||||
},
|
||||
|
||||
keys: function(object) {
|
||||
var keys = [];
|
||||
for (var property in object)
|
||||
keys.push(property);
|
||||
return keys;
|
||||
},
|
||||
|
||||
values: function(object) {
|
||||
var values = [];
|
||||
for (var property in object)
|
||||
values.push(object[property]);
|
||||
return values;
|
||||
},
|
||||
|
||||
clone: function(object) {
|
||||
return Object.extend({}, object);
|
||||
}
|
||||
});
|
||||
|
||||
Function.prototype.bind = function() {
|
||||
var __method = this, args = $A(arguments), object = args.shift();
|
||||
return function() {
|
||||
return __method.apply(object, args.concat($A(arguments)));
|
||||
}
|
||||
}
|
||||
|
||||
Function.prototype.bindAsEventListener = function(object) {
|
||||
var __method = this, args = $A(arguments), object = args.shift();
|
||||
return function(event) {
|
||||
return __method.apply(object, [event || window.event].concat(args));
|
||||
}
|
||||
}
|
||||
|
||||
Object.extend(Number.prototype, {
|
||||
toColorPart: function() {
|
||||
return this.toPaddedString(2, 16);
|
||||
},
|
||||
|
||||
succ: function() {
|
||||
return this + 1;
|
||||
},
|
||||
|
||||
times: function(iterator) {
|
||||
$R(0, this, true).each(iterator);
|
||||
return this;
|
||||
},
|
||||
|
||||
toPaddedString: function(length, radix) {
|
||||
var string = this.toString(radix || 10);
|
||||
return '0'.times(length - string.length) + string;
|
||||
},
|
||||
|
||||
toJSON: function() {
|
||||
return isFinite(this) ? this.toString() : 'null';
|
||||
}
|
||||
});
|
||||
|
||||
Date.prototype.toJSON = function() {
|
||||
return '"' + this.getFullYear() + '-' +
|
||||
(this.getMonth() + 1).toPaddedString(2) + '-' +
|
||||
this.getDate().toPaddedString(2) + 'T' +
|
||||
this.getHours().toPaddedString(2) + ':' +
|
||||
this.getMinutes().toPaddedString(2) + ':' +
|
||||
this.getSeconds().toPaddedString(2) + '"';
|
||||
};
|
||||
|
||||
var Try = {
|
||||
these: function() {
|
||||
var returnValue;
|
||||
|
||||
for (var i = 0, length = arguments.length; i < length; i++) {
|
||||
var lambda = arguments[i];
|
||||
try {
|
||||
returnValue = lambda();
|
||||
break;
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
var PeriodicalExecuter = Class.create();
|
||||
PeriodicalExecuter.prototype = {
|
||||
initialize: function(callback, frequency) {
|
||||
this.callback = callback;
|
||||
this.frequency = frequency;
|
||||
this.currentlyExecuting = false;
|
||||
|
||||
this.registerCallback();
|
||||
},
|
||||
|
||||
registerCallback: function() {
|
||||
this.timer = setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
|
||||
},
|
||||
|
||||
stop: function() {
|
||||
if (!this.timer) return;
|
||||
clearInterval(this.timer);
|
||||
this.timer = null;
|
||||
},
|
||||
|
||||
onTimerEvent: function() {
|
||||
if (!this.currentlyExecuting) {
|
||||
try {
|
||||
this.currentlyExecuting = true;
|
||||
this.callback(this);
|
||||
} finally {
|
||||
this.currentlyExecuting = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Object.extend(String, {
|
||||
interpret: function(value) {
|
||||
return value == null ? '' : String(value);
|
||||
},
|
||||
specialChar: {
|
||||
'\b': '\\b',
|
||||
'\t': '\\t',
|
||||
'\n': '\\n',
|
||||
'\f': '\\f',
|
||||
'\r': '\\r',
|
||||
'\\': '\\\\'
|
||||
}
|
||||
});
|
||||
|
||||
Object.extend(String.prototype, {
|
||||
gsub: function(pattern, replacement) {
|
||||
var result = '', source = this, match;
|
||||
replacement = arguments.callee.prepareReplacement(replacement);
|
||||
|
||||
while (source.length > 0) {
|
||||
if (match = source.match(pattern)) {
|
||||
result += source.slice(0, match.index);
|
||||
result += String.interpret(replacement(match));
|
||||
source = source.slice(match.index + match[0].length);
|
||||
} else {
|
||||
result += source, source = '';
|
||||
}
|
||||
}
|
||||
return result;
|
||||
},
|
||||
|
||||
sub: function(pattern, replacement, count) {
|
||||
replacement = this.gsub.prepareReplacement(replacement);
|
||||
count = count === undefined ? 1 : count;
|
||||
|
||||
return this.gsub(pattern, function(match) {
|
||||
if (--count < 0) return match[0];
|
||||
return replacement(match);
|
||||
});
|
||||
},
|
||||
|
||||
scan: function(pattern, iterator) {
|
||||
this.gsub(pattern, iterator);
|
||||
return this;
|
||||
},
|
||||
|
||||
truncate: function(length, truncation) {
|
||||
length = length || 30;
|
||||
truncation = truncation === undefined ? '...' : truncation;
|
||||
return this.length > length ?
|
||||
this.slice(0, length - truncation.length) + truncation : this;
|
||||
},
|
||||
|
||||
strip: function() {
|
||||
return this.replace(/^\s+/, '').replace(/\s+$/, '');
|
||||
},
|
||||
|
||||
stripTags: function() {
|
||||
return this.replace(/<\/?[^>]+>/gi, '');
|
||||
},
|
||||
|
||||
stripScripts: function() {
|
||||
return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), '');
|
||||
},
|
||||
|
||||
extractScripts: function() {
|
||||
var matchAll = new RegExp(Prototype.ScriptFragment, 'img');
|
||||
var matchOne = new RegExp(Prototype.ScriptFragment, 'im');
|
||||
return (this.match(matchAll) || []).map(function(scriptTag) {
|
||||
return (scriptTag.match(matchOne) || ['', ''])[1];
|
||||
});
|
||||
},
|
||||
|
||||
evalScripts: function() {
|
||||
return this.extractScripts().map(function(script) { return eval(script) });
|
||||
},
|
||||
|
||||
escapeHTML: function() {
|
||||
var self = arguments.callee;
|
||||
self.text.data = this;
|
||||
return self.div.innerHTML;
|
||||
},
|
||||
|
||||
unescapeHTML: function() {
|
||||
var div = document.createElement('div');
|
||||
div.innerHTML = this.stripTags();
|
||||
return div.childNodes[0] ? (div.childNodes.length > 1 ?
|
||||
$A(div.childNodes).inject('', function(memo, node) { return memo+node.nodeValue }) :
|
||||
div.childNodes[0].nodeValue) : '';
|
||||
},
|
||||
|
||||
toQueryParams: function(separator) {
|
||||
var match = this.strip().match(/([^?#]*)(#.*)?$/);
|
||||
if (!match) return {};
|
||||
|
||||
return match[1].split(separator || '&').inject({}, function(hash, pair) {
|
||||
if ((pair = pair.split('='))[0]) {
|
||||
var key = decodeURIComponent(pair.shift());
|
||||
var value = pair.length > 1 ? pair.join('=') : pair[0];
|
||||
if (value != undefined) value = decodeURIComponent(value);
|
||||
|
||||
if (key in hash) {
|
||||
if (hash[key].constructor != Array) hash[key] = [hash[key]];
|
||||
hash[key].push(value);
|
||||
}
|
||||
else hash[key] = value;
|
||||
}
|
||||
return hash;
|
||||
});
|
||||
},
|
||||
|
||||
toArray: function() {
|
||||
return this.split('');
|
||||
},
|
||||
|
||||
succ: function() {
|
||||
return this.slice(0, this.length - 1) +
|
||||
String.fromCharCode(this.charCodeAt(this.length - 1) + 1);
|
||||
},
|
||||
|
||||
times: function(count) {
|
||||
var result = '';
|
||||
for (var i = 0; i < count; i++) result += this;
|
||||
return result;
|
||||
},
|
||||
|
||||
camelize: function() {
|
||||
var parts = this.split('-'), len = parts.length;
|
||||
if (len == 1) return parts[0];
|
||||
|
||||
var camelized = this.charAt(0) == '-'
|
||||
? parts[0].charAt(0).toUpperCase() + parts[0].substring(1)
|
||||
: parts[0];
|
||||
|
||||
for (var i = 1; i < len; i++)
|
||||
camelized += parts[i].charAt(0).toUpperCase() + parts[i].substring(1);
|
||||
|
||||
return camelized;
|
||||
},
|
||||
|
||||
capitalize: function() {
|
||||
return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase();
|
||||
},
|
||||
|
||||
underscore: function() {
|
||||
return this.gsub(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/,'#{1}_#{2}').gsub(/([a-z\d])([A-Z])/,'#{1}_#{2}').gsub(/-/,'_').toLowerCase();
|
||||
},
|
||||
|
||||
dasherize: function() {
|
||||
return this.gsub(/_/,'-');
|
||||
},
|
||||
|
||||
inspect: function(useDoubleQuotes) {
|
||||
var escapedString = this.gsub(/[\x00-\x1f\\]/, function(match) {
|
||||
var character = String.specialChar[match[0]];
|
||||
return character ? character : '\\u00' + match[0].charCodeAt().toPaddedString(2, 16);
|
||||
});
|
||||
if (useDoubleQuotes) return '"' + escapedString.replace(/"/g, '\\"') + '"';
|
||||
return "'" + escapedString.replace(/'/g, '\\\'') + "'";
|
||||
},
|
||||
|
||||
toJSON: function() {
|
||||
return this.inspect(true);
|
||||
},
|
||||
|
||||
unfilterJSON: function(filter) {
|
||||
return this.sub(filter || Prototype.JSONFilter, '#{1}');
|
||||
},
|
||||
|
||||
evalJSON: function(sanitize) {
|
||||
var json = this.unfilterJSON();
|
||||
try {
|
||||
if (!sanitize || (/^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/.test(json)))
|
||||
return eval('(' + json + ')');
|
||||
} catch (e) { }
|
||||
throw new SyntaxError('Badly formed JSON string: ' + this.inspect());
|
||||
},
|
||||
|
||||
include: function(pattern) {
|
||||
return this.indexOf(pattern) > -1;
|
||||
},
|
||||
|
||||
startsWith: function(pattern) {
|
||||
return this.indexOf(pattern) === 0;
|
||||
},
|
||||
|
||||
endsWith: function(pattern) {
|
||||
var d = this.length - pattern.length;
|
||||
return d >= 0 && this.lastIndexOf(pattern) === d;
|
||||
},
|
||||
|
||||
empty: function() {
|
||||
return this == '';
|
||||
},
|
||||
|
||||
blank: function() {
|
||||
return /^\s*$/.test(this);
|
||||
}
|
||||
});
|
||||
|
||||
if (Prototype.Browser.WebKit || Prototype.Browser.IE) Object.extend(String.prototype, {
|
||||
escapeHTML: function() {
|
||||
return this.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>');
|
||||
},
|
||||
unescapeHTML: function() {
|
||||
return this.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>');
|
||||
}
|
||||
});
|
||||
|
||||
String.prototype.gsub.prepareReplacement = function(replacement) {
|
||||
if (typeof replacement == 'function') return replacement;
|
||||
var template = new Template(replacement);
|
||||
return function(match) { return template.evaluate(match) };
|
||||
}
|
||||
|
||||
String.prototype.parseQuery = String.prototype.toQueryParams;
|
||||
|
||||
Object.extend(String.prototype.escapeHTML, {
|
||||
div: document.createElement('div'),
|
||||
text: document.createTextNode('')
|
||||
});
|
||||
|
||||
with (String.prototype.escapeHTML) div.appendChild(text);
|
||||
|
||||
var Template = Class.create();
|
||||
Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/;
|
||||
Template.prototype = {
|
||||
initialize: function(template, pattern) {
|
||||
this.template = template.toString();
|
||||
this.pattern = pattern || Template.Pattern;
|
||||
},
|
||||
|
||||
evaluate: function(object) {
|
||||
return this.template.gsub(this.pattern, function(match) {
|
||||
var before = match[1];
|
||||
if (before == '\\') return match[2];
|
||||
return before + String.interpret(object[match[3]]);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
var $break = {}, $continue = new Error('"throw $continue" is deprecated, use "return" instead');
|
||||
|
||||
var Enumerable = {
|
||||
each: function(iterator) {
|
||||
var index = 0;
|
||||
try {
|
||||
this._each(function(value) {
|
||||
iterator(value, index++);
|
||||
});
|
||||
} catch (e) {
|
||||
if (e != $break) throw e;
|
||||
}
|
||||
return this;
|
||||
},
|
||||
|
||||
eachSlice: function(number, iterator) {
|
||||
var index = -number, slices = [], array = this.toArray();
|
||||
while ((index += number) < array.length)
|
||||
slices.push(array.slice(index, index+number));
|
||||
return slices.map(iterator);
|
||||
},
|
||||
|
||||
all: function(iterator) {
|
||||
var result = true;
|
||||
this.each(function(value, index) {
|
||||
result = result && !!(iterator || Prototype.K)(value, index);
|
||||
if (!result) throw $break;
|
||||
});
|
||||
return result;
|
||||
},
|
||||
|
||||
any: function(iterator) {
|
||||
var result = false;
|
||||
this.each(function(value, index) {
|
||||
if (result = !!(iterator || Prototype.K)(value, index))
|
||||
throw $break;
|
||||
});
|
||||
return result;
|
||||
},
|
||||
|
||||
collect: function(iterator) {
|
||||
var results = [];
|
||||
this.each(function(value, index) {
|
||||
results.push((iterator || Prototype.K)(value, index));
|
||||
});
|
||||
return results;
|
||||
},
|
||||
|
||||
detect: function(iterator) {
|
||||
var result;
|
||||
this.each(function(value, index) {
|
||||
if (iterator(value, index)) {
|
||||
result = value;
|
||||
throw $break;
|
||||
}
|
||||
});
|
||||
return result;
|
||||
},
|
||||
|
||||
findAll: function(iterator) {
|
||||
var results = [];
|
||||
this.each(function(value, index) {
|
||||
if (iterator(value, index))
|
||||
results.push(value);
|
||||
});
|
||||
return results;
|
||||
},
|
||||
|
||||
grep: function(pattern, iterator) {
|
||||
var results = [];
|
||||
this.each(function(value, index) {
|
||||
var stringValue = value.toString();
|
||||
if (stringValue.match(pattern))
|
||||
results.push((iterator || Prototype.K)(value, index));
|
||||
})
|
||||
return results;
|
||||
},
|
||||
|
||||
include: function(object) {
|
||||
var found = false;
|
||||
this.each(function(value) {
|
||||
if (value == object) {
|
||||
found = true;
|
||||
throw $break;
|
||||
}
|
||||
});
|
||||
return found;
|
||||
},
|
||||
|
||||
inGroupsOf: function(number, fillWith) {
|
||||
fillWith = fillWith === undefined ? null : fillWith;
|
||||
return this.eachSlice(number, function(slice) {
|
||||
while(slice.length < number) slice.push(fillWith);
|
||||
return slice;
|
||||
});
|
||||
},
|
||||
|
||||
inject: function(memo, iterator) {
|
||||
this.each(function(value, index) {
|
||||
memo = iterator(memo, value, index);
|
||||
});
|
||||
return memo;
|
||||
},
|
||||
|
||||
invoke: function(method) {
|
||||
var args = $A(arguments).slice(1);
|
||||
return this.map(function(value) {
|
||||
return value[method].apply(value, args);
|
||||
});
|
||||
},
|
||||
|
||||
max: function(iterator) {
|
||||
var result;
|
||||
this.each(function(value, index) {
|
||||
value = (iterator || Prototype.K)(value, index);
|
||||
if (result == undefined || value >= result)
|
||||
result = value;
|
||||
});
|
||||
return result;
|
||||
},
|
||||
|
||||
min: function(iterator) {
|
||||
var result;
|
||||
this.each(function(value, index) {
|
||||
value = (iterator || Prototype.K)(value, index);
|
||||
if (result == undefined || value < result)
|
||||
result = value;
|
||||
});
|
||||
return result;
|
||||
},
|
||||
|
||||
partition: function(iterator) {
|
||||
var trues = [], falses = [];
|
||||
this.each(function(value, index) {
|
||||
((iterator || Prototype.K)(value, index) ?
|
||||
trues : falses).push(value);
|
||||
});
|
||||
return [trues, falses];
|
||||
},
|
||||
|
||||
pluck: function(property) {
|
||||
var results = [];
|
||||
this.each(function(value, index) {
|
||||
results.push(value[property]);
|
||||
});
|
||||
return results;
|
||||
},
|
||||
|
||||
reject: function(iterator) {
|
||||
var results = [];
|
||||
this.each(function(value, index) {
|
||||
if (!iterator(value, index))
|
||||
results.push(value);
|
||||
});
|
||||
return results;
|
||||
},
|
||||
|
||||
sortBy: function(iterator) {
|
||||
return this.map(function(value, index) {
|
||||
return {value: value, criteria: iterator(value, index)};
|
||||
}).sort(function(left, right) {
|
||||
var a = left.criteria, b = right.criteria;
|
||||
return a < b ? -1 : a > b ? 1 : 0;
|
||||
}).pluck('value');
|
||||
},
|
||||
|
||||
toArray: function() {
|
||||
return this.map();
|
||||
},
|
||||
|
||||
zip: function() {
|
||||
var iterator = Prototype.K, args = $A(arguments);
|
||||
if (typeof args.last() == 'function')
|
||||
iterator = args.pop();
|
||||
|
||||
var collections = [this].concat(args).map($A);
|
||||
return this.map(function(value, index) {
|
||||
return iterator(collections.pluck(index));
|
||||
});
|
||||
},
|
||||
|
||||
size: function() {
|
||||
return this.toArray().length;
|
||||
},
|
||||
|
||||
inspect: function() {
|
||||
return '#<Enumerable:' + this.toArray().inspect() + '>';
|
||||
}
|
||||
}
|
||||
|
||||
Object.extend(Enumerable, {
|
||||
map: Enumerable.collect,
|
||||
find: Enumerable.detect,
|
||||
select: Enumerable.findAll,
|
||||
member: Enumerable.include,
|
||||
entries: Enumerable.toArray
|
||||
});
|
||||
var $A = Array.from = function(iterable) {
|
||||
if (!iterable) return [];
|
||||
if (iterable.toArray) {
|
||||
return iterable.toArray();
|
||||
} else {
|
||||
var results = [];
|
||||
for (var i = 0, length = iterable.length; i < length; i++)
|
||||
results.push(iterable[i]);
|
||||
return results;
|
||||
}
|
||||
}
|
||||
|
||||
if (Prototype.Browser.WebKit) {
|
||||
$A = Array.from = function(iterable) {
|
||||
if (!iterable) return [];
|
||||
if (!(typeof iterable == 'function' && iterable == '[object NodeList]') &&
|
||||
iterable.toArray) {
|
||||
return iterable.toArray();
|
||||
} else {
|
||||
var results = [];
|
||||
for (var i = 0, length = iterable.length; i < length; i++)
|
||||
results.push(iterable[i]);
|
||||
return results;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Object.extend(Array.prototype, Enumerable);
|
||||
|
||||
if (!Array.prototype._reverse)
|
||||
Array.prototype._reverse = Array.prototype.reverse;
|
||||
|
||||
Object.extend(Array.prototype, {
|
||||
_each: function(iterator) {
|
||||
for (var i = 0, length = this.length; i < length; i++)
|
||||
iterator(this[i]);
|
||||
},
|
||||
|
||||
clear: function() {
|
||||
this.length = 0;
|
||||
return this;
|
||||
},
|
||||
|
||||
first: function() {
|
||||
return this[0];
|
||||
},
|
||||
|
||||
last: function() {
|
||||
return this[this.length - 1];
|
||||
},
|
||||
|
||||
compact: function() {
|
||||
return this.select(function(value) {
|
||||
return value != null;
|
||||
});
|
||||
},
|
||||
|
||||
flatten: function() {
|
||||
return this.inject([], function(array, value) {
|
||||
return array.concat(value && value.constructor == Array ?
|
||||
value.flatten() : [value]);
|
||||
});
|
||||
},
|
||||
|
||||
without: function() {
|
||||
var values = $A(arguments);
|
||||
return this.select(function(value) {
|
||||
return !values.include(value);
|
||||
});
|
||||
},
|
||||
|
||||
indexOf: function(object) {
|
||||
for (var i = 0, length = this.length; i < length; i++)
|
||||
if (this[i] == object) return i;
|
||||
return -1;
|
||||
},
|
||||
|
||||
reverse: function(inline) {
|
||||
return (inline !== false ? this : this.toArray())._reverse();
|
||||
},
|
||||
|
||||
reduce: function() {
|
||||
return this.length > 1 ? this : this[0];
|
||||
},
|
||||
|
||||
uniq: function(sorted) {
|
||||
return this.inject([], function(array, value, index) {
|
||||
if (0 == index || (sorted ? array.last() != value : !array.include(value)))
|
||||
array.push(value);
|
||||
return array;
|
||||
});
|
||||
},
|
||||
|
||||
clone: function() {
|
||||
return [].concat(this);
|
||||
},
|
||||
|
||||
size: function() {
|
||||
return this.length;
|
||||
},
|
||||
|
||||
inspect: function() {
|
||||
return '[' + this.map(Object.inspect).join(', ') + ']';
|
||||
},
|
||||
|
||||
toJSON: function() {
|
||||
var results = [];
|
||||
this.each(function(object) {
|
||||
var value = Object.toJSON(object);
|
||||
if (value !== undefined) results.push(value);
|
||||
});
|
||||
return '[' + results.join(', ') + ']';
|
||||
}
|
||||
});
|
||||
|
||||
Array.prototype.toArray = Array.prototype.clone;
|
||||
|
||||
function $w(string) {
|
||||
string = string.strip();
|
||||
return string ? string.split(/\s+/) : [];
|
||||
}
|
||||
|
||||
if (Prototype.Browser.Opera){
|
||||
Array.prototype.concat = function() {
|
||||
var array = [];
|
||||
for (var i = 0, length = this.length; i < length; i++) array.push(this[i]);
|
||||
for (var i = 0, length = arguments.length; i < length; i++) {
|
||||
if (arguments[i].constructor == Array) {
|
||||
for (var j = 0, arrayLength = arguments[i].length; j < arrayLength; j++)
|
||||
array.push(arguments[i][j]);
|
||||
} else {
|
||||
array.push(arguments[i]);
|
||||
}
|
||||
}
|
||||
return array;
|
||||
}
|
||||
}
|
||||
var Hash = function(object) {
|
||||
if (object instanceof Hash) this.merge(object);
|
||||
else Object.extend(this, object || {});
|
||||
};
|
||||
|
||||
Object.extend(Hash, {
|
||||
toQueryString: function(obj) {
|
||||
var parts = [];
|
||||
parts.add = arguments.callee.addPair;
|
||||
|
||||
this.prototype._each.call(obj, function(pair) {
|
||||
if (!pair.key) return;
|
||||
var value = pair.value;
|
||||
|
||||
if (value && typeof value == 'object') {
|
||||
if (value.constructor == Array) value.each(function(value) {
|
||||
parts.add(pair.key, value);
|
||||
});
|
||||
return;
|
||||
}
|
||||
parts.add(pair.key, value);
|
||||
});
|
||||
|
||||
return parts.join('&');
|
||||
},
|
||||
|
||||
toJSON: function(object) {
|
||||
var results = [];
|
||||
this.prototype._each.call(object, function(pair) {
|
||||
var value = Object.toJSON(pair.value);
|
||||
if (value !== undefined) results.push(pair.key.toJSON() + ': ' + value);
|
||||
});
|
||||
return '{' + results.join(', ') + '}';
|
||||
}
|
||||
});
|
||||
|
||||
Hash.toQueryString.addPair = function(key, value, prefix) {
|
||||
key = encodeURIComponent(key);
|
||||
if (value === undefined) this.push(key);
|
||||
else this.push(key + '=' + (value == null ? '' : encodeURIComponent(value)));
|
||||
}
|
||||
|
||||
Object.extend(Hash.prototype, Enumerable);
|
||||
Object.extend(Hash.prototype, {
|
||||
_each: function(iterator) {
|
||||
for (var key in this) {
|
||||
var value = this[key];
|
||||
if (value && value == Hash.prototype[key]) continue;
|
||||
|
||||
var pair = [key, value];
|
||||
pair.key = key;
|
||||
pair.value = value;
|
||||
iterator(pair);
|
||||
}
|
||||
},
|
||||
|
||||
keys: function() {
|
||||
return this.pluck('key');
|
||||
},
|
||||
|
||||
values: function() {
|
||||
return this.pluck('value');
|
||||
},
|
||||
|
||||
merge: function(hash) {
|
||||
return $H(hash).inject(this, function(mergedHash, pair) {
|
||||
mergedHash[pair.key] = pair.value;
|
||||
return mergedHash;
|
||||
});
|
||||
},
|
||||
|
||||
remove: function() {
|
||||
var result;
|
||||
for(var i = 0, length = arguments.length; i < length; i++) {
|
||||
var value = this[arguments[i]];
|
||||
if (value !== undefined){
|
||||
if (result === undefined) result = value;
|
||||
else {
|
||||
if (result.constructor != Array) result = [result];
|
||||
result.push(value)
|
||||
}
|
||||
}
|
||||
delete this[arguments[i]];
|
||||
}
|
||||
return result;
|
||||
},
|
||||
|
||||
toQueryString: function() {
|
||||
return Hash.toQueryString(this);
|
||||
},
|
||||
|
||||
inspect: function() {
|
||||
return '#<Hash:{' + this.map(function(pair) {
|
||||
return pair.map(Object.inspect).join(': ');
|
||||
}).join(', ') + '}>';
|
||||
},
|
||||
|
||||
toJSON: function() {
|
||||
return Hash.toJSON(this);
|
||||
}
|
||||
});
|
||||
|
||||
function $H(object) {
|
||||
if (object instanceof Hash) return object;
|
||||
return new Hash(object);
|
||||
};
|
||||
|
||||
// Safari iterates over shadowed properties
|
||||
if (function() {
|
||||
var i = 0, Test = function(value) { this.key = value };
|
||||
Test.prototype.key = 'foo';
|
||||
for (var property in new Test('bar')) i++;
|
||||
return i > 1;
|
||||
}()) Hash.prototype._each = function(iterator) {
|
||||
var cache = [];
|
||||
for (var key in this) {
|
||||
var value = this[key];
|
||||
if ((value && value == Hash.prototype[key]) || cache.include(key)) continue;
|
||||
cache.push(key);
|
||||
var pair = [key, value];
|
||||
pair.key = key;
|
||||
pair.value = value;
|
||||
iterator(pair);
|
||||
}
|
||||
};
|
||||
ObjectRange = Class.create();
|
||||
Object.extend(ObjectRange.prototype, Enumerable);
|
||||
Object.extend(ObjectRange.prototype, {
|
||||
initialize: function(start, end, exclusive) {
|
||||
this.start = start;
|
||||
this.end = end;
|
||||
this.exclusive = exclusive;
|
||||
},
|
||||
|
||||
_each: function(iterator) {
|
||||
var value = this.start;
|
||||
while (this.include(value)) {
|
||||
iterator(value);
|
||||
value = value.succ();
|
||||
}
|
||||
},
|
||||
|
||||
include: function(value) {
|
||||
if (value < this.start)
|
||||
return false;
|
||||
if (this.exclusive)
|
||||
return value < this.end;
|
||||
return value <= this.end;
|
||||
}
|
||||
});
|
||||
|
||||
var $R = function(start, end, exclusive) {
|
||||
return new ObjectRange(start, end, exclusive);
|
||||
}
|
||||
|
||||
var Ajax = {
|
||||
getTransport: function() {
|
||||
return Try.these(
|
||||
function() {return new XMLHttpRequest()},
|
||||
function() {return new ActiveXObject('Msxml2.XMLHTTP')},
|
||||
function() {return new ActiveXObject('Microsoft.XMLHTTP')}
|
||||
) || false;
|
||||
},
|
||||
|
||||
activeRequestCount: 0
|
||||
}
|
||||
|
||||
Ajax.Responders = {
|
||||
responders: [],
|
||||
|
||||
_each: function(iterator) {
|
||||
this.responders._each(iterator);
|
||||
},
|
||||
|
||||
register: function(responder) {
|
||||
if (!this.include(responder))
|
||||
this.responders.push(responder);
|
||||
},
|
||||
|
||||
unregister: function(responder) {
|
||||
this.responders = this.responders.without(responder);
|
||||
},
|
||||
|
||||
dispatch: function(callback, request, transport, json) {
|
||||
this.each(function(responder) {
|
||||
if (typeof responder[callback] == 'function') {
|
||||
try {
|
||||
responder[callback].apply(responder, [request, transport, json]);
|
||||
} catch (e) {}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Object.extend(Ajax.Responders, Enumerable);
|
||||
|
||||
Ajax.Responders.register({
|
||||
onCreate: function() {
|
||||
Ajax.activeRequestCount++;
|
||||
},
|
||||
onComplete: function() {
|
||||
Ajax.activeRequestCount--;
|
||||
}
|
||||
});
|
||||
|
||||
Ajax.Base = function() {};
|
||||
Ajax.Base.prototype = {
|
||||
setOptions: function(options) {
|
||||
this.options = {
|
||||
method: 'post',
|
||||
asynchronous: true,
|
||||
contentType: 'application/x-www-form-urlencoded',
|
||||
encoding: 'UTF-8',
|
||||
parameters: ''
|
||||
}
|
||||
Object.extend(this.options, options || {});
|
||||
|
||||
this.options.method = this.options.method.toLowerCase();
|
||||
if (typeof this.options.parameters == 'string')
|
||||
this.options.parameters = this.options.parameters.toQueryParams();
|
||||
}
|
||||
}
|
||||
|
||||
Ajax.Request = Class.create();
|
||||
Ajax.Request.Events =
|
||||
['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete'];
|
||||
|
||||
Ajax.Request.prototype = Object.extend(new Ajax.Base(), {
|
||||
_complete: false,
|
||||
|
||||
initialize: function(url, options) {
|
||||
this.transport = Ajax.getTransport();
|
||||
this.setOptions(options);
|
||||
this.request(url);
|
||||
},
|
||||
|
||||
request: function(url) {
|
||||
this.url = url;
|
||||
this.method = this.options.method;
|
||||
var params = Object.clone(this.options.parameters);
|
||||
|
||||
if (!['get', 'post'].include(this.method)) {
|
||||
// simulate other verbs over post
|
||||
params['_method'] = this.method;
|
||||
this.method = 'post';
|
||||
}
|
||||
|
||||
this.parameters = params;
|
||||
|
||||
if (params = Hash.toQueryString(params)) {
|
||||
// when GET, append parameters to URL
|
||||
if (this.method == 'get')
|
||||
this.url += (this.url.include('?') ? '&' : '?') + params;
|
||||
else if (/Konqueror|Safari|KHTML/.test(navigator.userAgent))
|
||||
params += '&_=';
|
||||
}
|
||||
|
||||
try {
|
||||
if (this.options.onCreate) this.options.onCreate(this.transport);
|
||||
Ajax.Responders.dispatch('onCreate', this, this.transport);
|
||||
|
||||
this.transport.open(this.method.toUpperCase(), this.url,
|
||||
this.options.asynchronous);
|
||||
|
||||
if (this.options.asynchronous)
|
||||
setTimeout(function() { this.respondToReadyState(1) }.bind(this), 10);
|
||||
|
||||
this.transport.onreadystatechange = this.onStateChange.bind(this);
|
||||
this.setRequestHeaders();
|
||||
|
||||
this.body = this.method == 'post' ? (this.options.postBody || params) : null;
|
||||
this.transport.send(this.body);
|
||||
|
||||
/* Force Firefox to handle ready state 4 for synchronous requests */
|
||||
if (!this.options.asynchronous && this.transport.overrideMimeType)
|
||||
this.onStateChange();
|
||||
|
||||
}
|
||||
catch (e) {
|
||||
this.dispatchException(e);
|
||||
}
|
||||
},
|
||||
|
||||
onStateChange: function() {
|
||||
var readyState = this.transport.readyState;
|
||||
if (readyState > 1 && !((readyState == 4) && this._complete))
|
||||
this.respondToReadyState(this.transport.readyState);
|
||||
},
|
||||
|
||||
setRequestHeaders: function() {
|
||||
var headers = {
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
'X-Prototype-Version': Prototype.Version,
|
||||
'Accept': 'text/javascript, text/html, application/xml, text/xml, */*'
|
||||
};
|
||||
|
||||
if (this.method == 'post') {
|
||||
headers['Content-type'] = this.options.contentType +
|
||||
(this.options.encoding ? '; charset=' + this.options.encoding : '');
|
||||
|
||||
/* Force "Connection: close" for older Mozilla browsers to work
|
||||
* around a bug where XMLHttpRequest sends an incorrect
|
||||
* Content-length header. See Mozilla Bugzilla #246651.
|
||||
*/
|
||||
if (this.transport.overrideMimeType &&
|
||||
(navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005)
|
||||
headers['Connection'] = 'close';
|
||||
}
|
||||
|
||||
// user-defined headers
|
||||
if (typeof this.options.requestHeaders == 'object') {
|
||||
var extras = this.options.requestHeaders;
|
||||
|
||||
if (typeof extras.push == 'function')
|
||||
for (var i = 0, length = extras.length; i < length; i += 2)
|
||||
headers[extras[i]] = extras[i+1];
|
||||
else
|
||||
$H(extras).each(function(pair) { headers[pair.key] = pair.value });
|
||||
}
|
||||
|
||||
for (var name in headers)
|
||||
this.transport.setRequestHeader(name, headers[name]);
|
||||
},
|
||||
|
||||
success: function() {
|
||||
return !this.transport.status
|
||||
|| (this.transport.status >= 200 && this.transport.status < 300);
|
||||
},
|
||||
|
||||
respondToReadyState: function(readyState) {
|
||||
var state = Ajax.Request.Events[readyState];
|
||||
var transport = this.transport, json = this.evalJSON();
|
||||
|
||||
if (state == 'Complete') {
|
||||
try {
|
||||
this._complete = true;
|
||||
(this.options['on' + this.transport.status]
|
||||
|| this.options['on' + (this.success() ? 'Success' : 'Failure')]
|
||||
|| Prototype.emptyFunction)(transport, json);
|
||||
} catch (e) {
|
||||
this.dispatchException(e);
|
||||
}
|
||||
|
||||
var contentType = this.getHeader('Content-type');
|
||||
if (contentType && contentType.strip().
|
||||
match(/^(text|application)\/(x-)?(java|ecma)script(;.*)?$/i))
|
||||
this.evalResponse();
|
||||
}
|
||||
|
||||
try {
|
||||
(this.options['on' + state] || Prototype.emptyFunction)(transport, json);
|
||||
Ajax.Responders.dispatch('on' + state, this, transport, json);
|
||||
} catch (e) {
|
||||
this.dispatchException(e);
|
||||
}
|
||||
|
||||
if (state == 'Complete') {
|
||||
// avoid memory leak in MSIE: clean up
|
||||
this.transport.onreadystatechange = Prototype.emptyFunction;
|
||||
}
|
||||
},
|
||||
|
||||
getHeader: function(name) {
|
||||
try {
|
||||
return this.transport.getResponseHeader(name);
|
||||
} catch (e) { return null }
|
||||
},
|
||||
|
||||
evalJSON: function() {
|
||||
try {
|
||||
var json = this.getHeader('X-JSON');
|
||||
return json ? json.evalJSON() : null;
|
||||
} catch (e) { return null }
|
||||
},
|
||||
|
||||
evalResponse: function() {
|
||||
try {
|
||||
return eval((this.transport.responseText || '').unfilterJSON());
|
||||
} catch (e) {
|
||||
this.dispatchException(e);
|
||||
}
|
||||
},
|
||||
|
||||
dispatchException: function(exception) {
|
||||
(this.options.onException || Prototype.emptyFunction)(this, exception);
|
||||
Ajax.Responders.dispatch('onException', this, exception);
|
||||
}
|
||||
});
|
||||
|
||||
Ajax.Updater = Class.create();
|
||||
|
||||
Object.extend(Object.extend(Ajax.Updater.prototype, Ajax.Request.prototype), {
|
||||
initialize: function(container, url, options) {
|
||||
this.container = {
|
||||
success: (container.success || container),
|
||||
failure: (container.failure || (container.success ? null : container))
|
||||
}
|
||||
|
||||
this.transport = Ajax.getTransport();
|
||||
this.setOptions(options);
|
||||
|
||||
var onComplete = this.options.onComplete || Prototype.emptyFunction;
|
||||
this.options.onComplete = (function(transport, param) {
|
||||
this.updateContent();
|
||||
onComplete(transport, param);
|
||||
}).bind(this);
|
||||
|
||||
this.request(url);
|
||||
},
|
||||
|
||||
updateContent: function() {
|
||||
var receiver = this.container[this.success() ? 'success' : 'failure'];
|
||||
var response = this.transport.responseText;
|
||||
|
||||
if (!this.options.evalScripts) response = response.stripScripts();
|
||||
|
||||
if (receiver = $(receiver)) {
|
||||
if (this.options.insertion)
|
||||
new this.options.insertion(receiver, response);
|
||||
else
|
||||
receiver.update(response);
|
||||
}
|
||||
|
||||
if (this.success()) {
|
||||
if (this.onComplete)
|
||||
setTimeout(this.onComplete.bind(this), 10);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Ajax.PeriodicalUpdater = Class.create();
|
||||
Ajax.PeriodicalUpdater.prototype = Object.extend(new Ajax.Base(), {
|
||||
initialize: function(container, url, options) {
|
||||
this.setOptions(options);
|
||||
this.onComplete = this.options.onComplete;
|
||||
|
||||
this.frequency = (this.options.frequency || 2);
|
||||
this.decay = (this.options.decay || 1);
|
||||
|
||||
this.updater = {};
|
||||
this.container = container;
|
||||
this.url = url;
|
||||
|
||||
this.start();
|
||||
},
|
||||
|
||||
start: function() {
|
||||
this.options.onComplete = this.updateComplete.bind(this);
|
||||
this.onTimerEvent();
|
||||
},
|
||||
|
||||
stop: function() {
|
||||
this.updater.options.onComplete = undefined;
|
||||
clearTimeout(this.timer);
|
||||
(this.onComplete || Prototype.emptyFunction).apply(this, arguments);
|
||||
},
|
||||
|
||||
updateComplete: function(request) {
|
||||
if (this.options.decay) {
|
||||
this.decay = (request.responseText == this.lastText ?
|
||||
this.decay * this.options.decay : 1);
|
||||
|
||||
this.lastText = request.responseText;
|
||||
}
|
||||
this.timer = setTimeout(this.onTimerEvent.bind(this),
|
||||
this.decay * this.frequency * 1000);
|
||||
},
|
||||
|
||||
onTimerEvent: function() {
|
||||
this.updater = new Ajax.Updater(this.container, this.url, this.options);
|
||||
}
|
||||
});
|
||||
function $(element) {
|
||||
if (arguments.length > 1) {
|
||||
for (var i = 0, elements = [], length = arguments.length; i < length; i++)
|
||||
elements.push($(arguments[i]));
|
||||
return elements;
|
||||
}
|
||||
if (typeof element == 'string')
|
||||
element = document.getElementById(element);
|
||||
return Element.extend(element);
|
||||
}
|
||||
|
||||
if (Prototype.BrowserFeatures.XPath) {
|
||||
document._getElementsByXPath = function(expression, parentElement) {
|
||||
var results = [];
|
||||
var query = document.evaluate(expression, $(parentElement) || document,
|
||||
null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
|
||||
for (var i = 0, length = query.snapshotLength; i < length; i++)
|
||||
results.push(query.snapshotItem(i));
|
||||
return results;
|
||||
};
|
||||
|
||||
document.getElementsByClassName = function(className, parentElement) {
|
||||
var q = ".//*[contains(concat(' ', @class, ' '), ' " + className + " ')]";
|
||||
return document._getElementsByXPath(q, parentElement);
|
||||
}
|
||||
|
||||
} else document.getElementsByClassName = function(className, parentElement) {
|
||||
var children = ($(parentElement) || document.body).getElementsByTagName('*');
|
||||
var elements = [], child;
|
||||
for (var i = 0, length = children.length; i < length; i++) {
|
||||
child = children[i];
|
||||
if (Element.hasClassName(child, className))
|
||||
elements.push(Element.extend(child));
|
||||
}
|
||||
return elements;
|
||||
};
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
if (!window.Element) var Element = {};
|
||||
|
||||
Element.extend = function(element) {
|
||||
var F = Prototype.BrowserFeatures;
|
||||
if (!element || !element.tagName || element.nodeType == 3 ||
|
||||
element._extended || F.SpecificElementExtensions || element == window)
|
||||
return element;
|
||||
|
||||
var methods = {}, tagName = element.tagName, cache = Element.extend.cache,
|
||||
T = Element.Methods.ByTag;
|
||||
|
||||
// extend methods for all tags (Safari doesn't need this)
|
||||
if (!F.ElementExtensions) {
|
||||
Object.extend(methods, Element.Methods),
|
||||
Object.extend(methods, Element.Methods.Simulated);
|
||||
}
|
||||
|
||||
// extend methods for specific tags
|
||||
if (T[tagName]) Object.extend(methods, T[tagName]);
|
||||
|
||||
for (var property in methods) {
|
||||
var value = methods[property];
|
||||
if (typeof value == 'function' && !(property in element))
|
||||
element[property] = cache.findOrStore(value);
|
||||
}
|
||||
|
||||
element._extended = Prototype.emptyFunction;
|
||||
return element;
|
||||
};
|
||||
|
||||
Element.extend.cache = {
|
||||
findOrStore: function(value) {
|
||||
return this[value] = this[value] || function() {
|
||||
return value.apply(null, [this].concat($A(arguments)));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Element.Methods = {
|
||||
visible: function(element) {
|
||||
return $(element).style.display != 'none';
|
||||
},
|
||||
|
||||
toggle: function(element) {
|
||||
element = $(element);
|
||||
Element[Element.visible(element) ? 'hide' : 'show'](element);
|
||||
return element;
|
||||
},
|
||||
|
||||
hide: function(element) {
|
||||
$(element).style.display = 'none';
|
||||
return element;
|
||||
},
|
||||
|
||||
show: function(element) {
|
||||
$(element).style.display = '';
|
||||
return element;
|
||||
},
|
||||
|
||||
remove: function(element) {
|
||||
element = $(element);
|
||||
element.parentNode.removeChild(element);
|
||||
return element;
|
||||
},
|
||||
|
||||
update: function(element, html) {
|
||||
html = typeof html == 'undefined' ? '' : html.toString();
|
||||
$(element).innerHTML = html.stripScripts();
|
||||
setTimeout(function() {html.evalScripts()}, 10);
|
||||
return element;
|
||||
},
|
||||
|
||||
replace: function(element, html) {
|
||||
element = $(element);
|
||||
html = typeof html == 'undefined' ? '' : html.toString();
|
||||
if (element.outerHTML) {
|
||||
element.outerHTML = html.stripScripts();
|
||||
} else {
|
||||
var range = element.ownerDocument.createRange();
|
||||
range.selectNodeContents(element);
|
||||
element.parentNode.replaceChild(
|
||||
range.createContextualFragment(html.stripScripts()), element);
|
||||
}
|
||||
setTimeout(function() {html.evalScripts()}, 10);
|
||||
return element;
|
||||
},
|
||||
|
||||
inspect: function(element) {
|
||||
element = $(element);
|
||||
var result = '<' + element.tagName.toLowerCase();
|
||||
$H({'id': 'id', 'className': 'class'}).each(function(pair) {
|
||||
var property = pair.first(), attribute = pair.last();
|
||||
var value = (element[property] || '').toString();
|
||||
if (value) result += ' ' + attribute + '=' + value.inspect(true);
|
||||
});
|
||||
return result + '>';
|
||||
},
|
||||
|
||||
recursivelyCollect: function(element, property) {
|
||||
element = $(element);
|
||||
var elements = [];
|
||||
while (element = element[property])
|
||||
if (element.nodeType == 1)
|
||||
elements.push(Element.extend(element));
|
||||
return elements;
|
||||
},
|
||||
|
||||
ancestors: function(element) {
|
||||
return $(element).recursivelyCollect('parentNode');
|
||||
},
|
||||
|
||||
descendants: function(element) {
|
||||
return $A($(element).getElementsByTagName('*')).each(Element.extend);
|
||||
},
|
||||
|
||||
firstDescendant: function(element) {
|
||||
element = $(element).firstChild;
|
||||
while (element && element.nodeType != 1) element = element.nextSibling;
|
||||
return $(element);
|
||||
},
|
||||
|
||||
immediateDescendants: function(element) {
|
||||
if (!(element = $(element).firstChild)) return [];
|
||||
while (element && element.nodeType != 1) element = element.nextSibling;
|
||||
if (element) return [element].concat($(element).nextSiblings());
|
||||
return [];
|
||||
},
|
||||
|
||||
previousSiblings: function(element) {
|
||||
return $(element).recursivelyCollect('previousSibling');
|
||||
},
|
||||
|
||||
nextSiblings: function(element) {
|
||||
return $(element).recursivelyCollect('nextSibling');
|
||||
},
|
||||
|
||||
siblings: function(element) {
|
||||
element = $(element);
|
||||
return element.previousSiblings().reverse().concat(element.nextSiblings());
|
||||
},
|
||||
|
||||
match: function(element, selector) {
|
||||
if (typeof selector == 'string')
|
||||
selector = new Selector(selector);
|
||||
return selector.match($(element));
|
||||
},
|
||||
|
||||
up: function(element, expression, index) {
|
||||
element = $(element);
|
||||
if (arguments.length == 1) return $(element.parentNode);
|
||||
var ancestors = element.ancestors();
|
||||
return expression ? Selector.findElement(ancestors, expression, index) :
|
||||
ancestors[index || 0];
|
||||
},
|
||||
|
||||
down: function(element, expression, index) {
|
||||
element = $(element);
|
||||
if (arguments.length == 1) return element.firstDescendant();
|
||||
var descendants = element.descendants();
|
||||
return expression ? Selector.findElement(descendants, expression, index) :
|
||||
descendants[index || 0];
|
||||
},
|
||||
|
||||
previous: function(element, expression, index) {
|
||||
element = $(element);
|
||||
if (arguments.length == 1) return $(Selector.handlers.previousElementSibling(element));
|
||||
var previousSiblings = element.previousSiblings();
|
||||
return expression ? Selector.findElement(previousSiblings, expression, index) :
|
||||
previousSiblings[index || 0];
|
||||
},
|
||||
|
||||
next: function(element, expression, index) {
|
||||
element = $(element);
|
||||
if (arguments.length == 1) return $(Selector.handlers.nextElementSibling(element));
|
||||
var nextSiblings = element.nextSiblings();
|
||||
return expression ? Selector.findElement(nextSiblings, expression, index) :
|
||||
nextSiblings[index || 0];
|
||||
},
|
||||
|
||||
getElementsBySelector: function() {
|
||||
var args = $A(arguments), element = $(args.shift());
|
||||
return Selector.findChildElements(element, args);
|
||||
},
|
||||
|
||||
getElementsByClassName: function(element, className) {
|
||||
return document.getElementsByClassName(className, element);
|
||||
},
|
||||
|
||||
readAttribute: function(element, name) {
|
||||
element = $(element);
|
||||
if (Prototype.Browser.IE) {
|
||||
if (!element.attributes) return null;
|
||||
var t = Element._attributeTranslations;
|
||||
if (t.values[name]) return t.values[name](element, name);
|
||||
if (t.names[name]) name = t.names[name];
|
||||
var attribute = element.attributes[name];
|
||||
return attribute ? attribute.nodeValue : null;
|
||||
}
|
||||
return element.getAttribute(name);
|
||||
},
|
||||
|
||||
getHeight: function(element) {
|
||||
return $(element).getDimensions().height;
|
||||
},
|
||||
|
||||
getWidth: function(element) {
|
||||
return $(element).getDimensions().width;
|
||||
},
|
||||
|
||||
classNames: function(element) {
|
||||
return new Element.ClassNames(element);
|
||||
},
|
||||
|
||||
hasClassName: function(element, className) {
|
||||
if (!(element = $(element))) return;
|
||||
var elementClassName = element.className;
|
||||
if (elementClassName.length == 0) return false;
|
||||
if (elementClassName == className ||
|
||||
elementClassName.match(new RegExp("(^|\\s)" + className + "(\\s|$)")))
|
||||
return true;
|
||||
return false;
|
||||
},
|
||||
|
||||
addClassName: function(element, className) {
|
||||
if (!(element = $(element))) return;
|
||||
Element.classNames(element).add(className);
|
||||
return element;
|
||||
},
|
||||
|
||||
removeClassName: function(element, className) {
|
||||
if (!(element = $(element))) return;
|
||||
Element.classNames(element).remove(className);
|
||||
return element;
|
||||
},
|
||||
|
||||
toggleClassName: function(element, className) {
|
||||
if (!(element = $(element))) return;
|
||||
Element.classNames(element)[element.hasClassName(className) ? 'remove' : 'add'](className);
|
||||
return element;
|
||||
},
|
||||
|
||||
observe: function() {
|
||||
Event.observe.apply(Event, arguments);
|
||||
return $A(arguments).first();
|
||||
},
|
||||
|
||||
stopObserving: function() {
|
||||
Event.stopObserving.apply(Event, arguments);
|
||||
return $A(arguments).first();
|
||||
},
|
||||
|
||||
// removes whitespace-only text node children
|
||||
cleanWhitespace: function(element) {
|
||||
element = $(element);
|
||||
var node = element.firstChild;
|
||||
while (node) {
|
||||
var nextNode = node.nextSibling;
|
||||
if (node.nodeType == 3 && !/\S/.test(node.nodeValue))
|
||||
element.removeChild(node);
|
||||
node = nextNode;
|
||||
}
|
||||
return element;
|
||||
},
|
||||
|
||||
empty: function(element) {
|
||||
return $(element).innerHTML.blank();
|
||||
},
|
||||
|
||||
descendantOf: function(element, ancestor) {
|
||||
element = $(element), ancestor = $(ancestor);
|
||||
while (element = element.parentNode)
|
||||
if (element == ancestor) return true;
|
||||
return false;
|
||||
},
|
||||
|
||||
scrollTo: function(element) {
|
||||
element = $(element);
|
||||
var pos = Position.cumulativeOffset(element);
|
||||
window.scrollTo(pos[0], pos[1]);
|
||||
return element;
|
||||
},
|
||||
|
||||
getStyle: function(element, style) {
|
||||
element = $(element);
|
||||
style = style == 'float' ? 'cssFloat' : style.camelize();
|
||||
var value = element.style[style];
|
||||
if (!value) {
|
||||
var css = document.defaultView.getComputedStyle(element, null);
|
||||
value = css ? css[style] : null;
|
||||
}
|
||||
if (style == 'opacity') return value ? parseFloat(value) : 1.0;
|
||||
return value == 'auto' ? null : value;
|
||||
},
|
||||
|
||||
getOpacity: function(element) {
|
||||
return $(element).getStyle('opacity');
|
||||
},
|
||||
|
||||
setStyle: function(element, styles, camelized) {
|
||||
element = $(element);
|
||||
var elementStyle = element.style;
|
||||
|
||||
for (var property in styles)
|
||||
if (property == 'opacity') element.setOpacity(styles[property])
|
||||
else
|
||||
elementStyle[(property == 'float' || property == 'cssFloat') ?
|
||||
(elementStyle.styleFloat === undefined ? 'cssFloat' : 'styleFloat') :
|
||||
(camelized ? property : property.camelize())] = styles[property];
|
||||
|
||||
return element;
|
||||
},
|
||||
|
||||
setOpacity: function(element, value) {
|
||||
element = $(element);
|
||||
element.style.opacity = (value == 1 || value === '') ? '' :
|
||||
(value < 0.00001) ? 0 : value;
|
||||
return element;
|
||||
},
|
||||
|
||||
getDimensions: function(element) {
|
||||
element = $(element);
|
||||
var display = $(element).getStyle('display');
|
||||
if (display != 'none' && display != null) // Safari bug
|
||||
return {width: element.offsetWidth, height: element.offsetHeight};
|
||||
|
||||
// All *Width and *Height properties give 0 on elements with display none,
|
||||
// so enable the element temporarily
|
||||
var els = element.style;
|
||||
var originalVisibility = els.visibility;
|
||||
var originalPosition = els.position;
|
||||
var originalDisplay = els.display;
|
||||
els.visibility = 'hidden';
|
||||
els.position = 'absolute';
|
||||
els.display = 'block';
|
||||
var originalWidth = element.clientWidth;
|
||||
var originalHeight = element.clientHeight;
|
||||
els.display = originalDisplay;
|
||||
els.position = originalPosition;
|
||||
els.visibility = originalVisibility;
|
||||
return {width: originalWidth, height: originalHeight};
|
||||
},
|
||||
|
||||
makePositioned: function(element) {
|
||||
element = $(element);
|
||||
var pos = Element.getStyle(element, 'position');
|
||||
if (pos == 'static' || !pos) {
|
||||
element._madePositioned = true;
|
||||
element.style.position = 'relative';
|
||||
// Opera returns the offset relative to the positioning context, when an
|
||||
// element is position relative but top and left have not been defined
|
||||
if (window.opera) {
|
||||
element.style.top = 0;
|
||||
element.style.left = 0;
|
||||
}
|
||||
}
|
||||
return element;
|
||||
},
|
||||
|
||||
undoPositioned: function(element) {
|
||||
element = $(element);
|
||||
if (element._madePositioned) {
|
||||
element._madePositioned = undefined;
|
||||
element.style.position =
|
||||
element.style.top =
|
||||
element.style.left =
|
||||
element.style.bottom =
|
||||
element.style.right = '';
|
||||
}
|
||||
return element;
|
||||
},
|
||||
|
||||
makeClipping: function(element) {
|
||||
element = $(element);
|
||||
if (element._overflow) return element;
|
||||
element._overflow = element.style.overflow || 'auto';
|
||||
if ((Element.getStyle(element, 'overflow') || 'visible') != 'hidden')
|
||||
element.style.overflow = 'hidden';
|
||||
return element;
|
||||
},
|
||||
|
||||
undoClipping: function(element) {
|
||||
element = $(element);
|
||||
if (!element._overflow) return element;
|
||||
element.style.overflow = element._overflow == 'auto' ? '' : element._overflow;
|
||||
element._overflow = null;
|
||||
return element;
|
||||
}
|
||||
};
|
||||
|
||||
Object.extend(Element.Methods, {
|
||||
childOf: Element.Methods.descendantOf,
|
||||
childElements: Element.Methods.immediateDescendants
|
||||
});
|
||||
|
||||
if (Prototype.Browser.Opera) {
|
||||
Element.Methods._getStyle = Element.Methods.getStyle;
|
||||
Element.Methods.getStyle = function(element, style) {
|
||||
switch(style) {
|
||||
case 'left':
|
||||
case 'top':
|
||||
case 'right':
|
||||
case 'bottom':
|
||||
if (Element._getStyle(element, 'position') == 'static') return null;
|
||||
default: return Element._getStyle(element, style);
|
||||
}
|
||||
};
|
||||
}
|
||||
else if (Prototype.Browser.IE) {
|
||||
Element.Methods.getStyle = function(element, style) {
|
||||
element = $(element);
|
||||
style = (style == 'float' || style == 'cssFloat') ? 'styleFloat' : style.camelize();
|
||||
var value = element.style[style];
|
||||
if (!value && element.currentStyle) value = element.currentStyle[style];
|
||||
|
||||
if (style == 'opacity') {
|
||||
if (value = (element.getStyle('filter') || '').match(/alpha\(opacity=(.*)\)/))
|
||||
if (value[1]) return parseFloat(value[1]) / 100;
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
if (value == 'auto') {
|
||||
if ((style == 'width' || style == 'height') && (element.getStyle('display') != 'none'))
|
||||
return element['offset'+style.capitalize()] + 'px';
|
||||
return null;
|
||||
}
|
||||
return value;
|
||||
};
|
||||
|
||||
Element.Methods.setOpacity = function(element, value) {
|
||||
element = $(element);
|
||||
var filter = element.getStyle('filter'), style = element.style;
|
||||
if (value == 1 || value === '') {
|
||||
style.filter = filter.replace(/alpha\([^\)]*\)/gi,'');
|
||||
return element;
|
||||
} else if (value < 0.00001) value = 0;
|
||||
style.filter = filter.replace(/alpha\([^\)]*\)/gi, '') +
|
||||
'alpha(opacity=' + (value * 100) + ')';
|
||||
return element;
|
||||
};
|
||||
|
||||
// IE is missing .innerHTML support for TABLE-related elements
|
||||
Element.Methods.update = function(element, html) {
|
||||
element = $(element);
|
||||
html = typeof html == 'undefined' ? '' : html.toString();
|
||||
var tagName = element.tagName.toUpperCase();
|
||||
if (['THEAD','TBODY','TR','TD'].include(tagName)) {
|
||||
var div = document.createElement('div');
|
||||
switch (tagName) {
|
||||
case 'THEAD':
|
||||
case 'TBODY':
|
||||
div.innerHTML = '<table><tbody>' + html.stripScripts() + '</tbody></table>';
|
||||
depth = 2;
|
||||
break;
|
||||
case 'TR':
|
||||
div.innerHTML = '<table><tbody><tr>' + html.stripScripts() + '</tr></tbody></table>';
|
||||
depth = 3;
|
||||
break;
|
||||
case 'TD':
|
||||
div.innerHTML = '<table><tbody><tr><td>' + html.stripScripts() + '</td></tr></tbody></table>';
|
||||
depth = 4;
|
||||
}
|
||||
$A(element.childNodes).each(function(node) { element.removeChild(node) });
|
||||
depth.times(function() { div = div.firstChild });
|
||||
$A(div.childNodes).each(function(node) { element.appendChild(node) });
|
||||
} else {
|
||||
element.innerHTML = html.stripScripts();
|
||||
}
|
||||
setTimeout(function() { html.evalScripts() }, 10);
|
||||
return element;
|
||||
}
|
||||
}
|
||||
else if (Prototype.Browser.Gecko) {
|
||||
Element.Methods.setOpacity = function(element, value) {
|
||||
element = $(element);
|
||||
element.style.opacity = (value == 1) ? 0.999999 :
|
||||
(value === '') ? '' : (value < 0.00001) ? 0 : value;
|
||||
return element;
|
||||
};
|
||||
}
|
||||
|
||||
Element._attributeTranslations = {
|
||||
names: {
|
||||
colspan: "colSpan",
|
||||
rowspan: "rowSpan",
|
||||
valign: "vAlign",
|
||||
datetime: "dateTime",
|
||||
accesskey: "accessKey",
|
||||
tabindex: "tabIndex",
|
||||
enctype: "encType",
|
||||
maxlength: "maxLength",
|
||||
readonly: "readOnly",
|
||||
longdesc: "longDesc"
|
||||
},
|
||||
values: {
|
||||
_getAttr: function(element, attribute) {
|
||||
return element.getAttribute(attribute, 2);
|
||||
},
|
||||
_flag: function(element, attribute) {
|
||||
return $(element).hasAttribute(attribute) ? attribute : null;
|
||||
},
|
||||
style: function(element) {
|
||||
return element.style.cssText.toLowerCase();
|
||||
},
|
||||
title: function(element) {
|
||||
var node = element.getAttributeNode('title');
|
||||
return node.specified ? node.nodeValue : null;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
(function() {
|
||||
Object.extend(this, {
|
||||
href: this._getAttr,
|
||||
src: this._getAttr,
|
||||
type: this._getAttr,
|
||||
disabled: this._flag,
|
||||
checked: this._flag,
|
||||
readonly: this._flag,
|
||||
multiple: this._flag
|
||||
});
|
||||
}).call(Element._attributeTranslations.values);
|
||||
|
||||
Element.Methods.Simulated = {
|
||||
hasAttribute: function(element, attribute) {
|
||||
var t = Element._attributeTranslations, node;
|
||||
attribute = t.names[attribute] || attribute;
|
||||
node = $(element).getAttributeNode(attribute);
|
||||
return node && node.specified;
|
||||
}
|
||||
};
|
||||
|
||||
Element.Methods.ByTag = {};
|
||||
|
||||
Object.extend(Element, Element.Methods);
|
||||
|
||||
if (!Prototype.BrowserFeatures.ElementExtensions &&
|
||||
document.createElement('div').__proto__) {
|
||||
window.HTMLElement = {};
|
||||
window.HTMLElement.prototype = document.createElement('div').__proto__;
|
||||
Prototype.BrowserFeatures.ElementExtensions = true;
|
||||
}
|
||||
|
||||
Element.hasAttribute = function(element, attribute) {
|
||||
if (element.hasAttribute) return element.hasAttribute(attribute);
|
||||
return Element.Methods.Simulated.hasAttribute(element, attribute);
|
||||
};
|
||||
|
||||
Element.addMethods = function(methods) {
|
||||
var F = Prototype.BrowserFeatures, T = Element.Methods.ByTag;
|
||||
|
||||
if (!methods) {
|
||||
Object.extend(Form, Form.Methods);
|
||||
Object.extend(Form.Element, Form.Element.Methods);
|
||||
Object.extend(Element.Methods.ByTag, {
|
||||
"FORM": Object.clone(Form.Methods),
|
||||
"INPUT": Object.clone(Form.Element.Methods),
|
||||
"SELECT": Object.clone(Form.Element.Methods),
|
||||
"TEXTAREA": Object.clone(Form.Element.Methods)
|
||||
});
|
||||
}
|
||||
|
||||
if (arguments.length == 2) {
|
||||
var tagName = methods;
|
||||
methods = arguments[1];
|
||||
}
|
||||
|
||||
if (!tagName) Object.extend(Element.Methods, methods || {});
|
||||
else {
|
||||
if (tagName.constructor == Array) tagName.each(extend);
|
||||
else extend(tagName);
|
||||
}
|
||||
|
||||
function extend(tagName) {
|
||||
tagName = tagName.toUpperCase();
|
||||
if (!Element.Methods.ByTag[tagName])
|
||||
Element.Methods.ByTag[tagName] = {};
|
||||
Object.extend(Element.Methods.ByTag[tagName], methods);
|
||||
}
|
||||
|
||||
function copy(methods, destination, onlyIfAbsent) {
|
||||
onlyIfAbsent = onlyIfAbsent || false;
|
||||
var cache = Element.extend.cache;
|
||||
for (var property in methods) {
|
||||
var value = methods[property];
|
||||
if (!onlyIfAbsent || !(property in destination))
|
||||
destination[property] = cache.findOrStore(value);
|
||||
}
|
||||
}
|
||||
|
||||
function findDOMClass(tagName) {
|
||||
var klass;
|
||||
var trans = {
|
||||
"OPTGROUP": "OptGroup", "TEXTAREA": "TextArea", "P": "Paragraph",
|
||||
"FIELDSET": "FieldSet", "UL": "UList", "OL": "OList", "DL": "DList",
|
||||
"DIR": "Directory", "H1": "Heading", "H2": "Heading", "H3": "Heading",
|
||||
"H4": "Heading", "H5": "Heading", "H6": "Heading", "Q": "Quote",
|
||||
"INS": "Mod", "DEL": "Mod", "A": "Anchor", "IMG": "Image", "CAPTION":
|
||||
"TableCaption", "COL": "TableCol", "COLGROUP": "TableCol", "THEAD":
|
||||
"TableSection", "TFOOT": "TableSection", "TBODY": "TableSection", "TR":
|
||||
"TableRow", "TH": "TableCell", "TD": "TableCell", "FRAMESET":
|
||||
"FrameSet", "IFRAME": "IFrame"
|
||||
};
|
||||
if (trans[tagName]) klass = 'HTML' + trans[tagName] + 'Element';
|
||||
if (window[klass]) return window[klass];
|
||||
klass = 'HTML' + tagName + 'Element';
|
||||
if (window[klass]) return window[klass];
|
||||
klass = 'HTML' + tagName.capitalize() + 'Element';
|
||||
if (window[klass]) return window[klass];
|
||||
|
||||
window[klass] = {};
|
||||
window[klass].prototype = document.createElement(tagName).__proto__;
|
||||
return window[klass];
|
||||
}
|
||||
|
||||
if (F.ElementExtensions) {
|
||||
copy(Element.Methods, HTMLElement.prototype);
|
||||
copy(Element.Methods.Simulated, HTMLElement.prototype, true);
|
||||
}
|
||||
|
||||
if (F.SpecificElementExtensions) {
|
||||
for (var tag in Element.Methods.ByTag) {
|
||||
var klass = findDOMClass(tag);
|
||||
if (typeof klass == "undefined") continue;
|
||||
copy(T[tag], klass.prototype);
|
||||
}
|
||||
}
|
||||
|
||||
Object.extend(Element, Element.Methods);
|
||||
delete Element.ByTag;
|
||||
};
|
||||
|
||||
var Toggle = { display: Element.toggle };
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
Abstract.Insertion = function(adjacency) {
|
||||
this.adjacency = adjacency;
|
||||
}
|
||||
|
||||
Abstract.Insertion.prototype = {
|
||||
initialize: function(element, content) {
|
||||
this.element = $(element);
|
||||
this.content = content.stripScripts();
|
||||
|
||||
if (this.adjacency && this.element.insertAdjacentHTML) {
|
||||
try {
|
||||
this.element.insertAdjacentHTML(this.adjacency, this.content);
|
||||
} catch (e) {
|
||||
var tagName = this.element.tagName.toUpperCase();
|
||||
if (['TBODY', 'TR'].include(tagName)) {
|
||||
this.insertContent(this.contentFromAnonymousTable());
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.range = this.element.ownerDocument.createRange();
|
||||
if (this.initializeRange) this.initializeRange();
|
||||
this.insertContent([this.range.createContextualFragment(this.content)]);
|
||||
}
|
||||
|
||||
setTimeout(function() {content.evalScripts()}, 10);
|
||||
},
|
||||
|
||||
contentFromAnonymousTable: function() {
|
||||
var div = document.createElement('div');
|
||||
div.innerHTML = '<table><tbody>' + this.content + '</tbody></table>';
|
||||
return $A(div.childNodes[0].childNodes[0].childNodes);
|
||||
}
|
||||
}
|
||||
|
||||
var Insertion = new Object();
|
||||
|
||||
Insertion.Before = Class.create();
|
||||
Insertion.Before.prototype = Object.extend(new Abstract.Insertion('beforeBegin'), {
|
||||
initializeRange: function() {
|
||||
this.range.setStartBefore(this.element);
|
||||
},
|
||||
|
||||
insertContent: function(fragments) {
|
||||
fragments.each((function(fragment) {
|
||||
this.element.parentNode.insertBefore(fragment, this.element);
|
||||
}).bind(this));
|
||||
}
|
||||
});
|
||||
|
||||
Insertion.Top = Class.create();
|
||||
Insertion.Top.prototype = Object.extend(new Abstract.Insertion('afterBegin'), {
|
||||
initializeRange: function() {
|
||||
this.range.selectNodeContents(this.element);
|
||||
this.range.collapse(true);
|
||||
},
|
||||
|
||||
insertContent: function(fragments) {
|
||||
fragments.reverse(false).each((function(fragment) {
|
||||
this.element.insertBefore(fragment, this.element.firstChild);
|
||||
}).bind(this));
|
||||
}
|
||||
});
|
||||
|
||||
Insertion.Bottom = Class.create();
|
||||
Insertion.Bottom.prototype = Object.extend(new Abstract.Insertion('beforeEnd'), {
|
||||
initializeRange: function() {
|
||||
this.range.selectNodeContents(this.element);
|
||||
this.range.collapse(this.element);
|
||||
},
|
||||
|
||||
insertContent: function(fragments) {
|
||||
fragments.each((function(fragment) {
|
||||
this.element.appendChild(fragment);
|
||||
}).bind(this));
|
||||
}
|
||||
});
|
||||
|
||||
Insertion.After = Class.create();
|
||||
Insertion.After.prototype = Object.extend(new Abstract.Insertion('afterEnd'), {
|
||||
initializeRange: function() {
|
||||
this.range.setStartAfter(this.element);
|
||||
},
|
||||
|
||||
insertContent: function(fragments) {
|
||||
fragments.each((function(fragment) {
|
||||
this.element.parentNode.insertBefore(fragment,
|
||||
this.element.nextSibling);
|
||||
}).bind(this));
|
||||
}
|
||||
});
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
Element.ClassNames = Class.create();
|
||||
Element.ClassNames.prototype = {
|
||||
initialize: function(element) {
|
||||
this.element = $(element);
|
||||
},
|
||||
|
||||
_each: function(iterator) {
|
||||
this.element.className.split(/\s+/).select(function(name) {
|
||||
return name.length > 0;
|
||||
})._each(iterator);
|
||||
},
|
||||
|
||||
set: function(className) {
|
||||
this.element.className = className;
|
||||
},
|
||||
|
||||
add: function(classNameToAdd) {
|
||||
if (this.include(classNameToAdd)) return;
|
||||
this.set($A(this).concat(classNameToAdd).join(' '));
|
||||
},
|
||||
|
||||
remove: function(classNameToRemove) {
|
||||
if (!this.include(classNameToRemove)) return;
|
||||
this.set($A(this).without(classNameToRemove).join(' '));
|
||||
},
|
||||
|
||||
toString: function() {
|
||||
return $A(this).join(' ');
|
||||
}
|
||||
};
|
||||
|
||||
Object.extend(Element.ClassNames.prototype, Enumerable);
|
||||
/* Portions of the Selector class are derived from Jack Slocum’s DomQuery,
|
||||
* part of YUI-Ext version 0.40, distributed under the terms of an MIT-style
|
||||
* license. Please see http://www.yui-ext.com/ for more information. */
|
||||
|
||||
var Selector = Class.create();
|
||||
|
||||
Selector.prototype = {
|
||||
initialize: function(expression) {
|
||||
this.expression = expression.strip();
|
||||
this.compileMatcher();
|
||||
},
|
||||
|
||||
compileMatcher: function() {
|
||||
// Selectors with namespaced attributes can't use the XPath version
|
||||
if (Prototype.BrowserFeatures.XPath && !(/\[[\w-]*?:/).test(this.expression))
|
||||
return this.compileXPathMatcher();
|
||||
|
||||
var e = this.expression, ps = Selector.patterns, h = Selector.handlers,
|
||||
c = Selector.criteria, le, p, m;
|
||||
|
||||
if (Selector._cache[e]) {
|
||||
this.matcher = Selector._cache[e]; return;
|
||||
}
|
||||
this.matcher = ["this.matcher = function(root) {",
|
||||
"var r = root, h = Selector.handlers, c = false, n;"];
|
||||
|
||||
while (e && le != e && (/\S/).test(e)) {
|
||||
le = e;
|
||||
for (var i in ps) {
|
||||
p = ps[i];
|
||||
if (m = e.match(p)) {
|
||||
this.matcher.push(typeof c[i] == 'function' ? c[i](m) :
|
||||
new Template(c[i]).evaluate(m));
|
||||
e = e.replace(m[0], '');
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.matcher.push("return h.unique(n);\n}");
|
||||
eval(this.matcher.join('\n'));
|
||||
Selector._cache[this.expression] = this.matcher;
|
||||
},
|
||||
|
||||
compileXPathMatcher: function() {
|
||||
var e = this.expression, ps = Selector.patterns,
|
||||
x = Selector.xpath, le, m;
|
||||
|
||||
if (Selector._cache[e]) {
|
||||
this.xpath = Selector._cache[e]; return;
|
||||
}
|
||||
|
||||
this.matcher = ['.//*'];
|
||||
while (e && le != e && (/\S/).test(e)) {
|
||||
le = e;
|
||||
for (var i in ps) {
|
||||
if (m = e.match(ps[i])) {
|
||||
this.matcher.push(typeof x[i] == 'function' ? x[i](m) :
|
||||
new Template(x[i]).evaluate(m));
|
||||
e = e.replace(m[0], '');
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.xpath = this.matcher.join('');
|
||||
Selector._cache[this.expression] = this.xpath;
|
||||
},
|
||||
|
||||
findElements: function(root) {
|
||||
root = root || document;
|
||||
if (this.xpath) return document._getElementsByXPath(this.xpath, root);
|
||||
return this.matcher(root);
|
||||
},
|
||||
|
||||
match: function(element) {
|
||||
return this.findElements(document).include(element);
|
||||
},
|
||||
|
||||
toString: function() {
|
||||
return this.expression;
|
||||
},
|
||||
|
||||
inspect: function() {
|
||||
return "#<Selector:" + this.expression.inspect() + ">";
|
||||
}
|
||||
};
|
||||
|
||||
Object.extend(Selector, {
|
||||
_cache: {},
|
||||
|
||||
xpath: {
|
||||
descendant: "//*",
|
||||
child: "/*",
|
||||
adjacent: "/following-sibling::*[1]",
|
||||
laterSibling: '/following-sibling::*',
|
||||
tagName: function(m) {
|
||||
if (m[1] == '*') return '';
|
||||
return "[local-name()='" + m[1].toLowerCase() +
|
||||
"' or local-name()='" + m[1].toUpperCase() + "']";
|
||||
},
|
||||
className: "[contains(concat(' ', @class, ' '), ' #{1} ')]",
|
||||
id: "[@id='#{1}']",
|
||||
attrPresence: "[@#{1}]",
|
||||
attr: function(m) {
|
||||
m[3] = m[5] || m[6];
|
||||
return new Template(Selector.xpath.operators[m[2]]).evaluate(m);
|
||||
},
|
||||
pseudo: function(m) {
|
||||
var h = Selector.xpath.pseudos[m[1]];
|
||||
if (!h) return '';
|
||||
if (typeof h === 'function') return h(m);
|
||||
return new Template(Selector.xpath.pseudos[m[1]]).evaluate(m);
|
||||
},
|
||||
operators: {
|
||||
'=': "[@#{1}='#{3}']",
|
||||
'!=': "[@#{1}!='#{3}']",
|
||||
'^=': "[starts-with(@#{1}, '#{3}')]",
|
||||
'$=': "[substring(@#{1}, (string-length(@#{1}) - string-length('#{3}') + 1))='#{3}']",
|
||||
'*=': "[contains(@#{1}, '#{3}')]",
|
||||
'~=': "[contains(concat(' ', @#{1}, ' '), ' #{3} ')]",
|
||||
'|=': "[contains(concat('-', @#{1}, '-'), '-#{3}-')]"
|
||||
},
|
||||
pseudos: {
|
||||
'first-child': '[not(preceding-sibling::*)]',
|
||||
'last-child': '[not(following-sibling::*)]',
|
||||
'only-child': '[not(preceding-sibling::* or following-sibling::*)]',
|
||||
'empty': "[count(*) = 0 and (count(text()) = 0 or translate(text(), ' \t\r\n', '') = '')]",
|
||||
'checked': "[@checked]",
|
||||
'disabled': "[@disabled]",
|
||||
'enabled': "[not(@disabled)]",
|
||||
'not': function(m) {
|
||||
var e = m[6], p = Selector.patterns,
|
||||
x = Selector.xpath, le, m, v;
|
||||
|
||||
var exclusion = [];
|
||||
while (e && le != e && (/\S/).test(e)) {
|
||||
le = e;
|
||||
for (var i in p) {
|
||||
if (m = e.match(p[i])) {
|
||||
v = typeof x[i] == 'function' ? x[i](m) : new Template(x[i]).evaluate(m);
|
||||
exclusion.push("(" + v.substring(1, v.length - 1) + ")");
|
||||
e = e.replace(m[0], '');
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return "[not(" + exclusion.join(" and ") + ")]";
|
||||
},
|
||||
'nth-child': function(m) {
|
||||
return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ", m);
|
||||
},
|
||||
'nth-last-child': function(m) {
|
||||
return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ", m);
|
||||
},
|
||||
'nth-of-type': function(m) {
|
||||
return Selector.xpath.pseudos.nth("position() ", m);
|
||||
},
|
||||
'nth-last-of-type': function(m) {
|
||||
return Selector.xpath.pseudos.nth("(last() + 1 - position()) ", m);
|
||||
},
|
||||
'first-of-type': function(m) {
|
||||
m[6] = "1"; return Selector.xpath.pseudos['nth-of-type'](m);
|
||||
},
|
||||
'last-of-type': function(m) {
|
||||
m[6] = "1"; return Selector.xpath.pseudos['nth-last-of-type'](m);
|
||||
},
|
||||
'only-of-type': function(m) {
|
||||
var p = Selector.xpath.pseudos; return p['first-of-type'](m) + p['last-of-type'](m);
|
||||
},
|
||||
nth: function(fragment, m) {
|
||||
var mm, formula = m[6], predicate;
|
||||
if (formula == 'even') formula = '2n+0';
|
||||
if (formula == 'odd') formula = '2n+1';
|
||||
if (mm = formula.match(/^(\d+)$/)) // digit only
|
||||
return '[' + fragment + "= " + mm[1] + ']';
|
||||
if (mm = formula.match(/^(-?\d*)?n(([+-])(\d+))?/)) { // an+b
|
||||
if (mm[1] == "-") mm[1] = -1;
|
||||
var a = mm[1] ? Number(mm[1]) : 1;
|
||||
var b = mm[2] ? Number(mm[2]) : 0;
|
||||
predicate = "[((#{fragment} - #{b}) mod #{a} = 0) and " +
|
||||
"((#{fragment} - #{b}) div #{a} >= 0)]";
|
||||
return new Template(predicate).evaluate({
|
||||
fragment: fragment, a: a, b: b });
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
criteria: {
|
||||
tagName: 'n = h.tagName(n, r, "#{1}", c); c = false;',
|
||||
className: 'n = h.className(n, r, "#{1}", c); c = false;',
|
||||
id: 'n = h.id(n, r, "#{1}", c); c = false;',
|
||||
attrPresence: 'n = h.attrPresence(n, r, "#{1}"); c = false;',
|
||||
attr: function(m) {
|
||||
m[3] = (m[5] || m[6]);
|
||||
return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}"); c = false;').evaluate(m);
|
||||
},
|
||||
pseudo: function(m) {
|
||||
if (m[6]) m[6] = m[6].replace(/"/g, '\\"');
|
||||
return new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;').evaluate(m);
|
||||
},
|
||||
descendant: 'c = "descendant";',
|
||||
child: 'c = "child";',
|
||||
adjacent: 'c = "adjacent";',
|
||||
laterSibling: 'c = "laterSibling";'
|
||||
},
|
||||
|
||||
patterns: {
|
||||
// combinators must be listed first
|
||||
// (and descendant needs to be last combinator)
|
||||
laterSibling: /^\s*~\s*/,
|
||||
child: /^\s*>\s*/,
|
||||
adjacent: /^\s*\+\s*/,
|
||||
descendant: /^\s/,
|
||||
|
||||
// selectors follow
|
||||
tagName: /^\s*(\*|[\w\-]+)(\b|$)?/,
|
||||
id: /^#([\w\-\*]+)(\b|$)/,
|
||||
className: /^\.([\w\-\*]+)(\b|$)/,
|
||||
pseudo: /^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|\s|(?=:))/,
|
||||
attrPresence: /^\[([\w]+)\]/,
|
||||
attr: /\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\]]*?)\4|([^'"][^\]]*?)))?\]/
|
||||
},
|
||||
|
||||
handlers: {
|
||||
// UTILITY FUNCTIONS
|
||||
// joins two collections
|
||||
concat: function(a, b) {
|
||||
for (var i = 0, node; node = b[i]; i++)
|
||||
a.push(node);
|
||||
return a;
|
||||
},
|
||||
|
||||
// marks an array of nodes for counting
|
||||
mark: function(nodes) {
|
||||
for (var i = 0, node; node = nodes[i]; i++)
|
||||
node._counted = true;
|
||||
return nodes;
|
||||
},
|
||||
|
||||
unmark: function(nodes) {
|
||||
for (var i = 0, node; node = nodes[i]; i++)
|
||||
node._counted = undefined;
|
||||
return nodes;
|
||||
},
|
||||
|
||||
// mark each child node with its position (for nth calls)
|
||||
// "ofType" flag indicates whether we're indexing for nth-of-type
|
||||
// rather than nth-child
|
||||
index: function(parentNode, reverse, ofType) {
|
||||
parentNode._counted = true;
|
||||
if (reverse) {
|
||||
for (var nodes = parentNode.childNodes, i = nodes.length - 1, j = 1; i >= 0; i--) {
|
||||
node = nodes[i];
|
||||
if (node.nodeType == 1 && (!ofType || node._counted)) node.nodeIndex = j++;
|
||||
}
|
||||
} else {
|
||||
for (var i = 0, j = 1, nodes = parentNode.childNodes; node = nodes[i]; i++)
|
||||
if (node.nodeType == 1 && (!ofType || node._counted)) node.nodeIndex = j++;
|
||||
}
|
||||
},
|
||||
|
||||
// filters out duplicates and extends all nodes
|
||||
unique: function(nodes) {
|
||||
if (nodes.length == 0) return nodes;
|
||||
var results = [], n;
|
||||
for (var i = 0, l = nodes.length; i < l; i++)
|
||||
if (!(n = nodes[i])._counted) {
|
||||
n._counted = true;
|
||||
results.push(Element.extend(n));
|
||||
}
|
||||
return Selector.handlers.unmark(results);
|
||||
},
|
||||
|
||||
// COMBINATOR FUNCTIONS
|
||||
descendant: function(nodes) {
|
||||
var h = Selector.handlers;
|
||||
for (var i = 0, results = [], node; node = nodes[i]; i++)
|
||||
h.concat(results, node.getElementsByTagName('*'));
|
||||
return results;
|
||||
},
|
||||
|
||||
child: function(nodes) {
|
||||
var h = Selector.handlers;
|
||||
for (var i = 0, results = [], node; node = nodes[i]; i++) {
|
||||
for (var j = 0, children = [], child; child = node.childNodes[j]; j++)
|
||||
if (child.nodeType == 1 && child.tagName != '!') results.push(child);
|
||||
}
|
||||
return results;
|
||||
},
|
||||
|
||||
adjacent: function(nodes) {
|
||||
for (var i = 0, results = [], node; node = nodes[i]; i++) {
|
||||
var next = this.nextElementSibling(node);
|
||||
if (next) results.push(next);
|
||||
}
|
||||
return results;
|
||||
},
|
||||
|
||||
laterSibling: function(nodes) {
|
||||
var h = Selector.handlers;
|
||||
for (var i = 0, results = [], node; node = nodes[i]; i++)
|
||||
h.concat(results, Element.nextSiblings(node));
|
||||
return results;
|
||||
},
|
||||
|
||||
nextElementSibling: function(node) {
|
||||
while (node = node.nextSibling)
|
||||
if (node.nodeType == 1) return node;
|
||||
return null;
|
||||
},
|
||||
|
||||
previousElementSibling: function(node) {
|
||||
while (node = node.previousSibling)
|
||||
if (node.nodeType == 1) return node;
|
||||
return null;
|
||||
},
|
||||
|
||||
// TOKEN FUNCTIONS
|
||||
tagName: function(nodes, root, tagName, combinator) {
|
||||
tagName = tagName.toUpperCase();
|
||||
var results = [], h = Selector.handlers;
|
||||
if (nodes) {
|
||||
if (combinator) {
|
||||
// fastlane for ordinary descendant combinators
|
||||
if (combinator == "descendant") {
|
||||
for (var i = 0, node; node = nodes[i]; i++)
|
||||
h.concat(results, node.getElementsByTagName(tagName));
|
||||
return results;
|
||||
} else nodes = this[combinator](nodes);
|
||||
if (tagName == "*") return nodes;
|
||||
}
|
||||
for (var i = 0, node; node = nodes[i]; i++)
|
||||
if (node.tagName.toUpperCase() == tagName) results.push(node);
|
||||
return results;
|
||||
} else return root.getElementsByTagName(tagName);
|
||||
},
|
||||
|
||||
id: function(nodes, root, id, combinator) {
|
||||
var targetNode = $(id), h = Selector.handlers;
|
||||
if (!nodes && root == document) return targetNode ? [targetNode] : [];
|
||||
if (nodes) {
|
||||
if (combinator) {
|
||||
if (combinator == 'child') {
|
||||
for (var i = 0, node; node = nodes[i]; i++)
|
||||
if (targetNode.parentNode == node) return [targetNode];
|
||||
} else if (combinator == 'descendant') {
|
||||
for (var i = 0, node; node = nodes[i]; i++)
|
||||
if (Element.descendantOf(targetNode, node)) return [targetNode];
|
||||
} else if (combinator == 'adjacent') {
|
||||
for (var i = 0, node; node = nodes[i]; i++)
|
||||
if (Selector.handlers.previousElementSibling(targetNode) == node)
|
||||
return [targetNode];
|
||||
} else nodes = h[combinator](nodes);
|
||||
}
|
||||
for (var i = 0, node; node = nodes[i]; i++)
|
||||
if (node == targetNode) return [targetNode];
|
||||
return [];
|
||||
}
|
||||
return (targetNode && Element.descendantOf(targetNode, root)) ? [targetNode] : [];
|
||||
},
|
||||
|
||||
className: function(nodes, root, className, combinator) {
|
||||
if (nodes && combinator) nodes = this[combinator](nodes);
|
||||
return Selector.handlers.byClassName(nodes, root, className);
|
||||
},
|
||||
|
||||
byClassName: function(nodes, root, className) {
|
||||
if (!nodes) nodes = Selector.handlers.descendant([root]);
|
||||
var needle = ' ' + className + ' ';
|
||||
for (var i = 0, results = [], node, nodeClassName; node = nodes[i]; i++) {
|
||||
nodeClassName = node.className;
|
||||
if (nodeClassName.length == 0) continue;
|
||||
if (nodeClassName == className || (' ' + nodeClassName + ' ').include(needle))
|
||||
results.push(node);
|
||||
}
|
||||
return results;
|
||||
},
|
||||
|
||||
attrPresence: function(nodes, root, attr) {
|
||||
var results = [];
|
||||
for (var i = 0, node; node = nodes[i]; i++)
|
||||
if (Element.hasAttribute(node, attr)) results.push(node);
|
||||
return results;
|
||||
},
|
||||
|
||||
attr: function(nodes, root, attr, value, operator) {
|
||||
if (!nodes) nodes = root.getElementsByTagName("*");
|
||||
var handler = Selector.operators[operator], results = [];
|
||||
for (var i = 0, node; node = nodes[i]; i++) {
|
||||
var nodeValue = Element.readAttribute(node, attr);
|
||||
if (nodeValue === null) continue;
|
||||
if (handler(nodeValue, value)) results.push(node);
|
||||
}
|
||||
return results;
|
||||
},
|
||||
|
||||
pseudo: function(nodes, name, value, root, combinator) {
|
||||
if (nodes && combinator) nodes = this[combinator](nodes);
|
||||
if (!nodes) nodes = root.getElementsByTagName("*");
|
||||
return Selector.pseudos[name](nodes, value, root);
|
||||
}
|
||||
},
|
||||
|
||||
pseudos: {
|
||||
'first-child': function(nodes, value, root) {
|
||||
for (var i = 0, results = [], node; node = nodes[i]; i++) {
|
||||
if (Selector.handlers.previousElementSibling(node)) continue;
|
||||
results.push(node);
|
||||
}
|
||||
return results;
|
||||
},
|
||||
'last-child': function(nodes, value, root) {
|
||||
for (var i = 0, results = [], node; node = nodes[i]; i++) {
|
||||
if (Selector.handlers.nextElementSibling(node)) continue;
|
||||
results.push(node);
|
||||
}
|
||||
return results;
|
||||
},
|
||||
'only-child': function(nodes, value, root) {
|
||||
var h = Selector.handlers;
|
||||
for (var i = 0, results = [], node; node = nodes[i]; i++)
|
||||
if (!h.previousElementSibling(node) && !h.nextElementSibling(node))
|
||||
results.push(node);
|
||||
return results;
|
||||
},
|
||||
'nth-child': function(nodes, formula, root) {
|
||||
return Selector.pseudos.nth(nodes, formula, root);
|
||||
},
|
||||
'nth-last-child': function(nodes, formula, root) {
|
||||
return Selector.pseudos.nth(nodes, formula, root, true);
|
||||
},
|
||||
'nth-of-type': function(nodes, formula, root) {
|
||||
return Selector.pseudos.nth(nodes, formula, root, false, true);
|
||||
},
|
||||
'nth-last-of-type': function(nodes, formula, root) {
|
||||
return Selector.pseudos.nth(nodes, formula, root, true, true);
|
||||
},
|
||||
'first-of-type': function(nodes, formula, root) {
|
||||
return Selector.pseudos.nth(nodes, "1", root, false, true);
|
||||
},
|
||||
'last-of-type': function(nodes, formula, root) {
|
||||
return Selector.pseudos.nth(nodes, "1", root, true, true);
|
||||
},
|
||||
'only-of-type': function(nodes, formula, root) {
|
||||
var p = Selector.pseudos;
|
||||
return p['last-of-type'](p['first-of-type'](nodes, formula, root), formula, root);
|
||||
},
|
||||
|
||||
// handles the an+b logic
|
||||
getIndices: function(a, b, total) {
|
||||
if (a == 0) return b > 0 ? [b] : [];
|
||||
return $R(1, total).inject([], function(memo, i) {
|
||||
if (0 == (i - b) % a && (i - b) / a >= 0) memo.push(i);
|
||||
return memo;
|
||||
});
|
||||
},
|
||||
|
||||
// handles nth(-last)-child, nth(-last)-of-type, and (first|last)-of-type
|
||||
nth: function(nodes, formula, root, reverse, ofType) {
|
||||
if (nodes.length == 0) return [];
|
||||
if (formula == 'even') formula = '2n+0';
|
||||
if (formula == 'odd') formula = '2n+1';
|
||||
var h = Selector.handlers, results = [], indexed = [], m;
|
||||
h.mark(nodes);
|
||||
for (var i = 0, node; node = nodes[i]; i++) {
|
||||
if (!node.parentNode._counted) {
|
||||
h.index(node.parentNode, reverse, ofType);
|
||||
indexed.push(node.parentNode);
|
||||
}
|
||||
}
|
||||
if (formula.match(/^\d+$/)) { // just a number
|
||||
formula = Number(formula);
|
||||
for (var i = 0, node; node = nodes[i]; i++)
|
||||
if (node.nodeIndex == formula) results.push(node);
|
||||
} else if (m = formula.match(/^(-?\d*)?n(([+-])(\d+))?/)) { // an+b
|
||||
if (m[1] == "-") m[1] = -1;
|
||||
var a = m[1] ? Number(m[1]) : 1;
|
||||
var b = m[2] ? Number(m[2]) : 0;
|
||||
var indices = Selector.pseudos.getIndices(a, b, nodes.length);
|
||||
for (var i = 0, node, l = indices.length; node = nodes[i]; i++) {
|
||||
for (var j = 0; j < l; j++)
|
||||
if (node.nodeIndex == indices[j]) results.push(node);
|
||||
}
|
||||
}
|
||||
h.unmark(nodes);
|
||||
h.unmark(indexed);
|
||||
return results;
|
||||
},
|
||||
|
||||
'empty': function(nodes, value, root) {
|
||||
for (var i = 0, results = [], node; node = nodes[i]; i++) {
|
||||
// IE treats comments as element nodes
|
||||
if (node.tagName == '!' || (node.firstChild && !node.innerHTML.match(/^\s*$/))) continue;
|
||||
results.push(node);
|
||||
}
|
||||
return results;
|
||||
},
|
||||
|
||||
'not': function(nodes, selector, root) {
|
||||
var h = Selector.handlers, selectorType, m;
|
||||
var exclusions = new Selector(selector).findElements(root);
|
||||
h.mark(exclusions);
|
||||
for (var i = 0, results = [], node; node = nodes[i]; i++)
|
||||
if (!node._counted) results.push(node);
|
||||
h.unmark(exclusions);
|
||||
return results;
|
||||
},
|
||||
|
||||
'enabled': function(nodes, value, root) {
|
||||
for (var i = 0, results = [], node; node = nodes[i]; i++)
|
||||
if (!node.disabled) results.push(node);
|
||||
return results;
|
||||
},
|
||||
|
||||
'disabled': function(nodes, value, root) {
|
||||
for (var i = 0, results = [], node; node = nodes[i]; i++)
|
||||
if (node.disabled) results.push(node);
|
||||
return results;
|
||||
},
|
||||
|
||||
'checked': function(nodes, value, root) {
|
||||
for (var i = 0, results = [], node; node = nodes[i]; i++)
|
||||
if (node.checked) results.push(node);
|
||||
return results;
|
||||
}
|
||||
},
|
||||
|
||||
operators: {
|
||||
'=': function(nv, v) { return nv == v; },
|
||||
'!=': function(nv, v) { return nv != v; },
|
||||
'^=': function(nv, v) { return nv.startsWith(v); },
|
||||
'$=': function(nv, v) { return nv.endsWith(v); },
|
||||
'*=': function(nv, v) { return nv.include(v); },
|
||||
'~=': function(nv, v) { return (' ' + nv + ' ').include(' ' + v + ' '); },
|
||||
'|=': function(nv, v) { return ('-' + nv.toUpperCase() + '-').include('-' + v.toUpperCase() + '-'); }
|
||||
},
|
||||
|
||||
matchElements: function(elements, expression) {
|
||||
var matches = new Selector(expression).findElements(), h = Selector.handlers;
|
||||
h.mark(matches);
|
||||
for (var i = 0, results = [], element; element = elements[i]; i++)
|
||||
if (element._counted) results.push(element);
|
||||
h.unmark(matches);
|
||||
return results;
|
||||
},
|
||||
|
||||
findElement: function(elements, expression, index) {
|
||||
if (typeof expression == 'number') {
|
||||
index = expression; expression = false;
|
||||
}
|
||||
return Selector.matchElements(elements, expression || '*')[index || 0];
|
||||
},
|
||||
|
||||
findChildElements: function(element, expressions) {
|
||||
var exprs = expressions.join(','), expressions = [];
|
||||
exprs.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/, function(m) {
|
||||
expressions.push(m[1].strip());
|
||||
});
|
||||
var results = [], h = Selector.handlers;
|
||||
for (var i = 0, l = expressions.length, selector; i < l; i++) {
|
||||
selector = new Selector(expressions[i].strip());
|
||||
h.concat(results, selector.findElements(element));
|
||||
}
|
||||
return (l > 1) ? h.unique(results) : results;
|
||||
}
|
||||
});
|
||||
|
||||
function $$() {
|
||||
return Selector.findChildElements(document, $A(arguments));
|
||||
}
|
||||
var Form = {
|
||||
reset: function(form) {
|
||||
$(form).reset();
|
||||
return form;
|
||||
},
|
||||
|
||||
serializeElements: function(elements, getHash) {
|
||||
var data = elements.inject({}, function(result, element) {
|
||||
if (!element.disabled && element.name) {
|
||||
var key = element.name, value = $(element).getValue();
|
||||
if (value != null) {
|
||||
if (key in result) {
|
||||
if (result[key].constructor != Array) result[key] = [result[key]];
|
||||
result[key].push(value);
|
||||
}
|
||||
else result[key] = value;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
});
|
||||
|
||||
return getHash ? data : Hash.toQueryString(data);
|
||||
}
|
||||
};
|
||||
|
||||
Form.Methods = {
|
||||
serialize: function(form, getHash) {
|
||||
return Form.serializeElements(Form.getElements(form), getHash);
|
||||
},
|
||||
|
||||
getElements: function(form) {
|
||||
return $A($(form).getElementsByTagName('*')).inject([],
|
||||
function(elements, child) {
|
||||
if (Form.Element.Serializers[child.tagName.toLowerCase()])
|
||||
elements.push(Element.extend(child));
|
||||
return elements;
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
getInputs: function(form, typeName, name) {
|
||||
form = $(form);
|
||||
var inputs = form.getElementsByTagName('input');
|
||||
|
||||
if (!typeName && !name) return $A(inputs).map(Element.extend);
|
||||
|
||||
for (var i = 0, matchingInputs = [], length = inputs.length; i < length; i++) {
|
||||
var input = inputs[i];
|
||||
if ((typeName && input.type != typeName) || (name && input.name != name))
|
||||
continue;
|
||||
matchingInputs.push(Element.extend(input));
|
||||
}
|
||||
|
||||
return matchingInputs;
|
||||
},
|
||||
|
||||
disable: function(form) {
|
||||
form = $(form);
|
||||
Form.getElements(form).invoke('disable');
|
||||
return form;
|
||||
},
|
||||
|
||||
enable: function(form) {
|
||||
form = $(form);
|
||||
Form.getElements(form).invoke('enable');
|
||||
return form;
|
||||
},
|
||||
|
||||
findFirstElement: function(form) {
|
||||
return $(form).getElements().find(function(element) {
|
||||
return element.type != 'hidden' && !element.disabled &&
|
||||
['input', 'select', 'textarea'].include(element.tagName.toLowerCase());
|
||||
});
|
||||
},
|
||||
|
||||
focusFirstElement: function(form) {
|
||||
form = $(form);
|
||||
form.findFirstElement().activate();
|
||||
return form;
|
||||
},
|
||||
|
||||
request: function(form, options) {
|
||||
form = $(form), options = Object.clone(options || {});
|
||||
|
||||
var params = options.parameters;
|
||||
options.parameters = form.serialize(true);
|
||||
|
||||
if (params) {
|
||||
if (typeof params == 'string') params = params.toQueryParams();
|
||||
Object.extend(options.parameters, params);
|
||||
}
|
||||
|
||||
if (form.hasAttribute('method') && !options.method)
|
||||
options.method = form.method;
|
||||
|
||||
return new Ajax.Request(form.readAttribute('action'), options);
|
||||
}
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
Form.Element = {
|
||||
focus: function(element) {
|
||||
$(element).focus();
|
||||
return element;
|
||||
},
|
||||
|
||||
select: function(element) {
|
||||
$(element).select();
|
||||
return element;
|
||||
}
|
||||
}
|
||||
|
||||
Form.Element.Methods = {
|
||||
serialize: function(element) {
|
||||
element = $(element);
|
||||
if (!element.disabled && element.name) {
|
||||
var value = element.getValue();
|
||||
if (value != undefined) {
|
||||
var pair = {};
|
||||
pair[element.name] = value;
|
||||
return Hash.toQueryString(pair);
|
||||
}
|
||||
}
|
||||
return '';
|
||||
},
|
||||
|
||||
getValue: function(element) {
|
||||
element = $(element);
|
||||
var method = element.tagName.toLowerCase();
|
||||
return Form.Element.Serializers[method](element);
|
||||
},
|
||||
|
||||
clear: function(element) {
|
||||
$(element).value = '';
|
||||
return element;
|
||||
},
|
||||
|
||||
present: function(element) {
|
||||
return $(element).value != '';
|
||||
},
|
||||
|
||||
activate: function(element) {
|
||||
element = $(element);
|
||||
try {
|
||||
element.focus();
|
||||
if (element.select && (element.tagName.toLowerCase() != 'input' ||
|
||||
!['button', 'reset', 'submit'].include(element.type)))
|
||||
element.select();
|
||||
} catch (e) {}
|
||||
return element;
|
||||
},
|
||||
|
||||
disable: function(element) {
|
||||
element = $(element);
|
||||
element.blur();
|
||||
element.disabled = true;
|
||||
return element;
|
||||
},
|
||||
|
||||
enable: function(element) {
|
||||
element = $(element);
|
||||
element.disabled = false;
|
||||
return element;
|
||||
}
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
var Field = Form.Element;
|
||||
var $F = Form.Element.Methods.getValue;
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
Form.Element.Serializers = {
|
||||
input: function(element) {
|
||||
switch (element.type.toLowerCase()) {
|
||||
case 'checkbox':
|
||||
case 'radio':
|
||||
return Form.Element.Serializers.inputSelector(element);
|
||||
default:
|
||||
return Form.Element.Serializers.textarea(element);
|
||||
}
|
||||
},
|
||||
|
||||
inputSelector: function(element) {
|
||||
return element.checked ? element.value : null;
|
||||
},
|
||||
|
||||
textarea: function(element) {
|
||||
return element.value;
|
||||
},
|
||||
|
||||
select: function(element) {
|
||||
return this[element.type == 'select-one' ?
|
||||
'selectOne' : 'selectMany'](element);
|
||||
},
|
||||
|
||||
selectOne: function(element) {
|
||||
var index = element.selectedIndex;
|
||||
return index >= 0 ? this.optionValue(element.options[index]) : null;
|
||||
},
|
||||
|
||||
selectMany: function(element) {
|
||||
var values, length = element.length;
|
||||
if (!length) return null;
|
||||
|
||||
for (var i = 0, values = []; i < length; i++) {
|
||||
var opt = element.options[i];
|
||||
if (opt.selected) values.push(this.optionValue(opt));
|
||||
}
|
||||
return values;
|
||||
},
|
||||
|
||||
optionValue: function(opt) {
|
||||
// extend element because hasAttribute may not be native
|
||||
return Element.extend(opt).hasAttribute('value') ? opt.value : opt.text;
|
||||
}
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
Abstract.TimedObserver = function() {}
|
||||
Abstract.TimedObserver.prototype = {
|
||||
initialize: function(element, frequency, callback) {
|
||||
this.frequency = frequency;
|
||||
this.element = $(element);
|
||||
this.callback = callback;
|
||||
|
||||
this.lastValue = this.getValue();
|
||||
this.registerCallback();
|
||||
},
|
||||
|
||||
registerCallback: function() {
|
||||
setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
|
||||
},
|
||||
|
||||
onTimerEvent: function() {
|
||||
var value = this.getValue();
|
||||
var changed = ('string' == typeof this.lastValue && 'string' == typeof value
|
||||
? this.lastValue != value : String(this.lastValue) != String(value));
|
||||
if (changed) {
|
||||
this.callback(this.element, value);
|
||||
this.lastValue = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Form.Element.Observer = Class.create();
|
||||
Form.Element.Observer.prototype = Object.extend(new Abstract.TimedObserver(), {
|
||||
getValue: function() {
|
||||
return Form.Element.getValue(this.element);
|
||||
}
|
||||
});
|
||||
|
||||
Form.Observer = Class.create();
|
||||
Form.Observer.prototype = Object.extend(new Abstract.TimedObserver(), {
|
||||
getValue: function() {
|
||||
return Form.serialize(this.element);
|
||||
}
|
||||
});
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
Abstract.EventObserver = function() {}
|
||||
Abstract.EventObserver.prototype = {
|
||||
initialize: function(element, callback) {
|
||||
this.element = $(element);
|
||||
this.callback = callback;
|
||||
|
||||
this.lastValue = this.getValue();
|
||||
if (this.element.tagName.toLowerCase() == 'form')
|
||||
this.registerFormCallbacks();
|
||||
else
|
||||
this.registerCallback(this.element);
|
||||
},
|
||||
|
||||
onElementEvent: function() {
|
||||
var value = this.getValue();
|
||||
if (this.lastValue != value) {
|
||||
this.callback(this.element, value);
|
||||
this.lastValue = value;
|
||||
}
|
||||
},
|
||||
|
||||
registerFormCallbacks: function() {
|
||||
Form.getElements(this.element).each(this.registerCallback.bind(this));
|
||||
},
|
||||
|
||||
registerCallback: function(element) {
|
||||
if (element.type) {
|
||||
switch (element.type.toLowerCase()) {
|
||||
case 'checkbox':
|
||||
case 'radio':
|
||||
Event.observe(element, 'click', this.onElementEvent.bind(this));
|
||||
break;
|
||||
default:
|
||||
Event.observe(element, 'change', this.onElementEvent.bind(this));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Form.Element.EventObserver = Class.create();
|
||||
Form.Element.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), {
|
||||
getValue: function() {
|
||||
return Form.Element.getValue(this.element);
|
||||
}
|
||||
});
|
||||
|
||||
Form.EventObserver = Class.create();
|
||||
Form.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), {
|
||||
getValue: function() {
|
||||
return Form.serialize(this.element);
|
||||
}
|
||||
});
|
||||
if (!window.Event) {
|
||||
var Event = new Object();
|
||||
}
|
||||
|
||||
Object.extend(Event, {
|
||||
KEY_BACKSPACE: 8,
|
||||
KEY_TAB: 9,
|
||||
KEY_RETURN: 13,
|
||||
KEY_ESC: 27,
|
||||
KEY_LEFT: 37,
|
||||
KEY_UP: 38,
|
||||
KEY_RIGHT: 39,
|
||||
KEY_DOWN: 40,
|
||||
KEY_DELETE: 46,
|
||||
KEY_HOME: 36,
|
||||
KEY_END: 35,
|
||||
KEY_PAGEUP: 33,
|
||||
KEY_PAGEDOWN: 34,
|
||||
|
||||
element: function(event) {
|
||||
return $(event.target || event.srcElement);
|
||||
},
|
||||
|
||||
isLeftClick: function(event) {
|
||||
return (((event.which) && (event.which == 1)) ||
|
||||
((event.button) && (event.button == 1)));
|
||||
},
|
||||
|
||||
pointerX: function(event) {
|
||||
return event.pageX || (event.clientX +
|
||||
(document.documentElement.scrollLeft || document.body.scrollLeft));
|
||||
},
|
||||
|
||||
pointerY: function(event) {
|
||||
return event.pageY || (event.clientY +
|
||||
(document.documentElement.scrollTop || document.body.scrollTop));
|
||||
},
|
||||
|
||||
stop: function(event) {
|
||||
if (event.preventDefault) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
} else {
|
||||
event.returnValue = false;
|
||||
event.cancelBubble = true;
|
||||
}
|
||||
},
|
||||
|
||||
// find the first node with the given tagName, starting from the
|
||||
// node the event was triggered on; traverses the DOM upwards
|
||||
findElement: function(event, tagName) {
|
||||
var element = Event.element(event);
|
||||
while (element.parentNode && (!element.tagName ||
|
||||
(element.tagName.toUpperCase() != tagName.toUpperCase())))
|
||||
element = element.parentNode;
|
||||
return element;
|
||||
},
|
||||
|
||||
observers: false,
|
||||
|
||||
_observeAndCache: function(element, name, observer, useCapture) {
|
||||
if (!this.observers) this.observers = [];
|
||||
if (element.addEventListener) {
|
||||
this.observers.push([element, name, observer, useCapture]);
|
||||
element.addEventListener(name, observer, useCapture);
|
||||
} else if (element.attachEvent) {
|
||||
this.observers.push([element, name, observer, useCapture]);
|
||||
element.attachEvent('on' + name, observer);
|
||||
}
|
||||
},
|
||||
|
||||
unloadCache: function() {
|
||||
if (!Event.observers) return;
|
||||
for (var i = 0, length = Event.observers.length; i < length; i++) {
|
||||
Event.stopObserving.apply(this, Event.observers[i]);
|
||||
Event.observers[i][0] = null;
|
||||
}
|
||||
Event.observers = false;
|
||||
},
|
||||
|
||||
observe: function(element, name, observer, useCapture) {
|
||||
element = $(element);
|
||||
useCapture = useCapture || false;
|
||||
|
||||
if (name == 'keypress' &&
|
||||
(Prototype.Browser.WebKit || element.attachEvent))
|
||||
name = 'keydown';
|
||||
|
||||
Event._observeAndCache(element, name, observer, useCapture);
|
||||
},
|
||||
|
||||
stopObserving: function(element, name, observer, useCapture) {
|
||||
element = $(element);
|
||||
useCapture = useCapture || false;
|
||||
|
||||
if (name == 'keypress' &&
|
||||
(Prototype.Browser.WebKit || element.attachEvent))
|
||||
name = 'keydown';
|
||||
|
||||
if (element.removeEventListener) {
|
||||
element.removeEventListener(name, observer, useCapture);
|
||||
} else if (element.detachEvent) {
|
||||
try {
|
||||
element.detachEvent('on' + name, observer);
|
||||
} catch (e) {}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/* prevent memory leaks in IE */
|
||||
if (Prototype.Browser.IE)
|
||||
Event.observe(window, 'unload', Event.unloadCache, false);
|
||||
var Position = {
|
||||
// set to true if needed, warning: firefox performance problems
|
||||
// NOT neeeded for page scrolling, only if draggable contained in
|
||||
// scrollable elements
|
||||
includeScrollOffsets: false,
|
||||
|
||||
// must be called before calling withinIncludingScrolloffset, every time the
|
||||
// page is scrolled
|
||||
prepare: function() {
|
||||
this.deltaX = window.pageXOffset
|
||||
|| document.documentElement.scrollLeft
|
||||
|| document.body.scrollLeft
|
||||
|| 0;
|
||||
this.deltaY = window.pageYOffset
|
||||
|| document.documentElement.scrollTop
|
||||
|| document.body.scrollTop
|
||||
|| 0;
|
||||
},
|
||||
|
||||
realOffset: function(element) {
|
||||
var valueT = 0, valueL = 0;
|
||||
do {
|
||||
valueT += element.scrollTop || 0;
|
||||
valueL += element.scrollLeft || 0;
|
||||
element = element.parentNode;
|
||||
} while (element);
|
||||
return [valueL, valueT];
|
||||
},
|
||||
|
||||
cumulativeOffset: function(element) {
|
||||
var valueT = 0, valueL = 0;
|
||||
do {
|
||||
valueT += element.offsetTop || 0;
|
||||
valueL += element.offsetLeft || 0;
|
||||
element = element.offsetParent;
|
||||
} while (element);
|
||||
return [valueL, valueT];
|
||||
},
|
||||
|
||||
positionedOffset: function(element) {
|
||||
var valueT = 0, valueL = 0;
|
||||
do {
|
||||
valueT += element.offsetTop || 0;
|
||||
valueL += element.offsetLeft || 0;
|
||||
element = element.offsetParent;
|
||||
if (element) {
|
||||
if(element.tagName=='BODY') break;
|
||||
var p = Element.getStyle(element, 'position');
|
||||
if (p == 'relative' || p == 'absolute') break;
|
||||
}
|
||||
} while (element);
|
||||
return [valueL, valueT];
|
||||
},
|
||||
|
||||
offsetParent: function(element) {
|
||||
if (element.offsetParent) return element.offsetParent;
|
||||
if (element == document.body) return element;
|
||||
|
||||
while ((element = element.parentNode) && element != document.body)
|
||||
if (Element.getStyle(element, 'position') != 'static')
|
||||
return element;
|
||||
|
||||
return document.body;
|
||||
},
|
||||
|
||||
// caches x/y coordinate pair to use with overlap
|
||||
within: function(element, x, y) {
|
||||
if (this.includeScrollOffsets)
|
||||
return this.withinIncludingScrolloffsets(element, x, y);
|
||||
this.xcomp = x;
|
||||
this.ycomp = y;
|
||||
this.offset = this.cumulativeOffset(element);
|
||||
|
||||
return (y >= this.offset[1] &&
|
||||
y < this.offset[1] + element.offsetHeight &&
|
||||
x >= this.offset[0] &&
|
||||
x < this.offset[0] + element.offsetWidth);
|
||||
},
|
||||
|
||||
withinIncludingScrolloffsets: function(element, x, y) {
|
||||
var offsetcache = this.realOffset(element);
|
||||
|
||||
this.xcomp = x + offsetcache[0] - this.deltaX;
|
||||
this.ycomp = y + offsetcache[1] - this.deltaY;
|
||||
this.offset = this.cumulativeOffset(element);
|
||||
|
||||
return (this.ycomp >= this.offset[1] &&
|
||||
this.ycomp < this.offset[1] + element.offsetHeight &&
|
||||
this.xcomp >= this.offset[0] &&
|
||||
this.xcomp < this.offset[0] + element.offsetWidth);
|
||||
},
|
||||
|
||||
// within must be called directly before
|
||||
overlap: function(mode, element) {
|
||||
if (!mode) return 0;
|
||||
if (mode == 'vertical')
|
||||
return ((this.offset[1] + element.offsetHeight) - this.ycomp) /
|
||||
element.offsetHeight;
|
||||
if (mode == 'horizontal')
|
||||
return ((this.offset[0] + element.offsetWidth) - this.xcomp) /
|
||||
element.offsetWidth;
|
||||
},
|
||||
|
||||
page: function(forElement) {
|
||||
var valueT = 0, valueL = 0;
|
||||
|
||||
var element = forElement;
|
||||
do {
|
||||
valueT += element.offsetTop || 0;
|
||||
valueL += element.offsetLeft || 0;
|
||||
|
||||
// Safari fix
|
||||
if (element.offsetParent == document.body)
|
||||
if (Element.getStyle(element,'position')=='absolute') break;
|
||||
|
||||
} while (element = element.offsetParent);
|
||||
|
||||
element = forElement;
|
||||
do {
|
||||
if (!window.opera || element.tagName=='BODY') {
|
||||
valueT -= element.scrollTop || 0;
|
||||
valueL -= element.scrollLeft || 0;
|
||||
}
|
||||
} while (element = element.parentNode);
|
||||
|
||||
return [valueL, valueT];
|
||||
},
|
||||
|
||||
clone: function(source, target) {
|
||||
var options = Object.extend({
|
||||
setLeft: true,
|
||||
setTop: true,
|
||||
setWidth: true,
|
||||
setHeight: true,
|
||||
offsetTop: 0,
|
||||
offsetLeft: 0
|
||||
}, arguments[2] || {})
|
||||
|
||||
// find page position of source
|
||||
source = $(source);
|
||||
var p = Position.page(source);
|
||||
|
||||
// find coordinate system to use
|
||||
target = $(target);
|
||||
var delta = [0, 0];
|
||||
var parent = null;
|
||||
// delta [0,0] will do fine with position: fixed elements,
|
||||
// position:absolute needs offsetParent deltas
|
||||
if (Element.getStyle(target,'position') == 'absolute') {
|
||||
parent = Position.offsetParent(target);
|
||||
delta = Position.page(parent);
|
||||
}
|
||||
|
||||
// correct by body offsets (fixes Safari)
|
||||
if (parent == document.body) {
|
||||
delta[0] -= document.body.offsetLeft;
|
||||
delta[1] -= document.body.offsetTop;
|
||||
}
|
||||
|
||||
// set position
|
||||
if(options.setLeft) target.style.left = (p[0] - delta[0] + options.offsetLeft) + 'px';
|
||||
if(options.setTop) target.style.top = (p[1] - delta[1] + options.offsetTop) + 'px';
|
||||
if(options.setWidth) target.style.width = source.offsetWidth + 'px';
|
||||
if(options.setHeight) target.style.height = source.offsetHeight + 'px';
|
||||
},
|
||||
|
||||
absolutize: function(element) {
|
||||
element = $(element);
|
||||
if (element.style.position == 'absolute') return;
|
||||
Position.prepare();
|
||||
|
||||
var offsets = Position.positionedOffset(element);
|
||||
var top = offsets[1];
|
||||
var left = offsets[0];
|
||||
var width = element.clientWidth;
|
||||
var height = element.clientHeight;
|
||||
|
||||
element._originalLeft = left - parseFloat(element.style.left || 0);
|
||||
element._originalTop = top - parseFloat(element.style.top || 0);
|
||||
element._originalWidth = element.style.width;
|
||||
element._originalHeight = element.style.height;
|
||||
|
||||
element.style.position = 'absolute';
|
||||
element.style.top = top + 'px';
|
||||
element.style.left = left + 'px';
|
||||
element.style.width = width + 'px';
|
||||
element.style.height = height + 'px';
|
||||
},
|
||||
|
||||
relativize: function(element) {
|
||||
element = $(element);
|
||||
if (element.style.position == 'relative') return;
|
||||
Position.prepare();
|
||||
|
||||
element.style.position = 'relative';
|
||||
var top = parseFloat(element.style.top || 0) - (element._originalTop || 0);
|
||||
var left = parseFloat(element.style.left || 0) - (element._originalLeft || 0);
|
||||
|
||||
element.style.top = top + 'px';
|
||||
element.style.left = left + 'px';
|
||||
element.style.height = element._originalHeight;
|
||||
element.style.width = element._originalWidth;
|
||||
}
|
||||
}
|
||||
|
||||
// Safari returns margins on body which is incorrect if the child is absolutely
|
||||
// positioned. For performance reasons, redefine Position.cumulativeOffset for
|
||||
// KHTML/WebKit only.
|
||||
if (Prototype.Browser.WebKit) {
|
||||
Position.cumulativeOffset = function(element) {
|
||||
var valueT = 0, valueL = 0;
|
||||
do {
|
||||
valueT += element.offsetTop || 0;
|
||||
valueL += element.offsetLeft || 0;
|
||||
if (element.offsetParent == document.body)
|
||||
if (Element.getStyle(element, 'position') == 'absolute') break;
|
||||
|
||||
element = element.offsetParent;
|
||||
} while (element);
|
||||
|
||||
return [valueL, valueT];
|
||||
}
|
||||
}
|
||||
|
||||
Element.addMethods();
|
10
thirdparty/jsmin/test/test.php
vendored
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
error_reporting(E_STRICT);
|
||||
|
||||
fwrite(STDERR, memory_get_peak_usage(true)."\n");
|
||||
|
||||
require '../jsmin.php';
|
||||
echo JSMin::minify(file_get_contents('ext-all-debug.js'));
|
||||
|
||||
fwrite(STDERR, memory_get_peak_usage(true)."\n");
|
||||
?>
|