2012-03-15 11:04:17 -04:00
|
|
|
/*
|
|
|
|
* fix-report-delete-submit.js
|
|
|
|
*
|
|
|
|
* Usage:
|
|
|
|
* $config['additional_javascript'][] = 'js/jquery.min.js';
|
2015-02-28 08:06:50 -05:00
|
|
|
* $config['additional_javascript'][] = 'js/post-menu.js';
|
2012-03-15 11:04:17 -04:00
|
|
|
* $config['additional_javascript'][] = 'js/fix-report-delete-submit.js';
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2016-05-09 04:59:50 -04:00
|
|
|
if (active_page == 'thread' || active_page == 'index' || active_page == 'ukko') {
|
2015-04-20 11:39:44 -04:00
|
|
|
$(document).on('menu_ready', function(){
|
2015-04-21 10:07:51 -04:00
|
|
|
var Menu = window.Menu;
|
2015-04-20 11:39:44 -04:00
|
|
|
|
2015-04-20 07:20:17 -04:00
|
|
|
if ($('#delete-fields #password').length) {
|
2015-03-20 04:09:21 -04:00
|
|
|
Menu.add_item("delete_post_menu", _("Delete post"));
|
|
|
|
Menu.add_item("delete_file_menu", _("Delete file"));
|
2015-02-28 08:06:50 -05:00
|
|
|
Menu.onclick(function(e, $buf) {
|
|
|
|
var ele = e.target.parentElement.parentElement;
|
|
|
|
var $ele = $(ele);
|
|
|
|
var threadId = $ele.parent().attr('id').replace('thread_', '');
|
|
|
|
var postId = $ele.find('.post_no').not('[id]').text();
|
2016-05-09 05:08:24 -04:00
|
|
|
var board_name = $ele.parent().data('board');
|
2015-02-28 08:06:50 -05:00
|
|
|
|
|
|
|
$buf.find('#delete_post_menu,#delete_file_menu').click(function(e) {
|
2012-03-15 11:04:17 -04:00
|
|
|
e.preventDefault();
|
2015-02-28 08:06:50 -05:00
|
|
|
$('#delete_'+postId).prop('checked', 'checked');
|
|
|
|
|
|
|
|
if ($(this).attr('id') === 'delete_file_menu') {
|
|
|
|
$('#delete_file').prop('checked', 'checked');
|
|
|
|
} else {
|
|
|
|
$('#delete_file').prop('checked', '');
|
|
|
|
}
|
2016-05-09 05:08:24 -04:00
|
|
|
$('input[type="hidden"][name="board"]').val(board_name);
|
2015-02-28 08:06:50 -05:00
|
|
|
$('input[name=delete][type=submit]').click();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2015-03-20 04:09:21 -04:00
|
|
|
Menu.add_item("report_menu", _("Report"));
|
2016-05-06 08:57:07 -04:00
|
|
|
//Menu.add_item("global_report_menu", _("Global report"));
|
2015-02-28 08:06:50 -05:00
|
|
|
Menu.onclick(function(e, $buf) {
|
|
|
|
var ele = e.target.parentElement.parentElement;
|
|
|
|
var $ele = $(ele);
|
|
|
|
var threadId = $ele.parent().attr('id').replace('thread_', '');
|
|
|
|
var postId = $ele.find('.post_no').not('[id]').text();
|
2016-05-09 05:08:24 -04:00
|
|
|
var board_name = $ele.parent().data('board');
|
2015-02-28 08:06:50 -05:00
|
|
|
|
|
|
|
$buf.find('#report_menu,#global_report_menu').click(function(e) {
|
2015-03-13 00:45:57 -04:00
|
|
|
if ($(this).attr('id') === "global_report_menu") {
|
|
|
|
var global = '&global';
|
2015-02-28 08:06:50 -05:00
|
|
|
} else {
|
2015-03-13 00:45:57 -04:00
|
|
|
var global = '';
|
2012-03-15 11:04:17 -04:00
|
|
|
}
|
2015-03-13 00:45:57 -04:00
|
|
|
window.open(configRoot+'report.php?board='+board_name+'&post=delete_'+postId+global, "", (global?"width=600, height=575":"width=500, height=275"));
|
2012-03-15 11:04:17 -04:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2015-02-28 08:06:50 -05:00
|
|
|
$(document).on('new_post', function(){
|
|
|
|
$('input.delete').hide();
|
|
|
|
});
|
|
|
|
$('input.delete').hide();
|
2015-04-20 07:20:17 -04:00
|
|
|
$('#post-moderation-fields').hide();
|
2015-04-20 11:39:44 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
if (typeof window.Menu !== "undefined") {
|
|
|
|
$(document).trigger('menu_ready');
|
|
|
|
}
|
|
|
|
}
|