-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontent.html
186 lines (124 loc) · 4.82 KB
/
content.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
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
<html>
<head>
<title>Set and retrieve localized metadata for a video</title>
</head>
<body>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://jonthornton.github.io/jquery-timepicker/jquery.timepicker.js"></script>
<link rel="stylesheet" type="text/css" href="https://jonthornton.github.io/jquery-timepicker/jquery.timepicker.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.0/js/bootstrap-datepicker.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.0/css/bootstrap-datepicker.standalone.css" />
<script src="http://jonthornton.github.io/Datepair.js/dist/datepair.js"></script>
<script src="http://jonthornton.github.io/Datepair.js/dist/jquery.datepair.js"></script>
<br>
<button type="button" onclick="clearParams()">Reset</button>
<br>
-------------------------------------------------
<br><br>
<div>
<!-- <form method="GET" id="testformid"> -->
List video id: (private video only)
<br>
<textarea form ="testformid" name="videoId" id="taid" cols="35" wrap="soft"></textarea>
<br>
<input type="button" id="getId" value="Get list video" onclick="getListVideo();" >
<br>
<input type="text" id ="token" style="display: none;" placeholder= "token">
<br><br>
Select public time:
<p id="datepairExample">
<input type="text" name="date" class="date start" />
<input type="text" name="time" class="time start" />
</p>
</div>
<input type="submit" id="scheduler" value="Scheduler Pulbic" onclick="setTimeVideo();">
<!-- </form> -->
<br><br>
-------------------------------------------------
<br>
Result:
<div id="result">
</div>
<br>
<br>
<script>
// initialize input widgets first
$('#datepairExample .time').timepicker({
'disableTextInput':false,
'showDuration': true,
'timeFormat': 'G:i'
});
$('#datepairExample .date').datepicker({
'disableTextInput':false,
'format': 'yyyy-mm-dd',
'autoclose': true
});
$('#datepairExample .time').timepicker('setTime', new Date());
$('#datepairExample .date').datepicker('setDate', new Date());
// initialize datepair
$('#datepairExample').datepair();
function clearParams () {
location.reload();
}
function getListVideo (){
btSend = document.getElementById("getId");
btSend.style.visibility = "hidden";
var ajaxurl = 'request.php',
token = document.getElementById("token");
data = {'token': token.value};
$.post(ajaxurl, data, function (response) {
// Response div goes here.
// alert(response);
var obj = JSON.parse(response);
console.log(obj);
if (obj['status']== 0) {
document.getElementById("result").innerHTML += "<li>" + obj['message'] +"</li>";
btSend.style.visibility = "visible";
return;
};
listTextId = document.getElementById("taid");
if (listTextId.value.length > 0) {
listTextId.value += ","+ obj['privateVideo'];
} else{
listTextId.value += obj['privateVideo'];
}
document.getElementById("token").value = obj['nextPageToken'];
updateResult(obj);
btSend.style.visibility = "visible";
btSend.value = "Load more";
});
}
function updateResult (obj){
var result = '';
var listVideo = obj['listId'];
var listTitle = obj['listTitle'];
var listPrivate = obj['private'];
for (var i = 0; i < listVideo.length; i++) {
result += "<li> " + listVideo[i] + " -- " + listTitle[i] + " -- " + listPrivate[i]+ "</li>";
};
document.getElementById("result").innerHTML += result;
}
function setTimeVideo(){
listId = document.getElementById("taid");
var partsOfStr = listId.value.split(',');
var dateValue = $('#datepairExample .date').val();
var timeValue = $('#datepairExample .time').val();
var fullDate = dateValue+"T"+timeValue+":00.50Z";
console.log(fullDate);
for (var i = 0; i < partsOfStr.length; i++) {
sendRequest(partsOfStr[i], fullDate);
};
}
function sendRequest( videoId, time){
data = {'videoId': videoId,
'time':time};
$.post('request.php', data, function (response) {
// Response div goes here.;
var obj = JSON.parse(response);
console.log(obj);
document.getElementById("result").innerHTML += "<li>" + obj['message'] +"</li>";
});
}
</script>
</body>
</html>