@@ -63,13 +63,12 @@ define([
6363 * @returns {Boolean }
6464 */
6565 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+ } ;
7372
7473 if ( checkVideoID && checkVideoID !== this . options . videoId ) {
7574 this . _doUpdate ( ) ;
@@ -336,45 +335,45 @@ define([
336335 var self = this ;
337336
338337 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 ,
368344 data : {
369345 title : data . title ,
370- uploaded : data . uploaded ,
371- uploader : data . channel ,
372- duration : data . duration ,
373- uploaderUrl : data . channelId
346+ description : data . description
374347 }
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
375373 }
376- } )
377- . off ( 'finish_update_video finish_create_video' ) ;
374+ }
375+ } )
376+ . off ( 'finish_update_video finish_create_video' ) ;
378377
379378 this . _videoRequestComplete = true ;
380379 } ,
@@ -559,10 +558,10 @@ define([
559558 */
560559 _uploadImage : function ( file , oldFile , callback ) {
561560 var url = this . options . saveVideoUrl ,
562- data = {
563- files : file ,
564- url : url
565- } ;
561+ data = {
562+ files : file ,
563+ url : url
564+ } ;
566565
567566 this . _blockActionButtons ( true , true ) ;
568567 this . _uploadFile ( data , $ . proxy ( function ( result ) {
@@ -601,7 +600,7 @@ define([
601600 $ . each ( this . element . find ( this . _videoFormSelector ) . serializeArray ( ) , function ( i , field ) {
602601 data [ field . name ] = field . value ;
603602 } ) ;
604- data . disabled = this . element . find ( this . _videoDisableinputSelector ) . attr ( 'checked' ) ? 1 : 0 ;
603+ data . disabled = this . element . find ( this . _videoDisableinputSelector ) . prop ( 'checked' ) ? 1 : 0 ;
605604 data [ 'media_type' ] = 'external-video' ;
606605 data . oldFile = oldFile ;
607606
@@ -682,26 +681,26 @@ define([
682681 modalClass : 'mage-new-video-dialog form-inline' ,
683682 title : $ . mage . __ ( 'New Video' ) ,
684683 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+ }
705704 ] ,
706705
707706 /**
@@ -858,7 +857,8 @@ define([
858857 }
859858
860859 nvs . removeClass ( reqClass ) ;
861- } , this
860+ } ,
861+ this
862862 ) ) ;
863863 } ,
864864
@@ -895,10 +895,11 @@ define([
895895 imageData [ fieldName ] = _field . val ( ) ;
896896 }
897897 } . bind ( this ) ) ;
898- flagChecked = this . element . find ( this . _videoDisableinputSelector ) . attr ( 'checked' ) ? 1 : 0 ;
898+ flagChecked = this . element . find ( this . _videoDisableinputSelector ) . prop ( 'checked' ) ? 1 : 0 ;
899899 this . _gallery . find ( 'input[name*="' + itemId + '][disabled]"]' ) . val ( flagChecked ) ;
900900 this . _gallery . find ( _inputSelector ) . siblings ( '.image-fade' ) . css (
901- 'visibility' , flagChecked ? 'visible' : 'hidden'
901+ 'visibility' ,
902+ flagChecked ? 'visible' : 'hidden'
902903 ) ;
903904 imageData . disabled = flagChecked ;
904905
@@ -929,7 +930,8 @@ define([
929930 this . _replaceImage ( imageData . file , imageData . file , imageData ) ;
930931 callback ( 0 , imageData ) ;
931932 }
932- } , this
933+ } ,
934+ this
933935 ) ) ;
934936 } ,
935937
@@ -1107,8 +1109,8 @@ define([
11071109 newVideoForm = this . element . find ( this . _videoFormSelector ) ;
11081110
11091111 $ ( 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 ( ) + '"]'
11121114 ) . parent ( ) . removeClass ( 'active' ) ;
11131115
11141116 try {
@@ -1152,7 +1154,7 @@ define([
11521154 self . _videoFormSelector + ' input[value="' + imageType + '"]'
11531155 ) ;
11541156
1155- self . _changeRole ( imageType , imageCheckbox . attr ( 'checked' ) , imageData ) ;
1157+ self . _changeRole ( imageType , imageCheckbox . prop ( 'checked' ) , imageData ) ;
11561158 } ) ;
11571159 }
11581160 } ,
@@ -1265,7 +1267,7 @@ define([
12651267 } ) ;
12661268
12671269 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 ) ;
12691271
12701272 file = self . _gallery . find ( '#file_name' ) . val ( container . find ( 'input[name*="file"]' ) . val ( ) ) ;
12711273
0 commit comments