mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-22 00:16:15 -04:00
lint: Run eslint --fix
on src/
This commit is contained in:
parent
b8d07a42eb
commit
8e5fd19db2
109 changed files with 9061 additions and 10572 deletions
|
@ -20,14 +20,13 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
var padimpexp = (function() {
|
||||
|
||||
///// import
|
||||
var currentImportTimer = null;
|
||||
const padimpexp = (function () {
|
||||
// /// import
|
||||
let currentImportTimer = null;
|
||||
|
||||
function addImportFrames() {
|
||||
$("#import .importframe").remove();
|
||||
var iframe = $('<iframe style="display: none;" name="importiframe" class="importframe"></iframe>');
|
||||
$('#import .importframe').remove();
|
||||
const iframe = $('<iframe style="display: none;" name="importiframe" class="importframe"></iframe>');
|
||||
$('#import').append(iframe);
|
||||
}
|
||||
|
||||
|
@ -39,29 +38,27 @@ var padimpexp = (function() {
|
|||
}
|
||||
|
||||
function fileInputSubmit() {
|
||||
$('#importmessagefail').fadeOut("fast");
|
||||
var ret = window.confirm(html10n.get("pad.impexp.confirmimport"));
|
||||
if (ret)
|
||||
{
|
||||
currentImportTimer = window.setTimeout(function() {
|
||||
if (!currentImportTimer)
|
||||
{
|
||||
$('#importmessagefail').fadeOut('fast');
|
||||
const ret = window.confirm(html10n.get('pad.impexp.confirmimport'));
|
||||
if (ret) {
|
||||
currentImportTimer = window.setTimeout(() => {
|
||||
if (!currentImportTimer) {
|
||||
return;
|
||||
}
|
||||
currentImportTimer = null;
|
||||
importFailed("Request timed out.");
|
||||
importFailed('Request timed out.');
|
||||
importDone();
|
||||
}, 25000); // time out after some number of seconds
|
||||
$('#importsubmitinput').attr(
|
||||
{
|
||||
disabled: true
|
||||
}).val(html10n.get("pad.impexp.importing"));
|
||||
{
|
||||
disabled: true,
|
||||
}).val(html10n.get('pad.impexp.importing'));
|
||||
|
||||
window.setTimeout(function() {
|
||||
window.setTimeout(() => {
|
||||
$('#importfileinput').attr(
|
||||
{
|
||||
disabled: true
|
||||
});
|
||||
{
|
||||
disabled: true,
|
||||
});
|
||||
}, 0);
|
||||
$('#importarrow').stop(true, true).hide();
|
||||
$('#importstatusball').show();
|
||||
|
@ -74,8 +71,8 @@ var padimpexp = (function() {
|
|||
}
|
||||
|
||||
function importDone() {
|
||||
$('#importsubmitinput').removeAttr('disabled').val(html10n.get("pad.impexp.importbutton"));
|
||||
window.setTimeout(function() {
|
||||
$('#importsubmitinput').removeAttr('disabled').val(html10n.get('pad.impexp.importbutton'));
|
||||
window.setTimeout(() => {
|
||||
$('#importfileinput').removeAttr('disabled');
|
||||
}, 0);
|
||||
$('#importstatusball').hide();
|
||||
|
@ -84,155 +81,136 @@ var padimpexp = (function() {
|
|||
}
|
||||
|
||||
function importClearTimeout() {
|
||||
if (currentImportTimer)
|
||||
{
|
||||
if (currentImportTimer) {
|
||||
window.clearTimeout(currentImportTimer);
|
||||
currentImportTimer = null;
|
||||
}
|
||||
}
|
||||
|
||||
function importErrorMessage(status) {
|
||||
var msg="";
|
||||
let msg = '';
|
||||
|
||||
if(status === "convertFailed"){
|
||||
msg = html10n.get("pad.impexp.convertFailed");
|
||||
} else if(status === "uploadFailed"){
|
||||
msg = html10n.get("pad.impexp.uploadFailed");
|
||||
} else if(status === "padHasData"){
|
||||
msg = html10n.get("pad.impexp.padHasData");
|
||||
} else if(status === "maxFileSize"){
|
||||
msg = html10n.get("pad.impexp.maxFileSize");
|
||||
} else if(status === "permission"){
|
||||
msg = html10n.get("pad.impexp.permission");
|
||||
if (status === 'convertFailed') {
|
||||
msg = html10n.get('pad.impexp.convertFailed');
|
||||
} else if (status === 'uploadFailed') {
|
||||
msg = html10n.get('pad.impexp.uploadFailed');
|
||||
} else if (status === 'padHasData') {
|
||||
msg = html10n.get('pad.impexp.padHasData');
|
||||
} else if (status === 'maxFileSize') {
|
||||
msg = html10n.get('pad.impexp.maxFileSize');
|
||||
} else if (status === 'permission') {
|
||||
msg = html10n.get('pad.impexp.permission');
|
||||
}
|
||||
|
||||
function showError(fade) {
|
||||
$('#importmessagefail').html('<strong style="color: red">'+html10n.get('pad.impexp.importfailed')+':</strong> ' + (msg || html10n.get('pad.impexp.copypaste','')))[(fade ? "fadeIn" : "show")]();
|
||||
$('#importmessagefail').html(`<strong style="color: red">${html10n.get('pad.impexp.importfailed')}:</strong> ${msg || html10n.get('pad.impexp.copypaste', '')}`)[(fade ? 'fadeIn' : 'show')]();
|
||||
}
|
||||
|
||||
if ($('#importexport .importmessage').is(':visible'))
|
||||
{
|
||||
$('#importmessagesuccess').fadeOut("fast");
|
||||
$('#importmessagefail').fadeOut("fast", function() {
|
||||
if ($('#importexport .importmessage').is(':visible')) {
|
||||
$('#importmessagesuccess').fadeOut('fast');
|
||||
$('#importmessagefail').fadeOut('fast', () => {
|
||||
showError(true);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
showError();
|
||||
}
|
||||
}
|
||||
|
||||
function importSuccessful(token) {
|
||||
$.ajax(
|
||||
{
|
||||
type: 'post',
|
||||
url: '/ep/pad/impexp/import2',
|
||||
data: {
|
||||
token: token,
|
||||
padId: pad.getPadId()
|
||||
},
|
||||
success: importApplicationSuccessful,
|
||||
error: importApplicationFailed,
|
||||
timeout: 25000
|
||||
});
|
||||
{
|
||||
type: 'post',
|
||||
url: '/ep/pad/impexp/import2',
|
||||
data: {
|
||||
token,
|
||||
padId: pad.getPadId(),
|
||||
},
|
||||
success: importApplicationSuccessful,
|
||||
error: importApplicationFailed,
|
||||
timeout: 25000,
|
||||
});
|
||||
addImportFrames();
|
||||
}
|
||||
|
||||
function importApplicationFailed(xhr, textStatus, errorThrown) {
|
||||
importErrorMessage("Error during conversion.");
|
||||
importErrorMessage('Error during conversion.');
|
||||
importDone();
|
||||
}
|
||||
|
||||
///// export
|
||||
// /// export
|
||||
|
||||
function cantExport() {
|
||||
var type = $(this);
|
||||
if (type.hasClass("exporthrefpdf"))
|
||||
{
|
||||
type = "PDF";
|
||||
let type = $(this);
|
||||
if (type.hasClass('exporthrefpdf')) {
|
||||
type = 'PDF';
|
||||
} else if (type.hasClass('exporthrefdoc')) {
|
||||
type = 'Microsoft Word';
|
||||
} else if (type.hasClass('exporthrefodt')) {
|
||||
type = 'OpenDocument';
|
||||
} else {
|
||||
type = 'this file';
|
||||
}
|
||||
else if (type.hasClass("exporthrefdoc"))
|
||||
{
|
||||
type = "Microsoft Word";
|
||||
}
|
||||
else if (type.hasClass("exporthrefodt"))
|
||||
{
|
||||
type = "OpenDocument";
|
||||
}
|
||||
else
|
||||
{
|
||||
type = "this file";
|
||||
}
|
||||
alert(html10n.get("pad.impexp.exportdisabled", {type:type}));
|
||||
alert(html10n.get('pad.impexp.exportdisabled', {type}));
|
||||
return false;
|
||||
}
|
||||
|
||||
/////
|
||||
// ///
|
||||
var pad = undefined;
|
||||
var self = {
|
||||
init: function(_pad) {
|
||||
const self = {
|
||||
init(_pad) {
|
||||
pad = _pad;
|
||||
|
||||
//get /p/padname
|
||||
// get /p/padname
|
||||
// if /p/ isn't available due to a rewrite we use the clientVars padId
|
||||
var pad_root_path = new RegExp(/.*\/p\/[^\/]+/).exec(document.location.pathname) || clientVars.padId;
|
||||
//get http://example.com/p/padname without Params
|
||||
var pad_root_url = document.location.protocol + '//' + document.location.host + document.location.pathname;
|
||||
const pad_root_path = new RegExp(/.*\/p\/[^\/]+/).exec(document.location.pathname) || clientVars.padId;
|
||||
// get http://example.com/p/padname without Params
|
||||
const pad_root_url = `${document.location.protocol}//${document.location.host}${document.location.pathname}`;
|
||||
|
||||
//i10l buttom import
|
||||
$('#importsubmitinput').val(html10n.get("pad.impexp.importbutton"));
|
||||
html10n.bind('localized', function() {
|
||||
$('#importsubmitinput').val(html10n.get("pad.impexp.importbutton"));
|
||||
})
|
||||
// i10l buttom import
|
||||
$('#importsubmitinput').val(html10n.get('pad.impexp.importbutton'));
|
||||
html10n.bind('localized', () => {
|
||||
$('#importsubmitinput').val(html10n.get('pad.impexp.importbutton'));
|
||||
});
|
||||
|
||||
// build the export links
|
||||
$("#exporthtmla").attr("href", pad_root_path + "/export/html");
|
||||
$("#exportetherpada").attr("href", pad_root_path + "/export/etherpad");
|
||||
$("#exportplaina").attr("href", pad_root_path + "/export/txt");
|
||||
$('#exporthtmla').attr('href', `${pad_root_path}/export/html`);
|
||||
$('#exportetherpada').attr('href', `${pad_root_path}/export/etherpad`);
|
||||
$('#exportplaina').attr('href', `${pad_root_path}/export/txt`);
|
||||
|
||||
// activate action to import in the form
|
||||
$("#importform").attr('action', pad_root_url + "/import");
|
||||
$('#importform').attr('action', `${pad_root_url}/import`);
|
||||
|
||||
//hide stuff thats not avaible if abiword/soffice is disabled
|
||||
if(clientVars.exportAvailable == "no")
|
||||
{
|
||||
$("#exportworda").remove();
|
||||
$("#exportpdfa").remove();
|
||||
$("#exportopena").remove();
|
||||
// hide stuff thats not avaible if abiword/soffice is disabled
|
||||
if (clientVars.exportAvailable == 'no') {
|
||||
$('#exportworda').remove();
|
||||
$('#exportpdfa').remove();
|
||||
$('#exportopena').remove();
|
||||
|
||||
$("#importmessageabiword").show();
|
||||
}
|
||||
else if(clientVars.exportAvailable == "withoutPDF")
|
||||
{
|
||||
$("#exportpdfa").remove();
|
||||
$('#importmessageabiword').show();
|
||||
} else if (clientVars.exportAvailable == 'withoutPDF') {
|
||||
$('#exportpdfa').remove();
|
||||
|
||||
$("#exportworda").attr("href", pad_root_path + "/export/doc");
|
||||
$("#exportopena").attr("href", pad_root_path + "/export/odt");
|
||||
$('#exportworda').attr('href', `${pad_root_path}/export/doc`);
|
||||
$('#exportopena').attr('href', `${pad_root_path}/export/odt`);
|
||||
|
||||
$("#importexport").css({"height":"142px"});
|
||||
$("#importexportline").css({"height":"142px"});
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#exportworda").attr("href", pad_root_path + "/export/doc");
|
||||
$("#exportpdfa").attr("href", pad_root_path + "/export/pdf");
|
||||
$("#exportopena").attr("href", pad_root_path + "/export/odt");
|
||||
$('#importexport').css({height: '142px'});
|
||||
$('#importexportline').css({height: '142px'});
|
||||
} else {
|
||||
$('#exportworda').attr('href', `${pad_root_path}/export/doc`);
|
||||
$('#exportpdfa').attr('href', `${pad_root_path}/export/pdf`);
|
||||
$('#exportopena').attr('href', `${pad_root_path}/export/odt`);
|
||||
}
|
||||
|
||||
addImportFrames();
|
||||
$("#importfileinput").change(fileInputUpdated);
|
||||
$('#importform').unbind("submit").submit(fileInputSubmit);
|
||||
$('#importfileinput').change(fileInputUpdated);
|
||||
$('#importform').unbind('submit').submit(fileInputSubmit);
|
||||
$('.disabledexport').click(cantExport);
|
||||
},
|
||||
handleFrameCall: function(directDatabaseAccess, status) {
|
||||
if(directDatabaseAccess === "undefined") directDatabaseAccess = false;
|
||||
if (status !== "ok")
|
||||
{
|
||||
handleFrameCall(directDatabaseAccess, status) {
|
||||
if (directDatabaseAccess === 'undefined') directDatabaseAccess = false;
|
||||
if (status !== 'ok') {
|
||||
importFailed(status);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$('#import_export').removeClass('popup-show');
|
||||
}
|
||||
|
||||
|
@ -244,16 +222,16 @@ var padimpexp = (function() {
|
|||
|
||||
importDone();
|
||||
},
|
||||
disable: function() {
|
||||
$("#impexp-disabled-clickcatcher").show();
|
||||
$("#import").css('opacity', 0.5);
|
||||
$("#impexp-export").css('opacity', 0.5);
|
||||
disable() {
|
||||
$('#impexp-disabled-clickcatcher').show();
|
||||
$('#import').css('opacity', 0.5);
|
||||
$('#impexp-export').css('opacity', 0.5);
|
||||
},
|
||||
enable() {
|
||||
$('#impexp-disabled-clickcatcher').hide();
|
||||
$('#import').css('opacity', 1);
|
||||
$('#impexp-export').css('opacity', 1);
|
||||
},
|
||||
enable: function() {
|
||||
$("#impexp-disabled-clickcatcher").hide();
|
||||
$("#import").css('opacity', 1);
|
||||
$("#impexp-export").css('opacity', 1);
|
||||
}
|
||||
};
|
||||
return self;
|
||||
}());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue