Commit 8419426e authored by Sean Roberts's avatar Sean Roberts

Cleaning up: moving constructor to be first function in Guest class and...

Cleaning up: moving constructor to be first function in Guest class and removing unused wrapper html field
parent 4efa180a
......@@ -54,26 +54,12 @@ module.exports = class Guest extends Delegator
html:
adder: '<hypothesis-adder></hypothesis-adder>'
wrapper: '<div class="annotator-wrapper"></div>'
addPlugin: (name, options) ->
if @plugins[name]
console.error("You cannot have more than one instance of any plugin.")
else
klass = @options.pluginClasses[name]
if typeof klass is 'function'
@plugins[name] = new klass(@element[0], options)
@plugins[name].annotator = this
@plugins[name].pluginInit?()
else
console.error("Could not load " + name + " plugin. Have you included the appropriate <script> tag?")
this # allow chaining
constructor: (element, options) ->
super
this.adder = $(this.html.adder).appendTo(@element).hide()
self = this
this.adderCtrl = new adder.Adder(@adder[0], {
onAnnotate: ->
......@@ -112,6 +98,19 @@ module.exports = class Guest extends Delegator
if not @plugins[name] and @options.pluginClasses[name]
this.addPlugin(name, opts)
addPlugin: (name, options) ->
if @plugins[name]
console.error("You cannot have more than one instance of any plugin.")
else
klass = @options.pluginClasses[name]
if typeof klass is 'function'
@plugins[name] = new klass(@element[0], options)
@plugins[name].annotator = this
@plugins[name].pluginInit?()
else
console.error("Could not load " + name + " plugin. Have you included the appropriate <script> tag?")
this # allow chaining
# Get the document info
getDocumentInfo: ->
if @plugins.PDF?
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment