File tree Expand file tree Collapse file tree 2 files changed +15
-24
lines changed
app/assets/javascripts/blacklight Expand file tree Collapse file tree 2 files changed +15
-24
lines changed Original file line number Diff line number Diff line change 4949 var unique_id = form . attr ( "data-doc-id" ) || Math . random ( ) ;
5050 // if form is currently using method delete to change state,
5151 // then checkbox is currently checked
52- var checked = ( form . find ( "input[name=_method][value=delete]" ) . size ( ) != 0 ) ;
52+ var checked = ( form . find ( "input[name=_method][value=delete]" ) . length != 0 ) ;
5353
5454 var checkbox = $ ( '<input type="checkbox">' )
5555 . addClass ( options . css_class )
Original file line number Diff line number Diff line change @@ -9,31 +9,22 @@ Blacklight = function() {
99 for ( var i = 0 ; i < buffer . length ; i ++ ) {
1010 buffer [ i ] . call ( ) ;
1111 }
12- } ,
13-
14- listeners : function ( ) {
15- var listeners = [ ] ;
16- if ( typeof Turbolinks !== 'undefined' && Turbolinks . supported ) {
17- // Turbolinks 5
18- if ( Turbolinks . BrowserAdapter ) {
19- listeners . push ( 'turbolinks:load' ) ;
20- } else {
21- // Turbolinks < 5
22- listeners . push ( 'page:load' , 'ready' ) ;
23- }
24- } else {
25- listeners . push ( 'ready' ) ;
26- }
27-
28- return listeners . join ( ' ' ) ;
2912 }
3013 } ;
3114} ( ) ;
3215
3316// turbolinks triggers page:load events on page transition
34- // If app isn't using turbolinks, this event will never be triggered, no prob.
35- $ ( document ) . on ( Blacklight . listeners ( ) , function ( ) {
36- Blacklight . activate ( ) ;
37- } ) ;
38-
39-
17+ // If app isn't using turbolinks, this event will never be triggered, no prob.
18+ // $(document).on('ready') is deprecated in JQuery 1.8
19+ if ( typeof Turbolinks !== 'undefined' && Turbolinks . supported ) {
20+ // Turbolinks 5
21+ if ( Turbolinks . BrowserAdapter ) {
22+ $ ( document ) . on ( 'turbolinks:load' , function ( ) { Blacklight . activate ( ) ; } ) ;
23+ } else {
24+ // Turbolinks < 5
25+ $ ( document ) . on ( 'page:load' , function ( ) { Blacklight . activate ( ) ; } ) ;
26+ $ ( document ) . ready ( function ( ) { Blacklight . activate ( ) ; } ) ;
27+ }
28+ } else {
29+ $ ( document ) . ready ( function ( ) { Blacklight . activate ( ) ; } ) ;
30+ }
You can’t perform that action at this time.
0 commit comments