http://www.mediawiki.org/wiki/Special:Code/MediaWiki/59477

Revision: 59477
Author:   catrope
Date:     2009-11-26 23:12:43 +0000 (Thu, 26 Nov 2009)

Log Message:
-----------
Delete a bunch of stuff that shouldn't have been readded in r59450

Removed Paths:
-------------
    trunk/phase3/js2/README
    trunk/phase3/js2/ajaxcategories.js
    trunk/phase3/js2/apiProxyPage.js
    trunk/phase3/js2/editPage.js
    trunk/phase3/js2/mwEmbed/
    trunk/phase3/js2/remoteMwEmbed.js
    trunk/phase3/js2/uploadPage.js

Deleted: trunk/phase3/js2/README
===================================================================
--- trunk/phase3/js2/README     2009-11-26 22:57:52 UTC (rev 59476)
+++ trunk/phase3/js2/README     2009-11-26 23:12:43 UTC (rev 59477)
@@ -1,4 +0,0 @@
-MediaWiki Javascript phase 2
-
-See Documentation on wiki: 
-http://www.mediawiki.org/wiki/JS2_Overview
\ No newline at end of file

Deleted: trunk/phase3/js2/ajaxcategories.js
===================================================================
--- trunk/phase3/js2/ajaxcategories.js  2009-11-26 22:57:52 UTC (rev 59476)
+++ trunk/phase3/js2/ajaxcategories.js  2009-11-26 23:12:43 UTC (rev 59477)
@@ -1,326 +0,0 @@
-loadGM( {
-       "ajax-add-category" : "[Add Category]",
-       "ajax-add-category-submit" : "[Add]",
-       "ajax-confirm-prompt" : "[Confirmation Text]",
-       "ajax-confirm-title" : "[Confirmation Title]",
-       "ajax-confirm-save" : "[Save]",
-       "ajax-add-category-summary" : "[Add category $1]",
-       "ajax-remove-category-summary" : "[Remove category $2]",
-       "ajax-confirm-actionsummary" : "[Summary]",
-       "ajax-error-title" : "Error",
-       "ajax-error-dismiss" : "OK",
-       "ajax-remove-category-error" : "[RemoveErr]"
-} );
-
-var ajaxCategories = {
-       handleAddLink : function( e ) {
-               e.preventDefault();
-
-               // Make sure the suggestion plugin is loaded. Load everything 
else while we're at it
-               mvJsLoader.doLoad(
-                       ['$j.ui', '$j.ui.dialog', '$j.fn.suggestions'],
-                       function() {
-                               $j( '#mw-addcategory-prompt' ).toggle();
-
-                               $j( '#mw-addcategory-input' ).suggestions( {
-                                       'fetch':ajaxCategories.fetchSuggestions,
-                                       'cancel': function() {
-                                               var req = 
ajaxCategories.request;
-                                               if ( req.abort )
-                                                       req.abort();
-                                       }
-                               } );
-
-                               $j( '#mw-addcategory-input' ).suggestions();
-                       }
-               );
-       },
-
-       fetchSuggestions : function( query ) {
-               var that = this;
-               var request = $j.ajax( {
-                       url: wgScriptPath + '/api.php',
-                       data: {
-                               'action': 'query',
-                               'list': 'allpages',
-                               'apnamespace': 14,
-                               'apprefix': $j( this ).val(),
-                               'format': 'json'
-                       },
-                       dataType: 'json',
-                       success: function( data ) {
-                               // Process data.query.allpages into an array of 
titles
-                               var pages = data.query.allpages;
-                               var titleArr = [];
-
-                               $j.each( pages, function( i, page ) {
-                                       var title = page.title.split( ':', 2 
)[1];
-                                       titleArr.push( title );
-                               } );
-
-                               $j( that ).suggestions( 'suggestions', titleArr 
);
-                       }
-               } );
-
-               ajaxCategories.request = request;
-       },
-
-       reloadCategoryList : function( response ) {
-               var holder = $j( '<div/>' );
-
-               holder.load(
-                       window.location.href + ' .catlinks',
-                       function() {
-                               $j( '.catlinks' ).replaceWith( holder.find( 
'.catlinks' ) );
-                               ajaxCategories.setupAJAXCategories();
-                               ajaxCategories.removeProgressIndicator( $j( 
'.catlinks' ) );
-                       }
-               );
-       },
-
-       confirmEdit : function( page, fn, actionSummary, doneFn ) {
-               // Load jQuery UI
-               mvJsLoader.doLoad(
-                       ['$j.ui', '$j.ui.dialog', '$j.fn.suggestions'],
-                       function() {
-                               // Produce a confirmation dialog
-
-                               var dialog = $j( '<div/>' );
-
-                               dialog.addClass( 'mw-ajax-confirm-dialog' );
-                               dialog.attr( 'title', gM( 'ajax-confirm-title' 
) );
-
-                               // Intro text.
-                               var confirmIntro = $j( '<p/>' );
-                               confirmIntro.text( gM( 'ajax-confirm-prompt' ) 
);
-                               dialog.append( confirmIntro );
-
-                               // Summary of the action to be taken
-                               var summaryHolder = $j( '<p/>' );
-                               var summaryLabel = $j( '<strong/>' );
-                               summaryLabel.text( gM( 
'ajax-confirm-actionsummary' ) + " " );
-                               summaryHolder.text( actionSummary );
-                               summaryHolder.prepend( summaryLabel );
-                               dialog.append( summaryHolder );
-
-                               // Reason textbox.
-                               var reasonBox = $j( '<input type="text" 
size="45" />' );
-                               reasonBox.addClass( 'mw-ajax-confirm-reason' );
-                               dialog.append( reasonBox );
-
-                               // Submit button
-                               var submitButton = $j( '<input type="button"/>' 
);
-                               submitButton.val( gM( 'ajax-confirm-save' ) );
-
-                               var submitFunction = function() {
-                                       ajaxCategories.addProgressIndicator( 
dialog );
-                                       ajaxCategories.doEdit(
-                                               page,
-                                               fn,
-                                               reasonBox.val(),
-                                               function() {
-                                                       doneFn();
-                                                       dialog.dialog( 'close' 
);
-                                                       
ajaxCategories.removeProgressIndicator( dialog );
-                                               }
-                                       );
-                               };
-
-                               var buttons = { };
-                               buttons[gM( 'ajax-confirm-save' )] = 
submitFunction;
-                               var dialogOptions = {
-                                       'AutoOpen' : true,
-                                       'buttons' : buttons,
-                                       'width' : 450
-                               };
-
-                               $j( '#catlinks' ).prepend( dialog );
-                               dialog.dialog( dialogOptions );
-                       }
-               );
-       },
-
-       doEdit : function( page, fn, summary, doneFn ) {
-               // Get an edit token for the page.
-               var getTokenVars = {
-                       'action':'query',
-                       'prop':'info|revisions',
-                       'intoken':'edit',
-                       'titles':page,
-                       'rvprop':'content|timestamp',
-                       'format':'json'
-               };
-
-               $j.get( wgScriptPath + '/api.php', getTokenVars,
-                       function( reply ) {
-                               var infos = reply.query.pages;
-                               $j.each(
-                                       infos,
-                                       function( pageid, data ) {
-                                               var token = data.edittoken;
-                                               var timestamp = 
data.revisions[0].timestamp;
-                                               var oldText = 
data.revisions[0]['*'];
-
-                                               var newText = fn( oldText );
-
-                                               if ( newText === false ) return;
-
-                                               var postEditVars = {
-                                                       'action':'edit',
-                                                       'title':page,
-                                                       'text':newText,
-                                                       'summary':summary,
-                                                       'token':token,
-                                                       
'basetimestamp':timestamp,
-                                                       'format':'json'
-                                               };
-
-                                               $j.post( wgScriptPath + 
'/api.php', postEditVars, doneFn,       'json' );
-                                       }
-                               );
-                       }
-               , 'json' );
-       },
-
-       addProgressIndicator : function( elem ) {
-               var indicator = $j( '<div/>' );
-
-               indicator.addClass( 'mw-ajax-loader' );
-
-               elem.append( indicator );
-       },
-
-       removeProgressIndicator : function( elem ) {
-               elem.find( '.mw-ajax-loader' ).remove();
-       },
-
-       handleCategoryAdd : function( e ) {
-               // Grab category text
-               var category = $j( '#mw-addcategory-input' ).val();
-               var appendText = "\n[[" + wgFormattedNamespaces[14] + ":" + 
category + "]]\n";
-               var summary = gM( 'ajax-add-category-summary', category );
-
-               ajaxCategories.confirmEdit(
-                       wgPageName,
-                       function( oldText ) { return oldText + appendText },
-                       summary,
-                       ajaxCategories.reloadCategoryList
-               );
-       },
-
-       handleDeleteLink : function( e ) {
-               e.preventDefault();
-
-               var category = $j( this ).parent().find( 'a' ).text();
-
-               // Build a regex that matches legal invocations of that 
category.
-
-               // In theory I should escape the aliases, but there's no JS 
function for it
-               //  Shouldn't have any real impact, can't be exploited or 
anything, so we'll
-               //  leave it for now.
-               var categoryNSFragment = '';
-               $j.each( wgNamespaceIds, function( name, id ) {
-                       if ( id == 14 ) {
-                               // Allow the first character to be any case
-                               var firstChar = name.charAt( 0 );
-                               firstChar = '[' + firstChar.toUpperCase() + 
firstChar.toLowerCase() + ']';
-                               categoryNSFragment += '|' + firstChar + 
name.substr( 1 );
-                       }
-               } );
-               categoryNSFragment = categoryNSFragment.substr( 1 ); // Remove 
leading |
-
-               // Build the regex
-               var titleFragment = category;
-
-               firstChar = category.charAt( 0 );
-               firstChar = '[' + firstChar.toUpperCase() + 
firstChar.toLowerCase() + ']';
-               titleFragment = firstChar + category.substr( 1 );
-               var categoryRegex = '\\[\\[' + categoryNSFragment + ':' + 
titleFragment + '(\\|[^\\]]*)?\\]\\]';
-               categoryRegex = new RegExp( categoryRegex, 'g' );
-
-               var summary = gM( 'ajax-remove-category-summary', category );
-
-               ajaxCategories.confirmEdit(
-                       wgPageName,
-                       function( oldText ) {
-                               var newText = oldText.replace( categoryRegex, 
'' );
-
-                               if ( newText == oldText ) {
-                                       var error = gM( 
'ajax-remove-category-error' );
-                                       ajaxCategories.showError( error );
-                                       ajaxCategories.removeProgressIndicator( 
$j( '.mw-ajax-confirm-dialog' ) );
-                                       $j( '.mw-ajax-confirm-dialog' ).dialog( 
'close' );
-                                       return false;
-                               }
-
-                               return newText;
-                       },
-                       summary, ajaxCategories.reloadCategoryList
-               );
-       },
-
-       showError : function( str ) {
-               var dialog = $j( '<div/>' );
-               dialog.text( str );
-
-               $j( '#bodyContent' ).append( dialog );
-
-               var buttons = { };
-               buttons[gM( 'ajax-error-dismiss' )] = function( e ) {
-                       dialog.dialog( 'close' );
-               };
-               var dialogOptions = {
-                       'buttons' : buttons,
-                       'AutoOpen' : true,
-                       'title' : gM( 'ajax-error-title' )
-               };
-
-               dialog.dialog( dialogOptions );
-       },
-
-       setupAJAXCategories : function() {
-               // Only do it for articles.
-               if ( !wgIsArticle ) return;
-
-               var clElement = $j( '.catlinks' );
-
-               // Unhide hidden category holders.
-               clElement.removeClass( 'catlinks-allhidden' );
-
-               var addLink = $j( '<a/>' );
-               addLink.addClass( 'mw-ajax-addcategory' );
-
-               // Create [Add Category] link
-               addLink.text( gM( 'ajax-add-category' ) );
-               addLink.attr( 'href', '#' );
-               addLink.click( ajaxCategories.handleAddLink );
-               clElement.append( addLink );
-
-               // Create add category prompt
-               var promptContainer = $j( '<div id="mw-addcategory-prompt"/>' );
-               var promptTextbox = $j( '<input type="text" size="45" 
id="mw-addcategory-input"/>' );
-               var addButton = $j( '<input type="button" 
id="mw-addcategory-button"/>' );
-               addButton.val( gM( 'ajax-add-category-submit' ) );
-
-               promptTextbox.keypress( ajaxCategories.handleCategoryInput );
-               addButton.click( ajaxCategories.handleCategoryAdd );
-
-               promptContainer.append( promptTextbox );
-               promptContainer.append( addButton );
-               promptContainer.hide();
-
-               // Create delete link for each category.
-               $j( '.catlinks div span a' ).each( function( e ) {
-                       // Create a remove link
-                       var deleteLink = $j( '<a class="mw-remove-category" 
href="#"/>' );
-
-                       deleteLink.click( ajaxCategories.handleDeleteLink );
-
-                       $j( this ).after( deleteLink );
-               } );
-
-               clElement.append( promptContainer );
-       }
-};
-
-js2AddOnloadHook( ajaxCategories.setupAJAXCategories );

Deleted: trunk/phase3/js2/apiProxyPage.js
===================================================================
--- trunk/phase3/js2/apiProxyPage.js    2009-11-26 22:57:52 UTC (rev 59476)
+++ trunk/phase3/js2/apiProxyPage.js    2009-11-26 23:12:43 UTC (rev 59477)
@@ -1,28 +0,0 @@
-/*
-* mwProxy js2 page system.
-*
-* Invokes the apiProxy system 
-*/
-
-/*
- * Since this is proxy server set a pre-append debug flag to know which debug 
msgs are coming from where
- */
- 
-mw.conf['debug_pre'] = 'Proxy';
- 
-if ( !mwApiProxyConfig )
-       var mwApiProxyConfig = { };
-
-// The default mwApiProxyConfig config 
-// (presently hard coded but should read from user and site config)  
-var mwApiProxyDefaultConfig = {
-               'master_whitelist'      : [  'en.wikipedia.org', 'localhost', 
'127.1.1.100' ],
-               'master_blacklist'      : []
-};
-
-// User white_list should also be checked and configured at runtime.
-js2AddOnloadHook( function() {
-       // build our configuration from the default and mwApiProxyConfig vars
-       mwApiProxyConfig = $j.extend( true, mwApiProxyDefaultConfig,  
mwApiProxyConfig );
-       $j.apiProxy( 'server', mwApiProxyConfig );
-} );

Deleted: trunk/phase3/js2/editPage.js
===================================================================
--- trunk/phase3/js2/editPage.js        2009-11-26 22:57:52 UTC (rev 59476)
+++ trunk/phase3/js2/editPage.js        2009-11-26 23:12:43 UTC (rev 59477)
@@ -1,69 +0,0 @@
-/*
- * JS2-style replacement for MediaWiki edit.js
- * (right now it just supports the toolbar)
- */
-
-// Setup configuration vars (if not set already)
-if ( !mwAddMediaConfig )
-       var mwAddMediaConfig = { };
-
-// The default editPage AMW config
-var defaultAddMediaConfig = {
-               'profile': 'mediawiki_edit',
-               'target_textbox': '#wpTextbox1',
-               // Note: selections in the textbox will take over the default 
query
-               'default_query': wgTitle,
-               'target_title': wgPageName,
-               // Here we can setup the content provider overrides
-               'enabled_cps':['wiki_commons'],
-               // The local wiki API URL:
-               'local_wiki_api_url': wgServer + wgScriptPath + '/api.php'
-};
-
-js2AddOnloadHook( function() {
-       js_log( "edit page js2AddOnloadHook::" );
-       var amwConf = $j.extend( true, defaultAddMediaConfig, mwAddMediaConfig 
);
-       // kind of tricky, it would be nice to use run on ready "loader" call 
here
-       var didWikiEditorBind = false;
-       
-       // Set-up the drag drop binding (will only work for html5 upload 
browsers) 
-       // $j('textarea#wpTextbox1').dragFileUpload();
-
-       // set up the add-media-wizard binding: 
-       if ( typeof $j.wikiEditor != 'undefined' ) {
-                       // the below seems to be broken :(
-                       $j( 'textarea#wpTextbox1' ).bind( 
'wikiEditor-toolbar-buildSection-main',
-                   function( e, section ) {
-                       didWikiEditorBind = true;
-                       if ( typeof section.groups.insert.tools.file !== 
'undefined' ) {
-                           section.groups.insert.tools.file.action = {
-                               'type': 'callback',
-                               'execute': function() {
-                                       js_log( 'click add media wiz' );
-                                       $j.addMediaWiz( amwConf );
-                               }
-                           };
-                       }
-                   }
-               );
-       }
-       // Add to old toolbar if wikiEditor did not remove '#toolbar' from the 
page:    
-       setTimeout( function() {
-               if ( $j( '#btn-add-media-wiz' ).length == 0 && $j( '#toolbar' 
).length != 0 ) {
-                       js_log( 'Do old toolbar bind:' );
-                       didWikiEditorBind = true;
-                       $j( '#toolbar' ).append( '<img style="cursor:pointer" 
id="btn-add-media-wiz" src="' +
-                               mv_skin_img_path + 'Button_add_media.png">' );
-                       $j( '#btn-add-media-wiz' ).addMediaWiz(
-                               amwConf
-                       );
-               } else {
-                       // Make sure the wikieditor got binded: 
-                       if ( !didWikiEditorBind ) {
-                               js_log( 'Failed to bind via build section bind 
via target:' );
-                               $j( ".tool[rel='file']" ).unbind().addMediaWiz( 
amwConf );
-                       }
-               }
-       }, 120 )
-
-} );

Deleted: trunk/phase3/js2/remoteMwEmbed.js
===================================================================
--- trunk/phase3/js2/remoteMwEmbed.js   2009-11-26 22:57:52 UTC (rev 59476)
+++ trunk/phase3/js2/remoteMwEmbed.js   2009-11-26 23:12:43 UTC (rev 59477)
@@ -1,263 +0,0 @@
-/*
- * This file exposes some of the functionality of mwEmbed to wikis
- * that do not yet have js2 enabled
- */
- 
-var urlparts = getRemoteEmbedPath();
-var mwEmbedHostPath = urlparts[0];
-var mwRemoteVersion = '1.10';
-var mwUseScriptLoader = true;
-
-// setup up request Params: 
-var reqParts = urlparts[1].substring( 1 ).split( '&' );
-var mwReqParam = { };
-for ( var i = 0; i < reqParts.length; i++ ) {
-       var p = reqParts[i].split( '=' );
-       if ( p.length == 2 )
-               mwReqParam[ p[0] ] = p[1];
-}
-
-addOnloadHook( function() {
-       // Only do rewrites if MV_EMBED / js2 is "off"
-       if ( typeof MV_EMBED_VERSION == 'undefined' ) {
-               doPageSpecificRewrite();
-       }
-} );
-
-function doPageSpecificRewrite() {             
-       // Add media wizard
-       if ( wgAction == 'edit' || wgAction == 'submit' ) {     
-               var jsSetEdit = [ 'remoteSearchDriver', '$j.fn.textSelection', 
'$j.ui', '$j.ui.sortable' ]
-               mwr_load_mv_embed( jsSetEdit, function() {
-                       loadExternalJs( mwEmbedHostPath + '/editPage.js?' + 
mwGetReqArgs() );
-               } );
-       }
-       
-       // Timed text display:
-       if ( wgPageName.indexOf( "TimedText" ) === 0 ) {
-               mwr_load_mv_embed( function() {
-                       // Load with mw loader to get localized interface:
-                       mw.load( ['mvTimeTextEdit'], function() {
-                               // could run init here (but mvTimeTextEdit 
already included onLoad actions)
-                       } );
-               } );
-       }
-       
-       // Firefogg integration
-       if ( wgPageName == "Special:Upload" ) { 
-               var jsSetUpload = [ 'mvBaseUploadInterface', 'mvFirefogg' , 
'$j.ui',
-                                                       '$j.ui.progressbar', 
'$j.ui.dialog', '$j.ui.draggable' ]; 
-               mwr_load_mv_embed( jsSetUpload, function() {
-                       loadExternalJs( mwEmbedHostPath + '/uploadPage.js?' + 
mwGetReqArgs() );
-               } );
-       }
-       
-       // Special api proxy page
-       if ( wgPageName == 'MediaWiki:ApiProxy' ) {
-               var wgEnableIframeApiProxy = true;
-               mwr_load_mv_embed( [ 'mw.proxy' ], function() {                 
-                       loadExternalJs( mwEmbedHostPath + '/apiProxyPage.js?' + 
mwGetReqArgs() );
-               } );
-       }
-       
-       // OggHandler rewrite for view pages:
-       var vidIdList = [];
-       var divs = document.getElementsByTagName( 'div' );
-       for ( var i = 0; i < divs.length; i++ ) {
-               if ( divs[i].id && divs[i].id.substring( 0, 11 ) == 
'ogg_player_' ) {
-                       vidIdList.push( divs[i].getAttribute( "id" ) );
-               }
-       }
-       if ( vidIdList.length > 0 ) {   
-               var jsSetVideo = [ 'embedVideo', '$j.ui', 'ctrlBuilder', 
'$j.cookie', '$j.ui.slider', 'kskinConfig' ];          
-               // Quick sniff use java if IE and native if firefox 
-               // ( other browsers will run detect and get on-demand )         
-               if (navigator.userAgent.indexOf("MSIE") != -1)
-                       jsSetVideo.push( 'javaEmbed' );
-                       
-               if ( navigator.userAgent &&  
navigator.userAgent.indexOf("Firefox") != -1 )
-                       jsSetVideo.push( 'nativeEmbed' );
-       
-               mwr_load_mv_embed( jsSetVideo, function() {
-                       mvJsLoader.embedVideoCheck( function() {
-                               // Do utility rewrite of OggHandler content:
-                               rewrite_for_OggHandler( vidIdList );
-                       } );
-               } );
-       }
-}
-// This will be depreciated in favour of updates to OggHandler
-function rewrite_for_OggHandler( vidIdList ) {
-       function procVidId( vidId ) {
-               // don't process empty vids
-               if ( !vidId )
-                       return ;
-               js_log( 'vidIdList on: ' + vidId + ' length: ' + 
vidIdList.length + ' left in the set: ' + vidIdList );
-               
-               tag_type = 'video';
-               // Check type:
-               var pwidth = $j( '#' + vidId ).width();
-               var $pimg = $j( '#' + vidId + ' img:first' );           
-               if( $pimg.attr('src').split('/').pop() == 'play.png'){
-                       tag_type = 'audio';
-                       poster_attr = '';               
-                       pheight = 0;
-               }else{
-                       var poster_attr = 'poster = "' + $pimg.attr( 'src' ) + 
'" ';                    
-                       var pheight = $pimg.attr( 'height' );                   
        
-               }
-
-
-               // Parsed values:
-               var src = '';
-               var duration_attr = '';
-               var wikiTitleKey = $j( '#' + vidId + ' img' ).filter( ':first' 
).attr( 'src' ).split( '/' );
-               wikiTitleKey = unescape( wikiTitleKey[ wikiTitleKey.length - 2 
] );
-               var re = new RegExp( /videoUrl(&quot;:?\s*)*([^&]*)/ );
-               src = re.exec( $j( '#' + vidId ).html() )[2];
-
-               var re = new RegExp( /length(&quot;:?\s*)*([^,]*)/ );
-               var dv = re.exec( $j( '#' + vidId ).html() )[2];
-               if ( dv ) {
-                       duration_attr = 'durationHint="' + dv + '" ';
-               }
-
-               var re = new RegExp( /offset(&quot;:?\s*)*([^&]*)/ );
-               offset = re.exec( $j( '#' + vidId ).html() )[2];
-               var offset_attr = offset ? 'startOffset="' + offset + '"' : '';
-
-               if ( src ) {
-                       var html_out = '';
-                       
-                       var common_attr = ' id="mwe_' + vidId + '" ' +
-                                       'wikiTitleKey="' + wikiTitleKey + '" ' +
-                                       'src="' + src + '" ' +
-                                       duration_attr +
-                                       offset_attr + ' ' +
-                                       'class="kskin" ';
-                                                               
-                       if ( tag_type == 'audio' ) {
-                               html_out = '<audio' + common_attr + ' 
style="width:' + pwidth + 'px;"></audio>';
-                       } else {
-                               html_out = '<video' + common_attr +
-                               poster_attr + ' ' +
-                               'style="width:' + pwidth + 'px;height:' + 
pheight + 'px;">' +
-                               '</video>';
-                       }
-                       // Set the video tag inner html and update the height
-                       $j( '#' + vidId ).html( html_out )
-                               .css( 'height', pheight + 30 );
-
-                       // Do the actual rewrite                                
-                       rewrite_by_id( 'mwe_' + vidId, function() {
-                               if ( vidIdList.length != 0 ) {
-                                       setTimeout( function() {
-                                               procVidId( vidIdList.pop() )
-                                       }, 10 );
-                               }
-                       } );
-
-               }               
-       };
-       // process each item in the vidIdList (with setTimeout to avoid locking)
-       procVidId( vidIdList.pop() );
-}
-function getRemoteEmbedPath() {
-       for ( var i = 0; i < document.getElementsByTagName( 'script' ).length; 
i++ ) {
-               var s = document.getElementsByTagName( 'script' )[i];
-               if ( s.src.indexOf( '/remoteMwEmbed.js' ) != - 1 ) {
-                       var reqStr = '';
-                       var scriptPath = '';
-                       if ( s.src.indexOf( '?' ) != - 1 ) {
-                               reqStr = s.src.substr( s.src.indexOf( '?' ) );
-                               scriptPath = s.src.substr( 0,  s.src.indexOf( 
'?' ) ).replace( '/remoteMwEmbed.js', '' );
-                       } else {
-                               scriptPath = s.src.replace( 
'/remoteMwEmbed.js', '' )
-                       }
-                       // Use the external_media_wizard path:
-                       return [scriptPath, reqStr];
-               }
-       }
-}
-function mwGetReqArgs() {
-       var rurl = '';
-       if ( mwReqParam['debug'] )
-               rurl += 'debug=true&';
-
-       if ( mwReqParam['uselang'] )
-               rurl += 'uselang=' + mwReqParam['uselang'] + '&';
-
-       if ( mwReqParam['urid'] ) {
-               rurl += 'urid=' + mwReqParam['urid'];
-       } else {
-               // Make sure to use an urid 
-               // This way remoteMwEmbed can control version of code being 
requested
-               rurl += 'urid=' + mwRemoteVersion;
-       }
-       return rurl;
-}
-/**
-* @param {mixed} function or classSet to preload
-* classSet saves round trips to the server by grabbing things we will likely 
need in the first request. 
-* ( this is essentially a shortcut to mv_jqueryBindings in mv_embed.js )   
-* @param {callback} function callback to be called once mv_embed is ready
-*/
-function mwr_load_mv_embed( classSet, callback ) {
-       if( typeof classSet == 'function')
-               callback = classSet;
-       // Inject mv_embed if needed
-       if ( typeof mw == 'undefined' ) {
-               if ( ( mwReqParam['uselang'] || mwReqParam['useloader'] ) && 
mwUseScriptLoader ) {
-                       var rurl = mwEmbedHostPath + 
'/mwEmbed/jsScriptLoader.php?class=mv_embed';
-                       
-                       // Add jQuery too if we need it: 
-                       if ( typeof window.jQuery == 'undefined' ) {
-                               rurl += ',window.jQuery';
-                       }       
-                                                               
-                       // Add requested classSet
-                       for( var i=0; i < classSet.length; i++ ){
-                               var cName =  classSet[i];
-                               if( !mwr_check_obj_path( cName ) ){
-                                       rurl +=  ',' + cName;
-                               }
-                       }
-                       
-                       // Add the remaining arguments
-                       rurl += '&' + mwGetReqArgs();
-                                                       
-                       importScriptURI( rurl );
-               } else { 
-                       // Ingore classSet (will be loaded onDemand )
-                       importScriptURI( mwEmbedHostPath + 
'/mwEmbed/mv_embed.js?' + mwGetReqArgs() );
-               }
-       }
-       mwr_check_for_mv_embed( callback );
-}
-
-function mwr_check_for_mv_embed( callback ) {
-       if ( typeof mw == 'undefined' ) {
-               setTimeout( function() {
-                       mwr_check_for_mv_embed( callback );
-               }, 25 );
-       } else {
-               callback();
-       }
-}
-
-function mwr_check_obj_path ( libVar ) {
-       if ( !libVar )
-               return false;
-       var objPath = libVar.split( '.' )
-       var cur_path = '';
-       for ( var p = 0; p < objPath.length; p++ ) {
-               cur_path = ( cur_path == '' ) ? cur_path + objPath[p] : 
cur_path + '.' + objPath[p];
-               eval( 'var ptest = typeof ( ' + cur_path + ' ); ' );
-               if ( ptest == 'undefined' ) {
-                       this.missing_path = cur_path;
-                       return false;
-               }
-       }
-       this.cur_path = cur_path;
-       return true;
-};

Deleted: trunk/phase3/js2/uploadPage.js
===================================================================
--- trunk/phase3/js2/uploadPage.js      2009-11-26 22:57:52 UTC (rev 59476)
+++ trunk/phase3/js2/uploadPage.js      2009-11-26 23:12:43 UTC (rev 59477)
@@ -1,143 +0,0 @@
-/*
- * This script is run on [[Special:Upload]].
- * It controls the invocation of the mvUploader class based on local config.
- */
-
-var mwUploadFormSelector = '#mw-upload-form';
-// Set up the upload form bindings once all DOM manipulation is done
-var mwUploadHelper = {
-       init: function() {
-               var _this = this;
-               // If wgEnableFirefogg is not boolean false, set to true
-               if ( typeof wgEnableFirefogg == 'undefined' )
-                       wgEnableFirefogg = true;
-
-               if ( wgEnableFirefogg ) {
-                       // Set up the upload handler to Firefogg. Should work 
with the HTTP uploads too.
-                       $j( '#wpUploadFile' ).firefogg( {
-                               // An API URL (we won't submit directly to 
action of the form)
-                               'api_url': wgServer + wgScriptPath + '/api.php',
-                               'form_rewrite': true,
-                               // MediaWiki API supports chunk uploads: 
-                               'enable_chunks' : true, 
-                               'edit_form_selector': mwUploadFormSelector,
-                               'new_source_cb': function( orgFilename, oggName 
) {
-                                       $j( '#wpDestFile' ).val( oggName );
-                                       $j( '#wpDestFile' ).doDestCheck( {
-                                               'warn_target': 
'#wpDestFile-warning'
-                                       } );
-                               }
-                       } );
-               } else {
-                       // Add basic upload profile support ( http status 
monitoring, progress box for
-                       // browsers that support it, etc.)
-                       if ( $j( '#wpUploadFileURL' ).length != 0 ) {
-                               $j( '#wpUploadFileURL' ).baseUploadInterface( {
-                                       'api_url': wgServer + wgScriptPath + 
'/api.php',
-                                       'edit_form_selector': 
mwUploadFormSelector
-                               } );
-                       }
-               }
-
-               if ( wgAjaxUploadDestCheck ) {
-                       // Do destination check
-                       $j( '#wpDestFile' ).change( function() {
-                               $j( '#wpDestFile' ).doDestCheck( {
-                                       'warn_target':'#wpDestFile-warning'
-                               } );
-                       } );
-               }
-
-               // Check if we have HTTP enabled & setup enable/disable toggle:
-               if ( $j( '#wpUploadFileURL' ).length != 0 ) {
-                       // Set the initial toggleUpType
-                       _this.toggleUpType( true );
-
-                       $j( "input[name='wpSourceType']" ).click( function() {
-                               _this.toggleUpType( this.id == 
'wpSourceTypeFile' );
-                       } );
-               }
-               $j( '#wpUploadFile,#wpUploadFileURL' )
-               .focus( function() {
-                       _this.toggleUpType( this.id == 'wpUploadFile' );
-               } )
-               // Also setup the onChange event binding:
-               .change( function() {
-                       if ( wgUploadAutoFill ) {
-                               mwUploadHelper.doDestinationFill( this );
-                       }
-               } );
-       },
-       /**
-       * Set the upload radio buttons
-       *
-       * @boolean set
-       */
-       toggleUpType: function( set ) {
-               $j( '#wpSourceTypeFile' ).attr( 'checked', set );
-               $j( '#wpUploadFile' ).attr( 'disabled', !set );
-
-               $j( '#wpSourceTypeURL' ).attr( 'checked', !set );
-               $j( '#wpUploadFileURL' ).attr( 'disabled', set );
-
-               // If Firefogg is enabled, toggle action according to 
wpSourceTypeFile selection
-               if ( wgEnableFirefogg ) {
-                       $j( '#wpUploadFile' ).firefogg( {
-                               'firefogg_form_action': $j( '#wpSourceTypeFile' 
).attr( 'checked' )
-                       } );
-               }
-       },
-       /**
-       * Fill in a destination file-name based on a source asset name.
-       */
-       doDestinationFill: function( targetElm ) {
-               js_log( "doDestinationFill" )
-               // Remove any previously flagged errors
-               $j( '#mw-upload-permitted,#mw-upload-prohibited' ).hide();
-
-               var path = $j( targetElm ).val();
-               // Find trailing part
-               var slash = path.lastIndexOf( '/' );
-               var backslash = path.lastIndexOf( '\\' );
-               var fname;
-               if ( slash == -1 && backslash == -1 ) {
-                       fname = path;
-               } else if ( slash > backslash ) {
-                       fname = path.substring( slash + 1, 10000 );
-               } else {
-                       fname = path.substring( backslash + 1, 10000 );
-               }
-               // URLs are less likely to have a useful extension. Don't 
include them in the extension check.
-               if ( wgFileExtensions && $j( targetElm ).attr( 'id' ) != 
'wpUploadFileURL' ) {
-                       var found = false;
-                       if ( fname.lastIndexOf( '.' ) != -1 ) {
-                               var ext = fname.substr( fname.lastIndexOf( '.' 
) + 1 );
-                               for ( var i = 0; i < wgFileExtensions.length; 
i++ ) {
-                                       if ( wgFileExtensions[i].toLowerCase() 
== ext.toLowerCase() )
-                                       found = true;
-                               }
-                       }
-                       if ( !found ) {
-                               // Clear the upload. Set mw-upload-permitted to 
error.
-                               $j( targetElm ).val( '' );
-                               $j( 
'#mw-upload-permitted,#mw-upload-prohibited' ).show().addClass( 'error' );
-                               $j( '#wpDestFile' ).val( '' );
-                               return false;
-                       }
-               }
-               // Capitalise first letter and replace spaces by underscores
-               fname = fname.charAt( 0 ).toUpperCase().concat( 
fname.substring( 1, 10000 ) ).replace(/ /g, '_' );
-               // Output result
-               $j( '#wpDestFile' ).val( fname );
-
-               // Do a destination check
-               $j( '#wpDestFile' ).doDestCheck( {
-                       'warn_target': '#wpDestFile-warning'
-               } );
-       }
-}
-
-
-js2AddOnloadHook( function() {
-       mwUploadHelper.init();
-} );
\ No newline at end of file



_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to