@@ -31,20 +31,26 @@ $.widget( "mobile.fetchlink", $.mobile.widget, {
3131 method += "With" ;
3232 }
3333
34- if ( url && method ) {
34+ if ( url && method ) {
35+
36+ targetEl . ajaxStart ( function ( ) {
37+ $ ( this ) . trigger ( 'inlineLoader' ) ;
38+ } ) ;
39+
3540 $ . get ( url , function ( data ) {
3641 /* Swiped from the jQuery core; $.get() should really be replaced by .load() */
3742 var rscript = / < s c r i p t \b [ ^ < ] * (?: (? ! < \/ s c r i p t > ) < [ ^ < ] * ) * < \/ s c r i p t > / gi,
3843 responseEl = $ ( load ? $ ( "<div/>" ) . append ( data . replace ( rscript , "" ) ) . find ( load ) : data ) ;
3944
40- /* Do we want to do this? */
41- $ ( load ) . remove ( ) ;
42- targetEl [ method ] ( responseEl )
43-
44- responseEl
45- . trigger ( "create" )
46- . trigger ( "fetchlink" , { target : targetEl , data : responseEl } ) ;
45+ setTimeout ( function ( ) {
46+ targetEl [ method ] ( responseEl ) ;
47+ responseEl
48+ . trigger ( "create" )
49+ . trigger ( "fetchlink" , { target : targetEl , data : responseEl } ) ;
50+ } , 1500 ) ;
51+
4752 } ) ;
53+
4854 }
4955 }
5056 return false ;
@@ -53,6 +59,11 @@ $.widget( "mobile.fetchlink", $.mobile.widget, {
5359 }
5460} ) ;
5561
62+ $ ( document ) . bind ( "inlineLoader" , function ( e ) {
63+ $ ( e . target ) . html ( "<div class='ui-loader' style='display: block; position: static; float: none; width: 100%; padding: 1em 0 .5em 0; margin: 0;'><span class='ui-icon ui-icon-loading spin' style='top: 0; border: 1px solid red;'></span><h1></h1></div>" ) ;
64+ } ) ;
65+
66+
5667//auto self-init widgets
5768$ ( document ) . bind ( "pagecreate create" , function ( e ) {
5869 $ ( $ . mobile . fetchlink . prototype . options . initSelector , e . target ) . fetchlink ( ) ;
0 commit comments