Code Duplication    Length = 34-34 lines in 2 locations

public/themes/templates/1/includes/js/news.js 2 locations

@@ 323-356 (lines=34) @@
320
        });
321
    })
322
    // Delete news Function in dropdown
323
    $('.jsNewsWrapper').on('click', '.jsNewsPostDeleteDropdownItem', function () {
324
        var newsId = $(this).data('news-id');
325
        $('#JSGenericModal').dialog({
326
            title: 'Delete News Post',
327
            open: $('#JSGenericModalText').text('Are you sure you want to delete this news post?'),
328
            resizable: false,
329
            height: 200,
330
            modal: true,
331
            buttons: {
332
                'Delete': function () {
333
                    $(this).dialog('close');
334
                    $.ajaxQueue({
335
                        // The URL for the request
336
                        url: 'db_news.php',
337
                        data: 'action=delete_news&news_id=' + newsId,
338
                        type: 'POST',
339
                        dataType: 'html',
340
                        // Code to run if the request succeeds;
341
                        success: function (html) {
342
                            var begin = html.startsWith('You');
343
                            if (begin) {
344
                            } else {
345
                                $('#jsNewsId' + newsId).html('');
346
                            }
347
                            window.OSDMessageDisplay(html);
348
                        }
349
                    });
350
                },
351
                Cancel: function () {
352
                    $(this).dialog('close');
353
                }
354
            }
355
        });
356
    })
357
358
    $('.jsNewsWrapper').on('click', '.news_button_dropdown', function () {
359
        var dropdownId = $(this).data('dropdown-id');
@@ 288-321 (lines=34) @@
285
        });
286
    })
287
    // Delete news Function
288
    $('.jsNewsWrapper').on('click', '.jsNewsPostDeleteButton', function () {
289
        var newsId = $(this).data('news-id');
290
        $('#JSGenericModal').dialog({
291
            title: 'Delete News Post',
292
            open: $('#JSGenericModalText').text('Are you sure you want to delete this news post?'),
293
            resizable: false,
294
            height: 200,
295
            modal: true,
296
            buttons: {
297
                'Delete': function () {
298
                    $(this).dialog('close');
299
                    $.ajaxQueue({
300
                        // The URL for the request
301
                        url: 'db_news.php',
302
                        data: 'action=delete_news&news_id=' + newsId,
303
                        type: 'POST',
304
                        dataType: 'html',
305
                        // Code to run if the request succeeds;
306
                        success: function (html) {
307
                            var begin = html.startsWith('You');
308
                            if (begin) {
309
                            } else {
310
                                $('#jsNewsId' + newsId).html('');
311
                            }
312
                            window.OSDMessageDisplay(html);
313
                        }
314
                    });
315
                },
316
                Cancel: function () {
317
                    $(this).dialog('close');
318
                }
319
            }
320
        });
321
    })
322
    // Delete news Function in dropdown
323
    $('.jsNewsWrapper').on('click', '.jsNewsPostDeleteDropdownItem', function () {
324
        var newsId = $(this).data('news-id');