mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-26 10:26:15 -04:00
Merge branch 'master' into timeslider-realtimeupdate+readonly-pads
Conflicts: src/node/handler/PadMessageHandler.js src/static/css/pad.css src/templates/pad.html
This commit is contained in:
commit
15a7d24450
32 changed files with 375 additions and 1962 deletions
|
@ -1,6 +1,5 @@
|
|||
body {
|
||||
margin: 0;
|
||||
height: 100%;
|
||||
color: #333;
|
||||
font: 14px helvetica, sans-serif;
|
||||
background: #ddd;
|
||||
|
@ -26,7 +25,7 @@ h1 {
|
|||
h2 {
|
||||
font-size: 24px;
|
||||
}
|
||||
.seperator {
|
||||
.separator {
|
||||
margin: 10px 0;
|
||||
height: 1px;
|
||||
background: #aaa;
|
||||
|
|
|
@ -5,6 +5,13 @@
|
|||
html { cursor: text; } /* in Safari, produces text cursor for whole doc (inc. below body) */
|
||||
span { cursor: auto; }
|
||||
|
||||
::selection {
|
||||
background: #acf;
|
||||
}
|
||||
::-moz-selection {
|
||||
background: #acf;
|
||||
}
|
||||
|
||||
a { cursor: pointer !important; }
|
||||
|
||||
ul, ol, li {
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -177,19 +177,18 @@ require.setGlobalKeyPath("require");\n\
|
|||
}
|
||||
function pushScriptsTo(buffer) {
|
||||
/* Folling is for packaging regular expression. */
|
||||
/* $$INCLUDE_JS("../javascripts/src/ace2_inner.js?callback=require.define"); */
|
||||
var ACE_SOURCE = '../javascripts/src/ace2_inner.js?callback=require.define';
|
||||
/* $$INCLUDE_JS("../javascripts/lib/ep_etherpad-lite/static/js/ace2_inner.js?callback=require.define"); */
|
||||
/* $$INCLUDE_JS("../javascripts/lib/ep_etherpad-lite/static/js/ace2_common.js?callback=require.define"); */
|
||||
var ACE_SOURCE = '../javascripts/lib/ep_etherpad-lite/static/js/ace2_inner.js?callback=require.define';
|
||||
var ACE_COMMON = '../javascripts/lib/ep_etherpad-lite/static/js/ace2_common.js?callback=require.define';
|
||||
if (Ace2Editor.EMBEDED && Ace2Editor.EMBEDED[ACE_SOURCE]) {
|
||||
buffer.push('<script type="text/javascript">');
|
||||
buffer.push(Ace2Editor.EMBEDED[ACE_SOURCE]);
|
||||
buffer.push('require("ep_etherpad-lite/static/js/ace2_inner");');
|
||||
buffer.push(Ace2Editor.EMBEDED[ACE_COMMON]);
|
||||
buffer.push('<\/script>');
|
||||
} else {
|
||||
file = ACE_SOURCE;
|
||||
buffer.push('<script type="application/javascript" src="' + ACE_SOURCE + '"><\/script>');
|
||||
buffer.push('<script type="text/javascript">');
|
||||
buffer.push('require("ep_etherpad-lite/static/js/ace2_inner");');
|
||||
buffer.push('<\/script>');
|
||||
buffer.push('<script type="application/javascript" src="' + ACE_COMMON + '"><\/script>');
|
||||
}
|
||||
}
|
||||
function pushStyleTagsFor(buffer, files) {
|
||||
|
@ -239,20 +238,11 @@ require.setGlobalKeyPath("require");\n\
|
|||
|
||||
iframeHTML.push(doctype);
|
||||
iframeHTML.push("<html><head>");
|
||||
iframeHTML.push('<script type="text/javascript" src="../static/js/jquery.js"></script>');
|
||||
|
||||
hooks.callAll("aceInitInnerdocbodyHead", {
|
||||
iframeHTML: iframeHTML
|
||||
});
|
||||
|
||||
// For compatability's sake transform in and out.
|
||||
for (var i = 0, ii = iframeHTML.length; i < ii; i++) {
|
||||
iframeHTML[i] = JSON.stringify(iframeHTML[i]);
|
||||
}
|
||||
for (var i = 0, ii = iframeHTML.length; i < ii; i++) {
|
||||
iframeHTML[i] = JSON.parse(iframeHTML[i]);
|
||||
}
|
||||
|
||||
// calls to these functions ($$INCLUDE_...) are replaced when this file is processed
|
||||
// and compressed, putting the compressed code from the named file directly into the
|
||||
// source here.
|
||||
|
@ -269,23 +259,22 @@ require.setGlobalKeyPath("require");\n\
|
|||
pushStyleTagsFor(iframeHTML, includedCSS);
|
||||
|
||||
var includedJS = [];
|
||||
var $$INCLUDE_JS = function(filename) {includedJS.push(filename)};
|
||||
pushRequireScriptTo(iframeHTML);
|
||||
pushScriptsTo(iframeHTML);
|
||||
|
||||
// Inject my plugins into my child.
|
||||
iframeHTML.push('\
|
||||
<script type="text/javascript">\
|
||||
parent_req = require("./pluginfw/parent_require.js");\
|
||||
parent_req = require("ep_etherpad-lite/static/js/pluginfw/parent_require");\
|
||||
parent_req.getRequirementFromParent(require, "ep_etherpad-lite/static/js/pluginfw/hooks");\
|
||||
parent_req.getRequirementFromParent(require, "ep_etherpad-lite/static/js/pluginfw/plugins");\
|
||||
parent_req.getRequirementFromParent(require, "./pluginfw/hooks");\
|
||||
parent_req.getRequirementFromParent(require, "./pluginfw/plugins");\
|
||||
require.define("/plugins", null);\n\
|
||||
require.define("/plugins.js", function (require, exports, module) {\
|
||||
module.exports = require("ep_etherpad-lite/static/js/plugins");\
|
||||
});\
|
||||
</script>\
|
||||
');
|
||||
pushScriptsTo(iframeHTML);
|
||||
|
||||
iframeHTML.push('<script type="text/javascript">');
|
||||
iframeHTML.push('$ = jQuery = require("ep_etherpad-lite/static/js/rjquery").jQuery; // Expose jQuery #HACK');
|
||||
iframeHTML.push('require("ep_etherpad-lite/static/js/ace2_inner");');
|
||||
iframeHTML.push('<\/script>');
|
||||
|
||||
iframeHTML.push('<style type="text/css" title="dynamicsyntax"></style>');
|
||||
iframeHTML.push('</head><body id="innerdocbody" class="syntax" spellcheck="false"> </body></html>');
|
||||
|
|
|
@ -166,12 +166,10 @@ function Ace2Inner(){
|
|||
}
|
||||
|
||||
var dynamicCSS = null;
|
||||
var dynamicCSSTop = null;
|
||||
|
||||
function initDynamicCSS()
|
||||
{
|
||||
dynamicCSS = makeCSSManager("dynamicsyntax");
|
||||
dynamicCSSTop = makeCSSManager("dynamicsyntax", true);
|
||||
}
|
||||
|
||||
var changesetTracker = makeChangesetTracker(scheduler, rep.apool, {
|
||||
|
@ -214,7 +212,6 @@ function Ace2Inner(){
|
|||
if (dynamicCSS)
|
||||
{
|
||||
dynamicCSS.removeSelectorStyle(getAuthorColorClassSelector(getAuthorClassName(author)));
|
||||
dynamicCSSTop.removeSelectorStyle(getAuthorColorClassSelector(getAuthorClassName(author)));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -232,23 +229,18 @@ function Ace2Inner(){
|
|||
|
||||
var authorStyle = dynamicCSS.selectorStyle(getAuthorColorClassSelector(
|
||||
getAuthorClassName(author)));
|
||||
var authorStyleTop = dynamicCSSTop.selectorStyle(getAuthorColorClassSelector(
|
||||
getAuthorClassName(author)));
|
||||
var anchorStyle = dynamicCSS.selectorStyle(getAuthorColorClassSelector(
|
||||
getAuthorClassName(author))+' > a')
|
||||
|
||||
// author color
|
||||
authorStyle.backgroundColor = bgcolor;
|
||||
authorStyleTop.backgroundColor = bgcolor;
|
||||
|
||||
// text contrast
|
||||
if(colorutils.luminosity(colorutils.css2triple(bgcolor)) < 0.5)
|
||||
{
|
||||
authorStyle.color = '#ffffff';
|
||||
authorStyleTop.color = '#ffffff';
|
||||
}else{
|
||||
authorStyle.color = null;
|
||||
authorStyleTop.color = null;
|
||||
}
|
||||
|
||||
// anchor text contrast
|
||||
|
@ -3749,24 +3741,6 @@ function Ace2Inner(){
|
|||
setSelection(selection);
|
||||
}
|
||||
|
||||
function getRepHTML()
|
||||
{
|
||||
return _.map(rep.lines.slice(), function(entry)
|
||||
{
|
||||
var text = entry.text;
|
||||
var content;
|
||||
if (text.length === 0)
|
||||
{
|
||||
content = '<span style="color: #aaa">--</span>';
|
||||
}
|
||||
else
|
||||
{
|
||||
content = htmlPrettyEscape(text);
|
||||
}
|
||||
return '<div><code>' + content + '</div></code>';
|
||||
}).join('');
|
||||
}
|
||||
|
||||
function nodeMaxIndex(nd)
|
||||
{
|
||||
if (isNodeText(nd)) return nd.nodeValue.length;
|
||||
|
|
|
@ -1,5 +1,16 @@
|
|||
$(document).ready(function () {
|
||||
var socket = io.connect().of("/pluginfw/installer");
|
||||
|
||||
var socket,
|
||||
loc = document.location,
|
||||
port = loc.port == "" ? (loc.protocol == "https:" ? 443 : 80) : loc.port,
|
||||
url = loc.protocol + "//" + loc.hostname + ":" + port + "/",
|
||||
pathComponents = location.pathname.split('/'),
|
||||
// Strip admin/plugins
|
||||
baseURL = pathComponents.slice(0,pathComponents.length-2).join('/') + '/',
|
||||
resource = baseURL.substring(1) + "socket.io";
|
||||
|
||||
//connect
|
||||
socket = io.connect(url, {resource : resource}).of("/pluginfw/installer");
|
||||
|
||||
$('.search-results').data('query', {
|
||||
pattern: '',
|
||||
|
|
|
@ -189,95 +189,15 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options, _pad)
|
|||
|
||||
function setUpSocket()
|
||||
{
|
||||
//oldSocketId = String(Math.floor(Math.random()*1e12));
|
||||
//socketId = String(Math.floor(Math.random()*1e12));
|
||||
/*socket = new io.Socket();
|
||||
socket.connect();*/
|
||||
|
||||
//socket.on('connect', function(){
|
||||
hiccupCount = 0;
|
||||
setChannelState("CONNECTED");
|
||||
/*var msg = { type:"CLIENT_READY", roomType:'padpage',
|
||||
roomName:'padpage/'+globalPadId,
|
||||
data: {
|
||||
lastRev:rev,
|
||||
userInfo:userSet[userId],
|
||||
stats: getStats() } };
|
||||
if (oldSocketId) {
|
||||
msg.data.isReconnectOf = oldSocketId;
|
||||
msg.data.isCommitPending = (state == "COMMITTING");
|
||||
}
|
||||
sendMessage(msg);*/
|
||||
doDeferredActions();
|
||||
|
||||
initialStartConnectTime = +new Date();
|
||||
// });
|
||||
/*socket.on('message', function(obj){
|
||||
if(window.console)
|
||||
console.log(obj);
|
||||
handleMessageFromServer(obj);
|
||||
});*/
|
||||
|
||||
/*var success = false;
|
||||
callCatchingErrors("setUpSocket", function() {
|
||||
appLevelDisconnectReason = null;
|
||||
|
||||
var oldSocketId = socketId;
|
||||
socketId = String(Math.floor(Math.random()*1e12));
|
||||
socket = new WebSocket(socketId);
|
||||
socket.onmessage = wrapRecordingErrors("socket.onmessage", handleMessageFromServer);
|
||||
socket.onclosed = wrapRecordingErrors("socket.onclosed", handleSocketClosed);
|
||||
socket.onopen = wrapRecordingErrors("socket.onopen", function() {
|
||||
hiccupCount = 0;
|
||||
setChannelState("CONNECTED");
|
||||
var msg = { type:"CLIENT_READY", roomType:'padpage',
|
||||
roomName:'padpage/'+globalPadId,
|
||||
data: {
|
||||
lastRev:rev,
|
||||
userInfo:userSet[userId],
|
||||
stats: getStats() } };
|
||||
if (oldSocketId) {
|
||||
msg.data.isReconnectOf = oldSocketId;
|
||||
msg.data.isCommitPending = (state == "COMMITTING");
|
||||
}
|
||||
sendMessage(msg);
|
||||
doDeferredActions();
|
||||
});
|
||||
socket.onhiccup = wrapRecordingErrors("socket.onhiccup", handleCometHiccup);
|
||||
socket.onlogmessage = dmesg;
|
||||
socket.connect();
|
||||
success = true;
|
||||
});
|
||||
if (success) {
|
||||
initialStartConnectTime = +new Date();
|
||||
}
|
||||
else {
|
||||
abandonConnection("initsocketfail");
|
||||
}*/
|
||||
}
|
||||
|
||||
var hiccupCount = 0;
|
||||
|
||||
function handleCometHiccup(params)
|
||||
{
|
||||
dmesg("HICCUP (connected:" + ( !! params.connected) + ")");
|
||||
var connectedNow = params.connected;
|
||||
if (!connectedNow)
|
||||
{
|
||||
hiccupCount++;
|
||||
// skip first "cut off from server" notification
|
||||
if (hiccupCount > 1)
|
||||
{
|
||||
setChannelState("RECONNECTING");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
hiccupCount = 0;
|
||||
setChannelState("CONNECTED");
|
||||
}
|
||||
}
|
||||
|
||||
function sendMessage(msg)
|
||||
{
|
||||
getSocket().json.send(
|
||||
|
@ -382,13 +302,11 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options, _pad)
|
|||
{
|
||||
userSet[id] = userInfo;
|
||||
callbacks.onUpdateUserInfo(userInfo);
|
||||
dmesgUsers();
|
||||
}
|
||||
else
|
||||
{
|
||||
userSet[id] = userInfo;
|
||||
callbacks.onUserJoin(userInfo);
|
||||
dmesgUsers();
|
||||
}
|
||||
tellAceActiveAuthorInfo(userInfo);
|
||||
}
|
||||
|
@ -401,7 +319,6 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options, _pad)
|
|||
delete userSet[userInfo.userId];
|
||||
fadeAceAuthorInfo(userInfo);
|
||||
callbacks.onUserLeave(userInfo);
|
||||
dmesgUsers();
|
||||
}
|
||||
}
|
||||
else if (msg.type == "DISCONNECT_REASON")
|
||||
|
@ -485,11 +402,6 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options, _pad)
|
|||
}
|
||||
}
|
||||
|
||||
function dmesgUsers()
|
||||
{
|
||||
//pad.dmesg($.map(getConnectedUsers(), function(u) { return u.userId.slice(-2); }).join(','));
|
||||
}
|
||||
|
||||
function setChannelState(newChannelState, moreInfo)
|
||||
{
|
||||
if (newChannelState != channelState)
|
||||
|
@ -678,29 +590,4 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options, _pad)
|
|||
return self;
|
||||
}
|
||||
|
||||
function selectElementContents(elem)
|
||||
{
|
||||
if ($.browser.msie)
|
||||
{
|
||||
var range = document.body.createTextRange();
|
||||
range.moveToElementText(elem);
|
||||
range.select();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (window.getSelection)
|
||||
{
|
||||
var browserSelection = window.getSelection();
|
||||
if (browserSelection)
|
||||
{
|
||||
var range = document.createRange();
|
||||
range.selectNodeContents(elem);
|
||||
browserSelection.removeAllRanges();
|
||||
browserSelection.addRange(range);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
exports.getCollabClient = getCollabClient;
|
||||
exports.selectElementContents = selectElementContents;
|
||||
|
|
|
@ -20,15 +20,12 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
function makeCSSManager(emptyStylesheetTitle, top)
|
||||
function makeCSSManager(emptyStylesheetTitle)
|
||||
{
|
||||
|
||||
function getSheetByTitle(title, top)
|
||||
function getSheetByTitle(title)
|
||||
{
|
||||
if(top)
|
||||
var allSheets = window.parent.parent.document.styleSheets;
|
||||
else
|
||||
var allSheets = document.styleSheets;
|
||||
var allSheets = document.styleSheets;
|
||||
|
||||
for (var i = 0; i < allSheets.length; i++)
|
||||
{
|
||||
|
@ -40,21 +37,8 @@ function makeCSSManager(emptyStylesheetTitle, top)
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/*function getSheetTagByTitle(title) {
|
||||
var allStyleTags = document.getElementsByTagName("style");
|
||||
for(var i=0;i<allStyleTags.length;i++) {
|
||||
var t = allStyleTags[i];
|
||||
if (t.title == title) {
|
||||
return t;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}*/
|
||||
|
||||
var browserSheet = getSheetByTitle(emptyStylesheetTitle, top);
|
||||
//var browserTag = getSheetTagByTitle(emptyStylesheetTitle);
|
||||
|
||||
|
||||
var browserSheet = getSheetByTitle(emptyStylesheetTitle);
|
||||
|
||||
function browserRules()
|
||||
{
|
||||
|
|
|
@ -30,7 +30,6 @@ require('./jquery');
|
|||
require('./farbtastic');
|
||||
require('./excanvas');
|
||||
JSON = require('./json2');
|
||||
require('./undo-xpopup');
|
||||
|
||||
var chat = require('./chat').chat;
|
||||
var getCollabClient = require('./collab_client').getCollabClient;
|
||||
|
@ -102,7 +101,6 @@ function getParams()
|
|||
var showLineNumbers = params["showLineNumbers"];
|
||||
var useMonospaceFont = params["useMonospaceFont"];
|
||||
var IsnoColors = params["noColors"];
|
||||
var hideQRCode = params["hideQRCode"];
|
||||
var rtl = params["rtl"];
|
||||
var alwaysShowChat = params["alwaysShowChat"];
|
||||
|
||||
|
@ -148,10 +146,6 @@ function getParams()
|
|||
// If the username is set as a parameter we should set a global value that we can call once we have initiated the pad.
|
||||
settings.globalUserName = decodeURIComponent(userName);
|
||||
}
|
||||
if(hideQRCode)
|
||||
{
|
||||
$('#qrcode').hide();
|
||||
}
|
||||
if(rtl)
|
||||
{
|
||||
if(rtl == "true")
|
||||
|
@ -203,8 +197,7 @@ function handshake()
|
|||
//create the url
|
||||
var url = loc.protocol + "//" + loc.hostname + ":" + port + "/";
|
||||
//find out in which subfolder we are
|
||||
var resource = exports.baseURL + "socket.io";
|
||||
|
||||
var resource = exports.baseURL.substring(1) + "socket.io";
|
||||
//connect
|
||||
socket = pad.socket = io.connect(url, {
|
||||
resource: resource,
|
||||
|
@ -697,13 +690,6 @@ var pad = {
|
|||
paduserlist.removeGuestPrompt(msg.guestId);
|
||||
}
|
||||
},
|
||||
editbarClick: function(cmd)
|
||||
{
|
||||
if (padeditbar)
|
||||
{
|
||||
padeditbar.toolbarClick(cmd);
|
||||
}
|
||||
},
|
||||
dmesg: function(m)
|
||||
{
|
||||
if (pad.getIsDebugEnabled())
|
||||
|
@ -1033,7 +1019,6 @@ var settings = {
|
|||
, noColors: false
|
||||
, useMonospaceFontGlobal: false
|
||||
, globalUserName: false
|
||||
, hideQRCode: false
|
||||
, rtlIsTrue: false
|
||||
};
|
||||
|
||||
|
|
|
@ -97,8 +97,15 @@ var padeditbar = (function()
|
|||
var self = {
|
||||
init: function()
|
||||
{
|
||||
var self = this;
|
||||
$("#editbar .editbarbutton").attr("unselectable", "on"); // for IE
|
||||
$("#editbar").removeClass("disabledtoolbar").addClass("enabledtoolbar");
|
||||
$("#editbar [data-key]").each(function (i, e) {
|
||||
$(e).click(function (event) {
|
||||
self.toolbarClick($(e).attr('data-key'));
|
||||
event.preventDefault();
|
||||
});
|
||||
});
|
||||
},
|
||||
isEnabled: function()
|
||||
{
|
||||
|
@ -119,7 +126,7 @@ var padeditbar = (function()
|
|||
}
|
||||
else if (cmd == 'settings')
|
||||
{
|
||||
self.toogleDropDown("settingsmenu");
|
||||
self.toogleDropDown("settings");
|
||||
}
|
||||
else if (cmd == 'embed')
|
||||
{
|
||||
|
@ -177,12 +184,11 @@ var padeditbar = (function()
|
|||
},
|
||||
toogleDropDown: function(moduleName)
|
||||
{
|
||||
var modules = ["settingsmenu", "importexport", "embed", "users"];
|
||||
var modules = ["settings", "importexport", "embed", "users"];
|
||||
|
||||
//hide all modules
|
||||
// hide all modules and remove highlighting of all buttons
|
||||
if(moduleName == "none")
|
||||
{
|
||||
$(".toolbar ul.menu_right li").removeClass("selected");
|
||||
for(var i=0;i<modules.length;i++)
|
||||
{
|
||||
//skip the userlist
|
||||
|
@ -193,29 +199,27 @@ var padeditbar = (function()
|
|||
|
||||
if(module.css('display') != "none")
|
||||
{
|
||||
$("#" + modules[i] + "link").removeClass("selected");
|
||||
module.slideUp("fast");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var nth_child = indexOf(modules, moduleName) + 1;
|
||||
if (nth_child > 0 && nth_child <= (modules.length-1)) {
|
||||
$(".toolbar ul.menu_right li:not(:nth-child(" + nth_child + "))").removeClass("selected");
|
||||
$(".toolbar ul.menu_right li:nth-child(" + nth_child + ")").toggleClass("selected");
|
||||
}
|
||||
if(modules[modules.length-1] === moduleName) $(".toolbar ul.menu_right li").removeClass("selected");
|
||||
//hide all modules that are not selected and show the selected one
|
||||
// hide all modules that are not selected and remove highlighting
|
||||
// respectively add highlighting to the corresponding button
|
||||
for(var i=0;i<modules.length;i++)
|
||||
{
|
||||
var module = $("#" + modules[i]);
|
||||
|
||||
if(module.css('display') != "none")
|
||||
{
|
||||
$("#" + modules[i] + "link").removeClass("selected");
|
||||
module.slideUp("fast");
|
||||
}
|
||||
else if(modules[i]==moduleName)
|
||||
{
|
||||
$("#" + modules[i] + "link").addClass("selected");
|
||||
module.slideDown("fast");
|
||||
}
|
||||
}
|
||||
|
@ -240,14 +244,12 @@ var padeditbar = (function()
|
|||
var readonlyLink = basePath + "/p/" + clientVars.readOnlyId;
|
||||
$('#embedinput').val("<iframe name='embed_readonly' src='" + readonlyLink + "?showControls=true&showChat=true&showLineNumbers=true&useMonospaceFont=false' width=600 height=400>");
|
||||
$('#linkinput').val(readonlyLink);
|
||||
$('#embedreadonlyqr').attr("src","https://chart.googleapis.com/chart?chs=200x200&cht=qr&chld=|0&chl=" + readonlyLink);
|
||||
}
|
||||
else
|
||||
{
|
||||
var padurl = window.location.href.split("?")[0];
|
||||
$('#embedinput').val("<iframe name='embed_readwrite' src='" + padurl + "?showControls=true&showChat=true&showLineNumbers=true&useMonospaceFont=false' width=600 height=400>");
|
||||
$('#linkinput').val(padurl);
|
||||
$('#embedreadonlyqr').attr("src","https://chart.googleapis.com/chart?chs=200x200&cht=qr&chld=|0&chl=" + padurl);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -58,7 +58,6 @@ var padeditor = (function()
|
|||
self.setViewOptions(initialViewOptions);
|
||||
|
||||
// view bar
|
||||
self.initViewZoom();
|
||||
$("#viewbarcontents").show();
|
||||
},
|
||||
initViewOptions: function()
|
||||
|
@ -98,43 +97,14 @@ var padeditor = (function()
|
|||
v = getOption('showAuthorColors', true);
|
||||
self.ace.setProperty("showsauthorcolors", v);
|
||||
padutils.setCheckbox($("#options-colorscheck"), v);
|
||||
// Override from parameters
|
||||
self.ace.setProperty("showsauthorcolors", !settings.noColors);
|
||||
// Override from parameters if true
|
||||
if (settings.noColors !== false)
|
||||
self.ace.setProperty("showsauthorcolors", !settings.noColors);
|
||||
|
||||
v = getOption('useMonospaceFont', false);
|
||||
self.ace.setProperty("textface", (v ? "monospace" : "Arial, sans-serif"));
|
||||
$("#viewfontmenu").val(v ? "monospace" : "normal");
|
||||
},
|
||||
initViewZoom: function()
|
||||
{
|
||||
var viewZoom = Number(padcookie.getPref('viewZoom'));
|
||||
if ((!viewZoom) || isNaN(viewZoom))
|
||||
{
|
||||
viewZoom = 100;
|
||||
}
|
||||
self.setViewZoom(viewZoom);
|
||||
$("#viewzoommenu").change(function(evt)
|
||||
{
|
||||
// strip initial 'z' from val
|
||||
self.setViewZoom(Number($("#viewzoommenu").val().substring(1)));
|
||||
});
|
||||
},
|
||||
setViewZoom: function(percent)
|
||||
{
|
||||
if (!(percent >= 50 && percent <= 1000))
|
||||
{
|
||||
// percent is out of sane range or NaN (which fails comparisons)
|
||||
return;
|
||||
}
|
||||
|
||||
self.viewZoom = percent;
|
||||
$("#viewzoommenu").val('z' + percent);
|
||||
|
||||
var baseSize = 13;
|
||||
self.ace.setProperty('textsize', Math.round(baseSize * self.viewZoom / 100));
|
||||
|
||||
padcookie.setPref('viewZoom', percent);
|
||||
},
|
||||
dispose: function()
|
||||
{
|
||||
if (self.ace)
|
||||
|
|
|
@ -217,7 +217,6 @@ var padimpexp = (function()
|
|||
// build the export links
|
||||
$("#exporthtmla").attr("href", pad_root_path + "/export/html");
|
||||
$("#exportplaina").attr("href", pad_root_path + "/export/txt");
|
||||
$("#exportwordlea").attr("href", pad_root_path + "/export/wordle");
|
||||
$("#exportdokuwikia").attr("href", pad_root_path + "/export/dokuwiki");
|
||||
|
||||
//hide stuff thats not avaible if abiword is disabled
|
||||
|
@ -280,17 +279,6 @@ var padimpexp = (function()
|
|||
$("#impexp-disabled-clickcatcher").hide();
|
||||
$("#import").css('opacity', 1);
|
||||
$("#impexp-export").css('opacity', 1);
|
||||
},
|
||||
export2Wordle: function()
|
||||
{
|
||||
var padUrl = $('#exportwordlea').attr('href').replace(/\/wordle$/, '/txt')
|
||||
|
||||
$.get(padUrl, function(data)
|
||||
{
|
||||
$('.result').html(data);
|
||||
$('#text').html(data);
|
||||
$('#wordlepost').submit();
|
||||
});
|
||||
}
|
||||
};
|
||||
return self;
|
||||
|
|
|
@ -19,166 +19,16 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
var padutils = require('./pad_utils').padutils;
|
||||
var paddocbar = require('./pad_docbar').paddocbar;
|
||||
|
||||
var padmodals = (function()
|
||||
{
|
||||
|
||||
/*var clearFeedbackEmail = function() {};
|
||||
function clearFeedback() {
|
||||
clearFeedbackEmail();
|
||||
$("#feedbackbox-message").val('');
|
||||
}
|
||||
|
||||
var sendingFeedback = false;
|
||||
function setSendingFeedback(v) {
|
||||
v = !! v;
|
||||
if (sendingFeedback != v) {
|
||||
sendingFeedback = v;
|
||||
if (v) {
|
||||
$("#feedbackbox-send").css('opacity', 0.75);
|
||||
}
|
||||
else {
|
||||
$("#feedbackbox-send").css('opacity', 1);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
var sendingInvite = false;
|
||||
|
||||
function setSendingInvite(v)
|
||||
{
|
||||
v = !! v;
|
||||
if (sendingInvite != v)
|
||||
{
|
||||
sendingInvite = v;
|
||||
if (v)
|
||||
{
|
||||
$(".sharebox-send").css('opacity', 0.75);
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#sharebox-send").css('opacity', 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var clearShareBoxTo = function()
|
||||
{};
|
||||
|
||||
function clearShareBox()
|
||||
{
|
||||
clearShareBoxTo();
|
||||
}
|
||||
|
||||
var pad = undefined;
|
||||
var self = {
|
||||
init: function(_pad)
|
||||
{
|
||||
pad = _pad;
|
||||
|
||||
self.initFeedback();
|
||||
self.initShareBox();
|
||||
},
|
||||
initFeedback: function()
|
||||
{
|
||||
/*var emailField = $("#feedbackbox-email");
|
||||
clearFeedbackEmail =
|
||||
padutils.makeFieldLabeledWhenEmpty(emailField, '(your email address)').clear;
|
||||
clearFeedback();*/
|
||||
|
||||
$("#feedbackbox-hide").click(function()
|
||||
{
|
||||
self.hideModal();
|
||||
});
|
||||
/*$("#feedbackbox-send").click(function() {
|
||||
self.sendFeedbackEmail();
|
||||
});*/
|
||||
|
||||
$("#feedbackbutton").click(function()
|
||||
{
|
||||
self.showFeedback();
|
||||
});
|
||||
},
|
||||
initShareBox: function()
|
||||
{
|
||||
$("#sharebutton").click(function()
|
||||
{
|
||||
self.showShareBox();
|
||||
});
|
||||
$("#sharebox-hide").click(function()
|
||||
{
|
||||
self.hideModal();
|
||||
});
|
||||
$("#sharebox-send").click(function()
|
||||
{
|
||||
self.sendInvite();
|
||||
});
|
||||
|
||||
$("#sharebox-url").click(function()
|
||||
{
|
||||
$("#sharebox-url").focus().select();
|
||||
});
|
||||
|
||||
clearShareBoxTo = padutils.makeFieldLabeledWhenEmpty($("#sharebox-to"), "(email addresses)").clear;
|
||||
clearShareBox();
|
||||
|
||||
$("#sharebox-subject").val(self.getDefaultShareBoxSubjectForName(pad.getUserName()));
|
||||
$("#sharebox-message").val(self.getDefaultShareBoxMessageForName(pad.getUserName()));
|
||||
|
||||
$("#sharebox-stripe .setsecurity").click(function()
|
||||
{
|
||||
self.hideModal();
|
||||
paddocbar.setShownPanel('security');
|
||||
});
|
||||
},
|
||||
getDefaultShareBoxMessageForName: function(name)
|
||||
{
|
||||
return (name || "Somebody") + " has shared an EtherPad document with you." + "\n\n" + "View it here:\n\n" + padutils.escapeHtml($(".sharebox-url").val() + "\n");
|
||||
},
|
||||
getDefaultShareBoxSubjectForName: function(name)
|
||||
{
|
||||
return (name || "Somebody") + " invited you to an EtherPad document";
|
||||
},
|
||||
relayoutWithBottom: function(px)
|
||||
{
|
||||
$("#modaloverlay").height(px);
|
||||
$("#sharebox").css('left', Math.floor(($(window).width() - $("#sharebox").outerWidth()) / 2));
|
||||
$("#feedbackbox").css('left', Math.floor(($(window).width() - $("#feedbackbox").outerWidth()) / 2));
|
||||
},
|
||||
showFeedback: function()
|
||||
{
|
||||
self.showModal("#feedbackbox");
|
||||
},
|
||||
showShareBox: function()
|
||||
{
|
||||
// when showing the dialog, if it still says "Somebody" invited you
|
||||
// then we fill in the updated username if there is one;
|
||||
// otherwise, we don't touch it, perhaps the user is happy with it
|
||||
var msgbox = $("#sharebox-message");
|
||||
if (msgbox.val() == self.getDefaultShareBoxMessageForName(null))
|
||||
{
|
||||
msgbox.val(self.getDefaultShareBoxMessageForName(pad.getUserName()));
|
||||
}
|
||||
var subjBox = $("#sharebox-subject");
|
||||
if (subjBox.val() == self.getDefaultShareBoxSubjectForName(null))
|
||||
{
|
||||
subjBox.val(self.getDefaultShareBoxSubjectForName(pad.getUserName()));
|
||||
}
|
||||
|
||||
if (pad.isPadPublic())
|
||||
{
|
||||
$("#sharebox-stripe").get(0).className = 'sharebox-stripe-public';
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#sharebox-stripe").get(0).className = 'sharebox-stripe-private';
|
||||
}
|
||||
|
||||
self.showModal("#sharebox", 500);
|
||||
$("#sharebox-url").focus().select();
|
||||
},
|
||||
showModal: function(modalId, duration)
|
||||
{
|
||||
|
@ -217,155 +67,6 @@ var padmodals = (function()
|
|||
{
|
||||
$("#modaloverlay").hide();
|
||||
});
|
||||
},
|
||||
hideFeedbackLaterIfNoOtherInteraction: function()
|
||||
{
|
||||
return padutils.getCancellableAction('hide-feedbackbox', function()
|
||||
{
|
||||
self.hideModal();
|
||||
});
|
||||
},
|
||||
hideShareboxLaterIfNoOtherInteraction: function()
|
||||
{
|
||||
return padutils.getCancellableAction('hide-sharebox', function()
|
||||
{
|
||||
self.hideModal();
|
||||
});
|
||||
},
|
||||
/* sendFeedbackEmail: function() {
|
||||
if (sendingFeedback) {
|
||||
return;
|
||||
}
|
||||
var message = $("#feedbackbox-message").val();
|
||||
if (! message) {
|
||||
return;
|
||||
}
|
||||
var email = ($("#feedbackbox-email").hasClass('editempty') ? '' :
|
||||
$("#feedbackbox-email").val());
|
||||
var padId = pad.getPadId();
|
||||
var username = pad.getUserName();
|
||||
setSendingFeedback(true);
|
||||
$("#feedbackbox-response").html("Sending...").get(0).className = '';
|
||||
$("#feedbackbox-response").show();
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
url: '/ep/pad/feedback',
|
||||
data: {
|
||||
feedback: message,
|
||||
padId: padId,
|
||||
username: username,
|
||||
email: email
|
||||
},
|
||||
success: success,
|
||||
error: error
|
||||
});
|
||||
var hideCall = self.hideFeedbackLaterIfNoOtherInteraction();
|
||||
function success(msg) {
|
||||
setSendingFeedback(false);
|
||||
clearFeedback();
|
||||
$("#feedbackbox-response").html("Thanks for your feedback").get(0).className = 'goodresponse';
|
||||
$("#feedbackbox-response").show();
|
||||
window.setTimeout(function() {
|
||||
$("#feedbackbox-response").fadeOut('slow', function() {
|
||||
hideCall();
|
||||
});
|
||||
}, 1500);
|
||||
}
|
||||
function error(e) {
|
||||
setSendingFeedback(false);
|
||||
$("#feedbackbox-response").html("Could not send feedback. Please email us at feedback"+"@"+"etherpad.com instead.").get(0).className = 'badresponse';
|
||||
$("#feedbackbox-response").show();
|
||||
}
|
||||
},*/
|
||||
sendInvite: function()
|
||||
{
|
||||
if (sendingInvite)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!pad.isFullyConnected())
|
||||
{
|
||||
displayErrorMessage("Error: Connection to the server is down or flaky.");
|
||||
return;
|
||||
}
|
||||
var message = $("#sharebox-message").val();
|
||||
if (!message)
|
||||
{
|
||||
displayErrorMessage("Please enter a message body before sending.");
|
||||
return;
|
||||
}
|
||||
var emails = ($("#sharebox-to").hasClass('editempty') ? '' : $("#sharebox-to").val()) || '';
|
||||
// find runs of characters that aren't obviously non-email punctuation
|
||||
var emailArray = emails.match(/[^\s,:;<>\"\'\/\(\)\[\]{}]+/g) || [];
|
||||
if (emailArray.length == 0)
|
||||
{
|
||||
displayErrorMessage('Please enter at least one "To:" address.');
|
||||
$("#sharebox-to").focus().select();
|
||||
return;
|
||||
}
|
||||
for (var i = 0; i < emailArray.length; i++)
|
||||
{
|
||||
var addr = emailArray[i];
|
||||
if (!addr.match(/^[\w\.\_\+\-]+\@[\w\_\-]+\.[\w\_\-\.]+$/))
|
||||
{
|
||||
displayErrorMessage('"' + padutils.escapeHtml(addr) + '" does not appear to be a valid email address.');
|
||||
return;
|
||||
}
|
||||
}
|
||||
var subject = $("#sharebox-subject").val();
|
||||
if (!subject)
|
||||
{
|
||||
subject = self.getDefaultShareBoxSubjectForName(pad.getUserName());
|
||||
$("#sharebox-subject").val(subject); // force the default subject
|
||||
}
|
||||
|
||||
var padId = pad.getPadId();
|
||||
var username = pad.getUserName();
|
||||
setSendingInvite(true);
|
||||
$("#sharebox-response").html("Sending...").get(0).className = '';
|
||||
$("#sharebox-response").show();
|
||||
$.ajax(
|
||||
{
|
||||
type: 'post',
|
||||
url: '/ep/pad/emailinvite',
|
||||
data: {
|
||||
message: message,
|
||||
toEmails: emailArray.join(','),
|
||||
subject: subject,
|
||||
username: username,
|
||||
padId: padId
|
||||
},
|
||||
success: success,
|
||||
error: error
|
||||
});
|
||||
var hideCall = self.hideShareboxLaterIfNoOtherInteraction();
|
||||
|
||||
function success(msg)
|
||||
{
|
||||
setSendingInvite(false);
|
||||
$("#sharebox-response").html("Email invitation sent!").get(0).className = 'goodresponse';
|
||||
$("#sharebox-response").show();
|
||||
window.setTimeout(function()
|
||||
{
|
||||
$("#sharebox-response").fadeOut('slow', function()
|
||||
{
|
||||
hideCall();
|
||||
});
|
||||
}, 1500);
|
||||
}
|
||||
|
||||
function error(e)
|
||||
{
|
||||
setSendingFeedback(false);
|
||||
$("#sharebox-response").html("An error occurred; no email was sent.").get(0).className = 'badresponse';
|
||||
$("#sharebox-response").show();
|
||||
}
|
||||
|
||||
function displayErrorMessage(msgHtml)
|
||||
{
|
||||
$("#sharebox-response").html(msgHtml).get(0).className = 'badresponse';
|
||||
$("#sharebox-response").show();
|
||||
}
|
||||
}
|
||||
};
|
||||
return self;
|
||||
|
|
|
@ -724,11 +724,11 @@ var paduserlist = (function()
|
|||
$("#myswatch").css({'background-color': myUserInfo.colorId});
|
||||
|
||||
if ($.browser.msie && parseInt($.browser.version) <= 8) {
|
||||
$("#usericon").css({'box-shadow': 'inset 0 0 30px ' + myUserInfo.colorId,'background-color': myUserInfo.colorId});
|
||||
$("#usericon a").css({'box-shadow': 'inset 0 0 30px ' + myUserInfo.colorId,'background-color': myUserInfo.colorId});
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#usericon").css({'box-shadow': 'inset 0 0 30px ' + myUserInfo.colorId});
|
||||
$("#usericon a").css({'box-shadow': 'inset 0 0 30px ' + myUserInfo.colorId});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -19,19 +19,21 @@
|
|||
* @params reqModuleName Module name e.g. (ep_etherpad-lite/static/js/plugins)
|
||||
*/
|
||||
exports.getRequirementFromParent = function(requireDefObj, reqModuleName) {
|
||||
requireDefObj.define(reqModuleName, function(require, exports, module) {
|
||||
var t = parent;
|
||||
var max = 0; // make sure I don't go up more than 10 times
|
||||
while (typeof(t) != "undefined") {
|
||||
max++;
|
||||
if (max==10)
|
||||
break;
|
||||
if (typeof(t.require) != "undefined") {
|
||||
module.exports = t.require(reqModuleName);
|
||||
return;
|
||||
}
|
||||
t = t.parent;
|
||||
}
|
||||
});
|
||||
|
||||
// Force the 'undefinition' of the modules (if they already have been loaded).
|
||||
delete (requireDefObj._definitions)[reqModuleName];
|
||||
delete (requireDefObj._modules)[reqModuleName];
|
||||
requireDefObj.define(reqModuleName, function(require, exports, module) {
|
||||
var t = parent;
|
||||
var max = 0; // make sure I don't go up more than 10 times
|
||||
while (typeof(t) != "undefined") {
|
||||
max++;
|
||||
if (max==10)
|
||||
break;
|
||||
if (typeof(t.require) != "undefined") {
|
||||
module.exports = t.require(reqModuleName);
|
||||
return;
|
||||
}
|
||||
t = t.parent;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
// assigns to the global `$` and augments it with plugins.
|
||||
require('./jquery');
|
||||
JSON = require('./json2');
|
||||
require('./undo-xpopup');
|
||||
|
||||
var createCookie = require('./pad_utils').createCookie;
|
||||
var readCookie = require('./pad_utils').readCookie;
|
||||
|
@ -60,7 +59,7 @@ function init() {
|
|||
//create the url
|
||||
var url = loc.protocol + "//" + loc.hostname + ":" + port + "/";
|
||||
//find out in which subfolder we are
|
||||
var resource = exports.baseURL + 'socket.io';
|
||||
var resource = exports.baseURL.substring(1) + 'socket.io';
|
||||
|
||||
//build up the socket io connection
|
||||
socket = io.connect(url, {resource: resource});
|
||||
|
|
|
@ -1,34 +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.
|
||||
*/
|
||||
|
||||
if (window._orig_windowOpen)
|
||||
{
|
||||
window.open = _orig_windowOpen;
|
||||
}
|
||||
if (window._orig_windowSetTimeout)
|
||||
{
|
||||
window.setTimeout = _orig_windowSetTimeout;
|
||||
}
|
||||
if (window._orig_windowSetInterval)
|
||||
{
|
||||
window.setInterval = _orig_windowSetInterval;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue