Index: branches/js2-work/phase3/js/mwEmbed/mwEmbed.js |
— | — | @@ -2459,10 +2459,7 @@ |
2460 | 2460 | // Make sure we have jQuery: |
2461 | 2461 | mw.load( 'window.jQuery', function() { |
2462 | 2462 | if ( ! window['$j'] ) { |
2463 | | - // Don't use noConflict() since other web embeding context may |
2464 | | - // have mixed use of $ aliased to jQuery or not but would |
2465 | | - // mannage it themselves with use of jQuery.noConflict(); |
2466 | | - window['$j'] = jQuery; |
| 2463 | + window['$j'] = jQuery.noConflict(); |
2467 | 2464 | } |
2468 | 2465 | mw.setConfig( 'jquery_skin_path', mw.getMwEmbedPath() + 'jquery/jquery.ui/themes/' + mw.getConfig( 'jQueryUISkin' ) + '/' ); |
2469 | 2466 | |
— | — | @@ -2901,10 +2898,17 @@ |
2902 | 2899 | mwCheckBody(); |
2903 | 2900 | }, 250); |
2904 | 2901 | |
2905 | | -// If window.jQuery is already avaliable set mapping before setup |
2906 | | -// ( we don't use noConflict since other pages that include |
2907 | | -// mwEmbed may depend on $ = jQuery, with a simple |
2908 | | -// alias we should be fine |
| 2902 | +// Somewhat weird hack to keep jQuery in $ when its |
| 2903 | +// already there, but also use noConflict to get $j. |
2909 | 2904 | if( window.jQuery ){ |
2910 | | - window['$j'] = jQuery(); |
2911 | | -} |
\ No newline at end of file |
| 2905 | + var dollarFlag = false; |
| 2906 | + if( $ && $.fn && $.fn.jquery ){ |
| 2907 | + // NOTE we could check the version of |
| 2908 | + // jQuery and do a removal call if too old |
| 2909 | + dollarFlag = true; |
| 2910 | + } |
| 2911 | + window['$j'] = jQuery.noConflict(); |
| 2912 | + if( dollarFlag ) { |
| 2913 | + window['$'] = jQuery.noConflict(); |
| 2914 | + } |
| 2915 | +} |