toolkit 1.3.8 → 2.0.0.alpha.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -7
- data/lib/toolkit.rb +1 -13
- data/stylesheets/_toolkit.scss +12 -68
- data/stylesheets/toolkit/_clearfix.scss +11 -95
- data/stylesheets/toolkit/_colors.scss +89 -1
- data/stylesheets/toolkit/_element-query.scss +13 -5
- data/stylesheets/toolkit/_fonts.scss +26 -8
- data/stylesheets/toolkit/_intrinsic-ratio.scss +15 -10
- data/stylesheets/toolkit/_kickstart.scss +14 -0
- data/stylesheets/toolkit/_nested-context.scss +8 -7
- data/stylesheets/toolkit/_pe.scss +19 -226
- data/stylesheets/toolkit/_selectors.scss +0 -25
- data/stylesheets/toolkit/_settings.scss +90 -0
- data/stylesheets/toolkit/_triangle.scss +7 -2
- data/stylesheets/toolkit/_viewport.scss +6 -16
- metadata +46 -105
- data/stylesheets/_toolkit-no-css.scss +0 -69
- data/stylesheets/toolkit/_border-box.scss +0 -6
- data/stylesheets/toolkit/_box-sizing.scss +0 -42
- data/stylesheets/toolkit/_carousel.scss +0 -155
- data/stylesheets/toolkit/_children-of-ie.scss +0 -26
- data/stylesheets/toolkit/_colours.scss +0 -102
- data/stylesheets/toolkit/_debug.scss +0 -25
- data/stylesheets/toolkit/_equal-height-columns.scss +0 -56
- data/stylesheets/toolkit/_fluid-media.scss +0 -7
- data/stylesheets/toolkit/_vertical-center.scss +0 -23
- data/templates/box-sizing/behaviors/box-sizing/boxsizing.htc +0 -399
- data/templates/box-sizing/behaviors/box-sizing/boxsizing.php +0 -23
- data/templates/box-sizing/manifest.rb +0 -4
- data/templates/project/_base.scss +0 -26
- data/templates/project/manifest.rb +0 -57
- data/templates/rwd/_base.scss +0 -27
- data/templates/rwd/manifest.rb +0 -60
- data/templates/shared/_design.scss +0 -9
- data/templates/shared/_extendables.scss +0 -6
- data/templates/shared/_functions.scss +0 -5
- data/templates/shared/_ie-design.scss +0 -9
- data/templates/shared/_ie-layout.scss +0 -9
- data/templates/shared/_layout.scss +0 -9
- data/templates/shared/_mixins.scss +0 -5
- data/templates/shared/_print-design.scss +0 -9
- data/templates/shared/_print-layout.scss +0 -9
- data/templates/shared/_style-guide.scss +0 -10
- data/templates/shared/_variables.scss +0 -5
- data/templates/shared/ie.scss +0 -32
- data/templates/shared/print.scss +0 -28
- data/templates/shared/style.scss +0 -31
@@ -1,26 +0,0 @@
|
|
1
|
-
////////////////////////
|
2
|
-
// nth-child() support for IE 7 and 8
|
3
|
-
////////////////////////
|
4
|
-
|
5
|
-
@function nth-child($n) {
|
6
|
-
|
7
|
-
// If a single number for nth.
|
8
|
-
@if type-of($n) == number {
|
9
|
-
$nth-child: first-child;
|
10
|
-
@for $i from 2 through $n {
|
11
|
-
$nth-child: append($nth-child, #{"+*"});
|
12
|
-
}
|
13
|
-
@return #{":"}$nth-child;
|
14
|
-
}
|
15
|
-
|
16
|
-
// If a nth-child string, need to parse the string.
|
17
|
-
@else {
|
18
|
-
$n: nth(children-of-ie-nth($n), 1);
|
19
|
-
$nth-child: first-child;
|
20
|
-
@for $i from 2 through $n {
|
21
|
-
$nth-child: append($nth-child, #{"~*"});
|
22
|
-
}
|
23
|
-
@return #{":"}$nth-child;
|
24
|
-
}
|
25
|
-
}
|
26
|
-
|
@@ -1,102 +0,0 @@
|
|
1
|
-
//////////////////////////////
|
2
|
-
// Compass Extension Imports
|
3
|
-
//////////////////////////////
|
4
|
-
@import 'color-schemer';
|
5
|
-
|
6
|
-
/// Tint and Shade
|
7
|
-
@function tint($colour, $amount) {
|
8
|
-
@return mix(#fff, $colour, $amount);
|
9
|
-
}
|
10
|
-
|
11
|
-
@function shade($colour, $amount) {
|
12
|
-
@return mix(#000, $colour, $amount);
|
13
|
-
}
|
14
|
-
|
15
|
-
$color-stack-amounts: 25%, 50%, 75%, 85%, 90% !default;
|
16
|
-
$colour-stack-amounts: $color-stack-amounts !default;
|
17
|
-
|
18
|
-
// Create a colour stack using the given colours and tints
|
19
|
-
@function colour-stack($main, $secondary, $amounts...) {
|
20
|
-
@if length($amounts) == 0 {
|
21
|
-
$amounts: $colour-stack-amounts;
|
22
|
-
}
|
23
|
-
@else if length($amounts) == 1 {
|
24
|
-
$amounts: nth($amounts, 1);
|
25
|
-
}
|
26
|
-
|
27
|
-
$stack: $main;
|
28
|
-
|
29
|
-
@each $amount in $amounts {
|
30
|
-
$stack: join($stack, mix($secondary, nth($stack, 1), $amount));
|
31
|
-
}
|
32
|
-
|
33
|
-
@return $stack;
|
34
|
-
}
|
35
|
-
|
36
|
-
@function color-stack($main, $secondary, $amounts...) {
|
37
|
-
@if length($amounts) > 0 {
|
38
|
-
@return colour-stack($main, $secondary, $amounts);
|
39
|
-
}
|
40
|
-
@else {
|
41
|
-
@return colour-stack($main, $secondary);
|
42
|
-
}
|
43
|
-
}
|
44
|
-
|
45
|
-
@function tint-stack($colour, $amounts...) {
|
46
|
-
@if length($amounts) > 0 {
|
47
|
-
@return colour-stack($colour, #fff, $amounts);
|
48
|
-
}
|
49
|
-
@else {
|
50
|
-
@return colour-stack($colour, #fff);
|
51
|
-
}
|
52
|
-
}
|
53
|
-
|
54
|
-
@function shade-stack($colour, $amounts...) {
|
55
|
-
@if length($amounts) > 0 {
|
56
|
-
@return colour-stack($colour, #000, $amounts);
|
57
|
-
}
|
58
|
-
@else {
|
59
|
-
@return colour-stack($colour, #000);
|
60
|
-
}
|
61
|
-
}
|
62
|
-
|
63
|
-
//////////////////////////////
|
64
|
-
// Creates an even scale from one color to another
|
65
|
-
//////////////////////////////
|
66
|
-
$color-scale-shades: 6 !default;
|
67
|
-
$colour-scale-shades: $color-scale-shades !default;
|
68
|
-
|
69
|
-
@function colour-scale($main, $secondary, $shades: $colour-scale-shades) {
|
70
|
-
@return color-scale($main, $secondary, $shades);
|
71
|
-
}
|
72
|
-
|
73
|
-
@function color-scale($main, $secondary, $shades: $color-scale-shades) {
|
74
|
-
$list: $main;
|
75
|
-
|
76
|
-
|
77
|
-
$red1: red($main);
|
78
|
-
$red2: red($secondary);
|
79
|
-
$red-diff: (($red1 - $red2) / (($shades - 1)));
|
80
|
-
|
81
|
-
$grn1: green($main);
|
82
|
-
$grn2: green($secondary);
|
83
|
-
$grn-diff: (($grn1 - $grn2) / (($shades - 1)));
|
84
|
-
|
85
|
-
$blu1: blue($main);
|
86
|
-
$blu2: blue($secondary);
|
87
|
-
$blu-diff: (($blu1 - $blu2) / (($shades - 1)));
|
88
|
-
|
89
|
-
$red-hold: $red1;
|
90
|
-
$grn-hold: $grn1;
|
91
|
-
$blu-hold: $blu1;
|
92
|
-
|
93
|
-
@for $i from 2 through $shades {
|
94
|
-
$red-hold: $red-hold - ($red-diff);
|
95
|
-
$grn-hold: $grn-hold - ($grn-diff);
|
96
|
-
$blu-hold: $blu-hold - ($blu-diff);
|
97
|
-
$color-hold: rgb($red-hold, $grn-hold, $blu-hold);
|
98
|
-
$list: append($list, $color-hold);
|
99
|
-
}
|
100
|
-
|
101
|
-
@return $list;
|
102
|
-
}
|
@@ -1,25 +0,0 @@
|
|
1
|
-
//////////////////////////////
|
2
|
-
// Debugging
|
3
|
-
//////////////////////////////
|
4
|
-
$debug-extend: true !default;
|
5
|
-
$debug-color-default: red !default;
|
6
|
-
$debug-bkg-color-default: false !default;
|
7
|
-
|
8
|
-
@mixin debug($color: $debug-color, $bkg-color: false, $extend: $debug-extend) {
|
9
|
-
@if ($color != $debug-color-default) or ($bkg-color != $debug-bkg-color-default) {
|
10
|
-
$extend: false;
|
11
|
-
}
|
12
|
-
@if $extend {
|
13
|
-
@extend %debug-extend;
|
14
|
-
}
|
15
|
-
@else {
|
16
|
-
outline: 1px solid $color;
|
17
|
-
@if $bkg-color != false {
|
18
|
-
background-color: $bkg-color;
|
19
|
-
}
|
20
|
-
}
|
21
|
-
}
|
22
|
-
|
23
|
-
%debug-extend {
|
24
|
-
@include debug($extend: true);
|
25
|
-
}
|
@@ -1,56 +0,0 @@
|
|
1
|
-
@import "compass/css3/images";
|
2
|
-
|
3
|
-
$equal-height-columns-direction: left !default;
|
4
|
-
|
5
|
-
//////////////////////////////
|
6
|
-
// Equal Height Columns
|
7
|
-
//
|
8
|
-
// Builds equal-height columns based on Dan Cederholm's Faux Columns method using CSS3 Gradients
|
9
|
-
// Can be used to build fluid or fixed backgrounds, depending on widths passed in.
|
10
|
-
// http://alistapart.com/article/fauxcolumns
|
11
|
-
//////////////////////////////
|
12
|
-
@mixin equal-height-columns($widths, $colors, $direction: $equal-height-columns-direction) {
|
13
|
-
@if (length($widths) != length($colors)) and (length($widths) != length($colors) - 1) {
|
14
|
-
@warn 'You either need an equal number of widths and colors or one less width than color, in which case it is assumed that the last width goes to 100%. Please provide the correct amount of widths and colors.';
|
15
|
-
}
|
16
|
-
@else {
|
17
|
-
$stops: ();
|
18
|
-
|
19
|
-
@if length($widths) == (length($colors) - 1) {
|
20
|
-
$widths: append($widths, 100%);
|
21
|
-
}
|
22
|
-
|
23
|
-
$i: 1;
|
24
|
-
|
25
|
-
@each $width in $widths {
|
26
|
-
$width: nth($widths, $i);
|
27
|
-
$color: nth($colors, $i);
|
28
|
-
|
29
|
-
@if $i == 1 {
|
30
|
-
$stops: join($stops, build-gradient-piece($width, $color), comma);
|
31
|
-
}
|
32
|
-
@else {
|
33
|
-
$position: nth($widths, $i - 1);
|
34
|
-
$stops: join($stops, build-gradient-piece($width, $color, $position), comma);
|
35
|
-
}
|
36
|
-
|
37
|
-
$i: $i + 1;
|
38
|
-
}
|
39
|
-
|
40
|
-
@include background-image(
|
41
|
-
linear-gradient($direction, $stops)
|
42
|
-
);
|
43
|
-
}
|
44
|
-
}
|
45
|
-
|
46
|
-
@function build-gradient-piece($width, $color, $position: false) {
|
47
|
-
@if ($position == 'last') {
|
48
|
-
@return ($color $width);
|
49
|
-
}
|
50
|
-
@else if ($position != false) {
|
51
|
-
@return $color $position, $color $width;
|
52
|
-
}
|
53
|
-
@else {
|
54
|
-
@return $color, $color $width;
|
55
|
-
}
|
56
|
-
}
|
@@ -1,23 +0,0 @@
|
|
1
|
-
$legacy-support-for-ie: true !default;
|
2
|
-
|
3
|
-
//////////////////////////////
|
4
|
-
// Vertical Align of content with IE fallback
|
5
|
-
//
|
6
|
-
// Adapted from http://css-tricks.com/vertically-center-multi-lined-text/
|
7
|
-
//////////////////////////////
|
8
|
-
@mixin vertical-center {
|
9
|
-
display: table-cell;
|
10
|
-
vertical-align: middle;
|
11
|
-
|
12
|
-
@if $legacy-support-for-ie {
|
13
|
-
margin-top: inherit;
|
14
|
-
*clear: expression(
|
15
|
-
style.marginTop = "" + (offsetHeight < parentNode.offsetHeight ? parseInt((parentNode.offsetHeight - offsetHeight) / 2) + "px" : "0"),
|
16
|
-
style.clear = "none", 0
|
17
|
-
);
|
18
|
-
}
|
19
|
-
}
|
20
|
-
|
21
|
-
%vertical-center {
|
22
|
-
@include vertical-center;
|
23
|
-
}
|
@@ -1,399 +0,0 @@
|
|
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
|
-
element.runtimeStyle.removeAttribute("width");
|
100
|
-
element.runtimeStyle.removeAttribute("height");
|
101
|
-
}
|
102
|
-
}
|
103
|
-
|
104
|
-
/*
|
105
|
-
* init gets called once at the start and then never again,
|
106
|
-
* triggers box-sizing calculations and updates width and height
|
107
|
-
*/
|
108
|
-
function init(){
|
109
|
-
if(apply){
|
110
|
-
updateBorderBoxWidth();
|
111
|
-
updateBorderBoxHeight();
|
112
|
-
}
|
113
|
-
}
|
114
|
-
|
115
|
-
/*
|
116
|
-
* checkPropertyChange gets called as soon as an element property changes
|
117
|
-
* (see event binding at the top), it then checks if any property influencing its
|
118
|
-
* dimensions was changed and if yes recalculates width and height
|
119
|
-
*/
|
120
|
-
function checkPropertyChange(){
|
121
|
-
if(apply){
|
122
|
-
var pn = event.propertyName;
|
123
|
-
if(pn === "style.boxSizing" && element.style.boxSizing === ""){
|
124
|
-
element.style.removeAttribute("boxSizing");
|
125
|
-
element.runtimeStyle.removeAttribute("boxSizing");
|
126
|
-
element.runtimeStyle.removeAttribute("width");
|
127
|
-
element.runtimeStyle.removeAttribute("height");
|
128
|
-
}
|
129
|
-
switch (pn){
|
130
|
-
case "style.width":
|
131
|
-
case "style.borderLeftWidth":
|
132
|
-
case "style.borderLeftStyle":
|
133
|
-
case "style.borderRightWidth":
|
134
|
-
case "style.borderRightStyle":
|
135
|
-
case "style.paddingLeft":
|
136
|
-
case "style.paddingRight":
|
137
|
-
updateBorderBoxWidth();
|
138
|
-
break;
|
139
|
-
|
140
|
-
case "style.height":
|
141
|
-
case "style.borderTopWidth":
|
142
|
-
case "style.borderTopStyle":
|
143
|
-
case "style.borderBottomWidth":
|
144
|
-
case "style.borderBottomStyle":
|
145
|
-
case "style.paddingTop":
|
146
|
-
case "style.paddingBottom":
|
147
|
-
updateBorderBoxHeight();
|
148
|
-
break;
|
149
|
-
|
150
|
-
case "className":
|
151
|
-
case "style.boxSizing":
|
152
|
-
updateBorderBoxWidth();
|
153
|
-
updateBorderBoxHeight();
|
154
|
-
break;
|
155
|
-
}
|
156
|
-
}
|
157
|
-
}
|
158
|
-
|
159
|
-
/*
|
160
|
-
* Helper function, taken from Dean Edward's IE7 framework,
|
161
|
-
* added by Schepp on 12.06.2010.
|
162
|
-
* http://code.google.com/p/ie7-js/
|
163
|
-
*
|
164
|
-
* Allows us to convert from relative to pixel-values.
|
165
|
-
*/
|
166
|
-
function getPixelValue(value){
|
167
|
-
var PIXEL = /^\d+(px)?$/i;
|
168
|
-
if (PIXEL.test(value)) return parseInt(value);
|
169
|
-
var style = element.style.left;
|
170
|
-
var runtimeStyle = element.runtimeStyle.left;
|
171
|
-
element.runtimeStyle.left = element.currentStyle.left;
|
172
|
-
element.style.left = value || 0;
|
173
|
-
value = parseInt(element.style.pixelLeft);
|
174
|
-
element.style.left = style;
|
175
|
-
element.runtimeStyle.left = runtimeStyle;
|
176
|
-
|
177
|
-
return value;
|
178
|
-
}
|
179
|
-
|
180
|
-
function getPixelWidth(object, value){
|
181
|
-
// For Pixel Values
|
182
|
-
var PIXEL = /^\d+(px)?$/i;
|
183
|
-
if (PIXEL.test(value)) return parseInt(value);
|
184
|
-
|
185
|
-
// For Percentage Values
|
186
|
-
var PERCENT = /^[\d\.]+%$/i;
|
187
|
-
if (PERCENT.test(value)){
|
188
|
-
try{
|
189
|
-
parentWidth = getPixelWidth(object.parentElement,(object.parentElement.currentStyle.width != "auto" ? object.parentElement.currentStyle.width : "100%"));
|
190
|
-
value = (parseFloat(value) / 100) * parentWidth;
|
191
|
-
}
|
192
|
-
catch(e){
|
193
|
-
value = (parseFloat(value) / 100) * element.document.documentElement.clientWidth;
|
194
|
-
}
|
195
|
-
return parseInt(value);
|
196
|
-
}
|
197
|
-
|
198
|
-
// For EM Values
|
199
|
-
var style = object.style.left;
|
200
|
-
var runtimeStyle = object.runtimeStyle.left;
|
201
|
-
object.runtimeStyle.left = object.currentStyle.left;
|
202
|
-
object.style.left = value || 0;
|
203
|
-
value = parseInt(object.style.pixelLeft);
|
204
|
-
object.style.left = style;
|
205
|
-
object.runtimeStyle.left = runtimeStyle;
|
206
|
-
|
207
|
-
return value;
|
208
|
-
}
|
209
|
-
|
210
|
-
function getPixelHeight(object, value){
|
211
|
-
// For Pixel Values
|
212
|
-
var PIXEL = /^\d+(px)?$/i;
|
213
|
-
if (PIXEL.test(value)) return parseInt(value);
|
214
|
-
|
215
|
-
// For Percentage Values
|
216
|
-
var PERCENT = /^[\d\.]+%$/i;
|
217
|
-
if (PERCENT.test(value)){
|
218
|
-
try{
|
219
|
-
if(object.parentElement.currentStyle.height != "auto"){
|
220
|
-
switch(object.parentElement.nodeName){
|
221
|
-
default:
|
222
|
-
parentHeight = getPixelHeight(object.parentElement,object.parentElement.currentStyle.height);
|
223
|
-
if(parentHeight !== "auto"){
|
224
|
-
value = (parseFloat(value) / 100) * parentHeight;
|
225
|
-
}
|
226
|
-
else {
|
227
|
-
value = "auto";
|
228
|
-
}
|
229
|
-
break;
|
230
|
-
|
231
|
-
case 'HTML':
|
232
|
-
parentHeight = element.document.documentElement.clientHeight;
|
233
|
-
if(parentHeight !== "auto"){
|
234
|
-
value = (parseFloat(value) / 100) * parentHeight;
|
235
|
-
}
|
236
|
-
else {
|
237
|
-
value = "auto";
|
238
|
-
}
|
239
|
-
break;
|
240
|
-
}
|
241
|
-
if(value !== "auto") value = parseInt(value);
|
242
|
-
}
|
243
|
-
else {
|
244
|
-
value = "auto";
|
245
|
-
}
|
246
|
-
}
|
247
|
-
catch(e){
|
248
|
-
value = "auto";
|
249
|
-
}
|
250
|
-
return value;
|
251
|
-
}
|
252
|
-
|
253
|
-
// For EM Values
|
254
|
-
var style = object.style.left;
|
255
|
-
var runtimeStyle = object.runtimeStyle.left;
|
256
|
-
object.runtimeStyle.left = object.currentStyle.left;
|
257
|
-
object.style.left = value || 0;
|
258
|
-
value = parseInt(object.style.pixelLeft);
|
259
|
-
object.style.left = style;
|
260
|
-
object.runtimeStyle.left = runtimeStyle;
|
261
|
-
|
262
|
-
return value;
|
263
|
-
}
|
264
|
-
|
265
|
-
|
266
|
-
/*
|
267
|
-
* getBorderWidth & friends
|
268
|
-
* Border width getters
|
269
|
-
*/
|
270
|
-
function getBorderWidth(sSide){
|
271
|
-
if(element.currentStyle["border" + sSide + "Style"] == "none"){
|
272
|
-
return 0;
|
273
|
-
}
|
274
|
-
var n = getPixelValue(element.currentStyle["border" + sSide + "Width"]);
|
275
|
-
return n || 0;
|
276
|
-
}
|
277
|
-
function getBorderLeftWidth() { return getBorderWidth("Left"); }
|
278
|
-
function getBorderRightWidth() { return getBorderWidth("Right"); }
|
279
|
-
function getBorderTopWidth() { return getBorderWidth("Top"); }
|
280
|
-
function getBorderBottomWidth() { return getBorderWidth("Bottom"); }
|
281
|
-
|
282
|
-
|
283
|
-
/*
|
284
|
-
* getPadding & friends
|
285
|
-
* Padding width getters
|
286
|
-
*/
|
287
|
-
function getPadding(sSide) {
|
288
|
-
var n = getPixelValue(element.currentStyle["padding" + sSide]);
|
289
|
-
return n || 0;
|
290
|
-
}
|
291
|
-
function getPaddingLeft() { return getPadding("Left"); }
|
292
|
-
function getPaddingRight() { return getPadding("Right"); }
|
293
|
-
function getPaddingTop() { return getPadding("Top"); }
|
294
|
-
function getPaddingBottom() { return getPadding("Bottom"); }
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
/*
|
299
|
-
* getBoxSizing
|
300
|
-
* Get the box-sizing value for the current element
|
301
|
-
*/
|
302
|
-
function getBoxSizing(){
|
303
|
-
var s = element.style;
|
304
|
-
var cs = element.currentStyle
|
305
|
-
if(typeof s.boxSizing != "undefined" && s.boxSizing != ""){
|
306
|
-
return s.boxSizing;
|
307
|
-
}
|
308
|
-
if(typeof s["box-sizing"] != "undefined" && s["box-sizing"] != ""){
|
309
|
-
return s["box-sizing"];
|
310
|
-
}
|
311
|
-
if(typeof cs.boxSizing != "undefined" && cs.boxSizing != ""){
|
312
|
-
return cs.boxSizing;
|
313
|
-
}
|
314
|
-
if(typeof cs["box-sizing"] != "undefined" && cs["box-sizing"] != ""){
|
315
|
-
return cs["box-sizing"];
|
316
|
-
}
|
317
|
-
return getDocumentBoxSizing();
|
318
|
-
}
|
319
|
-
|
320
|
-
|
321
|
-
/*
|
322
|
-
* getDocumentBoxSizing
|
323
|
-
* Get the default document box sizing (check for quirks mode)
|
324
|
-
*/
|
325
|
-
function getDocumentBoxSizing(){
|
326
|
-
if(doc.compatMode === null || doc.compatMode === "BackCompat"){
|
327
|
-
return "border-box";
|
328
|
-
}
|
329
|
-
return "content-box"
|
330
|
-
}
|
331
|
-
|
332
|
-
|
333
|
-
/*
|
334
|
-
* setBorderBoxWidth & friends
|
335
|
-
* Width and height setters
|
336
|
-
*/
|
337
|
-
function setBorderBoxWidth(n){
|
338
|
-
element.runtimeStyle.width = Math.max(0, n - getBorderLeftWidth() -
|
339
|
-
getPaddingLeft() - getPaddingRight() - getBorderRightWidth()) + "px";
|
340
|
-
}
|
341
|
-
function setBorderBoxHeight(n){
|
342
|
-
element.runtimeStyle.height = Math.max(0, n - getBorderTopWidth() -
|
343
|
-
getPaddingTop() - getPaddingBottom() - getBorderBottomWidth()) + "px";
|
344
|
-
}
|
345
|
-
function setContentBoxWidth(n){
|
346
|
-
element.runtimeStyle.width = Math.max(0, n + getBorderLeftWidth() +
|
347
|
-
getPaddingLeft() + getPaddingRight() + getBorderRightWidth()) + "px";
|
348
|
-
}
|
349
|
-
function setContentBoxHeight(n){
|
350
|
-
element.runtimeStyle.height = Math.max(0, n + getBorderTopWidth() +
|
351
|
-
getPaddingTop() + getPaddingBottom() + getBorderBottomWidth()) + "px";
|
352
|
-
}
|
353
|
-
|
354
|
-
|
355
|
-
/*
|
356
|
-
* updateBorderBoxWidth & updateBorderBoxHeight
|
357
|
-
*
|
358
|
-
*/
|
359
|
-
function updateBorderBoxWidth() {
|
360
|
-
if(getDocumentBoxSizing() == getBoxSizing()){
|
361
|
-
return;
|
362
|
-
}
|
363
|
-
var csw = element.currentStyle.width;
|
364
|
-
if(csw != "auto"){
|
365
|
-
csw = getPixelWidth(element,csw);
|
366
|
-
if(getBoxSizing() == "border-box"){
|
367
|
-
setBorderBoxWidth(parseInt(csw));
|
368
|
-
}
|
369
|
-
else{
|
370
|
-
setContentBoxWidth(parseInt(csw));
|
371
|
-
}
|
372
|
-
}
|
373
|
-
}
|
374
|
-
|
375
|
-
function updateBorderBoxHeight() {
|
376
|
-
if(getDocumentBoxSizing() == getBoxSizing()){
|
377
|
-
return;
|
378
|
-
}
|
379
|
-
var csh = element.currentStyle.height;
|
380
|
-
if(csh != "auto"){
|
381
|
-
csh = getPixelHeight(element,csh);
|
382
|
-
if(csh !== "auto"){
|
383
|
-
if(getBoxSizing() == "border-box"){
|
384
|
-
setBorderBoxHeight(parseInt(csh));
|
385
|
-
}
|
386
|
-
else{
|
387
|
-
setContentBoxHeight(parseInt(csh));
|
388
|
-
}
|
389
|
-
}
|
390
|
-
}
|
391
|
-
}
|
392
|
-
|
393
|
-
|
394
|
-
// Run the calculations
|
395
|
-
init();
|
396
|
-
|
397
|
-
//]]>
|
398
|
-
</script>
|
399
|
-
</component>
|