compass-aurora-os 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/aurora-os.rb +12 -0
- data/stylesheets/_aurora.scss +5 -0
- data/stylesheets/aurora/_singularity-grid.scss +2 -0
- data/stylesheets/aurora/_susy-grid.scss +2 -0
- data/stylesheets/aurora/_system.scss +24 -0
- data/stylesheets/drupal/_system.scss +19 -0
- data/stylesheets/drupal/_vertical-tabs.scss +196 -0
- data/templates/arcturus/arcturus.info.erb +69 -0
- data/templates/arcturus/manifest.rb +44 -0
- data/templates/arcturus/partials/global/_base.scss +24 -0
- data/templates/arcturus/partials/layouts/_layouts.scss +6 -0
- data/templates/arcturus/partials/modules/_modules.scss +6 -0
- data/templates/arcturus/partials/states/_states.scss +6 -0
- data/templates/arcturus/partials/styleguide/_style-guide.scss +19 -0
- data/templates/arcturus/print.scss +16 -0
- data/templates/arcturus/style.scss +41 -0
- data/templates/arcturus/template.php.erb +177 -0
- data/templates/bower/manifest.rb +20 -0
- data/templates/box-sizing/README-behaviors.md +4 -0
- data/templates/box-sizing/behaviors/box-sizing/boxsizing.htc +399 -0
- data/templates/box-sizing/behaviors/box-sizing/boxsizing.php +23 -0
- data/templates/box-sizing/manifest.rb +5 -0
- data/templates/corona/maintenance.scss +29 -0
- data/templates/corona/manifest.rb +47 -0
- data/templates/corona/partials/_base.scss +31 -0
- data/templates/corona/partials/_variables.scss +137 -0
- data/templates/corona/partials/design/_design.scss +4 -0
- data/templates/corona/partials/global/_defaults.scss +3 -0
- data/templates/corona/partials/global/_forms.scss +62 -0
- data/templates/corona/partials/global/_global.scss +11 -0
- data/templates/corona/partials/global/_type.scss +124 -0
- data/templates/corona/print.scss +16 -0
- data/templates/corona/style.scss +21 -0
- data/templates/grunt/manifest.rb +23 -0
- data/templates/polaris/manifest.rb +46 -0
- data/templates/polaris/partials/global/_base.scss +24 -0
- data/templates/polaris/partials/layouts/_layouts.scss +6 -0
- data/templates/polaris/partials/modules/_modules.scss +6 -0
- data/templates/polaris/partials/states/_states.scss +6 -0
- data/templates/polaris/partials/styleguide/_style-guide.scss +19 -0
- data/templates/polaris/print.scss +16 -0
- data/templates/polaris/style.scss +39 -0
- data/templates/project/manifest.rb +46 -0
- data/templates/project/partials/design/_design.scss +8 -0
- data/templates/project/partials/global/_base.scss +22 -0
- data/templates/project/partials/layout/_layout.scss +8 -0
- data/templates/project/partials/styleguide/_style-guide.scss +18 -0
- data/templates/project/print.scss +16 -0
- data/templates/project/style.scss +34 -0
- data/templates/shared/Gemfile.txt +16 -0
- data/templates/shared/Gruntfile.js.erb +159 -0
- data/templates/shared/README-Partials.md +82 -0
- data/templates/shared/README-Sass.md +77 -0
- data/templates/shared/README-templates.md +3 -0
- data/templates/shared/_extendables.scss +22 -0
- data/templates/shared/_functions.scss +5 -0
- data/templates/shared/_mixins.scss +5 -0
- data/templates/shared/_variables.scss +5 -0
- data/templates/shared/aurora.info.erb +69 -0
- data/templates/shared/bowerrc.txt +3 -0
- data/templates/shared/component.json.erb +8 -0
- data/templates/shared/config.rb.erb +40 -0
- data/templates/shared/editorconfig.txt +21 -0
- data/templates/shared/gitignore.txt +2 -0
- data/templates/shared/jshintrc.txt +24 -0
- data/templates/shared/package.json.erb +19 -0
- data/templates/shared/template.php.erb +180 -0
- metadata +229 -0
@@ -0,0 +1,16 @@
|
|
1
|
+
////////////////////////
|
2
|
+
// Print File
|
3
|
+
//
|
4
|
+
// This file gets turned into print.css.
|
5
|
+
// This file is styles specific to Printed files.
|
6
|
+
////////////////////////
|
7
|
+
|
8
|
+
////////////////////////
|
9
|
+
// Base Import
|
10
|
+
////////////////////////
|
11
|
+
@import 'partials/global/base';
|
12
|
+
|
13
|
+
|
14
|
+
////////////////////////
|
15
|
+
// Custom Code
|
16
|
+
////////////////////////
|
@@ -0,0 +1,41 @@
|
|
1
|
+
////////////////////////
|
2
|
+
// Style File
|
3
|
+
//
|
4
|
+
// This file gets turned into style.css.
|
5
|
+
// This file should really hold nothing except for imports of your base,
|
6
|
+
// style guide, layouts, modules, and states partials.
|
7
|
+
////////////////////////
|
8
|
+
|
9
|
+
//////////////////////////////
|
10
|
+
// Legacy Support Setup
|
11
|
+
//////////////////////////////
|
12
|
+
$legacy-support-for-ie6: false;
|
13
|
+
$legacy-support-for-ie7: false;
|
14
|
+
$legacy-support-for-ie8: true;
|
15
|
+
|
16
|
+
$legacy-support-for-mozilla: false;
|
17
|
+
|
18
|
+
////////////////////////
|
19
|
+
// Base Import
|
20
|
+
////////////////////////
|
21
|
+
@import 'partials/global/base';
|
22
|
+
|
23
|
+
////////////////////////
|
24
|
+
// Import Style Guide
|
25
|
+
////////////////////////
|
26
|
+
@import 'partials/styleguide/style-guide';
|
27
|
+
|
28
|
+
////////////////////////
|
29
|
+
// Import Layouts
|
30
|
+
////////////////////////
|
31
|
+
@import 'partials/layouts/layouts';
|
32
|
+
|
33
|
+
////////////////////////
|
34
|
+
// Import Modules
|
35
|
+
////////////////////////
|
36
|
+
@import 'partials/modules/modules';
|
37
|
+
|
38
|
+
////////////////////////
|
39
|
+
// Import States
|
40
|
+
////////////////////////
|
41
|
+
@import 'partials/states/states';
|
@@ -0,0 +1,177 @@
|
|
1
|
+
<% project_name = File.basename(Compass.configuration.project_path) %><% project_js = Compass.configuration.javascripts_dir %><% project_css = Compass.configuration.css_dir %><?php
|
2
|
+
|
3
|
+
/**
|
4
|
+
* @file
|
5
|
+
* Theme functions for the <%= project_name %> theme.
|
6
|
+
*/
|
7
|
+
|
8
|
+
/**
|
9
|
+
* Override or insert variables into the maintenance page template.
|
10
|
+
*
|
11
|
+
* @param (array) $vars
|
12
|
+
* An array of variables to pass to the theme template.
|
13
|
+
*/
|
14
|
+
function <%= project_name %>_preprocess_maintenance_page(&$vars) {
|
15
|
+
// When a variable is manipulated or added in preprocess_html or
|
16
|
+
// preprocess_page, that same work is probably needed for the maintenance page
|
17
|
+
// as well, so we can just re-use those functions to do that work here.
|
18
|
+
// <%= project_name %>_preprocess_html($variables, $hook);
|
19
|
+
// <%= project_name %>_preprocess_page($variables, $hook);
|
20
|
+
//
|
21
|
+
// This preprocessor will also be used if the db is inactive. To ensure your
|
22
|
+
// theme is used, add the following line to your settings.php file:
|
23
|
+
// $conf['maintenance_theme'] = '<%= project_name %>';
|
24
|
+
// Also, check $vars['db_is_active'] before doing any db queries.
|
25
|
+
}
|
26
|
+
|
27
|
+
/**
|
28
|
+
* Implements hook_modernizr_load_alter().
|
29
|
+
*
|
30
|
+
* @return (array)
|
31
|
+
* An array to be output as yepnope testObjects.
|
32
|
+
*/
|
33
|
+
/* -- Delete this line if you want to use this function
|
34
|
+
function <%= project_name %>_modernizr_load_alter(&$load) {
|
35
|
+
|
36
|
+
}
|
37
|
+
*/
|
38
|
+
|
39
|
+
/**
|
40
|
+
* Implements hook_preprocess_html()
|
41
|
+
*
|
42
|
+
* @param (array) $vars
|
43
|
+
* An array of variables to pass to the theme template.
|
44
|
+
*/
|
45
|
+
/* -- Delete this line if you want to use this function
|
46
|
+
function <%= project_name %>_preprocess_html(&$vars) {
|
47
|
+
|
48
|
+
}
|
49
|
+
*/
|
50
|
+
|
51
|
+
/**
|
52
|
+
* Override or insert variables into the page template.
|
53
|
+
*
|
54
|
+
* @param (array) $vars
|
55
|
+
* An array of variables to pass to the theme template.
|
56
|
+
*/
|
57
|
+
/* -- Delete this line if you want to use this function
|
58
|
+
function <%= project_name %>_preprocess_page(&$vars) {
|
59
|
+
|
60
|
+
}
|
61
|
+
*/
|
62
|
+
|
63
|
+
/**
|
64
|
+
* Override or insert variables into the region templates.
|
65
|
+
*
|
66
|
+
* @param (array) $vars
|
67
|
+
* An array of variables to pass to the theme template.
|
68
|
+
*/
|
69
|
+
/* -- Delete this line if you want to use this function
|
70
|
+
function <%= project_name %>_preprocess_region(&$vars) {
|
71
|
+
|
72
|
+
}
|
73
|
+
*/
|
74
|
+
|
75
|
+
/**
|
76
|
+
* Override or insert variables into the block templates.
|
77
|
+
*
|
78
|
+
* @param (array) $vars
|
79
|
+
* An array of variables to pass to the theme template.
|
80
|
+
*/
|
81
|
+
/* -- Delete this line if you want to use this function
|
82
|
+
function <%= project_name %>_preprocess_block(&$vars) {
|
83
|
+
|
84
|
+
}
|
85
|
+
*/
|
86
|
+
|
87
|
+
/**
|
88
|
+
* Override or insert variables into the entity template.
|
89
|
+
*
|
90
|
+
* @param (array) $vars
|
91
|
+
* An array of variables to pass to the theme template.
|
92
|
+
*/
|
93
|
+
/* -- Delete this line if you want to use this function
|
94
|
+
function <%= project_name %>_preprocess_entity(&$vars) {
|
95
|
+
|
96
|
+
}
|
97
|
+
*/
|
98
|
+
|
99
|
+
/**
|
100
|
+
* Override or insert variables into the node template.
|
101
|
+
*
|
102
|
+
* @param (array) $vars
|
103
|
+
* An array of variables to pass to the theme template.
|
104
|
+
*/
|
105
|
+
function <%= project_name %>_preprocess_node(&$vars) {
|
106
|
+
$node = $vars['node'];
|
107
|
+
|
108
|
+
// Node listings should be heading 2.
|
109
|
+
$vars['title_tag'] = $vars['view_mode'] == 'full' ? 'h1' : 'h2';
|
110
|
+
|
111
|
+
// Break out type-specific preprocessors into their own functions.
|
112
|
+
$function = '_' . __FUNCTION__ . '_' . $node->type;
|
113
|
+
if (function_exists($function)) {
|
114
|
+
$function($vars);
|
115
|
+
}
|
116
|
+
}
|
117
|
+
|
118
|
+
/**
|
119
|
+
* Override or insert variables into the field template.
|
120
|
+
*
|
121
|
+
* @param (array) $vars
|
122
|
+
* An array of variables to pass to the theme template.
|
123
|
+
*/
|
124
|
+
/* -- Delete this line if you want to use this function
|
125
|
+
function <%= project_name %>_preprocess_field(&$vars) {
|
126
|
+
|
127
|
+
}
|
128
|
+
*/
|
129
|
+
|
130
|
+
/**
|
131
|
+
* Override or insert variables into the comment template.
|
132
|
+
*
|
133
|
+
* @param (array) $vars
|
134
|
+
* An array of variables to pass to the theme template.
|
135
|
+
*/
|
136
|
+
/* -- Delete this line if you want to use this function
|
137
|
+
function <%= project_name %>_preprocess_comment(&$vars) {
|
138
|
+
$comment = $vars['comment'];
|
139
|
+
}
|
140
|
+
*/
|
141
|
+
|
142
|
+
/**
|
143
|
+
* Override or insert variables into the views template.
|
144
|
+
*
|
145
|
+
* @param (array) $vars
|
146
|
+
* An array of variables to pass to the theme template.
|
147
|
+
*/
|
148
|
+
/* -- Delete this line if you want to use this function
|
149
|
+
function <%= project_name %>_preprocess_views_view(&$vars) {
|
150
|
+
$view = $vars['view'];
|
151
|
+
}
|
152
|
+
*/
|
153
|
+
|
154
|
+
|
155
|
+
/**
|
156
|
+
* Override or insert css on the site.
|
157
|
+
*
|
158
|
+
* @param (array) $css
|
159
|
+
* An array of all CSS items being requested on the page.
|
160
|
+
*/
|
161
|
+
/* -- Delete this line if you want to use this function
|
162
|
+
function <%= project_name %>_css_alter(&$css) {
|
163
|
+
|
164
|
+
}
|
165
|
+
*/
|
166
|
+
|
167
|
+
/**
|
168
|
+
* Override or insert javascript on the site.
|
169
|
+
*
|
170
|
+
* @param (array) $js
|
171
|
+
* An array of all JavaScript being presented on the page.
|
172
|
+
*/
|
173
|
+
/* -- Delete this line if you want to use this function
|
174
|
+
function <%= project_name %>_js_alter(&$js) {
|
175
|
+
|
176
|
+
}
|
177
|
+
*/
|
@@ -0,0 +1,20 @@
|
|
1
|
+
description "Aurora Bower Configuration"
|
2
|
+
no_configuration_file!
|
3
|
+
|
4
|
+
# Bower's for the Birds
|
5
|
+
file '../shared/bowerrc.txt', :to => '.bowerrc'
|
6
|
+
file '../shared/component.json.erb', :to => 'component.json', :erb => true
|
7
|
+
|
8
|
+
help %Q{
|
9
|
+
Please contact Sam Richard with questions:
|
10
|
+
|
11
|
+
sam@snug.ug
|
12
|
+
}
|
13
|
+
|
14
|
+
welcome_message %Q{
|
15
|
+
Aurora Bower Configuration.
|
16
|
+
|
17
|
+
See http://snugug.github.io/Aurora/ for full documentation.
|
18
|
+
|
19
|
+
Now run `bower install` to install your Bower dependencies.
|
20
|
+
}
|
@@ -0,0 +1,399 @@
|
|
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>
|