@@ -63,13 +63,12 @@ define([
63
63
* @returns {Boolean }
64
64
*/
65
65
update : function ( ) {
66
- var checkVideoID = this . element . find ( this . options . container ) . find (
67
- '.' + this . options . videoClass
68
- ) . data ( 'code' ) ,
69
- eventVideoData = {
70
- oldVideoId : checkVideoID ? checkVideoID . toString ( ) : checkVideoID ,
71
- newVideoId : this . options . videoId ? this . options . videoId . toString ( ) : this . options . videoId
72
- } ;
66
+ var checkVideoID =
67
+ this . element . find ( this . options . container ) . find ( '.' + this . options . videoClass ) . data ( 'code' ) ,
68
+ eventVideoData = {
69
+ oldVideoId : checkVideoID ? checkVideoID . toString ( ) : checkVideoID ,
70
+ newVideoId : this . options . videoId ? this . options . videoId . toString ( ) : this . options . videoId
71
+ } ;
73
72
74
73
if ( checkVideoID && checkVideoID !== this . options . videoId ) {
75
74
this . _doUpdate ( ) ;
@@ -336,45 +335,45 @@ define([
336
335
var self = this ;
337
336
338
337
self . element . on ( 'finish_update_video finish_create_video' , $ . proxy ( function ( element , playerData ) {
339
- if ( ! self . _onlyVideoPlayer ||
340
- ! self . _isEditPage && playerData . oldVideoId !== playerData . newVideoId ||
341
- playerData . oldVideoId && playerData . oldVideoId !== playerData . newVideoId
342
- ) {
343
- self . element . updateInputFields ( {
344
- reset : false ,
345
- data : {
346
- title : data . title ,
347
- description : data . description
348
- }
349
- } ) ;
350
- this . _loadRemotePreview ( data . thumbnail ) ;
351
- }
352
- self . _onlyVideoPlayer = true ;
353
- } , this ) )
354
- . createVideoPlayer ( {
355
- videoId : data . videoId ,
356
- videoProvider : data . videoProvider ,
357
- useYoutubeNocookie : data . useYoutubeNocookie ,
358
- reset : false ,
359
- metaData : {
360
- DOM : {
361
- title : '.video-information.title span' ,
362
- uploaded : '.video-information.uploaded span' ,
363
- uploader : '.video-information.uploader span' ,
364
- duration : '.video-information.duration span' ,
365
- all : '.video-information span' ,
366
- wrapper : '.video-information'
367
- } ,
338
+ if ( ! self . _onlyVideoPlayer ||
339
+ ! self . _isEditPage && playerData . oldVideoId !== playerData . newVideoId ||
340
+ playerData . oldVideoId && playerData . oldVideoId !== playerData . newVideoId
341
+ ) {
342
+ self . element . updateInputFields ( {
343
+ reset : false ,
368
344
data : {
369
345
title : data . title ,
370
- uploaded : data . uploaded ,
371
- uploader : data . channel ,
372
- duration : data . duration ,
373
- uploaderUrl : data . channelId
346
+ description : data . description
374
347
}
348
+ } ) ;
349
+ this . _loadRemotePreview ( data . thumbnail ) ;
350
+ }
351
+ self . _onlyVideoPlayer = true ;
352
+ } , this ) )
353
+ . createVideoPlayer ( {
354
+ videoId : data . videoId ,
355
+ videoProvider : data . videoProvider ,
356
+ useYoutubeNocookie : data . useYoutubeNocookie ,
357
+ reset : false ,
358
+ metaData : {
359
+ DOM : {
360
+ title : '.video-information.title span' ,
361
+ uploaded : '.video-information.uploaded span' ,
362
+ uploader : '.video-information.uploader span' ,
363
+ duration : '.video-information.duration span' ,
364
+ all : '.video-information span' ,
365
+ wrapper : '.video-information'
366
+ } ,
367
+ data : {
368
+ title : data . title ,
369
+ uploaded : data . uploaded ,
370
+ uploader : data . channel ,
371
+ duration : data . duration ,
372
+ uploaderUrl : data . channelId
375
373
}
376
- } )
377
- . off ( 'finish_update_video finish_create_video' ) ;
374
+ }
375
+ } )
376
+ . off ( 'finish_update_video finish_create_video' ) ;
378
377
379
378
this . _videoRequestComplete = true ;
380
379
} ,
@@ -559,10 +558,10 @@ define([
559
558
*/
560
559
_uploadImage : function ( file , oldFile , callback ) {
561
560
var url = this . options . saveVideoUrl ,
562
- data = {
563
- files : file ,
564
- url : url
565
- } ;
561
+ data = {
562
+ files : file ,
563
+ url : url
564
+ } ;
566
565
567
566
this . _blockActionButtons ( true , true ) ;
568
567
this . _uploadFile ( data , $ . proxy ( function ( result ) {
@@ -601,7 +600,7 @@ define([
601
600
$ . each ( this . element . find ( this . _videoFormSelector ) . serializeArray ( ) , function ( i , field ) {
602
601
data [ field . name ] = field . value ;
603
602
} ) ;
604
- data . disabled = this . element . find ( this . _videoDisableinputSelector ) . attr ( 'checked' ) ? 1 : 0 ;
603
+ data . disabled = this . element . find ( this . _videoDisableinputSelector ) . prop ( 'checked' ) ? 1 : 0 ;
605
604
data [ 'media_type' ] = 'external-video' ;
606
605
data . oldFile = oldFile ;
607
606
@@ -682,26 +681,26 @@ define([
682
681
modalClass : 'mage-new-video-dialog form-inline' ,
683
682
title : $ . mage . __ ( 'New Video' ) ,
684
683
buttons : [
685
- {
686
- text : $ . mage . __ ( 'Save' ) ,
687
- class : 'action-primary video-create-button' ,
688
- click : $ . proxy ( widget . _onCreate , widget )
689
- } ,
690
- {
691
- text : $ . mage . __ ( 'Cancel' ) ,
692
- class : 'video-cancel-button' ,
693
- click : $ . proxy ( widget . _onCancel , widget )
694
- } ,
695
- {
696
- text : $ . mage . __ ( 'Delete' ) ,
697
- class : 'video-delete-button' ,
698
- click : $ . proxy ( widget . _onDelete , widget )
699
- } ,
700
- {
701
- text : $ . mage . __ ( 'Save' ) ,
702
- class : 'action-primary video-edit' ,
703
- click : $ . proxy ( widget . _onUpdate , widget )
704
- }
684
+ {
685
+ text : $ . mage . __ ( 'Save' ) ,
686
+ class : 'action-primary video-create-button' ,
687
+ click : $ . proxy ( widget . _onCreate , widget )
688
+ } ,
689
+ {
690
+ text : $ . mage . __ ( 'Cancel' ) ,
691
+ class : 'video-cancel-button' ,
692
+ click : $ . proxy ( widget . _onCancel , widget )
693
+ } ,
694
+ {
695
+ text : $ . mage . __ ( 'Delete' ) ,
696
+ class : 'video-delete-button' ,
697
+ click : $ . proxy ( widget . _onDelete , widget )
698
+ } ,
699
+ {
700
+ text : $ . mage . __ ( 'Save' ) ,
701
+ class : 'action-primary video-edit' ,
702
+ click : $ . proxy ( widget . _onUpdate , widget )
703
+ }
705
704
] ,
706
705
707
706
/**
@@ -858,7 +857,8 @@ define([
858
857
}
859
858
860
859
nvs . removeClass ( reqClass ) ;
861
- } , this
860
+ } ,
861
+ this
862
862
) ) ;
863
863
} ,
864
864
@@ -895,10 +895,11 @@ define([
895
895
imageData [ fieldName ] = _field . val ( ) ;
896
896
}
897
897
} . bind ( this ) ) ;
898
- flagChecked = this . element . find ( this . _videoDisableinputSelector ) . attr ( 'checked' ) ? 1 : 0 ;
898
+ flagChecked = this . element . find ( this . _videoDisableinputSelector ) . prop ( 'checked' ) ? 1 : 0 ;
899
899
this . _gallery . find ( 'input[name*="' + itemId + '][disabled]"]' ) . val ( flagChecked ) ;
900
900
this . _gallery . find ( _inputSelector ) . siblings ( '.image-fade' ) . css (
901
- 'visibility' , flagChecked ? 'visible' : 'hidden'
901
+ 'visibility' ,
902
+ flagChecked ? 'visible' : 'hidden'
902
903
) ;
903
904
imageData . disabled = flagChecked ;
904
905
@@ -929,7 +930,8 @@ define([
929
930
this . _replaceImage ( imageData . file , imageData . file , imageData ) ;
930
931
callback ( 0 , imageData ) ;
931
932
}
932
- } , this
933
+ } ,
934
+ this
933
935
) ) ;
934
936
} ,
935
937
@@ -1107,8 +1109,8 @@ define([
1107
1109
newVideoForm = this . element . find ( this . _videoFormSelector ) ;
1108
1110
1109
1111
$ ( newVideoForm ) . find ( 'input[type="hidden"][name!="form_key"]' ) . val ( '' ) ;
1110
- this . _gallery . find ( 'input[name*="' + this . element . find (
1111
- this . _itemIdSelector ) . val ( ) + '"]'
1112
+ this . _gallery . find (
1113
+ 'input[name*="' + this . element . find ( this . _itemIdSelector ) . val ( ) + '"]'
1112
1114
) . parent ( ) . removeClass ( 'active' ) ;
1113
1115
1114
1116
try {
@@ -1152,7 +1154,7 @@ define([
1152
1154
self . _videoFormSelector + ' input[value="' + imageType + '"]'
1153
1155
) ;
1154
1156
1155
- self . _changeRole ( imageType , imageCheckbox . attr ( 'checked' ) , imageData ) ;
1157
+ self . _changeRole ( imageType , imageCheckbox . prop ( 'checked' ) , imageData ) ;
1156
1158
} ) ;
1157
1159
}
1158
1160
} ,
@@ -1265,7 +1267,7 @@ define([
1265
1267
} ) ;
1266
1268
1267
1269
flagChecked = container . find ( 'input[name*="disabled"]' ) . val ( ) > 0 ;
1268
- self . _gallery . find ( self . _videoDisableinputSelector ) . attr ( 'checked' , flagChecked ) ;
1270
+ self . _gallery . find ( self . _videoDisableinputSelector ) . prop ( 'checked' , flagChecked ) ;
1269
1271
1270
1272
file = self . _gallery . find ( '#file_name' ) . val ( container . find ( 'input[name*="file"]' ) . val ( ) ) ;
1271
1273
0 commit comments