/usr/share/coquelicot/public/javascripts/coquelicot.js is in coquelicot 0.9.5-1.
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 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | /*
* Coquelicot: "one-click" file sharing with a focus on users' privacy.
* Copyright © 2010-2013 potager.org <jardiniers@potager.org>
* © 2011 mh / immerda.ch <mh+coquelicot@immerda.ch>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
$(function($) {
$.lightBoxFu.initialize({
imagesPath: 'images/',
stylesheetsPath: 'stylesheets/'
});
$('form#upload').uploadProgress({
start:function() {
// after starting upload open lightBoxFu with our bar as html
$.lightBoxFu.open({
html: '<div id="uploading"><span id="received"></span><span id="size"></span><br/><div id="progress" class="bar"><div id="progressbar"> </div></div><span id="percent"></span></div>',
width: "250px",
closeOnClick: false
});
jQuery('#received').html(i18n.uploadStarting);
jQuery('#percent').html("0%");
},
uploading: function(upload) {
// update upload info on each /progress response
jQuery('#received').html(i18n.uploading + parseInt(upload.received / 1024) + "/");
jQuery('#size').html(parseInt(upload.size / 1024) + ' ' + i18n.kb);
jQuery('#percent').html(upload.percents + "%");
},
success: function(upload) {
$('#received').html('');
$('#size').html('');
$('#percent').html("100%");
},
interval: 2000,
/* if we are using images it's good to preload them, safari has problems with
downloading anything after hitting submit button. these are images for lightBoxFu
and progress bar */
preloadImages: ["images/overlay.png", "images/ajax-loader.gif"],
jqueryPath: "javascripts/jquery.min.js",
uploadProgressPath: "javascripts/jquery.uploadProgress.js",
progressUrl: "progress"
});
});
function addLinkToPasswordGenerator() {
var link = $('<a href="#" id="gen_pass" />');
link.text(i18n.generateRandomPassword);
var file_key = $('#file_key');
file_key.before(link);
link.click(function(e) {
e.preventDefault();
link.text(i18n.generatingRandomPassword);
$.get('random_pass', function(pass) {
file_key.val(pass);
file_key.hide();
var show = $('<div class="random-pass" />');
show.append($('<div>').append($('<code>').text(pass))).
append($('<div>').append($('<em>').text(i18n.writeItDown)));
link.before(show);
link.remove();
});
});
}
function authenticate() {
var authForm = $('<form></form>')
var authDiv = $('#upload-authentication').remove();
var lb = $.lightBoxFu;
authForm.bind('submit', function() {
jQuery.ajax({
type: 'POST',
url: 'authenticate',
dataType: 'text',
data: authentication.getData(),
success: function(data, textStatus, jqXHR) {
if (data != 'OK') {
/* Mh. Something strange happened. */
return;
}
var hiddenFields = $('<div />')
$.each(authentication.getData(), function(key, value) {
var hiddenField = $('<input type="hidden" />');
hiddenField.attr('name', key);
hiddenField.val(value);
hiddenFields.append(hiddenField)
});
$('#upload').prepend(hiddenFields);
lb.close();
if (authentication.handleAccept) {
authentication.handleAccept();
}
},
error: function(jqXHR, textStatus, errorThrown) {
switch (jqXHR.status) {
case 403:
$('#auth-message').text(i18n.pleaseTryAgain);
if (authentication.handleReject) {
authentication.handleReject();
}
return;
default:
$('#auth-message').
empty().
append($('<div />').text(i18n.error)).
append($('<div />').append($('<strong />').text(errorThrown))).
append($('<div />').text(jqXHR.responseText));
if (authentication.handleFailure) {
authentication.handleFailure(textStatus);
}
}
},
});
return false;
});
lb.open({
html: authForm.append(authDiv).append('<div id="auth-message"></div>'),
width: "350px",
closeOnClick: false
});
authentication.focus();
}
|