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
65d34fbd
Unverified
Commit
65d34fbd
authored
Jan 13, 2020
by
Robert Knight
Committed by
GitHub
Jan 13, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1660 from hypothesis/convert-sidebar-entrypoint
Convert sidebar entry point to ES modules
parents
1b60f9fa
2d39ba8a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
79 additions
and
81 deletions
+79
-81
index.js
src/sidebar/index.js
+79
-81
No files found.
src/sidebar/index.js
View file @
65d34fbd
const
addAnalytics
=
require
(
'./ga'
)
;
import
addAnalytics
from
'./ga'
;
const
disableOpenerForExternalLinks
=
require
(
'./util/disable-opener-for-external-links'
)
;
import
disableOpenerForExternalLinks
from
'./util/disable-opener-for-external-links'
;
const
{
fetchConfig
}
=
require
(
'./util/fetch-config'
)
;
import
{
fetchConfig
}
from
'./util/fetch-config'
;
const
serviceConfig
=
require
(
'./service-config'
)
;
import
serviceConfig
from
'./service-config'
;
const
{
jsonConfigsFrom
}
=
require
(
'../shared/settings'
)
;
import
{
jsonConfigsFrom
}
from
'../shared/settings'
;
const
crossOriginRPC
=
require
(
'./cross-origin-rpc.js'
)
;
import
crossOriginRPC
from
'./cross-origin-rpc.js'
;
const
sentry
=
require
(
'./util/sentry'
)
;
import
*
as
sentry
from
'./util/sentry'
;
// Read settings rendered into sidebar app HTML by service/extension.
// Read settings rendered into sidebar app HTML by service/extension.
const
appConfig
=
jsonConfigsFrom
(
document
);
const
appConfig
=
jsonConfigsFrom
(
document
);
...
@@ -26,21 +26,23 @@ document.body.setAttribute('ng-csp', '');
...
@@ -26,21 +26,23 @@ document.body.setAttribute('ng-csp', '');
// Prevent tab-jacking.
// Prevent tab-jacking.
disableOpenerForExternalLinks
(
document
.
body
);
disableOpenerForExternalLinks
(
document
.
body
);
const
angular
=
require
(
'angular'
);
import
angular
from
'angular'
;
const
angularRoute
=
require
(
'angular-route'
);
const
angularToastr
=
require
(
'angular-toastr'
);
// Angular addons which export the Angular module name via `module.exports`.
import
angularRoute
from
'angular-route'
;
import
angularToastr
from
'angular-toastr'
;
// autofill-event relies on the existence of window.angular so
// autofill-event relies on the existence of window.angular so
// it must be require'd after angular is first require'd
// it must be require'd after angular is first require'd
require
(
'autofill-event'
)
;
import
'autofill-event'
;
// Load polyfill for :focus-visible pseudo-class.
// Load polyfill for :focus-visible pseudo-class.
require
(
'focus-visible'
)
;
import
'focus-visible'
;
// Enable debugging checks for Preact.
// Enable debugging checks for Preact.
require
(
'preact/debug'
)
;
import
'preact/debug'
;
const
wrapReactComponent
=
require
(
'./util/wrap-react-component'
)
;
import
wrapReactComponent
from
'./util/wrap-react-component'
;
if
(
appConfig
.
googleAnalytics
)
{
if
(
appConfig
.
googleAnalytics
)
{
addAnalytics
(
appConfig
.
googleAnalytics
);
addAnalytics
(
appConfig
.
googleAnalytics
);
...
@@ -112,84 +114,80 @@ function sendPageView(analytics) {
...
@@ -112,84 +114,80 @@ function sendPageView(analytics) {
}
}
// Preact UI components that are wrapped for use within Angular templates.
// Preact UI components that are wrapped for use within Angular templates.
const
AnnotationActionBar
=
require
(
'./components/annotation-action-bar'
)
;
import
AnnotationActionBar
from
'./components/annotation-action-bar'
;
const
AnnotationBody
=
require
(
'./components/annotation-body'
)
;
import
AnnotationBody
from
'./components/annotation-body'
;
const
AnnotationHeader
=
require
(
'./components/annotation-header'
)
;
import
AnnotationHeader
from
'./components/annotation-header'
;
const
AnnotationLicense
=
require
(
'./components/annotation-license'
)
;
import
AnnotationLicense
from
'./components/annotation-license'
;
const
AnnotationOmega
=
require
(
'./components/annotation-omega'
)
;
import
AnnotationOmega
from
'./components/annotation-omega'
;
const
AnnotationPublishControl
=
require
(
'./components/annotation-publish-control'
)
;
import
AnnotationPublishControl
from
'./components/annotation-publish-control'
;
const
AnnotationQuote
=
require
(
'./components/annotation-quote'
)
;
import
AnnotationQuote
from
'./components/annotation-quote'
;
const
FocusedModeHeader
=
require
(
'./components/focused-mode-header'
)
;
import
FocusedModeHeader
from
'./components/focused-mode-header'
;
const
HelpPanel
=
require
(
'./components/help-panel'
)
;
import
HelpPanel
from
'./components/help-panel'
;
const
LoggedOutMessage
=
require
(
'./components/logged-out-message'
)
;
import
LoggedOutMessage
from
'./components/logged-out-message'
;
const
ModerationBanner
=
require
(
'./components/moderation-banner'
)
;
import
ModerationBanner
from
'./components/moderation-banner'
;
const
SearchStatusBar
=
require
(
'./components/search-status-bar'
)
;
import
SearchStatusBar
from
'./components/search-status-bar'
;
const
SelectionTabs
=
require
(
'./components/selection-tabs'
)
;
import
SelectionTabs
from
'./components/selection-tabs'
;
const
ShareAnnotationsPanel
=
require
(
'./components/share-annotations-panel'
)
;
import
ShareAnnotationsPanel
from
'./components/share-annotations-panel'
;
const
SidebarContentError
=
require
(
'./components/sidebar-content-error'
)
;
import
SidebarContentError
from
'./components/sidebar-content-error'
;
const
SvgIcon
=
require
(
'./components/svg-icon'
)
;
import
SvgIcon
from
'./components/svg-icon'
;
const
TagEditor
=
require
(
'./components/tag-editor'
)
;
import
TagEditor
from
'./components/tag-editor'
;
const
TagList
=
require
(
'./components/tag-list'
)
;
import
TagList
from
'./components/tag-list'
;
const
TopBar
=
require
(
'./components/top-bar'
)
;
import
TopBar
from
'./components/top-bar'
;
// Remaining UI components that are still built with Angular.
// Remaining UI components that are still built with Angular.
const
annotation
=
require
(
'./components/annotation'
)
;
import
annotation
from
'./components/annotation'
;
const
annotationThread
=
require
(
'./components/annotation-thread'
)
;
import
annotationThread
from
'./components/annotation-thread'
;
const
annotationViewerContent
=
require
(
'./components/annotation-viewer-content'
)
;
import
annotationViewerContent
from
'./components/annotation-viewer-content'
;
const
hypothesisApp
=
require
(
'./components/hypothesis-app'
)
;
import
hypothesisApp
from
'./components/hypothesis-app'
;
const
sidebarContent
=
require
(
'./components/sidebar-content'
)
;
import
sidebarContent
from
'./components/sidebar-content'
;
const
streamContent
=
require
(
'./components/stream-content'
)
;
import
streamContent
from
'./components/stream-content'
;
const
threadList
=
require
(
'./components/thread-list'
)
;
import
threadList
from
'./components/thread-list'
;
// Angular directives.
// Angular directives.
const
hAutofocusDirective
=
require
(
'./directive/h-autofocus'
)
;
import
hAutofocusDirective
from
'./directive/h-autofocus'
;
const
hBrandingDirective
=
require
(
'./directive/h-branding'
)
;
import
hBrandingDirective
from
'./directive/h-branding'
;
const
hOnTouchDirective
=
require
(
'./directive/h-on-touch'
)
;
import
hOnTouchDirective
from
'./directive/h-on-touch'
;
const
hTooltipDirective
=
require
(
'./directive/h-tooltip'
)
;
import
hTooltipDirective
from
'./directive/h-tooltip'
;
const
windowScrollDirective
=
require
(
'./directive/window-scroll'
)
;
import
windowScrollDirective
from
'./directive/window-scroll'
;
// Services.
// Services.
const
analyticsService
=
require
(
'./services/analytics'
);
import
analyticsService
from
'./services/analytics'
;
const
annotationMapperService
=
require
(
'./services/annotation-mapper'
);
import
annotationMapperService
from
'./services/annotation-mapper'
;
const
annotationsService
=
require
(
'./services/annotations'
);
import
annotationsService
from
'./services/annotations'
;
const
apiService
=
require
(
'./services/api'
);
import
apiService
from
'./services/api'
;
const
apiRoutesService
=
require
(
'./services/api-routes'
);
import
apiRoutesService
from
'./services/api-routes'
;
const
authService
=
require
(
'./services/oauth-auth'
);
import
authService
from
'./services/oauth-auth'
;
const
bridgeService
=
require
(
'../shared/bridge'
);
import
bridgeService
from
'../shared/bridge'
;
const
featuresService
=
require
(
'./services/features'
);
import
featuresService
from
'./services/features'
;
const
flashService
=
require
(
'./services/flash'
);
import
flashService
from
'./services/flash'
;
const
{
default
:
frameSyncService
}
=
require
(
'./services/frame-sync'
);
import
frameSyncService
from
'./services/frame-sync'
;
const
groupsService
=
require
(
'./services/groups'
);
import
groupsService
from
'./services/groups'
;
const
localStorageService
=
require
(
'./services/local-storage'
);
import
localStorageService
from
'./services/local-storage'
;
const
permissionsService
=
require
(
'./services/permissions'
);
import
permissionsService
from
'./services/permissions'
;
const
rootThreadService
=
require
(
'./services/root-thread'
);
import
rootThreadService
from
'./services/root-thread'
;
const
searchFilterService
=
require
(
'./services/search-filter'
);
import
searchFilterService
from
'./services/search-filter'
;
const
serviceUrlService
=
require
(
'./services/service-url'
);
import
serviceUrlService
from
'./services/service-url'
;
const
sessionService
=
require
(
'./services/session'
);
import
sessionService
from
'./services/session'
;
const
streamerService
=
require
(
'./services/streamer'
);
import
streamerService
from
'./services/streamer'
;
const
streamFilterService
=
require
(
'./services/stream-filter'
);
import
streamFilterService
from
'./services/stream-filter'
;
const
tagsService
=
require
(
'./services/tags'
);
import
tagsService
from
'./services/tags'
;
const
unicodeService
=
require
(
'./services/unicode'
);
import
unicodeService
from
'./services/unicode'
;
const
viewFilterService
=
require
(
'./services/view-filter'
);
import
viewFilterService
from
'./services/view-filter'
;
const
store
=
require
(
'./store'
);
// Redux store.
import
store
from
'./store'
;
// Utilities.
// Utilities.
const
Discovery
=
require
(
'../shared/discovery'
)
;
import
Discovery
from
'../shared/discovery'
;
const
OAuthClient
=
require
(
'./util/oauth-client'
)
;
import
OAuthClient
from
'./util/oauth-client'
;
const
VirtualThreadList
=
require
(
'./virtual-thread-list'
)
;
import
VirtualThreadList
from
'./virtual-thread-list'
;
const
random
=
require
(
'./util/random'
)
;
import
*
as
random
from
'./util/random'
;
const
time
=
require
(
'./util/time'
)
;
import
*
as
time
from
'./util/time'
;
const
{
encode
:
urlEncodeFilter
}
=
require
(
'./filter/url'
)
;
import
{
encode
as
urlEncodeFilter
}
from
'./filter/url'
;
function
startAngularApp
(
config
)
{
function
startAngularApp
(
config
)
{
angular
angular
.
module
(
'h'
,
[
.
module
(
'h'
,
[
angularRoute
,
angularToastr
])
// Angular addons which export the Angular module name
// via module.exports
angularRoute
,
angularToastr
,
])
// The root component for the application
// The root component for the application
.
component
(
'hypothesisApp'
,
hypothesisApp
)
.
component
(
'hypothesisApp'
,
hypothesisApp
)
...
...
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