Index: branches/MwEmbedStandAlone/modules/AddMedia/mw.RemoteSearchDriver.js |
— | — | @@ -2810,7 +2810,7 @@ |
2811 | 2811 | $j( _this.target_container ).dialog( 'option', 'title', |
2812 | 2812 | gM( 'mwe-preview_insert_resource', resource.title ) ); |
2813 | 2813 | |
2814 | | - // Update buttons preview: |
| 2814 | + // Update buttons |
2815 | 2815 | $j( buttonPaneSelector ) |
2816 | 2816 | .html( |
2817 | 2817 | $j.btnHtml( gM( 'rsd_do_insert' ), 'preview_do_insert', 'check' ) + ' ' ) |
— | — | @@ -2828,8 +2828,10 @@ |
2829 | 2829 | .text( gM('mwe-do-more-modification' ) ) |
2830 | 2830 | .click( function() { |
2831 | 2831 | $j( '#rsd_preview_display' ).remove(); |
| 2832 | + |
2832 | 2833 | // Restore title: |
2833 | 2834 | $j( _this.target_container ).dialog( 'option', 'title', origTitle ); |
| 2835 | + |
2834 | 2836 | // Restore buttons (from the clipEdit object::) |
2835 | 2837 | _this.clipEdit.updateInsertControlActions(); |
2836 | 2838 | return false; |
— | — | @@ -2841,15 +2843,16 @@ |
2842 | 2844 | var pos = $j( _this.target_textbox ).textSelection( 'getCaretPosition' ); |
2843 | 2845 | var editWikiText = $j( _this.target_textbox ).val(); |
2844 | 2846 | var wikiText = editWikiText.substr(0, pos) + embed_code + editWikiText.substr( pos ); |
| 2847 | + |
2845 | 2848 | mw.parseWikiText( |
2846 | 2849 | wikiText, |
2847 | 2850 | _this.target_title, |
2848 | | - function( phtml ) { |
2849 | | - $j( '#rsd_preview_display' ).html( phtml ); |
| 2851 | + function( previewHtml ) { |
| 2852 | + $j( '#rsd_preview_display' ).html( previewHtml ); |
2850 | 2853 | if( mw.documentHasPlayerTags() ) { |
2851 | 2854 | mw.load( 'EmbedPlayer', function() { |
2852 | 2855 | // Update the display of video tag items (if any) |
2853 | | - $j( mw.getConfig( 'rewritePlayerTags' ) ).embedPlayer(); |
| 2856 | + $j.embedPlayers(); |
2854 | 2857 | }); |
2855 | 2858 | } |
2856 | 2859 | } |
Index: branches/MwEmbedStandAlone/modules/ClipEdit/loader.js |
— | — | @@ -18,7 +18,7 @@ |
19 | 19 | [ |
20 | 20 | 'mw.ClipEdit', |
21 | 21 | 'mw.style.ClipEdit' |
22 | | - ], |
| 22 | + ], |
23 | 23 | function(){ |
24 | 24 | callback( 'ClipEdit' ); |
25 | 25 | } |
Index: branches/MwEmbedStandAlone/modules/ClipEdit/mw.ClipEdit.js |
— | — | @@ -700,7 +700,7 @@ |
701 | 701 | } else if ( this.getMediaType() == 'video' ) { |
702 | 702 | this.applyVideoStartEnd(); |
703 | 703 | } |
704 | | - // copy over the desc text to the resource object |
| 704 | + // copy over the description text to the resource object |
705 | 705 | _this.resource['inlineDesc'] = $j( '#mv_inline_img_desc' ).val(); |
706 | 706 | }, |
707 | 707 | |
— | — | @@ -960,7 +960,7 @@ |
961 | 961 | /** |
962 | 962 | * Do the crop Interface |
963 | 963 | */ |
964 | | - doCropInterface:function() { |
| 964 | + doCropInterface: function() { |
965 | 965 | var _this = this; |
966 | 966 | $j( '.mw_crop_msg' ).hide(); |
967 | 967 | $j( '.mw_crop_msg_load' ).show(); |
Index: branches/MwEmbedStandAlone/mwEmbed.js |
— | — | @@ -808,20 +808,28 @@ |
809 | 809 | * @param {String} title Context title of the content to be parsed |
810 | 810 | * @param {Function} callback Function called with api parser output |
811 | 811 | */ |
812 | | - mw.parseWikiText = function( wikitext, title, callback ) { |
813 | | - // make sure we have json to decode the resposne |
814 | | - mw.load('JSON', function(){ |
815 | | - $j.post( mw.getLocalApiUrl(), |
816 | | - { |
817 | | - 'action': 'parse', |
818 | | - 'format': 'json', |
819 | | - 'title' : title, |
820 | | - 'text': wikitext |
821 | | - }, function( data ) { |
822 | | - var pageData = JSON.parse( data ); |
823 | | - callback( pageData.parse.text['*'] ); |
824 | | - } |
825 | | - ); |
| 812 | + mw.parseWikiText = function( wikitext, title, callback ) { |
| 813 | + $j.ajax({ |
| 814 | + type: 'POST', |
| 815 | + url: mw.getLocalApiUrl(), |
| 816 | + // Give the wiki 60 seconds to parse the wiki-text |
| 817 | + timeout : 60000, |
| 818 | + data: { |
| 819 | + 'action': 'parse', |
| 820 | + 'format': 'json', |
| 821 | + 'title' : title, |
| 822 | + 'text': wikitext |
| 823 | + }, |
| 824 | + dataType: 'json', |
| 825 | + success: function( data ) { |
| 826 | + // xxx should handle other failures |
| 827 | + callback( data.parse.text['*'] ); |
| 828 | + }, |
| 829 | + error: function( XMLHttpRequest, textStatus, errorThrown ){ |
| 830 | + // xxx should better handle failures |
| 831 | + mw.log( "Error: mw.parseWikiText:" + textStatus ); |
| 832 | + callback( "Error: failed to parse wikitext " ); |
| 833 | + } |
826 | 834 | }); |
827 | 835 | } |
828 | 836 | |