Skip to content
This repository was archived by the owner on Jun 23, 2018. It is now read-only.
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
implements header/footer hiding for embedding purposes
  • Loading branch information
Joel McCracken committed Dec 14, 2014
commit d6d2c4ffde70c9b67b788f14b258cf0891a1383c
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ <h2 class="content-title">About Us</h2>
</ul>
<input id="save-box-link" type="text" value="" />
<textarea id="save-box-embed"></textarea>
<a href="#" id="save-box-embed-test">View embed on test page.</a>
<a href="#" target="_blank" id="save-box-embed-test">View embed on test page.</a>
<label>Download:</label>
<ul class="downloads">
<li><a class="editor" href="#">Editor content</a></li>
Expand Down
8 changes: 7 additions & 1 deletion src/dom.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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'
Expand Down Expand Up @@ -254,7 +259,8 @@ $.extend REPLIT,
# Calculate container height and width.
documentWidth = document.documentElement.clientWidth
documentHeight = document.documentElement.clientHeight
height = documentHeight - HEADER_HEIGHT - FOOTER_HEIGHT
height = documentHeight
height -= (HEADER_HEIGHT + FOOTER_HEIGHT) unless isEmbed()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use if instead of unless? (it's pretty unnatural way to read code, imo)

width = documentWidth - @content_padding
innerWidth = width - 2 * RESIZER_WIDTH

Expand Down