-
Notifications
You must be signed in to change notification settings - Fork 2
/
buttons.html
123 lines (96 loc) · 4.7 KB
/
buttons.html
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<!DOCTYPE html>
<html>
<head>
<title>AppCenter - Xamarin Webview Samples</title>
<link rel="stylesheet" href="jQueryUI/jquery-ui-1.12.0.custom/jquery-ui.min.css">
<link rel="stylesheet" href="style.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<script src="jQueryUI/jquery-ui-1.12.0.custom/jquery-ui.min.js"></script>
<script>
(function (i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date(); a = s.createElement(o),
m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m)
})(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');
ga('create', 'UA-81122166-1', 'auto');
ga('send', 'pageview');
</script>
<script>
var jQueryLoaded = false;
var colors = ["Fuchsia", "Teal", "Orange", "Purple", "Lime", "Red", "Black", "Blue", "Green", "Maroon", "Navy", "Olive", "Silver", "Aqua", "Yellow"];
function checkForJQuery() {
//if the jQuery object isn't available
if (typeof (jQuery) == 'undefined') {
document.write("<h1>Could not load jQuery on this device (</h1>");
jQueryLoaded = false;
} else {
jQueryLoaded = true;
}
}
function getRandomColorBoxes() {
console.log("=======================================\n\n(using console.log to see this message)\n\n");
console.log("Getting new colors! :)");
console.log("\n=======================================");
$("#colorBox1").css('background-color', colors[Math.floor(Math.random() * colors.length)]);
$("#colorBox2").css('background-color', colors[Math.floor(Math.random() * colors.length)]);
$("#colorBox3").css('background-color', colors[Math.floor(Math.random() * colors.length)]);
$("#colorBox4").css('background-color', colors[Math.floor(Math.random() * colors.length)]);
}
function resetColors() {
console.log("=======================================\n\n(using console.log to see this message)\n\n");
console.log("Resetting colors!");
console.log("\n=======================================");
$("#colorBox1").css('background-color', '#5b9aa0');
$("#colorBox2").css('background-color', '#5b9aa0');
$("#colorBox3").css('background-color', '#5b9aa0');
$("#colorBox4").css('background-color', '#5b9aa0');
}
function randomBodyColor() {
console.log("=======================================\n\n(using console.log to see this message)\n\n");
console.log("Changing BG Color!");
console.log("\n=======================================");
var color = colors[Math.floor(Math.random() * colors.length)];
$("body").css('background-color', colors[Math.floor(Math.random() * colors.length)]);
}
function refreshPage() {
location.reload();
}
window.onload = function () {
checkForJQuery();
if (!jQueryLoaded)
return;
}
</script>
</head>
<body>
<!-- Buttons ============================================================================================================================================= -->
<div class='section ui-widget ui-corner-all'>
<p class="ui-state-default ui-corner-all ui-helper-clearfix" style="padding:4px;">
<span class="ui-icon ui-icon-eject" style="float:left; margin:-2px 5px 0 0;"></span>
Buttons
</p>
<div class='ui-widget-content ui-widget ui-corner-all' id="divControls">
<table>
<tr>
<td><div class="colorBox" id="colorBox1"></div></td>
<td><div class="colorBox" id="colorBox2"></div></td>
<td><div class="colorBox" id="colorBox3"></div></td>
<td><div class="colorBox" id="colorBox4"></div></td>
</tr>
</table>
<p>
<button id="btnGetRandomColors" onclick="getRandomColorBoxes()" class='ui-button ui-widget ui-corner-all'>Get Random Colors</button>
<button id="btnResetColors" onclick="resetColors()" class='ui-button ui-widget ui-corner-all'>Reset Colors</button>
<br><br>
<button id="btnChangeBGColor" onclick="randomBodyColor()" class='ui-button ui-widget ui-corner-all'>Change Background Color</button>
<br><br>
<button id="btnRefreshPage" onclick="refreshPage()" class='ui-button ui-widget ui-corner-all'>Reload Page (via Javascript)</button>
<br>
<p>
</div>
</div>
<br/>
<br/>
</body>
</html>