Code Duplication    Length = 32-32 lines in 2 locations

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

@@ 109-140 (lines=32) @@
106
        });
107
    })
108
    // Delete submission Function in dropdown
109
    $('.jsNewsWrapper').on('click', '.jsNewsDeleteDropdownItem', function () {
110
        var newsId = $(this).data('news-id');
111
        $('#JSGenericModal').dialog({
112
            title: 'Delete Submission',
113
            open: $('#JSGenericModalText').text('Are you sure you want to delete this submission?'),
114
            resizable: false,
115
            height: 200,
116
            modal: true,
117
            buttons: {
118
                'Delete': function () {
119
                    $(this).dialog('close');
120
                    $.ajaxQueue({
121
                        // The URL for the request
122
                        url: 'db_news.php',
123
                        data: 'action=delete_submission&news_id=' + newsId,
124
                        type: 'POST',
125
                        dataType: 'html',
126
                        // Code to run if the request succeeds;
127
                        success: function (html) {
128
                            var returnHtml = html.split('[BRK]');
129
                            $('#news_submission_list').html(returnHtml[0]);
130
                            window.OSDMessageDisplay(returnHtml[1]);
131
                            document.getElementById('post').reset();
132
                        }
133
                    });
134
                },
135
                Cancel: function () {
136
                    $(this).dialog('close');
137
                }
138
            }
139
        });
140
    })
141
    // Approve Submission Function
142
    $('.jsNewsWrapper').on('click', '.jsNewsApproveButton', function () {
143
        var newsId = $(this).data('news-id');
@@ 76-107 (lines=32) @@
73
        });
74
    })
75
    // Delete Submission Function
76
    $('.jsNewsWrapper').on('click', '.jsNewsDeleteButton', function () {
77
        var newsId = $(this).data('news-id');
78
        $('#JSGenericModal').dialog({
79
            title: 'Delete Submission',
80
            open: $('#JSGenericModalText').text('Are you sure you want to delete this submission?'),
81
            resizable: false,
82
            height: 200,
83
            modal: true,
84
            buttons: {
85
                'Delete': function () {
86
                    $(this).dialog('close');
87
                    $.ajaxQueue({
88
                        // The URL for the request
89
                        url: 'db_news.php',
90
                        data: 'action=delete_submission&news_id=' + newsId,
91
                        type: 'POST',
92
                        dataType: 'html',
93
                        // Code to run if the request succeeds;
94
                        success: function (html) {
95
                            var returnHtml = html.split('[BRK]');
96
                            $('#news_submission_list').html(returnHtml[0]);
97
                            window.OSDMessageDisplay(returnHtml[1]);
98
                            document.getElementById('post').reset();
99
                        }
100
                    });
101
                },
102
                Cancel: function () {
103
                    $(this).dialog('close');
104
                }
105
            }
106
        });
107
    })
108
    // Delete submission Function in dropdown
109
    $('.jsNewsWrapper').on('click', '.jsNewsDeleteDropdownItem', function () {
110
        var newsId = $(this).data('news-id');