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
f6a57e1d
Commit
f6a57e1d
authored
Jan 25, 2019
by
Robert Knight
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Run eslint --fix
Run `eslint --fix` to fix lint failures after ESLint update.
parent
eaf950df
Changes
32
Hide whitespace changes
Inline
Side-by-side
Showing
32 changed files
with
146 additions
and
146 deletions
+146
-146
gulpfile.js
gulpfile.js
+1
-1
decaf.js
scripts/decaf/decaf.js
+1
-1
create-bundle.js
scripts/gulp/create-bundle.js
+1
-1
index.js
src/annotator/index.js
+2
-2
pdf-metadata-test.js
src/annotator/plugin/test/pdf-metadata-test.js
+3
-3
anchoring-test.js
src/annotator/test/integration/anchoring-test.js
+1
-1
observable.js
src/annotator/util/observable.js
+3
-3
discovery.js
src/shared/discovery.js
+1
-1
annotation.js
src/sidebar/components/annotation.js
+2
-2
markdown.js
src/sidebar/components/markdown.js
+1
-1
annotation-test.js
src/sidebar/components/test/annotation-test.js
+5
-5
login-control-test.js
src/sidebar/components/test/login-control-test.js
+1
-1
h-branding-test.js
src/sidebar/directive/test/h-branding-test.js
+2
-2
index.js
src/sidebar/index.js
+80
-80
markdown-commands.js
src/sidebar/markdown-commands.js
+1
-1
frame-sync.js
src/sidebar/services/frame-sync.js
+1
-1
groups.js
src/sidebar/services/groups.js
+1
-1
oauth-auth.js
src/sidebar/services/oauth-auth.js
+1
-1
session.js
src/sidebar/services/session.js
+1
-1
streamer.js
src/sidebar/services/streamer.js
+1
-1
api-test.js
src/sidebar/services/test/api-test.js
+8
-8
groups-test.js
src/sidebar/services/test/groups-test.js
+2
-2
permissions-test.js
src/sidebar/services/test/permissions-test.js
+3
-3
tags-test.js
src/sidebar/services/test/tags-test.js
+1
-1
view-filter.js
src/sidebar/services/view-filter.js
+13
-13
annotations.js
src/sidebar/store/modules/annotations.js
+2
-2
selection.js
src/sidebar/store/modules/selection.js
+1
-1
markdown-commands-test.js
src/sidebar/test/markdown-commands-test.js
+2
-2
media-embedder-test.js
src/sidebar/test/media-embedder-test.js
+1
-1
group-organizations.js
src/sidebar/util/group-organizations.js
+1
-1
postmessage-json-rpc.js
src/sidebar/util/postmessage-json-rpc.js
+1
-1
time.js
src/sidebar/util/time.js
+1
-1
No files found.
gulpfile.js
View file @
f6a57e1d
...
...
@@ -372,7 +372,7 @@ function runKarma(baseConfig, opts, done) {
const
BaseReporter
=
require
(
'karma/lib/reporters/base'
);
BaseReporter
.
decoratorFactory
.
$inject
=
BaseReporter
.
decoratorFactory
.
$inject
.
map
(
dep
=>
dep
.
replace
(
'browserLogOptions'
,
'browserConsoleLogOptions'
));
dep
.
replace
(
'browserLogOptions'
,
'browserConsoleLogOptions'
));
const
karma
=
require
(
'karma'
);
new
karma
.
Server
(
Object
.
assign
({},
{
...
...
scripts/decaf/decaf.js
View file @
f6a57e1d
...
...
@@ -116,7 +116,7 @@ function checkSyntax(js) {
}
},
[]).
join
(
'
\
n'
);
throw
new
Error
(
`Could not parsing ES2015 JavaScript generated by 'decaffeinate'.
`Could not parsing ES2015 JavaScript generated by 'decaffeinate'.
You may need to fix or simplify the CoffeeScript first.
Error:
${
err
}
...
...
scripts/gulp/create-bundle.js
View file @
f6a57e1d
...
...
@@ -200,7 +200,7 @@ module.exports = function createBundle(config, buildOpts) {
// the root of the repository
const
repoRootPath
=
path
.
join
(
__dirname
,
'../../'
);
const
relativePath
=
path
.
relative
(
path
.
resolve
(
repoRootPath
),
path
.
resolve
(
req
));
path
.
resolve
(
req
));
bundle
.
require
(
req
,
{
expose
:
'/'
+
relativePath
});
}
else
{
// this is a package under node_modules/, no
...
...
src/annotator/index.js
View file @
f6a57e1d
...
...
@@ -42,8 +42,8 @@ const config = configFrom(window);
$
.
noConflict
(
true
)(
function
()
{
let
Klass
=
window
.
PDFViewerApplication
?
PdfSidebar
:
Sidebar
;
PdfSidebar
:
Sidebar
;
if
(
config
.
hasOwnProperty
(
'constructor'
))
{
Klass
=
config
.
constructor
;
...
...
src/annotator/plugin/test/pdf-metadata-test.js
View file @
f6a57e1d
...
...
@@ -155,7 +155,7 @@ describe('annotator/plugin/pdf-metadata', function () {
return
pdfMetadata
.
getUri
().
then
(
uri
=>
{
const
expected
=
new
URL
(
fakePDFViewerApplication
.
url
,
document
.
location
.
href
).
toString
();
document
.
location
.
href
).
toString
();
assert
.
equal
(
uri
,
expected
);
});
});
...
...
@@ -166,7 +166,7 @@ describe('annotator/plugin/pdf-metadata', function () {
const
expectedMetadata
=
{
title
:
'dcFakeTitle'
,
link
:
[{
href
:
'urn:x-pdf:'
+
fakePDFViewerApplication
.
pdfDocument
.
fingerprint
},
{
href
:
fakePDFViewerApplication
.
url
}],
{
href
:
fakePDFViewerApplication
.
url
}],
documentFingerprint
:
fakePDFViewerApplication
.
pdfDocument
.
fingerprint
,
};
...
...
@@ -179,7 +179,7 @@ describe('annotator/plugin/pdf-metadata', function () {
const
expectedMetadata
=
{
title
:
fakePDFViewerApplication
.
documentInfo
.
Title
,
link
:
[{
href
:
'urn:x-pdf:'
+
fakePDFViewerApplication
.
pdfDocument
.
fingerprint
},
{
href
:
fakePDFViewerApplication
.
url
}],
{
href
:
fakePDFViewerApplication
.
url
}],
documentFingerprint
:
fakePDFViewerApplication
.
pdfDocument
.
fingerprint
,
};
...
...
src/annotator/test/integration/anchoring-test.js
View file @
f6a57e1d
...
...
@@ -83,7 +83,7 @@ describe('anchoring', function () {
return
Promise
.
all
(
anchored
).
then
(
function
()
{
const
assertFn
=
testCase
.
expectFail
?
assert
.
notDeepEqual
:
assert
.
deepEqual
;
assertFn
(
normalize
(
highlightedPhrases
(
container
)),
normalize
(
testCase
.
quotes
));
normalize
(
testCase
.
quotes
));
});
},
[{
tag
:
'a simple quote'
,
...
...
src/annotator/util/observable.js
View file @
f6a57e1d
...
...
@@ -7,7 +7,7 @@
const
Observable
=
require
(
'zen-observable'
);
/**
/**
* Returns an observable of events emitted by a DOM event source
* (eg. an Element, Document or Window).
*
...
...
@@ -54,7 +54,7 @@ function delay(delay, src) {
});
}
/**
/**
* Buffers events from a source Observable, waiting for a pause of `delay`
* ms with no events before emitting the last value from `src`.
*
...
...
@@ -86,7 +86,7 @@ function buffer(delay, src) {
});
}
/**
/**
* Merges multiple streams of values into a single stream.
*
* @param {Array<Observable>} sources
...
...
src/shared/discovery.js
View file @
f6a57e1d
...
...
@@ -189,7 +189,7 @@ class Discovery {
discovered
=
true
;
}
else
if
(
messageType
===
'offer'
||
messageType
===
'ack'
)
{
throw
new
Error
(
`A second Discovery server has been detected at
${
origin
}
.
`A second Discovery server has been detected at
${
origin
}
.
This is unsupported and will cause unexpected behaviour.`
);
}
...
...
src/sidebar/components/annotation.js
View file @
f6a57e1d
...
...
@@ -134,7 +134,7 @@ function AnnotationController(
self
.
annotation
.
group
=
self
.
annotation
.
group
||
groups
.
focused
().
id
;
if
(
!
self
.
annotation
.
permissions
)
{
self
.
annotation
.
permissions
=
permissions
.
default
(
self
.
annotation
.
user
,
self
.
annotation
.
group
);
self
.
annotation
.
group
);
}
self
.
annotation
.
text
=
self
.
annotation
.
text
||
''
;
if
(
!
Array
.
isArray
(
self
.
annotation
.
tags
))
{
...
...
@@ -555,7 +555,7 @@ function AnnotationController(
tags
:
self
.
annotation
.
tags
,
text
:
self
.
annotation
.
text
,
isPrivate
:
!
permissions
.
isShared
(
self
.
annotation
.
permissions
,
self
.
annotation
.
user
),
self
.
annotation
.
user
),
};
};
...
...
src/sidebar/components/markdown.js
View file @
f6a57e1d
...
...
@@ -68,7 +68,7 @@ function MarkdownController($element, $sanitize, $scope) {
return
commands
.
toggleSpanStyle
(
state
,
'$$'
,
'$$'
,
'Insert LaTeX'
);
}
else
{
return
commands
.
toggleSpanStyle
(
state
,
'
\\
('
,
'
\\
)'
,
'Insert LaTeX'
);
'Insert LaTeX'
);
}
});
};
...
...
src/sidebar/components/test/annotation-test.js
View file @
f6a57e1d
...
...
@@ -258,7 +258,7 @@ describe('annotation', function() {
beforeEach
(
inject
(
function
(
_$q_
,
_$rootScope_
,
_$timeout_
,
_$window_
)
{
_$window_
)
{
$window
=
_$window_
;
$q
=
_$q_
;
$timeout
=
_$timeout_
;
...
...
@@ -311,7 +311,7 @@ describe('annotation', function() {
createDirective
(
annotation
);
assert
.
deepEqual
(
annotation
.
permissions
,
fakePermissions
.
default
(
fakeSession
.
state
.
userid
,
annotation
.
group
));
fakeSession
.
state
.
userid
,
annotation
.
group
));
});
it
(
'sets the tags and text fields for new annotations'
,
function
()
{
...
...
@@ -691,7 +691,7 @@ describe('annotation', function() {
fakeAnnotationMapper
.
deleteAnnotation
.
returns
(
$q
.
resolve
());
parts
.
controller
.
delete
().
then
(
function
()
{
assert
.
calledWith
(
fakeAnnotationMapper
.
deleteAnnotation
,
parts
.
annotation
);
parts
.
annotation
);
done
();
});
$timeout
.
flush
();
...
...
@@ -773,7 +773,7 @@ describe('annotation', function() {
fakeAnnotationMapper
.
flagAnnotation
.
returns
(
$q
.
resolve
());
parts
.
controller
.
flag
();
assert
.
calledWith
(
fakeAnnotationMapper
.
flagAnnotation
,
parts
.
annotation
);
parts
.
annotation
);
done
();
}
);
...
...
@@ -920,7 +920,7 @@ describe('annotation', function() {
[
'update'
,
'delete'
].
forEach
(
function
(
action
)
{
controller
.
authorize
(
action
);
assert
.
calledWith
(
fakePermissions
.
permits
,
ann
.
permissions
,
action
,
fakeSession
.
state
.
userid
);
fakeSession
.
state
.
userid
);
});
});
});
...
...
src/sidebar/components/test/login-control-test.js
View file @
f6a57e1d
...
...
@@ -10,7 +10,7 @@ function pageObject(element) {
return
{
menuLinks
:
function
()
{
return
Array
.
from
(
element
[
0
].
querySelectorAll
(
'.login-control-menu .dropdown-menu a'
))
.
map
(
function
(
el
)
{
return
el
.
textContent
;
});
.
map
(
function
(
el
)
{
return
el
.
textContent
;
});
},
menuText
:
function
()
{
return
element
[
0
].
querySelector
(
'span'
).
textContent
;
...
...
src/sidebar/directive/test/h-branding-test.js
View file @
f6a57e1d
...
...
@@ -71,8 +71,8 @@ describe('BrandingDirective', function () {
const
el
=
makeElementWithAttrs
(
testCase
.
attrs
);
if
(
Array
.
isArray
(
testCase
.
styleChanged
)){
// we expect that if styleChanged is an array
// that expectedPropValue will be an equal length array
// we expect that if styleChanged is an array
// that expectedPropValue will be an equal length array
testCase
.
styleChanged
.
forEach
(
function
(
styleChanged
,
index
){
assert
.
equal
(
el
[
0
].
style
[
styleChanged
],
testCase
.
expectedPropValue
[
index
]);
});
...
...
src/sidebar/index.js
View file @
f6a57e1d
...
...
@@ -120,92 +120,92 @@ function startAngularApp(config) {
])
// The root component for the application
.
component
(
'hypothesisApp'
,
require
(
'./components/hypothesis-app'
))
.
component
(
'hypothesisApp'
,
require
(
'./components/hypothesis-app'
))
// UI components
.
component
(
'annotation'
,
require
(
'./components/annotation'
))
.
component
(
'annotationHeader'
,
require
(
'./components/annotation-header'
))
.
component
(
'annotationActionButton'
,
require
(
'./components/annotation-action-button'
))
.
component
(
'annotationShareDialog'
,
require
(
'./components/annotation-share-dialog'
))
.
component
(
'annotationThread'
,
require
(
'./components/annotation-thread'
))
.
component
(
'annotationViewerContent'
,
require
(
'./components/annotation-viewer-content'
))
.
component
(
'dropdownMenuBtn'
,
require
(
'./components/dropdown-menu-btn'
))
.
component
(
'excerpt'
,
require
(
'./components/excerpt'
))
.
component
(
'groupList'
,
require
(
'./components/group-list'
))
.
component
(
'helpLink'
,
require
(
'./components/help-link'
))
.
component
(
'helpPanel'
,
require
(
'./components/help-panel'
))
.
component
(
'loggedoutMessage'
,
require
(
'./components/loggedout-message'
))
.
component
(
'loginControl'
,
require
(
'./components/login-control'
))
.
component
(
'markdown'
,
require
(
'./components/markdown'
))
.
component
(
'moderationBanner'
,
require
(
'./components/moderation-banner'
))
.
component
(
'newNoteBtn'
,
require
(
'./components/new-note-btn'
))
.
component
(
'publishAnnotationBtn'
,
require
(
'./components/publish-annotation-btn'
))
.
component
(
'searchInput'
,
require
(
'./components/search-input'
))
.
component
(
'searchStatusBar'
,
require
(
'./components/search-status-bar'
))
.
component
(
'selectionTabs'
,
require
(
'./components/selection-tabs'
))
.
component
(
'sidebarContent'
,
require
(
'./components/sidebar-content'
))
.
component
(
'sidebarTutorial'
,
require
(
'./components/sidebar-tutorial'
))
.
component
(
'shareDialog'
,
require
(
'./components/share-dialog'
))
.
component
(
'sortDropdown'
,
require
(
'./components/sort-dropdown'
))
.
component
(
'spinner'
,
require
(
'./components/spinner'
))
.
component
(
'streamContent'
,
require
(
'./components/stream-content'
))
.
component
(
'svgIcon'
,
require
(
'./components/svg-icon'
))
.
component
(
'tagEditor'
,
require
(
'./components/tag-editor'
))
.
component
(
'threadList'
,
require
(
'./components/thread-list'
))
.
component
(
'timestamp'
,
require
(
'./components/timestamp'
))
.
component
(
'topBar'
,
require
(
'./components/top-bar'
))
.
directive
(
'hAutofocus'
,
require
(
'./directive/h-autofocus'
))
.
directive
(
'hBranding'
,
require
(
'./directive/h-branding'
))
.
directive
(
'hOnTouch'
,
require
(
'./directive/h-on-touch'
))
.
directive
(
'hTooltip'
,
require
(
'./directive/h-tooltip'
))
.
directive
(
'windowScroll'
,
require
(
'./directive/window-scroll'
))
.
service
(
'analytics'
,
require
(
'./services/analytics'
))
.
service
(
'annotationMapper'
,
require
(
'./services/annotation-mapper'
))
.
service
(
'api'
,
require
(
'./services/api'
))
.
service
(
'apiRoutes'
,
require
(
'./services/api-routes'
))
.
service
(
'auth'
,
require
(
'./services/oauth-auth'
))
.
service
(
'bridge'
,
require
(
'../shared/bridge'
))
.
service
(
'drafts'
,
require
(
'./services/drafts'
))
.
service
(
'features'
,
require
(
'./services/features'
))
.
service
(
'flash'
,
require
(
'./services/flash'
))
.
service
(
'frameSync'
,
require
(
'./services/frame-sync'
).
default
)
.
service
(
'groups'
,
require
(
'./services/groups'
))
.
service
(
'localStorage'
,
require
(
'./services/local-storage'
))
.
service
(
'permissions'
,
require
(
'./services/permissions'
))
.
service
(
'rootThread'
,
require
(
'./services/root-thread'
))
.
service
(
'searchFilter'
,
require
(
'./services/search-filter'
))
.
service
(
'serviceUrl'
,
require
(
'./services/service-url'
))
.
service
(
'session'
,
require
(
'./services/session'
))
.
service
(
'streamer'
,
require
(
'./services/streamer'
))
.
service
(
'streamFilter'
,
require
(
'./services/stream-filter'
))
.
service
(
'tags'
,
require
(
'./services/tags'
))
.
service
(
'unicode'
,
require
(
'./services/unicode'
))
.
service
(
'viewFilter'
,
require
(
'./services/view-filter'
))
.
component
(
'annotation'
,
require
(
'./components/annotation'
))
.
component
(
'annotationHeader'
,
require
(
'./components/annotation-header'
))
.
component
(
'annotationActionButton'
,
require
(
'./components/annotation-action-button'
))
.
component
(
'annotationShareDialog'
,
require
(
'./components/annotation-share-dialog'
))
.
component
(
'annotationThread'
,
require
(
'./components/annotation-thread'
))
.
component
(
'annotationViewerContent'
,
require
(
'./components/annotation-viewer-content'
))
.
component
(
'dropdownMenuBtn'
,
require
(
'./components/dropdown-menu-btn'
))
.
component
(
'excerpt'
,
require
(
'./components/excerpt'
))
.
component
(
'groupList'
,
require
(
'./components/group-list'
))
.
component
(
'helpLink'
,
require
(
'./components/help-link'
))
.
component
(
'helpPanel'
,
require
(
'./components/help-panel'
))
.
component
(
'loggedoutMessage'
,
require
(
'./components/loggedout-message'
))
.
component
(
'loginControl'
,
require
(
'./components/login-control'
))
.
component
(
'markdown'
,
require
(
'./components/markdown'
))
.
component
(
'moderationBanner'
,
require
(
'./components/moderation-banner'
))
.
component
(
'newNoteBtn'
,
require
(
'./components/new-note-btn'
))
.
component
(
'publishAnnotationBtn'
,
require
(
'./components/publish-annotation-btn'
))
.
component
(
'searchInput'
,
require
(
'./components/search-input'
))
.
component
(
'searchStatusBar'
,
require
(
'./components/search-status-bar'
))
.
component
(
'selectionTabs'
,
require
(
'./components/selection-tabs'
))
.
component
(
'sidebarContent'
,
require
(
'./components/sidebar-content'
))
.
component
(
'sidebarTutorial'
,
require
(
'./components/sidebar-tutorial'
))
.
component
(
'shareDialog'
,
require
(
'./components/share-dialog'
))
.
component
(
'sortDropdown'
,
require
(
'./components/sort-dropdown'
))
.
component
(
'spinner'
,
require
(
'./components/spinner'
))
.
component
(
'streamContent'
,
require
(
'./components/stream-content'
))
.
component
(
'svgIcon'
,
require
(
'./components/svg-icon'
))
.
component
(
'tagEditor'
,
require
(
'./components/tag-editor'
))
.
component
(
'threadList'
,
require
(
'./components/thread-list'
))
.
component
(
'timestamp'
,
require
(
'./components/timestamp'
))
.
component
(
'topBar'
,
require
(
'./components/top-bar'
))
.
directive
(
'hAutofocus'
,
require
(
'./directive/h-autofocus'
))
.
directive
(
'hBranding'
,
require
(
'./directive/h-branding'
))
.
directive
(
'hOnTouch'
,
require
(
'./directive/h-on-touch'
))
.
directive
(
'hTooltip'
,
require
(
'./directive/h-tooltip'
))
.
directive
(
'windowScroll'
,
require
(
'./directive/window-scroll'
))
.
service
(
'analytics'
,
require
(
'./services/analytics'
))
.
service
(
'annotationMapper'
,
require
(
'./services/annotation-mapper'
))
.
service
(
'api'
,
require
(
'./services/api'
))
.
service
(
'apiRoutes'
,
require
(
'./services/api-routes'
))
.
service
(
'auth'
,
require
(
'./services/oauth-auth'
))
.
service
(
'bridge'
,
require
(
'../shared/bridge'
))
.
service
(
'drafts'
,
require
(
'./services/drafts'
))
.
service
(
'features'
,
require
(
'./services/features'
))
.
service
(
'flash'
,
require
(
'./services/flash'
))
.
service
(
'frameSync'
,
require
(
'./services/frame-sync'
).
default
)
.
service
(
'groups'
,
require
(
'./services/groups'
))
.
service
(
'localStorage'
,
require
(
'./services/local-storage'
))
.
service
(
'permissions'
,
require
(
'./services/permissions'
))
.
service
(
'rootThread'
,
require
(
'./services/root-thread'
))
.
service
(
'searchFilter'
,
require
(
'./services/search-filter'
))
.
service
(
'serviceUrl'
,
require
(
'./services/service-url'
))
.
service
(
'session'
,
require
(
'./services/session'
))
.
service
(
'streamer'
,
require
(
'./services/streamer'
))
.
service
(
'streamFilter'
,
require
(
'./services/stream-filter'
))
.
service
(
'tags'
,
require
(
'./services/tags'
))
.
service
(
'unicode'
,
require
(
'./services/unicode'
))
.
service
(
'viewFilter'
,
require
(
'./services/view-filter'
))
// Redux store
.
service
(
'store'
,
require
(
'./store'
))
.
service
(
'store'
,
require
(
'./store'
))
// Utilities
.
value
(
'Discovery'
,
require
(
'../shared/discovery'
))
.
value
(
'ExcerptOverflowMonitor'
,
require
(
'./util/excerpt-overflow-monitor'
))
.
value
(
'OAuthClient'
,
require
(
'./util/oauth-client'
))
.
value
(
'VirtualThreadList'
,
require
(
'./virtual-thread-list'
))
.
value
(
'isSidebar'
,
isSidebar
)
.
value
(
'random'
,
require
(
'./util/random'
))
.
value
(
'raven'
,
require
(
'./raven'
))
.
value
(
'serviceConfig'
,
serviceConfig
)
.
value
(
'settings'
,
config
)
.
value
(
'time'
,
require
(
'./util/time'
))
.
value
(
'urlEncodeFilter'
,
require
(
'./filter/url'
).
encode
)
.
config
(
configureLocation
)
.
config
(
configureRoutes
)
.
config
(
configureToastr
)
.
run
(
setupHttp
)
.
run
(
crossOriginRPC
.
server
.
start
);
.
value
(
'Discovery'
,
require
(
'../shared/discovery'
))
.
value
(
'ExcerptOverflowMonitor'
,
require
(
'./util/excerpt-overflow-monitor'
))
.
value
(
'OAuthClient'
,
require
(
'./util/oauth-client'
))
.
value
(
'VirtualThreadList'
,
require
(
'./virtual-thread-list'
))
.
value
(
'isSidebar'
,
isSidebar
)
.
value
(
'random'
,
require
(
'./util/random'
))
.
value
(
'raven'
,
require
(
'./raven'
))
.
value
(
'serviceConfig'
,
serviceConfig
)
.
value
(
'settings'
,
config
)
.
value
(
'time'
,
require
(
'./util/time'
))
.
value
(
'urlEncodeFilter'
,
require
(
'./filter/url'
).
encode
)
.
config
(
configureLocation
)
.
config
(
configureRoutes
)
.
config
(
configureToastr
)
.
run
(
setupHttp
)
.
run
(
crossOriginRPC
.
server
.
start
);
if
(
config
.
liveReloadServer
)
{
require
(
'./live-reload-client'
).
connect
(
config
.
liveReloadServer
);
...
...
src/sidebar/markdown-commands.js
View file @
f6a57e1d
...
...
@@ -153,7 +153,7 @@ function toggleSpanStyle(state, prefix, suffix, placeholder) {
if
(
selectionPrefix
===
prefix
&&
selectionSuffix
===
suffix
)
{
newState
=
replaceText
(
newState
,
newState
.
selectionStart
-
prefix
.
length
,
prefix
.
length
,
''
);
prefix
.
length
,
''
);
newState
=
replaceText
(
newState
,
newState
.
selectionEnd
,
suffix
.
length
,
''
);
}
else
{
newState
=
replaceText
(
newState
,
newState
.
selectionStart
,
0
,
prefix
);
...
...
src/sidebar/services/frame-sync.js
View file @
f6a57e1d
...
...
@@ -16,7 +16,7 @@ const uiConstants = require('../ui-constants');
* for PDFs
*/
/**
/**
* Return a minimal representation of an annotation that can be sent from the
* sidebar app to a connected frame.
*
...
...
src/sidebar/services/groups.js
View file @
f6a57e1d
...
...
@@ -17,7 +17,7 @@ const serviceConfig = require('../service-config');
// @ngInject
function
groups
(
$rootScope
,
store
,
api
,
isSidebar
,
localStorage
,
serviceUrl
,
session
,
settings
)
{
settings
)
{
const
svc
=
serviceConfig
(
settings
);
const
authority
=
svc
?
svc
.
authority
:
null
;
...
...
src/sidebar/services/oauth-auth.js
View file @
f6a57e1d
...
...
@@ -25,7 +25,7 @@ const serviceConfig = require('../service-config');
*/
// @ngInject
function
auth
(
$http
,
$rootScope
,
$window
,
OAuthClient
,
apiRoutes
,
flash
,
localStorage
,
settings
)
{
apiRoutes
,
flash
,
localStorage
,
settings
)
{
/**
* Authorization code from auth popup window.
...
...
src/sidebar/services/session.js
View file @
f6a57e1d
...
...
@@ -21,7 +21,7 @@ const CACHE_TTL = 5 * 60 * 1000; // 5 minutes
* @ngInject
*/
function
session
(
$q
,
$rootScope
,
analytics
,
store
,
api
,
auth
,
flash
,
raven
,
settings
,
serviceConfig
)
{
flash
,
raven
,
settings
,
serviceConfig
)
{
// Cache the result of load()
let
lastLoad
;
let
lastLoadTime
;
...
...
src/sidebar/services/streamer.js
View file @
f6a57e1d
...
...
@@ -21,7 +21,7 @@ const Socket = require('../websocket');
*/
// @ngInject
function
Streamer
(
$rootScope
,
annotationMapper
,
store
,
auth
,
groups
,
session
,
settings
)
{
groups
,
session
,
settings
)
{
// The randomly generated session UUID
const
clientId
=
uuid
.
v4
();
...
...
src/sidebar/services/test/api-test.js
View file @
f6a57e1d
...
...
@@ -216,9 +216,9 @@ describe('sidebar.services.api', function () {
done
();
});
$httpBackend
.
expectPATCH
(
'https://example.com/api/profile'
)
.
respond
(
function
()
{
return
[
testCase
.
status
,
testCase
.
body
,
{},
testCase
.
statusText
];
});
.
respond
(
function
()
{
return
[
testCase
.
status
,
testCase
.
body
,
{},
testCase
.
statusText
];
});
$httpBackend
.
flush
();
},
[{
// Network error
...
...
@@ -253,9 +253,9 @@ describe('sidebar.services.api', function () {
done
();
});
$httpBackend
.
expectPATCH
(
'https://example.com/api/profile'
)
.
respond
(
function
()
{
return
[
404
,
{
reason
:
'User not found'
},
{},
'Not found'
];
});
.
respond
(
function
()
{
return
[
404
,
{
reason
:
'User not found'
},
{},
'Not found'
];
});
$httpBackend
.
flush
();
});
});
...
...
@@ -268,7 +268,7 @@ describe('sidebar.services.api', function () {
});
$httpBackend
.
expectGET
(
'https://example.com/api/profile'
)
.
respond
(()
=>
[
200
,
{
userid
:
'acct:user@example.com'
}]);
.
respond
(()
=>
[
200
,
{
userid
:
'acct:user@example.com'
}]);
$httpBackend
.
flush
();
});
...
...
@@ -283,7 +283,7 @@ describe('sidebar.services.api', function () {
});
$httpBackend
.
expectGET
(
'https://example.com/api/profile'
)
.
respond
(()
=>
[
200
,
{
userid
:
'acct:user@example.com'
}]);
.
respond
(()
=>
[
200
,
{
userid
:
'acct:user@example.com'
}]);
$httpBackend
.
flush
();
});
});
src/sidebar/services/test/groups-test.js
View file @
f6a57e1d
...
...
@@ -211,8 +211,8 @@ describe('groups', function() {
{
id
:
'39r39f'
,
name
:
'Ding Dong!'
},
];
fakeApi
.
groups
.
list
.
returns
(
Promise
.
resolve
({
token
:
'1234'
,
data
:
groups
,
token
:
'1234'
,
data
:
groups
,
}));
return
svc
.
load
().
then
(
groups
=>
{
assert
.
isObject
(
groups
[
0
].
organization
);
...
...
src/sidebar/services/test/permissions-test.js
View file @
f6a57e1d
...
...
@@ -39,19 +39,19 @@ describe('permissions', function () {
describe
(
'#default'
,
function
()
{
it
(
'returns shared permissions by default'
,
function
()
{
assert
.
deepEqual
(
permissions
.
default
(
userid
,
'gid'
),
permissions
.
shared
(
userid
,
'gid'
));
permissions
.
shared
(
userid
,
'gid'
));
});
it
(
'returns private permissions if the saved level is "private"'
,
function
()
{
fakeLocalStorage
.
getItem
.
returns
(
'private'
);
assert
.
deepEqual
(
permissions
.
default
(
userid
,
'gid'
),
permissions
.
private
(
userid
));
permissions
.
private
(
userid
));
});
it
(
'returns shared permissions if the saved level is "shared"'
,
function
()
{
fakeLocalStorage
.
getItem
.
returns
(
'shared'
);
assert
.
deepEqual
(
permissions
.
default
(
userid
,
'gid'
),
permissions
.
shared
(
userid
,
'gid'
));
permissions
.
shared
(
userid
,
'gid'
));
});
});
...
...
src/sidebar/services/test/tags-test.js
View file @
f6a57e1d
...
...
@@ -25,7 +25,7 @@ describe('sidebar.tags', () => {
before
(()
=>
{
angular
.
module
(
'h'
,
[])
.
service
(
'tags'
,
require
(
'../tags'
));
.
service
(
'tags'
,
require
(
'../tags'
));
});
beforeEach
(()
=>
{
...
...
src/sidebar/services/view-filter.js
View file @
f6a57e1d
...
...
@@ -151,19 +151,19 @@ function viewFilter(unicode) {
// filters.
const
fieldFilters
=
Object
.
entries
(
filters
).
filter
(([,
filter
])
=>
filter
.
terms
.
length
>
0
)
.
map
(([
field
,
filter
])
=>
{
const
terms
=
filter
.
terms
.
map
(
normalize
);
let
termFilters
;
if
(
field
===
'any'
)
{
const
anyFields
=
[
'quote'
,
'text'
,
'tag'
,
'user'
];
termFilters
=
terms
.
map
(
term
=>
new
BinaryOpFilter
(
'or'
,
anyFields
.
map
(
field
=>
new
TermFilter
(
field
,
term
,
fieldMatchers
[
field
])
)));
}
else
{
termFilters
=
terms
.
map
(
term
=>
new
TermFilter
(
field
,
term
,
fieldMatchers
[
field
]));
}
return
new
BinaryOpFilter
(
filter
.
operator
,
termFilters
);
});
.
map
(([
field
,
filter
])
=>
{
const
terms
=
filter
.
terms
.
map
(
normalize
);
let
termFilters
;
if
(
field
===
'any'
)
{
const
anyFields
=
[
'quote'
,
'text'
,
'tag'
,
'user'
];
termFilters
=
terms
.
map
(
term
=>
new
BinaryOpFilter
(
'or'
,
anyFields
.
map
(
field
=>
new
TermFilter
(
field
,
term
,
fieldMatchers
[
field
])
)));
}
else
{
termFilters
=
terms
.
map
(
term
=>
new
TermFilter
(
field
,
term
,
fieldMatchers
[
field
]));
}
return
new
BinaryOpFilter
(
filter
.
operator
,
termFilters
);
});
const
rootFilter
=
new
BinaryOpFilter
(
'and'
,
fieldFilters
);
...
...
src/sidebar/store/modules/annotations.js
View file @
f6a57e1d
...
...
@@ -262,13 +262,13 @@ function addAnnotations(annotations, now) {
const
ANCHORING_TIMEOUT
=
500
;
const
anchoringIDs
=
added
.
filter
(
metadata
.
isWaitingToAnchor
)
.
map
(
ann
=>
ann
.
id
);
.
map
(
ann
=>
ann
.
id
);
if
(
anchoringIDs
.
length
>
0
)
{
setTimeout
(()
=>
{
// Find annotations which haven't yet been anchored in the document.
const
anns
=
getState
().
annotations
;
const
annsStillAnchoring
=
anchoringIDs
.
map
(
id
=>
findByID
(
anns
,
id
))
.
filter
(
ann
=>
ann
&&
metadata
.
isWaitingToAnchor
(
ann
));
.
filter
(
ann
=>
ann
&&
metadata
.
isWaitingToAnchor
(
ann
));
// Mark anchoring as timed-out for these annotations.
const
anchorStatusUpdates
=
annsStillAnchoring
.
reduce
((
updates
,
ann
)
=>
{
...
...
src/sidebar/store/modules/selection.js
View file @
f6a57e1d
...
...
@@ -24,7 +24,7 @@ const util = require('../util');
*/
const
TAB_DEFAULT
=
uiConstants
.
TAB_ANNOTATIONS
;
/**
/**
* Default sort keys for each tab.
*/
const
TAB_SORTKEY_DEFAULT
=
{};
...
...
src/sidebar/test/markdown-commands-test.js
View file @
f6a57e1d
...
...
@@ -61,13 +61,13 @@ describe('markdown commands', function () {
it
(
'adds formatting to spans when the prefix and suffix differ'
,
function
()
{
const
output
=
toggle
(
parseState
(
'make <sel>math</sel> mathy'
),
'
\\
('
,
'
\\
)'
);
'
\\
)'
);
assert
.
equal
(
formatState
(
output
),
'make
\\
(<sel>math</sel>
\\
) mathy'
);
});
it
(
'inserts placeholders if the selection is empty'
,
function
()
{
const
output
=
toggle
(
parseState
(
'make <sel></sel> bold'
),
'**'
,
undefined
,
'Bold'
);
undefined
,
'Bold'
);
assert
.
equal
(
formatState
(
output
),
'make **<sel>Bold</sel>** bold'
);
});
});
...
...
src/sidebar/test/media-embedder-test.js
View file @
f6a57e1d
...
...
@@ -360,7 +360,7 @@ describe('media-embedder', function () {
const
url1
=
'https://www.youtube.com/watch?v=QCkm0lL-6lc'
;
const
url2
=
'https://youtu.be/abcdefg'
;
const
element
=
domElement
(
'<a href="'
+
url1
+
'">'
+
url1
+
'</a>
\
n
\
n'
+
'<a href="'
+
url1
+
'">'
+
url1
+
'</a>
\
n
\
n'
+
'<a href="'
+
url2
+
'">'
+
url2
+
'</a>'
);
mediaEmbedder
.
replaceLinksWithEmbeds
(
element
);
...
...
src/sidebar/util/group-organizations.js
View file @
f6a57e1d
...
...
@@ -2,7 +2,7 @@
const
immutable
=
require
(
'seamless-immutable'
);
// TODO: Update when this is a property available on the API response
// TODO: Update when this is a property available on the API response
const
DEFAULT_ORG_ID
=
'__default__'
;
/**
...
...
src/sidebar/util/postmessage-json-rpc.js
View file @
f6a57e1d
...
...
@@ -29,7 +29,7 @@ function createTimeout(delay, message) {
* @return {Promise<any>} - A Promise for the response to the call
*/
function
call
(
frame
,
origin
,
method
,
params
=
[],
timeout
=
2000
,
window_
=
window
,
id
=
generateId
())
{
window_
=
window
,
id
=
generateId
())
{
// Send RPC request.
const
request
=
{
...
...
src/sidebar/util/time.js
View file @
f6a57e1d
...
...
@@ -81,7 +81,7 @@ function format(date, options, Intl) {
if
(
!
formatter
)
{
formatter
=
formatters
[
key
]
=
new
Intl
.
DateTimeFormat
(
undefined
,
options
);
options
);
}
return
formatter
.
format
(
date
);
...
...
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