Merge branch 'master' of ../etherpad-lite.devmaster

This commit is contained in:
Peter 'Pita' Martischka 2011-08-15 16:01:30 +01:00
commit e24b8ac93a
7 changed files with 72 additions and 5 deletions

View File

@ -211,6 +211,7 @@ async.waterfall([
return; return;
} }
res.header("Access-Control-Allow-Origin", "*");
res.header("Server", serverName); res.header("Server", serverName);
exportHandler.doExport(req, res, req.params.pad, req.params.type); exportHandler.doExport(req, res, req.params.pad, req.params.type);
}); });

View File

@ -1086,3 +1086,11 @@ width:27px !important;
opacity:0.01; opacity:0.01;
display:none; display:none;
} }
#showhistorylabel{
position:absolute;
left:58px;
top:4px;
cursor: hand;
cursor: pointer;
}

View File

@ -194,3 +194,29 @@ float:right;
padding-right: 6pt; padding-right: 6pt;
} }
padding: 0;
margin: 0;
}
ul { margin-left: 1.5em; }
ul ul { margin-left: 0 !important; }
ul.list-bullet1 { margin-left: 1.5em; }
ul.list-bullet2 { margin-left: 3em; }
ul.list-bullet3 { margin-left: 4.5em; }
ul.list-bullet4 { margin-left: 6em; }
ul.list-bullet5 { margin-left: 7.5em; }
ul.list-bullet6 { margin-left: 9em; }
ul.list-bullet7 { margin-left: 10.5em; }
ul.list-bullet8 { margin-left: 12em; }
ul { list-style-type: disc; }
ul.list-bullet1 { list-style-type: disc; }
ul.list-bullet2 { list-style-type: circle; }
ul.list-bullet3 { list-style-type: square; }
ul.list-bullet4 { list-style-type: disc; }
ul.list-bullet5 { list-style-type: circle; }
ul.list-bullet6 { list-style-type: square; }
ul.list-bullet7 { list-style-type: disc; }
ul.list-bullet8 { list-style-type: circle; }

View File

@ -248,6 +248,8 @@ function Ace2Editor()
// these lines must conform to a specific format because they are passed by the build script: // these lines must conform to a specific format because they are passed by the build script:
iframeHTML.push($$INCLUDE_CSS_Q("../static/css/iframe_editor.css")); iframeHTML.push($$INCLUDE_CSS_Q("../static/css/iframe_editor.css"));
iframeHTML.push($$INCLUDE_CSS_Q("../static/css/pad.css"));
iframeHTML.push($$INCLUDE_CSS_Q("../static/custom/pad.css"));
iframeHTML.push($$INCLUDE_JS_Q("../static/js/ace2_common.js")); iframeHTML.push($$INCLUDE_JS_Q("../static/js/ace2_common.js"));
iframeHTML.push($$INCLUDE_JS_Q("../static/js/skiplist.js")); iframeHTML.push($$INCLUDE_JS_Q("../static/js/skiplist.js"));
iframeHTML.push($$INCLUDE_JS_Q("../static/js/virtual_lines.js")); iframeHTML.push($$INCLUDE_JS_Q("../static/js/virtual_lines.js"));
@ -267,7 +269,7 @@ function 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 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 = (' + iframeHTML.join('+') + ').replace(/\\\\x3c/g, \'<\');doc.write(text); doc.close(); ' + '}, 0); }'; '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 = (' + iframeHTML.join('+') + ').replace(/\\\\x3c/g, \'<\');doc.write(text); doc.close(); ' + '}, 0); }';
var outerHTML = [doctype, '<html><head>', $$INCLUDE_CSS("../static/css/iframe_editor.css"), var outerHTML = [doctype, '<html><head>', $$INCLUDE_CSS("../static/css/iframe_editor.css"), $$INCLUDE_CSS("../static/css/pad.css"), $$INCLUDE_CSS("../static/custom/pad.css"),
// bizarrely, in FF2, a file with no "external" dependencies won't finish loading properly // bizarrely, in FF2, a file with no "external" dependencies won't finish loading properly
// (throbs busy while typing) // (throbs busy while typing)
'<link rel="stylesheet" type="text/css" href="data:text/css,"/>', '\x3cscript>\n', outerScript, '\n\x3c/script>', '</head><body id="outerdocbody"><div id="sidediv"><!-- --></div><div id="linemetricsdiv">x</div><div id="overlaysdiv"><!-- --></div></body></html>']; '<link rel="stylesheet" type="text/css" href="data:text/css,"/>', '\x3cscript>\n', outerScript, '\n\x3c/script>', '</head><body id="outerdocbody"><div id="sidediv"><!-- --></div><div id="linemetricsdiv">x</div><div id="overlaysdiv"><!-- --></div></body></html>'];

View File

@ -28,6 +28,13 @@ var chat = (function()
}); });
}); });
}, },
showHistory: function()
{
// this is a placeholder for the showHistory function
// load the messages from the server
// append them to the UI using addMessage
self.scrollDown(); // scroll down to the bottom of the chat
},
hide: function () hide: function ()
{ {
$("#chatcounter").text("0"); $("#chatcounter").text("0");

View File

@ -18,6 +18,7 @@
var socket; var socket;
var LineNumbersDisabled = false; var LineNumbersDisabled = false;
var useMonospaceFontGlobal = false;
var globalUserName = false; var globalUserName = false;
$(document).ready(function() $(document).ready(function()
@ -77,6 +78,7 @@ function getParams()
var showChat = getUrlVars()["showChat"]; var showChat = getUrlVars()["showChat"];
var userName = getUrlVars()["userName"]; var userName = getUrlVars()["userName"];
var showLineNumbers = getUrlVars()["showLineNumbers"]; var showLineNumbers = getUrlVars()["showLineNumbers"];
var useMonospaceFont = getUrlVars()["useMonospaceFont"];
if(showControls) if(showControls)
{ {
if(showControls == "false") if(showControls == "false")
@ -102,6 +104,15 @@ function getParams()
} }
} }
if(useMonospaceFont)
{
if(useMonospaceFont == "true")
{
useMonospaceFontGlobal = true;
}
}
if(userName) 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. // If the username is set as a parameter we should set a global value that we can call once we have initiated the pad.
@ -139,6 +150,8 @@ function handshake()
socket.once('connect', function() socket.once('connect', function()
{ {
var padId = document.location.pathname.substring(document.location.pathname.lastIndexOf("/") + 1); var padId = document.location.pathname.substring(document.location.pathname.lastIndexOf("/") + 1);
padId = unescape(padId); // unescape neccesary due to Safari and Opera interpretation of spaces
document.title = document.title + " | " + padId; document.title = document.title + " | " + padId;
var token = readCookie("token"); var token = readCookie("token");
@ -147,7 +160,7 @@ function handshake()
token = randomString(); token = randomString();
createCookie("token", token, 60); createCookie("token", token, 60);
} }
var msg = { var msg = {
"component": "pad", "component": "pad",
"type": "CLIENT_READY", "type": "CLIENT_READY",
@ -183,6 +196,12 @@ function handshake()
pad.changeViewOption('showLineNumbers', false); pad.changeViewOption('showLineNumbers', false);
} }
// If the Monospacefont value is set to true then change it to monospace.
if (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 the globalUserName value is set we need to tell the server and the client about the new authorname
if (globalUserName !== false) if (globalUserName !== false)
{ {
@ -403,7 +422,8 @@ var pad = {
}; };
options.view[key] = value; options.view[key] = value;
pad.handleOptionsChange(options); pad.handleOptionsChange(options);
if (key != "showLineNumbers") // if the request isn't to hide line numbers then broadcast this to other users
if (key != "showLineNumbers" && key != "useMonospaceFont")
{ {
pad.collabClient.sendClientMessage( pad.collabClient.sendClientMessage(
{ {

View File

@ -249,14 +249,17 @@ Use this link to share a read-only version of your pad:<input id="readonlyInput"
<div id="chaticon"> <div id="chaticon">
<a onClick="chat.show();return false;" <a onClick="chat.show();return false;"
title="Open the chat for this pad"> title="Open the chat for this pad">
<span id="chatlabel">Chat</span> <span id="chatlabel">Chat</span>
<div class="buttonicon" style="background-position:0px -102px;display:inline-block;"></div> <div class="buttonicon" style="background-position:0px -102px;display:inline-block;"></div>
</a> </a>
<span id="chatcounter">0</span> <span id="chatcounter">0</span>
</div> </div>
<div id="chatbox"> <div id="chatbox">
<div id="titlebar"><span id ="titlelabel">Chat</span><a id="titlecross" onClick="chat.hide();return false;">-&nbsp;</a></div> <div id="titlebar"><span id="titlelabel">Chat |</span>
<a id="showhistorylabel" onClick="chat.showHistory();return false;">Show History</a>
<a id="titlecross" onClick="chat.hide();return false;">-&nbsp;</a>
</div>
<div id="chattext" class="authorColors"></div> <div id="chattext" class="authorColors"></div>
<div id="chatinputbox"> <div id="chatinputbox">
<form> <form>