File tree Expand file tree Collapse file tree 2 files changed +29
-2
lines changed
public/assets/backend/js/dialog Expand file tree Collapse file tree 2 files changed +29
-2
lines changed Original file line number Diff line number Diff line change 251251 autodestroy : true ,
252252 draggable : false ,
253253 animate : true ,
254+ enableScript : false ,
254255 description : '' ,
255256 tabindex : - 1
256257 } ;
660661 updateMessage : function ( ) {
661662 if ( this . isRealized ( ) ) {
662663 var message = this . createDynamicContent ( this . getMessage ( ) ) ;
664+ var scripts = [ ] ;
665+ if ( this . options . enableScript ) {
666+ var $h = $ ( message ) ;
667+ scripts = $h . find ( 'script' ) ;
668+ $h . find ( 'script' ) . remove ( ) ;
669+ message = $h . html ( ) ;
670+ }
663671 this . getModalBody ( ) . find ( '.' + this . getNamespace ( 'message' ) ) . html ( '' ) . append ( message ) ;
672+ console . dir ( scripts )
673+ if ( scripts && scripts . length > 0 ) {
674+ var scriptText = '' ;
675+ for ( var i = 0 ; i < scripts . length ; i ++ ) {
676+ var script = scripts [ i ] ;
677+ if ( script . src ) {
678+ if ( $ ( 'script[src$="' + script . src + '"]' ) . length < 1 ) $ ( 'body' ) . append ( '<script type="text/javascript" src="' + script . src + '"></script>' ) ;
679+ } else if ( script . text ) {
680+ scriptText += '<script type="text/javascript">' + script . text + '</script>' ;
681+ }
682+ }
683+ if ( scriptText ) this . getModalBody ( ) . data ( 'script-text' , scriptText ) ;
684+ }
685+
664686 }
665687
666688 return this ;
11741196 } ) ;
11751197 this . getModal ( ) . on ( 'shown.bs.modal' , { dialog : this } , function ( event ) {
11761198 var dialog = event . data . dialog ;
1177- dialog . isModalEvent ( event ) && typeof dialog . options . onshown === 'function' && dialog . options . onshown ( dialog ) ;
1199+ if ( dialog . isModalEvent ( event ) ) {
1200+ if ( dialog . getModalBody ( ) . data ( 'script-text' ) ) {
1201+ $ ( 'body' ) . append ( dialog . getModalBody ( ) . data ( 'script-text' ) ) ;
1202+ }
1203+ typeof dialog . options . onshown === 'function' && dialog . options . onshown ( dialog ) ;
1204+ }
11781205 } ) ;
11791206 this . getModal ( ) . on ( 'hide.bs.modal' , { dialog : this } , function ( event ) {
11801207 var dialog = event . data . dialog ;
You can’t perform that action at this time.
0 commit comments