Skip to content
This repository was archived by the owner on Jun 23, 2018. It is now read-only.
Open
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
9 changes: 8 additions & 1 deletion repl.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@ if script_element?
BASE_PATH = script_element.src.split('/')[...-1].join '/'
SANDBOX_SRC = "#{BASE_PATH}/sandbox.html"
else
throw new Error 'JSREPL script element cannot be found. Make sure you have the ID "jsrepl-script" on it.'
elements = document.getElementsByTagName 'script'
for script_element in elements
if script_element.src.match /^(.*)\/jsrepl(\-\w+)?\.js(\?|$)/ isnt null
BASE_PATH = script_element.src.split('/')[...-1].join '/'
SANDBOX_SRC = "#{BASE_PATH}/sandbox.html"
break
if BASE_PATH?
Copy link
Contributor

Choose a reason for hiding this comment

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

is that supposed to be not BASE_PATH??

Copy link
Author

Choose a reason for hiding this comment

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

Yes, it is.

throw new Error 'JSREPL script element cannot be found. Make sure you have the ID "jsrepl-script" on it.'

class Loader
constructor: ->
Expand Down