-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexample.html
More file actions
147 lines (132 loc) · 6.56 KB
/
example.html
File metadata and controls
147 lines (132 loc) · 6.56 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
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<script src="vendor/components/jquery/jquery.min.js"></script>
</head>
<body>
<table><tr>
<td valign="top">
<form action="pushover-http.php" id="pushover">
config: <br><input type="text" id="pushconfig" name="config" size="50" ><br>
user: <br><input type="text" id="pushuser" name="user" size="50" ><br>
token: <br><input type="text" id="pushtoken" name="token" size="50" ><br>
priority: <br><input type="text" id="pushpriority" name="priority" size="50" ><br>
attachment:<br><input type="text" id="pushattachment" name="attachment" size="50" ><br>
message: <br><input type="text" id="pushmessage" name="message" size="50" ><br>
title: <br><input type="text" id="pushtitle" name="title" size="50" ><br>
url: <br><input type="text" id="pushurl" name="url" size="50" ><br>
urlTitle: <br><input type="text" id="pushurltitle" name="urlTitle" size="50" ><br>
sound: <br><input type="text" id="pushsound" name="sound" size="50" ><br>
html: <br><input type="text" id="pushhtml" name="html" size="50" ><br>
device: <br><input type="text" id="pushdevice" name="device" size="50" ><br>
date: <br><input type="text" id="pushdatetime" name="datetime" size="50" ><br>
retry: <br><input type="text" id="pushretry" name="retry" size="50" ><br>
expire: <br><input type="text" id="pushexpire" name="expire" size="50" ><br>
callback: <br><input type="text" id="pushcallback" name="callback" size="50" ><br>
<br><input type="button" id="pushsubmit" value="push" size="50" onclick="subPush(this.form);" >
<input type="radio" name="method" value="get" id="pushrbget" checked > GET
<input type="radio" name="method" value="post" id="pushrbpost" > POST
<input type="checkbox" name="debug" value="debug" id="pushdebug" > DEBUG
</form>
</td>
<td valign="top">
<form action="pushover-http.php" id="poll">
config: <br><input type="text" id="pollconfig" name="config" size="50" ><br>
receipt: <br><input type="text" id="pollreceipt" name="receipt" size="50" ><br>
token: <br><input type="text" id="polltoken" name="token" size="50" ><br>
<br><input type="button" id="pollsubmit" value="poll" onclick="subPollCancel(this.form, 'poll');" >
<input type="button" id="cancelsubmit" value="cancel" onclick="subPollCancel(this.form, 'cancel');" >
<input type="radio" name="method" value="get" id="pollrbget" checked > GET
<input type="radio" name="method" value="post" id="pollrbpost" > POST
<input type="checkbox" name="debug" value="debug" id="polldebug" > DEBUG
</form>
</td>
</tr>
<tr>
<td colspan="2">
<hr>
</td>
</tr>
</table>
<!-- the result of the push will be rendered inside this div -->
<div id="result"></div>
</body>
</html>
<script type='text/javascript'>
/*
* pushover from submit
*/
function subPush(form) {
$("#result").empty();
/* get some values from elements on the page: */
url = form.action;
/* Send the data using post/get */
data = {
job: 'push',
config: $('#pushconfig').val(),
user: $('#pushuser').val(),
token: $('#pushtoken').val(),
priority: $('#pushpriority').val(),
attachment: $('#pushattachment').val(),
message: $('#pushmessage').val(),
title: $('#pushtitle').val(),
url: $('#pushurl').val(),
urlTitle: $('#pushurlTitle').val(),
sound: $('#pushsound').val(),
device: $('#pushdevice').val(),
datetime: $('#pushdatetime').val(),
retry: $('#pushretry').val(),
expire: $('#pushexpire').val(),
callback: $('#pushcallback').val()
};
if($('#pushdebug').prop("checked"))
data.echo = 1;
if($('#pushrbget').prop("checked")) {
var posting = $.get(url, data);
} else {
var posting = $.post(url, data);
}
/* Put the results in a div */
posting.done(function(data) {
$("#result").append(data);
var receipt = data.match('[A-Za-z0-9]{30}')
var pollform = document.getElementById('poll');
pollform.elements["pollreceipt"].value = receipt;
pollform.elements["polltoken"].value = $('#pushtoken').val();
pollform.elements["pollconfig"].value = $('#pushconfig').val();
});
posting.fail(function(data) {
$("#result").append("[" + data.status + "] " + data.statusText + "<br>" + data.responseText);
});
};
/*
* poll from submit
*/
function subPollCancel(form, job)
{
$("#result").empty();
/* get some values from elements on the page: */
url = form.action;
data = {
job: job,
config: $('#pollconfig').val(),
receipt: $('#pollreceipt').val(),
token: $('#polltoken').val()
};
if($('#polldebug').prop("checked"))
data.echo = 1;
if($('#pollrbget').prop("checked")) {
var posting = $.get(url, data);
} else {
var posting = $.post(url, data);
}
/* Put the results in a div */
posting.done(function(data) {
$("#result").append(data);
});
posting.fail(function(data) {
$("#result").append("[" + data.status + "] " + data.statusText + "<br>" + data.responseText);
});
};
</script>