mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-01-31 19:02:59 +01:00
Merge pull request #1465 from mluto/kill-ep-stuff
Removing old etherpad code
This commit is contained in:
commit
5f79546c2a
7 changed files with 2 additions and 606 deletions
|
@ -958,16 +958,11 @@ function handleClientReady(client, message)
|
||||||
// used to request the latest 100 chat-messages later (GET_CHAT_MESSAGES)
|
// used to request the latest 100 chat-messages later (GET_CHAT_MESSAGES)
|
||||||
"chatHead": pad.chatHead,
|
"chatHead": pad.chatHead,
|
||||||
"numConnectedUsers": roomClients.length,
|
"numConnectedUsers": roomClients.length,
|
||||||
"isProPad": false,
|
|
||||||
"readOnlyId": padIds.readOnlyPadId,
|
"readOnlyId": padIds.readOnlyPadId,
|
||||||
"readonly": padIds.readonly,
|
"readonly": padIds.readonly,
|
||||||
"serverTimestamp": new Date().getTime(),
|
"serverTimestamp": new Date().getTime(),
|
||||||
"globalPadId": message.padId,
|
"globalPadId": message.padId,
|
||||||
"userId": author,
|
"userId": author,
|
||||||
"cookiePrefsToSet": {
|
|
||||||
"fullWidth": false,
|
|
||||||
"hideSidebar": false
|
|
||||||
},
|
|
||||||
"abiwordAvailable": settings.abiwordAvailable(),
|
"abiwordAvailable": settings.abiwordAvailable(),
|
||||||
"plugins": {
|
"plugins": {
|
||||||
"plugins": plugins.plugins,
|
"plugins": plugins.plugins,
|
||||||
|
|
|
@ -460,31 +460,6 @@ function loadBroadcastSliderJS(fireWhenAllScriptsAreLoaded)
|
||||||
|
|
||||||
if (clientVars)
|
if (clientVars)
|
||||||
{
|
{
|
||||||
if (clientVars.fullWidth)
|
|
||||||
{
|
|
||||||
$("#padpage").css('width', '100%');
|
|
||||||
$("#revision").css('position', "absolute")
|
|
||||||
$("#revision").css('right', "20px")
|
|
||||||
$("#revision").css('top', "20px")
|
|
||||||
$("#padmain").css('left', '0px');
|
|
||||||
$("#padmain").css('right', '197px');
|
|
||||||
$("#padmain").css('width', 'auto');
|
|
||||||
$("#rightbars").css('right', '7px');
|
|
||||||
$("#rightbars").css('margin-right', '0px');
|
|
||||||
$("#timeslider").css('width', 'auto');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (clientVars.disableRightBar)
|
|
||||||
{
|
|
||||||
$("#rightbars").css('display', 'none');
|
|
||||||
$('#padmain').css('width', 'auto');
|
|
||||||
if (clientVars.fullWidth) $("#padmain").css('right', '7px');
|
|
||||||
else $("#padmain").css('width', '860px');
|
|
||||||
$("#revision").css('position', "absolute");
|
|
||||||
$("#revision").css('right', "20px");
|
|
||||||
$("#revision").css('top', "20px");
|
|
||||||
}
|
|
||||||
|
|
||||||
$("#timeslider").show();
|
$("#timeslider").show();
|
||||||
|
|
||||||
var startPos = clientVars.collab_client_vars.rev;
|
var startPos = clientVars.collab_client_vars.rev;
|
||||||
|
|
|
@ -35,7 +35,6 @@ var chat = require('./chat').chat;
|
||||||
var getCollabClient = require('./collab_client').getCollabClient;
|
var getCollabClient = require('./collab_client').getCollabClient;
|
||||||
var padconnectionstatus = require('./pad_connectionstatus').padconnectionstatus;
|
var padconnectionstatus = require('./pad_connectionstatus').padconnectionstatus;
|
||||||
var padcookie = require('./pad_cookie').padcookie;
|
var padcookie = require('./pad_cookie').padcookie;
|
||||||
var paddocbar = require('./pad_docbar').paddocbar;
|
|
||||||
var padeditbar = require('./pad_editbar').padeditbar;
|
var padeditbar = require('./pad_editbar').padeditbar;
|
||||||
var padeditor = require('./pad_editor').padeditor;
|
var padeditor = require('./pad_editor').padeditor;
|
||||||
var padimpexp = require('./pad_impexp').padimpexp;
|
var padimpexp = require('./pad_impexp').padimpexp;
|
||||||
|
@ -391,10 +390,6 @@ var pad = {
|
||||||
{
|
{
|
||||||
return clientVars.clientIp;
|
return clientVars.clientIp;
|
||||||
},
|
},
|
||||||
getIsProPad: function()
|
|
||||||
{
|
|
||||||
return clientVars.isProPad;
|
|
||||||
},
|
|
||||||
getColorPalette: function()
|
getColorPalette: function()
|
||||||
{
|
{
|
||||||
return clientVars.colorPalette;
|
return clientVars.colorPalette;
|
||||||
|
@ -467,11 +462,6 @@ var pad = {
|
||||||
}
|
}
|
||||||
|
|
||||||
// order of inits is important here:
|
// order of inits is important here:
|
||||||
padcookie.init(clientVars.cookiePrefsToSet, this);
|
|
||||||
|
|
||||||
$("#widthprefcheck").click(pad.toggleWidthPref);
|
|
||||||
// $("#sidebarcheck").click(pad.togglewSidebar);
|
|
||||||
|
|
||||||
pad.myUserInfo = {
|
pad.myUserInfo = {
|
||||||
userId: clientVars.userId,
|
userId: clientVars.userId,
|
||||||
name: clientVars.userName,
|
name: clientVars.userName,
|
||||||
|
@ -488,13 +478,6 @@ var pad = {
|
||||||
$("#specialkeyarea").html("mode: " + String(clientVars.specialKeyTranslation).toUpperCase());
|
$("#specialkeyarea").html("mode: " + String(clientVars.specialKeyTranslation).toUpperCase());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
paddocbar.init(
|
|
||||||
{
|
|
||||||
isTitleEditable: pad.getIsProPad(),
|
|
||||||
initialTitle: clientVars.initialTitle,
|
|
||||||
initialPassword: clientVars.initialPassword,
|
|
||||||
guestPolicy: pad.padOptions.guestPolicy
|
|
||||||
}, this);
|
|
||||||
padimpexp.init(this);
|
padimpexp.init(this);
|
||||||
padsavedrevs.init(this);
|
padsavedrevs.init(this);
|
||||||
|
|
||||||
|
@ -558,24 +541,6 @@ var pad = {
|
||||||
pad.myUserInfo.colorId = newColorId;
|
pad.myUserInfo.colorId = newColorId;
|
||||||
pad.collabClient.updateUserInfo(pad.myUserInfo);
|
pad.collabClient.updateUserInfo(pad.myUserInfo);
|
||||||
},
|
},
|
||||||
notifyChangeTitle: function(newTitle)
|
|
||||||
{
|
|
||||||
pad.collabClient.sendClientMessage(
|
|
||||||
{
|
|
||||||
type: 'padtitle',
|
|
||||||
title: newTitle,
|
|
||||||
changedBy: pad.myUserInfo.name || "unnamed"
|
|
||||||
});
|
|
||||||
},
|
|
||||||
notifyChangePassword: function(newPass)
|
|
||||||
{
|
|
||||||
pad.collabClient.sendClientMessage(
|
|
||||||
{
|
|
||||||
type: 'padpassword',
|
|
||||||
password: newPass,
|
|
||||||
changedBy: pad.myUserInfo.name || "unnamed"
|
|
||||||
});
|
|
||||||
},
|
|
||||||
changePadOption: function(key, value)
|
changePadOption: function(key, value)
|
||||||
{
|
{
|
||||||
var options = {};
|
var options = {};
|
||||||
|
@ -616,7 +581,6 @@ var pad = {
|
||||||
{
|
{
|
||||||
// order important here
|
// order important here
|
||||||
pad.padOptions.guestPolicy = opts.guestPolicy;
|
pad.padOptions.guestPolicy = opts.guestPolicy;
|
||||||
paddocbar.setGuestPolicy(opts.guestPolicy);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getPadOptions: function()
|
getPadOptions: function()
|
||||||
|
@ -626,7 +590,7 @@ var pad = {
|
||||||
},
|
},
|
||||||
isPadPublic: function()
|
isPadPublic: function()
|
||||||
{
|
{
|
||||||
return (!pad.getIsProPad()) || (pad.getPadOptions().guestPolicy == 'allow');
|
return pad.getPadOptions().guestPolicy == 'allow';
|
||||||
},
|
},
|
||||||
suggestUserName: function(userId, name)
|
suggestUserName: function(userId, name)
|
||||||
{
|
{
|
||||||
|
@ -659,14 +623,6 @@ var pad = {
|
||||||
paduserlist.setMyUserInfo(pad.myUserInfo);
|
paduserlist.setMyUserInfo(pad.myUserInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (msg.type == 'padtitle')
|
|
||||||
{
|
|
||||||
paddocbar.changeTitle(msg.title);
|
|
||||||
}
|
|
||||||
else if (msg.type == 'padpassword')
|
|
||||||
{
|
|
||||||
paddocbar.changePassword(msg.password);
|
|
||||||
}
|
|
||||||
else if (msg.type == 'newRevisionList')
|
else if (msg.type == 'newRevisionList')
|
||||||
{
|
{
|
||||||
padsavedrevs.newRevisionList(msg.revisionList);
|
padsavedrevs.newRevisionList(msg.revisionList);
|
||||||
|
@ -759,7 +715,6 @@ var pad = {
|
||||||
}
|
}
|
||||||
padeditor.disable();
|
padeditor.disable();
|
||||||
padeditbar.disable();
|
padeditbar.disable();
|
||||||
paddocbar.disable();
|
|
||||||
padimpexp.disable();
|
padimpexp.disable();
|
||||||
|
|
||||||
padconnectionstatus.disconnected(message);
|
padconnectionstatus.disconnected(message);
|
||||||
|
@ -786,28 +741,10 @@ var pad = {
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
// pad.determineSidebarVisibility(isConnected && !isInitialConnect);
|
|
||||||
pad.determineChatVisibility(isConnected && !isInitialConnect);
|
pad.determineChatVisibility(isConnected && !isInitialConnect);
|
||||||
pad.determineAuthorshipColorsVisibility();
|
pad.determineAuthorshipColorsVisibility();
|
||||||
|
|
||||||
},
|
},
|
||||||
/* determineSidebarVisibility: function(asNowConnectedFeedback)
|
|
||||||
{
|
|
||||||
if (pad.isFullyConnected())
|
|
||||||
{
|
|
||||||
var setSidebarVisibility = padutils.getCancellableAction("set-sidebar-visibility", function()
|
|
||||||
{
|
|
||||||
// $("body").toggleClass('hidesidebar', !! padcookie.getPref('hideSidebar'));
|
|
||||||
});
|
|
||||||
window.setTimeout(setSidebarVisibility, asNowConnectedFeedback ? 3000 : 0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
padutils.cancelActions("set-sidebar-visibility");
|
|
||||||
$("body").removeClass('hidesidebar');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
*/
|
|
||||||
determineChatVisibility: function(asNowConnectedFeedback){
|
determineChatVisibility: function(asNowConnectedFeedback){
|
||||||
var chatVisCookie = padcookie.getPref('chatAlwaysVisible');
|
var chatVisCookie = padcookie.getPref('chatAlwaysVisible');
|
||||||
if(chatVisCookie){ // if the cookie is set for chat always visible
|
if(chatVisCookie){ // if the cookie is set for chat always visible
|
||||||
|
@ -869,37 +806,6 @@ var pad = {
|
||||||
$('form#reconnectform input.missedChanges').val(JSON.stringify(pad.collabClient.getMissedChanges()));
|
$('form#reconnectform input.missedChanges').val(JSON.stringify(pad.collabClient.getMissedChanges()));
|
||||||
$('form#reconnectform').submit();
|
$('form#reconnectform').submit();
|
||||||
},
|
},
|
||||||
toggleWidthPref: function()
|
|
||||||
{
|
|
||||||
var newValue = !padcookie.getPref('fullWidth');
|
|
||||||
padcookie.setPref('fullWidth', newValue);
|
|
||||||
$("#widthprefcheck").toggleClass('widthprefchecked', !! newValue).toggleClass('widthprefunchecked', !newValue);
|
|
||||||
pad.handleWidthChange();
|
|
||||||
},
|
|
||||||
/*
|
|
||||||
toggleSidebar: function()
|
|
||||||
{
|
|
||||||
var newValue = !padcookie.getPref('hideSidebar');
|
|
||||||
padcookie.setPref('hideSidebar', newValue);
|
|
||||||
$("#sidebarcheck").toggleClass('sidebarchecked', !newValue).toggleClass('sidebarunchecked', !! newValue);
|
|
||||||
pad.determineSidebarVisibility();
|
|
||||||
},
|
|
||||||
*/
|
|
||||||
handleWidthChange: function()
|
|
||||||
{
|
|
||||||
var isFullWidth = padcookie.getPref('fullWidth');
|
|
||||||
if (isFullWidth)
|
|
||||||
{
|
|
||||||
$("body").addClass('fullwidth').removeClass('limwidth').removeClass('squish1width').removeClass('squish2width');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$("body").addClass('limwidth').removeClass('fullwidth');
|
|
||||||
|
|
||||||
var pageWidth = $(window).width();
|
|
||||||
$("body").toggleClass('squish1width', (pageWidth < 912 && pageWidth > 812)).toggleClass('squish2width', (pageWidth <= 812));
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// this is called from code put into a frame from the server:
|
// this is called from code put into a frame from the server:
|
||||||
handleImportExportFrameCall: function(callName, varargs)
|
handleImportExportFrameCall: function(callName, varargs)
|
||||||
{
|
{
|
||||||
|
|
|
@ -73,7 +73,7 @@ var padcookie = (function()
|
||||||
}
|
}
|
||||||
setRawCookie(stringifyCookie(cookieData));
|
setRawCookie(stringifyCookie(cookieData));
|
||||||
|
|
||||||
if (pad.getIsProPad() && (!getRawCookie()) && (!alreadyWarnedAboutNoCookies))
|
if ((!getRawCookie()) && (!alreadyWarnedAboutNoCookies))
|
||||||
{
|
{
|
||||||
alert("Warning: it appears that your browser does not have cookies enabled." + " EtherPad uses cookies to keep track of unique users for the purpose" + " of putting a quota on the number of active users. Using EtherPad without " + " cookies may fill up your server's user quota faster than expected.");
|
alert("Warning: it appears that your browser does not have cookies enabled." + " EtherPad uses cookies to keep track of unique users for the purpose" + " of putting a quota on the number of active users. Using EtherPad without " + " cookies may fill up your server's user quota faster than expected.");
|
||||||
alreadyWarnedAboutNoCookies = true;
|
alreadyWarnedAboutNoCookies = true;
|
||||||
|
|
|
@ -1,466 +0,0 @@
|
||||||
/**
|
|
||||||
* This code is mostly from the old Etherpad. Please help us to comment this code.
|
|
||||||
* This helps other people to understand this code better and helps them to improve it.
|
|
||||||
* TL;DR COMMENTS ON THIS FILE ARE HIGHLY APPRECIATED
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Copyright 2009 Google Inc.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS-IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
var padutils = require('./pad_utils').padutils;
|
|
||||||
|
|
||||||
var paddocbar = (function()
|
|
||||||
{
|
|
||||||
var isTitleEditable = false;
|
|
||||||
var isEditingTitle = false;
|
|
||||||
var isEditingPassword = false;
|
|
||||||
var enabled = false;
|
|
||||||
|
|
||||||
function getPanelOpenCloseAnimator(panelName, panelHeight)
|
|
||||||
{
|
|
||||||
var wrapper = $("#" + panelName + "-wrapper");
|
|
||||||
var openingClass = "docbar" + panelName + "-opening";
|
|
||||||
var openClass = "docbar" + panelName + "-open";
|
|
||||||
var closingClass = "docbar" + panelName + "-closing";
|
|
||||||
|
|
||||||
function setPanelState(action)
|
|
||||||
{
|
|
||||||
$("#docbar").removeClass(openingClass).removeClass(openClass).
|
|
||||||
removeClass(closingClass);
|
|
||||||
if (action != "closed")
|
|
||||||
{
|
|
||||||
$("#docbar").addClass("docbar" + panelName + "-" + action);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function openCloseAnimate(state)
|
|
||||||
{
|
|
||||||
function pow(x)
|
|
||||||
{
|
|
||||||
x = 1 - x;
|
|
||||||
x *= x * x;
|
|
||||||
return 1 - x;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (state == -1)
|
|
||||||
{
|
|
||||||
// startng to open
|
|
||||||
setPanelState("opening");
|
|
||||||
wrapper.css('height', '0');
|
|
||||||
}
|
|
||||||
else if (state < 0)
|
|
||||||
{
|
|
||||||
// opening
|
|
||||||
var height = Math.round(pow(state + 1) * (panelHeight - 1)) + 'px';
|
|
||||||
wrapper.css('height', height);
|
|
||||||
}
|
|
||||||
else if (state == 0)
|
|
||||||
{
|
|
||||||
// open
|
|
||||||
setPanelState("open");
|
|
||||||
wrapper.css('height', panelHeight - 1);
|
|
||||||
}
|
|
||||||
else if (state < 1)
|
|
||||||
{
|
|
||||||
// closing
|
|
||||||
setPanelState("closing");
|
|
||||||
var height = Math.round((1 - pow(state)) * (panelHeight - 1)) + 'px';
|
|
||||||
wrapper.css('height', height);
|
|
||||||
}
|
|
||||||
else if (state == 1)
|
|
||||||
{
|
|
||||||
// closed
|
|
||||||
setPanelState("closed");
|
|
||||||
wrapper.css('height', '0');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return padutils.makeShowHideAnimator(openCloseAnimate, false, 25, 500);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
var currentPanel = null;
|
|
||||||
|
|
||||||
function setCurrentPanel(newCurrentPanel)
|
|
||||||
{
|
|
||||||
if (currentPanel != newCurrentPanel)
|
|
||||||
{
|
|
||||||
currentPanel = newCurrentPanel;
|
|
||||||
padutils.cancelActions("hide-docbar-panel");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var panels;
|
|
||||||
|
|
||||||
function changePassword(newPass)
|
|
||||||
{
|
|
||||||
if ((newPass || null) != (self.password || null))
|
|
||||||
{
|
|
||||||
self.password = (newPass || null);
|
|
||||||
pad.notifyChangePassword(newPass);
|
|
||||||
}
|
|
||||||
self.renderPassword();
|
|
||||||
}
|
|
||||||
|
|
||||||
var pad = undefined;
|
|
||||||
var self = {
|
|
||||||
title: null,
|
|
||||||
password: null,
|
|
||||||
init: function(opts, _pad)
|
|
||||||
{
|
|
||||||
pad = _pad;
|
|
||||||
|
|
||||||
panels = {
|
|
||||||
impexp: {
|
|
||||||
animator: getPanelOpenCloseAnimator("impexp", 160)
|
|
||||||
},
|
|
||||||
savedrevs: {
|
|
||||||
animator: getPanelOpenCloseAnimator("savedrevs", 79)
|
|
||||||
},
|
|
||||||
options: {
|
|
||||||
animator: getPanelOpenCloseAnimator("options", 114)
|
|
||||||
},
|
|
||||||
security: {
|
|
||||||
animator: getPanelOpenCloseAnimator("security", 130)
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
isTitleEditable = opts.isTitleEditable;
|
|
||||||
self.title = opts.initialTitle;
|
|
||||||
self.password = opts.initialPassword;
|
|
||||||
|
|
||||||
$("#docbarimpexp").click(function()
|
|
||||||
{
|
|
||||||
self.togglePanel("impexp");
|
|
||||||
});
|
|
||||||
$("#docbarsavedrevs").click(function()
|
|
||||||
{
|
|
||||||
self.togglePanel("savedrevs");
|
|
||||||
});
|
|
||||||
$("#docbaroptions").click(function()
|
|
||||||
{
|
|
||||||
self.togglePanel("options");
|
|
||||||
});
|
|
||||||
$("#docbarsecurity").click(function()
|
|
||||||
{
|
|
||||||
self.togglePanel("security");
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#docbarrenamelink").click(self.editTitle);
|
|
||||||
$("#padtitlesave").click(function()
|
|
||||||
{
|
|
||||||
self.closeTitleEdit(true);
|
|
||||||
});
|
|
||||||
$("#padtitlecancel").click(function()
|
|
||||||
{
|
|
||||||
self.closeTitleEdit(false);
|
|
||||||
});
|
|
||||||
padutils.bindEnterAndEscape($("#padtitleedit"), function()
|
|
||||||
{
|
|
||||||
$("#padtitlesave").trigger('click');
|
|
||||||
}, function()
|
|
||||||
{
|
|
||||||
$("#padtitlecancel").trigger('click');
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#options-close").click(function()
|
|
||||||
{
|
|
||||||
self.setShownPanel(null);
|
|
||||||
});
|
|
||||||
$("#security-close").click(function()
|
|
||||||
{
|
|
||||||
self.setShownPanel(null);
|
|
||||||
});
|
|
||||||
|
|
||||||
if (pad.getIsProPad())
|
|
||||||
{
|
|
||||||
self.initPassword();
|
|
||||||
}
|
|
||||||
|
|
||||||
enabled = true;
|
|
||||||
self.render();
|
|
||||||
|
|
||||||
// public/private
|
|
||||||
$("#security-access input").bind("change click", function(evt)
|
|
||||||
{
|
|
||||||
pad.changePadOption('guestPolicy', $("#security-access input[name='padaccess']:checked").val());
|
|
||||||
});
|
|
||||||
self.setGuestPolicy(opts.guestPolicy);
|
|
||||||
},
|
|
||||||
setGuestPolicy: function(newPolicy)
|
|
||||||
{
|
|
||||||
$("#security-access input[value='" + newPolicy + "']").attr("checked", "checked");
|
|
||||||
self.render();
|
|
||||||
},
|
|
||||||
initPassword: function()
|
|
||||||
{
|
|
||||||
self.renderPassword();
|
|
||||||
$("#password-clearlink").click(function()
|
|
||||||
{
|
|
||||||
changePassword(null);
|
|
||||||
});
|
|
||||||
$("#password-setlink, #password-display").click(function()
|
|
||||||
{
|
|
||||||
self.enterPassword();
|
|
||||||
});
|
|
||||||
$("#password-cancellink").click(function()
|
|
||||||
{
|
|
||||||
self.exitPassword(false);
|
|
||||||
});
|
|
||||||
$("#password-savelink").click(function()
|
|
||||||
{
|
|
||||||
self.exitPassword(true);
|
|
||||||
});
|
|
||||||
padutils.bindEnterAndEscape($("#security-passwordedit"), function()
|
|
||||||
{
|
|
||||||
self.exitPassword(true);
|
|
||||||
}, function()
|
|
||||||
{
|
|
||||||
self.exitPassword(false);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
enterPassword: function()
|
|
||||||
{
|
|
||||||
isEditingPassword = true;
|
|
||||||
$("#security-passwordedit").val(self.password || '');
|
|
||||||
self.renderPassword();
|
|
||||||
$("#security-passwordedit").focus().select();
|
|
||||||
},
|
|
||||||
exitPassword: function(accept)
|
|
||||||
{
|
|
||||||
isEditingPassword = false;
|
|
||||||
if (accept)
|
|
||||||
{
|
|
||||||
changePassword($("#security-passwordedit").val());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
self.renderPassword();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
renderPassword: function()
|
|
||||||
{
|
|
||||||
if (isEditingPassword)
|
|
||||||
{
|
|
||||||
$("#password-nonedit").hide();
|
|
||||||
$("#password-inedit").show();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$("#password-nonedit").toggleClass('nopassword', !self.password);
|
|
||||||
$("#password-setlink").html(self.password ? "Change..." : "Set...");
|
|
||||||
if (self.password)
|
|
||||||
{
|
|
||||||
$("#password-display").html(self.password.replace(/./g, '•'));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$("#password-display").html("None");
|
|
||||||
}
|
|
||||||
$("#password-inedit").hide();
|
|
||||||
$("#password-nonedit").show();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
togglePanel: function(panelName)
|
|
||||||
{
|
|
||||||
if (panelName in panels)
|
|
||||||
{
|
|
||||||
if (currentPanel == panelName)
|
|
||||||
{
|
|
||||||
self.setShownPanel(null);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
self.setShownPanel(panelName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
setShownPanel: function(panelName)
|
|
||||||
{
|
|
||||||
function animateHidePanel(panelName, next)
|
|
||||||
{
|
|
||||||
var delay = 0;
|
|
||||||
if (panelName == 'options' && isEditingPassword)
|
|
||||||
{
|
|
||||||
// give user feedback that the password they've
|
|
||||||
// typed in won't actually take effect
|
|
||||||
self.exitPassword(false);
|
|
||||||
delay = 500;
|
|
||||||
}
|
|
||||||
|
|
||||||
window.setTimeout(function()
|
|
||||||
{
|
|
||||||
panels[panelName].animator.hide();
|
|
||||||
if (next)
|
|
||||||
{
|
|
||||||
next();
|
|
||||||
}
|
|
||||||
}, delay);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!panelName)
|
|
||||||
{
|
|
||||||
if (currentPanel)
|
|
||||||
{
|
|
||||||
animateHidePanel(currentPanel);
|
|
||||||
setCurrentPanel(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (panelName in panels)
|
|
||||||
{
|
|
||||||
if (currentPanel != panelName)
|
|
||||||
{
|
|
||||||
if (currentPanel)
|
|
||||||
{
|
|
||||||
animateHidePanel(currentPanel, function()
|
|
||||||
{
|
|
||||||
panels[panelName].animator.show();
|
|
||||||
setCurrentPanel(panelName);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
panels[panelName].animator.show();
|
|
||||||
setCurrentPanel(panelName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
isPanelShown: function(panelName)
|
|
||||||
{
|
|
||||||
if (!panelName)
|
|
||||||
{
|
|
||||||
return !currentPanel;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return (panelName == currentPanel);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
changeTitle: function(newTitle)
|
|
||||||
{
|
|
||||||
self.title = newTitle;
|
|
||||||
self.render();
|
|
||||||
},
|
|
||||||
editTitle: function()
|
|
||||||
{
|
|
||||||
if (!enabled)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
$("#padtitleedit").val(self.title);
|
|
||||||
isEditingTitle = true;
|
|
||||||
self.render();
|
|
||||||
$("#padtitleedit").focus().select();
|
|
||||||
},
|
|
||||||
closeTitleEdit: function(accept)
|
|
||||||
{
|
|
||||||
if (!enabled)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (accept)
|
|
||||||
{
|
|
||||||
var newTitle = $("#padtitleedit").val();
|
|
||||||
if (newTitle)
|
|
||||||
{
|
|
||||||
newTitle = newTitle.substring(0, 80);
|
|
||||||
self.title = newTitle;
|
|
||||||
|
|
||||||
pad.notifyChangeTitle(newTitle);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
isEditingTitle = false;
|
|
||||||
self.render();
|
|
||||||
},
|
|
||||||
changePassword: function(newPass)
|
|
||||||
{
|
|
||||||
if (newPass)
|
|
||||||
{
|
|
||||||
self.password = newPass;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
self.password = null;
|
|
||||||
}
|
|
||||||
self.renderPassword();
|
|
||||||
},
|
|
||||||
render: function()
|
|
||||||
{
|
|
||||||
if (isEditingTitle)
|
|
||||||
{
|
|
||||||
$("#docbarpadtitle").hide();
|
|
||||||
$("#docbarrenamelink").hide();
|
|
||||||
$("#padtitleedit").show();
|
|
||||||
$("#padtitlebuttons").show();
|
|
||||||
if (!enabled)
|
|
||||||
{
|
|
||||||
$("#padtitleedit").attr('disabled', 'disabled');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$("#padtitleedit").removeAttr('disabled');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$("#padtitleedit").hide();
|
|
||||||
$("#padtitlebuttons").hide();
|
|
||||||
|
|
||||||
var titleSpan = $("#docbarpadtitle span");
|
|
||||||
titleSpan.html(padutils.escapeHtml(self.title));
|
|
||||||
$("#docbarpadtitle").attr('title', (pad.isPadPublic() ? "Public Pad: " : "") + self.title);
|
|
||||||
$("#docbarpadtitle").show();
|
|
||||||
|
|
||||||
if (isTitleEditable)
|
|
||||||
{
|
|
||||||
var titleRight = $("#docbarpadtitle").position().left + $("#docbarpadtitle span").position().left + Math.min($("#docbarpadtitle").width(), $("#docbarpadtitle span").width());
|
|
||||||
$("#docbarrenamelink").css('left', titleRight + 10).show();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pad.isPadPublic())
|
|
||||||
{
|
|
||||||
$("#docbar").addClass("docbar-public");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$("#docbar").removeClass("docbar-public");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
disable: function()
|
|
||||||
{
|
|
||||||
enabled = false;
|
|
||||||
self.render();
|
|
||||||
},
|
|
||||||
handleResizePage: function()
|
|
||||||
{
|
|
||||||
// Side-step circular reference. This should be injected.
|
|
||||||
var padsavedrevs = require('./pad_savedrevs');
|
|
||||||
padsavedrevs.handleResizePage();
|
|
||||||
},
|
|
||||||
hideLaterIfNoOtherInteraction: function()
|
|
||||||
{
|
|
||||||
return padutils.getCancellableAction('hide-docbar-panel', function()
|
|
||||||
{
|
|
||||||
self.setShownPanel(null);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
return self;
|
|
||||||
}());
|
|
||||||
|
|
||||||
exports.paddocbar = paddocbar;
|
|
|
@ -20,14 +20,11 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var paddocbar = require('./pad_docbar').paddocbar;
|
|
||||||
|
|
||||||
var padimpexp = (function()
|
var padimpexp = (function()
|
||||||
{
|
{
|
||||||
|
|
||||||
///// import
|
///// import
|
||||||
var currentImportTimer = null;
|
var currentImportTimer = null;
|
||||||
var hidePanelCall = null;
|
|
||||||
|
|
||||||
function addImportFrames()
|
function addImportFrames()
|
||||||
{
|
{
|
||||||
|
@ -72,7 +69,6 @@ var padimpexp = (function()
|
||||||
var ret = window.confirm(html10n.get("pad.impexp.confirmimport"));
|
var ret = window.confirm(html10n.get("pad.impexp.confirmimport"));
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
hidePanelCall = paddocbar.hideLaterIfNoOtherInteraction();
|
|
||||||
currentImportTimer = window.setTimeout(function()
|
currentImportTimer = window.setTimeout(function()
|
||||||
{
|
{
|
||||||
if (!currentImportTimer)
|
if (!currentImportTimer)
|
||||||
|
@ -255,11 +251,6 @@ var padimpexp = (function()
|
||||||
$("#exportopena").attr("href", pad_root_path + "/export/odt");
|
$("#exportopena").attr("href", pad_root_path + "/export/odt");
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#impexp-close").click(function()
|
|
||||||
{
|
|
||||||
paddocbar.setShownPanel(null);
|
|
||||||
});
|
|
||||||
|
|
||||||
addImportFrames();
|
addImportFrames();
|
||||||
$("#importfileinput").change(fileInputUpdated);
|
$("#importfileinput").change(fileInputUpdated);
|
||||||
$('#importform').submit(fileInputSubmit);
|
$('#importform').submit(fileInputSubmit);
|
||||||
|
|
|
@ -107,14 +107,9 @@ var paduserlist = (function()
|
||||||
function getUserRowHtml(height, data)
|
function getUserRowHtml(height, data)
|
||||||
{
|
{
|
||||||
var nameHtml;
|
var nameHtml;
|
||||||
var isGuest = (data.id.charAt(0) != 'p');
|
|
||||||
if (data.name)
|
if (data.name)
|
||||||
{
|
{
|
||||||
nameHtml = padutils.escapeHtml(data.name);
|
nameHtml = padutils.escapeHtml(data.name);
|
||||||
if (isGuest && pad.getIsProPad())
|
|
||||||
{
|
|
||||||
nameHtml += ' ('+_(pad.userlist.guest)+')';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue