diff --git a/css/style.css b/css/style.css
index 557cd2a..d213816 100644
--- a/css/style.css
+++ b/css/style.css
@@ -247,7 +247,7 @@ and (max-device-width : 480px) {
background: #FFF;
width: 591px;
position: absolute;
- height: 100%;
+ height: 100%;
left: 0px;
bottom: 0;
}
@@ -1092,7 +1092,7 @@ and (max-device-width : 480px) {
/* Save */
#save-box {
- height: 85px;
+ height: 150px;
width: 181px;
border: 1px #ccc solid;
position: absolute;
@@ -1161,6 +1161,13 @@ and (max-device-width : 480px) {
color: #666;
}
+#save-box textarea {
+ border: 1px #ccc solid;
+ padding: 2px;
+ width: 180px;
+ color: #666;
+}
+
#save-box .downloads li {
margin-top: -4px;
}
@@ -1171,6 +1178,12 @@ and (max-device-width : 480px) {
font-size: 75%;
}
+#save-box a {
+ color: #0E157F;
+ text-decoration: none;
+ font-size: 75%;
+}
+
.tooltip {
position: absolute;
z-index: 1020;
diff --git a/embed-preview.html b/embed-preview.html
new file mode 100644
index 0000000..b640f46
--- /dev/null
+++ b/embed-preview.html
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/index.html b/index.html
index 66dc629..a52ba2f 100644
--- a/index.html
+++ b/index.html
@@ -288,6 +288,9 @@ About Us
+
+
+ View embed on test page.
- Editor content
diff --git a/server.js b/server.js
index 8f24c6e..d0405f4 100755
--- a/server.js
+++ b/server.js
@@ -73,6 +73,7 @@ var httpCb = function (req, res) {
if(inMemorySaved[uriFirstPiece]) {
restoreFakeSession(uriFirstPiece, res);
+ return;
}
var filename = path.join(process.cwd(), uri);;
diff --git a/src/dom.coffee b/src/dom.coffee
index 77f0476..d62bf53 100644
--- a/src/dom.coffee
+++ b/src/dom.coffee
@@ -38,6 +38,8 @@ $.fn.enableSelection = ->
'user-select': ''
$this.each -> this.onselectstart = null
+isEmbed = ->
+ window.location.search == "?embed=true"
$.extend REPLIT,
RESIZER_WIDTH: RESIZER_WIDTH
@@ -52,6 +54,9 @@ $.extend REPLIT,
last_progress_ratio: 0
# Initialize the DOM (Runs before JSRPEL's load)
InitDOM: ->
+ if isEmbed()
+ $("#header").hide()
+ $("#footer").hide()
@$doc_elem = $ 'html'
# The main container holding the pages.
@$container = $ '#main'
@@ -254,7 +259,9 @@ $.extend REPLIT,
# Calculate container height and width.
documentWidth = document.documentElement.clientWidth
documentHeight = document.documentElement.clientHeight
- height = documentHeight - HEADER_HEIGHT - FOOTER_HEIGHT
+ height = documentHeight
+ if !isEmbed()
+ height -= (HEADER_HEIGHT + FOOTER_HEIGHT)
width = documentWidth - @content_padding
innerWidth = width - 2 * RESIZER_WIDTH
diff --git a/src/session.coffee b/src/session.coffee
index f802be8..7fc5893 100644
--- a/src/session.coffee
+++ b/src/session.coffee
@@ -165,6 +165,13 @@ $ ->
$savebox.find('li.facebook a').replaceWith SHARE_TEMPLATE.facebook()
$savebox.find('li.gplus a').replaceWith SHARE_TEMPLATE.gplus()
$savebox.find('input').val window.location.href
+ iframe_val = """
+
+ """
+ $savebox.find('textarea').val iframe_val
+
+ preview_link = "/embed-preview.html?embedded=#{encodeURIComponent(iframe_val)}"
+ $savebox.find('#save-box-embed-test').attr('href', preview_link)
$savebox.find('.downloads a.editor').attr 'href', "/download/editor/#{session_id}/#{revision_id}/"
$savebox.find('.downloads a.repl').attr 'href', "/download/repl/#{session_id}/#{revision_id}/"
$savebox.slideDown()
@@ -183,6 +190,7 @@ $ ->
bindSaveButton()
$('#save-box input').click -> $(this).select()
+ $('#save-box textarea').click -> $(this).select()
# When any command is evaled, save it in the eval_history array of the session
# object, in order to send it to the server on save.
REPLIT.$this.bind 'eval', (e, command) ->