@@ -327,6 +327,7 @@ __options.Options = Options = (function() {
327
327
this . mindelay = 1000 ;
328
328
this . maxdelay = 60000 ;
329
329
this . handshake_timeout = 5000 ;
330
+ this . animate = false ;
330
331
}
331
332
Options . prototype . set = function ( name , value ) {
332
333
switch ( typeof this [ name ] ) {
@@ -918,15 +919,16 @@ __livereload.LiveReload = LiveReload = (function() {
918
919
} ;
919
920
920
921
LiveReload . prototype . performReload = function ( message ) {
921
- var _ref , _ref2 ;
922
+ var _base , _ref , _ref2 ;
922
923
this . log ( "LiveReload received reload request for " + message . path + "." ) ;
923
- return this . reloader . reload ( message . path , {
924
+ this . reloader . reload ( message . path , {
924
925
liveCSS : ( _ref = message . liveCSS ) != null ? _ref : true ,
925
926
liveImg : ( _ref2 = message . liveImg ) != null ? _ref2 : true ,
926
927
originalPath : message . originalPath || '' ,
927
928
overrideURL : message . overrideURL || '' ,
928
929
serverURL : "http://" + this . options . host + ":" + this . options . port
929
930
} ) ;
931
+ return typeof ( _base = this . listeners ) . reload === "function" ? _base . reload ( ) : void 0 ;
930
932
} ;
931
933
932
934
LiveReload . prototype . performAlert = function ( message ) {
@@ -980,6 +982,24 @@ __livereload.LiveReload = LiveReload = (function() {
980
982
} ) ;
981
983
} ;
982
984
985
+ LiveReload . prototype . setUpCSSTransitions = function ( ) {
986
+ var cssText , head , prefixer , styleNode ;
987
+ prefixer = function ( declaration ) {
988
+ return ( [ '-webkit-' , '-moz-' , '' ] . map ( function ( item ) {
989
+ return "" + item + declaration ;
990
+ } ) ) . join ( ' ' ) ;
991
+ } ;
992
+ head = document . getElementsByTagName ( 'head' ) [ 0 ] ;
993
+ styleNode = document . createElement ( "style" ) ;
994
+ cssText = ".livereload-reloaded * { " + ( prefixer ( 'transition: all 280ms ease-out;' ) ) + " }" ;
995
+ if ( styleNode . styleSheet ) {
996
+ styleNode . styleSheet . cssText = cssText ;
997
+ } else {
998
+ styleNode . appendChild ( document . createTextNode ( cssText ) ) ;
999
+ }
1000
+ return head . appendChild ( styleNode ) ;
1001
+ } ;
1002
+
983
1003
return LiveReload ;
984
1004
985
1005
} ) ( ) ;
@@ -1072,11 +1092,24 @@ LiveReload.on('shutdown', function() {
1072
1092
return delete window . LiveReload ;
1073
1093
} ) ;
1074
1094
LiveReload . on ( 'connect' , function ( ) {
1095
+ if ( ! ! / t r u e | 1 $ / . test ( LiveReload . options . animate ) ) {
1096
+ LiveReload . setUpCSSTransitions ( ) ;
1097
+ }
1075
1098
return CustomEvents . fire ( document , 'LiveReloadConnect' ) ;
1076
1099
} ) ;
1077
1100
LiveReload . on ( 'disconnect' , function ( ) {
1078
1101
return CustomEvents . fire ( document , 'LiveReloadDisconnect' ) ;
1079
1102
} ) ;
1103
+ LiveReload . on ( 'reload' , function ( ) {
1104
+ var existingHtmlClass , html , reloadedClass , _ref ;
1105
+ html = document . body . parentNode ;
1106
+ reloadedClass = ' livereload-reloaded' ;
1107
+ existingHtmlClass = ( _ref = html . getAttribute ( 'class' ) ) != null ? _ref : '' ;
1108
+ html . setAttribute ( 'class' , "" + ( existingHtmlClass . replace ( reloadedClass , '' ) ) + " " + reloadedClass ) ;
1109
+ return setTimeout ( ( function ( ) {
1110
+ return html . setAttribute ( 'class' , existingHtmlClass . replace ( reloadedClass , '' ) ) ;
1111
+ } ) , 300 ) ;
1112
+ } ) ;
1080
1113
CustomEvents . bind ( document , 'LiveReloadShutDown' , function ( ) {
1081
1114
return LiveReload . shutDown ( ) ;
1082
1115
} ) ;
0 commit comments