3 <!-- Latest compiled and minified CSS --
>
4 <link rel=
"stylesheet" href=
"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
6 <!-- Optional theme --
>
7 <link rel=
"stylesheet" href=
"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">
9 <!-- Latest compiled and minified JavaScript --
>
10 <script src=
"https://code.jquery.com/jquery-2.1.4.min.js"></script>
11 <script src=
"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
15 background-color: blue;
18 .sprite table.outline td {
19 border:
1px solid red;
32 border-left:
2px solid transparent;
36 border-right:
2px solid transparent;
40 border-top:
2px solid transparent;
44 border-bottom:
2px solid transparent;
47 .sprite.measurements .line-left {
48 border-left:
2px solid black;
51 .sprite.measurements .line-right {
52 border-right:
2px solid black;
55 .sprite.measurements .line-top {
56 border-top:
2px solid black;
59 .sprite.measurements .line-bottom {
60 border-bottom:
2px solid black;
63 .sprite.measurements .dimension-top {
64 transform: translate(
50%, -
50%);
67 .sprite.measurements .dimension-bottom {
68 transform: translate(
50%,
50%);
71 .sprite.measurements .dimension-left {
72 transform: translateY(
50%);
75 .sprite.measurements .dimension-right {
76 transform: translateY(
50%);
79 .sprite.measurements .dimension-left .line-left, .sprite.measurements .dimension-right .line-right {
93 .sprite.measurements .height, .sprite.measurements .width {
98 border:
1px solid red;
109 <div class=
"container-fluid">
110 <h1><?php echo $name;
?></h1>
112 <ul class=
"nav nav-tabs">
113 <li class=
"nav active"><a href=
"#comparison" data-toggle=
"tab">Comparison
</a></li>
114 <li class=
"nav"><a href=
"#materials" data-toggle=
"tab">Materials
</a></li>
117 <div class=
"tab-content">
118 <div class=
"tab-pane fade in active" id=
"comparison">
119 <div id=
"original_sprite">
120 <div class=
"col-md-6">
122 <div class=
"sprite col-md-8"><?php echo $original_sprite;
?></div>
123 <div class=
"colour_table col-md-4"><?php echo $original_colour_table;
?></div>
125 <div class=
"col-md-6">
126 <h2>Ironlack approximation
</h2>
127 <div class=
"sprite col-md-8"><?php echo $ironlak_sprite;
?></div>
128 <div class=
"colour_table col-md-4"><?php echo $ironlak_colour_table;
?></div>
132 <div class=
"tab-pane fade in" id=
"materials">
133 <div class=
"col-md-6">
135 <div class=
"sprite measurements col-md-8">
136 <?php echo $ironlak_sprite;
?>
138 <div class=
"col-md-4">
139 <h3>Cost of materials
</h3>
140 <?php $materials = $cost_of_lumber + $cost_of_cans;
?>
141 <?php $materials_used = $value_of_lumber_used + $value_of_can_used;
?>
142 <table class=
"table">
145 <td><?php echo $cost_of_lumber;
?></td>
149 <td><?php echo $cost_of_cans;
?></td>
153 <td><strong><?php echo $materials;
?></strong></td>
157 <h3>Value of materials used
</h3>
158 <table class=
"table">
161 <td><?php echo $value_of_lumber_used;
?></td>
165 <td><?php echo $value_of_can_used;
?></td>
169 <td><strong><?php echo $materials_used;
?></strong></td>
173 <h3>Profit @
<?php echo $markup*
100;
?>% Markup
</h3>
174 <table class=
"table">
177 <td><?php echo $materials_used*$markup;
?></td>
180 <th>Less materials
</th>
181 <td><?php echo $materials_used*$markup - $materials;
?></td>
187 <div class=
"col-md-6">
188 <h2>Materials Breakdown
</h2>
189 <div class=
"col-md-12">
191 <?php echo $spray_can_breakdown;
?>
194 <div class=
"col-md-12">
196 <?php echo $lumber_breakdown;
?>
204 padSprite = function(sprite) {
205 var height = $(
".sprite:first table tr").length;
206 var width = $(
".sprite:first table tr:first td").length;
208 $(sprite).find('tr').each(function() {
209 $(this).append(
"<td class=\"added\"></td>");
212 $(sprite).find('tr:first td:last').append('
<div class=
"line-top"></div>');
213 $(sprite).find('tr:first td:last').addClass('dimension-top');
215 $(sprite).find('tr:last td:last').append('
<div class=
"line-bottom"></div>');
216 $(sprite).find('tr:last td:last').addClass('dimension-bottom');
218 $(sprite).find('tr').each(function(){
219 $(this).find('td').eq(
0).before('
<td class=
"added"></td>');
222 for (var i=
0; i<$(sprite).find(
"tr:last td").length; i++) {
223 var cells = cells ? cells + '
<td class=
"added"></td>' : '
<tr><td class=
"added"></td>';
225 cells +=
"<td class=\"added\"></td></tr><tr><td class=\"added\"></td><td class=\"line-top width added\" colspan=\"" + width +
"\"><?php echo $sprite_width_cm; ?></td></tr>";
226 $(sprite).find(
"tr:last").after(cells);
228 $(sprite).find('tr:nth-last-child(
2) td:nth-last-child(
2)').append('
<div class=
"line-left"></div>');
229 $(sprite).find('tr:nth-last-child(
2) td:nth-last-child(
2)').addClass('dimension-left');
231 $(sprite).find('tr:nth-last-child(
2) td:first').append('
<div class=
"line-right"></div>');
232 $(sprite).find('tr:nth-last-child(
2) td:first').addClass('dimension-right');
234 $(sprite).find(
"tr:first td:last").after(
"<td class=\"line-left\ height added\" rowspan=\"" + height +
"\"><?php echo $sprite_height_cm; ?></td>")
237 padSprite($(
".measurements"));
238 $(
".sprite:not(.measurements").each(function() {
242 var pixelSize = Math.floor($(
".sprite:first").width()*
0.75 / $(
".sprite:first table tr:first td").length);
244 $(
".sprite td").width(pixelSize);
245 $(
".sprite td").height(pixelSize);
247 $(window).bind('resize', function(e)
250 $(window).resize(function()
252 clearTimeout(window.resizeEvt);
253 window.resizeEvt = setTimeout(function()
255 var pixelSize = Math.floor($(
".sprite:visible").filter(
":first").width()*
0.75 / $(
".sprite:first table tr:first td").length);
256 //console.log($(
".sprite:visible").filter(
":first").width());
257 //console.log($(
".sprite:first table tr:first td").length)
258 //console.log(pixelSize);
259 $(
".sprite td").width(pixelSize);
260 $(
".sprite td").height(pixelSize);
265 $(
".colour-row" ).hover(function() {
266 var colour = $(this).attr('colour');
267 $(
"." + colour).toggleClass(
"highlighted");
270 function nextTab(elem) {
271 $(elem + ' li.active')
273 .find('a[
data-toggle=
"tab"]')
277 $(document).keypress(function(e) {
279 var active = $(
".nav li.active");
280 var tabs = active.parent().children();
281 tabs.eq((tabs.index(active) +
1) % tabs.length).find('a[
data-toggle=
"tab"]').click();
285 $(
".sprite tr td:not(.added)").toggleClass(
"grid");