Commit cc34a02d authored by Nick Stenning's avatar Nick Stenning

Merge pull request #1596 from hypothesis/remove-console-log

Remove console.log statements from within the app
parents 660bf572 05be24c4
...@@ -134,7 +134,6 @@ class AppController ...@@ -134,7 +134,6 @@ class AppController
, slots * 500 , slots * 500
_sock.onmessage = (msg) -> _sock.onmessage = (msg) ->
#console.log msg
unless msg.data.type? and msg.data.type is 'annotation-notification' unless msg.data.type? and msg.data.type is 'annotation-notification'
return return
data = msg.data.payload data = msg.data.payload
......
...@@ -57,7 +57,6 @@ class Annotator.Guest extends Annotator ...@@ -57,7 +57,6 @@ class Annotator.Guest extends Annotator
origin: origin origin: origin
scope: "#{scope}:provider" scope: "#{scope}:provider"
onReady: => onReady: =>
console.log "Guest functions are ready for #{origin}"
setTimeout => setTimeout =>
event = document.createEvent "UIEvents" event = document.createEvent "UIEvents"
event.initUIEvent "annotatorReady", false, false, window, 0 event.initUIEvent "annotatorReady", false, false, window, 0
...@@ -101,7 +100,6 @@ class Annotator.Guest extends Annotator ...@@ -101,7 +100,6 @@ class Annotator.Guest extends Annotator
pages = Object.keys(hls).map (s) -> parseInt s pages = Object.keys(hls).map (s) -> parseInt s
# Do we have any highlights left? # Do we have any highlights left?
if pages.length if pages.length
console.log "We still have something left"
firstPage = pages.sort()[0] # Determine the first page firstPage = pages.sort()[0] # Determine the first page
firstHl = hls[firstPage] # Determine the first (topmost) hl firstHl = hls[firstPage] # Determine the first (topmost) hl
# Store the position of this anchor inside target # Store the position of this anchor inside target
...@@ -109,7 +107,6 @@ class Annotator.Guest extends Annotator ...@@ -109,7 +107,6 @@ class Annotator.Guest extends Annotator
top: highlight.getTop() top: highlight.getTop()
heigth: highlight.getHeight() heigth: highlight.getHeight()
else else
console.log "No pos left"
delete highlight.anchor.target.pos delete highlight.anchor.target.pos
# Announce the new positions, so that the sidebar knows # Announce the new positions, so that the sidebar knows
...@@ -169,13 +166,10 @@ class Annotator.Guest extends Annotator ...@@ -169,13 +166,10 @@ class Annotator.Guest extends Annotator
.bind('getDocumentInfo', (trans) => .bind('getDocumentInfo', (trans) =>
(@plugins.PDF?.getMetaData() ? Promise.reject()) (@plugins.PDF?.getMetaData() ? Promise.reject())
.then (md) => .then (md) =>
# console.log "Returning PDF metadata", md
trans.complete trans.complete
uri: @getHref() uri: @getHref()
metadata: md metadata: md
.catch (problem) => .catch (problem) =>
# console.log "Returning standard metadata, because"
# console.log problem.stack ? problem
trans.complete trans.complete
uri: @getHref() uri: @getHref()
metadata: @plugins.Document?.metadata metadata: @plugins.Document?.metadata
......
...@@ -111,8 +111,6 @@ class Annotator.Plugin.Bridge extends Annotator.Plugin ...@@ -111,8 +111,6 @@ class Annotator.Plugin.Bridge extends Annotator.Plugin
(options.origin.match /^resource:\/\//) (options.origin.match /^resource:\/\//)
options.origin = '*' options.origin = '*'
console.log "Bridge plugin connecting to #{options.origin}"
# options.debugOutput = true
channel = Channel.build(options) channel = Channel.build(options)
## Remote method call bindings ## Remote method call bindings
...@@ -165,7 +163,6 @@ class Annotator.Plugin.Bridge extends Annotator.Plugin ...@@ -165,7 +163,6 @@ class Annotator.Plugin.Bridge extends Annotator.Plugin
while queue.length while queue.length
parent = queue.shift() parent = queue.shift()
if parent isnt window if parent isnt window
console.log window.location.toString(), 'sending beacon...'
parent.postMessage '__annotator_dhcp_discovery', @options.origin parent.postMessage '__annotator_dhcp_discovery', @options.origin
for child in parent.frames for child in parent.frames
queue.push child queue.push child
...@@ -183,10 +180,6 @@ class Annotator.Plugin.Bridge extends Annotator.Plugin ...@@ -183,10 +180,6 @@ class Annotator.Plugin.Bridge extends Annotator.Plugin
success: (result) -> d.resolve result success: (result) -> d.resolve result
error: (error, reason) -> error: (error, reason) ->
if error isnt 'timeout_error' if error isnt 'timeout_error'
console.log 'Error in call! Reason: ' + reason
console.log error
console.log "Call was:", options
console.log 'Destroying channel!'
d.reject error, reason d.reject error, reason
else else
d.resolve null d.resolve null
......
class Annotator.Plugin.Discovery extends Annotator.Plugin class Annotator.Plugin.Discovery extends Annotator.Plugin
pluginInit: -> pluginInit: ->
console.log "Initializing discovery plugin."
svc = $('link') svc = $('link')
.filter -> .filter ->
this.rel is 'service' and this.type is 'application/annotatorsvc+json' this.rel is 'service' and this.type is 'application/annotatorsvc+json'
......
...@@ -135,7 +135,6 @@ class Annotator.Plugin.Heatmap extends Annotator.Plugin ...@@ -135,7 +135,6 @@ class Annotator.Plugin.Heatmap extends Annotator.Plugin
anchor = ann.anchors[0] anchor = ann.anchors[0]
if not next? or start.page*dir < anchor.startPage*dir if not next? or start.page*dir < anchor.startPage*dir
# This one is obviously better # This one is obviously better
#console.log "Found anchor on better page."
start: start:
page: anchor.startPage page: anchor.startPage
top: anchor.highlight[anchor.startPage]?.getTop() top: anchor.highlight[anchor.startPage]?.getTop()
...@@ -146,7 +145,6 @@ class Annotator.Plugin.Heatmap extends Annotator.Plugin ...@@ -146,7 +145,6 @@ class Annotator.Plugin.Heatmap extends Annotator.Plugin
if hl? if hl?
# We have a real highlight, let's compare coordinates # We have a real highlight, let's compare coordinates
if start.top*dir < hl.getTop()*dir if start.top*dir < hl.getTop()*dir
#console.log "Found anchor on same page, better pos."
# OK, this one is better # OK, this one is better
start: start:
page: start.page page: start.page
...@@ -154,19 +152,16 @@ class Annotator.Plugin.Heatmap extends Annotator.Plugin ...@@ -154,19 +152,16 @@ class Annotator.Plugin.Heatmap extends Annotator.Plugin
next: [anchor] next: [anchor]
else else
# No, let's keep the old one instead # No, let's keep the old one instead
#console.log "Found anchor on same page, worse pos. (Known: ", start.top, "; found: ", hl.getTop(), ")"
acc acc
else else
# The page is not yet rendered, can't decide yet. # The page is not yet rendered, can't decide yet.
# Let's just store this one, too # Let's just store this one, too
#console.log "Found anchor on same page, unknown pos."
start: page: start.page start: page: start.page
next: $.merge next, [anchor] next: $.merge next, [anchor]
else else
# No, we have clearly seen better alternatives # No, we have clearly seen better alternatives
acc acc
, {} , {}
#console.log "Next is", next
# Get an anchor from the page we want to go to # Get an anchor from the page we want to go to
anchor = next[0] anchor = next[0]
......
...@@ -92,7 +92,6 @@ class Hypothesis extends Annotator ...@@ -92,7 +92,6 @@ class Hypothesis extends Annotator
origin: origin origin: origin
scope: "#{scope}:provider" scope: "#{scope}:provider"
onReady: => onReady: =>
console.log "Provider functions are ready for #{origin}"
if source is $window.parent then @host = channel if source is $window.parent then @host = channel
entities = [] entities = []
channel = this._setupXDM options channel = this._setupXDM options
...@@ -272,7 +271,6 @@ class Hypothesis extends Annotator ...@@ -272,7 +271,6 @@ class Hypothesis extends Annotator
for p in @annotator.providers for p in @annotator.providers
for uri in p.entities for uri in p.entities
unless entities[uri]? unless entities[uri]?
console.log "Loading annotations for: " + uri
entities[uri] = true entities[uri] = true
this.loadAnnotationsFromSearch (angular.extend {}, query, uri: uri) this.loadAnnotationsFromSearch (angular.extend {}, query, uri: uri)
...@@ -308,17 +306,12 @@ class Hypothesis extends Annotator ...@@ -308,17 +306,12 @@ class Hypothesis extends Annotator
switch @socialView.name switch @socialView.name
when "none" when "none"
# Sweet, nothing to do, just clean up previous filters # Sweet, nothing to do, just clean up previous filters
console.log "Not applying any Social View filters."
delete query.user delete query.user
when "single-player" when "single-player"
if @plugins.Permissions?.user if @plugins.Permissions?.user
console.log "Social View filter: single player mode."
query.user = @plugins.Permissions.user query.user = @plugins.Permissions.user
else else
console.log "Social View: single-player mode, but ignoring it, since not logged in."
delete query.user delete query.user
else
console.warn "Unsupported Social View: '" + @socialView.name + "'!"
setTool: (name) -> setTool: (name) ->
return if name is @tool return if name is @tool
......
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