Commit e2f8fd13 authored by csillag's avatar csillag

Added PDF support - we can now annotate PDF documents

 * Update dom-text-mapper to fcd26632 (master branch)
 * Update dom-text-matcher to fcd26632 (master branch)
 * Update Annotator to f1e08bdd (maintenance branch)

 * Updated assets.py for the changed Annotator files and libraries
 * Updated JSChannel with a patch to allow talking to pdf.js
 * Updated our code to follow Annotator API changess
 * Updated the heatmap for two-phase anchoring and virtual anchors

The change in embed.txt fixes a sporadic code insertation problem.

For pages with no script tags, our embed script sometimes crashed.
I have already fixed this problem for YepNope (see #607), but now
it has come back in our own code.

I am not sure why have not this happened before,
but it definitely was happening now.

I applied the same fix that worked with YepNope. It worked again.
parent 686fe9cf
......@@ -12,6 +12,8 @@ class Annotator.Guest extends Annotator
# Plugin configuration
options:
FuzzyAnchoring: {}
PDF: {}
Document: {}
# Internal state
......@@ -40,7 +42,7 @@ class Annotator.Guest extends Annotator
formatted = {}
if annotation.document?
formatted['uri'] = @plugins.Document.uri()
for k, v of annotation when k isnt 'highlights'
for k, v of annotation when k not in ['highlights', 'anchors']
formatted[k] = v
# Work around issue in jschannel where a repeated object is considered
# recursive, even if it is not its own ancestor.
......@@ -65,6 +67,14 @@ class Annotator.Guest extends Annotator
if not @plugins[name]
this.addPlugin(name, opts)
this.subscribe "annotationPhysicallyAnchored", (anchor) =>
if anchor.annotation.id? # Is this a finished annotation ?
@plugins.Heatmap._update()
this.subscribe "annotationPhysicallyUnAnchored", (anchor) =>
if anchor.annotation.id? # Is this a finished annotation ?
@plugins.Heatmap._update()
# Scan the document text with the DOM Text libraries
this.scanDocument "Annotator initialized"
......@@ -135,9 +145,7 @@ class Annotator.Guest extends Annotator
scanDocument: (reason = "something happened") =>
try
console.log "Analyzing host frame, because " + reason + "..."
r = this._scan()
scanTime = r.time
console.log "Traversal+scan took " + scanTime + " ms."
this._scan()
catch e
console.log e.message
console.log e.stack
......@@ -149,8 +157,6 @@ class Annotator.Guest extends Annotator
setTimeout =>
unless @selectedRanges?.length
@panel?.notify method: 'back'
this._setupMatching()
@domMatcher.setRootNode @wrapper[0]
this
# These methods aren't used in the iframe-hosted configuration of Annotator.
......@@ -342,11 +348,7 @@ class Annotator.Guest extends Annotator
# Uncomment the traces below to investigate this further.
deleteAnnotation: (annotation) ->
if annotation.deleted
# console.log "Not deleting annotation the second time."
# console.trace()
return
else
# console.log "Deleting an annotation in " + @role + "."
# console.trace()
annotation.deleted = true
super
......@@ -115,6 +115,32 @@ class Annotator.Plugin.Heatmap extends Annotator.Plugin
.interpolate(d3.interpolateHcl)
c(v).toString()
_collectPendingVirtualAnnotations: (startIndex, endIndex) ->
results = []
for index in [startIndex .. endIndex]
anchors = @annotator.anchors[index]
if anchors?
$.merge results, (anchor.annotation for anchor in anchors when not anchor.allRendered)
results
_scrollTo: (where, up) ->
wrapper = @annotator.wrapper
defaultView = wrapper[0].ownerDocument.defaultView
pad = defaultView.innerHeight * .2
where?.scrollintoview
complete: ->
if this.parentNode is this.ownerDocument
scrollable = $(this.ownerDocument.body)
else
scrollable = $(this)
top = scrollable.scrollTop()
correction = pad * (if up then -1 else +1)
scrollable.stop().animate {scrollTop: top + correction}, 300
_scrollUpTo: (where) -> this._scrollTo where, true
_scrollDownTo: (where) -> this._scrollTo where, false
_update: =>
wrapper = @annotator.wrapper
highlights = wrapper.find('.annotator-hl')
......@@ -123,6 +149,17 @@ class Annotator.Plugin.Heatmap extends Annotator.Plugin
# Keep track of buckets of annotations above and below the viewport
above = []
below = []
# Get the page numbers
mapper = @annotator.domMapper
firstPage = 0
currentPage = mapper.getPageIndex()
lastPage = mapper.getPageCount() - 1
# Collect the pending virtual anchors from above and below
$.merge above, this._collectPendingVirtualAnnotations 0, currentPage-1
$.merge below, this._collectPendingVirtualAnnotations currentPage+1, lastPage
comments = @annotator.comments.slice()
# Construct control points for the heatmap highlights
......@@ -322,50 +359,54 @@ class Annotator.Plugin.Heatmap extends Annotator.Plugin
# Does one of a few things when a tab is clicked depending on type
.on 'click', (bucket) =>
d3.event.stopPropagation()
highlights = wrapper.find('.annotator-hl')
pad = defaultView.innerHeight * .2
# If it's the upper tab, scroll to next bucket above
if @isUpper bucket
# If it's the upper tab, scroll to next bucket above (virtual version)
if (@isUpper bucket)
@dynamicBucket = true
threshold = defaultView.pageYOffset
{next} = highlights.toArray().reduce (acc, hl) ->
{pos, next} = acc
if pos < $(hl).offset().top < threshold
pos: $(hl).offset().top
next: $(hl)
# Find the next annotation, based on character position
{next} = @buckets[bucket].reduce (acc, ann) ->
{start, next} = acc
if start < ann.anchors[0].virtual.start
start: ann.anchors[0].virtual.start
next: ann
else
acc
, {pos: 0, next: null}
next?.scrollintoview
complete: ->
if this.parentNode is this.ownerDocument
scrollable = $(this.ownerDocument.body)
else
scrollable = $(this)
top = scrollable.scrollTop()
scrollable.stop().animate {scrollTop: top - pad}, 300
# If it's the lower tab, scroll to next bucket below
else if @isLower bucket
, {start: 0, next: null}
anchor = next.anchors[0] # This is where we want to go
startPage = anchor.virtual.startPage
if anchor.physical[startPage]? # Is this rendered?
hl = anchor.physical[startPage].highlights
this._scrollUpTo $(hl)
else # Not rendered yet
@pendingScroll =
anchor: anchor
page: startPage
@annotator.domMapper.setPageIndex startPage
# If it's the lower tab, scroll to next bucket below (virtual version)
else if (@isLower bucket)
@dynamicBucket = true
threshold = defaultView.pageYOffset + defaultView.innerHeight - pad
{next} = highlights.toArray().reduce (acc, hl) ->
{pos, next} = acc
if threshold < $(hl).offset().top < pos
pos: $(hl).offset().top
next: $(hl)
# Find the next annotation, based on character position
{next} = @buckets[bucket].reduce (acc, ann) ->
{start, next} = acc
if ann.anchors[0].virtual.start < start
start: ann.anchors[0].virtual.start
next: ann
else
acc
, {pos: Number.MAX_VALUE, next: null}
next?.scrollintoview
complete: ->
if this.parentNode is this.ownerDocument
scrollable = $(this.ownerDocument.body)
else
scrollable = $(this)
top = scrollable.scrollTop()
scrollable.stop().animate {scrollTop: top + pad}, 300
, {start: @annotator.domMapper.getCorpus().length, next: null}
anchor = next.anchors[0] # This is where we want to go
startPage = anchor.virtual.startPage
if anchor.physical[startPage]? # Is this rendered?
hl = anchor.physical[startPage].highlights
this._scrollDownTo $(hl)
else # Not rendered yet
# Pass this value to our listener
@pendingScroll =
anchor: anchor
page: startPage
@annotator.domMapper.setPageIndex startPage
# If it's neither of the above, load the bucket into the viewer
else
......@@ -392,6 +433,14 @@ class Annotator.Plugin.Heatmap extends Annotator.Plugin
if @dynamicBucket
this._fillDynamicBucket()
# Event handler to finish scrolling when we have to wait for rendering
@annotator.subscribe "annotationPhysicallyAnchored", (anchor) =>
if @pendingScroll? and anchor is @pendingScroll.anchor
# The wanted annotation has been anchored.
hl = anchor.physical[@pendingScroll.page].highlights
this._scrollDownTo $(hl)
delete @pendingScroll
_fillDynamicBucket: =>
top = window.pageYOffset
bottom = top + $(window).innerHeight()
......
......@@ -99,7 +99,9 @@ class Annotator extends Delegator
return this unless Annotator.supported()
this._setupDocumentEvents() unless @options.readOnly
this._setupWrapper()
this._setupMatching() unless @options.noMatching
unless @options.noMatching
this._setupDocumentAccessStrategies()
this._setupVirtualAnchoringStrategies()
this._setupViewer()._setupEditor()
this._setupDynamicStyle()
......@@ -109,19 +111,60 @@ class Annotator extends Delegator
# Create adder
this.adder = $(this.html.adder).appendTo(@wrapper).hide()
# Initializes the components used for analyzing the DOM
_setupMatching: ->
@domMapper = new DomTextMapper()
@domMatcher = new DomTextMatcher @domMapper
@domMapper.setRootNode @wrapper[0]
# Initializes the available document access strategies
_setupDocumentAccessStrategies: ->
@documentAccessStrategies = [
# Default strategy for simple HTML documents.
# Also the generic fallback.
name: "DOM generic"
mapper: DomTextMapper
init: => @domMapper.setRootNode @wrapper[0]
]
this
# Initializes the components used for analyzing the document
_setupMapper: ->
if @domMapper? then return
# Go over the available strategies
for s in @documentAccessStrategies
# Can we use this strategy for this document?
if s.mapper.applicable()
@documentAccessStrategy = s
console.log "Selected document access strategy: " + s.name
@domMapper = new s.mapper()
@anchors = {}
addEventListener "docPageMapped", (evt) =>
@_physicallyAnchorPage evt.pageIndex
addEventListener "docPageUnmapped", (evt) =>
@_physicallyUnAnchorPage evt.pageIndex
s.init?()
return this
# Initializes the available virtual anchoring strategies
_setupVirtualAnchoringStrategies: ->
@virtualAnchoringStrategies = [
# Simple strategy based on DOM Range
name: "range"
code: this.createVirtualAnchorFromRangeSelector
,
# Position-based strategy. (The quote is verified.)
# This can handle document structure changes,
# but not the content changes.
name: "position"
code: this.createVirtualAnchorFromPositionSelector
]
this
# Perform a scan of the DOM. Required for finding anchors.
_scan: ->
@domMatcher.scan()
unless @domMapper # If we haven't yet created a document mapper,
this._setupMapper() # do so now.
@pendingScan = @domMapper.scan()
# Wraps the children of @element in a @wrapper div. NOTE: This method will also
# remove any script elements inside @element to prevent them re-executing.
#
......@@ -251,8 +294,7 @@ class Annotator extends Delegator
unless rangeEnd?
throw new Error "Called getTextQuoteSelector(range) on a range with no valid end."
endOffset = (@domMapper.getInfoForNode rangeEnd).end
quote = @domMapper.getContentForCharRange startOffset, endOffset
quote = @domMapper.getCorpus()[startOffset .. endOffset-1].trim()
[prefix, suffix] = @domMapper.getContextForCharRange startOffset, endOffset
selector =
type: "TextQuoteSelector"
......@@ -364,199 +406,89 @@ class Annotator extends Delegator
# Try to determine the anchor position for a target
# using the saved Range selector. The quote is verified.
findAnchorFromRangeSelector: (target) ->
createVirtualAnchorFromRangeSelector: (target) ->
selector = this.findSelector target.selector, "RangeSelector"
unless selector? then return null
# Try to apply the saved XPath
normalizedRange = Range.sniff(selector).normalize @wrapper[0]
try
normalizedRange = Range.sniff(selector).normalize @wrapper[0]
catch error
#console.log "Could not apply XPath selector to current document, " +
# "because the structure has changed."
return null
startInfo = @domMapper.getInfoForNode normalizedRange.start
startOffset = startInfo.start
endInfo = @domMapper.getInfoForNode normalizedRange.end
endOffset = endInfo.end
content = @domMapper.getCorpus()[startOffset .. endOffset-1].trim()
currentQuote = this.normalizeString content
# Look up the saved quote
savedQuote = this.getQuoteForTarget target
if savedQuote?
# We have a saved quote, let's compare it to current content
startInfo = @domMapper.getInfoForNode normalizedRange.start
startOffset = startInfo.start
endInfo = @domMapper.getInfoForNode normalizedRange.end
endOffset = endInfo.end
content = @domMapper.getContentForCharRange startOffset, endOffset
currentQuote = this.normalizeString content
if currentQuote isnt savedQuote
console.log "Could not apply XPath selector to current document \
because the quote has changed. (Saved quote is '#{savedQuote}'. \
Current quote is '#{currentQuote}'.)"
return null
else
# console.log "Saved quote matches."
else
console.log "No saved quote, nothing to compare. Assume that it's OK."
range: normalizedRange
quote: savedQuote
if savedQuote? and currentQuote isnt savedQuote
#console.log "Could not apply XPath selector to current document, " +
# "because the quote has changed. (Saved quote is '#{savedQuote}'." +
# " Current quote is '#{currentQuote}'.)"
return null
# Create a "text poision"-type virtual anchor from this range
startPage: startInfo.pageIndex ? 0
start: startInfo.start
endPage: endInfo.pageIndex ? 0
end: endInfo.end
quote: currentQuote
# Try to determine the anchor position for a target
# using the saved position selector. The quote is verified.
findAnchorFromPositionSelector: (target) ->
createVirtualAnchorFromPositionSelector: (target) ->
selector = this.findSelector target.selector, "TextPositionSelector"
unless selector? then return null
content = @domMapper.getCorpus()[selector.start .. selector.end-1].trim()
currentQuote = this.normalizeString content
savedQuote = this.getQuoteForTarget target
if savedQuote?
if savedQuote? and currentQuote isnt savedQuote
# We have a saved quote, let's compare it to current content
content = @domMapper.getContentForCharRange selector.start, selector.end
currentQuote = this.normalizeString content
if currentQuote isnt savedQuote
console.log "Could not apply position selector" +
" [#{selector.start}:#{selector.end}] to current document," +
" because the quote has changed." +
"(Saved quote is '#{savedQuote}'." +
" Current quote is '#{currentQuote}'.)"
return null
else
# console.log "Saved quote matches."
else
console.log "No saved quote, nothing to compare. Assume that it's okay."
# OK, we have everything. Create a range from this.
mappings = this.domMapper.getMappingsForCharRange selector.start,
selector.end
browserRange = new Range.BrowserRange mappings.realRange
normalizedRange = browserRange.normalize @wrapper[0]
range: normalizedRange
quote: savedQuote
findAnchorWithTwoPhaseFuzzyMatching: (target) ->
# Fetch the quote and the context
quoteSelector = this.findSelector target.selector, "TextQuoteSelector"
prefix = quoteSelector?.prefix
suffix = quoteSelector?.suffix
quote = quoteSelector?.exact
# No context, to joy
unless (prefix? and suffix?) then return null
# Fetch the expected start and end positions
posSelector = this.findSelector target.selector, "TextPositionSelector"
expectedStart = posSelector?.start
expectedEnd = posSelector?.end
options =
contextMatchDistance: @domMapper.getDocLength() * 2
contextMatchThreshold: 0.5
patternMatchThreshold: 0.5
flexContext: true
result = @domMatcher.searchFuzzyWithContext prefix, suffix, quote,
expectedStart, expectedEnd, false, null, options
# If we did not got a result, give up
unless result.matches.length
console.log "Fuzzy matching did not return any results. Giving up on two-phase strategy."
return null
# here is our result
match = result.matches[0]
console.log "2-phase fuzzy found match:"
console.log match
# convert it to a Range
browserRange = new Range.BrowserRange match.realRange
normalizedRange = browserRange.normalize @wrapper[0]
# return the anchor
anchor =
range: normalizedRange
quote: unless match.exact then match.found
diffHTML: unless match.exact then match.comparison.diffHTML
diffCaseOnly: unless match.exact then match.exactExceptCase
anchor
findAnchorWithFuzzyMatching: (target) ->
# Fetch the quote
quoteSelector = this.findSelector target.selector, "TextQuoteSelector"
quote = quoteSelector?.exact
# No quote, no joy
unless quote? then return null
# For too short quotes, this strategy is bound to return false positives.
# See https://github.com/hypothesis/h/issues/853 for details.
return unless quote.length >= 32
# Get a starting position for the search
posSelector = this.findSelector target.selector, "TextPositionSelector"
expectedStart = posSelector?.start
# Get full document length
len = this.domMapper.getDocLength()
# If we don't have the position saved, start at the middle of the doc
expectedStart ?= len / 2
# Do the fuzzy search
options =
matchDistance: len * 2
withFuzzyComparison: true
result = @domMatcher.searchFuzzy quote, expectedStart, false, null, options
# If we did not got a result, give up
unless result.matches.length
console.log "Fuzzy matching did not return any results. Giving up on one-phase strategy."
#console.log "Could not apply position selector" +
# " [#{selector.start}:#{selector.end}] to current document," +
# " because the quote has changed. " +
# "(Saved quote is '#{savedQuote}'." +
# " Current quote is '#{currentQuote}'.)"
return null
# here is our result
match = result.matches[0]
console.log "1-phase fuzzy found match:"
console.log match
# convert it to a Range
browserRange = new Range.BrowserRange match.realRange
normalizedRange = browserRange.normalize @wrapper[0]
# return the anchor
anchor =
range: normalizedRange
quote: unless match.exact then match.found
diffHTML: unless match.exact then match.comparison.diffHTML
diffCaseOnly: unless match.exact then match.exactExceptCase
anchor
# OK, we have everything.
# Compile the data required to store this virtual anchor
startPage: @domMapper.getPageIndexForPos selector.start
endPage: @domMapper.getPageIndexForPos selector.end
start: selector.start
end: selector.end
quote: currentQuote
# Try to find the right anchoring point for a given target
#
# Returns a normalized range if succeeded, null otherwise
findAnchor: (target) ->
createVirtualAnchor: (target) ->
unless target?
throw new Error "Trying to find anchor for null target!"
# console.log "Trying to find anchor for target: "
# console.log target
strategies = [
# Simple strategy based on DOM Range
this.findAnchorFromRangeSelector
# Position-based strategy. (The quote is verified.)
# This can handle document structure changes,
# but not the content changes.
this.findAnchorFromPositionSelector
# Two-phased fuzzy text matching strategy. (Using context and quote.)
# This can handle document structure changes,
# and also content changes.
this.findAnchorWithTwoPhaseFuzzyMatching
# Naive fuzzy text matching strategy. (Using only the quote.)
# This can handle document structure changes,
# and also content changes.
this.findAnchorWithFuzzyMatching
]
error = null
anchor = null
for fn in strategies
for s in @virtualAnchoringStrategies
try
anchor ?= fn.call this, target
a = s.code.call this, target
if a
# console.log "Strategy '" + s.name + "' yielded a virtual anchor."
return result: a
# else
# console.log "Strategy '" + s.name + "' did NOT yield a virtual anchor."
catch error
unless error instanceof Range.RangeError
# console.log "Strategy '" + s.name + "' has thrown an error."
if error instanceof Range.RangeError
return error: error
else
throw error
{error, anchor}
# Public: Initialises an annotation either from an object representation or
# an annotation created with Annotator#createAnnotation(). It finds the
......@@ -579,7 +511,6 @@ class Annotator extends Delegator
#
# Returns the initialised annotation.
setupAnnotation: (annotation) ->
root = @wrapper[0]
ranges = annotation.ranges or @selectedRanges or []
# Upgrade format from v1.2.6 and earlier
......@@ -590,20 +521,43 @@ class Annotator extends Delegator
unless annotation.target?
throw new Error "Can not run setupAnnotation(). No target or selection available."
normedRanges = []
annotation.quote = []
annotation.anchors = []
annotation.ranges = []
annotation.highlights = []
for t in annotation.target
try
{anchor, error} = this.findAnchor t
if error instanceof Range.RangeError
this.publish('rangeNormalizeFail', [annotation, error.range, error])
if anchor?
t.quote = anchor.quote or $.trim(anchor.range.text())
t.diffHTML = anchor.diffHTML
t.diffCaseOnly = anchor.diffCaseOnly
normedRanges.push anchor.range
annotation.quote.push t.quote
result = this.createVirtualAnchor t
vAnchor = result.result
if result.error? instanceof Range.RangeError
this.publish 'rangeNormalizeFail', [annotation, result.error.range, result.error]
if vAnchor?
annotation.quote.push t.quote = vAnchor.quote
delete vAnchor.quote
t.diffHTML = vAnchor.diffHTML
delete vAnchor.diffHTML
t.diffCaseOnly = vAnchor.diffCaseOnly
delete vAnchor.diffCaseOnly
# Create a new anchor object, starting with a virtual anchor
anchor =
annotation: annotation
target: t
virtual: vAnchor
physical: {}
# Store this anchor for the annotation
annotation.anchors.push anchor
# Store the anchor for all involved pages
for pageIndex in [vAnchor.startPage .. vAnchor.endPage]
@anchors[pageIndex] ?= []
@anchors[pageIndex].push anchor
# Realizing the anchor
this._physicallyAnchor anchor
else
console.log "Could not find anchor target for annotation '" +
annotation.id + "'."
......@@ -612,20 +566,9 @@ class Annotator extends Delegator
console.log exception.message
console.log exception
annotation.ranges = []
annotation.highlights = []
for normed in normedRanges
annotation.ranges.push normed.serialize(@wrapper[0], '.annotator-hl')
$.merge annotation.highlights, this.highlightRange(normed)
# Join all the quotes into one string.
annotation.quote = annotation.quote.join(' / ')
# Save the annotation data on each highlighter element.
$(annotation.highlights).data('annotation', annotation)
annotation
# Public: Publishes the 'beforeAnnotationUpdated' and 'annotationUpdated'
......@@ -657,12 +600,11 @@ class Annotator extends Delegator
#
# Returns deleted annotation.
deleteAnnotation: (annotation) ->
if annotation.highlights?
for h in annotation.highlights when h.parentNode?
child = h.childNodes[0]
$(h).replaceWith(h.childNodes)
window.DomTextMapper.changed child.parentNode,
"removed hilite (annotation deleted)"
if annotation.anchors?
for a in annotation.anchors
for page, data of a.physical
this._physicallyUnAnchor a, page
this._removeAnchor a
this.publish('annotationDeleted', [annotation])
annotation
......@@ -693,7 +635,17 @@ class Annotator extends Delegator
this.publish 'annotationsLoaded', [clone]
clone = annotations.slice()
loader(annotations) if annotations.length
if annotations.length # Do we have to do something?
if @pendingScan? # Is there a pending scan?
# Schedule the parsing the annotations for
# when scan has finished
@pendingScan.then =>
#console.log "Document scan finished. Can start anchoring."
setTimeout => loader annotations
else # no pending scan
# We can start parsing them right away
loader annotations
this
# Public: Calls the Store#dumpAnnotations() method.
......@@ -1034,6 +986,112 @@ class Annotator extends Delegator
# Delete highlight elements.
this.deleteAnnotation annotation
# Virtual/Physical anchoring
# Remove an anchor from all involved pages
_removeAnchor: (anchor) ->
# Go over all the pages
for index in [anchor.virtual.startPage .. anchor.virtual.endPage]
# Remove the anchor from the list
i = @anchors[index].indexOf anchor
@anchors[index][i..i] = []
# Kill the list if it's empty
delete @anchors[index] unless @anchors[index].length
_physicallyAnchor: (anchor) ->
return if anchor.allRendered # If we have everything, go home
vAnchor = anchor.virtual
pAnchor = anchor.physical
# Collect the pages that are already rendered
renderedPages = [vAnchor.startPage .. vAnchor.endPage].filter (index) =>
@domMapper.isPageMapped index
# Collect the pages that are already rendered, but not yet anchored
pagesTodo = renderedPages.filter (index) -> not pAnchor[index]?
return unless pagesTodo.length # Return if nothing to do
# First calculate the ranges
mappings = @domMapper.getMappingsForCharRange vAnchor.start, vAnchor.end, pagesTodo
for page, section of mappings.sections
browserRange = new Range.BrowserRange section.realRange
range = browserRange.normalize @wrapper[0]
# Get the serialized range
serializedRange = range.serialize @wrapper[0], '.annotator-hl'
# Add the range to the annotation
anchor.annotation.ranges.push serializedRange
# Create a highlights, and link them with the annotation
highlights = this.highlightRange range
$(highlights).data('annotation', anchor.annotation)
$.merge anchor.annotation.highlights, highlights
# Add the newly mapped page to the physical anchor
pAnchor[page] =
range: serializedRange
highlights: highlights
anchor.allRendered = renderedPages.length is vAnchor.endPage - vAnchor.startPage + 1
# Announce the anchoring
this.publish 'annotationPhysicallyAnchored', anchor
# Physically anchor targets to a given pages
_physicallyAnchorPage: (index) ->
# Fetch the anchors related to this page
anchors = @anchors[index]
# If there are no anchors, or the page is not mapped, give up
return unless anchors? and @domMapper.isPageMapped index
# Go over all anchors
for anchor in anchors
this._physicallyAnchor anchor
# Remove a given physical anchor from a given page
_physicallyUnAnchor: (anchor, pageIndex) ->
data = anchor.physical[pageIndex]
return unless data? # No physical anchor for this page
ann = anchor.annotation
# remove the range added by this anchor
i = ann.ranges.indexOf data.range
ann.ranges[i..i] = []
# remove the highlights added by this anchor
for hl in data.highlights
# Is this highlight actually the part of the document?
if hl.parentNode? and @domMapper.isPageMapped pageIndex
# We should restore original state
child = hl.childNodes[0]
$(hl).replaceWith hl.childNodes
window.DomTextMapper.changed child.parentNode,
"removed hilite (annotation deleted)"
i = ann.highlights.indexOf hl
ann.highlights[i..i] = []
delete anchor.physical[pageIndex]
# Mark this anchor as not fully rendered
anchor.allRendered = false
# Publish un-anchoring event
this.publish 'annotationPhysicallyUnAnchored', anchor
# Remove physical anchors from a given page
_physicallyUnAnchorPage: (index) ->
# Go over all virtual anchors related to this page
for anchor in @anchors[index] ? []
this._physicallyUnAnchor anchor, index
# Create namespace for Annotator plugins
class Annotator.Plugin extends Delegator
constructor: (element, options) ->
......
# Annotator plugin for fuzzy text matching
class Annotator.Plugin.FuzzyAnchoring extends Annotator.Plugin
pluginInit: ->
# Initialize the text matcher library
@textFinder = new DomTextMatcher => @annotator.domMapper.getCorpus()
# Register our fuzzy strategies
@annotator.virtualAnchoringStrategies.push
# Two-phased fuzzy text matching strategy. (Using context and quote.)
# This can handle document structure changes,
# and also content changes.
name: "two-phase fuzzy"
code: this.createVirtualAnchorWithTwoPhaseFuzzyMatching
@annotator.virtualAnchoringStrategies.push
# Naive fuzzy text matching strategy. (Using only the quote.)
# This can handle document structure changes,
# and also content changes.
name: "one-phase fuzzy"
code: this.createVirtualAnchorWithFuzzyMatching
createVirtualAnchorWithTwoPhaseFuzzyMatching: (target) =>
# Fetch the quote and the context
quoteSelector = @annotator.findSelector target.selector, "TextQuoteSelector"
prefix = quoteSelector?.prefix
suffix = quoteSelector?.suffix
quote = quoteSelector?.exact
# No context, to joy
unless (prefix? and suffix?) then return null
# Fetch the expected start and end positions
posSelector = @annotator.findSelector target.selector, "TextPositionSelector"
expectedStart = posSelector?.start
expectedEnd = posSelector?.end
options =
contextMatchDistance: @annotator.domMapper.getCorpus().length * 2
contextMatchThreshold: 0.5
patternMatchThreshold: 0.5
flexContext: true
result = @textFinder.searchFuzzyWithContext prefix, suffix, quote,
expectedStart, expectedEnd, false, options
# If we did not got a result, give up
unless result.matches.length
# console.log "Fuzzy matching did not return any results. Giving up on two-phase strategy."
return null
# here is our result
match = result.matches[0]
# console.log "2-phase fuzzy found match at: [" + match.start + ":" +
# match.end + "]: '" + match.found + "' (exact: " + match.exact + ")"
# OK, we have everything
# Compile the data required to store this virtual anchor
start: match.start
end: match.end
startPage: @annotator.domMapper.getPageIndexForPos match.start
endPage: @annotator.domMapper.getPageIndexForPos match.end
quote: match.found
diffHTML: unless match.exact then match.comparison.diffHTML
diffCaseOnly: unless match.exact then match.exactExceptCase
createVirtualAnchorWithFuzzyMatching: (target) =>
# Fetch the quote
quoteSelector = @annotator.findSelector target.selector, "TextQuoteSelector"
quote = quoteSelector?.exact
# No quote, no joy
unless quote? then return null
# For too short quotes, this strategy is bound to return false positives.
# See https://github.com/hypothesis/h/issues/853 for details.
return unless quote.length >= 32
# Get a starting position for the search
posSelector = @annotator.findSelector target.selector, "TextPositionSelector"
expectedStart = posSelector?.start
# Get full document length
len = @annotator.domMapper.getCorpus().length
# If we don't have the position saved, start at the middle of the doc
expectedStart ?= len / 2
# Do the fuzzy search
options =
matchDistance: len * 2
withFuzzyComparison: true
result = @textFinder.searchFuzzy quote, expectedStart, false, options
# If we did not got a result, give up
unless result.matches.length
# console.log "Fuzzy matching did not return any results. Giving up on one-phase strategy."
return null
# here is our result
match = result.matches[0]
# console.log "1-phase fuzzy found match at: [" + match.start + ":" +
# match.end + "]: '" + match.found + "' (exact: " + match.exact + ")"
# OK, we have everything
# Compile the data required to store this virtual anchor
start: match.start
end: match.end
startPage: @annotator.domMapper.getPageIndexForPos match.start
endPage: @annotator.domMapper.getPageIndexForPos match.end
quote: match.found
diffHTML: unless match.exact then match.comparison.diffHTML
diffCaseOnly: unless match.exact then match.exactExceptCase
......@@ -29,7 +29,7 @@ Annotator::setupPlugins = (config={}, options={}) ->
win = util.getGlobal()
# Set up the default plugins.
plugins = ['Unsupported', 'Auth', 'Tags', 'Filter', 'Store', 'AnnotateItPermissions']
plugins = ['Unsupported', 'Auth', 'Tags', 'Filter', 'Store', 'AnnotateItPermissions', "FuzzyAnchoring", "PDF"]
# If Showdown is included add the Markdown plugin.
if win.Showdown
......
# Document mapper module for PDF.js documents
class window.PDFTextMapper extends window.PageTextMapperCore
# Are we working with a PDF document?
@applicable: -> PDFView?.initialized ? false
requiresSmartStringPadding: true
# Get the number of pages
getPageCount: -> PDFView.pages.length
# Where are we in the document?
getPageIndex: -> PDFView.page - 1
# Jump to a given page
setPageIndex: (index) -> PDFView.page = index + 1
# Determine whether a given page has been rendered
_isPageRendered: (index) ->
return PDFView.pages[index]?.textLayer?.renderingDone
# Get the root DOM node of a given page
getRootNodeForPage: (index) ->
PDFView.pages[index].textLayer.textLayerDiv
constructor: ->
@setEvents()
# Install watchers for various events to detect page rendering/unrendering
setEvents: ->
# Detect page rendering
addEventListener "pagerender", (evt) =>
index = evt.detail.pageNumber - 1
@_onPageRendered index
# Detect page un-rendering
addEventListener "DOMNodeRemoved", (evt) =>
node = evt.target
if node.nodeType is Node.ELEMENT_NODE and node.nodeName.toLowerCase() is "div" and node.className is "textLayer"
index = parseInt node.parentNode.id.substr(13) - 1
# Forget info about the new DOM subtree
@_unmapPage @pageInfo[index]
# Do something about cross-page selections
window.DomTextMapper.instances.push
id: "cross-page catcher"
rootNode: document.getElementById "viewer"
performUpdateOnNode: (node, data) =>
if "viewer" is node.getAttribute? "id"
# This event escaped the pages.
# Must be a cross-page selection.
if data.start? and data.end?
startPage = @getPageForNode data.start
endPage = @getPageForNode data.end
for index in [ startPage.index .. endPage.index ]
#console.log "Should rescan page #" + index
@_updateMap @pageInfo[index]
documentChanged: ->
timestamp: ->
_extractionPattern: /[ ]+/g
_parseExtractedText: (text) => text.replace @_extractionPattern, " "
# Extract the text from the PDF
scan: ->
console.log "Scanning document for text..."
# Create a promise
pendingScan = new PDFJS.Promise()
# Tell the Find Controller to go digging
PDFFindController.extractText()
# When all the text has been extracted
PDFJS.Promise.all(PDFFindController.extractTextPromises).then =>
# PDF.js text extraction has finished.
# Post-process the extracted text
@pageInfo = ({ content: @_parseExtractedText page } for page in PDFFindController.pageContents)
# Do some besic calculations with the content
@_onHavePageContents()
# OK, we are ready to rock.
pendingScan.resolve()
# Do whatever we need to do after scanning
@_onAfterScan()
# Return the promise
pendingScan
# Look up the page for a given DOM node
getPageForNode: (node) ->
# Search for the root of this page
div = node
while (
(div.nodeType isnt Node.ELEMENT_NODE) or
not div.getAttribute("class")? or
(div.getAttribute("class") isnt "textLayer")
)
div = div.parentNode
# Fetch the page number from the id. ("pageContainerN")
index = parseInt div.parentNode.id.substr(13) - 1
# Look up the page
@pageInfo[index]
# Annotator plugin for annotating documents handled by PDF.js
class Annotator.Plugin.PDF extends Annotator.Plugin
pluginInit: ->
@annotator.documentAccessStrategies.unshift
# Strategy to handle PDF documents rendered by PDF.js
name: "PDF.js"
mapper: PDFTextMapper
......@@ -213,7 +213,7 @@ class Range.BrowserRange
if window.DomTextMapper? and changed
# console.log "Ranged normalization changed the DOM, updating d-t-m"
window.DomTextMapper.changed nr.commonAncestor, "range normalization"
window.DomTextMapper.changed nr.commonAncestor, "range normalization", nr
new Range.NormalizedRange(nr)
......
// Generated by CoffeeScript 1.6.3
/*
** Annotator 1.2.6-dev-b9ec63a
** Annotator 1.2.6-dev-33543a5
** https://github.com/okfn/annotator/
**
** Copyright 2012 Aron Carroll, Rufus Pollock, and Nick Stenning.
** Dual licensed under the MIT and GPLv3 licenses.
** https://github.com/okfn/annotator/blob/master/LICENSE
**
** Built at: 2013-10-02 17:26:42Z
** Built at: 2013-10-27 05:12:46Z
*/
......
// Generated by CoffeeScript 1.6.3
/*
** Annotator 1.2.6-dev-0aaf331
** Annotator 1.2.6-dev-33543a5
** https://github.com/okfn/annotator/
**
** Copyright 2012 Aron Carroll, Rufus Pollock, and Nick Stenning.
** Dual licensed under the MIT and GPLv3 licenses.
** https://github.com/okfn/annotator/blob/master/LICENSE
**
** Built at: 2013-10-24 01:17:53Z
** Built at: 2013-10-27 05:12:46Z
*/
......
// Generated by CoffeeScript 1.6.3
/*
** Annotator 1.2.6-dev-f1e08bd
** https://github.com/okfn/annotator/
**
** Copyright 2012 Aron Carroll, Rufus Pollock, and Nick Stenning.
** Dual licensed under the MIT and GPLv3 licenses.
** https://github.com/okfn/annotator/blob/master/LICENSE
**
** Built at: 2013-11-12 02:02:47Z
*/
/*
//
*/
// Generated by CoffeeScript 1.6.3
(function() {
var _ref,
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
Annotator.Plugin.FuzzyAnchoring = (function(_super) {
__extends(FuzzyAnchoring, _super);
function FuzzyAnchoring() {
this.createVirtualAnchorWithFuzzyMatching = __bind(this.createVirtualAnchorWithFuzzyMatching, this);
this.createVirtualAnchorWithTwoPhaseFuzzyMatching = __bind(this.createVirtualAnchorWithTwoPhaseFuzzyMatching, this);
_ref = FuzzyAnchoring.__super__.constructor.apply(this, arguments);
return _ref;
}
FuzzyAnchoring.prototype.pluginInit = function() {
var _this = this;
this.textFinder = new DomTextMatcher(function() {
return _this.annotator.domMapper.getCorpus();
});
this.annotator.virtualAnchoringStrategies.push({
name: "two-phase fuzzy",
code: this.createVirtualAnchorWithTwoPhaseFuzzyMatching
});
return this.annotator.virtualAnchoringStrategies.push({
name: "one-phase fuzzy",
code: this.createVirtualAnchorWithFuzzyMatching
});
};
FuzzyAnchoring.prototype.createVirtualAnchorWithTwoPhaseFuzzyMatching = function(target) {
var expectedEnd, expectedStart, match, options, posSelector, prefix, quote, quoteSelector, result, suffix;
quoteSelector = this.annotator.findSelector(target.selector, "TextQuoteSelector");
prefix = quoteSelector != null ? quoteSelector.prefix : void 0;
suffix = quoteSelector != null ? quoteSelector.suffix : void 0;
quote = quoteSelector != null ? quoteSelector.exact : void 0;
if (!((prefix != null) && (suffix != null))) {
return null;
}
posSelector = this.annotator.findSelector(target.selector, "TextPositionSelector");
expectedStart = posSelector != null ? posSelector.start : void 0;
expectedEnd = posSelector != null ? posSelector.end : void 0;
options = {
contextMatchDistance: this.annotator.domMapper.getCorpus().length * 2,
contextMatchThreshold: 0.5,
patternMatchThreshold: 0.5,
flexContext: true
};
result = this.textFinder.searchFuzzyWithContext(prefix, suffix, quote, expectedStart, expectedEnd, false, options);
if (!result.matches.length) {
return null;
}
match = result.matches[0];
return {
start: match.start,
end: match.end,
startPage: this.annotator.domMapper.getPageIndexForPos(match.start),
endPage: this.annotator.domMapper.getPageIndexForPos(match.end),
quote: match.found,
diffHTML: !match.exact ? match.comparison.diffHTML : void 0,
diffCaseOnly: !match.exact ? match.exactExceptCase : void 0
};
};
FuzzyAnchoring.prototype.createVirtualAnchorWithFuzzyMatching = function(target) {
var expectedStart, len, match, options, posSelector, quote, quoteSelector, result;
quoteSelector = this.annotator.findSelector(target.selector, "TextQuoteSelector");
quote = quoteSelector != null ? quoteSelector.exact : void 0;
if (quote == null) {
return null;
}
if (!(quote.length >= 32)) {
return;
}
posSelector = this.annotator.findSelector(target.selector, "TextPositionSelector");
expectedStart = posSelector != null ? posSelector.start : void 0;
len = this.annotator.domMapper.getCorpus().length;
if (expectedStart == null) {
expectedStart = len / 2;
}
options = {
matchDistance: len * 2,
withFuzzyComparison: true
};
result = this.textFinder.searchFuzzy(quote, expectedStart, false, options);
if (!result.matches.length) {
return null;
}
match = result.matches[0];
return {
start: match.start,
end: match.end,
startPage: this.annotator.domMapper.getPageIndexForPos(match.start),
endPage: this.annotator.domMapper.getPageIndexForPos(match.end),
quote: match.found,
diffHTML: !match.exact ? match.comparison.diffHTML : void 0,
diffCaseOnly: !match.exact ? match.exactExceptCase : void 0
};
};
return FuzzyAnchoring;
})(Annotator.Plugin);
}).call(this);
//
//@ sourceMappingURL=annotator.fuzzyanchoring.map
\ No newline at end of file
{"version":3,"file":"annotator.fuzzyanchoring.js","sources":["_preamble.coffee","_annotator_mapsrc/src/plugin/fuzzyanchoring.coffee"],"names":[],"mappings":";AAAA;;;;;;;;;;CAAA;CAAA;;;;;;;ACCA;CAAA,GAAA,EAAA;KAAA;;oSAAA;;CAAA,CAAM,IAAgB,GAAP;CAEb;;;;;;;CAAA;;CAAA,EAAY,MAAA,CAAZ;CAEE,SAAA,EAAA;CAAA,EAAkB,CAAjB,EAAD,GAAiC,CAAjC,IAAkB;CAAmB,IAAA,IAAS,MAAV;CAAlB,MAAe;CAAjC,GAGC,EAAD,GAAU,iBAA2B;CAInC,CAAM,EAAN,IAAA,SAAA;CAAA,CACM,EAAN,IAAA,oCADA;CAPF,OAGA;CAOC,GAAA,KAAS,IAAV,aAAqC;CAInC,CAAM,EAAN,IAAA,SAAA;CAAA,CACM,EAAN,IAAA,4BADA;CAhBQ,OAYV;CAZF,IAAY;;CAAZ,EAmB8C,GAAA,GAAC,mCAA/C;CAEE,SAAA,2FAAA;CAAA,CAAyD,CAAzC,CAAC,EAAjB,EAAgB,CAAU,GAAV,CAAhB,MAAgB;CAAhB,EACS,GAAT,OAAsB;CADtB,EAES,GAAT,OAAsB;CAFtB,EAGQ,EAAR,CAAA,OAAqB;AAGd,CAAP,GAAA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;QAlBA;CAAA,EAsBE,GADF,CAAA;CACE,CAAe,CAAA,KAAf,KAAA;CAAA,CACqB,EADrB,IACA,WAAA;CAvBF,OAAA;CAAA,CAwBwC,CAA/B,CAAC,CAAD,CAAT,CAAS,GAAW,CAAX,EAAA;AAGF,CAAP,GAAA,EAAA,CAAqB;CAEnB,GAAA,WAAO;QA7BT;CAAA,EAgCQ,EAAR,CAAA,CAAuB;aAMvB;CAAA,CAAO,GAAP,GAAA;CAAA,CACK,CAAL,EAAU,GAAV;CADA,CAEW,EAAC,CAA4C,GAAxD,CAAA,SAAW;CAFX,CAGS,CAAA,CAAC,CAA4C,EAAtD,CAAA,CAAmB,SAAV;CAHT,CAIO,GAAP,GAAA;AACiB,CALjB,CAKU,CAAwB,EAAZ,CALtB,EAKA,EAAkD;AAC7B,CANrB,CAMc,CAAwB,EAAZ,CAN1B,EAMA,IAAA,GAAc;CA9CsB;CA9DtC,IA8DsC;;CA9DtC;;CAF4C,QAAS;CAAvD"}
\ No newline at end of file
// Generated by CoffeeScript 1.6.3
/*
** Annotator 1.2.6-dev-33543a5
** Annotator 1.2.6-dev-f1e08bd
** https://github.com/okfn/annotator/
**
** Copyright 2012 Aron Carroll, Rufus Pollock, and Nick Stenning.
** Dual licensed under the MIT and GPLv3 licenses.
** https://github.com/okfn/annotator/blob/master/LICENSE
**
** Built at: 2013-10-27 05:20:36Z
** Built at: 2013-11-12 02:02:44Z
*/
......@@ -557,7 +557,7 @@
nr.commonAncestor = nr.commonAncestor.parentNode;
}
if ((window.DomTextMapper != null) && changed) {
window.DomTextMapper.changed(nr.commonAncestor, "range normalization");
window.DomTextMapper.changed(nr.commonAncestor, "range normalization", nr);
}
return new Range.NormalizedRange(nr);
};
......@@ -850,7 +850,8 @@
}
this._setupWrapper();
if (!this.options.noMatching) {
this._setupMatching();
this._setupDocumentAccessStrategies();
this._setupVirtualAnchoringStrategies();
}
this._setupViewer()._setupEditor();
this._setupDynamicStyle();
......@@ -860,15 +861,66 @@
this.adder = $(this.html.adder).appendTo(this.wrapper).hide();
}
Annotator.prototype._setupMatching = function() {
this.domMapper = new DomTextMapper();
this.domMatcher = new DomTextMatcher(this.domMapper);
this.domMapper.setRootNode(this.wrapper[0]);
Annotator.prototype._setupDocumentAccessStrategies = function() {
var _this = this;
this.documentAccessStrategies = [
{
name: "DOM generic",
mapper: DomTextMapper,
init: function() {
return _this.domMapper.setRootNode(_this.wrapper[0]);
}
}
];
return this;
};
Annotator.prototype._setupMapper = function() {
var s, _k, _len2, _ref1,
_this = this;
if (this.domMapper != null) {
return;
}
_ref1 = this.documentAccessStrategies;
for (_k = 0, _len2 = _ref1.length; _k < _len2; _k++) {
s = _ref1[_k];
if (s.mapper.applicable()) {
this.documentAccessStrategy = s;
console.log("Selected document access strategy: " + s.name);
this.domMapper = new s.mapper();
this.anchors = {};
addEventListener("docPageMapped", function(evt) {
return _this._physicallyAnchorPage(evt.pageIndex);
});
addEventListener("docPageUnmapped", function(evt) {
return _this._physicallyUnAnchorPage(evt.pageIndex);
});
if (typeof s.init === "function") {
s.init();
}
return this;
}
}
};
Annotator.prototype._setupVirtualAnchoringStrategies = function() {
this.virtualAnchoringStrategies = [
{
name: "range",
code: this.createVirtualAnchorFromRangeSelector
}, {
name: "position",
code: this.createVirtualAnchorFromPositionSelector
}
];
return this;
};
Annotator.prototype._scan = function() {
return this.domMatcher.scan();
if (!this.domMapper) {
this._setupMapper();
}
return this.pendingScan = this.domMapper.scan();
};
Annotator.prototype._setupWrapper = function() {
......@@ -988,7 +1040,7 @@
throw new Error("Called getTextQuoteSelector(range) on a range with no valid end.");
}
endOffset = (this.domMapper.getInfoForNode(rangeEnd)).end;
quote = this.domMapper.getContentForCharRange(startOffset, endOffset);
quote = this.domMapper.getCorpus().slice(startOffset, +(endOffset - 1) + 1 || 9e9).trim();
_ref1 = this.domMapper.getContextForCharRange(startOffset, endOffset), prefix = _ref1[0], suffix = _ref1[1];
return selector = {
type: "TextQuoteSelector",
......@@ -1082,170 +1134,90 @@
return null;
};
Annotator.prototype.findAnchorFromRangeSelector = function(target) {
var content, currentQuote, endInfo, endOffset, normalizedRange, savedQuote, selector, startInfo, startOffset;
Annotator.prototype.createVirtualAnchorFromRangeSelector = function(target) {
var content, currentQuote, endInfo, endOffset, error, normalizedRange, savedQuote, selector, startInfo, startOffset, _ref1, _ref2;
selector = this.findSelector(target.selector, "RangeSelector");
if (selector == null) {
return null;
}
normalizedRange = Range.sniff(selector).normalize(this.wrapper[0]);
try {
normalizedRange = Range.sniff(selector).normalize(this.wrapper[0]);
} catch (_error) {
error = _error;
return null;
}
startInfo = this.domMapper.getInfoForNode(normalizedRange.start);
startOffset = startInfo.start;
endInfo = this.domMapper.getInfoForNode(normalizedRange.end);
endOffset = endInfo.end;
content = this.domMapper.getCorpus().slice(startOffset, +(endOffset - 1) + 1 || 9e9).trim();
currentQuote = this.normalizeString(content);
savedQuote = this.getQuoteForTarget(target);
if (savedQuote != null) {
startInfo = this.domMapper.getInfoForNode(normalizedRange.start);
startOffset = startInfo.start;
endInfo = this.domMapper.getInfoForNode(normalizedRange.end);
endOffset = endInfo.end;
content = this.domMapper.getContentForCharRange(startOffset, endOffset);
currentQuote = this.normalizeString(content);
if (currentQuote !== savedQuote) {
console.log("Could not apply XPath selector to current document because the quote has changed. (Saved quote is '" + savedQuote + "'. Current quote is '" + currentQuote + "'.)");
return null;
} else {
}
} else {
console.log("No saved quote, nothing to compare. Assume that it's OK.");
if ((savedQuote != null) && currentQuote !== savedQuote) {
return null;
}
return {
range: normalizedRange,
quote: savedQuote
startPage: (_ref1 = startInfo.pageIndex) != null ? _ref1 : 0,
start: startInfo.start,
endPage: (_ref2 = endInfo.pageIndex) != null ? _ref2 : 0,
end: endInfo.end,
quote: currentQuote
};
};
Annotator.prototype.findAnchorFromPositionSelector = function(target) {
var browserRange, content, currentQuote, mappings, normalizedRange, savedQuote, selector;
Annotator.prototype.createVirtualAnchorFromPositionSelector = function(target) {
var content, currentQuote, savedQuote, selector;
selector = this.findSelector(target.selector, "TextPositionSelector");
if (selector == null) {
return null;
}
content = this.domMapper.getCorpus().slice(selector.start, +(selector.end - 1) + 1 || 9e9).trim();
currentQuote = this.normalizeString(content);
savedQuote = this.getQuoteForTarget(target);
if (savedQuote != null) {
content = this.domMapper.getContentForCharRange(selector.start, selector.end);
currentQuote = this.normalizeString(content);
if (currentQuote !== savedQuote) {
console.log("Could not apply position selector" + (" [" + selector.start + ":" + selector.end + "] to current document,") + " because the quote has changed." + ("(Saved quote is '" + savedQuote + "'.") + (" Current quote is '" + currentQuote + "'.)"));
return null;
} else {
}
} else {
console.log("No saved quote, nothing to compare. Assume that it's okay.");
}
mappings = this.domMapper.getMappingsForCharRange(selector.start, selector.end);
browserRange = new Range.BrowserRange(mappings.realRange);
normalizedRange = browserRange.normalize(this.wrapper[0]);
return {
range: normalizedRange,
quote: savedQuote
};
};
Annotator.prototype.findAnchorWithTwoPhaseFuzzyMatching = function(target) {
var anchor, browserRange, expectedEnd, expectedStart, match, normalizedRange, options, posSelector, prefix, quote, quoteSelector, result, suffix;
quoteSelector = this.findSelector(target.selector, "TextQuoteSelector");
prefix = quoteSelector != null ? quoteSelector.prefix : void 0;
suffix = quoteSelector != null ? quoteSelector.suffix : void 0;
quote = quoteSelector != null ? quoteSelector.exact : void 0;
if (!((prefix != null) && (suffix != null))) {
if ((savedQuote != null) && currentQuote !== savedQuote) {
return null;
}
posSelector = this.findSelector(target.selector, "TextPositionSelector");
expectedStart = posSelector != null ? posSelector.start : void 0;
expectedEnd = posSelector != null ? posSelector.end : void 0;
options = {
contextMatchDistance: this.domMapper.getDocLength() * 2,
contextMatchThreshold: 0.5,
patternMatchThreshold: 0.5,
flexContext: true
};
result = this.domMatcher.searchFuzzyWithContext(prefix, suffix, quote, expectedStart, expectedEnd, false, null, options);
if (!result.matches.length) {
console.log("Fuzzy matching did not return any results. Giving up on two-phase strategy.");
return null;
}
match = result.matches[0];
console.log("2-phase fuzzy found match:");
console.log(match);
browserRange = new Range.BrowserRange(match.realRange);
normalizedRange = browserRange.normalize(this.wrapper[0]);
anchor = {
range: normalizedRange,
quote: !match.exact ? match.found : void 0,
diffHTML: !match.exact ? match.comparison.diffHTML : void 0,
diffCaseOnly: !match.exact ? match.exactExceptCase : void 0
};
return anchor;
};
Annotator.prototype.findAnchorWithFuzzyMatching = function(target) {
var anchor, browserRange, expectedStart, len, match, normalizedRange, options, posSelector, quote, quoteSelector, result;
quoteSelector = this.findSelector(target.selector, "TextQuoteSelector");
quote = quoteSelector != null ? quoteSelector.exact : void 0;
if (quote == null) {
return null;
}
if (!(quote.length >= 32)) {
return;
}
posSelector = this.findSelector(target.selector, "TextPositionSelector");
expectedStart = posSelector != null ? posSelector.start : void 0;
len = this.domMapper.getDocLength();
if (expectedStart == null) {
expectedStart = len / 2;
}
options = {
matchDistance: len * 2,
withFuzzyComparison: true
};
result = this.domMatcher.searchFuzzy(quote, expectedStart, false, null, options);
if (!result.matches.length) {
console.log("Fuzzy matching did not return any results. Giving up on one-phase strategy.");
return null;
}
match = result.matches[0];
console.log("1-phase fuzzy found match:");
console.log(match);
browserRange = new Range.BrowserRange(match.realRange);
normalizedRange = browserRange.normalize(this.wrapper[0]);
anchor = {
range: normalizedRange,
quote: !match.exact ? match.found : void 0,
diffHTML: !match.exact ? match.comparison.diffHTML : void 0,
diffCaseOnly: !match.exact ? match.exactExceptCase : void 0
return {
startPage: this.domMapper.getPageIndexForPos(selector.start),
endPage: this.domMapper.getPageIndexForPos(selector.end),
start: selector.start,
end: selector.end,
quote: currentQuote
};
return anchor;
};
Annotator.prototype.findAnchor = function(target) {
var anchor, error, strategies, _k, _len2;
Annotator.prototype.createVirtualAnchor = function(target) {
var a, anchor, error, s, _k, _len2, _ref1;
if (target == null) {
throw new Error("Trying to find anchor for null target!");
}
strategies = [this.findAnchorFromRangeSelector, this.findAnchorFromPositionSelector, this.findAnchorWithTwoPhaseFuzzyMatching, this.findAnchorWithFuzzyMatching];
error = null;
anchor = null;
for (_k = 0, _len2 = strategies.length; _k < _len2; _k++) {
fn = strategies[_k];
_ref1 = this.virtualAnchoringStrategies;
for (_k = 0, _len2 = _ref1.length; _k < _len2; _k++) {
s = _ref1[_k];
try {
if (anchor == null) {
anchor = fn.call(this, target);
a = s.code.call(this, target);
if (a) {
return {
result: a
};
}
} catch (_error) {
error = _error;
if (!(error instanceof Range.RangeError)) {
if (error instanceof Range.RangeError) {
return {
error: error
};
} else {
throw error;
}
}
}
return {
error: error,
anchor: anchor
};
};
Annotator.prototype.setupAnnotation = function(annotation) {
var anchor, error, exception, normed, normedRanges, r, ranges, root, t, _k, _l, _len2, _len3, _ref1, _ref2;
root = this.wrapper[0];
var anchor, exception, pageIndex, r, ranges, result, t, vAnchor, _base, _k, _l, _len2, _ref1, _ref2, _ref3;
ranges = annotation.ranges || this.selectedRanges || [];
if (annotation.ranges != null) {
delete annotation.ranges;
......@@ -1262,22 +1234,40 @@
if (annotation.target == null) {
throw new Error("Can not run setupAnnotation(). No target or selection available.");
}
normedRanges = [];
annotation.quote = [];
annotation.anchors = [];
annotation.ranges = [];
annotation.highlights = [];
_ref1 = annotation.target;
for (_k = 0, _len2 = _ref1.length; _k < _len2; _k++) {
t = _ref1[_k];
try {
_ref2 = this.findAnchor(t), anchor = _ref2.anchor, error = _ref2.error;
if (error instanceof Range.RangeError) {
this.publish('rangeNormalizeFail', [annotation, error.range, error]);
result = this.createVirtualAnchor(t);
vAnchor = result.result;
if ((result.error != null) instanceof Range.RangeError) {
this.publish('rangeNormalizeFail', [annotation, result.error.range, result.error]);
}
if (anchor != null) {
t.quote = anchor.quote || $.trim(anchor.range.text());
t.diffHTML = anchor.diffHTML;
t.diffCaseOnly = anchor.diffCaseOnly;
normedRanges.push(anchor.range);
annotation.quote.push(t.quote);
if (vAnchor != null) {
annotation.quote.push(t.quote = vAnchor.quote);
delete vAnchor.quote;
t.diffHTML = vAnchor.diffHTML;
delete vAnchor.diffHTML;
t.diffCaseOnly = vAnchor.diffCaseOnly;
delete vAnchor.diffCaseOnly;
anchor = {
annotation: annotation,
target: t,
virtual: vAnchor,
physical: {}
};
annotation.anchors.push(anchor);
for (pageIndex = _l = _ref2 = vAnchor.startPage, _ref3 = vAnchor.endPage; _ref2 <= _ref3 ? _l <= _ref3 : _l >= _ref3; pageIndex = _ref2 <= _ref3 ? ++_l : --_l) {
if ((_base = this.anchors)[pageIndex] == null) {
_base[pageIndex] = [];
}
this.anchors[pageIndex].push(anchor);
}
this._physicallyAnchor(anchor);
} else {
console.log("Could not find anchor target for annotation '" + annotation.id + "'.");
}
......@@ -1290,15 +1280,7 @@
console.log(exception);
}
}
annotation.ranges = [];
annotation.highlights = [];
for (_l = 0, _len3 = normedRanges.length; _l < _len3; _l++) {
normed = normedRanges[_l];
annotation.ranges.push(normed.serialize(this.wrapper[0], '.annotator-hl'));
$.merge(annotation.highlights, this.highlightRange(normed));
}
annotation.quote = annotation.quote.join(' / ');
$(annotation.highlights).data('annotation', annotation);
return annotation;
};
......@@ -1309,17 +1291,17 @@
};
Annotator.prototype.deleteAnnotation = function(annotation) {
var child, h, _k, _len2, _ref1;
if (annotation.highlights != null) {
_ref1 = annotation.highlights;
var a, data, page, _k, _len2, _ref1, _ref2;
if (annotation.anchors != null) {
_ref1 = annotation.anchors;
for (_k = 0, _len2 = _ref1.length; _k < _len2; _k++) {
h = _ref1[_k];
if (!(h.parentNode != null)) {
continue;
a = _ref1[_k];
_ref2 = a.physical;
for (page in _ref2) {
data = _ref2[page];
this._physicallyUnAnchor(a, page);
}
child = h.childNodes[0];
$(h).replaceWith(h.childNodes);
window.DomTextMapper.changed(child.parentNode, "removed hilite (annotation deleted)");
this._removeAnchor(a);
}
}
this.publish('annotationDeleted', [annotation]);
......@@ -1352,7 +1334,15 @@
};
clone = annotations.slice();
if (annotations.length) {
loader(annotations);
if (this.pendingScan != null) {
this.pendingScan.then(function() {
return setTimeout(function() {
return loader(annotations);
});
});
} else {
loader(annotations);
}
}
return this;
};
......@@ -1567,6 +1557,112 @@
return this.deleteAnnotation(annotation);
};
Annotator.prototype._removeAnchor = function(anchor) {
var i, index, _k, _ref1, _ref2, _ref3, _results;
_results = [];
for (index = _k = _ref1 = anchor.virtual.startPage, _ref2 = anchor.virtual.endPage; _ref1 <= _ref2 ? _k <= _ref2 : _k >= _ref2; index = _ref1 <= _ref2 ? ++_k : --_k) {
i = this.anchors[index].indexOf(anchor);
[].splice.apply(this.anchors[index], [i, i - i + 1].concat(_ref3 = [])), _ref3;
if (!this.anchors[index].length) {
_results.push(delete this.anchors[index]);
} else {
_results.push(void 0);
}
}
return _results;
};
Annotator.prototype._physicallyAnchor = function(anchor) {
var browserRange, highlights, mappings, pAnchor, page, pagesTodo, range, renderedPages, section, serializedRange, vAnchor, _k, _ref1, _ref2, _ref3, _results,
_this = this;
if (anchor.allRendered) {
return;
}
vAnchor = anchor.virtual;
pAnchor = anchor.physical;
renderedPages = (function() {
_results = [];
for (var _k = _ref1 = vAnchor.startPage, _ref2 = vAnchor.endPage; _ref1 <= _ref2 ? _k <= _ref2 : _k >= _ref2; _ref1 <= _ref2 ? _k++ : _k--){ _results.push(_k); }
return _results;
}).apply(this).filter(function(index) {
return _this.domMapper.isPageMapped(index);
});
pagesTodo = renderedPages.filter(function(index) {
return pAnchor[index] == null;
});
if (!pagesTodo.length) {
return;
}
mappings = this.domMapper.getMappingsForCharRange(vAnchor.start, vAnchor.end, pagesTodo);
_ref3 = mappings.sections;
for (page in _ref3) {
section = _ref3[page];
browserRange = new Range.BrowserRange(section.realRange);
range = browserRange.normalize(this.wrapper[0]);
serializedRange = range.serialize(this.wrapper[0], '.annotator-hl');
anchor.annotation.ranges.push(serializedRange);
highlights = this.highlightRange(range);
$(highlights).data('annotation', anchor.annotation);
$.merge(anchor.annotation.highlights, highlights);
pAnchor[page] = {
range: serializedRange,
highlights: highlights
};
}
anchor.allRendered = renderedPages.length === vAnchor.endPage - vAnchor.startPage + 1;
return this.publish('annotationPhysicallyAnchored', anchor);
};
Annotator.prototype._physicallyAnchorPage = function(index) {
var anchor, anchors, _k, _len2, _results;
anchors = this.anchors[index];
if (!((anchors != null) && this.domMapper.isPageMapped(index))) {
return;
}
_results = [];
for (_k = 0, _len2 = anchors.length; _k < _len2; _k++) {
anchor = anchors[_k];
_results.push(this._physicallyAnchor(anchor));
}
return _results;
};
Annotator.prototype._physicallyUnAnchor = function(anchor, pageIndex) {
var ann, child, data, hl, i, _k, _len2, _ref1, _ref2, _ref3;
data = anchor.physical[pageIndex];
if (data == null) {
return;
}
ann = anchor.annotation;
i = ann.ranges.indexOf(data.range);
[].splice.apply(ann.ranges, [i, i - i + 1].concat(_ref1 = [])), _ref1;
_ref2 = data.highlights;
for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {
hl = _ref2[_k];
if ((hl.parentNode != null) && this.domMapper.isPageMapped(pageIndex)) {
child = hl.childNodes[0];
$(hl).replaceWith(hl.childNodes);
window.DomTextMapper.changed(child.parentNode, "removed hilite (annotation deleted)");
}
i = ann.highlights.indexOf(hl);
[].splice.apply(ann.highlights, [i, i - i + 1].concat(_ref3 = [])), _ref3;
}
delete anchor.physical[pageIndex];
anchor.allRendered = false;
return this.publish('annotationPhysicallyUnAnchored', anchor);
};
Annotator.prototype._physicallyUnAnchorPage = function(index) {
var anchor, _k, _len2, _ref1, _ref2, _results;
_ref2 = (_ref1 = this.anchors[index]) != null ? _ref1 : [];
_results = [];
for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {
anchor = _ref2[_k];
_results.push(this._physicallyUnAnchor(anchor, index));
}
return _results;
};
return Annotator;
})(Delegator);
......
{"version":3,"file":"annotator.js","sources":["_preamble.coffee","_annotator_mapsrc/src/xpath.coffee","_annotator_mapsrc/src/extensions.coffee","_annotator_mapsrc/src/console.coffee","_annotator_mapsrc/src/class.coffee","_annotator_mapsrc/src/range.coffee","_annotator_mapsrc/src/annotator.coffee","_annotator_mapsrc/src/widget.coffee","_annotator_mapsrc/src/editor.coffee","_annotator_mapsrc/src/viewer.coffee","_annotator_mapsrc/src/notification.coffee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S,IAAT,CAAA;CADF,KAAA;;CAAA,EAKE,IADF;CACE,CAAM,EAAN,EAAA,gCAAA;CAAA,CAEE,IADF,CAAA;CACE,CAAS,EAAT,IAAA,eAAA;CAAA,CACS,EAAT,IAAA,eADA;CAAA,CAES,KAAT,CAAA,kBAFA;CAAA,CAGS,GAAT,GAAA,gBAHA;QAFF;CALF,KAAA;;CA0Ba,EAAA,CAAA,GAAA,eAAC;CACZ,kCAAA;CAAA,kCAAA;CAAA,CAAmD,EAA1C,EAAT,CAAgB,CAAV,sCAAA;CA3BR,IA0Ba;;CA1Bb,CA6CgB,CAAV,CAAN,EAAM,CAAA,EAAC;;CAA0B,EAAV,KAAP,CAAgB,GAAa;QAC3C;CAAA,CAGQ,EAHL,EAAH,CAAA,CAAA;CAAA,CAKsB,EAAP,EAAf,IAAA;CANI,YAOJ;CApDF,IA6CM;;CA7CN,EA8DM,CAAN,KAAM;CACJ,GAAG,EAAH,CAAA,IAAA;CADI,YAEJ;CAhEF,IA8DM;;CA9DN;;CAHmC;;CTLrC,CS4EA,CAAiC,CAAjC,ET5EA,GS4ES,GAAa;;CT5EtB,CS6EA,CAAiC,IAAjC,EAAS,GAAa;;CT7EtB,CS8EA,CAAiC,EAAjC,ET9EA,ES8ES,GAAa;;CT9EtB,CSiFA,CAAE,MAAA;CACA,OAAA,IAAA;AAAe,CAAf,EAAe,CAAf,KAA4B,GAA5B;CAAA,EAE6B,CAA7B,KAAS,GAAgC,IAAzC;CACU,EAAmB,MAApB,EAAT,CAAyC,IAAzC;CAJF,EAAE;CTjFF"}
\ No newline at end of file
{"version":3,"file":"annotator.js","sources":["_preamble.coffee","_annotator_mapsrc/src/xpath.coffee","_annotator_mapsrc/src/extensions.coffee","_annotator_mapsrc/src/console.coffee","_annotator_mapsrc/src/class.coffee","_annotator_mapsrc/src/range.coffee","_annotator_mapsrc/src/annotator.coffee","_annotator_mapsrc/src/widget.coffee","_annotator_mapsrc/src/editor.coffee","_annotator_mapsrc/src/viewer.coffee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AA,EACE,GADF;CACE,CAAS,IAAT,CAAA;CADF,KAAA;;CAAA,EAKE,IADF;CACE,CAAM,EAAN,EAAA,gCAAA;CAAA,CAEE,IADF,CAAA;CACE,CAAS,EAAT,IAAA,eAAA;CAAA,CACS,EAAT,IAAA,eADA;CAAA,CAES,KAAT,CAAA,kBAFA;CAAA,CAGS,GAAT,GAAA,gBAHA;QAFF;CALF,KAAA;;CA0Ba,EAAA,CAAA,GAAA,eAAC;CACZ,kCAAA;CAAA,kCAAA;CAAA,CAAmD,EAA1C,EAAT,CAAgB,CAAV,sCAAA;CA3BR,IA0Ba;;CA1Bb,CA6CgB,CAAV,CAAN,EAAM,CAAA,EAAC;;CAA0B,EAAV,KAAP,CAAgB,GAAa;QAC3C;CAAA,CAGQ,EAHL,EAAH,CAAA,CAAA;CAAA,CAKsB,EAAP,EAAf,IAAA;CANI,YAOJ;CApDF,IA6CM;;CA7CN,EA8DM,CAAN,KAAM;CACJ,GAAG,EAAH,CAAA,IAAA;CADI,YAEJ;CAhEF,IA8DM;;CA9DN;;CAHmC;;CTLrC,CS4EA,CAAiC,CAAjC,ET5EA,GS4ES,GAAa;;CT5EtB,CS6EA,CAAiC,IAAjC,EAAS,GAAa;;CT7EtB,CS8EA,CAAiC,EAAjC,ET9EA,ES8ES,GAAa;;CT9EtB,CSiFA,CAAE,MAAA;CACA,OAAA,IAAA;AAAe,CAAf,EAAe,CAAf,KAA4B,GAA5B;CAAA,EAE6B,CAA7B,KAAS,GAAgC,IAAzC;CACU,EAAmB,MAApB,EAAT,CAAyC,IAAzC;CAJF,EAAE;CTjFF"}
\ No newline at end of file
// Generated by CoffeeScript 1.6.3
/*
** Annotator 1.2.6-dev-f1e08bd
** https://github.com/okfn/annotator/
**
** Copyright 2012 Aron Carroll, Rufus Pollock, and Nick Stenning.
** Dual licensed under the MIT and GPLv3 licenses.
** https://github.com/okfn/annotator/blob/master/LICENSE
**
** Built at: 2013-11-12 02:02:48Z
*/
/*
//
*/
// Generated by CoffeeScript 1.6.3
(function() {
var _ref,
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
window.PDFTextMapper = (function(_super) {
__extends(PDFTextMapper, _super);
PDFTextMapper.applicable = function() {
var _ref;
return (_ref = typeof PDFView !== "undefined" && PDFView !== null ? PDFView.initialized : void 0) != null ? _ref : false;
};
PDFTextMapper.prototype.requiresSmartStringPadding = true;
PDFTextMapper.prototype.getPageCount = function() {
return PDFView.pages.length;
};
PDFTextMapper.prototype.getPageIndex = function() {
return PDFView.page - 1;
};
PDFTextMapper.prototype.setPageIndex = function(index) {
return PDFView.page = index + 1;
};
PDFTextMapper.prototype._isPageRendered = function(index) {
var _ref, _ref1;
return (_ref = PDFView.pages[index]) != null ? (_ref1 = _ref.textLayer) != null ? _ref1.renderingDone : void 0 : void 0;
};
PDFTextMapper.prototype.getRootNodeForPage = function(index) {
return PDFView.pages[index].textLayer.textLayerDiv;
};
function PDFTextMapper() {
this._parseExtractedText = __bind(this._parseExtractedText, this);
this.setEvents();
}
PDFTextMapper.prototype.setEvents = function() {
var _this = this;
addEventListener("pagerender", function(evt) {
var index;
index = evt.detail.pageNumber - 1;
return _this._onPageRendered(index);
});
addEventListener("DOMNodeRemoved", function(evt) {
var index, node;
node = evt.target;
if (node.nodeType === Node.ELEMENT_NODE && node.nodeName.toLowerCase() === "div" && node.className === "textLayer") {
index = parseInt(node.parentNode.id.substr(13) - 1);
return _this._unmapPage(_this.pageInfo[index]);
}
});
return window.DomTextMapper.instances.push({
id: "cross-page catcher",
rootNode: document.getElementById("viewer"),
performUpdateOnNode: function(node, data) {
var endPage, index, startPage, _i, _ref, _ref1, _results;
if ("viewer" === (typeof node.getAttribute === "function" ? node.getAttribute("id") : void 0)) {
if ((data.start != null) && (data.end != null)) {
startPage = _this.getPageForNode(data.start);
endPage = _this.getPageForNode(data.end);
_results = [];
for (index = _i = _ref = startPage.index, _ref1 = endPage.index; _ref <= _ref1 ? _i <= _ref1 : _i >= _ref1; index = _ref <= _ref1 ? ++_i : --_i) {
_results.push(_this._updateMap(_this.pageInfo[index]));
}
return _results;
}
}
},
documentChanged: function() {},
timestamp: function() {}
});
};
PDFTextMapper.prototype._extractionPattern = /[ ]+/g;
PDFTextMapper.prototype._parseExtractedText = function(text) {
return text.replace(this._extractionPattern, " ");
};
PDFTextMapper.prototype.scan = function() {
var pendingScan,
_this = this;
console.log("Scanning document for text...");
pendingScan = new PDFJS.Promise();
PDFFindController.extractText();
PDFJS.Promise.all(PDFFindController.extractTextPromises).then(function() {
var page;
_this.pageInfo = (function() {
var _i, _len, _ref, _results;
_ref = PDFFindController.pageContents;
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
page = _ref[_i];
_results.push({
content: this._parseExtractedText(page)
});
}
return _results;
}).call(_this);
_this._onHavePageContents();
pendingScan.resolve();
return _this._onAfterScan();
});
return pendingScan;
};
PDFTextMapper.prototype.getPageForNode = function(node) {
var div, index;
div = node;
while ((div.nodeType !== Node.ELEMENT_NODE) || (div.getAttribute("class") == null) || (div.getAttribute("class") !== "textLayer")) {
div = div.parentNode;
}
index = parseInt(div.parentNode.id.substr(13) - 1);
return this.pageInfo[index];
};
return PDFTextMapper;
})(window.PageTextMapperCore);
Annotator.Plugin.PDF = (function(_super) {
__extends(PDF, _super);
function PDF() {
_ref = PDF.__super__.constructor.apply(this, arguments);
return _ref;
}
PDF.prototype.pluginInit = function() {
return this.annotator.documentAccessStrategies.unshift({
name: "PDF.js",
mapper: PDFTextMapper
});
};
return PDF;
})(Annotator.Plugin);
}).call(this);
//
//@ sourceMappingURL=annotator.pdf.map
\ No newline at end of file
{"version":3,"file":"annotator.pdf.js","sources":["_preamble.coffee","_annotator_mapsrc/src/plugin/pdf.coffee"],"names":[],"mappings":";A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;;;;CAAA;;CAAA,EAAY,MAAA,CAAZ;CACG,GAAA,GAAD,EAAU,IAAV,WAAmC;CAEjC,CAAM,EAAN,IAAA;CAAA,CACQ,IAAR,EAAA,KADA;CAHQ,OACV;CADF,IAAY;;CAAZ;;CAFiC,QAAS;CAhH5C"}
\ No newline at end of file
......@@ -9,17 +9,27 @@ class window.DomTextMapper
@instances: []
@changed: (node, reason = "no reason") ->
@changed: (node, reason = "no reason", data = {}) ->
if @instances.length is 0 then return
# dm = @instances[0]
# console.log "Node @ " + (dm.getPathTo node) + " has changed: " + reason
# console.log "==== Node"
# console.log node
# console.log "has changed: " + reason
# console.log data
for instance in @instances when instance.rootNode.contains(node)
instance.performUpdateOnNode node
# console.log "Telling instance '" + instance.id + "'."
instance.documentChanged()
instance.performUpdateOnNode node, false, data
instance.lastScanned = instance.timestamp()
null
constructor: ->
constructor: (@id)->
@setRealRoot()
window.DomTextMapper.instances.push this
instances = window.DomTextMapper.instances
instances.push this
@id ?= "d-t-m #" + instances.length
log: (msg) ->
console.log @id + ": " + msg
# ===== Public methods =======
......@@ -69,7 +79,10 @@ class window.DomTextMapper
# anythime, and therefore will not assume any stability.
documentChanged: ->
@lastDOMChange = @timestamp()
# console.log "Registered document change."
# @log "Registered document change."
setExpectedContent: (content) ->
@expectedContent = content
# Scan the document
#
......@@ -85,6 +98,7 @@ class window.DomTextMapper
# length: the length of the next content
scan: ->
if @domStableSince @lastScanned
<<<<<<< HEAD
# We have a valid paths structure!
# console.log "We have a valid DOM structure cache."
return
......@@ -92,26 +106,38 @@ class window.DomTextMapper
unless @pathStartNode.ownerDocument.body.contains @pathStartNode
# We cannot map nodes that are not attached.
# console.log "This is not attached to dom. Exiting."
=======
# @log "We have a valid DOM structure cache."
return
else
# @log "Last scan time: " + @lastScanned
# @log "Last DOM change: " + @lastDOMChange
# @log "No valid DOM structure scan available, doing scan."
unless @pathStartNode.ownerDocument.body.contains @pathStartNode
# We cannot map nodes that are not attached.
# @log "This is not attached to dom. Exiting."
>>>>>>> Updated libraries for PDF support
return
# console.log "No valid cache, will have to do a scan."
# @log "No valid cache, will have to do a scan."
startTime = @timestamp()
@saveSelection()
@path = {}
@traverseSubTree @pathStartNode, @getDefaultPath()
t1 = @timestamp()
# console.log "Phase I (Path traversal) took " + (t1 - startTime) + " ms."
# @log "Phase I (Path traversal) took " + (t1 - startTime) + " ms."
path = @getPathTo @pathStartNode
node = @path[path].node
@collectPositions node, path, null, 0, 0
@restoreSelection()
@lastScanned = @timestamp()
@corpus = @path[path].content
# console.log "Corpus is: " + @corpus
@_corpus = @path[path].content
# @log "Corpus is: " + @_corpus
t2 = @timestamp()
# console.log "Phase II (offset calculation) took " + (t2 - t1) + " ms."
# @log "Phase II (offset calculation) took " + (t2 - t1) + " ms."
null
......@@ -135,13 +161,13 @@ class window.DomTextMapper
@performUpdateOnNode node.parentNode, true
unless escalating then @restoreSelection()
return
# console.log "Performing update on node @ path " + path
# @log "Performing update on node @ path " + path
# if escalating then console.log "(Escalated)"
# console.log "Updating data about " + path + ": "
# if escalating then @log "(Escalated)"
# @log "Updating data about " + path + ": "
if pathInfo.node is node and pathInfo.content is @getNodeContent node, false
# console.log "Good, the node and the overall content is still the same"
# console.log "Dropping obsolete path info for children..."
# @log "Good, the node and the overall content is still the same"
# @log "Dropping obsolete path info for children..."
prefix = path + "/"
pathsToDrop =p
......@@ -152,13 +178,13 @@ class window.DomTextMapper
for p in pathsToDrop
delete @path[p]
# console.log "Done. Collecting new path info..."
# @log "Done. Collecting new path info..."
@traverseSubTree node, path
# console.log "Done. Updating mappings..."
# @log "Done. Updating mappings..."
if pathInfo.node is @pathStartNode
console.log "Ended up rescanning the whole doc."
# @log "Ended up rescanning the whole doc."
@collectPositions node, path, null, 0, 0
else
parentPath = @parentPath path
......@@ -173,18 +199,18 @@ class window.DomTextMapper
@collectPositions node, path, parentPathInfo.content,
parentPathInfo.start, oldIndex
# console.log "Data update took " + (@timestamp() - startTime) + " ms."
# @log "Data update took " + (@timestamp() - startTime) + " ms."
else
# console.log "Hm..node has been replaced, or overall content has changed!"
# @log "Hm..node has been replaced, or overall content has changed!"
if pathInfo.node isnt @pathStartNode
# console.log "I guess I must go up one level."
# @log "I guess I must go up one level."
parentNode = if node.parentNode?
# console.log "Node has parent, using that."
# @log "Node has parent, using that."
node.parentNode
else
parentPath = @parentPath path
# console.log "Node has no parent, will look up " + parentPath
# @log "Node has no parent, will look up " + parentPath
@lookUpNode parentPath
@performUpdateOnNode parentNode, true
else
......@@ -208,13 +234,9 @@ class window.DomTextMapper
@getInfoForPath @getPathTo node
# Get the matching DOM elements for a given set of charRanges
# (Calles getMappingsForCharRange for each element in the givenl ist)
# (Calles getMappingsForCharRange for each element in the given ist)
getMappingsForCharRanges: (charRanges) ->
# console.log "charRanges:"
# console.log charRanges
(for charRange in charRanges
mapping = @getMappingsForCharRange charRange.start, charRange.end
)
(@getMappingsForCharRange charRange.start, charRange.end) for charRange in charRanges
# Return the rendered value of a part of the dom.
# If path is not given, the default path is used.
......@@ -228,22 +250,16 @@ class window.DomTextMapper
path ?= @getDefaultPath()
@path[path].length
getDocLength: -> @getLengthForPath()
getDocLength: -> @_corpus.length
# Return a given charRange of the rendered value of a part of the dom.
# If path is not given, the default path is used.
getContentForCharRange: (start, end, path = null) ->
text = @getContentForPath(path).substr start, end - start
text.trim()
getCorpus: -> @_corpus
# Get the context that encompasses the given charRange
# in the rendered text of the document
getContextForCharRange: (start, end, path = null) ->
content = @getContentForPath path
getContextForCharRange: (start, end) ->
prefixStart = Math.max 0, start - CONTEXT_LEN
prefixLen = start - prefixStart
prefix = content.substr prefixStart, prefixLen
suffix = content.substr end, prefixLen
prefix = @_corpus[prefixStart .. start - 1]
suffix = @_corpus[end .. end + CONTEXT_LEN - 1]
[prefix.trim(), suffix.trim()]
# Get the matching DOM elements for a given charRange
......@@ -253,17 +269,18 @@ class window.DomTextMapper
getMappingsForCharRange: (start, end) ->
unless (start? and end?)
throw new Error "start and end is required!"
# console.log "Collecting nodes for [" + start + ":" + end + "]"
# @log "Collecting nodes for [" + start + ":" + end + "]"
@scan()
# Collect the matching path infos
# console.log "Collecting mappings"
# @log "Collecting mappings"
mappings = []
for p, info of @path when info.atomic and
@regions_overlap info.start, info.end, start, end
do (info) =>
# console.log "Checking " + info.path
# console.log info
# @log "Checking " + info.path
# @log info
mapping =
element: info
......@@ -293,28 +310,30 @@ class window.DomTextMapper
mapping.endCorrected - mapping.startCorrected
else if (info.node.nodeType is Node.ELEMENT_NODE) and
(info.node.tagName.toLowerCase() is "img")
console.log "Can not select a sub-string from the title of an image.
@log "Can not select a sub-string from the title of an image.
Selecting all."
mapping.full = true
mapping.wanted = info.content
else
console.log "Warning: no idea how to handle partial mappings
@log "Warning: no idea how to handle partial mappings
for node type " + info.node.nodeType
if info.node.tagName? then console.log "Tag: " + info.node.tagName
console.log "Selecting all."
if info.node.tagName? then @log "Tag: " + info.node.tagName
@log "Selecting all."
mapping.full = true
mapping.wanted = info.content
mappings.push mapping
# console.log "Done with " + info.path
# @log "Done with " + info.path
if mappings.length is 0
@log "Collecting nodes for [" + start + ":" + end + "]"
@log "Should be: '" + @_corpus[ start .. (end-1) ] + "'."
throw new Error "No mappings found for [" + start + ":" + end + "]!"
mappings = mappings.sort (a, b) -> a.element.start - b.element.start
# Create a DOM range object
# console.log "Building range..."
# @log "Building range..."
r = @rootWin.document.createRange()
startMapping = mappings[0]
startNode = startMapping.element.node
......@@ -350,23 +369,27 @@ class window.DomTextMapper
endInfo: endInfo
safeParent: r.commonAncestorContainer
}
# console.log "Done collecting"
result
# Return the result
sections: [result]
# ===== Private methods (never call from outside the module) =======
timestamp: -> new Date().getTime()
stringStartsWith: (string, prefix) ->
prefix is string.substr 0, prefix.length
string[ 0 .. prefix.length - 1 ] is prefix
stringEndsWith: (string, suffix) ->
suffix is string.substr string.length - suffix.length
string[ string.length - suffix.length .. string.length ] is suffix
parentPath: (path) -> path.substr 0, path.lastIndexOf "/"
domChangedSince: (timestamp) ->
if @lastDOMChange? and timestamp? then @lastDOMChange > timestamp else true
if @lastDOMChange? and timestamp?
@lastDOMChange > timestamp
else
true
domStableSince: (timestamp) -> not @domChangedSince timestamp
......@@ -415,14 +438,18 @@ class window.DomTextMapper
length: cont.length
node : node
if cont.length
if verbose then console.log "Collected info about path " + path
if verbose then @log "Collected info about path " + path
if invisible
console.log "Something seems to be wrong. I see visible content @ " +
@log "Something seems to be wrong. I see visible content @ " +
path + ", while some of the ancestor nodes reported empty contents.
Probably a new selection API bug...."
<<<<<<< HEAD
console.log "Anyway, text is '" + cont + "'."
=======
@log "Anyway, text is '" + cont + "'."
>>>>>>> Updated libraries for PDF support
else
if verbose then console.log "Found no content at path " + path
if verbose then @log "Found no content at path " + path
invisible = true
# Step two: cover all children.
......@@ -448,11 +475,11 @@ class window.DomTextMapper
# save the original selection
saveSelection: ->
if @savedSelection?
console.log "Selection saved at:"
console.log @selectionSaved
@log "Selection saved at:"
@log @selectionSaved
throw new Error "Selection already saved!"
sel = @rootWin.getSelection()
# console.log "Saving selection: " + sel.rangeCount + " ranges."
# @log "Saving selection: " + sel.rangeCount + " ranges."
@savedSelection = (sel.getRangeAt i) for i in [0 ... sel.rangeCount]
switch sel.rangeCount
when 0 then @savedSelection ?= []
......@@ -464,7 +491,7 @@ class window.DomTextMapper
# restore selection
restoreSelection: ->
# console.log "Restoring selection: " + @savedSelection.length + " ranges."
# @log "Restoring selection: " + @savedSelection.length + " ranges."
unless @savedSelection? then throw new Error "No selection to restore."
sel = @rootWin.getSelection()
sel.removeAllRanges()
......@@ -523,9 +550,9 @@ class window.DomTextMapper
# If this is the case, then it's OK.
unless USE_EMPTY_TEXT_WORKAROUND and @isWhitespace node
# No, this is not the case. Then this is an error.
console.log "Warning: failed to scan element @ " + @underTraverse
console.log "Content is: " + node.innerHTML
console.log "We won't be able to properly anchor to any text inside this element."
@log "Warning: failed to scan element @ " + @underTraverse
@log "Content is: " + node.innerHTML
@log "We won't be able to properly anchor to any text inside this element."
# throw exception
if scroll
sn = node
......@@ -534,7 +561,7 @@ class window.DomTextMapper
if sn?
sn.scrollIntoViewIfNeeded()
else
console.log "Failed to scroll to element. (Browser does not support scrollIntoViewIfNeeded?)"
@log "Failed to scroll to element. (Browser does not support scrollIntoViewIfNeeded?)"
sel
# Read and convert the text of the current selection.
......@@ -557,23 +584,23 @@ class window.DomTextMapper
# Convert "display" text indices to "source" text indices.
computeSourcePositions: (match) ->
# console.log "In computeSourcePosition"
# console.log match.element.path
# console.log match.element.node.data
# @log "In computeSourcePosition"
# @log match.element.path
# @log match.element.node.data
# the HTML source of the text inside a text element.
# console.log "Calculating source position at " + match.element.path
# @log "Calculating source position at " + match.element.path
sourceText = match.element.node.data.replace /\n/g, " "
# console.log "sourceText is '" + sourceText + "'"
# @log "sourceText is '" + sourceText + "'"
# what gets displayed, when the node is processed by the browser.
displayText = match.element.content
# console.log "displayText is '" + displayText + "'"
# @log "displayText is '" + displayText + "'"
# The selected charRange in displayText.
displayStart = if match.start? then match.start else 0
displayEnd = if match.end? then match.end else displayText.length
# console.log "Display charRange is: " + displayStart + "-" + displayEnd
# @log "Display charRange is: " + displayStart + "-" + displayEnd
if displayEnd is 0
# Handle empty text nodes
......@@ -597,7 +624,7 @@ class window.DomTextMapper
sourceIndex++
match.startCorrected = sourceStart
match.endCorrected = sourceEnd
# console.log "computeSourcePosition done. Corrected charRange is: " +
# @log "computeSourcePosition done. Corrected charRange is: " +
# match.startCorrected + "-" + match.endCorrected
null
......@@ -605,7 +632,11 @@ class window.DomTextMapper
# as render by the browser.
# The current implementation uses the browser selection API to do so.
getNodeContent: (node, shouldRestoreSelection = true) ->
@getNodeSelectionText node, shouldRestoreSelection
if node is @pathStartNode and @expectedContent?
# @log "Returning fake expectedContent for getNodeContent"
@expectedContent
else
@getNodeSelectionText node, shouldRestoreSelection
# Internal function to collect mapping data from a given DOM element.
#
......@@ -627,7 +658,7 @@ class window.DomTextMapper
# the first character offset position in the content of this node's
# parent node that is not accounted for by this node
collectPositions: (node, path, parentContent = null, parentIndex = 0, index = 0) ->
# console.log "Scanning path " + path
# @log "Scanning path " + path
# content = @getNodeContent node, false
pathInfo = @path[path]
......@@ -645,11 +676,11 @@ class window.DomTextMapper
else
index
if startIndex is -1
# content of node is not present in parent's content - probably hidden,
# or something similar
# console.log "Content of this not is not present in content of parent,
# at path " + path
return index
# content of node is not present in parent's content - probably hidden,
# or something similar
@log "Content of this not is not present in content of parent, at path " + path
@log "(Content: '" + content + "'.)"
return index
endIndex = startIndex + content.length
......@@ -694,3 +725,24 @@ class window.DomTextMapper
mightBeEmpty
else false
result
# Internal debug method to verify the consistency of mapping info
_testMap: ->
@log "Verifying map info: was it all properly traversed?"
for i,p of @path
unless p.atomic? then @log i + " is missing data."
@log "Verifying map info: do atomic elements match?"
for i,p of @path when p.atomic
expected = @_corpus[p.start .. (p.end - 1) ]
ok = p.content is expected
unless ok then @log "Mismatch on " + i + ": content is '" + p.content + "', range in corpus is '" + expected + "'."
ok
null
# Fake two-phase / pagination support, used for HTML documents
getPageIndex: -> 0
getPageCount: -> 1
getPageIndexForPos: -> 0
isPageMapped: -> true
# Text search library
class window.DomTextMatcher
# ===== Public methods =======
# Consider only the sub-tree beginning with the given node.
#
# This will be the root node to use for all operations.
setRootNode: (rootNode) -> @mapper.setRootNode rootNode
# Consider only the sub-tree beginning with the node whose ID was given.
#
# This will be the root node to use for all operations.
setRootId: (rootId) -> @mapper.setRootId rootId
# Use this iframe for operations.
#
# Call this when mapping content in an iframe.
setRootIframe: (iframeId) -> @mapper.setRootIframe iframeId
# Work with the whole DOM tree
#
# (This is the default; you only need to call this, if you have configured
# a different root earlier, and now you want to restore the default setting.)
setRealRoot: -> @mapper.setRealRoot()
# Notify the library that the document has changed.
# This means that subsequent calls can not safely re-use previously cached
# data structures, so some calculations will be necessary again.
#
# The usage of this feature is not mandatorry; if not receiving change
# notifications, the library will just assume that the document can change
# anythime, and therefore will not assume any stability.
documentChanged: -> @mapper.documentChanged()
# The available paths which can be searched
#
# An map is returned, where the keys are the paths, and the values hold
# the collected informatino about the given sub-trees of the DOM.
scan: ->
t0 = @timestamp()
data = @mapper.scan()
t1 = @timestamp()
return time: t1 - t0, data: data
# Return the default path
getDefaultPath: -> @mapper.getDefaultPath()
constructor: (@corpus) ->
# Search for text using exact string matching
#
......@@ -54,19 +11,14 @@ class window.DomTextMatcher
#
# caseSensitive: should the search be case sensitive? (defaults to false)
#
# path: the sub-tree inside the DOM you want to search.
# Must be an XPath expression, relative to the configured root node.
# You can check for valid input values using the getAllPaths method above.
# It's not necessary to submit path, if the search was prepared beforehand,
# with the prepareSearch() method
#
# For the details about the returned data structure,
# see the documentation of the search() method.
searchExact: (pattern, distinct = true, caseSensitive = false, path = null) ->
searchExact: (pattern, distinct = true, caseSensitive = false) ->
if not @pm then @pm = new window.DTM_ExactMatcher
@pm.setDistinct(distinct)
@pm.setCaseSensitive(caseSensitive)
@search @pm, pattern, null, path
@_search @pm, pattern
# Search for text using regular expressions
#
......@@ -75,18 +27,12 @@ class window.DomTextMatcher
#
# caseSensitive: should the search be case sensitive? (defaults to false)
#
# path: the sub-tree inside the DOM you want to search.
# Must be an XPath expression, relative to the configured root node.
# You can check for valid input values using the getAllPaths method above.
# It's not necessary to submit path, if the search was prepared beforehand,
# with the prepareSearch() method
#
# For the details about the returned data structure,
# see the documentation of the search() method.
searchRegex: (pattern, caseSensitive = false, path = null) ->
searchRegex: (pattern, caseSensitive = false) ->
if not @rm then @rm = new window.DTM_RegexMatcher
@rm.setCaseSensitive(caseSensitive)
@search @rm, pattern, null, path
@_search @rm, pattern
# Search for text using fuzzy text matching
#
......@@ -102,26 +48,16 @@ class window.DomTextMatcher
# fine-tuning parameters for the d-m-p library.
# See http://code.google.com/p/google-diff-match-patch/wiki/API for details.
#
# path: the sub-tree inside the DOM you want to search.
# Must be an XPath expression, relative to the configured root node.
# You can check for valid input values using the getAllPaths method above.
# It's not necessary to submit path, if the search was prepared beforehand,
# with the prepareSearch() method
#
# For the details about the returned data structure,
# see the documentation of the search() method.
searchFuzzy: (pattern, pos, caseSensitive = false, path = null, options = {}) ->
searchFuzzy: (pattern, pos, caseSensitive = false, options = {}) ->
@ensureDMP()
@dmp.setMatchDistance options.matchDistance ? 1000
@dmp.setMatchThreshold options.matchThreshold ? 0.5
@dmp.setCaseSensitive caseSensitive
@search @dmp, pattern, pos, path, options
# Do some normalization to get a "canonical" form of a string.
# Used to even out some browser differences.
normalizeString: (string) -> string.replace /\s{2,}/g, " "
@_search @dmp, pattern, pos, options
searchFuzzyWithContext: (prefix, suffix, pattern, expectedStart = null, expectedEnd = null, caseSensitive = false, path = null, options = {}) ->
searchFuzzyWithContext: (prefix, suffix, pattern, expectedStart = null, expectedEnd = null, caseSensitive = false, options = {}) ->
@ensureDMP()
# No context, to joy
......@@ -130,7 +66,7 @@ class window.DomTextMatcher
with missing context!"
# Get full document length
len = @mapper.getDocLength()
len = @corpus().length
# Get a starting position for the prefix search
expectedPrefixStart = if expectedStart?
......@@ -141,7 +77,7 @@ class window.DomTextMatcher
# Do the fuzzy search for the prefix
@dmp.setMatchDistance options.contextMatchDistance ? len * 2
@dmp.setMatchThreshold options.contextMatchThreshold ? 0.5
prefixResult = @dmp.search @mapper.corpus, prefix, expectedPrefixStart
prefixResult = @dmp.search @corpus(), prefix, expectedPrefixStart
# If the prefix is not found, give up
unless prefixResult.length then return matches: []
......@@ -166,7 +102,7 @@ class window.DomTextMatcher
64
# Get the part of text that is after the prefix
remainingText = @mapper.corpus.substr prefixEnd
remainingText = @corpus().substr prefixEnd
# Calculate expected position
expectedSuffixStart = patternLength
......@@ -190,7 +126,7 @@ class window.DomTextMatcher
matchThreshold = options.patternMatchThreshold ? 0.5
# See how good a match we have
analysis = @analyzeMatch pattern, charRange, true
analysis = @_analyzeMatch pattern, charRange, true
# Should we try to find a better match by moving the
# initial match around a little bit, even if this has
......@@ -202,7 +138,7 @@ class window.DomTextMatcher
@pm.setDistinct false
@pm.setCaseSensitive false
flexMatches = @pm.search @mapper.corpus[prefixStart..suffixEnd], pattern
flexMatches = @pm.search @corpus()[prefixStart..suffixEnd], pattern
delete candidate
bestError = 2
......@@ -215,12 +151,12 @@ class window.DomTextMatcher
# Check how the prefix would fare
prefixRange = start: prefixStart, end: flexRange.start
a1 = @analyzeMatch prefix, prefixRange, true
a1 = @_analyzeMatch prefix, prefixRange, true
prefixError = if a1.exact then 0 else a1.comparison.errorLevel
# Check how the suffix would fare
suffixRange = start: flexRange.end, end: suffixEnd
a2 = @analyzeMatch suffix, suffixRange, true
a2 = @_analyzeMatch suffix, suffixRange, true
suffixError = if a2.exact then 0 else a2.comparison.errorLevel
# Did we at least one match?
......@@ -237,17 +173,16 @@ class window.DomTextMatcher
if candidate?
console.log "flexContext adjustment: we found a better candidate!"
charRange = candidate
analysis = @analyzeMatch pattern, charRange, true
analysis = @_analyzeMatch pattern, charRange, true
# Do we have to compare what we found to a pattern?
if (not pattern?) or # "No pattern, nothing to compare. Assume it's OK."
analysis.exact or # "Found text matches exactly to pattern"
(analysis.comparison.errorLevel <= matchThreshold) # still acceptable
mappings = @mapper.getMappingsForCharRange charRange.start, charRange.end
# Collect the results
match = {}
for obj in [charRange, analysis, mappings]
for obj in [charRange, analysis]
for k, v of obj
match[k] = v
return matches: [match]
......@@ -256,19 +191,16 @@ class window.DomTextMatcher
# errorLevel + ")"
return matches: []
# ===== Private methods (never call from outside the module) =======
constructor: (domTextMapper) ->
@mapper = domTextMapper
# Do some normalization to get a "canonical" form of a string.
# Used to even out some browser differences.
_normalizeString: (string) -> (string.replace /\s{2,}/g, " ").trim()
# Search for text with a custom matcher object
#
# Parameters:
# matcher: the object to use for doing the plain-text part of the search
# path: the sub-tree inside the DOM you want to search.
# Must be an XPath expression, relative to the configured root node.
# You can check for valid input values using the getAllPaths method above.
# pattern: what to search for
# pos: where do we expect to find it
#
......@@ -280,7 +212,7 @@ class window.DomTextMatcher
# Nodes is the list of matching nodes, with details about the matches.
#
# If no match is found, an empty list is returned.
search: (matcher, pattern, pos, path = null, options = {}) ->
_search: (matcher, pattern, pos, options = {}) ->
# Prepare and check the pattern
unless pattern? then throw new Error "Can't search for null pattern!"
pattern = pattern.trim()
......@@ -288,28 +220,21 @@ class window.DomTextMatcher
fuzzyComparison = options.withFuzzyComparison ? false
# Do some preparation, if required
t0 = @timestamp()
if path? then @scan()
t1 = @timestamp()
# Do the text search
textMatches = matcher.search @mapper.corpus, pattern, pos, options
textMatches = matcher.search @corpus(), pattern, pos, options
t2 = @timestamp()
matches = []
for textMatch in textMatches
do (textMatch) =>
# See how good a match we have
analysis = @analyzeMatch pattern, textMatch, fuzzyComparison
# See how good a match we have
analysis = @_analyzeMatch pattern, textMatch, fuzzyComparison
# Collect the mappings
mappings = @mapper.getMappingsForCharRange textMatch.start,
textMatch.end
# Collect the results
match = {}
for obj in [textMatch, analysis, mappings]
for obj in [textMatch, analysis]
for k, v of obj
match[k] = v
......@@ -319,19 +244,17 @@ class window.DomTextMatcher
result =
matches: matches
time:
phase0_domMapping: t1 - t0
phase1_textMatching: t2 - t1
phase2_matchMapping: t3 - t2
total: t3 - t0
total: t3 - t1
result
timestamp: -> new Date().getTime()
# Read a match returned by the matcher engine, and compare it with the pattern
analyzeMatch: (pattern, charRange, useFuzzy = false) ->
expected = @normalizeString pattern
found = @normalizeString @mapper.getContentForCharRange charRange.start,
charRange.end
_analyzeMatch: (pattern, charRange, useFuzzy = false) ->
expected = @_normalizeString pattern
found = @_normalizeString @corpus()[charRange.start .. charRange.end - 1]
result =
found: found
exact: found is expected
......@@ -353,4 +276,4 @@ class window.DomTextMatcher
unless window.DTM_DMPMatcher?
throw new Error "DTM_DMPMatcher is not available.
Have you loaded the text match engines?"
@dmp = new window.DTM_DMPMatcher
\ No newline at end of file
@dmp = new window.DTM_DMPMatcher
......@@ -268,6 +268,8 @@
else if (null !== (oMatch = cfg.origin.match(/^https?:\/\/(?:[-a-zA-Z0-9_\.])+(?::\d+)?/))) {
cfg.origin = oMatch[0].toLowerCase();
validOrigin = true;
} else if (cfg.origin == "resource://pdf.js") {
validOrigin = true
}
}
......
# Common functions for all page-based document mapper modules
class window.PageTextMapperCore
CONTEXT_LEN: 32
# Get the page index for a given character position
getPageIndexForPos: (pos) ->
for info in @pageInfo
if info.start <= pos < info.end
return info.index
console.log "Not on page " + info.index
return -1
# A new page was rendered
_onPageRendered: (index) =>
#console.log "Allegedly rendered page #" + index
# Is it really rendered?
unless @_isPageRendered index
#console.log "Page #" + index + " is not really rendered yet."
setTimeout (=> @_onPageRendered index), 1000
return
# Collect info about the new DOM subtree
@_mapPage @pageInfo[index]
# Determine whether a given page has been rendered and mapped
isPageMapped: (index) ->
return @pageInfo[index]?.domMapper?
# Create the mappings for a given page
_mapPage: (info) ->
info.node = @getRootNodeForPage info.index
info.domMapper = new DomTextMapper("d-t-m for page #" + info.index)
info.domMapper.setRootNode info.node
info.domMapper.documentChanged()
if @requiresSmartStringPadding
info.domMapper.setExpectedContent info.content
info.domMapper.scan()
renderedContent = info.domMapper.getCorpus()
if renderedContent isnt info.content
console.log "Oops. Mismatch between rendered and extracted text, while mapping page #" + info.index + "!"
console.trace()
console.log "Rendered: " + renderedContent
console.log "Extracted: " + info.content
# Announce the newly available page
setTimeout ->
event = document.createEvent "UIEvents"
event.initUIEvent "docPageMapped", false, false, window, 0
event.pageIndex = info.index
window.dispatchEvent event
# Update the mappings for a given page
_updateMap: (info) ->
#console.log "Updating mappings for page #" + info.index
info.domMapper.scan()
# Delete the mappings for a given page
_unmapPage: (info) ->
delete info.domMapper
# Announce the unavailable page
event = document.createEvent "UIEvents"
event.initUIEvent "docPageUnmapped", false, false, window, 0
event.pageIndex = info.index
window.dispatchEvent event
# Look up info about a give DOM node, uniting page and node info
getInfoForNode: (node) ->
pageData = @getPageForNode node
nodeData = pageData.domMapper.getInfoForNode node
# Copy info about the node
info = {}
for k,v of nodeData
info[k] = v
# Correct the chatacter offsets with that of the page
info.start += pageData.start
info.end += pageData.start
info.pageIndex = pageData.index
info
# Return some data about a given character range
getMappingsForCharRange: (start, end, pages) ->
#console.log "Get mappings for char range [" + start + "; " + end + "], for pages " + pages + "."
# Check out which pages are these on
startIndex = @getPageIndexForPos start
endIndex = @getPageIndexForPos end
#console.log "These are on pages [" + startIndex + ".." + endIndex + "]."
# Function to get the relevant section inside a given page
getSection = (index) =>
info = @pageInfo[index]
# Calculate in-page offsets
realStart = (Math.max info.start, start) - info.start
realEnd = (Math.min info.end, end) - info.start
# Get the range inside the page
mappings = info.domMapper.getMappingsForCharRange realStart, realEnd
mappings.sections[0]
# Get the section for all involved pages
sections = {}
for index in pages ? [startIndex..endIndex]
sections[index] = getSection index
# Return the data
sections: sections
getCorpus: -> @_corpus
getContextForCharRange: (start, end) ->
prefixStart = Math.max 0, start - @CONTEXT_LEN
prefixLen = start - prefixStart
prefix = @_corpus.substr prefixStart, prefixLen
suffix = @_corpus.substr end, @CONTEXT_LEN
[prefix.trim(), suffix.trim()]
# Call this in scan, when you have the page contents
_onHavePageContents: ->
# Join all the text together
@_corpus = (info.content for info in @pageInfo).join " "
# Go over the pages, and calculate some basic info
pos = 0
@pageInfo.forEach (info, i) =>
info.index = i
info.len = info.content.length
info.start = pos
info.end = (pos += info.len + 1)
# Call this in scan, after resolving the promise
_onAfterScan: ->
# Go over the pages again, and map the rendered ones
@pageInfo.forEach (info, i) =>
if @_isPageRendered i
@_mapPage info
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