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

This commit is contained in:
Peter 'Pita' Martischka 2011-11-25 16:08:24 -08:00
commit dc6d0cda68
7 changed files with 47 additions and 24 deletions

View File

@ -70,7 +70,7 @@ var functions = {
exports.handle = function(functionName, fields, req, res)
{
//check the api key!
if(fields["apikey"] != apikey)
if(fields["apikey"] != apikey.trim())
{
res.send({code: 4, message: "no or wrong API Key", data: null});
return;

View File

@ -442,19 +442,19 @@ async.waterfall([
io.set('logger', {
debug: function (str)
{
socketIOLogger.debug(str);
socketIOLogger.debug.apply(socketIOLogger, arguments);
},
info: function (str)
{
socketIOLogger.info(str);
socketIOLogger.info.apply(socketIOLogger, arguments);
},
warn: function (str)
{
socketIOLogger.warn(str);
socketIOLogger.warn.apply(socketIOLogger, arguments);
},
error: function (str)
{
socketIOLogger.error(str);
socketIOLogger.error.apply(socketIOLogger, arguments);
},
});

View File

@ -786,11 +786,15 @@ padding: 10px;
border-radius: 6px;
}
#embedcode, #readonlyUrl {
#embedreadonly {
float:right;
}
#embedcode, #readonlyUrl, #linkcode {
margin-left:10px;
}
#embedinput, #readonlyInput{
#embedinput, #readonlyInput, #linkinput {
width:375px;
height:24px;
display:inline;

View File

@ -152,6 +152,10 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument)
{
if (href)
{
if(!~href.indexOf("http")) // if the url doesn't include http or https etc prefix it.
{
href = "http://"+href;
}
extraOpenTags = extraOpenTags + '<a href="' + href.replace(/\"/g, '&quot;') + '">';
extraCloseTags = '</a>' + extraCloseTags;
}

View File

@ -237,7 +237,7 @@ linestylefilter.getRegexpFilter = function(regExp, tag)
linestylefilter.REGEX_WORDCHAR = /[\u0030-\u0039\u0041-\u005A\u0061-\u007A\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF\u0100-\u1FFF\u3040-\u9FFF\uF900-\uFDFF\uFE70-\uFEFE\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFDC]/;
linestylefilter.REGEX_URLCHAR = new RegExp('(' + /[-:@a-zA-Z0-9_.,~%+\/\\?=&#;()$]/.source + '|' + linestylefilter.REGEX_WORDCHAR.source + ')');
linestylefilter.REGEX_URL = new RegExp(/(?:(?:https?|s?ftp|ftps|file|smb|afp|nfs|(x-)?man|gopher|txmt):\/\/|mailto:)/.source + linestylefilter.REGEX_URLCHAR.source + '*(?![:.,;])' + linestylefilter.REGEX_URLCHAR.source, 'g');
linestylefilter.REGEX_URL = new RegExp(/(?:(?:https?|s?ftp|ftps|file|smb|afp|nfs|(x-)?man|gopher|txmt):\/\/|mailto:|www\.)/.source + linestylefilter.REGEX_URLCHAR.source + '*(?![:.,;])' + linestylefilter.REGEX_URLCHAR.source, 'g');
linestylefilter.getURLFilter = linestylefilter.getRegexpFilter(
linestylefilter.REGEX_URL, 'url');

View File

@ -100,10 +100,9 @@ var padeditbar = (function()
}
else if (cmd == 'embed')
{
var padurl = window.location.href.split("?")[0];
$('#embedinput').val("<iframe src='" + padurl + "?showControls=true&showChat=true&showLineNumbers=true&useMonospaceFont=false' width=600 height=400>");
self.toogleDropDown("embed");
self.setEmbedLinks();
$('#embedinput').focus().select();
self.toogleDropDown("embed");
}
else if (cmd == 'import_export')
{
@ -211,6 +210,22 @@ var padeditbar = (function()
{
syncAnimation.done();
}
},
setEmbedLinks: function()
{
if ($('#readonlyinput').is(':checked'))
{
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);
}
else
{
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);
}
}
};
return self;

View File

@ -217,17 +217,17 @@
<!-- the embed code -->
<div id="embed">
<div id="embedcode">
Embed code:<input id="embedinput" type="text" value="">
</div>
</div>
<!-- the embed code -->
<div id="readonly">
<div id="readonlyUrl">
Use this link to share a read-only version of your pad:<input id="readonlyInput" type="text" value="">
<img id="readonlyImage" src="" alt="" style="margin: 10px 90px">
</div>
<div id="embedreadonly">
<input type="checkbox" id="readonlyinput" onClick="padeditbar.setEmbedLinks();"/><label for="readonlyinput">Read only</label>
</div>
Share:
<br/>
<div id="linkcode">
Link:<input id="linkinput" type="text" value="">
</div>
<div id="embedcode">
Embed code:<input id="embedinput" type="text" value="">
</div>
</div>
<div id="chatthrob">