survivalkit 1.0.beta.11 → 1.0.beta.12
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.markdown +4 -0
- data/lib/survivalkit.rb +2 -2
- data/stylesheets/survivalkit/fonts/_all.scss +2 -0
- data/stylesheets/survivalkit/fonts/_ss-social.scss +136 -0
- data/stylesheets/survivalkit/fonts/_ss-standard.scss +426 -0
- data/stylesheets/survivalkit/reset/_reset.scss +4 -0
- data/templates/clean/manifest.rb +0 -2
- data/templates/drupal/manifest.rb +0 -2
- data/templates/project/manifest.rb +44 -46
- data/templates/project/sources/FitVids/README.md +49 -0
- data/templates/project/sources/FitVids/jquery.fitvids.js +80 -0
- data/templates/project/sources/FitVids/tests.html +66 -0
- data/templates/project/sources/Geared-Scrolling/README.md +31 -0
- data/templates/project/sources/Geared-Scrolling/css/specific.css +88 -0
- data/templates/project/sources/Geared-Scrolling/images/col1.png +0 -0
- data/templates/project/sources/Geared-Scrolling/images/col2.png +0 -0
- data/templates/project/sources/Geared-Scrolling/images/col3.png +0 -0
- data/templates/project/sources/Geared-Scrolling/images/header.png +0 -0
- data/templates/project/sources/Geared-Scrolling/index.html +32 -0
- data/templates/project/sources/Geared-Scrolling/js/init.js +11 -0
- data/templates/project/sources/Geared-Scrolling/js/jquery.heyday.gearedscrolling.js +283 -0
- data/templates/project/sources/Lettering.js/README.md +58 -0
- data/templates/project/sources/Lettering.js/examples/index.html +135 -0
- data/templates/project/sources/Lettering.js/examples/style.css +171 -0
- data/templates/project/sources/Lettering.js/jquery.lettering.js +66 -0
- data/templates/project/sources/Respond/README.md +100 -0
- data/templates/project/sources/Respond/cross-domain/example.html +24 -0
- data/templates/project/sources/Respond/cross-domain/respond-proxy.html +96 -0
- data/templates/project/sources/Respond/cross-domain/respond.proxy.gif +0 -0
- data/templates/project/sources/Respond/cross-domain/respond.proxy.js +127 -0
- data/templates/project/sources/Respond/respond.min.js +6 -0
- data/templates/project/sources/Respond/respond.src.js +326 -0
- data/templates/project/sources/Respond/test/test.css +80 -0
- data/templates/project/sources/Respond/test/test.html +20 -0
- data/templates/project/sources/Respond/test/test2.css +8 -0
- data/templates/project/sources/Respond/test/unit/index.html +29 -0
- data/templates/project/sources/Respond/test/unit/qunit/qunit.css +226 -0
- data/templates/project/sources/Respond/test/unit/qunit/qunit.js +1598 -0
- data/templates/project/sources/Respond/test/unit/test.css +73 -0
- data/templates/project/sources/Respond/test/unit/test2.css +5 -0
- data/templates/project/sources/Respond/test/unit/test3.css +5 -0
- data/templates/project/sources/Respond/test/unit/tests.js +144 -0
- data/templates/project/sources/box-sizing-polyfill/README.md +24 -0
- data/templates/project/sources/box-sizing-polyfill/boxsizing.htc +501 -0
- data/templates/project/sources/formalize/README.txt +26 -0
- data/templates/project/sources/formalize/assets/css/_formalize.sass +326 -0
- data/templates/project/sources/formalize/assets/css/demo.css +654 -0
- data/templates/project/sources/formalize/assets/css/formalize.css +368 -0
- data/templates/project/sources/formalize/assets/css/reset.css +211 -0
- data/templates/project/sources/formalize/assets/css/text.css +81 -0
- data/templates/project/sources/formalize/assets/images/button.png +0 -0
- data/templates/project/sources/formalize/assets/images/select_arrow.gif +0 -0
- data/templates/project/sources/formalize/assets/js/dojo.formalize.js +202 -0
- data/templates/project/sources/formalize/assets/js/dojo.formalize.min.js +1 -0
- data/templates/project/sources/formalize/assets/js/extjs.formalize.js +192 -0
- data/templates/project/sources/formalize/assets/js/extjs.formalize.min.js +1 -0
- data/templates/project/sources/formalize/assets/js/jquery.formalize.js +181 -0
- data/templates/project/sources/formalize/assets/js/jquery.formalize.min.js +1 -0
- data/templates/project/sources/formalize/assets/js/mootools.formalize.js +193 -0
- data/templates/project/sources/formalize/assets/js/mootools.formalize.min.js +1 -0
- data/templates/project/sources/formalize/assets/js/prototype.formalize.js +192 -0
- data/templates/project/sources/formalize/assets/js/prototype.formalize.min.js +1 -0
- data/templates/project/sources/formalize/assets/js/yui.formalize.js +183 -0
- data/templates/project/sources/formalize/assets/js/yui.formalize.min.js +1 -0
- data/templates/project/sources/formalize/demo.html +130 -0
- data/templates/project/sources/formalize/dojo_demo.html +215 -0
- data/templates/project/sources/formalize/dojo_disabled.html +215 -0
- data/templates/project/sources/formalize/dojo_errors.html +215 -0
- data/templates/project/sources/formalize/extjs_demo.html +215 -0
- data/templates/project/sources/formalize/extjs_disabled.html +215 -0
- data/templates/project/sources/formalize/extjs_errors.html +215 -0
- data/templates/project/sources/formalize/jquery_demo.html +215 -0
- data/templates/project/sources/formalize/jquery_disabled.html +215 -0
- data/templates/project/sources/formalize/jquery_errors.html +215 -0
- data/templates/project/sources/formalize/mootools_demo.html +215 -0
- data/templates/project/sources/formalize/mootools_disabled.html +215 -0
- data/templates/project/sources/formalize/mootools_errors.html +215 -0
- data/templates/project/sources/formalize/prototype_demo.html +215 -0
- data/templates/project/sources/formalize/prototype_disabled.html +215 -0
- data/templates/project/sources/formalize/prototype_errors.html +215 -0
- data/templates/project/sources/formalize/unstyled.html +210 -0
- data/templates/project/sources/formalize/yui_demo.html +223 -0
- data/templates/project/sources/formalize/yui_disabled.html +223 -0
- data/templates/project/sources/formalize/yui_errors.html +223 -0
- data/templates/project/sources/iOS-Orientationchange-Fix/README.md +16 -0
- data/templates/project/sources/iOS-Orientationchange-Fix/demo.html +43 -0
- data/templates/project/sources/iOS-Orientationchange-Fix/ios-orientationchange-fix.js +56 -0
- data/templates/project/sources/jQuery-widowFix/index.html +159 -0
- data/templates/project/sources/jQuery-widowFix/js/jquery-1.4.3.min.js +166 -0
- data/templates/project/sources/jQuery-widowFix/js/jquery.widowFix-1.3.2.js +135 -0
- data/templates/project/sources/jQuery-widowFix/js/jquery.widowFix-1.3.2.min.js +10 -0
- data/templates/project/sources/jQuery-widowFix/sample.html +84 -0
- data/templates/project/sources/jquery-html5-placeholder-shim/jquery.html5-placeholder-shim.js +96 -0
- data/templates/project/sources/jquery-html5-placeholder-shim/readme.md +22 -0
- data/templates/project/sources/jquery-html5-placeholder-shim/test.html +103 -0
- data/templates/project/sources/ss-social/ss-social.js +78 -0
- data/templates/project/sources/ss-standard/ss-standard.js +78 -0
- data/templates/shared/partials/01-variables/_colors.scss +2 -6
- data/templates/shared/partials/01-variables/_fonts.scss +49 -2
- data/templates/shared/partials/01-variables/_settings.scss +48 -13
- data/templates/shared/partials/04-base/_all.scss +0 -2
- data/templates/shared/partials/04-base/_common.scss +0 -4
- data/templates/shared/partials/05-layout/_grids-susy.scss +4 -4
- data/templates/shared/style.scss +9 -9
- metadata +93 -5
- data/templates/shared/partials/04-base/_edits.scss +0 -8
- data/templates/shared/partials/04-base/_font-face.scss +0 -14
@@ -0,0 +1,73 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
.launcher #qunit-testrunner-toolbar,
|
4
|
+
.launcher #qunit-userAgent,
|
5
|
+
.launcher #qunit-tests,
|
6
|
+
.launcher #qunit-testresult {
|
7
|
+
display: none;
|
8
|
+
}
|
9
|
+
.launcher #launcher {
|
10
|
+
|
11
|
+
font: 1.5em/1 bold Helvetica, sans-serif;
|
12
|
+
}
|
13
|
+
|
14
|
+
#testelem {
|
15
|
+
width: 50px;
|
16
|
+
display: block;
|
17
|
+
}
|
18
|
+
|
19
|
+
/* a style like this should never apply in IE. If it does, tests will fail */
|
20
|
+
@media screen and (view-mode: minimized) {
|
21
|
+
#testelem {
|
22
|
+
width: 10px !important;
|
23
|
+
}
|
24
|
+
}
|
25
|
+
|
26
|
+
/*styles for 480px and up - media type purposely left out here to test that in the process */
|
27
|
+
@media (min-width: 480px) {
|
28
|
+
#testelem {
|
29
|
+
width: 150px;
|
30
|
+
}
|
31
|
+
#testelem[class=foo] {
|
32
|
+
height: 200px;
|
33
|
+
}
|
34
|
+
}
|
35
|
+
|
36
|
+
/*styles for 500px and under*/
|
37
|
+
@media screen and (max-width: 460px) {
|
38
|
+
#testelem {
|
39
|
+
height: 150px;
|
40
|
+
}
|
41
|
+
}
|
42
|
+
|
43
|
+
/* testing em unit support - 33em should be 528px and 35em should be 560px in IE with default font settings */
|
44
|
+
@media screen and (min-width: 33em) and (max-width: 35em) {
|
45
|
+
#testelem {
|
46
|
+
width: 12px;
|
47
|
+
}
|
48
|
+
}
|
49
|
+
|
50
|
+
|
51
|
+
|
52
|
+
/*styles for 620px and up */
|
53
|
+
@media only screen and (min-width: 620px) {
|
54
|
+
#testelem {
|
55
|
+
width: 250px;
|
56
|
+
}
|
57
|
+
}
|
58
|
+
|
59
|
+
|
60
|
+
/*styles for 760px and up */
|
61
|
+
@media only print, only screen and (min-width: 760px) {
|
62
|
+
#testelem {
|
63
|
+
width: 350px;
|
64
|
+
}
|
65
|
+
}
|
66
|
+
|
67
|
+
|
68
|
+
/*styles for print that shouldn't apply */
|
69
|
+
@media only print and (min-width: 800px) {
|
70
|
+
#testelem {
|
71
|
+
width: 500px;
|
72
|
+
}
|
73
|
+
}
|
@@ -0,0 +1,144 @@
|
|
1
|
+
/*
|
2
|
+
Respond.js unit tests - based on qUnit
|
3
|
+
*/
|
4
|
+
|
5
|
+
window.onload = function(){
|
6
|
+
|
7
|
+
if( !window.opener ){
|
8
|
+
|
9
|
+
document.documentElement.className = "launcher";
|
10
|
+
|
11
|
+
document.getElementById("launcher").innerHTML = '<p>Tests must run in a popup window. <a href="suite.html" id="suitelink">Open test suite</a></p>';
|
12
|
+
|
13
|
+
document.getElementById( "suitelink" ).onclick = function(){
|
14
|
+
window.open( location.href + "?" + Math.random(), 'win', 'width=800,height=600,scrollbars=1,resizable=1' );
|
15
|
+
return false;
|
16
|
+
};
|
17
|
+
|
18
|
+
}
|
19
|
+
else {
|
20
|
+
|
21
|
+
var testElem = document.getElementById("testelem");
|
22
|
+
|
23
|
+
//check if a particular style has applied properly
|
24
|
+
function widthApplied( val ){
|
25
|
+
return testElem.offsetWidth === val;
|
26
|
+
}
|
27
|
+
function heightApplied( val ){
|
28
|
+
return testElem.offsetHeight === val;
|
29
|
+
}
|
30
|
+
|
31
|
+
// A short snippet for detecting versions of IE in JavaScript - author: @padolsey
|
32
|
+
var ie = (function(){
|
33
|
+
|
34
|
+
var undef,
|
35
|
+
v = 3,
|
36
|
+
div = document.createElement('div'),
|
37
|
+
all = div.getElementsByTagName('i');
|
38
|
+
|
39
|
+
while (
|
40
|
+
div.innerHTML = '<!--[if gt IE ' + (++v) + ']><i></i><![endif]-->',
|
41
|
+
all[0]
|
42
|
+
);
|
43
|
+
|
44
|
+
return v > 4 ? v : undef;
|
45
|
+
|
46
|
+
}());
|
47
|
+
|
48
|
+
window.moveTo(0,0);
|
49
|
+
|
50
|
+
/* TESTS HERE */
|
51
|
+
asyncTest( 'Styles not nested in media queries apply as expected', function() {
|
52
|
+
window.resizeTo(200,600);
|
53
|
+
setTimeout(function(){
|
54
|
+
ok( widthApplied( 50 ), "testelem is 50px wide when window is 200px wide" );
|
55
|
+
start();
|
56
|
+
}, 900);
|
57
|
+
});
|
58
|
+
|
59
|
+
asyncTest( 'styles within min-width media queries apply properly', function() {
|
60
|
+
window.resizeTo(520,600);
|
61
|
+
setTimeout(function(){
|
62
|
+
ok( widthApplied( 150 ), 'testelem is 150px wide when window is 500px wide' );
|
63
|
+
start();
|
64
|
+
}, 900);
|
65
|
+
});
|
66
|
+
|
67
|
+
// This test is for a feature in IE7 and up
|
68
|
+
if( ie >= 7 ){
|
69
|
+
asyncTest( "attribute selectors still work (where supported) after respond runs its course", function() {
|
70
|
+
window.resizeTo(520,600);
|
71
|
+
setTimeout(function(){
|
72
|
+
ok( heightApplied( 200 ), "testelem is 200px tall when window is 500px wide" );
|
73
|
+
start();
|
74
|
+
}, 900);
|
75
|
+
});
|
76
|
+
}
|
77
|
+
|
78
|
+
|
79
|
+
asyncTest( 'styles within max-width media queries apply properly', function() {
|
80
|
+
window.resizeTo(300,600);
|
81
|
+
setTimeout(function(){
|
82
|
+
ok( heightApplied( 150 ), 'testelem is 150px tall when window is under 480px wide' );
|
83
|
+
start();
|
84
|
+
}, 900);
|
85
|
+
});
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
asyncTest( 'min and max-width media queries that use EM units apply properly', function() {
|
90
|
+
window.resizeTo(560,600);
|
91
|
+
setTimeout(function(){
|
92
|
+
ok( widthApplied( 12 ), 'testelem is 150px wide when window is 500px wide' );
|
93
|
+
start();
|
94
|
+
}, 900);
|
95
|
+
});
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
asyncTest( "styles within a min-width media query with an \"only\" keyword apply properly", function() {
|
100
|
+
window.resizeTo(650,600);
|
101
|
+
setTimeout(function(){
|
102
|
+
ok( widthApplied( 250 ), "testelem is 250px wide when window is 650px wide" );
|
103
|
+
start();
|
104
|
+
}, 900);
|
105
|
+
});
|
106
|
+
|
107
|
+
asyncTest( "styles within a media query with a one true query among other false queries apply properly", function() {
|
108
|
+
window.resizeTo(800,600);
|
109
|
+
setTimeout(function(){
|
110
|
+
ok( widthApplied( 350 ), "testelem is 350px wide when window is 750px wide" );
|
111
|
+
start();
|
112
|
+
}, 900);
|
113
|
+
});
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
asyncTest( "Styles within a false media query do not apply", function() {
|
118
|
+
window.resizeTo(800,600);
|
119
|
+
setTimeout(function(){
|
120
|
+
ok( !widthApplied( 500 ), "testelem is not 500px wide when window is 800px wide" );
|
121
|
+
start();
|
122
|
+
|
123
|
+
}, 900);
|
124
|
+
});
|
125
|
+
|
126
|
+
asyncTest( "stylesheets with a media query in a media attribute apply when they should", function() {
|
127
|
+
window.resizeTo(1300,600);
|
128
|
+
setTimeout(function(){
|
129
|
+
ok( widthApplied( 16 ), "testelem is 16px wide when window is 1300px wide" );
|
130
|
+
start();
|
131
|
+
}, 900);
|
132
|
+
});
|
133
|
+
|
134
|
+
asyncTest( "stylesheets with an EM-based media query in a media attribute apply when they should", function() {
|
135
|
+
window.resizeTo(1500,600);
|
136
|
+
setTimeout(function(){
|
137
|
+
ok( widthApplied( 25 ), "testelem is 25px wide when window is > 1400px wide" );
|
138
|
+
start();
|
139
|
+
}, 900);
|
140
|
+
});
|
141
|
+
|
142
|
+
}
|
143
|
+
|
144
|
+
};
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# Preface and Credits
|
2
|
+
|
3
|
+
This box-sizing polyfill is based on previous work done by Erik Arvidsson, which he published in 2002 on [WebFX](http://webfx.eae.net/dhtml/boxsizing/boxsizing.html).
|
4
|
+
|
5
|
+
Since there were some edge/heavy usage cases where it broke I started pushing it further. And since the original was not aware of IE8 I also added feature-detection for box-sizing, to do nothing when detected positive.
|
6
|
+
|
7
|
+
During that I also borrowed dimension measuring techniques from Dean Edwards' [IE7.js](http://code.google.com/p/ie7-js/) script.
|
8
|
+
|
9
|
+
# Usage
|
10
|
+
|
11
|
+
Add the behavior/HTC after every *box-sizing: border-box;* that you assign:
|
12
|
+
|
13
|
+
`box-sizing: border-box;
|
14
|
+
*behavior: url(/scripts/boxsizing.htc);`
|
15
|
+
|
16
|
+
If you prefix the `behavior` property with a star, like seen above, it will only be seen by IE6 & IE7, not by IE8+ (it's a hack) which is better for the performance on those newer browsers.
|
17
|
+
|
18
|
+
The URL to the HTC file must be relative to your HTML(!) document, not relative to your CSS.
|
19
|
+
That's why I'd advise you to use absolute paths like in the example.
|
20
|
+
|
21
|
+
Please make sure to check your server configuration and update it to use the correct content-type if needed.
|
22
|
+
You can do this in a .htaccess file:
|
23
|
+
|
24
|
+
`AddType text/x-component .htc`
|
@@ -0,0 +1,501 @@
|
|
1
|
+
/**
|
2
|
+
* box-sizing Polyfill
|
3
|
+
*
|
4
|
+
* A polyfill for box-sizing: border-box for IE6 & IE7.
|
5
|
+
*
|
6
|
+
* JScript
|
7
|
+
*
|
8
|
+
* This program is free software: you can redistribute it and/or modify
|
9
|
+
* it under the terms of the GNU Lesser General Public License as published
|
10
|
+
* by the Free Software Foundation, either version 3 of the License, or
|
11
|
+
* (at your option) any later version.
|
12
|
+
*
|
13
|
+
* This program is distributed in the hope that it will be useful,
|
14
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
+
* GNU Lesser General Public License for more details.
|
17
|
+
*
|
18
|
+
* See <http://www.gnu.org/licenses/lgpl-3.0.txt>
|
19
|
+
*
|
20
|
+
* @category JScript
|
21
|
+
* @package box-sizing-polyfill
|
22
|
+
* @author Christian Schepp Schaefer <schaepp@gmx.de> <http://twitter.com/derSchepp>
|
23
|
+
* @copyright 2012 Christian Schepp Schaefer
|
24
|
+
* @license http://www.gnu.org/copyleft/lesser.html The GNU LESSER GENERAL PUBLIC LICENSE, Version 3.0
|
25
|
+
* @link http://github.com/Schepp/box-sizing-polyfill
|
26
|
+
*
|
27
|
+
* PREFACE:
|
28
|
+
*
|
29
|
+
* This box-sizing polyfill is based on previous work done by Erik Arvidsson,
|
30
|
+
* which he published in 2002 on http://webfx.eae.net/dhtml/boxsizing/boxsizing.html.
|
31
|
+
*
|
32
|
+
* USAGE:
|
33
|
+
*
|
34
|
+
* Add the behavior/HTC after every `box-sizing: border-box;` that you assign:
|
35
|
+
*
|
36
|
+
* box-sizing: border-box;
|
37
|
+
* *behavior: url(/scripts/boxsizing.htc);`
|
38
|
+
*
|
39
|
+
* Prefix the `behavior` property with a star, like seen above, so it will only be seen by
|
40
|
+
* IE6 & IE7, not by IE8+ who already implement box-sizing.
|
41
|
+
*
|
42
|
+
* The URL to the HTC file must be relative to your HTML(!) document, not relative to your CSS.
|
43
|
+
* That's why I'd advise you to use absolute paths like in the example.
|
44
|
+
*
|
45
|
+
*/
|
46
|
+
<component lightWeight="true">
|
47
|
+
<attach event="onpropertychange" onevent="checkPropertyChange()" />
|
48
|
+
<attach event="ondetach" onevent="restore()" />
|
49
|
+
<attach event="onresize" for="window" onevent="update()" />
|
50
|
+
<script type="text/javascript">
|
51
|
+
//<![CDATA[
|
52
|
+
|
53
|
+
var viewportwidth = (typeof window.innerWidth != 'undefined' ? window.innerWidth : element.document.documentElement.clientWidth);
|
54
|
+
|
55
|
+
// Shortcut for the document object
|
56
|
+
var doc = element.document;
|
57
|
+
|
58
|
+
// Buffer for multiple resize events
|
59
|
+
var resizetimeout = null;
|
60
|
+
|
61
|
+
// Don't apply box-sizing to certain elements
|
62
|
+
var apply = false;
|
63
|
+
switch(element.nodeName){
|
64
|
+
case '#comment':
|
65
|
+
case 'HTML':
|
66
|
+
case 'HEAD':
|
67
|
+
case 'TITLE':
|
68
|
+
case 'SCRIPT':
|
69
|
+
case 'STYLE':
|
70
|
+
case 'LINK':
|
71
|
+
case 'META':
|
72
|
+
break;
|
73
|
+
|
74
|
+
default:
|
75
|
+
apply = true;
|
76
|
+
break;
|
77
|
+
}
|
78
|
+
|
79
|
+
/*
|
80
|
+
* update gets called during resize events, then waits until there are no further resize events, and finally triggers a recalculation
|
81
|
+
*/
|
82
|
+
function update(){
|
83
|
+
if(resizetimeout !== null){
|
84
|
+
window.clearTimeout(resizetimeout);
|
85
|
+
}
|
86
|
+
resizetimeout = window.setTimeout(function(){
|
87
|
+
restore();
|
88
|
+
init();
|
89
|
+
resizetimeout = null;
|
90
|
+
},100);
|
91
|
+
}
|
92
|
+
|
93
|
+
/*
|
94
|
+
* restore gets called when the behavior is being detached (see event binding at the top),
|
95
|
+
* resets everything like it was before applying the behavior
|
96
|
+
*/
|
97
|
+
function restore(){
|
98
|
+
if(apply){
|
99
|
+
try{
|
100
|
+
element.runtimeStyle.removeAttribute("width");
|
101
|
+
element.runtimeStyle.removeAttribute("height");
|
102
|
+
}
|
103
|
+
catch(e){}
|
104
|
+
}
|
105
|
+
}
|
106
|
+
|
107
|
+
/*
|
108
|
+
* init gets called once at the start and then never again,
|
109
|
+
* triggers box-sizing calculations and updates width and height
|
110
|
+
*/
|
111
|
+
function init(){
|
112
|
+
if(apply){
|
113
|
+
updateBorderBoxWidth();
|
114
|
+
updateBorderBoxHeight();
|
115
|
+
}
|
116
|
+
}
|
117
|
+
|
118
|
+
/*
|
119
|
+
* checkPropertyChange gets called as soon as an element property changes
|
120
|
+
* (see event binding at the top), it then checks if any property influencing its
|
121
|
+
* dimensions was changed and if yes recalculates width and height
|
122
|
+
*/
|
123
|
+
function checkPropertyChange(){
|
124
|
+
if(apply){
|
125
|
+
var pn = event.propertyName;
|
126
|
+
if(pn === "style.boxSizing" && element.style.boxSizing === ""){
|
127
|
+
element.style.removeAttribute("boxSizing");
|
128
|
+
element.runtimeStyle.removeAttribute("boxSizing");
|
129
|
+
element.runtimeStyle.removeAttribute("width");
|
130
|
+
element.runtimeStyle.removeAttribute("height");
|
131
|
+
}
|
132
|
+
switch (pn){
|
133
|
+
case "style.width":
|
134
|
+
case "style.minWidth":
|
135
|
+
case "style.maxWidth":
|
136
|
+
case "style.borderLeftWidth":
|
137
|
+
case "style.borderLeftStyle":
|
138
|
+
case "style.borderRightWidth":
|
139
|
+
case "style.borderRightStyle":
|
140
|
+
case "style.paddingLeft":
|
141
|
+
case "style.paddingRight":
|
142
|
+
updateBorderBoxWidth();
|
143
|
+
break;
|
144
|
+
|
145
|
+
case "style.height":
|
146
|
+
case "style.minHeight":
|
147
|
+
case "style.maxHeight":
|
148
|
+
case "style.borderTopWidth":
|
149
|
+
case "style.borderTopStyle":
|
150
|
+
case "style.borderBottomWidth":
|
151
|
+
case "style.borderBottomStyle":
|
152
|
+
case "style.paddingTop":
|
153
|
+
case "style.paddingBottom":
|
154
|
+
updateBorderBoxHeight();
|
155
|
+
break;
|
156
|
+
|
157
|
+
case "className":
|
158
|
+
case "style.boxSizing":
|
159
|
+
updateBorderBoxWidth();
|
160
|
+
updateBorderBoxHeight();
|
161
|
+
break;
|
162
|
+
}
|
163
|
+
}
|
164
|
+
}
|
165
|
+
|
166
|
+
/*
|
167
|
+
* Helper function, taken from Dean Edward's IE7 framework,
|
168
|
+
* added by Schepp on 12.06.2010.
|
169
|
+
* http://code.google.com/p/ie7-js/
|
170
|
+
*
|
171
|
+
* Allows us to convert from relative to pixel-values.
|
172
|
+
*/
|
173
|
+
function getPixelValue(value){
|
174
|
+
var PIXEL = /^\d+(px)?$/i;
|
175
|
+
if (PIXEL.test(value)) return parseInt(value);
|
176
|
+
var style = element.style.left;
|
177
|
+
var runtimeStyle = element.runtimeStyle.left;
|
178
|
+
element.runtimeStyle.left = element.currentStyle.left;
|
179
|
+
element.style.left = value || 0;
|
180
|
+
value = parseInt(element.style.pixelLeft);
|
181
|
+
element.style.left = style;
|
182
|
+
element.runtimeStyle.left = runtimeStyle;
|
183
|
+
|
184
|
+
return value;
|
185
|
+
}
|
186
|
+
|
187
|
+
function getPixelWidth(object, value){
|
188
|
+
// For Pixel Values
|
189
|
+
var PIXEL = /^\d+(px)?$/i;
|
190
|
+
if (PIXEL.test(value)) return parseInt(value);
|
191
|
+
|
192
|
+
// For Percentage Values
|
193
|
+
var PERCENT = /^[\d\.]+%$/i;
|
194
|
+
if (PERCENT.test(value)){
|
195
|
+
try{
|
196
|
+
var parentPaddingLeft = getPixelWidth(object.parentElement,object.parentElement.currentStyle.paddingLeft);
|
197
|
+
var parentPaddingRight = getPixelWidth(object.parentElement,object.parentElement.currentStyle.paddingRight);
|
198
|
+
var parentBorderLeft = getPixelWidth(object.parentElement,object.parentElement.currentStyle.borderLeft);
|
199
|
+
var parentBorderRight = getPixelWidth(object.parentElement,object.parentElement.currentStyle.borderRight);
|
200
|
+
|
201
|
+
//var parentWidth = getPixelWidth(object.parentElement,(object.parentElement.currentStyle.width != "auto" ? object.parentElement.currentStyle.width : "100%"));
|
202
|
+
var parentWidth = object.parentElement.offsetWidth - parentPaddingLeft - parentPaddingRight - parentBorderLeft - parentBorderRight;
|
203
|
+
var value = (parseFloat(value) / 100) * parentWidth;
|
204
|
+
}
|
205
|
+
catch(e){
|
206
|
+
var value = (parseFloat(value) / 100) * element.document.documentElement.clientWidth;
|
207
|
+
}
|
208
|
+
return parseInt(value);
|
209
|
+
}
|
210
|
+
|
211
|
+
// For EM Values
|
212
|
+
var style = object.style.left;
|
213
|
+
var runtimeStyle = object.runtimeStyle.left;
|
214
|
+
object.runtimeStyle.left = object.currentStyle.left;
|
215
|
+
object.style.left = value || 0;
|
216
|
+
value = parseInt(object.style.pixelLeft);
|
217
|
+
object.style.left = style;
|
218
|
+
object.runtimeStyle.left = runtimeStyle;
|
219
|
+
|
220
|
+
return value;
|
221
|
+
}
|
222
|
+
|
223
|
+
function getPixelHeight(object, value){
|
224
|
+
// For Pixel Values
|
225
|
+
var PIXEL = /^\d+(px)?$/i;
|
226
|
+
if (PIXEL.test(value)) return parseInt(value);
|
227
|
+
|
228
|
+
// For Percentage Values
|
229
|
+
var PERCENT = /^[\d\.]+%$/i;
|
230
|
+
if (PERCENT.test(value)){
|
231
|
+
try{
|
232
|
+
if(object.parentElement.currentStyle.height != "auto"){
|
233
|
+
switch(object.parentElement.nodeName){
|
234
|
+
default:
|
235
|
+
if(object.parentElement.currentStyle.height !== "auto"){
|
236
|
+
var parentPaddingTop = getPixelWidth(object.parentElement,object.parentElement.currentStyle.paddingTop);
|
237
|
+
var parentPaddingBottom = getPixelWidth(object.parentElement,object.parentElement.currentStyle.paddingBottom);
|
238
|
+
var parentBorderTop = getPixelWidth(object.parentElement,object.parentElement.currentStyle.borderTop);
|
239
|
+
var parentBorderBottom = getPixelWidth(object.parentElement,object.parentElement.currentStyle.borderBottom);
|
240
|
+
|
241
|
+
var parentHeight = object.parentElement.offsetHeight - parentPaddingTop - parentPaddingBottom - parentBorderTop - parentBorderBottom;
|
242
|
+
//var parentHeight = getPixelHeight(object.parentElement,object.parentElement.currentStyle.height);
|
243
|
+
|
244
|
+
value = (parseFloat(value) / 100) * parentHeight;
|
245
|
+
}
|
246
|
+
else {
|
247
|
+
value = "auto";
|
248
|
+
}
|
249
|
+
break;
|
250
|
+
|
251
|
+
case 'HTML':
|
252
|
+
parentHeight = element.document.documentElement.clientHeight;
|
253
|
+
if(parentHeight !== "auto"){
|
254
|
+
value = (parseFloat(value) / 100) * parentHeight;
|
255
|
+
}
|
256
|
+
else {
|
257
|
+
value = "auto";
|
258
|
+
}
|
259
|
+
break;
|
260
|
+
}
|
261
|
+
if(value !== "auto") value = parseInt(value);
|
262
|
+
}
|
263
|
+
else {
|
264
|
+
value = "auto";
|
265
|
+
}
|
266
|
+
}
|
267
|
+
catch(e){
|
268
|
+
value = "auto";
|
269
|
+
}
|
270
|
+
return value;
|
271
|
+
}
|
272
|
+
|
273
|
+
// For EM Values
|
274
|
+
var style = object.style.left;
|
275
|
+
var runtimeStyle = object.runtimeStyle.left;
|
276
|
+
object.runtimeStyle.left = object.currentStyle.left;
|
277
|
+
object.style.left = value || 0;
|
278
|
+
value = parseInt(object.style.pixelLeft);
|
279
|
+
object.style.left = style;
|
280
|
+
object.runtimeStyle.left = runtimeStyle;
|
281
|
+
|
282
|
+
return value;
|
283
|
+
}
|
284
|
+
|
285
|
+
|
286
|
+
/*
|
287
|
+
* getBorderWidth & friends
|
288
|
+
* Border width getters
|
289
|
+
*/
|
290
|
+
function getBorderWidth(sSide){
|
291
|
+
if(element.currentStyle["border" + sSide + "Style"] == "none"){
|
292
|
+
return 0;
|
293
|
+
}
|
294
|
+
var n = getPixelValue(element.currentStyle["border" + sSide + "Width"]);
|
295
|
+
return n || 0;
|
296
|
+
}
|
297
|
+
function getBorderLeftWidth() { return getBorderWidth("Left"); }
|
298
|
+
function getBorderRightWidth() { return getBorderWidth("Right"); }
|
299
|
+
function getBorderTopWidth() { return getBorderWidth("Top"); }
|
300
|
+
function getBorderBottomWidth() { return getBorderWidth("Bottom"); }
|
301
|
+
|
302
|
+
|
303
|
+
/*
|
304
|
+
* getPadding & friends
|
305
|
+
* Padding width getters
|
306
|
+
*/
|
307
|
+
function getPadding(sSide) {
|
308
|
+
var n = getPixelValue(element.currentStyle["padding" + sSide]);
|
309
|
+
return n || 0;
|
310
|
+
}
|
311
|
+
function getPaddingLeft() { return getPadding("Left"); }
|
312
|
+
function getPaddingRight() { return getPadding("Right"); }
|
313
|
+
function getPaddingTop() { return getPadding("Top"); }
|
314
|
+
function getPaddingBottom() { return getPadding("Bottom"); }
|
315
|
+
|
316
|
+
|
317
|
+
|
318
|
+
/*
|
319
|
+
* getBoxSizing
|
320
|
+
* Get the box-sizing value for the current element
|
321
|
+
*/
|
322
|
+
function getBoxSizing(){
|
323
|
+
var s = element.style;
|
324
|
+
var cs = element.currentStyle
|
325
|
+
if(typeof s.boxSizing != "undefined" && s.boxSizing != ""){
|
326
|
+
return s.boxSizing;
|
327
|
+
}
|
328
|
+
if(typeof s["box-sizing"] != "undefined" && s["box-sizing"] != ""){
|
329
|
+
return s["box-sizing"];
|
330
|
+
}
|
331
|
+
if(typeof cs.boxSizing != "undefined" && cs.boxSizing != ""){
|
332
|
+
return cs.boxSizing;
|
333
|
+
}
|
334
|
+
if(typeof cs["box-sizing"] != "undefined" && cs["box-sizing"] != ""){
|
335
|
+
return cs["box-sizing"];
|
336
|
+
}
|
337
|
+
return getDocumentBoxSizing();
|
338
|
+
}
|
339
|
+
|
340
|
+
|
341
|
+
/*
|
342
|
+
* getDocumentBoxSizing
|
343
|
+
* Get the default document box sizing (check for quirks mode)
|
344
|
+
*/
|
345
|
+
function getDocumentBoxSizing(){
|
346
|
+
if(doc.compatMode === null || doc.compatMode === "BackCompat"){
|
347
|
+
return "border-box";
|
348
|
+
}
|
349
|
+
return "content-box"
|
350
|
+
}
|
351
|
+
|
352
|
+
|
353
|
+
/*
|
354
|
+
* setBorderBoxWidth & friends
|
355
|
+
* Width and height setters
|
356
|
+
*/
|
357
|
+
function setBorderBoxWidth(n){
|
358
|
+
element.runtimeStyle.width = Math.max(0, n - getBorderLeftWidth() -
|
359
|
+
getPaddingLeft() - getPaddingRight() - getBorderRightWidth()) + "px";
|
360
|
+
}
|
361
|
+
function setBorderBoxMinWidth(n){
|
362
|
+
element.runtimeStyle.minWidth = Math.max(0, n - getBorderLeftWidth() -
|
363
|
+
getPaddingLeft() - getPaddingRight() - getBorderRightWidth()) + "px";
|
364
|
+
}
|
365
|
+
function setBorderBoxMaxWidth(n){
|
366
|
+
element.runtimeStyle.maxWidth = Math.max(0, n - getBorderLeftWidth() -
|
367
|
+
getPaddingLeft() - getPaddingRight() - getBorderRightWidth()) + "px";
|
368
|
+
}
|
369
|
+
function setBorderBoxHeight(n){
|
370
|
+
element.runtimeStyle.height = Math.max(0, n - getBorderTopWidth() -
|
371
|
+
getPaddingTop() - getPaddingBottom() - getBorderBottomWidth()) + "px";
|
372
|
+
}
|
373
|
+
function setBorderBoxMinHeight(n){
|
374
|
+
element.runtimeStyle.minHeight = Math.max(0, n - getBorderTopWidth() -
|
375
|
+
getPaddingTop() - getPaddingBottom() - getBorderBottomWidth()) + "px";
|
376
|
+
}
|
377
|
+
function setBorderBoxMaxHeight(n){
|
378
|
+
element.runtimeStyle.maxHeight = Math.max(0, n - getBorderTopWidth() -
|
379
|
+
getPaddingTop() - getPaddingBottom() - getBorderBottomWidth()) + "px";
|
380
|
+
}
|
381
|
+
function setContentBoxWidth(n){
|
382
|
+
element.runtimeStyle.width = Math.max(0, n + getBorderLeftWidth() +
|
383
|
+
getPaddingLeft() + getPaddingRight() + getBorderRightWidth()) + "px";
|
384
|
+
}
|
385
|
+
function setContentBoxMinWidth(n){
|
386
|
+
element.runtimeStyle.minWidth = Math.max(0, n + getBorderLeftWidth() +
|
387
|
+
getPaddingLeft() + getPaddingRight() + getBorderRightWidth()) + "px";
|
388
|
+
}
|
389
|
+
function setContentBoxMaxWidth(n){
|
390
|
+
element.runtimeStyle.maxWidth = Math.max(0, n + getBorderLeftWidth() +
|
391
|
+
getPaddingLeft() + getPaddingRight() + getBorderRightWidth()) + "px";
|
392
|
+
}
|
393
|
+
function setContentBoxHeight(n){
|
394
|
+
element.runtimeStyle.height = Math.max(0, n + getBorderTopWidth() +
|
395
|
+
getPaddingTop() + getPaddingBottom() + getBorderBottomWidth()) + "px";
|
396
|
+
}
|
397
|
+
function setContentBoxMinHeight(n){
|
398
|
+
element.runtimeStyle.minHeight = Math.max(0, n + getBorderTopWidth() +
|
399
|
+
getPaddingTop() + getPaddingBottom() + getBorderBottomWidth()) + "px";
|
400
|
+
}
|
401
|
+
function setContentBoxMaxHeight(n){
|
402
|
+
element.runtimeStyle.maxHeight = Math.max(0, n + getBorderTopWidth() +
|
403
|
+
getPaddingTop() + getPaddingBottom() + getBorderBottomWidth()) + "px";
|
404
|
+
}
|
405
|
+
|
406
|
+
|
407
|
+
/*
|
408
|
+
* updateBorderBoxWidth & updateBorderBoxHeight
|
409
|
+
*
|
410
|
+
*/
|
411
|
+
function updateBorderBoxWidth() {
|
412
|
+
if(getDocumentBoxSizing() == getBoxSizing()){
|
413
|
+
return;
|
414
|
+
}
|
415
|
+
|
416
|
+
var csw = element.currentStyle.width;
|
417
|
+
if(csw != "auto"){
|
418
|
+
csw = getPixelWidth(element,csw);
|
419
|
+
if(getBoxSizing() == "border-box"){
|
420
|
+
setBorderBoxWidth(parseInt(csw));
|
421
|
+
}
|
422
|
+
else{
|
423
|
+
setContentBoxWidth(parseInt(csw));
|
424
|
+
}
|
425
|
+
}
|
426
|
+
|
427
|
+
csw = element.currentStyle.minWidth;
|
428
|
+
if(csw != "none"){
|
429
|
+
csw = getPixelWidth(element,csw);
|
430
|
+
if(getBoxSizing() == "border-box"){
|
431
|
+
setBorderBoxMinWidth(parseInt(csw));
|
432
|
+
}
|
433
|
+
else{
|
434
|
+
setContentBoxMinWidth(parseInt(csw));
|
435
|
+
}
|
436
|
+
}
|
437
|
+
|
438
|
+
csw = element.currentStyle.maxWidth;
|
439
|
+
if(csw != "none"){
|
440
|
+
csw = getPixelWidth(element,csw);
|
441
|
+
if(getBoxSizing() == "border-box"){
|
442
|
+
setBorderBoxMaxWidth(parseInt(csw));
|
443
|
+
}
|
444
|
+
else{
|
445
|
+
setContentBoxMaxWidth(parseInt(csw));
|
446
|
+
}
|
447
|
+
}
|
448
|
+
}
|
449
|
+
|
450
|
+
function updateBorderBoxHeight() {
|
451
|
+
if(getDocumentBoxSizing() == getBoxSizing()){
|
452
|
+
return;
|
453
|
+
}
|
454
|
+
|
455
|
+
var csh = element.currentStyle.height;
|
456
|
+
if(csh != "auto"){
|
457
|
+
csh = getPixelHeight(element,csh);
|
458
|
+
if(csh !== "auto"){
|
459
|
+
if(getBoxSizing() == "border-box"){
|
460
|
+
setBorderBoxHeight(parseInt(csh));
|
461
|
+
}
|
462
|
+
else{
|
463
|
+
setContentBoxHeight(parseInt(csh));
|
464
|
+
}
|
465
|
+
}
|
466
|
+
}
|
467
|
+
|
468
|
+
csh = element.currentStyle.minHeight;
|
469
|
+
if(csh != "none"){
|
470
|
+
csh = getPixelHeight(element,csh);
|
471
|
+
if(csh !== "none"){
|
472
|
+
if(getBoxSizing() == "border-box"){
|
473
|
+
setBorderBoxMinHeight(parseInt(csh));
|
474
|
+
}
|
475
|
+
else{
|
476
|
+
setContentBoxMinHeight(parseInt(csh));
|
477
|
+
}
|
478
|
+
}
|
479
|
+
}
|
480
|
+
|
481
|
+
csh = element.currentStyle.maxHeight;
|
482
|
+
if(csh != "none"){
|
483
|
+
csh = getPixelHeight(element,csh);
|
484
|
+
if(csh !== "none"){
|
485
|
+
if(getBoxSizing() == "border-box"){
|
486
|
+
setBorderBoxMaxHeight(parseInt(csh));
|
487
|
+
}
|
488
|
+
else{
|
489
|
+
setContentBoxMaxHeight(parseInt(csh));
|
490
|
+
}
|
491
|
+
}
|
492
|
+
}
|
493
|
+
}
|
494
|
+
|
495
|
+
|
496
|
+
// Run the calculations
|
497
|
+
init();
|
498
|
+
|
499
|
+
//]]>
|
500
|
+
</script>
|
501
|
+
</component>
|