/usr/share/transmission/web/javascript/dialog.js is in transmission-common 2.84-3ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | /**
* Copyright © Dave Perrett and Malcolm Jarvis
*
* This file is licensed under the GPLv2.
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*/
function Dialog(){
this.initialize();
}
Dialog.prototype = {
/*
* Constructor
*/
initialize: function() {
/*
* Private Interface Variables
*/
this._container = $('#dialog_container');
this._heading = $('#dialog_heading');
this._message = $('#dialog_message');
this._cancel_button = $('#dialog_cancel_button');
this._confirm_button = $('#dialog_confirm_button');
this._callback_function = '';
this._callback_data = null;
// Observe the buttons
this._cancel_button.bind('click', {dialog: this}, this.onCancelClicked);
this._confirm_button.bind('click', {dialog: this}, this.onConfirmClicked);
},
/*--------------------------------------------
*
* E V E N T F U N C T I O N S
*
*--------------------------------------------*/
hideDialog: function()
{
$('body.dialog_showing').removeClass('dialog_showing');
this._container.hide();
transmission.hideMobileAddressbar();
transmission.updateButtonStates();
},
onCancelClicked: function(event)
{
event.data.dialog.hideDialog();
},
onConfirmClicked: function(event)
{
var dialog = event.data.dialog;
eval(dialog._callback_function + "(dialog._callback_data)");
dialog.hideDialog();
},
/*--------------------------------------------
*
* I N T E R F A C E F U N C T I O N S
*
*--------------------------------------------*/
/*
* Display a confirm dialog
*/
confirm: function(dialog_heading, dialog_message, confirm_button_label,
callback_function, callback_data, cancel_button_label)
{
if (!isMobileDevice)
$('.dialog_container').hide();
setTextContent(this._heading[0], dialog_heading);
setTextContent(this._message[0], dialog_message);
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;
$('body').addClass('dialog_showing');
this._container.show();
transmission.updateButtonStates();
if (isMobileDevice)
transmission.hideMobileAddressbar();
},
/*
* Display an alert dialog
*/
alert: function(dialog_heading, dialog_message, cancel_button_label) {
if (!isMobileDevice)
$('.dialog_container').hide();
setTextContent(this._heading[0], dialog_heading);
setTextContent(this._message[0], dialog_message);
// jquery::hide() doesn't work here in Safari for some odd reason
this._confirm_button.css('display', 'none');
setTextContent(this._cancel_button[0], cancel_button_label);
// Just in case
$('#upload_container').hide();
$('#move_container').hide();
$('body').addClass('dialog_showing');
transmission.updateButtonStates();
if (isMobileDevice)
transmission.hideMobileAddressbar();
this._container.show();
}
}
|