Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
eb9f9a7d
Commit
eb9f9a7d
authored
Apr 30, 2013
by
Ed Summers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
got basic title metadata extraction working
parent
b0b32c06
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
4 deletions
+21
-4
host.coffee
h/js/host.coffee
+7
-1
document.coffee
h/js/plugin/document.coffee
+9
-3
services.coffee
h/js/services.coffee
+5
-0
No files found.
h/js/host.coffee
View file @
eb9f9a7d
...
...
@@ -64,6 +64,8 @@ class Annotator.Host extends Annotator
parsed
[
k
]
=
v
parsed
this
.
addPlugin
'Document'
# Build a channel for the publish API
@
api
=
Channel
.
build
origin
:
'*'
...
...
@@ -158,6 +160,10 @@ class Annotator.Host extends Annotator
@
drag
.
last
=
null
)
.
bind
(
'getDocumentMetadata'
,
=>
return
@
plugins
.
Document
.
getDocumentMetadata
()
)
scanDocument
:
(
reason
=
"something happened"
)
=>
try
console
.
log
"Analyzing host frame, because "
+
reason
+
"..."
...
...
@@ -263,4 +269,4 @@ class Annotator.Host extends Annotator
addToken
:
(
token
)
=>
@
api
.
notify
method
:
'addToken'
params
:
token
\ No newline at end of file
params
:
token
h/js/plugin/document.coffee
View file @
eb9f9a7d
...
...
@@ -4,9 +4,15 @@ class Annotator.Plugin.Document extends Annotator.Plugin
'beforeAnnotationCreated'
:
'beforeAnnotationCreated'
pluginInit
:
->
console
.
log
"initializing Document plugin!"
@
metadata
=
null
beforeAnnotationCreated
:
(
annotation
)
=>
debugger
alert
"creating annotation
#{
annotation
}
"
if
not
@
metadata
@
metadata
=
this
.
getDocumentMetadata
()
annotation
.
document
=
@
metadata
getDocumentMetadata
:
=>
$
=
jQuery
@
metadata
=
title
:
$
(
"head title"
).
text
()
return
@
metadata
h/js/services.coffee
View file @
eb9f9a7d
...
...
@@ -365,6 +365,11 @@ class Hypothesis extends Annotator
console
.
log
"Also loading annotations for: "
+
href
this
.
plugins
.
Store
.
loadAnnotationsFromSearch
uri
:
href
# get metadata for the annotated document
@
provider
.
call
method
:
'getDocumentMetadata'
success
:
(
metadata
)
=>
this
.
plugins
.
Document
.
metadata
=
metadata
class
DraftProvider
drafts
:
[]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment