Merge branch 'master' of git://github.com/Pita/etherpad-lite

Conflicts:
	static/index.html
	static/pad.html
This commit is contained in:
Eric Martindale 2011-12-08 18:46:59 +00:00
commit a1b66baa63
59 changed files with 791 additions and 1225 deletions

View file

@ -32,6 +32,23 @@ ul.list-bullet6 { list-style-type: square; }
ul.list-bullet7 { list-style-type: disc; }
ul.list-bullet8 { list-style-type: circle; }
ul.list-indent1 { margin-left: 1.5em; }
ul.list-indent2 { margin-left: 3em; }
ul.list-indent3 { margin-left: 4.5em; }
ul.list-indent4 { margin-left: 6em; }
ul.list-indent5 { margin-left: 7.5em; }
ul.list-indent6 { margin-left: 9em; }
ul.list-indent7 { margin-left: 10.5em; }
ul.list-indent8 { margin-left: 12em; }
ul.list-indent1 { list-style-type: none; }
ul.list-indent2 { list-style-type: none; }
ul.list-indent3 { list-style-type: none; }
ul.list-indent4 { list-style-type: none; }
ul.list-indent5 { list-style-type: none; }
ul.list-indent6 { list-style-type: none; }
ul.list-indent7 { list-style-type: none; }
ul.list-indent8 { list-style-type: none; }
body {
margin: 0;

View file

@ -472,12 +472,10 @@ table#otheruserstable { display: none; }
background: url(../../static/img/connectingbar.gif) no-repeat center 60px;
height: 100px;
}
.modaldialog.cboxreconnecting {
background: #fed;
}
.modaldialog.cboxreconnecting,
.modaldialog.cboxconnecting,
.modaldialog.cboxdisconnected {
background: #fdd;
background: #8FCDE0;
}
.cboxdisconnected #connectionboxinner div { display: none; }
.cboxdisconnected_userdup #connectionboxinner #disconnected_userdup { display: block; }
@ -1146,17 +1144,106 @@ width:33px !important;
color: #999;
}
@media screen and (max-width: 600px) {
#editbar ul li {
padding: 4px 1px;
}
label[for=readonlyinput] {
margin: 0 10px 0 2px;
}
#embedreadonlyqr{
padding-top:20px;
margin-left:100px;
#qr_center {
margin: 10px 10px auto 0;
text-align: center;
}
#qrcode{
margin-left:10px;
}
@media screen and (max-width: 960px) {
.modaldialog {
position: relative;
margin: 0 auto;
width: 80%;
top: 40px;
left: 0;
}
}
@media screen and (max-width: 600px) {
#editbar ul li {
padding: 4px 1px;
}
}
@media only screen and (min-device-width: 320px) and (max-device-width: 600px) {
#editbar ul li {
padding: 4px 3px;
}
#editbar ul#menu_right > li {
padding: 4px 8px;
margin-top: 2px;
}
#chaticon {
opacity: .8;
}
#users {
right: none;
left: 30px;
}
#mycolorpicker {
right: 0;
left: 0 !important;
}
#editorcontainer {
margin-bottom: 33px;
}
#editbar ul#menu_right {
background: #f7f7f7;
background: -moz-linear-gradient(#f7f7f7, #f1f1f1 80%);
background: -ms-linear-gradient(#f7f7f7, #f1f1f1 80%);
background: -o-linear-gradient(#f7f7f7, #f1f1f1 80%);
background: -webkit-linear-gradient(#f7f7f7, #f1f1f1 80%);
width: 100%;
overflow: hidden;
height: 32px;
position: fixed;
bottom: 0;
border-top: 1px solid #ccc;
}
#editbar ul#menu_right li:not(:last-child) {
display: none;
}
#editbar ul#menu_right li:last-child {
height: 24px;
border-radius: 0;
margin-top: 0;
border: 0;
float: right;
}
#chaticon {
bottom: 0;
right: 55px;
border-right: none;
border-radius: 0;
background: #f7f7f7;
background: -moz-linear-gradient(#f7f7f7, #f1f1f1 80%);
background: -ms-linear-gradient(#f7f7f7, #f1f1f1 80%);
background: -o-linear-gradient(#f7f7f7, #f1f1f1 80%);
background: -webkit-linear-gradient(#f7f7f7, #f1f1f1 80%);
border: 0;
}
#chatbox {
bottom: 32px;
right: 0;
border-top-right-radius: 0;
}
#editbar ul li a span {
top: -3px;
}
#usericonback {
margin-top: 4px;
}
#sidediv {
display:none;
}
}

View file

@ -1,6 +1,8 @@
<!doctype html>
<html>
<title>RPG Write</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<style>
*{ margin:0;padding:0; }
body {
@ -13,13 +15,12 @@
background: -ms-radial-gradient(circle,#aaa,#eee 60%) center fixed;
background: -o-radial-gradient(circle,#aaa,#eee 60%) center fixed;
overflow-x: hidden;
border-top: 8px solid rgba(51,51,51,.8)
border-top: 8px solid rgba(51,51,51,.8);
}
#container {
text-shadow: 0 1px 1px #fff;
border-top: 1px solid #999;
margin-top: 160px;
width: 100%;
text-align: center;
padding: 15px;
background: #eee;
@ -28,7 +29,7 @@
background: -ms-linear-gradient(#fff,#ccc);
background: -o-linear-gradient(#fff,#ccc);
opacity: .9;
box-shadow: 0px 1px 8px rgba(0,0,0,0.3)
box-shadow: 0px 1px 8px rgba(0,0,0,0.3);
}
#button {
margin: 0 auto;
@ -45,7 +46,7 @@
background: -moz-linear-gradient(#5F5F5F,#565656 50%,#4C4C4C 51%,#373737);
background: -ms-linear-gradient(#5F5F5F,#565656 50%,#4C4C4C 51%,#373737);
background: -o-linear-gradient(#5F5F5F,#565656 50%,#4C4C4C 51%,#373737);
box-shadow: inset 0 1px 3px rgba(0,0,0,0.9)
box-shadow: inset 0 1px 3px rgba(0,0,0,0.9);
}
#button:hover {
cursor: pointer;
@ -53,21 +54,21 @@
background: -webkit-linear-gradient(#707070,#666666 50%,#5B5B5B 51%,#474747);
background: -moz-linear-gradient(#707070,#666666 50%,#5B5B5B 51%,#474747);
background: -ms-linear-gradient(#707070,#666666 50%,#5B5B5B 51%,#474747);
background: -o-linear-gradient(#707070,#666666 50%,#5B5B5B 51%,#474747)
background: -o-linear-gradient(#707070,#666666 50%,#5B5B5B 51%,#474747);
}
#button:active {
box-shadow: inset 0 1px 12px rgba(0,0,0,0.9);
background: #444
background: #444;
}
#label {
text-align: left;
margin: 0 auto;
width: 300px
width: 300px;
}
input {
vertical-align: middle;
font-weight: bold;
font-size: 15px
font-size: 15px;
}
input[type="text"] {
width: 243px;
@ -76,23 +77,43 @@
border: 1px solid #bbb;
outline: none;
border-radius: 3px;
text-shadow: 0 0 1px #fff
text-shadow: 0 0 1px #fff;
}
input[type="submit"] {
width: 45px;
margin-left: -50px;
padding: 8px
padding: 8px;
}
input[type="submit"]::-moz-focus-inner { border: 0 }
@-moz-document url-prefix() { input[type="submit"] { padding: 7px } }
@-moz-document url-prefix() { input[type="submit"] { padding: 7px } }
@media only screen and (min-device-width: 320px) and (max-device-width: 600px) {
body {
background: #bbb;
background: -webkit-linear-gradient(#aaa,#eee 60%) center fixed;
height: 100%;
}
#container {
margin-top: 0;
text-align: left;
}
#button, #label {
text-align: center;
width: 95%;
}
form {
text-align: center;
}
input[type=text] {
width: 75%;
}
}
</style>
<body onload="document.mainform.padname.focus();">
<link href="static/custom/index.css" rel="stylesheet">
<script src="static/custom/index.js"></script>
<div id="container">
<div id="button" onclick="go2Random()">New Pad</div><br><div id="label">or create/open a Pad with the name</div>
<form action="#" name="mainform" onsubmit="go2Name();return false;">
<input type="text" name="padname" id="padname" autofocus>
<div id="button" onclick="go2Random()" class="translate">New Pad</div><br><div id="label" class="translate">or create/open a Pad with the name</div>
<form action="#" onsubmit="go2Name();return false;">
<input type="text" id="padname" autofocus>
<input type="submit" value="OK">
</form>
</div>
@ -126,3 +147,4 @@
</script>
</body>
</html>
</html>

View file

@ -76,10 +76,13 @@ function isArray(testObject)
if (typeof exports !== "undefined")
{
var navigator = {userAgent: "node-js"};
userAgent = "node-js";
}
else
{
userAgent = navigator.userAgent.toLowerCase();
}
// Figure out what browser is being used (stolen from jquery 1.2.1)
userAgent = navigator.userAgent.toLowerCase();
var browser = {
version: (userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/) || [])[1],
safari: /webkit/.test(userAgent),

View file

@ -3534,7 +3534,8 @@ function OUTER(gscope)
function doIndentOutdent(isOut)
{
if (!(rep.selStart && rep.selEnd))
if (!(rep.selStart && rep.selEnd) ||
((rep.selStart[0] == rep.selEnd[0]) && (rep.selStart[1] == rep.selEnd[1]) && rep.selEnd[1] > 1))
{
return false;
}
@ -3544,25 +3545,25 @@ function OUTER(gscope)
lastLine = Math.max(firstLine, rep.selEnd[0] - ((rep.selEnd[1] == 0) ? 1 : 0));
var mods = [];
var foundLists = false;
for (var n = firstLine; n <= lastLine; n++)
{
var listType = getLineListType(n);
var t = 'indent';
var level = 0;
if (listType)
{
listType = /([a-z]+)([12345678])/.exec(listType);
if (listType)
{
foundLists = true;
var t = listType[1];
var level = Number(listType[2]);
var newLevel = Math.max(1, Math.min(MAX_LIST_LEVEL, level + (isOut ? -1 : 1)));
if (level != newLevel)
{
mods.push([n, t + newLevel]);
}
t = listType[1];
level = Number(listType[2]);
}
}
var newLevel = Math.max(0, Math.min(MAX_LIST_LEVEL, level + (isOut ? -1 : 1)));
if (level != newLevel)
{
mods.push([n, (newLevel > 0) ? t + newLevel : '']);
}
}
if (mods.length > 0)
@ -3570,7 +3571,7 @@ function OUTER(gscope)
setLineListTypes(mods);
}
return foundLists;
return true;
}
editorInfo.ace_doIndentOutdent = doIndentOutdent;
@ -5231,7 +5232,8 @@ function OUTER(gscope)
var allLinesAreList = true;
for (var n = firstLine; n <= lastLine; n++)
{
if (!getLineListType(n))
var listType = getLineListType(n);
if (!listType || listType.slice(0, 'bullet'.length) != 'bullet')
{
allLinesAreList = false;
break;
@ -5241,8 +5243,16 @@ function OUTER(gscope)
var mods = [];
for (var n = firstLine; n <= lastLine; n++)
{
var t = '';
var level = 0;
var listType = /([a-z]+)([12345678])/.exec(getLineListType(n));
if (listType)
{
t = listType[1];
level = Number(listType[2]);
}
var t = getLineListType(n);
mods.push([n, allLinesAreList ? '' : (t ? t : 'bullet1')]);
mods.push([n, allLinesAreList ? 'indent' + level : (t ? 'bullet' + level : 'bullet1')]);
}
setLineListTypes(mods);
}
@ -5647,31 +5657,17 @@ function OUTER(gscope)
{
var newNumLines = rep.lines.length();
if (newNumLines < 1) newNumLines = 1;
if (newNumLines != lineNumbersShown)
{
var container = sideDivInner;
var odoc = outerWin.document;
while (lineNumbersShown < newNumLines)
{
lineNumbersShown++;
var n = lineNumbersShown;
var div = odoc.createElement("DIV");
div.appendChild(odoc.createTextNode(String(n)));
container.appendChild(div);
}
while (lineNumbersShown > newNumLines)
{
container.removeChild(container.lastChild);
lineNumbersShown--;
}
}
//update height of all current line numbers
if (currentCallStack && currentCallStack.domClean)
{
var a = sideDivInner.firstChild;
var b = doc.body.firstChild;
var n = 0;
while (a && b)
{
if(n > lineNumbersShown) //all updated, break
break;
var h = (b.clientHeight || b.offsetHeight);
if (b.nextSibling)
{
@ -5685,10 +5681,42 @@ function OUTER(gscope)
if (h)
{
var hpx = h + "px";
if (a.style.height != hpx) a.style.height = hpx;
if (a.style.height != hpx) {
a.style.height = hpx;
}
}
a = a.nextSibling;
b = b.nextSibling;
n++;
}
}
if (newNumLines != lineNumbersShown)
{
var container = sideDivInner;
var odoc = outerWin.document;
var fragment = odoc.createDocumentFragment();
while (lineNumbersShown < newNumLines)
{
lineNumbersShown++;
var n = lineNumbersShown;
var div = odoc.createElement("DIV");
//calculate height for new line number
var h = (b.clientHeight || b.offsetHeight);
if (b.nextSibling)
h = b.nextSibling.offsetTop - b.offsetTop;
if(h) // apply style to div
div.style.height = h +"px";
div.appendChild(odoc.createTextNode(String(n)));
fragment.appendChild(div);
b = b.nextSibling;
}
container.appendChild(fragment);
while (lineNumbersShown > newNumLines)
{
container.removeChild(container.lastChild);
lineNumbersShown--;
}
}
}

View file

@ -16,6 +16,10 @@
var chat = (function()
{
var ua = navigator.userAgent.toLowerCase();
var isAndroid = ua.indexOf("android") > -1;
var isMobileSafari = ua.indexOf("mobile") > -1;
var bottomMargin = "0px";
var chatMentions = 0;
var title = document.title;
var self = {
@ -31,6 +35,8 @@ var chat = (function()
$("#chatbox").resizable(
{
handles: 'nw',
minHeight: 40,
minWidth: 80,
start: function (event, ui)
{
$("#focusprotector").show();
@ -39,7 +45,10 @@ var chat = (function()
{
$("#focusprotector").hide();
$("#chatbox").css({right: "20px", bottom: "0px", left: "", top: ""});
if(isAndroid || isMobileSafari)
bottommargin = "32px";
$("#chatbox").css({right: "20px", bottom: bottomMargin, left: "", top: ""});
self.scrollDown();
}
@ -51,10 +60,14 @@ var chat = (function()
hide: function ()
{
$("#chatcounter").text("0");
$("#chatbox").hide("slide", { direction: "down" }, 750, function()
if(isAndroid || isMobileSafari) {
$("#chatbox").toggle();
}
else
{
$("#chaticon").show("slide", { direction: "down" }, 500);
});
$("#chatbox").toggle("slide", { direction: "down" }, 625);
}
},
scrollDown: function()
{
@ -153,4 +166,4 @@ var chat = (function()
}
return self;
}());
}());

View file

@ -473,7 +473,7 @@ function makeContentCollector(collectStyles, browser, apool, domInterface, class
if (tname == "ul")
{
var type;
var rr = cls && /(?:^| )list-(bullet[12345678])\b/.exec(cls);
var rr = cls && /(?:^| )list-([a-z]+[12345678])\b/.exec(cls);
type = rr && rr[1] || "bullet" + String(Math.min(_MAX_LIST_LEVEL, (state.listNesting || 0) + 1));
oldListTypeOrNull = (_enterList(state, type) || 'none');
}

View file

@ -21,6 +21,7 @@ var LineNumbersDisabled = false;
var noColors = false;
var useMonospaceFontGlobal = false;
var globalUserName = false;
var hideQRCode = false;
$(document).ready(function()
{
@ -86,12 +87,14 @@ function getParams()
var showLineNumbers = params["showLineNumbers"];
var useMonospaceFont = params["useMonospaceFont"];
var IsnoColors = params["noColors"];
var hideQRCode = params["hideQRCode"];
if(IsnoColors)
{
if(IsnoColors == "true")
{
noColors = true;
$('#clearAuthorship').hide();
}
}
if(showControls)
@ -102,7 +105,6 @@ function getParams()
$('#editorcontainer').css({"top":"0px"});
}
}
if(showChat)
{
if(showChat == "false")
@ -110,7 +112,6 @@ function getParams()
$('#chaticon').hide();
}
}
if(showLineNumbers)
{
if(showLineNumbers == "false")
@ -118,7 +119,6 @@ function getParams()
LineNumbersDisabled = true;
}
}
if(useMonospaceFont)
{
if(useMonospaceFont == "true")
@ -126,13 +126,15 @@ function getParams()
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);
}
if(hideQRCode)
{
$('#qrcode').hide();
}
}
function getUrlVars()
@ -174,7 +176,7 @@ function handshake()
function sendClientReady(isReconnect)
{
var padId = document.location.pathname.substring(document.location.pathname.lastIndexOf("/") + 1);
padId = unescape(padId); // unescape neccesary due to Safari and Opera interpretation of spaces
padId = decodeURIComponent(padId); // unescape neccesary due to Safari and Opera interpretation of spaces
if(!isReconnect)
document.title = document.title + " | " + padId;

View file

@ -206,15 +206,14 @@ var padeditbar = (function()
{
if ($('#readonlyinput').is(':checked'))
{
$('#qrcode').show();
var basePath = document.location.href.substring(0, document.location.href.indexOf("/p/"));
var readonlyLink = basePath + "/ro/" + clientVars.readOnlyId;
$('#embedinput').val("<iframe 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=H|0&chl=" + readonlyLink);
}
else
{
$('#qrcode').hide();
var padurl = window.location.href.split("?")[0];
$('#embedinput').val("<iframe src='" + padurl + "?showControls=true&showChat=true&showLineNumbers=true&useMonospaceFont=false' width=600 height=400>");
$('#linkinput').val(padurl);

View file

@ -711,7 +711,14 @@ var paduserlist = (function()
}
$("#myswatch").css({'background-color': myUserInfo.colorId});
$("#usericon").css({'box-shadow': 'inset 0 0 30px ' + myUserInfo.colorId});
if ($.browser.msie && parseInt($.browser.version) <= 8) {
$("#usericon").css({'box-shadow': 'inset 0 0 30px ' + myUserInfo.colorId,'background-color': myUserInfo.colorId});
}
else
{
$("#usericon").css({'box-shadow': 'inset 0 0 30px ' + myUserInfo.colorId});
}
}
};
return self;

View file

@ -4,6 +4,7 @@
<meta charset="utf-8">
<meta name="robots" content="noindex, nofollow">
<title>RPG Write</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<!-- CSS -->
<link href="../static/css/pad.css" rel="stylesheet">
<!-- javascript -->
@ -50,14 +51,14 @@
</a>
</li>
<li onClick="window.pad&&pad.editbarClick('indent');return false;" >
<a title="Indent List">
<a title="Indent">
<div class="buttonicon" style="background-position:0px -52px"></div>
</a>
</li>
<li onClick="window.pad&&pad.editbarClick('outdent');return false;" >
<a title="Unindent List">
<a title="Unindent">
<div class="buttonicon" style="background-position:0px -134px"></div>
</a>
</a>
</li>
<li class="separator"></li>
<li onClick="window.pad&&pad.editbarClick('undo');return false;" >
@ -71,7 +72,7 @@
</a>
</li>
<li class="separator"></li>
<li onClick="window.pad&&pad.editbarClick('clearauthorship');return false;" >
<li id="clearAuthorship" onClick="window.pad&&pad.editbarClick('clearauthorship');return false;" >
<a title="Clear Authorship Colors">
<div class="buttonicon" style="background-position:0px -86px"></div>
</a>
@ -86,7 +87,7 @@
</a>
</li>
<li onClick="window.pad&&pad.editbarClick('embed');return false;" >
<a id="embedlink" title="Embed this pad">
<a id="embedlink" title="Share and Embed this pad">
<div class="buttonicon" style="background-position:0px -18px"></div>
</a>
</li>
@ -225,7 +226,7 @@
</div><br/>
<div id="qrcode">
<label for="embedreadonlyqr">QR code:</label><br/>
<img id="embedreadonlyqr">
<div id="qr_center"><img id="embedreadonlyqr"></div>
</div>
</div>

View file

@ -62,7 +62,7 @@
//get the padId out of the url
var urlParts= document.location.pathname.split("/");
padId = urlParts[urlParts.length-2];
padId = decodeURIComponent(urlParts[urlParts.length-2]);
//set the title
document.title = document.title + " | " + padId;
@ -271,7 +271,11 @@
<!-- termporary place holder-->
<a id = "returnbutton">Return to pad</a>
<script>
$("#returnbutton").attr("href", document.referrer);
if(document.referrer.length > 0 && document.referrer.substring(document.referrer.lastIndexOf("/")-1,document.referrer.lastIndexOf("/")) === "p") {
$("#returnbutton").attr("href", document.referrer);
} else {
$("#returnbutton").attr("href", document.location.href.substring(0,document.location.href.lastIndexOf("/")));
}
</script>
</div>