File tree Expand file tree Collapse file tree 3 files changed +29
-23
lines changed
Expand file tree Collapse file tree 3 files changed +29
-23
lines changed Original file line number Diff line number Diff line change @@ -423,6 +423,9 @@ http://sourceforge.net/adobe/cmap/wiki/License/
423423 var DEFAULT_URL = ' ${url}' ;
424424 window .pymChild .sendMessage (' embed' , ' embed-responsive-pdf' );
425425 </script >
426+ % if enable_hypothesis:
427+ <script src =" /static/js/mfr.child.hypothesis.js" ></script >
428+ % endif
426429 </body >
427430</html >
428431
Original file line number Diff line number Diff line change 1+ ; ( function ( ) {
2+ 'use strict' ;
3+
4+ var hypothesisLoaded = false ;
5+
6+ window . pymChild . onMessage ( 'startHypothesis' , startHypothesis ) ;
7+
8+ window . addEventListener ( 'message' , function ( event ) {
9+ if ( event . data === 'startHypothesis' ) {
10+ startHypothesis ( event ) ;
11+ }
12+ } ) ;
13+
14+ function startHypothesis ( event ) {
15+ if ( hypothesisLoaded ) {
16+ return ;
17+ }
18+
19+ var script = window . document . createElement ( 'script' ) ;
20+ script . type = 'text/javascript' ;
21+ script . src = 'https://hypothes.is/embed.js' ;
22+ window . document . head . appendChild ( script ) ;
23+ window . document . body . classList . add ( 'show-hypothesis' ) ;
24+ hypothesisLoaded = true ;
25+ } ;
26+ } ) ( ) ;
Original file line number Diff line number Diff line change 2626 window . pymChild . onMessage ( 'resize' , function ( ) {
2727 window . pymChild . sendHeight ( ) ;
2828 } ) ;
29-
30- var hypothesisLoaded = false ;
31-
32- window . pymChild . onMessage ( 'startHypothesis' , startHypothesis ) ;
33-
34- window . addEventListener ( 'message' , function ( event ) {
35- if ( event . data === 'startHypothesis' ) {
36- startHypothesis ( event ) ;
37- }
38- } ) ;
39-
40- function startHypothesis ( event ) {
41- if ( hypothesisLoaded ) {
42- return ;
43- }
44-
45- var script = window . document . createElement ( 'script' ) ;
46- script . type = 'text/javascript' ;
47- script . src = 'https://hypothes.is/embed.js' ;
48- window . document . head . appendChild ( script ) ;
49- window . document . body . classList . add ( 'show-hypothesis' ) ;
50- hypothesisLoaded = true ;
51- } ;
5229} ) ( ) ;
You can’t perform that action at this time.
0 commit comments