Total Complexity | 159 |
Complexity/F | 1.28 |
Lines of Code | 1037 |
Function Count | 124 |
Duplicated Lines | 128 |
Ratio | 12.34 % |
Changes | 0 |
Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
Complex classes like public/themes/templates/1/includes/js/menus.js often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
1 | /*! |
||
7 | window.editDisk = function (str) { |
||
8 | var diskEditAjax = 'diskedit_ajax_'.concat(str); |
||
9 | $.ajax({ |
||
10 | // The URL for the request |
||
11 | url: 'ajax_menus_detail.php', |
||
12 | data: 'action=edit_disk_box&menu_disk_id=' + str, |
||
13 | type: 'GET', |
||
14 | dataType: 'html', |
||
15 | // Code to run if the request succeeds; |
||
16 | success: function (html) { |
||
17 | $('#' + diskEditAjax).html(html); |
||
18 | } |
||
19 | }); |
||
20 | } |
||
21 | |||
22 | window.closeeditDisk = function (str) { |
||
23 | var diskEditAjax = 'diskedit_ajax_'.concat(str); |
||
24 | $.ajax({ |
||
25 | // The URL for the request |
||
26 | url: 'ajax_menus_detail.php', |
||
27 | data: 'action=close_edit_disk_box&menu_disk_id=' + str, |
||
28 | type: 'GET', |
||
29 | dataType: 'html', |
||
30 | // Code to run if the request succeeds; |
||
31 | success: function (html) { |
||
32 | $('#' + diskEditAjax).html(html); |
||
33 | } |
||
34 | }); |
||
35 | } |
||
36 | |||
37 | window.popAddGames = function (str) { |
||
38 | if (str === '') { |
||
39 | $('#JSMenuDetailExpandGames').html(''); |
||
40 | } else { |
||
41 | $.ajax({ |
||
42 | // The URL for the request |
||
43 | url: 'ajax_addgames_menus.php', |
||
44 | data: 'action=game_browse&list=full&query=num&menu_disk_id=' + str, |
||
45 | type: 'GET', |
||
46 | dataType: 'html', |
||
47 | // Code to run if the request succeeds; |
||
48 | success: function (html) { |
||
49 | $('#JSMenuDetailExpandGames').html(html); |
||
50 | $('#gameto_menu_link').html('<a onclick="closeAddGames(' + str + ')" style="cursor: pointer;" class="MAINNAV">Add Game/Tool/Demo to menu</a>'); |
||
51 | gameSearchListen(); |
||
52 | } |
||
53 | }); |
||
54 | } |
||
55 | } |
||
56 | |||
57 | window.closeAddGames = function (str) { |
||
58 | $('#JSMenuDetailExpandGames').html(''); |
||
59 | $('#gameto_menu_link').html('<a onclick="popAddGames(' + str + ')" style="cursor: pointer;" class="MAINNAV">Add Game/Tool/Demo to menu</a>'); |
||
60 | } |
||
61 | |||
62 | function searchingGame (GameSearchAction) { |
||
63 | var formValues = ''; |
||
64 | if (GameSearchAction === 'game_browse') { |
||
65 | formValues = $('#game_search_menu').serialize() + '&action=game_browse&list=inner&query=' + $('.JSGameBrowse').val(); |
||
66 | } else { |
||
67 | if (GameSearchAction === 'game_search') { |
||
68 | formValues = $('#game_search_menu').serialize() + '&action=game_search&list=inner&query=' + $('.JSGameSearch').val(); |
||
69 | } |
||
70 | } |
||
71 | $.ajaxQueue({ |
||
72 | // The URL for the request |
||
73 | url: 'ajax_addgames_menus.php', |
||
74 | data: formValues, |
||
75 | type: 'GET', |
||
76 | dataType: 'html', |
||
77 | // Code to run if the request succeeds; |
||
78 | success: function (html) { |
||
79 | $('#game_list').html(html); |
||
80 | } |
||
81 | }); |
||
82 | } |
||
83 | |||
84 | function gameSearchListen () { |
||
85 | $('.JSGameBrowse').change(function () { |
||
86 | searchingGame('game_browse'); |
||
87 | }); |
||
88 | |||
89 | $('.JSGameSearch').keyup(function () { |
||
90 | var value = $(this).val(); |
||
91 | if (value.length >= 3) { |
||
92 | searchingGame('game_search'); |
||
93 | } |
||
94 | }); |
||
95 | } |
||
96 | |||
97 | function searchingDoc (DocSearchAction) { |
||
98 | var formValues = ''; |
||
99 | if (DocSearchAction === 'doc_browse') { |
||
100 | formValues = $('#doc_search_menu').serialize() + '&action=game_browse&list=inner&query=' + $('.JSDocBrowse').val(); |
||
101 | } else { |
||
102 | if (DocSearchAction === 'doc_search') { |
||
103 | formValues = $('#doc_search_menu').serialize() + '&action=game_search&list=inner&query=' + $('.JSDocSearch').val(); |
||
104 | } |
||
105 | } |
||
106 | $.ajaxQueue({ |
||
107 | // The URL for the request |
||
108 | url: 'ajax_adddocs_menus.php', |
||
109 | data: formValues, |
||
110 | type: 'GET', |
||
111 | dataType: 'html', |
||
112 | // Code to run if the request succeeds; |
||
113 | success: function (html) { |
||
114 | $('#doc_list').html(html); |
||
115 | } |
||
116 | }); |
||
117 | } |
||
118 | |||
119 | function docSearchListen () { |
||
120 | $('.JSDocBrowse').change(function () { |
||
121 | searchingDoc('doc_browse'); |
||
122 | }); |
||
123 | |||
124 | $('.JSDocSearch').keyup(function () { |
||
125 | var value = $(this).val(); |
||
126 | if (value.length >= 3) { |
||
127 | searchingDoc('doc_search'); |
||
128 | } |
||
129 | }); |
||
130 | } |
||
131 | |||
132 | window.addGametoMenu = function (softwareId, menuDiskId, softwareType) { |
||
133 | if (softwareId === '') { |
||
134 | $('#JSMenuSoftwareList').html(''); |
||
135 | } else { |
||
136 | $.ajax({ |
||
137 | // The URL for the request |
||
138 | url: 'db_menu_disk.php', |
||
139 | data: 'action=add_title_to_menu&software_id=' + softwareId + '&menu_disk_id=' + menuDiskId + '&software_type=' + softwareType, |
||
140 | type: 'POST', |
||
141 | dataType: 'html', |
||
142 | // Code to run if the request succeeds; |
||
143 | success: function (html) { |
||
144 | var returnHtml = html.split('[BRK]'); |
||
145 | $('#JSMenuSoftwareList').html(returnHtml[0]); |
||
146 | window.OSDMessageDisplay(returnHtml[1]); |
||
147 | } |
||
148 | }); |
||
149 | } |
||
150 | } |
||
151 | |||
152 | window.addNewdisk = function (str) { |
||
153 | if (str === '') { |
||
154 | $('#new_disk').html(''); |
||
155 | } else { |
||
156 | $.ajax({ |
||
157 | // The URL for the request |
||
158 | url: 'ajax_menus.php', |
||
159 | data: 'action=add_new_disk_box&menu_sets_id=' + str, |
||
160 | type: 'POST', |
||
161 | dataType: 'html', |
||
162 | // Code to run if the request succeeds; |
||
163 | success: function (html) { |
||
164 | $('#new_disk').html(html); |
||
165 | $('#close_new_disk').html('<a onclick="closeaddNewdisk(' + str + ')" style="cursor: pointer;" class="MAINNAV">Add New Disk</a>'); |
||
166 | } |
||
167 | }); |
||
168 | } |
||
169 | } |
||
170 | |||
171 | window.closeaddNewdisk = function (str) { |
||
172 | $('#new_disk').html(''); |
||
173 | $('#close_new_disk').html('<a onclick="addNewdisk(' + str + ')" style="cursor: pointer;" class="MAINNAV">Add New Disk</a>'); |
||
174 | } |
||
175 | |||
176 | window.myFunction = function () { |
||
177 | $('input:file[id=file_upload]').change(function () { |
||
178 | document.getElementById('file_upload_game_screenshots').value = 'file(s) selected'; |
||
179 | }); |
||
180 | $('input:file[id=file_upload2]').change(function () { |
||
181 | document.getElementById('file_upload_game_file').value = $(this).val(); |
||
182 | }); |
||
183 | } |
||
184 | |||
185 | window.browseCrew = function (str) { |
||
186 | if (str === '') { |
||
187 | $('#option_crew').html(''); |
||
188 | } else { |
||
189 | $.ajax({ |
||
190 | // The URL for the request |
||
191 | url: 'ajax_menus.php', |
||
192 | data: 'action=crew_browse&query=' + str, |
||
193 | type: 'GET', |
||
194 | dataType: 'html', |
||
195 | // Code to run if the request succeeds; |
||
196 | success: function (html) { |
||
197 | $('#option_crew').html(html); |
||
198 | } |
||
199 | }); |
||
200 | } |
||
201 | } |
||
202 | |||
203 | window.browseIndividual = function (str) { |
||
204 | if (str === '') { |
||
205 | $('#option_ind').html(''); |
||
206 | } else { |
||
207 | $.ajax({ |
||
208 | // The URL for the request |
||
209 | url: 'ajax_menus.php', |
||
210 | data: 'action=ind_browse&query=' + str, |
||
211 | type: 'GET', |
||
212 | dataType: 'html', |
||
213 | // Code to run if the request succeeds; |
||
214 | success: function (html) { |
||
215 | $('#option_ind').html(html); |
||
216 | } |
||
217 | }); |
||
218 | } |
||
219 | } |
||
220 | |||
221 | window.browseInd = function (str) { |
||
222 | if (str === '') { |
||
223 | $('#ind_member').html(''); |
||
224 | } else { |
||
225 | $.ajaxQueue({ |
||
226 | // The URL for the request |
||
227 | url: 'ajax_menus_detail.php', |
||
228 | data: 'action=ind_gen_browse&query=' + str, |
||
229 | type: 'GET', |
||
230 | dataType: 'html', |
||
231 | // Code to run if the request succeeds; |
||
232 | success: function (html) { |
||
233 | $('#ind_member').html(html); |
||
234 | } |
||
235 | }); |
||
236 | } |
||
237 | } |
||
238 | |||
239 | window.searchInd = function (str) { |
||
240 | if (str === '') { |
||
241 | $('#ind_member').html(''); |
||
242 | } else { |
||
243 | $.ajaxQueue({ |
||
244 | // The URL for the request |
||
245 | url: 'ajax_menus_detail.php', |
||
246 | data: 'action=ind_gen_search&query=' + str, |
||
247 | type: 'GET', |
||
248 | dataType: 'html', |
||
249 | // Code to run if the request succeeds; |
||
250 | success: function (html) { |
||
251 | $('#ind_member').html(html); |
||
252 | } |
||
253 | }); |
||
254 | } |
||
255 | } |
||
256 | |||
257 | window.popAddIntroCred = function (str) { |
||
258 | if (str === '') { |
||
259 | $('#menu_detail_expand').html(''); |
||
260 | } else { |
||
261 | $.ajax({ |
||
262 | // The URL for the request |
||
263 | url: 'ajax_menus_detail.php', |
||
264 | data: 'action=add_intro_credit&query=' + str, |
||
265 | type: 'GET', |
||
266 | dataType: 'html', |
||
267 | // Code to run if the request succeeds; |
||
268 | success: function (html) { |
||
269 | $('#menu_detail_expand').html(html); |
||
270 | $('#intro_credit_link').html('<a onclick="closeAddIntroCred(' + str + ')" style="cursor: pointer;" class="MAINNAV">Add intro credits</a>'); |
||
271 | } |
||
272 | }); |
||
273 | } |
||
274 | } |
||
275 | |||
276 | window.closeAddIntroCred = function (str) { |
||
277 | $('#menu_detail_expand').html(''); |
||
278 | $('#intro_credit_link').html('<a onclick="popAddIntroCred(' + str + ')" style="cursor: pointer;" class="MAINNAV">Add intro credits</a>'); |
||
279 | } |
||
280 | |||
281 | window.popAddAuthorMenutitle = function (menuDiskTitleId, gameId, gameName) { |
||
282 | if (menuDiskTitleId === '') { |
||
283 | $('#menu_detail_expand_author_title').html(''); |
||
284 | } else { |
||
285 | $.ajaxQueue({ |
||
286 | // The URL for the request |
||
287 | url: 'ajax_add_author_menutitle.php', |
||
288 | data: 'menu_disk_title_id=' + menuDiskTitleId + '&game_name=' + gameName + '&game_id=' + gameId, |
||
289 | type: 'GET', |
||
290 | dataType: 'html', |
||
291 | // Code to run if the request succeeds; |
||
292 | success: function (html) { |
||
293 | $('#menu_detail_expand_author_title').html(html); |
||
294 | $('#author_to_menu_title' + gameId).html('<a onclick="closeAddAuthor(' + menuDiskTitleId + ',' + gameId + ',' + gameName + ')" style="cursor: pointer;" class="standard_tile_link">' + gameName + '</a>'); |
||
295 | } |
||
296 | }); |
||
297 | } |
||
298 | } |
||
299 | |||
300 | window.closeAddAuthor = function (menuDiskTitleId, gameId, gameName) { |
||
301 | $('#menu_detail_expand_author_title').html(''); |
||
302 | $('#author_to_menu_title' + gameId).html('<a onclick="popAddAuthorMenutitle(' + menuDiskTitleId + ',' + gameId + ',' + gameName + ')" style="cursor: pointer;" class="standard_tile_link">' + gameName + '</a>'); |
||
303 | } |
||
304 | |||
305 | window.popAddAuthorMenutitleDoc = function (menuDiskTitleId, gameId, gameName) { |
||
306 | if (menuDiskTitleId === '') { |
||
307 | $('#menu_detail_expand_author_title_doc').html(''); |
||
308 | } else { |
||
309 | $.ajax({ |
||
310 | // The URL for the request |
||
311 | url: 'ajax_add_author_menutitle.php', |
||
312 | data: 'menu_disk_title_id=' + menuDiskTitleId + '&game_name=' + gameName + '&game_id=' + gameId, |
||
313 | type: 'GET', |
||
314 | dataType: 'html', |
||
315 | // Code to run if the request succeeds; |
||
316 | success: function (html) { |
||
317 | $('#menu_detail_expand_author_title_doc').html(html); |
||
318 | $('#author_to_menu_title_doc' + gameId).html('<a onclick="closeAddAuthorDoc(' + menuDiskTitleId + ',' + gameId + ',' + gameName + ')" style="cursor: pointer;" class="standard_tile_link">' + gameName + '</a>'); |
||
319 | } |
||
320 | }); |
||
321 | } |
||
322 | } |
||
323 | |||
324 | window.closeAddAuthorDoc = function (menuDiskTitleId, gameId, gameName) { |
||
325 | $('#menu_detail_expand_author_title_doc').html(''); |
||
326 | $('#author_to_menu_title_doc' + gameId).html('<a onclick="popAddAuthorMenutitleDoc(' + menuDiskTitleId + ',' + gameId + ',' + gameName + ')" style="cursor: pointer;" class="standard_tile_link">' + gameName + '</a>'); |
||
327 | } |
||
328 | |||
329 | window.popAddDocs = function (str) { |
||
330 | if (str === '') { |
||
331 | $('#menu_detail_expand_docs').html(''); |
||
332 | } else { |
||
333 | $.ajax({ |
||
334 | // The URL for the request |
||
335 | url: 'ajax_adddocs_menus.php', |
||
336 | data: 'action=game_browse&list=full&query=num&menu_disk_id=' + str, |
||
337 | type: 'GET', |
||
338 | dataType: 'html', |
||
339 | // Code to run if the request succeeds; |
||
340 | success: function (html) { |
||
341 | $('#menu_detail_expand_docs').html(html); |
||
342 | $('#docto_menu_link').html('<a onclick="closeAddDocs(' + str + ')" style="cursor: pointer;" class="MAINNAV">Add Doc to menu</a>'); |
||
343 | docSearchListen(); |
||
344 | } |
||
345 | }); |
||
346 | } |
||
347 | } |
||
348 | |||
349 | window.closeAddDocs = function (str) { |
||
350 | $('#menu_detail_expand_docs').html(''); |
||
351 | $('#docto_menu_link').html('<a onclick="popAddDocs(' + str + ')" style="cursor: pointer;" class="MAINNAV">Add Doc to menu</a>'); |
||
352 | } |
||
353 | |||
354 | window.popAddScreenshots = function (str) { |
||
355 | if (str === '') { |
||
356 | $('#JSMenuDetailExpandScreenshots').html(''); |
||
357 | } else { |
||
358 | $.ajax({ |
||
359 | // The URL for the request |
||
360 | url: 'ajax_addscreenshots_menus.php', |
||
361 | data: 'menu_disk_id=' + str, |
||
362 | type: 'GET', |
||
363 | dataType: 'html', |
||
364 | // Code to run if the request succeeds; |
||
365 | success: function (html) { |
||
366 | $('#JSMenuDetailExpandScreenshots').html(html); |
||
367 | $('#screenshot_link').html('<a onclick="closeAddScreenshots(' + str + ')" style="cursor: pointer;" class="MAINNAV">Add Screenshots to menu</a>'); |
||
368 | } |
||
369 | }); |
||
370 | } |
||
371 | } |
||
372 | |||
373 | window.closeAddScreenshots = function (str) { |
||
374 | $('#JSMenuDetailExpandScreenshots').html(''); |
||
375 | $('#screenshot_link').html('<a onclick="popAddScreenshots(' + str + ')" style="cursor: pointer;" class="MAINNAV">Add Screenshots to menu</a>'); |
||
376 | } |
||
377 | |||
378 | window.popAddFile = function (str) { |
||
379 | if (str === '') { |
||
380 | $('#JSMenuDetailExpandFile').html(''); |
||
381 | } else { |
||
382 | $.ajax({ |
||
383 | // The URL for the request |
||
384 | url: 'ajax_addfile_menus.php', |
||
385 | data: 'menu_disk_id=' + str, |
||
386 | type: 'GET', |
||
387 | dataType: 'html', |
||
388 | // Code to run if the request succeeds; |
||
389 | success: function (html) { |
||
390 | $('#JSMenuDetailExpandFile').html(html); |
||
391 | $('#file_link').html('<a onclick="closeAddFile(' + str + ')" style="cursor: pointer;" class="MAINNAV">Add File to menu</a>'); |
||
392 | } |
||
393 | }); |
||
394 | } |
||
395 | } |
||
396 | |||
397 | window.closeAddFile = function (str) { |
||
398 | $('#JSMenuDetailExpandFile').html(''); |
||
399 | $('#file_link').html('<a onclick="popAddFile(' + str + ')" style="cursor: pointer;" class="MAINNAV">Add File to menu</a>'); |
||
400 | } |
||
401 | |||
402 | function addslashes (str) { |
||
403 | /* eslint-disable-next-line no-control-regex */ |
||
404 | return (str + '').replace(/[\\"']/g, '\\$&').replace(/\u0000/g, '\\0'); |
||
405 | } |
||
406 | |||
407 | window.popAddSet = function (str, menuDiskId, titleName) { |
||
408 | if (str === '') { |
||
409 | $('#JSMenuDetailExpandSet').html(''); |
||
410 | } else { |
||
411 | $.ajax({ |
||
412 | // The URL for the request |
||
413 | url: 'ajax_addset_menus.php', |
||
414 | data: 'menu_disk_title_id=' + str + '&menu_disk_id=' + menuDiskId + '&title_name=' + titleName, |
||
415 | type: 'GET', |
||
416 | dataType: 'html', |
||
417 | // Code to run if the request succeeds; |
||
418 | success: function (html) { |
||
419 | $('#JSMenuDetailExpandSet').html(html); |
||
420 | var title = addslashes(titleName); |
||
421 | $('#' + str).html('<a onclick="closeAddSet(' + str + ',' + menuDiskId + ',' + title + ')" style="cursor: pointer;" class="standard_tile_link">Add</a>'); |
||
422 | } |
||
423 | }); |
||
424 | var elementExists = document.getElementById('set_chain_update'); |
||
425 | if (typeof (elementExists) !== 'undefined' && elementExists !== null) { |
||
426 | $('#set_chain_update').html(''); |
||
427 | } |
||
428 | } |
||
429 | } |
||
430 | |||
431 | window.closeAddSet = function (str, menuDiskId, titleName) { |
||
432 | var title = addslashes(titleName); |
||
433 | $('#JSMenuDetailExpandSet').html(''); |
||
434 | $('#' + str).html('<a onclick="popAddSet(' + str + ',' + menuDiskId + ',' + title + ')" style="cursor: pointer;" class="standard_tile_link">Add</a>'); |
||
435 | } |
||
436 | |||
437 | window.addAuthorstoMenutitle = function (menuDiskTitleId) { |
||
438 | if (menuDiskTitleId === '') { |
||
439 | $('#author_list').html(''); |
||
440 | } else { |
||
441 | var formValues = $('#authors_form').serialize(); |
||
442 | $.ajax({ |
||
443 | // The URL for the request |
||
444 | url: 'db_menu_disk.php', |
||
445 | data: formValues, |
||
446 | type: 'POST', |
||
447 | dataType: 'html', |
||
448 | // Code to run if the request succeeds; |
||
449 | success: function (html) { |
||
450 | var returnHtml = html.split('[BRK]'); |
||
451 | $('#author_list').html(returnHtml[0]); |
||
452 | window.OSDMessageDisplay(returnHtml[1]); |
||
453 | } |
||
454 | }); |
||
455 | } |
||
456 | } |
||
457 | |||
458 | window.addDoctoMenu = function (softwareId, menuDiskId, softwareType) { |
||
459 | if (softwareId === '') { |
||
460 | $('#menu_doc_list').html(''); |
||
461 | } else { |
||
462 | $.ajax({ |
||
463 | // The URL for the request |
||
464 | url: 'db_menu_disk.php', |
||
465 | data: 'action=add_doc_to_menu&software_id=' + softwareId + '&menu_disk_id=' + menuDiskId + '&software_type=' + softwareType, |
||
466 | type: 'POST', |
||
467 | dataType: 'html', |
||
468 | // Code to run if the request succeeds; |
||
469 | success: function (html) { |
||
470 | var returnHtml = html.split('[BRK]'); |
||
471 | $('#menu_doc_list').html(returnHtml[0]); |
||
472 | window.OSDMessageDisplay(returnHtml[1]); |
||
473 | } |
||
474 | }); |
||
475 | } |
||
476 | } |
||
477 | |||
478 | window.addScreenshottoMenu = function (menuDiskId) { |
||
479 | if (menuDiskId === '') { |
||
480 | $('#JSMenuScreenshotList').html(''); |
||
481 | } else { |
||
482 | var form = $('#screenshot_add_to_menu')[0]; |
||
483 | var formValues = new FormData(form); |
||
484 | |||
485 | $.ajax({ |
||
486 | // The URL for the request |
||
487 | url: 'db_menu_disk.php', |
||
488 | data: formValues, |
||
489 | type: 'POST', |
||
490 | contentType: false, |
||
491 | processData: false, |
||
492 | dataType: 'html', |
||
493 | // Code to run if the request succeeds; |
||
494 | success: function (html) { |
||
495 | var returnHtml = html.split('[BRK]'); |
||
496 | $('#JSMenuScreenshotList').html(returnHtml[0]); |
||
497 | window.OSDMessageDisplay(returnHtml[1]); |
||
498 | document.getElementById('screenshot_add_to_menu').reset(); |
||
499 | } |
||
500 | }); |
||
501 | } |
||
502 | } |
||
503 | |||
504 | window.addFiletoMenu = function (menuDiskId) { |
||
505 | if (menuDiskId === '') { |
||
506 | $('#JSMenuFileList').html(''); |
||
507 | } else { |
||
508 | var form = $('#file_add_to_menu')[0]; |
||
509 | var formValues = new FormData(form); |
||
510 | |||
511 | $.ajax({ |
||
512 | // The URL for the request |
||
513 | url: 'db_menu_disk.php', |
||
514 | data: formValues, |
||
515 | type: 'POST', |
||
516 | contentType: false, |
||
517 | processData: false, |
||
518 | dataType: 'html', |
||
519 | // Code to run if the request succeeds; |
||
520 | success: function (html) { |
||
521 | var returnHtml = html.split('[BRK]'); |
||
522 | $('#JSMenuFileList').html(returnHtml[0]); |
||
523 | window.OSDMessageDisplay(returnHtml[1]); |
||
524 | document.getElementById('File_add_to_menu').reset(); |
||
525 | } |
||
526 | }); |
||
527 | } |
||
528 | } |
||
529 | |||
530 | window.linkChain = function (menuDiskTitleId, menuDiskId) { |
||
|
|||
531 | if (menuDiskTitleId === '') { |
||
532 | $('#JSMenuSoftwareList').html(''); |
||
533 | } else { |
||
534 | var formValues = $('#link_game_to_set').serialize(); |
||
535 | $.ajax({ |
||
536 | // The URL for the request |
||
537 | url: 'db_menu_disk.php', |
||
538 | data: formValues, |
||
539 | type: 'POST', |
||
540 | dataType: 'html', |
||
541 | // Code to run if the request succeeds; |
||
542 | success: function (html) { |
||
543 | var returnHtml = html.split('[BRK]'); |
||
544 | $('#JSMenuSoftwareList').html(returnHtml[0]); |
||
545 | window.OSDMessageDisplay(returnHtml[1]); |
||
546 | $('#JSMenuDetailExpandSet').html(''); |
||
547 | } |
||
548 | }); |
||
549 | } |
||
550 | } |
||
551 | |||
552 | window.deleteChain = function (menuDiskTitleId, menuDiskId, titleName) { |
||
553 | if (menuDiskTitleId === '') { |
||
554 | $('#JSMenuSoftwareList').html(''); |
||
555 | } else { |
||
556 | $.ajax({ |
||
557 | // The URL for the request |
||
558 | url: 'db_menu_disk.php', |
||
559 | data: 'action=delete_game_from_set&menu_disk_title_id=' + menuDiskTitleId + '&menu_disk_id=' + menuDiskId + '&title_name=' + titleName, |
||
560 | type: 'POST', |
||
561 | dataType: 'html', |
||
562 | // Code to run if the request succeeds; |
||
563 | success: function (html) { |
||
564 | var returnHtml = html.split('[BRK]'); |
||
565 | $('#JSMenuSoftwareList').html(returnHtml[0]); |
||
566 | window.OSDMessageDisplay(returnHtml[1]); |
||
567 | $('#JSMenuDetailExpandSet').html(''); |
||
568 | } |
||
569 | }); |
||
570 | } |
||
571 | } |
||
572 | |||
573 | window.createChain = function (str, menuDiskId) { |
||
574 | if (str === '') { |
||
575 | $('#JSMenuSoftwareList').html(''); |
||
576 | } else { |
||
577 | $.ajax({ |
||
578 | // The URL for the request |
||
579 | url: 'db_menu_disk.php', |
||
580 | data: 'action=add_set_to_menu&menu_disk_title_id=' + str + '&menu_disk_id=' + menuDiskId, |
||
581 | type: 'POST', |
||
582 | dataType: 'html', |
||
583 | // Code to run if the request succeeds; |
||
584 | success: function (html) { |
||
585 | var returnHtml = html.split('[BRK]'); |
||
586 | $('#JSMenuSoftwareList').html(returnHtml[0]); |
||
587 | window.OSDMessageDisplay(returnHtml[1]); |
||
588 | $('#JSMenuDetailExpandSet').html(''); |
||
589 | } |
||
590 | }); |
||
591 | } |
||
592 | } |
||
593 | |||
594 | window.addCreditstoMenu = function (menuDiskId) { |
||
595 | if (menuDiskId === '') { |
||
596 | $('#menu_credit_list').html(''); |
||
597 | } else { |
||
598 | var indId = document.getElementById('menu_credits_form').elements.namedItem('ind_id').value; |
||
599 | var authorTypeId = document.getElementById('menu_credits_form').elements.namedItem('author_type_id').value; |
||
600 | $.ajax({ |
||
601 | // The URL for the request |
||
602 | url: 'db_menu_disk.php', |
||
603 | data: 'action=add_intro_credits&author_type_id=' + authorTypeId + '&menu_disk_id=' + menuDiskId + '&ind_id=' + indId, |
||
604 | type: 'POST', |
||
605 | dataType: 'html', |
||
606 | // Code to run if the request succeeds; |
||
607 | success: function (html) { |
||
608 | var returnHtml = html.split('[BRK]'); |
||
609 | $('#menu_credit_list').html(returnHtml[0]); |
||
610 | window.OSDMessageDisplay(returnHtml[1]); |
||
611 | document.getElementById('menu_credit_list').reset(); |
||
612 | } |
||
613 | }); |
||
614 | } |
||
615 | } |
||
616 | |||
617 | View Code Duplication | window.changeState = function (stateId, menuDiskId) { |
|
618 | var str2 = 'diskedit_ajax_'; |
||
619 | var diskEditAjax = str2.concat(menuDiskId); |
||
620 | if (menuDiskId === '') { |
||
621 | $('#' + diskEditAjax).html(''); |
||
622 | } else { |
||
623 | $.ajax({ |
||
624 | // The URL for the request |
||
625 | url: 'db_menu_disk.php', |
||
626 | data: 'action=change_menu_disk_state&state_id=' + stateId + '&menu_disk_id=' + menuDiskId, |
||
627 | type: 'POST', |
||
628 | dataType: 'html', |
||
629 | // Code to run if the request succeeds; |
||
630 | success: function (html) { |
||
631 | var returnHtml = html.split('[BRK]'); |
||
632 | $('#' + diskEditAjax).html(returnHtml[0]); |
||
633 | window.OSDMessageDisplay(returnHtml[1]); |
||
634 | document.getElementById(diskEditAjax).reset(); |
||
635 | } |
||
636 | }); |
||
637 | } |
||
638 | } |
||
639 | |||
640 | window.changeDoctype = function (docTypeId, docId, menuDiskId) { |
||
641 | if (docTypeId === '') { |
||
642 | $('#menu_doc_list').html(''); |
||
643 | } else { |
||
644 | $.ajax({ |
||
645 | // The URL for the request |
||
646 | url: 'db_menu_disk.php', |
||
647 | data: 'action=change_doctype&doc_type_id=' + docTypeId + '&doc_id=' + docId + '&menu_disk_id=' + menuDiskId, |
||
648 | type: 'POST', |
||
649 | dataType: 'html', |
||
650 | // Code to run if the request succeeds; |
||
651 | success: function (html) { |
||
652 | var returnHtml = html.split('[BRK]'); |
||
653 | $('#menu_doc_list').html(returnHtml[0]); |
||
654 | window.OSDMessageDisplay(returnHtml[1]); |
||
655 | document.getElementById('menu_doc_list').reset(); |
||
656 | } |
||
657 | }); |
||
658 | } |
||
659 | } |
||
660 | |||
661 | View Code Duplication | window.changeYear = function (yearId, menuDiskId) { |
|
662 | var str2 = 'diskedit_ajax_'; |
||
663 | var diskEditAjax = str2.concat(menuDiskId); |
||
664 | if (menuDiskId === '') { |
||
665 | $('#' + diskEditAjax).html(''); |
||
666 | } else { |
||
667 | $.ajax({ |
||
668 | // The URL for the request |
||
669 | url: 'db_menu_disk.php', |
||
670 | data: 'action=change_menu_disk_year&year_id=' + yearId + '&menu_disk_id=' + menuDiskId, |
||
671 | type: 'POST', |
||
672 | dataType: 'html', |
||
673 | // Code to run if the request succeeds; |
||
674 | success: function (html) { |
||
675 | var returnHtml = html.split('[BRK]'); |
||
676 | $('#' + diskEditAjax).html(returnHtml[0]); |
||
677 | window.OSDMessageDisplay(returnHtml[1]); |
||
678 | document.getElementById(diskEditAjax).reset(); |
||
679 | } |
||
680 | }); |
||
681 | } |
||
682 | } |
||
683 | |||
684 | View Code Duplication | window.changeParent = function (parentId, menuDiskId) { |
|
685 | var str2 = 'diskedit_ajax_'; |
||
686 | var diskEditAjax = str2.concat(menuDiskId); |
||
687 | if (menuDiskId === '') { |
||
688 | $('#disk_edit_ajax').html(''); |
||
689 | } else { |
||
690 | $.ajax({ |
||
691 | // The URL for the request |
||
692 | url: 'db_menu_disk.php', |
||
693 | data: 'action=change_menu_disk_parent&parent_id=' + parentId + '&menu_disk_id=' + menuDiskId, |
||
694 | type: 'POST', |
||
695 | dataType: 'html', |
||
696 | // Code to run if the request succeeds; |
||
697 | success: function (html) { |
||
698 | var returnHtml = html.split('[BRK]'); |
||
699 | $('#' + diskEditAjax).html(returnHtml[0]); |
||
700 | window.OSDMessageDisplay(returnHtml[1]); |
||
701 | document.getElementById(diskEditAjax).reset(); |
||
702 | } |
||
703 | }); |
||
704 | } |
||
705 | } |
||
706 | // Are you sure question Delete |
||
707 | window.deleteGamefromMenuButton = function (str, menuDiskId) { |
||
708 | $('#JSGenericModal').dialog({ |
||
709 | title: 'Delete Title', |
||
710 | open: $('#JSGenericModalText').text('Are you sure you want to delete this title from the menu disk?'), |
||
711 | resizable: false, |
||
712 | height: 200, |
||
713 | modal: true, |
||
714 | buttons: { |
||
715 | 'Delete title': function () { |
||
716 | $(this).dialog('close'); |
||
717 | deleteGamefromMenu(str, menuDiskId); |
||
718 | }, |
||
719 | Cancel: function () { |
||
720 | $(this).dialog('close'); |
||
721 | $('#menu_disk_title_id' + str).prop('checked', false); |
||
722 | } |
||
723 | } |
||
724 | }); |
||
725 | } |
||
726 | |||
727 | function deleteGamefromMenu (menuDiskTitleId, menuDiskId) { |
||
728 | if (menuDiskTitleId === '') { |
||
729 | $('#JSMenuSoftwareList').html(''); |
||
730 | } else { |
||
731 | $.ajax({ |
||
732 | // The URL for the request |
||
733 | url: 'db_menu_disk.php', |
||
734 | data: 'action=delete_from_menu_disk&menu_disk_title_id=' + menuDiskTitleId + '&menu_disk_id=' + menuDiskId, |
||
735 | type: 'POST', |
||
736 | dataType: 'html', |
||
737 | // Code to run if the request succeeds; |
||
738 | success: function (html) { |
||
739 | var returnHtml = html.split('[BRK]'); |
||
740 | $('#JSMenuSoftwareList').html(returnHtml[0]); |
||
741 | window.OSDMessageDisplay(returnHtml[1]); |
||
742 | } |
||
743 | }); |
||
744 | } |
||
745 | } |
||
746 | |||
747 | window.deleteMenuDiskModal = function (menuDiskId) { |
||
748 | $('#JSGenericModal').dialog({ |
||
749 | title: 'Delete Disk?', |
||
750 | open: $('#JSGenericModalText').text('Are you sure you want to delete this menu disk?'), |
||
751 | resizable: false, |
||
752 | height: 200, |
||
753 | modal: true, |
||
754 | buttons: { |
||
755 | 'Delete disk': function () { |
||
756 | $(this).dialog('close'); |
||
757 | deleteMenuDisk(menuDiskId); |
||
758 | }, |
||
759 | Cancel: function () { |
||
760 | $(this).dialog('close'); |
||
761 | } |
||
762 | } |
||
763 | }); |
||
764 | } |
||
765 | |||
766 | function deleteMenuDisk (menuDiskId) { |
||
767 | var str2 = 'diskedit_ajax_'; |
||
768 | var diskEditAjax = str2.concat(menuDiskId); |
||
769 | $.ajax({ |
||
770 | // The URL for the request |
||
771 | url: 'db_menu_disk.php', |
||
772 | data: 'action=delete_menu_disk&menu_disk_id=' + menuDiskId, |
||
773 | type: 'POST', |
||
774 | dataType: 'html', |
||
775 | // Code to run if the request succeeds; |
||
776 | success: function (html) { |
||
777 | if (html === 'Menudisk completely removed') { |
||
778 | $('#' + diskEditAjax).html(''); |
||
779 | } |
||
780 | window.OSDMessageDisplay(html); |
||
781 | } |
||
782 | }); |
||
783 | } |
||
784 | |||
785 | window.deleteMenuSetIndividualModal = function (indSelect, menuSetsId) { |
||
786 | $('#JSGenericModal').dialog({ |
||
787 | title: 'Delete Individual?', |
||
788 | open: $('#JSGenericModalText').text('Are you sure you want to delete this Individual from the Menu Set?'), |
||
789 | resizable: false, |
||
790 | height: 200, |
||
791 | modal: true, |
||
792 | buttons: { |
||
793 | 'Delete disk': function () { |
||
794 | $(this).dialog('close'); |
||
795 | var url = 'db_menu_set.php?menu_sets_id=' + menuSetsId + '&ind_id=' + indSelect + '&action=delete_ind_from_menu_set'; |
||
796 | location.href = url; |
||
797 | }, |
||
798 | Cancel: function () { |
||
799 | $(this).dialog('close'); |
||
800 | } |
||
801 | } |
||
802 | }); |
||
803 | } |
||
804 | |||
805 | window.deleteMenuSetCrewModal = function (crewSelect, menuSetsId) { |
||
806 | $('#JSGenericModal').dialog({ |
||
807 | title: 'Delete Crew?', |
||
808 | open: $('#JSGenericModalText').text('Are you sure you want to delete this Crew from the Menu Set?'), |
||
809 | resizable: false, |
||
810 | height: 200, |
||
811 | modal: true, |
||
812 | buttons: { |
||
813 | 'Delete disk': function () { |
||
814 | $(this).dialog('close'); |
||
815 | var url = 'db_menu_set.php?menu_sets_id=' + menuSetsId + '&crew_id=' + crewSelect + '&action=delete_crew_from_menu_set'; |
||
816 | location.href = url; |
||
817 | }, |
||
818 | Cancel: function () { |
||
819 | $(this).dialog('close'); |
||
820 | } |
||
821 | } |
||
822 | }); |
||
823 | } |
||
824 | |||
825 | window.menuTypeDelete = function (menuTypeSelect, menuSetsId) { |
||
826 | $('#JSGenericModal').dialog({ |
||
827 | title: 'Delete menu type?', |
||
828 | open: $('#JSGenericModalText').text('Are you sure you want to delete this menu type from this menu set?'), |
||
829 | resizable: false, |
||
830 | height: 200, |
||
831 | modal: true, |
||
832 | buttons: { |
||
833 | 'Delete disk': function () { |
||
834 | $(this).dialog('close'); |
||
835 | var url = 'db_menu_set.php?menu_sets_id=' + menuSetsId + '&menu_type_id=' + menuTypeSelect + '&action=delete_menu_type_from_menu_set'; |
||
836 | location.href = url; |
||
837 | }, |
||
838 | Cancel: function () { |
||
839 | $(this).dialog('close'); |
||
840 | } |
||
841 | } |
||
842 | }); |
||
843 | } |
||
844 | |||
845 | window.deleteScreenshotfromMenu = function (str, menuDiskId) { |
||
846 | $('#JSGenericModal').dialog({ |
||
847 | title: 'Delete Screenshot?', |
||
848 | open: $('#JSGenericModalText').text('Are you sure you want to delete this screenshot from this menu disk?'), |
||
849 | resizable: false, |
||
850 | height: 200, |
||
851 | modal: true, |
||
852 | buttons: { |
||
853 | 'Delete': function () { |
||
854 | $(this).dialog('close'); |
||
855 | $.ajax({ |
||
856 | // The URL for the request |
||
857 | url: 'db_menu_disk.php', |
||
858 | data: 'action=delete_screen_from_menu_disk&screenshot_id=' + str + '&menu_disk_id=' + menuDiskId, |
||
859 | type: 'POST', |
||
860 | dataType: 'html', |
||
861 | // Code to run if the request succeeds; |
||
862 | success: function (html) { |
||
863 | var returnHtml = html.split('[BRK]'); |
||
864 | $('#JSMenuScreenshotList').html(returnHtml[0]); |
||
865 | window.OSDMessageDisplay(returnHtml[1]); |
||
866 | } |
||
867 | }); |
||
868 | }, |
||
869 | Cancel: function () { |
||
870 | $(this).dialog('close'); |
||
871 | $('#JSMenuScreenshotList').html(''); |
||
872 | } |
||
873 | } |
||
874 | }); |
||
875 | } |
||
876 | |||
877 | window.deleteDownload = function (str, menuDiskId) { |
||
878 | $('#JSGenericModal').dialog({ |
||
879 | title: 'Delete download?', |
||
880 | open: $('#JSGenericModalText').text('Are you sure you want to delete this download from this menu disk?'), |
||
881 | resizable: false, |
||
882 | height: 200, |
||
883 | modal: true, |
||
884 | buttons: { |
||
885 | 'Delete': function () { |
||
886 | $(this).dialog('close'); |
||
887 | $.ajax({ |
||
888 | // The URL for the request |
||
889 | url: 'db_menu_disk.php', |
||
890 | data: 'action=delete_download_from_menu_disk&menu_disk_download_id=' + str + '&menu_disk_id=' + menuDiskId, |
||
891 | type: 'POST', |
||
892 | dataType: 'html', |
||
893 | // Code to run if the request succeeds; |
||
894 | success: function (html) { |
||
895 | var returnHtml = html.split('[BRK]'); |
||
896 | $('#JSMenuFileList').html(returnHtml[0]); |
||
897 | window.OSDMessageDisplay(returnHtml[1]); |
||
898 | } |
||
899 | }); |
||
900 | }, |
||
901 | Cancel: function () { |
||
902 | $(this).dialog('close'); |
||
903 | } |
||
904 | } |
||
905 | }); |
||
906 | } |
||
907 | |||
908 | window.deleteDocfromMenu = function (str, menuDiskId) { |
||
909 | document.getElementById('menu_disk_title_id' + str).checked = false; |
||
910 | $('#JSGenericModal').dialog({ |
||
911 | title: 'Delete Doc title?', |
||
912 | open: $('#JSGenericModalText').text('Are you sure you want to delete this doc title from this menu disk?'), |
||
913 | resizable: false, |
||
914 | height: 200, |
||
915 | modal: true, |
||
916 | buttons: { |
||
917 | 'Delete': function () { |
||
918 | $(this).dialog('close'); |
||
919 | $.ajax({ |
||
920 | // The URL for the request |
||
921 | url: 'db_menu_disk.php', |
||
922 | data: 'action=delete_doc_from_menu_disk&menu_disk_title_id=' + str + '&menu_disk_id=' + menuDiskId, |
||
923 | type: 'POST', |
||
924 | dataType: 'html', |
||
925 | // Code to run if the request succeeds; |
||
926 | success: function (html) { |
||
927 | var returnHtml = html.split('[BRK]'); |
||
928 | $('#menu_doc_list').html(returnHtml[0]); |
||
929 | window.OSDMessageDisplay(returnHtml[1]); |
||
930 | } |
||
931 | }); |
||
932 | }, |
||
933 | Cancel: function () { |
||
934 | $(this).dialog('close'); |
||
935 | $('#menu_doc_list').html(''); |
||
936 | } |
||
937 | } |
||
938 | }); |
||
939 | } |
||
940 | |||
941 | window.deleteSet = function (str) { |
||
942 | $('#JSGenericModal').dialog({ |
||
943 | title: 'Delete menu set?', |
||
944 | open: $('#JSGenericModalText').text('Are you sure you want to delete this set?'), |
||
945 | resizable: false, |
||
946 | height: 200, |
||
947 | modal: true, |
||
948 | buttons: { |
||
949 | 'Delete disk': function () { |
||
950 | $(this).dialog('close'); |
||
951 | var url = '../menus/db_menu_set.php?action=delete_set&menu_sets_id=' + str; |
||
952 | location.href = url; |
||
953 | }, |
||
954 | Cancel: function () { |
||
955 | $(this).dialog('close'); |
||
956 | } |
||
957 | } |
||
958 | }); |
||
959 | } |
||
960 | |||
961 | window.publishSet = function (str, action) { |
||
962 | $('#JSGenericModal').dialog({ |
||
963 | title: 'Change Status?', |
||
964 | open: $('#JSGenericModalText').text('Are you sure you want to change status on this set?'), |
||
965 | resizable: false, |
||
966 | height: 200, |
||
967 | modal: true, |
||
968 | buttons: { |
||
969 | 'Change': function () { |
||
970 | $(this).dialog('close'); |
||
971 | var url = '../menus/db_menu_set.php?action=publish_set&online=' + action + '&menu_sets_id=' + str; |
||
972 | location.href = url; |
||
973 | }, |
||
974 | Cancel: function () { |
||
975 | $(this).dialog('close'); |
||
976 | } |
||
977 | } |
||
978 | }); |
||
979 | } |
||
980 | |||
981 | View Code Duplication | window.deleteCredits = function (menuDiskCreditsId, menuDiskId) { |
|
982 | $('#JSGenericModal').dialog({ |
||
983 | title: 'Delete from credits?', |
||
984 | open: $('#JSGenericModalText').text('Are you sure you want to delete this person from the credit list?'), |
||
985 | resizable: false, |
||
986 | height: 200, |
||
987 | modal: true, |
||
988 | buttons: { |
||
989 | 'Delete': function () { |
||
990 | $(this).dialog('close'); |
||
991 | $.ajax({ |
||
992 | // The URL for the request |
||
993 | url: 'db_menu_disk.php', |
||
994 | data: 'action=delete_menu_disk_credits&menu_disk_credits_id=' + menuDiskCreditsId + '&menu_disk_id=' + menuDiskId, |
||
995 | type: 'POST', |
||
996 | dataType: 'html', |
||
997 | // Code to run if the request succeeds; |
||
998 | success: function (html) { |
||
999 | var returnHtml = html.split('[BRK]'); |
||
1000 | $('#menu_credit_list').html(returnHtml[0]); |
||
1001 | window.OSDMessageDisplay(returnHtml[1]); |
||
1002 | document.getElementById('menu_credit_list').reset(); |
||
1003 | } |
||
1004 | }); |
||
1005 | }, |
||
1006 | Cancel: function () { |
||
1007 | $(this).dialog('close'); |
||
1008 | } |
||
1009 | } |
||
1010 | }); |
||
1011 | } |
||
1012 | |||
1013 | View Code Duplication | window.deleteTitleCredits = function (menuDiskTitleId, indId, authorTypeId) { |
|
1014 | $('#JSGenericModal').dialog({ |
||
1015 | title: 'Delete from credits?', |
||
1016 | open: $('#JSGenericModalText').text('Are you sure you want to delete this person from the title credit list?'), |
||
1017 | resizable: false, |
||
1018 | height: 200, |
||
1019 | modal: true, |
||
1020 | buttons: { |
||
1021 | 'Delete': function () { |
||
1022 | $(this).dialog('close'); |
||
1023 | $.ajax({ |
||
1024 | // The URL for the request |
||
1025 | url: 'db_menu_disk.php', |
||
1026 | data: 'action=delete_menu_disk_title_credits&menu_disk_title_id=' + menuDiskTitleId + '&author_type_id=' + authorTypeId + '+&ind_id=' + indId, |
||
1027 | type: 'POST', |
||
1028 | dataType: 'html', |
||
1029 | // Code to run if the request succeeds; |
||
1030 | success: function (html) { |
||
1031 | var returnHtml = html.split('[BRK]'); |
||
1032 | $('#author_list').html(returnHtml[0]); |
||
1033 | window.OSDMessageDisplay(returnHtml[1]); |
||
1034 | document.getElementById('author_list').reset(); |
||
1035 | } |
||
1036 | }); |
||
1037 | }, |
||
1038 | Cancel: function () { |
||
1039 | $(this).dialog('close'); |
||
1040 | } |
||
1041 | } |
||
1042 | }); |
||
1043 | } |
||
1044 |
This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.