Merge pull request #228 from alx/readonly-checkbox
add checkbox to limit number of inputs in embed window
This commit is contained in:
commit
89e3778a2c
|
@ -786,11 +786,15 @@ padding: 10px;
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#embedreadonly {
|
||||||
|
float:right;
|
||||||
|
}
|
||||||
|
|
||||||
#embedcode, #readonlyUrl, #linkcode {
|
#embedcode, #readonlyUrl, #linkcode {
|
||||||
margin-left:10px;
|
margin-left:10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#embedinput, #readonlyInput, #linkinput, #rolinkinput, #roembedinput {
|
#embedinput, #readonlyInput, #linkinput {
|
||||||
width:375px;
|
width:375px;
|
||||||
height:24px;
|
height:24px;
|
||||||
display:inline;
|
display:inline;
|
||||||
|
|
|
@ -99,16 +99,8 @@ var padeditbar = (function()
|
||||||
self.toogleDropDown("users");
|
self.toogleDropDown("users");
|
||||||
}
|
}
|
||||||
else if (cmd == 'embed')
|
else if (cmd == 'embed')
|
||||||
{
|
{
|
||||||
var padurl = window.location.href.split("?")[0];
|
self.setEmbedLinks();
|
||||||
$('#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);
|
|
||||||
$('#embedinput').focus().select();
|
$('#embedinput').focus().select();
|
||||||
self.toogleDropDown("embed");
|
self.toogleDropDown("embed");
|
||||||
}
|
}
|
||||||
|
@ -218,6 +210,22 @@ var padeditbar = (function()
|
||||||
{
|
{
|
||||||
syncAnimation.done();
|
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;
|
return self;
|
||||||
|
|
|
@ -217,7 +217,10 @@
|
||||||
|
|
||||||
<!-- the embed code -->
|
<!-- the embed code -->
|
||||||
<div id="embed">
|
<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/>
|
<br/>
|
||||||
<div id="linkcode">
|
<div id="linkcode">
|
||||||
Link:<input id="linkinput" type="text" value="">
|
Link:<input id="linkinput" type="text" value="">
|
||||||
|
@ -225,14 +228,6 @@
|
||||||
<div id="embedcode">
|
<div id="embedcode">
|
||||||
Embed code:<input id="embedinput" type="text" value="">
|
Embed code:<input id="embedinput" type="text" value="">
|
||||||
</div>
|
</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>
|
||||||
|
|
||||||
<div id="chatthrob">
|
<div id="chatthrob">
|
||||||
|
|
Loading…
Reference in New Issue