File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 1313 margin : 0 auto;
1414 padding : 30px ;
1515 }
16+ # con-error {
17+ position : fixed;
18+ top : 0px ;
19+ right : 0px ;
20+ padding : 5px ;
21+ background : white;
22+ color : red;
23+ }
1624 </ style >
1725 < script src ="/socket.io/socket.io.js "> </ script >
1826 < script >
1927 var socket = io . connect ( 'http://' + window . location . host + '/' ) ;
2028 socket . on ( 'connect' , function ( ) {
29+ setDisconnected ( false ) ;
2130 socket . on ( 'newContent' , function ( newHTML ) {
2231 document . querySelector ( ".markdown-body" ) . innerHTML = newHTML ;
2332 } ) ;
3241 document . body . innerHTML = firefoxWarning ;
3342 } ) ;
3443 } ) ;
44+ socket . on ( 'disconnect' , function ( ) {
45+ setDisconnected ( true ) ;
46+ } ) ;
3547
3648 try {
3749 eval ( '// If CSP is active, then this is blocked' ) ;
4355 meta . setAttribute ( 'content' , "script-src 'none';" ) ;
4456 document . head . appendChild ( meta ) ;
4557 }
58+
59+ function setDisconnected ( isDisconnected ) {
60+ document . getElementById ( 'con-error' ) . style . display =
61+ isDisconnected ? 'block' : 'none' ;
62+ }
4663 </ script >
4764</ head >
4865< body >
5774 </ div >
5875 </ div >
5976 </ div >
77+ < div id ="con-error " style ="display:none "> Live preview is unavailable</ div >
6078</ body >
6179</ html >
You can’t perform that action at this time.
0 commit comments