mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-24 01:16:15 -04:00
Merge branch 'master' of github.com:Pita/etherpad-lite
This commit is contained in:
commit
9f9eb6e928
44 changed files with 472 additions and 149 deletions
|
@ -28,9 +28,10 @@ Ace2Editor.registry = {
|
|||
nextId: 1
|
||||
};
|
||||
|
||||
var plugins = require('/plugins').plugins;
|
||||
|
||||
function Ace2Editor()
|
||||
{
|
||||
var thisFunctionsName = "Ace2Editor";
|
||||
var ace2 = Ace2Editor;
|
||||
|
||||
var editor = {};
|
||||
|
@ -215,24 +216,41 @@ function Ace2Editor()
|
|||
|
||||
return {embeded: embededFiles, remote: remoteFiles};
|
||||
}
|
||||
function pushRequireScriptTo(buffer) {
|
||||
/* Folling is for packaging regular expression. */
|
||||
/* $$INCLUDE_JS("../static/js/require-kernel.js"); */
|
||||
var KERNEL_SOURCE = '../static/js/require-kernel.js';
|
||||
if (Ace2Editor.EMBEDED && Ace2Editor.EMBEDED[KERNEL_SOURCE]) {
|
||||
buffer.push('<script type="text/javascript">');
|
||||
buffer.push(Ace2Editor.EMBEDED[KERNEL_SOURCE]);
|
||||
buffer.push('<\/script>');
|
||||
} else {
|
||||
buffer.push('<script type="application/javascript" src="'+KERNEL_SOURCE+'"><\/script>');
|
||||
}
|
||||
}
|
||||
function pushScriptTagsFor(buffer, files) {
|
||||
var sorted = sortFilesByEmbeded(files);
|
||||
var embededFiles = sorted.embeded;
|
||||
var remoteFiles = sorted.remote;
|
||||
|
||||
if (embededFiles.length > 0) {
|
||||
buffer.push('<script type="text/javascript">');
|
||||
for (var i = 0, ii = embededFiles.length; i < ii; i++) {
|
||||
var file = embededFiles[i];
|
||||
buffer.push(Ace2Editor.EMBEDED[file].replace(/<\//g, '<\\/'));
|
||||
buffer.push(';\n');
|
||||
}
|
||||
buffer.push('<\/script>');
|
||||
}
|
||||
for (var i = 0, ii = remoteFiles.length; i < ii; i++) {
|
||||
var file = remoteFiles[i];
|
||||
file = file.replace(/^\.\.\/static\/js\//, '../minified/');
|
||||
buffer.push('<script type="application/javascript" src="' + file + '"><\/script>');
|
||||
}
|
||||
|
||||
buffer.push('<script type="text/javascript">');
|
||||
for (var i = 0, ii = embededFiles.length; i < ii; i++) {
|
||||
var file = embededFiles[i];
|
||||
buffer.push(Ace2Editor.EMBEDED[file].replace(/<\//g, '<\\/'));
|
||||
buffer.push(';\n');
|
||||
}
|
||||
for (var i = 0, ii = files.length; i < ii; i++) {
|
||||
var file = files[i];
|
||||
file = file.replace(/^\.\.\/static\/js\//, '');
|
||||
buffer.push('require('+ JSON.stringify('/' + file) + ');\n');
|
||||
}
|
||||
buffer.push('<\/script>');
|
||||
}
|
||||
function pushStyleTagsFor(buffer, files) {
|
||||
var sorted = sortFilesByEmbeded(files);
|
||||
|
@ -318,11 +336,16 @@ function Ace2Editor()
|
|||
$$INCLUDE_JS("../static/js/linestylefilter.js");
|
||||
$$INCLUDE_JS("../static/js/domline.js");
|
||||
$$INCLUDE_JS("../static/js/ace2_inner.js");
|
||||
pushRequireScriptTo(iframeHTML);
|
||||
pushScriptTagsFor(iframeHTML, includedJS);
|
||||
|
||||
iframeHTML.push('<style type="text/css" title="dynamicsyntax"></style>');
|
||||
iframeHTML.push('</head><body id="innerdocbody" class="syntax" spellcheck="false"> </body></html>');
|
||||
|
||||
// Expose myself to global for my child frame.
|
||||
var thisFunctionsName = "ChildAccessibleAce2Editor";
|
||||
(function () {return this}())[thisFunctionsName] = Ace2Editor;
|
||||
|
||||
var outerScript = 'editorId = "' + info.id + '"; editorInfo = parent.' + thisFunctionsName + '.registry[editorId]; ' + 'window.onload = function() ' + '{ window.onload = null; setTimeout' + '(function() ' + '{ var iframe = document.createElement("IFRAME"); ' + 'iframe.scrolling = "no"; var outerdocbody = document.getElementById("outerdocbody"); ' + 'iframe.frameBorder = 0; iframe.allowTransparency = true; ' + // for IE
|
||||
'outerdocbody.insertBefore(iframe, outerdocbody.firstChild); ' + 'iframe.ace_outerWin = window; ' + 'readyFunc = function() { editorInfo.onEditorReady(); readyFunc = null; editorInfo = null; }; ' + 'var doc = iframe.contentWindow.document; doc.open(); var text = (' + JSON.stringify(iframeHTML.join('\n')) + ');doc.write(text); doc.close(); ' + '}, 0); }';
|
||||
|
||||
|
@ -367,3 +390,5 @@ function Ace2Editor()
|
|||
|
||||
return editor;
|
||||
}
|
||||
|
||||
exports.Ace2Editor = Ace2Editor;
|
||||
|
|
|
@ -80,14 +80,8 @@ function isArray(testObject)
|
|||
return testObject && typeof testObject === 'object' && !(testObject.propertyIsEnumerable('length')) && typeof testObject.length === 'number';
|
||||
}
|
||||
|
||||
if (typeof exports !== "undefined")
|
||||
{
|
||||
userAgent = "node-js";
|
||||
}
|
||||
else
|
||||
{
|
||||
userAgent = navigator.userAgent.toLowerCase();
|
||||
}
|
||||
var userAgent = (((function () {return this;})().navigator || {}).userAgent || 'node-js').toLowerCase();
|
||||
|
||||
// Figure out what browser is being used (stolen from jquery 1.2.1)
|
||||
var browser = {
|
||||
version: (userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/) || [])[1],
|
||||
|
@ -153,7 +147,17 @@ function htmlPrettyEscape(str)
|
|||
}).replace(/\r?\n/g, '\\n');
|
||||
}
|
||||
|
||||
if (typeof exports !== "undefined")
|
||||
{
|
||||
exports.map = map;
|
||||
}
|
||||
exports.isNodeText = isNodeText;
|
||||
exports.object = object;
|
||||
exports.extend = extend;
|
||||
exports.forEach = forEach;
|
||||
exports.map = map;
|
||||
exports.filter = filter;
|
||||
exports.isArray = isArray;
|
||||
exports.browser = browser;
|
||||
exports.getAssoc = getAssoc;
|
||||
exports.setAssoc = setAssoc;
|
||||
exports.binarySearch = binarySearch;
|
||||
exports.binarySearchInfinite = binarySearchInfinite;
|
||||
exports.htmlPrettyEscape = htmlPrettyEscape;
|
||||
exports.map = map;
|
||||
|
|
|
@ -20,6 +20,35 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
var Ace2Common = require('/ace2_common');
|
||||
// Extract useful method defined in the other module.
|
||||
var isNodeText = Ace2Common.isNodeText;
|
||||
var object = Ace2Common.object;
|
||||
var extend = Ace2Common.extend;
|
||||
var forEach = Ace2Common.forEach;
|
||||
var map = Ace2Common.map;
|
||||
var filter = Ace2Common.filter;
|
||||
var isArray = Ace2Common.isArray;
|
||||
var browser = Ace2Common.browser;
|
||||
var getAssoc = Ace2Common.getAssoc;
|
||||
var setAssoc = Ace2Common.setAssoc;
|
||||
var binarySearch = Ace2Common.binarySearch;
|
||||
var binarySearchInfinite = Ace2Common.binarySearchInfinite;
|
||||
var htmlPrettyEscape = Ace2Common.htmlPrettyEscape;
|
||||
var map = Ace2Common.map;
|
||||
|
||||
var makeChangesetTracker = require('/changesettracker').makeChangesetTracker;
|
||||
var colorutils = require('/colorutils').colorutils;
|
||||
var makeContentCollector = require('/contentcollector').makeContentCollector;
|
||||
var makeCSSManager = require('/cssmanager').makeCSSManager;
|
||||
var domline = require('/domline').domline;
|
||||
var AttribPool = require('/easysync2').AttribPool;
|
||||
var Changeset = require('/easysync2').Changeset;
|
||||
var linestylefilter = require('/linestylefilter').linestylefilter;
|
||||
var newSkipList = require('/skiplist').newSkipList;
|
||||
var undoModule = require('/undomodule').undoModule;
|
||||
var makeVirtualLineView = require('/virtual_lines').makeVirtualLineView;
|
||||
|
||||
function OUTER(gscope)
|
||||
{
|
||||
|
||||
|
@ -5868,3 +5897,5 @@ function OUTER(gscope)
|
|||
};
|
||||
|
||||
OUTER(this);
|
||||
|
||||
exports.OUTER = OUTER; // This is probably unimportant.
|
||||
|
|
|
@ -22,6 +22,12 @@
|
|||
|
||||
var global = this;
|
||||
|
||||
var makeCSSManager = require('/cssmanager_client').makeCSSManager;
|
||||
var domline = require('/domline_client').domline;
|
||||
var Changeset = require('/easysync2_client').Changeset;
|
||||
var AttribPool = require('/easysync2_client').AttribPool;
|
||||
var linestylefilter = require('/linestylefilter_client').linestylefilter;
|
||||
|
||||
function loadBroadcastJS()
|
||||
{
|
||||
// just in case... (todo: this must be somewhere else in the client code.)
|
||||
|
@ -758,3 +764,5 @@ function loadBroadcastJS()
|
|||
|
||||
receiveAuthorData(clientVars.historicalAuthorData);
|
||||
}
|
||||
|
||||
exports.loadBroadcastJS = loadBroadcastJS;
|
||||
|
|
|
@ -125,3 +125,5 @@ function loadBroadcastRevisionsJS()
|
|||
};
|
||||
}
|
||||
}
|
||||
|
||||
exports.loadBroadcastRevisionsJS = loadBroadcastRevisionsJS;
|
||||
|
|
|
@ -496,3 +496,5 @@ function loadBroadcastSliderJS()
|
|||
$("#viewlatest").html(loc == BroadcastSlider.getSliderLength() ? "Viewing latest content" : "View latest content");
|
||||
})
|
||||
}
|
||||
|
||||
exports.loadBroadcastSliderJS = loadBroadcastSliderJS;
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
var Changeset = require('/easysync2').Changeset;
|
||||
var AttribPool = require('/easysync2').AttribPool;
|
||||
|
||||
function makeChangesetTracker(scheduler, apool, aceCallbacksProvider)
|
||||
{
|
||||
|
@ -207,3 +209,5 @@ function makeChangesetTracker(scheduler, apool, aceCallbacksProvider)
|
|||
};
|
||||
|
||||
}
|
||||
|
||||
exports.makeChangesetTracker = makeChangesetTracker;
|
||||
|
|
|
@ -20,8 +20,11 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
var padutils = require('/pad_utils').padutils;
|
||||
|
||||
var chat = (function()
|
||||
{
|
||||
var isStuck = false;
|
||||
var bottomMargin = "0px";
|
||||
var sDuration = 500;
|
||||
var hDuration = 750;
|
||||
|
@ -66,6 +69,22 @@ var chat = (function()
|
|||
chatMentions = 0;
|
||||
document.title = title;
|
||||
},
|
||||
stickToScreen: function() // Make chat stick to right hand side of screen
|
||||
{
|
||||
console.log(isStuck);
|
||||
chat.show();
|
||||
if(!isStuck){ // Stick it to
|
||||
$('#chatbox').css({"right":"0px", "top":"35px", "border-radius":"0px", "height":"auto"});
|
||||
$('#editorcontainer').css({"right":"170px", "width":"auto"});
|
||||
isStuck = true;
|
||||
}
|
||||
else{ // Unstick it
|
||||
$('#chatbox').css({"right":"20px", "top":"auto", "border-top-left-radius":"5px", "border-top-right-radius":"5px", "height":"200px"});
|
||||
$('#editorcontainer').css({"right":"0px", "width":"100%"});
|
||||
isStuck = false;
|
||||
}
|
||||
}
|
||||
,
|
||||
hide: function ()
|
||||
{
|
||||
$("#chatcounter").text("0");
|
||||
|
@ -82,13 +101,13 @@ var chat = (function()
|
|||
send: function()
|
||||
{
|
||||
var text = $("#chatinput").val();
|
||||
pad.collabClient.sendMessage({"type": "CHAT_MESSAGE", "text": text});
|
||||
this._pad.collabClient.sendMessage({"type": "CHAT_MESSAGE", "text": text});
|
||||
$("#chatinput").val("");
|
||||
},
|
||||
addMessage: function(msg, increment)
|
||||
{
|
||||
//correct the time
|
||||
msg.time += pad.clientTimeOffset;
|
||||
msg.time += this._pad.clientTimeOffset;
|
||||
|
||||
//create the time string
|
||||
var minutes = "" + new Date(msg.time).getMinutes();
|
||||
|
@ -150,8 +169,9 @@ var chat = (function()
|
|||
self.scrollDown();
|
||||
|
||||
},
|
||||
init: function()
|
||||
init: function(pad)
|
||||
{
|
||||
this._pad = pad;
|
||||
$("#chatinput").keypress(function(evt)
|
||||
{
|
||||
//if the user typed enter, fire the send
|
||||
|
@ -172,3 +192,5 @@ var chat = (function()
|
|||
|
||||
return self;
|
||||
}());
|
||||
|
||||
exports.chat = chat;
|
||||
|
|
|
@ -25,12 +25,22 @@ $(window).bind("load", function()
|
|||
getCollabClient.windowLoaded = true;
|
||||
});
|
||||
|
||||
var chat = require('/chat').chat;
|
||||
|
||||
// Dependency fill on init. This exists for `pad.socket` only.
|
||||
// TODO: bind directly to the socket.
|
||||
var pad = undefined;
|
||||
function getSocket() {
|
||||
return pad && pad.socket;
|
||||
}
|
||||
|
||||
/** Call this when the document is ready, and a new Ace2Editor() has been created and inited.
|
||||
ACE's ready callback does not need to have fired yet.
|
||||
"serverVars" are from calling doc.getCollabClientVars() on the server. */
|
||||
function getCollabClient(ace2editor, serverVars, initialUserInfo, options)
|
||||
function getCollabClient(ace2editor, serverVars, initialUserInfo, options, _pad)
|
||||
{
|
||||
var editor = ace2editor;
|
||||
pad = _pad; // Inject pad to avoid a circular dependency.
|
||||
|
||||
var rev = serverVars.rev;
|
||||
var padId = serverVars.padId;
|
||||
|
@ -81,7 +91,7 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options)
|
|||
|
||||
$(window).bind("unload", function()
|
||||
{
|
||||
if (socket)
|
||||
if (getSocket())
|
||||
{
|
||||
setChannelState("DISCONNECTED", "unload");
|
||||
}
|
||||
|
@ -111,7 +121,7 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options)
|
|||
|
||||
function handleUserChanges()
|
||||
{
|
||||
if ((!socket) || channelState == "CONNECTING")
|
||||
if ((!getSocket()) || channelState == "CONNECTING")
|
||||
{
|
||||
if (channelState == "CONNECTING" && (((+new Date()) - initialStartConnectTime) > 20000))
|
||||
{
|
||||
|
@ -295,7 +305,7 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options)
|
|||
|
||||
function sendMessage(msg)
|
||||
{
|
||||
socket.json.send(
|
||||
getSocket().json.send(
|
||||
{
|
||||
type: "COLLABROOM",
|
||||
component: "pad",
|
||||
|
@ -337,7 +347,7 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options)
|
|||
{
|
||||
if (window.console) console.log(evt);
|
||||
|
||||
if (!socket) return;
|
||||
if (!getSocket()) return;
|
||||
if (!evt.data) return;
|
||||
var wrapper = evt;
|
||||
if (wrapper.type != "COLLABROOM") return;
|
||||
|
@ -442,7 +452,7 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options)
|
|||
userInfo.userId = userId;
|
||||
userSet[userId] = userInfo;
|
||||
tellAceActiveAuthorInfo(userInfo);
|
||||
if (!socket) return;
|
||||
if (!getSocket()) return;
|
||||
sendMessage(
|
||||
{
|
||||
type: "USERINFO_UPDATE",
|
||||
|
@ -714,3 +724,6 @@ function selectElementContents(elem)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
exports.getCollabClient = getCollabClient;
|
||||
exports.selectElementContents = selectElementContents;
|
||||
|
|
|
@ -119,3 +119,5 @@ colorutils.blend = function(c1, c2, t)
|
|||
{
|
||||
return [colorutils.scale(t, c1[0], c2[0]), colorutils.scale(t, c1[1], c2[1]), colorutils.scale(t, c1[2], c2[2])];
|
||||
}
|
||||
|
||||
exports.colorutils = colorutils;
|
||||
|
|
|
@ -25,6 +25,14 @@
|
|||
|
||||
var _MAX_LIST_LEVEL = 8;
|
||||
|
||||
var Changeset = require('/easysync2').Changeset
|
||||
var plugins = undefined;
|
||||
try {
|
||||
plugins = require('/plugins').plugins;
|
||||
} catch (e) {
|
||||
// silence
|
||||
}
|
||||
|
||||
function sanitizeUnicode(s)
|
||||
{
|
||||
return s.replace(/[\uffff\ufffe\ufeff\ufdd0-\ufdef\ud800-\udfff]/g, '?');
|
||||
|
@ -692,3 +700,6 @@ function makeContentCollector(collectStyles, browser, apool, domInterface, class
|
|||
|
||||
return cc;
|
||||
}
|
||||
|
||||
exports.sanitizeUnicode = sanitizeUnicode;
|
||||
exports.makeContentCollector = makeContentCollector;
|
||||
|
|
|
@ -118,3 +118,5 @@ function makeCSSManager(emptyStylesheetTitle, top)
|
|||
}
|
||||
};
|
||||
}
|
||||
|
||||
exports.makeCSSManager = makeCSSManager;
|
||||
|
|
|
@ -114,3 +114,5 @@ function makeCSSManager(emptyStylesheetTitle)
|
|||
}
|
||||
};
|
||||
}
|
||||
|
||||
exports.makeCSSManager = makeCSSManager;
|
||||
|
|
|
@ -25,6 +25,14 @@
|
|||
// requires: top
|
||||
// requires: plugins
|
||||
// requires: undefined
|
||||
|
||||
var plugins = undefined;
|
||||
try {
|
||||
plugins = require('/plugins').plugins;
|
||||
} catch (e) {
|
||||
// silence
|
||||
}
|
||||
|
||||
var domline = {};
|
||||
domline.noop = function()
|
||||
{};
|
||||
|
@ -310,3 +318,5 @@ domline.processSpaces = function(s, doesWrap)
|
|||
}
|
||||
return parts.join('');
|
||||
};
|
||||
|
||||
exports.domline = domline;
|
||||
|
|
|
@ -24,6 +24,14 @@
|
|||
// requires: top
|
||||
// requires: plugins
|
||||
// requires: undefined
|
||||
|
||||
var plugins = undefined;
|
||||
try {
|
||||
plugins = require('/plugins').plugins;
|
||||
} catch (e) {
|
||||
// silence
|
||||
}
|
||||
|
||||
var domline = {};
|
||||
domline.noop = function()
|
||||
{};
|
||||
|
@ -309,3 +317,5 @@ domline.processSpaces = function(s, doesWrap)
|
|||
}
|
||||
return parts.join('');
|
||||
};
|
||||
|
||||
exports.domline = domline;
|
||||
|
|
|
@ -193,3 +193,5 @@ function makeResizableHPane(left, sep, right, minLeft, minRight, sepWidth, sepOf
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
exports.makeDraggable = makeDraggable;
|
||||
|
|
|
@ -2508,3 +2508,6 @@ Changeset.followAttributes = function(att1, att2, pool)
|
|||
}
|
||||
return buf.toString();
|
||||
};
|
||||
|
||||
exports.Changeset = Changeset;
|
||||
exports.AttribPool = AttribPool;
|
||||
|
|
|
@ -2269,3 +2269,6 @@ Changeset.inverse = function(cs, lines, alines, pool)
|
|||
|
||||
return Changeset.checkRep(builder.toString());
|
||||
};
|
||||
|
||||
exports.Changeset = Changeset;
|
||||
exports.AttribPool = AttribPool;
|
||||
|
|
|
@ -27,6 +27,15 @@
|
|||
// requires: top
|
||||
// requires: plugins
|
||||
// requires: undefined
|
||||
|
||||
var Changeset = require('/easysync2').Changeset
|
||||
var plugins = undefined;
|
||||
try {
|
||||
plugins = require('/plugins').plugins;
|
||||
} catch (e) {
|
||||
// silence
|
||||
}
|
||||
|
||||
var linestylefilter = {};
|
||||
|
||||
linestylefilter.ATTRIB_CLASSES = {
|
||||
|
@ -352,3 +361,5 @@ linestylefilter.populateDomLine = function(textLine, aline, apool, domLineObj)
|
|||
func = linestylefilter.getLineStyleFilter(text.length, aline, func, apool);
|
||||
func(text, '');
|
||||
};
|
||||
|
||||
exports.linestylefilter = linestylefilter;
|
||||
|
|
|
@ -25,6 +25,15 @@
|
|||
// requires: top
|
||||
// requires: plugins
|
||||
// requires: undefined
|
||||
|
||||
var Changeset = require('/easysync2_client').Changeset
|
||||
var plugins = undefined;
|
||||
try {
|
||||
plugins = require('/plugins').plugins;
|
||||
} catch (e) {
|
||||
// silence
|
||||
}
|
||||
|
||||
var linestylefilter = {};
|
||||
|
||||
linestylefilter.ATTRIB_CLASSES = {
|
||||
|
@ -350,3 +359,5 @@ linestylefilter.populateDomLine = function(textLine, aline, apool, domLineObj)
|
|||
func = linestylefilter.getLineStyleFilter(text.length, aline, func, apool);
|
||||
func(text, '');
|
||||
};
|
||||
|
||||
exports.linestylefilter = linestylefilter;
|
||||
|
|
|
@ -23,12 +23,27 @@
|
|||
/* global $, window */
|
||||
|
||||
var socket;
|
||||
var LineNumbersDisabled = false;
|
||||
var noColors = false;
|
||||
var useMonospaceFontGlobal = false;
|
||||
var globalUserName = false;
|
||||
var hideQRCode = false;
|
||||
var rtlIsTrue = false;
|
||||
|
||||
var settings = {};
|
||||
settings.LineNumbersDisabled = false;
|
||||
settings.noColors = false;
|
||||
settings.useMonospaceFontGlobal = false;
|
||||
settings.globalUserName = false;
|
||||
settings.hideQRCode = false;
|
||||
settings.rtlIsTrue = false;
|
||||
|
||||
var chat = require('/chat').chat;
|
||||
var getCollabClient = require('/collab_client').getCollabClient;
|
||||
var padconnectionstatus = require('/pad_connectionstatus').padconnectionstatus;
|
||||
var padcookie = require('/pad_cookie').padcookie;
|
||||
var paddocbar = require('/pad_docbar').paddocbar;
|
||||
var padeditbar = require('/pad_editbar').padeditbar;
|
||||
var padeditor = require('/pad_editor').padeditor;
|
||||
var padimpexp = require('/pad_impexp').padimpexp;
|
||||
var padmodals = require('/pad_modals').padmodals;
|
||||
var padsavedrevs = require('/pad_savedrevs').padsavedrevs;
|
||||
var paduserlist = require('/pad_userlist').paduserlist;
|
||||
var padutils = require('/pad_utils').padutils;
|
||||
|
||||
$(document).ready(function()
|
||||
{
|
||||
|
@ -101,7 +116,7 @@ function getParams()
|
|||
{
|
||||
if(IsnoColors == "true")
|
||||
{
|
||||
noColors = true;
|
||||
settings.noColors = true;
|
||||
$('#clearAuthorship').hide();
|
||||
}
|
||||
}
|
||||
|
@ -124,20 +139,20 @@ function getParams()
|
|||
{
|
||||
if(showLineNumbers == "false")
|
||||
{
|
||||
LineNumbersDisabled = true;
|
||||
settings.LineNumbersDisabled = true;
|
||||
}
|
||||
}
|
||||
if(useMonospaceFont)
|
||||
{
|
||||
if(useMonospaceFont == "true")
|
||||
{
|
||||
useMonospaceFontGlobal = true;
|
||||
settings.useMonospaceFontGlobal = true;
|
||||
}
|
||||
}
|
||||
if(userName)
|
||||
{
|
||||
// If the username is set as a parameter we should set a global value that we can call once we have initiated the pad.
|
||||
globalUserName = unescape(userName);
|
||||
settings.globalUserName = unescape(userName);
|
||||
}
|
||||
if(hideQRCode)
|
||||
{
|
||||
|
@ -147,7 +162,7 @@ function getParams()
|
|||
{
|
||||
if(rtl == "true")
|
||||
{
|
||||
rtlIsTrue = true
|
||||
settings.rtlIsTrue = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -183,7 +198,7 @@ function handshake()
|
|||
//find out in which subfolder we are
|
||||
var resource = loc.pathname.substr(1, loc.pathname.indexOf("/p/")) + "socket.io";
|
||||
//connect
|
||||
socket = io.connect(url, {
|
||||
socket = pad.socket = io.connect(url, {
|
||||
resource: resource,
|
||||
'max reconnection attempts': 3
|
||||
});
|
||||
|
@ -270,13 +285,13 @@ function handshake()
|
|||
{
|
||||
$("#editorloadingbox").html("<b>You need a password to access this pad</b><br>" +
|
||||
"<input id='passwordinput' type='password' name='password'>"+
|
||||
"<button type='button' onclick='savePassword()'>ok</button>");
|
||||
"<button type='button' onclick=\"" + padutils.escapeHtml('require('+JSON.stringify(module.id)+").savePassword()") + "\">ok</button>");
|
||||
}
|
||||
else if(obj.accessStatus == "wrongPassword")
|
||||
{
|
||||
$("#editorloadingbox").html("<b>You're password was wrong</b><br>" +
|
||||
"<input id='passwordinput' type='password' name='password'>"+
|
||||
"<button type='button' onclick='savePassword()'>ok</button>");
|
||||
"<button type='button' onclick=\"" + padutils.escapeHtml('require('+JSON.stringify(module.id)+").savePassword()") + "\">ok</button>");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -298,33 +313,33 @@ function handshake()
|
|||
initalized = true;
|
||||
|
||||
// If the LineNumbersDisabled value is set to true then we need to hide the Line Numbers
|
||||
if (LineNumbersDisabled == true)
|
||||
if (settings.LineNumbersDisabled == true)
|
||||
{
|
||||
pad.changeViewOption('showLineNumbers', false);
|
||||
}
|
||||
|
||||
// If the noColors value is set to true then we need to hide the backround colors on the ace spans
|
||||
if (noColors == true)
|
||||
if (settings.noColors == true)
|
||||
{
|
||||
pad.changeViewOption('noColors', true);
|
||||
}
|
||||
|
||||
if (rtlIsTrue == true)
|
||||
if (settings.rtlIsTrue == true)
|
||||
{
|
||||
pad.changeViewOption('rtl', true);
|
||||
}
|
||||
|
||||
// If the Monospacefont value is set to true then change it to monospace.
|
||||
if (useMonospaceFontGlobal == true)
|
||||
if (settings.useMonospaceFontGlobal == true)
|
||||
{
|
||||
pad.changeViewOption('useMonospaceFont', true);
|
||||
}
|
||||
// if the globalUserName value is set we need to tell the server and the client about the new authorname
|
||||
if (globalUserName !== false)
|
||||
if (settings.globalUserName !== false)
|
||||
{
|
||||
pad.notifyChangeName(globalUserName); // Notifies the server
|
||||
pad.myUserInfo.name = globalUserName;
|
||||
$('#myusernameedit').attr({"value":globalUserName}); // Updates the current users UI
|
||||
pad.notifyChangeName(settings.globalUserName); // Notifies the server
|
||||
pad.myUserInfo.name = settings.globalUserName;
|
||||
$('#myusernameedit').attr({"value":settings.globalUserName}); // Updates the current users UI
|
||||
}
|
||||
}
|
||||
//This handles every Message after the clientVars
|
||||
|
@ -411,7 +426,7 @@ var pad = {
|
|||
pad.clientTimeOffset = new Date().getTime() - clientVars.serverTimestamp;
|
||||
|
||||
//initialize the chat
|
||||
chat.init();
|
||||
chat.init(this);
|
||||
pad.initTime = +(new Date());
|
||||
pad.padOptions = clientVars.initialOptions;
|
||||
|
||||
|
@ -472,7 +487,7 @@ var pad = {
|
|||
|
||||
pad.collabClient = getCollabClient(padeditor.ace, clientVars.collab_client_vars, pad.myUserInfo, {
|
||||
colorPalette: pad.getColorPalette()
|
||||
});
|
||||
}, pad);
|
||||
pad.collabClient.setOnUserJoin(pad.handleUserJoin);
|
||||
pad.collabClient.setOnUpdateUserInfo(pad.handleUserUpdate);
|
||||
pad.collabClient.setOnUserLeave(pad.handleUserLeave);
|
||||
|
@ -951,3 +966,14 @@ var alertBar = (function()
|
|||
};
|
||||
return self;
|
||||
}());
|
||||
|
||||
exports.settings = settings;
|
||||
exports.createCookie = createCookie;
|
||||
exports.readCookie = readCookie;
|
||||
exports.randomString = randomString;
|
||||
exports.getParams = getParams;
|
||||
exports.getUrlVars = getUrlVars;
|
||||
exports.savePassword = savePassword;
|
||||
exports.handshake = handshake;
|
||||
exports.pad = pad;
|
||||
exports.alertBar = alertBar;
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
var padmodals = require('/pad_modals').padmodals;
|
||||
|
||||
var padconnectionstatus = (function()
|
||||
{
|
||||
|
||||
|
@ -85,3 +87,5 @@ var padconnectionstatus = (function()
|
|||
};
|
||||
return self;
|
||||
}());
|
||||
|
||||
exports.padconnectionstatus = padconnectionstatus;
|
||||
|
|
|
@ -85,9 +85,12 @@ var padcookie = (function()
|
|||
var alreadyWarnedAboutNoCookies = false;
|
||||
var inited = false;
|
||||
|
||||
var pad = undefined;
|
||||
var self = {
|
||||
init: function(prefsToSet)
|
||||
{
|
||||
pad = require('/pad2').pad; // Sidestep circular dependency (should be injected).
|
||||
|
||||
var rawCookie = getRawCookie();
|
||||
if (rawCookie)
|
||||
{
|
||||
|
@ -126,3 +129,5 @@ var padcookie = (function()
|
|||
};
|
||||
return self;
|
||||
}());
|
||||
|
||||
exports.padcookie = padcookie;
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
var padutils = require('/pad_utils').padutils;
|
||||
|
||||
var paddocbar = (function()
|
||||
{
|
||||
|
@ -113,11 +114,14 @@ var paddocbar = (function()
|
|||
self.renderPassword();
|
||||
}
|
||||
|
||||
var pad = undefined;
|
||||
var self = {
|
||||
title: null,
|
||||
password: null,
|
||||
init: function(opts)
|
||||
{
|
||||
pad = require('/pad2').pad; // Sidestep circular dependency (should be injected).
|
||||
|
||||
panels = {
|
||||
impexp: {
|
||||
animator: getPanelOpenCloseAnimator("impexp", 160)
|
||||
|
@ -444,6 +448,8 @@ var paddocbar = (function()
|
|||
},
|
||||
handleResizePage: function()
|
||||
{
|
||||
// Side-step circular reference. This should be injected.
|
||||
var padsavedrevs = require('/pad_savedrevs').padsavedrevs;
|
||||
padsavedrevs.handleResizePage();
|
||||
},
|
||||
hideLaterIfNoOtherInteraction: function()
|
||||
|
@ -456,3 +462,5 @@ var paddocbar = (function()
|
|||
};
|
||||
return self;
|
||||
}());
|
||||
|
||||
exports.paddocbar = paddocbar;
|
||||
|
|
|
@ -20,6 +20,10 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
var padutils = require('/pad_utils').padutils;
|
||||
var padeditor = require('/pad_editor').padeditor;
|
||||
var padsavedrevs = require('/pad_savedrevs').padsavedrevs;
|
||||
|
||||
var padeditbar = (function()
|
||||
{
|
||||
|
||||
|
@ -230,3 +234,5 @@ var padeditbar = (function()
|
|||
};
|
||||
return self;
|
||||
}());
|
||||
|
||||
exports.padeditbar = padeditbar;
|
||||
|
|
|
@ -20,15 +20,23 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
var padcookie = require('/pad_cookie').padcookie;
|
||||
var padutils = require('/pad_utils').padutils;
|
||||
|
||||
var padeditor = (function()
|
||||
{
|
||||
var Ace2Editor = undefined;
|
||||
var pad = undefined;
|
||||
var settings = undefined;
|
||||
var self = {
|
||||
ace: null,
|
||||
// this is accessed directly from other files
|
||||
viewZoom: 100,
|
||||
init: function(readyFunc, initialViewOptions)
|
||||
{
|
||||
Ace2Editor = require('/ace').Ace2Editor;
|
||||
pad = require('/pad2').pad; // Sidestep circular dependency (should be injected).
|
||||
settings = require('/pad2').settings;
|
||||
|
||||
function aceReady()
|
||||
{
|
||||
|
@ -68,7 +76,7 @@ var padeditor = (function()
|
|||
pad.changeViewOption('useMonospaceFont', $("#viewfontmenu").val() == 'monospace');
|
||||
});
|
||||
|
||||
noColors = !noColors; // Inversed so we can pass it to showauthorcolors
|
||||
settings.noColors = !settings.noColors; // Inversed so we can pass it to showauthorcolors
|
||||
},
|
||||
setViewOptions: function(newOptions)
|
||||
{
|
||||
|
@ -93,9 +101,9 @@ var padeditor = (function()
|
|||
self.ace.setProperty("textface", (v ? "monospace" : "Arial, sans-serif"));
|
||||
$("#viewfontmenu").val(v ? "monospace" : "normal");
|
||||
|
||||
self.ace.setProperty("showsauthorcolors", noColors);
|
||||
self.ace.setProperty("showsauthorcolors", settings.noColors);
|
||||
|
||||
self.ace.setProperty("rtlIsTrue", rtlIsTrue);
|
||||
self.ace.setProperty("rtlIsTrue", settings.rtlIsTrue);
|
||||
},
|
||||
initViewZoom: function()
|
||||
{
|
||||
|
@ -150,3 +158,5 @@ var padeditor = (function()
|
|||
};
|
||||
return self;
|
||||
}());
|
||||
|
||||
exports.padeditor = padeditor;
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
var paddocbar = require('/pad_docbar').paddocbar;
|
||||
|
||||
var padimpexp = (function()
|
||||
{
|
||||
|
@ -233,9 +234,16 @@ var padimpexp = (function()
|
|||
}
|
||||
|
||||
/////
|
||||
var pad = undefined;
|
||||
var self = {
|
||||
init: function()
|
||||
{
|
||||
try {
|
||||
pad = require('/pad2').pad; // Sidestep circular dependency (should be injected).
|
||||
} catch (e) {
|
||||
// skip (doesn't require pad when required by timeslider)
|
||||
}
|
||||
|
||||
//get /p/padname
|
||||
var pad_root_path = new RegExp(/.*\/p\/[^\/]+/).exec(document.location.pathname)
|
||||
//get http://example.com/p/padname
|
||||
|
@ -325,3 +333,5 @@ var padimpexp = (function()
|
|||
};
|
||||
return self;
|
||||
}());
|
||||
|
||||
exports.padimpexp = padimpexp;
|
||||
|
|
|
@ -20,6 +20,9 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
var padutils = require('/pad_utils').padutils;
|
||||
var paddocbar = require('/pad_docbar').paddocbar;
|
||||
|
||||
var padmodals = (function()
|
||||
{
|
||||
|
||||
|
@ -70,9 +73,12 @@ var padmodals = (function()
|
|||
clearShareBoxTo();
|
||||
}
|
||||
|
||||
var pad = undefined;
|
||||
var self = {
|
||||
init: function()
|
||||
{
|
||||
pad = require('/pad2').pad; // Sidestep circular dependency (should be injected).
|
||||
|
||||
self.initFeedback();
|
||||
self.initShareBox();
|
||||
},
|
||||
|
@ -364,3 +370,5 @@ var padmodals = (function()
|
|||
};
|
||||
return self;
|
||||
}());
|
||||
|
||||
exports.padmodals = padmodals;
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
var padutils = require('/pad_utils').padutils;
|
||||
var paddocbar = require('/pad_docbar').paddocbar;
|
||||
|
||||
var padsavedrevs = (function()
|
||||
{
|
||||
|
@ -39,7 +41,7 @@ var padsavedrevs = (function()
|
|||
box.find(".srauthor").html("by " + padutils.escapeHtml(revisionInfo.savedBy));
|
||||
var viewLink = '/ep/pad/view/' + pad.getPadId() + '/' + revisionInfo.id;
|
||||
box.find(".srview").attr('href', viewLink);
|
||||
var restoreLink = 'javascript:void padsavedrevs.restoreRevision(' + rnum + ');';
|
||||
var restoreLink = 'javascript:void(require('+JSON.stringify(module.id)+').padsavedrevs.restoreRevision(' + JSON.stringify(rnum) + ');';
|
||||
box.find(".srrestore").attr('href', restoreLink);
|
||||
box.find(".srname").click(function(evt)
|
||||
{
|
||||
|
@ -345,9 +347,11 @@ var padsavedrevs = (function()
|
|||
$(document).unbind('mouseup', clearScrollRepeatTimer);
|
||||
}
|
||||
|
||||
var pad = undefined;
|
||||
var self = {
|
||||
init: function(initialRevisions)
|
||||
{
|
||||
pad = require('/pad2').pad; // Sidestep circular dependency (should be injected).
|
||||
self.newRevisionList(initialRevisions, true);
|
||||
|
||||
$("#savedrevs-savenow").click(function()
|
||||
|
@ -518,3 +522,5 @@ var padsavedrevs = (function()
|
|||
};
|
||||
return self;
|
||||
}());
|
||||
|
||||
exports.padsavedrevs = padsavedrevs;
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
var padutils = require('/pad_utils').padutils;
|
||||
|
||||
var myUserInfo = {};
|
||||
|
||||
var colorPickerOpen = false;
|
||||
|
@ -460,9 +462,12 @@ var paduserlist = (function()
|
|||
return true;
|
||||
}, 1000);
|
||||
|
||||
var pad = undefined;
|
||||
var self = {
|
||||
init: function(myInitialUserInfo)
|
||||
{
|
||||
pad = require('/pad2').pad; // Sidestep circular dependency (should be injected).
|
||||
|
||||
self.setMyUserInfo(myInitialUserInfo);
|
||||
|
||||
$("#otheruserstable tr").remove();
|
||||
|
@ -652,7 +657,7 @@ var paduserlist = (function()
|
|||
if (box.length == 0)
|
||||
{
|
||||
// make guest prompt box
|
||||
box = $('<div id="guestprompt-' + encodedUserId + '" class="guestprompt"><div class="choices"><a href="javascript:void(paduserlist.answerGuestPrompt(\'' + encodedUserId + '\',false))">Deny</a> <a href="javascript:void(paduserlist.answerGuestPrompt(\'' + encodedUserId + '\',true))">Approve</a></div><div class="guestname"><strong>Guest:</strong> ' + padutils.escapeHtml(displayName) + '</div></div>');
|
||||
box = $('<div id="'+padutils.escapeHtml('guestprompt-' + encodedUserId) + '" class="guestprompt"><div class="choices"><a href="' + padutils.escapeHtml('javascript:void(require('+JSON.stringify(module.id)+').paduserlist.answerGuestPrompt(' + JSON.stringify(encodedUserId) + ',false))')+'">Deny</a> <a href="' + padutils.escapeHtml('javascript:void(require('+JSON.stringify(module.id)+').paduserlist.answerGuestPrompt(' + JSON.stringify(encodedUserId) + ',true))') + '">Approve</a></div><div class="guestname"><strong>Guest:</strong> ' + padutils.escapeHtml(displayName) + '</div></div>');
|
||||
$("#guestprompts").append(box);
|
||||
}
|
||||
else
|
||||
|
@ -805,3 +810,5 @@ function showColorPicker()
|
|||
$($("#colorpickerswatches li")[myUserInfo.colorId]).addClass("picked"); //seems weird
|
||||
}
|
||||
}
|
||||
|
||||
exports.paduserlist = paduserlist;
|
||||
|
|
|
@ -34,6 +34,7 @@ var padutils = {
|
|||
},
|
||||
uniqueId: function()
|
||||
{
|
||||
var pad = require('/pad2').pad; // Sidestep circular dependency
|
||||
function encodeNum(n, width)
|
||||
{
|
||||
// returns string that is exactly 'width' chars, padding with zeros
|
||||
|
@ -226,6 +227,7 @@ var padutils = {
|
|||
},
|
||||
timediff: function(d)
|
||||
{
|
||||
var pad = require('/pad2').pad; // Sidestep circular dependency
|
||||
function format(n, word)
|
||||
{
|
||||
n = Math.round(n);
|
||||
|
@ -486,3 +488,5 @@ window.onerror = function test (msg, url, linenumber)
|
|||
|
||||
return false;
|
||||
};
|
||||
|
||||
exports.padutils = padutils;
|
||||
|
|
|
@ -7,7 +7,8 @@
|
|||
plugins = {
|
||||
callHook: function(hookName, args)
|
||||
{
|
||||
var hook = clientVars.hooks[hookName];
|
||||
var global = (function () {return this}());
|
||||
var hook = ((global.clientVars || {}).hooks || {})[hookName];
|
||||
if (hook === undefined) return [];
|
||||
var res = [];
|
||||
for (var i = 0, N = hook.length; i < N; i++)
|
||||
|
@ -30,3 +31,5 @@ plugins = {
|
|||
}).join(sep || "");
|
||||
}
|
||||
};
|
||||
|
||||
exports.plugins = plugins;
|
||||
|
|
|
@ -488,3 +488,5 @@ that is a string.
|
|||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
exports.newSkipList = newSkipList;
|
||||
|
|
|
@ -20,8 +20,10 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
var Changeset = require('/easysync2').Changeset;
|
||||
var extend = require('/ace2_common').extend;
|
||||
|
||||
undoModule = (function()
|
||||
var undoModule = (function()
|
||||
{
|
||||
var stack = (function()
|
||||
{
|
||||
|
@ -329,3 +331,5 @@ undoModule = (function()
|
|||
apool: null
|
||||
}; // apool is filled in by caller
|
||||
})();
|
||||
|
||||
exports.undoModule = undoModule;
|
||||
|
|
|
@ -384,3 +384,5 @@ function makeVirtualLineView(lineNode)
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
exports.makeVirtualLineView = makeVirtualLineView;
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
var clientVars = {};
|
||||
// ]]>
|
||||
</script>
|
||||
<script src="../static/js/require-kernel.js"></script>
|
||||
<script src="../socket.io/socket.io.js"></script>
|
||||
<script src="../minified/pad.js"></script>
|
||||
<link href="../static/custom/pad.css" rel="stylesheet">
|
||||
|
@ -337,5 +338,13 @@
|
|||
<input type="hidden" class="missedChanges" name="missedChanges"/>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
/* TODO: These globals shouldn't exist. */
|
||||
pad = require('/pad2').pad;
|
||||
chat = require('/chat').chat;
|
||||
padeditbar = require('/pad_editbar').padeditbar;
|
||||
padimpexp = require('/pad_impexp').padimpexp;
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
<link rel="stylesheet" href="../../static/css/timeslider.css">
|
||||
<style type="text/css" title="dynamicsyntax"></style>
|
||||
|
||||
<script type="text/javascript" src="../../static/js/require-kernel.js"></script>
|
||||
<script type="text/javascript" src="../../socket.io/socket.io.js"></script>
|
||||
<script type="text/javascript" src="../../minified/timeslider.js"></script>
|
||||
|
||||
|
@ -19,6 +20,10 @@
|
|||
// <![CDATA[
|
||||
var clientVars = {};
|
||||
|
||||
/* TODO: These globals shouldn't exist. */
|
||||
padeditbar = require('/pad_editbar').padeditbar;
|
||||
padimpexp = require('/pad_impexp').padimpexp;
|
||||
|
||||
function createCookie(name,value,days)
|
||||
{
|
||||
if (days) {
|
||||
|
@ -141,9 +146,9 @@
|
|||
clientVars = message.data;
|
||||
|
||||
//load all script that doesn't work without the clientVars
|
||||
loadBroadcastSliderJS();
|
||||
loadBroadcastRevisionsJS();
|
||||
loadBroadcastJS();
|
||||
require('/broadcast_slider').loadBroadcastSliderJS();
|
||||
require('/broadcast_revisions').loadBroadcastRevisionsJS();
|
||||
require('/broadcast').loadBroadcastJS();
|
||||
|
||||
//initialize export ui
|
||||
padimpexp.init();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue