forked from amiechen/codrops-dropcast
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsequencer.html
More file actions
297 lines (241 loc) · 7.63 KB
/
sequencer.html
File metadata and controls
297 lines (241 loc) · 7.63 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
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Umaticast - show sequence manager week view</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<style>
table {
font-size: 1em;
}
.ui-draggable, .ui-droppable {
background-position: top;
}
body {
min-width: 520px;
font-family: Arial, Helvetica, sans-serif;
}
.column {
width: 170px;
float: left;
padding-bottom: 100px;
}
.portlet {
margin: 0 1em 1em 0;
padding: 0.3em;
}
.portlet-header {
padding: 0.2em 0.3em;
margin-bottom: 0.5em;
position: relative;
}
.portlet-toggle {
position: absolute;
top: 50%;
right: 0;
margin-top: -8px;
}
.portlet-content {
padding: 0.4em;
}
.portlet-placeholder {
border: 1px dotted black;
margin: 0 1em 1em 0;
height: 50px;
}
</style>
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script>
$( function() {
//const invocation = new XMLHttpRequest();
//function callOtherDomain() {
// if (invocation) {
// invocation.open('GET', umaticastAPI, true);
// invocation.withCredentials = true;
// invocation.send();
// }
// }
// var xhr = $.ajax({
// type: 'HEAD',
// url: umaticastAPI,
// dataType: 'jsonp',
// forceMethod: true
// });
let xhr = new XMLHttpRequest();
xhr.open('GET', 'https://portal.etiny.xyz/api/umaticast');
xhr.responseType = 'json';
xhr.send();
// the response is {"message": "Hello, world!"}
xhr.onload = function() {
let responseObj = xhr.response;
alert(responseObj.message); // Hello, world!
};
function makeTheCall() {
const umaticastAPI = "https://portal.etiny.xyz/api/umaticast";
// var destinationUrl = "www.otherdestinationserver.com";
$.ajax({
type: 'GET',
url: umaticastAPI,
dataType: 'json', // use json only, not jsonp
crossDomain: true, // tell browser to allow cross domain.
success: successResponse,
error: failureFunction
});
const data = xhr.responseText;
}
successResponse = function(data) {
//functionality goes here;
$.each(data.GetDataResult, function(i, item) {
$( this.colid ).append( "<div class=\"portlet\" id=\"" + this.itemid + "\"><div class=\"portlet-header\">" + this.title + "</div><div class=\"portlet-content\">" + this.embedcode + "</div></div>");
console.log(this.firstname);
console.log(this.lastname);
});
}
failureFunction = function(data) {
//functionality goes here;
}
// makeTheCall();
/* $.getJSON( umaticastAPI, {
format: "jsonp",
method: "GET",
headers: {
accept: "application/json"
// Access-Control-Allow-Origin: "https://portal.etiny.xyz";
}
})
.each( xhr.items, function( i, item ) {
$( this.colid ).append( "<div class=\"portlet\" id=\"" + this.itemid + "\"><div class=\"portlet-header\">" + this.title + "</div><div class=\"portlet-content\">" + this.embedcode + "</div></div>");
});
*/
/* var data2 = {
"GetDataResult": [{
"firstname": "firstname5",
"lastname": "lastname5",
"itemid": "12",
"colid": ".col1",
"title":"title4",
"embedcode":"embedcode"
}, {
"firstname": "firstname6",
"lastname": "lastname6",
"itemid": "13",
"colid": ".col2",
"title":"title5",
"embedcode":"embedcode2"
}, {
"firstname": "firstname7",
"lastname": "lastname7",
"itemid": "14",
"colid": ".col3",
"title":"title6",
"embedcode":"embedcode3"
}]
};
//for (i = 0; i < data.GetDataResult.length; i++) {
// console.log(data.GetDataResult[i].firstname);
// console.log(data.GetDataResult[i].lastname);
// };
$.each(data2.GetDataResult, function(i, item) {
$( this.colid ).append( "<div class=\"portlet\" id=\"" + this.itemid + "\"><div class=\"portlet-header\">" + this.title + "</div><div class=\"portlet-content\">" + this.embedcode + "</div></div>");
console.log(this.firstname);
console.log(this.lastname);
});
*/
$( ".column" ).sortable({
connectWith: ".column",
handle: ".portlet-header",
cancel: ".portlet-toggle",
placeholder: "portlet-placeholder ui-corner-all"
});
$( ".column" ).sortable({
start: function(event, ui) {
ui.item.startRow = ui.item.index();
ui.item.startCol = ui.item.closest('span').index();
},
stop: function(event, ui) {
console.log("Item ID: " + ui.item.attr("id"));
console.log("Start col: " + ui.item.startCol);
console.log("New col: " + ui.item.closest('span').attr("id"));
console.log("Start row: " + ui.item.startRow);
console.log("New row: " + ui.item.index());
}
});
// load a new array of what is to be displaye
// jquery will add them to othe
$( ".portlet" )
.addClass( "ui-widget ui-widget-content ui-helper-clearfix ui-corner-all" )
.find( ".portlet-header" )
.addClass( "ui-widget-header ui-corner-all" )
.prepend( "<span class='ui-icon ui-icon-minusthick portlet-toggle'></span>");
$( ".portlet-toggle" ).on( "click", function() {
var icon = $( this );
icon.toggleClass( "ui-icon-minusthick ui-icon-plusthick" );
icon.closest( ".portlet" ).find( ".portlet-content" ).toggle();
});
});
</script>
</head>
<body>
<div class="content" style="width:96%">
<span class="column col1" id="0">
<h2>Monday</h2>
<div class="portlet" id="1">
<div class="portlet-header">Feeds</div>
<div class="portlet-content">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</div>
</div>
<div class="portlet" id="2">
<div class="portlet-header">News</div>
<div class="portlet-content">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</div>
</div>
</span>
<span class="column col2" id="1">
<h2>Tuesday</h2>
<div class="portlet" id="3">
<div class="portlet-header">Shopping</div>
<div class="portlet-content">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</div>
</div>
</span>
<span class="column col3" id="2">
<h2>Wednesday</h2>
<div class="portlet" id="4">
<div class="portlet-header">Links</div>
<div class="portlet-content">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</div>
</div>
<div class="portlet" id="5">
<div class="portlet-header">Images</div>
<div class="portlet-content">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</div>
</div>
</span>
<span class="column col4" id="3">
<h2>Thursday</h2>
<div class="portlet" id="6">
<div class="portlet-header">Shopping</div>
<div class="portlet-content">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</div>
</div>
</span>
<span class="column" id="4">
<h2>Friday</h2>
<div class="portlet" id="7">
<div class="portlet-header">Shopping</div>
<div class="portlet-content">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</div>
</div>
</span>
<span class="column" id="5">
<h2>Saturday</h2>
<div class="portlet" id="8">
<div class="portlet-header">Shopping</div>
<div class="portlet-content">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</div>
</div>
</span>
<span class="column" id="6">
<h2>Sunday</h2>
<div class="portlet" id="9">
<div class="portlet-header">Shopping</div>
<div class="portlet-content">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</div>
</div>
</span>
</div>
</body>
</html>