summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn McLear <john@mclear.co.uk>2011-11-24 08:01:23 -0800
committerJohn McLear <john@mclear.co.uk>2011-11-24 08:01:23 -0800
commit89e3778a2c800170ca874ad4a16519b257f8aae7 (patch)
tree98f0160a9d2f09a093ae2975d3b3ec1398aef0a0
parentccaa21a04a46f22dd95aad7b192ac64b09ea198a (diff)
parent7a7b3391fb1abf3cd31a733cbbdcf4fc7b1dd4c2 (diff)
downloadetherpad-lite-89e3778a2c800170ca874ad4a16519b257f8aae7.zip
Merge pull request #228 from alx/readonly-checkbox
add checkbox to limit number of inputs in embed window
-rw-r--r--static/css/pad.css6
-rw-r--r--static/js/pad_editbar.js28
-rw-r--r--static/pad.html13
3 files changed, 27 insertions, 20 deletions
diff --git a/static/css/pad.css b/static/css/pad.css
index 0101e7c1..6be1bf11 100644
--- a/static/css/pad.css
+++ b/static/css/pad.css
@@ -786,11 +786,15 @@ padding: 10px;
border-radius: 6px;
}
+#embedreadonly {
+float:right;
+}
+
#embedcode, #readonlyUrl, #linkcode {
margin-left:10px;
}
-#embedinput, #readonlyInput, #linkinput, #rolinkinput, #roembedinput {
+#embedinput, #readonlyInput, #linkinput {
width:375px;
height:24px;
display:inline;
diff --git a/static/js/pad_editbar.js b/static/js/pad_editbar.js
index f78e33fa..d1a60615 100644
--- a/static/js/pad_editbar.js
+++ b/static/js/pad_editbar.js
@@ -99,16 +99,8 @@ var padeditbar = (function()
self.toogleDropDown("users");
}
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>");
- $('#linkinput').val(padurl);
- var basePath = document.location.href.substring(0, document.location.href.indexOf("/p/"));
- var readonlyLink = basePath + "/ro/" + clientVars.readOnlyId;
- $('#roembedinput').val("<iframe src='" + readonlyLink + "?showControls=true&showChat=true&showLineNumbers=true&useMonospaceFont=false' width=600 height=400>");
- $('#rolinkinput').val(readonlyLink);
- $('#readonlyImage').attr("src","https://chart.googleapis.com/chart?chs=200x200&cht=qr&chld=H|0&chl=" + readonlyLink);
- $('#readonlyInput').val(readonlyLink);
+ {
+ self.setEmbedLinks();
$('#embedinput').focus().select();
self.toogleDropDown("embed");
}
@@ -218,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;
diff --git a/static/pad.html b/static/pad.html
index a8ab0dc5..c32453a5 100644
--- a/static/pad.html
+++ b/static/pad.html
@@ -217,7 +217,10 @@
<!-- the embed code -->
<div id="embed">
- Share editable versions:
+ <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="">
@@ -225,14 +228,6 @@
<div id="embedcode">
Embed code:<input id="embedinput" type="text" value="">
</div>
- <br/><hr><br/>
- Share non-editable versions:(Read only)
- <div id="linkcode">
- Read only Link:<input id="rolinkinput" type="text" value="">
- </div>
- <div id="embedcode">
- Read only Embed code:<input id="roembedinput" type="text" value="">
- </div>
</div>
<div id="chatthrob">