-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerated_stylesheet.html
More file actions
71 lines (71 loc) · 2.35 KB
/
generated_stylesheet.html
File metadata and controls
71 lines (71 loc) · 2.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="./style.css">
<title>Iron Style</title>
</head>
<body>
<div id="heading">
<h1><a href="./index.html">The Iron Style Generator</a></h1>
<image src="./watson.jpg">
<div id="navigation">
<ul>
<li><a href="background.html">Background Color</a></li>
<li><a href="color.html">Text Color</a></li>
<li><a href="width.html">Page Width</a></li>
<li><a href="line.html">Line Height</a></li>
<li><a href="size.html">Font Size</a></li>
<li><a href="radius.html">Border Radius</a></li>
<li><a href="shadow.html">Box Shadow</a></li>
</ul>
</div>
</div>
<div id="wrapper">
<div id="content">
<h2>Generated Stylesheet</h2>
<p>This is the stylesheet that you generated by the selections you have made.</p>
<pre></pre>
</div>
<div id="sidebar">
<h3>Aside goes here</h3>
</div>
</div>
<div id="footer">Footer</div>
<script src="./app.js"></script>
<script>
if(sessionStorage.length > 0){
var pre = document.querySelector("pre");
function addRule(selector, property){
pre.innerText += selector;
pre.innerText += " {\n";
pre.innerText += " " + property + ": " + sessionStorage[property] + ";\n"
pre.innerText += "}\n";
}
function addRules(selector){
pre.innerText += selector;
pre.innerText += " {\n";
for(var i = 1; i < arguments.length; i++){
var property = arguments[i];
if(sessionStorage[property]){
pre.innerText += " " + property + ": " + sessionStorage[property] + ";\n"
}
}
pre.innerText += "}\n";
}
if(sessionStorage["background"]){
addRule("html", "background");
}
if(sessionStorage["width"]){
addRule("body", "width");
}
if(sessionStorage["lineHeight"] || sessionStorage["fontSize"] || sessionStorage["color"]){
addRules("#content", "lineHeight", "fontSize", "color");
}
if(sessionStorage["borderRadius"] || sessionStorage["boxShadow"]){
addRules("#sidebar", "borderRadius", "boxShadow");
}
}
</script>
</body>
</html>