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
758fc27f
Commit
758fc27f
authored
Jun 11, 2017
by
Juan Corona
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add helper to FrameUtil that calls back when an iframe is ready
parent
7d142bd0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
4 deletions
+12
-4
cross-frame.coffee
src/annotator/plugin/cross-frame.coffee
+1
-4
frame-util.js
src/annotator/util/frame-util.js
+11
-0
No files found.
src/annotator/plugin/cross-frame.coffee
View file @
758fc27f
...
...
@@ -90,10 +90,7 @@ module.exports = class CrossFrame extends Plugin
_handleFrame
=
(
frame
)
->
if
!
FrameUtil
.
isAccessible
(
frame
)
then
return
if
frame
.
contentDocument
.
readyState
!=
'complete'
frame
.
addEventListener
'load'
,
->
_injectToFrame
(
frame
)
else
FrameUtil
.
isLoaded
frame
,
()
->
_injectToFrame
(
frame
)
_iframeUnloaded
=
(
frame
)
->
...
...
src/annotator/util/frame-util.js
View file @
758fc27f
...
...
@@ -43,10 +43,21 @@ function isValid (iframe) {
return
iframe
.
className
!==
'h-sidebar-iframe'
;
}
function
isLoaded
(
iframe
,
callback
)
{
if
(
iframe
.
contentDocument
.
readyState
!==
'complete'
)
{
iframe
.
addEventListener
(
'load'
,
function
()
{
callback
();
});
}
else
{
callback
();
}
}
module
.
exports
=
{
findFrames
:
findFrames
,
hasHypothesis
:
hasHypothesis
,
injectHypothesis
:
injectHypothesis
,
isAccessible
:
isAccessible
,
isValid
:
isValid
,
isLoaded
:
isLoaded
,
};
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