-
Notifications
You must be signed in to change notification settings - Fork 0
/
HueTemplateFactory.html
83 lines (81 loc) · 1.95 KB
/
HueTemplateFactory.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
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Hue Template Factory</title>
<script src="jquery-2.0.3.js" type="text/javascript"></script>
<script src="jquery-ui-1.10.4.custom\js\jquery-ui-1.10.4.custom.js"
type="text/javascript"></script>
<script src="HueProxyClient.js" type="text/javascript"></script>
<script>
$(function() {
$( ".templateItem" ).draggable({
appendTo: "body",
helper: "clone"
});
$( "#templateList" ).droppable({
drop: function( event, ui ) {
var objectToMove = $(ui.helper);
var clonedObject = objectToMove.clone();
console.log(clonedObject);
clonedObject.removeAttr("style");
clonedObject.removeClass("ui-draggable ui-draggable-dragging")
clonedObject.addClass("templateItemDropped");
$( this )
.find( "#placeholder" ).remove();
$( "<li></li>" ).addClass("droppedLineItem").append(clonedObject).appendTo(this);
}
});
});
</script>
<style type="text/css">
#container {
width: 100%;
height: 400px;
}
#stateObjects {
width: 49%;
height: 100%;
float: left;
border: 1px solid black;
}
.templateItem:drag {
background-color: red;
}
#templateContainer {
width: 49%;
float: left;
border: 1px solid black;
}
#templateList{
list-style-type: none;
}
.templateItem{
transition: background-color 300ms linear 0s;
}
.templateItemDropped{
border: 2px dashed gray;
border-radius: 10px;
margin-top: 3px;
display: inline-block;
}
</style>
</head>
<body>
<div id="container">
<div id="templateContainer">
<ul id="templateList">
<li id="placeholder">No current states</li>
</ul>
</div>
<div id="stateObjects">
<div id="lightStateUpdateObject" class="templateItem">
<p>Light State Update Object</p>
<input type="color" class="templateItemColor" />
<input type="range" min="1" max="255" class="templateItemBri" />
<input type="range" min="1" max="255" class="templateItemBrSat" />
</div>
</div>
</div>
</body>
</html>