1
|
|
|
/*! |
2
|
|
|
* trivia.js |
3
|
|
|
*/ |
4
|
|
|
window.DidyouknowdeleteConfirmation = function (triviaId) { |
5
|
|
|
$('#JSGenericModal').dialog({ |
6
|
|
|
title: 'Delete Quote', |
7
|
|
|
open: $('#JSGenericModalText').text('Are you sure you want to delete this Quote?'), |
8
|
|
|
resizable: false, |
9
|
|
|
height: 200, |
10
|
|
|
modal: true, |
11
|
|
|
buttons: { |
12
|
|
|
'Delete Quote': function () { |
13
|
|
|
$(this).dialog('close'); |
14
|
|
|
DidyouknowDelete(triviaId); |
15
|
|
|
}, |
16
|
|
|
Cancel: function () { |
17
|
|
|
$(this).dialog('close'); |
18
|
|
|
} |
19
|
|
|
} |
20
|
|
|
}); |
21
|
|
|
} |
22
|
|
|
function DidyouknowDelete (triviaId) { |
23
|
|
|
$.ajaxQueue({ |
24
|
|
|
// The URL for the request |
25
|
|
|
url: 'db_trivia.php', |
26
|
|
|
data: 'action=did_you_know_delete&trivia_id=' + triviaId, |
27
|
|
|
type: 'POST', |
28
|
|
|
dataType: 'html', |
29
|
|
|
// Code to run if the request succeeds; |
30
|
|
|
success: function (html) { |
31
|
|
|
var returnHtml = html.split('[BRK]'); |
32
|
|
|
$('#add_trivia_list').html(returnHtml[0]); |
33
|
|
|
window.OSDMessageDisplay(returnHtml[1]); |
34
|
|
|
document.getElementById('trivia').reset(); |
35
|
|
|
} |
36
|
|
|
}); |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
window.DidyouknowEdit = function (triviaId) { |
40
|
|
|
$.ajax({ |
41
|
|
|
// The URL for the request |
42
|
|
|
url: 'ajax_trivia_quotes.php', |
43
|
|
|
data: 'action=did_you_know_edit_view&trivia_id=' + triviaId, |
44
|
|
|
type: 'GET', |
45
|
|
|
dataType: 'html', |
46
|
|
|
// Code to run if the request succeeds; |
47
|
|
|
success: function (html) { |
48
|
|
|
var ReturnHtml = html.split('[BRK]'); |
49
|
|
|
$('#JSDidYouKnow_' + triviaId).html(ReturnHtml[0]); |
50
|
|
|
$('#JSDidYouKnowEdit_' + triviaId).html(ReturnHtml[1]); |
51
|
|
|
} |
52
|
|
|
}); |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
window.DidyouknowUpdate = function (triviaId) { |
56
|
|
|
var form = $('#JSTrivia' + triviaId).serialize() + '&action=update_trivia'; |
57
|
|
|
$.ajax({ |
58
|
|
|
// The URL for the request |
59
|
|
|
url: 'db_trivia.php', |
60
|
|
|
data: form, |
61
|
|
|
type: 'POST', |
62
|
|
|
dataType: 'html', |
63
|
|
|
// Code to run if the request succeeds; |
64
|
|
|
success: function (html) { |
65
|
|
|
var returnHtml = html.split('[BRK]'); |
66
|
|
|
$('#add_trivia_list').html(returnHtml[0]); |
67
|
|
|
window.OSDMessageDisplay(returnHtml[1]); |
68
|
|
|
document.getElementById('trivia').reset(); |
69
|
|
|
} |
70
|
|
|
}); |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
window.EditTriviaQuote = function (triviaQuoteId) { |
74
|
|
|
$.ajax({ |
75
|
|
|
// The URL for the request |
76
|
|
|
url: 'ajax_trivia_quotes.php', |
77
|
|
|
data: 'action=edit_trivia_quote&trivia_quote_id=' + triviaQuoteId, |
78
|
|
|
type: 'GET', |
79
|
|
|
dataType: 'html', |
80
|
|
|
// Code to run if the request succeeds; |
81
|
|
|
success: function (html) { |
82
|
|
|
var ReturnHtml = html.split('[BRK]'); |
83
|
|
|
$('#JSTrivia_' + triviaQuoteId).html(ReturnHtml[0]); |
84
|
|
|
$('#JSTriviaEdit_' + triviaQuoteId).html(ReturnHtml[1]); |
85
|
|
|
} |
86
|
|
|
}); |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
window.TriviaQuoteUpdate = function (triviaQuoteId) { |
90
|
|
|
var form = $('#JSTrivia' + triviaQuoteId).serialize() + '&action=edit_trivia_quote'; |
91
|
|
|
$.ajax({ |
92
|
|
|
// The URL for the request |
93
|
|
|
url: 'db_trivia.php', |
94
|
|
|
data: form, |
95
|
|
|
type: 'POST', |
96
|
|
|
dataType: 'html', |
97
|
|
|
// Code to run if the request succeeds; |
98
|
|
|
success: function (html) { |
99
|
|
|
var returnHtml = html.split('[BRK]'); |
100
|
|
|
$('#add_quote_list').html(returnHtml[0]); |
101
|
|
|
window.OSDMessageDisplay(returnHtml[1]); |
102
|
|
|
document.getElementById('triviaquote').reset(); |
103
|
|
|
} |
104
|
|
|
}); |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
window.TriviaQuoteDeleteConfirmation = function (triviaQuoteId) { |
108
|
|
|
$('#JSGenericModal').dialog({ |
109
|
|
|
title: 'Delete Trivia', |
110
|
|
|
open: $('#JSGenericModalText').text('Are you sure you want to delete this Quote?'), |
111
|
|
|
resizable: false, |
112
|
|
|
height: 200, |
113
|
|
|
modal: true, |
114
|
|
|
buttons: { |
115
|
|
|
'Delete Quote': function () { |
116
|
|
|
$(this).dialog('close'); |
117
|
|
|
TriviaQuoteDelete(triviaQuoteId); |
118
|
|
|
}, |
119
|
|
|
Cancel: function () { |
120
|
|
|
$(this).dialog('close'); |
121
|
|
|
} |
122
|
|
|
} |
123
|
|
|
}); |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
function TriviaQuoteDelete (triviaQuoteId) { |
127
|
|
|
$.ajaxQueue({ |
128
|
|
|
// The URL for the request |
129
|
|
|
url: 'db_trivia.php', |
130
|
|
|
data: 'action=delete_trivia_quote&trivia_quote_id=' + triviaQuoteId, |
131
|
|
|
type: 'POST', |
132
|
|
|
dataType: 'html', |
133
|
|
|
// Code to run if the request succeeds; |
134
|
|
|
success: function (html) { |
135
|
|
|
var returnHtml = html.split('[BRK]'); |
136
|
|
|
$('#add_quote_list').html(returnHtml[0]); |
137
|
|
|
window.OSDMessageDisplay(returnHtml[1]); |
138
|
|
|
document.getElementById('triviaquote').reset(); |
139
|
|
|
} |
140
|
|
|
}); |
141
|
|
|
} |
142
|
|
|
|
143
|
|
|
window.SpotlightdeleteConfirmation = function (spotlightId) { |
144
|
|
|
$('#JSGenericModal').dialog({ |
145
|
|
|
title: 'Delete spotlight', |
146
|
|
|
open: $('#JSGenericModalText').text('Are you sure you want to delete this spotlight entry?'), |
147
|
|
|
resizable: false, |
148
|
|
|
height: 200, |
149
|
|
|
modal: true, |
150
|
|
|
buttons: { |
151
|
|
|
'Delete': function () { |
152
|
|
|
$(this).dialog('close'); |
153
|
|
|
SpotlightDelete(spotlightId); |
154
|
|
|
}, |
155
|
|
|
Cancel: function () { |
156
|
|
|
$(this).dialog('close'); |
157
|
|
|
} |
158
|
|
|
} |
159
|
|
|
}); |
160
|
|
|
} |
161
|
|
|
|
162
|
|
|
function SpotlightDelete (spotlightId) { |
163
|
|
|
$.ajaxQueue({ |
164
|
|
|
// The URL for the request |
165
|
|
|
url: 'db_trivia.php', |
166
|
|
|
data: 'action=spotlight_delete&spotlight_id=' + spotlightId, |
167
|
|
|
type: 'POST', |
168
|
|
|
dataType: 'html', |
169
|
|
|
// Code to run if the request succeeds; |
170
|
|
|
success: function (html) { |
171
|
|
|
var returnHtml = html.split('[BRK]'); |
172
|
|
|
$('#spotlight_list').html(returnHtml[0]); |
173
|
|
|
window.OSDMessageDisplay(returnHtml[1]); |
174
|
|
|
document.getElementById('spotlight').reset(); |
175
|
|
|
} |
176
|
|
|
}); |
177
|
|
|
} |
178
|
|
|
|
179
|
|
|
window.SpotlightEdit = function (spotlightId) { |
180
|
|
|
$.ajax({ |
181
|
|
|
// The URL for the request |
182
|
|
|
url: 'ajax_trivia_quotes.php', |
183
|
|
|
data: 'action=spotlight_edit_view&spotlight_id=' + spotlightId, |
184
|
|
|
type: 'GET', |
185
|
|
|
dataType: 'html', |
186
|
|
|
// Code to run if the request succeeds; |
187
|
|
|
success: function (html) { |
188
|
|
|
var ReturnHtml = html.split('[BRK]'); |
189
|
|
|
$('#JSSpotlight_' + spotlightId).html(ReturnHtml[0]); |
190
|
|
|
$('#JSSpotlightEdit_' + spotlightId).html(ReturnHtml[1]); |
191
|
|
|
} |
192
|
|
|
}); |
193
|
|
|
} |
194
|
|
|
|
195
|
|
|
window.SpotlightUpdate = function (spotlightId) { |
196
|
|
|
var form = $('#JSTrivia' + spotlightId).serialize() + '&action=update_spotlight'; |
197
|
|
|
$.ajax({ |
198
|
|
|
// The URL for the request |
199
|
|
|
url: 'db_trivia.php', |
200
|
|
|
data: form, |
201
|
|
|
type: 'POST', |
202
|
|
|
dataType: 'html', |
203
|
|
|
// Code to run if the request succeeds; |
204
|
|
|
success: function (html) { |
205
|
|
|
var returnHtml = html.split('[BRK]'); |
206
|
|
|
$('#spotlight_list').html(returnHtml[0]); |
207
|
|
|
window.OSDMessageDisplay(returnHtml[1]); |
208
|
|
|
document.getElementById('spotlight').reset(); |
209
|
|
|
} |
210
|
|
|
}); |
211
|
|
|
} |
212
|
|
|
|