[ticket/11442] Use button name as indicator instead of css classes

This leaves it up to the style authors how to style any buttons, without
messing up any functionality.

PHPBB3-11442
This commit is contained in:
Joas Schilling 2013-05-08 00:08:35 +02:00
parent 665352d0d1
commit 1834ceb614

View file

@ -136,7 +136,7 @@ phpbb.confirm = function(msg, callback, fadedark) {
}); });
var clickHandler = function(e) { var clickHandler = function(e) {
var res = this.className === 'button1'; var res = this.name === 'confirm';
var fade = (typeof fadedark !== 'undefined' && !fadedark && res) ? div : dark; var fade = (typeof fadedark !== 'undefined' && !fadedark && res) ? div : dark;
fade.fadeOut(phpbb.alertTime, function() { fade.fadeOut(phpbb.alertTime, function() {
div.hide(); div.hide();
@ -164,11 +164,11 @@ phpbb.confirm = function(msg, callback, fadedark) {
$(document).bind('keydown', function(e) { $(document).bind('keydown', function(e) {
if (e.keyCode === keymap.ENTER) { if (e.keyCode === keymap.ENTER) {
$('input[type="button"].button1').trigger('click'); $('input[name="confirm"]').trigger('click');
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
} else if (e.keyCode === keymap.ESC) { } else if (e.keyCode === keymap.ESC) {
$('input[type="button"].button2').trigger('click'); $('input[name="cancel"]').trigger('click');
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
} }