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
d816525e
Commit
d816525e
authored
Jan 19, 2015
by
csillag
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Drop the URL fragments
parent
0a0019ec
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
2 deletions
+42
-2
fragmentselector.coffee
h/static/scripts/annotator/plugin/fragmentselector.coffee
+25
-0
guest.coffee
h/static/scripts/guest.coffee
+17
-2
No files found.
h/static/scripts/annotator/plugin/fragmentselector.coffee
0 → 100644
View file @
d816525e
# Annotator plugin for creating the Fragment Selector
class
Annotator
.
Plugin
.
FragmentSelector
extends
Annotator
.
Plugin
pluginInit
:
->
@
Annotator
=
Annotator
@
anchoring
=
@
annotator
.
anchoring
# Register the creator Fragment selectors
@
anchoring
.
selectorCreators
.
push
name
:
"FragmentSelector"
describe
:
@
_getFragmentSelector
# Create a FragmentSelector around a range
_getFragmentSelector
:
(
annotation
,
target
)
=>
console
.
log
"Should create a fragment selector"
return
[]
[
type
:
"TextPositionSelector"
start
:
startOffset
end
:
endOffset
]
h/static/scripts/guest.coffee
View file @
d816525e
...
@@ -23,6 +23,7 @@ class Annotator.Guest extends Annotator
...
@@ -23,6 +23,7 @@ class Annotator.Guest extends Annotator
TextPosition
:
{}
TextPosition
:
{}
TextQuote
:
{}
TextQuote
:
{}
FuzzyTextAnchors
:
{}
FuzzyTextAnchors
:
{}
FragmentSelector
:
{}
# Internal state
# Internal state
tool
:
'comment'
tool
:
'comment'
...
@@ -119,9 +120,23 @@ class Annotator.Guest extends Annotator
...
@@ -119,9 +120,23 @@ class Annotator.Guest extends Annotator
# Announce the new positions, so that the sidebar knows
# Announce the new positions, so that the sidebar knows
this
.
plugins
.
Bridge
.
sync
([
highlight
.
annotation
])
this
.
plugins
.
Bridge
.
sync
([
highlight
.
annotation
])
# Utility function to remove the hash part from a URL
_removeHash
:
(
url
)
->
url
=
new
URL
url
url
.
hash
=
""
url
.
toString
()
# Utility function to get the decoded form of the document URI
# Utility function to get the decoded form of the document URI
getHref
:
=>
getHref
:
=>
@
plugins
.
PDF
?
.
uri
()
?
@
plugins
.
Document
.
uri
()
?
super
if
@
plugins
.
PDF
@
plugins
.
PDF
.
uri
()
else
@
_removeHash
@
plugins
.
Document
.
uri
()
getMetadata
:
=>
metadata
=
@
plugins
.
Document
?
.
metadata
metadata
.
link
?
.
forEach
(
link
)
=>
link
.
href
=
@
_removeHash
link
.
href
metadata
_setupXDM
:
(
options
)
->
_setupXDM
:
(
options
)
->
# jschannel chokes FF and Chrome extension origins.
# jschannel chokes FF and Chrome extension origins.
...
@@ -160,7 +175,7 @@ class Annotator.Guest extends Annotator
...
@@ -160,7 +175,7 @@ class Annotator.Guest extends Annotator
.
catch
(
problem
)
=>
.
catch
(
problem
)
=>
trans
.
complete
trans
.
complete
uri
:
@
getHref
()
uri
:
@
getHref
()
metadata
:
@
plugins
.
Document
?
.
metadata
metadata
:
@
getMetadata
()
trans
.
delayReturn
(
true
)
trans
.
delayReturn
(
true
)
)
)
...
...
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