Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add checkbox to limit number of inputs in embed window #228

Merged
merged 1 commit into from
Nov 24, 2011
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion static/css/pad.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
28 changes: 18 additions & 10 deletions static/js/pad_editbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down Expand Up @@ -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;
Expand Down
13 changes: 4 additions & 9 deletions static/pad.html
Original file line number Diff line number Diff line change
Expand Up @@ -217,22 +217,17 @@

<!-- 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="">
</div>
<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">
Expand Down