mirror of
https://github.com/transmission/transmission.git
synced 2025-12-20 10:28:32 +00:00
#5894: Get rid of eval() in JS code (patch by Ancient; 2nd part)
This commit is contained in:
@@ -24,8 +24,7 @@ Dialog.prototype = {
|
||||
this._message = $('#dialog_message');
|
||||
this._cancel_button = $('#dialog_cancel_button');
|
||||
this._confirm_button = $('#dialog_confirm_button');
|
||||
this._callback_function = '';
|
||||
this._callback_data = null;
|
||||
this._callback = null;
|
||||
|
||||
// Observe the buttons
|
||||
this._cancel_button.bind('click', {dialog: this}, this.onCancelClicked);
|
||||
@@ -58,7 +57,7 @@ Dialog.prototype = {
|
||||
onConfirmClicked: function(event)
|
||||
{
|
||||
var dialog = event.data.dialog;
|
||||
eval(dialog._callback_function + "(dialog._callback_data)");
|
||||
dialog._callback();
|
||||
dialog.hideDialog();
|
||||
},
|
||||
|
||||
@@ -72,7 +71,7 @@ Dialog.prototype = {
|
||||
* Display a confirm dialog
|
||||
*/
|
||||
confirm: function(dialog_heading, dialog_message, confirm_button_label,
|
||||
callback_function, callback_data, cancel_button_label)
|
||||
callback, cancel_button_label)
|
||||
{
|
||||
if (!isMobileDevice)
|
||||
$('.dialog_container').hide();
|
||||
@@ -81,8 +80,7 @@ Dialog.prototype = {
|
||||
setTextContent(this._cancel_button[0], cancel_button_label || 'Cancel');
|
||||
setTextContent(this._confirm_button[0], confirm_button_label);
|
||||
this._confirm_button.show();
|
||||
this._callback_function = callback_function;
|
||||
this._callback_data = callback_data;
|
||||
this._callback = callback;
|
||||
$('body').addClass('dialog_showing');
|
||||
this._container.show();
|
||||
transmission.updateButtonStates();
|
||||
|
||||
Reference in New Issue
Block a user