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

Revision: 61136
Author:   ashley
Date:     2010-01-16 17:40:45 +0000 (Sat, 16 Jan 2010)

Log Message:
-----------
SocialProfile: JavaScript cleanup

Modified Paths:
--------------
    trunk/extensions/SocialProfile/UserBoard/BoardBlast.js
    trunk/extensions/SocialProfile/UserGifts/UserGifts.js
    trunk/extensions/SocialProfile/UserProfile/UpdateProfile.js
    trunk/extensions/SocialProfile/UserProfile/UserProfilePage.js
    trunk/extensions/SocialProfile/UserRelationship/UserRelationship.js

Modified: trunk/extensions/SocialProfile/UserBoard/BoardBlast.js
===================================================================
--- trunk/extensions/SocialProfile/UserBoard/BoardBlast.js      2010-01-16 
16:50:25 UTC (rev 61135)
+++ trunk/extensions/SocialProfile/UserBoard/BoardBlast.js      2010-01-16 
17:40:45 UTC (rev 61136)
@@ -1,24 +1,24 @@
-function toggle_user( user_id ){
-       if( YAHOO.util.Dom.hasClass( 'user-' + user_id, 'blast-friend-selected' 
) ){
+function toggle_user( user_id ) {
+       if( YAHOO.util.Dom.hasClass( 'user-' + user_id, 'blast-friend-selected' 
) ) {
                YAHOO.util.Dom.replaceClass( 'user-' + user_id, 
'blast-friend-selected', 'blast-friend-unselected' );
-       } else if( YAHOO.util.Dom.hasClass( 'user-' + user_id, 
'blast-friend-unselected' ) ){
+       } else if( YAHOO.util.Dom.hasClass( 'user-' + user_id, 
'blast-friend-unselected' ) ) {
                YAHOO.util.Dom.replaceClass( 'user-' + user_id, 
'blast-friend-unselected', 'blast-friend-selected' );
        }
 
-       if( YAHOO.util.Dom.hasClass( 'user-' + user_id, 'blast-foe-selected' ) 
){
+       if( YAHOO.util.Dom.hasClass( 'user-' + user_id, 'blast-foe-selected' ) 
) {
                YAHOO.util.Dom.replaceClass( 'user-' + user_id, 
'blast-foe-selected', 'blast-foe-unselected' );
-       } else if( YAHOO.util.Dom.hasClass( 'user-' + user_id, 
'blast-foe-unselected' ) ){
+       } else if( YAHOO.util.Dom.hasClass( 'user-' + user_id, 
'blast-foe-unselected' ) ) {
                YAHOO.util.Dom.replaceClass( 'user-' + user_id, 
'blast-foe-selected', 'blast-foe-unselected' );
        }
 }
 
-function toggle_type( method, on, off ){
+function toggle_type( method, on, off ) {
        list = YAHOO.util.Dom.getElementsByClassName( ( ( method == 1 ) ? off : 
on ), 'div', 'blast-friends-list' );
 
-       for( x = 0; x <= list.length-1; x++ ){
+       for( x = 0; x <= list.length - 1; x++ ) {
                el = list[x];
-               if( YAHOO.util.Dom.hasClass( el, on ) || 
YAHOO.util.Dom.hasClass( el, off ) ){
-                       if( method == 1 ){
+               if( YAHOO.util.Dom.hasClass( el, on ) || 
YAHOO.util.Dom.hasClass( el, off ) ) {
+                       if( method == 1 ) {
                                YAHOO.util.Dom.replaceClass( el, off, on );
                        } else {
                                YAHOO.util.Dom.replaceClass( el, on, off );
@@ -27,34 +27,35 @@
        }
 }
 
-function toggle_friends( method ){
+function toggle_friends( method ) {
        toggle_type( method, 'blast-friend-selected', 'blast-friend-unselected' 
);
 }
 
-function toggle_foes( method ){
+function toggle_foes( method ) {
        toggle_type( method, 'blast-foe-selected', 'blast-foe-unselected' );
 }
 
-function select_all(){
+function select_all() {
        toggle_friends( 1 );
        toggle_foes( 1 );
 }
-function unselect_all(){
+function unselect_all() {
        toggle_friends( 0 );
        toggle_foes( 0 );
 }
 
 submitted = 0;
-function send_messages(){
-       if( submitted == 1 )
+function send_messages() {
+       if( submitted == 1 ) {
                return 0;
+       }
 
-       submitted = 1
+       submitted = 1;
        selected = 0;
        user_ids_to = '';
 
        list = YAHOO.util.Dom.getElementsByClassName( 'blast-friend-selected', 
'div', 'blast-friends-list' );
-       for( x = 0; x <= list.length-1; x++ ){
+       for( x = 0; x <= list.length - 1; x++ ) {
                el = list[x];
                selected++;
                user_id = el.id.replace( 'user-', '' );
@@ -62,28 +63,28 @@
        }
 
        list = YAHOO.util.Dom.getElementsByClassName( 'blast-foe-selected', 
'div', 'blast-friends-list' );
-       for( x = 0; x <= list.length-1; x++ ){
+       for( x = 0; x <= list.length - 1; x++ ) {
                el = list[x];
                selected++;
                user_id = el.id.replace( 'user-', '' );
                user_ids_to += ( ( user_ids_to ) ? ',' : '' ) + user_id;
        }
 
-       if( selected == 0 ){
-               alert('Please select at least one person');
+       if( selected === 0 ) {
+               alert( 'Please select at least one person' );
                submitted = 0;
                return 0;
        }
 
-       if( !document.getElementById('message').value ){
-               alert('Please enter a message');
+       if( !document.getElementById('message').value ) {
+               alert( 'Please enter a message' );
                submitted = 0;
                return 0;
        }
 
        document.getElementById('ids').value = user_ids_to;
 
-       document.blast.message.style.color = "#ccc";
+       document.blast.message.style.color = '#ccc';
        document.blast.message.readOnly = true;
        document.getElementById('blast-friends-list').innerHTML = 'Sending 
messages...';
        document.blast.submit();

Modified: trunk/extensions/SocialProfile/UserGifts/UserGifts.js
===================================================================
--- trunk/extensions/SocialProfile/UserGifts/UserGifts.js       2010-01-16 
16:50:25 UTC (rev 61135)
+++ trunk/extensions/SocialProfile/UserGifts/UserGifts.js       2010-01-16 
17:40:45 UTC (rev 61136)
@@ -1,8 +1,8 @@
 var selected_gift = 0;
 
-function selectGift( id ){
+function selectGift( id ) {
        // Un-select previously selected gift
-       if( selected_gift ){
+       if( selected_gift ) {
                YAHOO.util.Dom.removeClass( 'give_gift_' + selected_gift, 
'g-give-all-selected' );
        }
 
@@ -12,16 +12,16 @@
        selected_gift = id;
 }
 
-function highlightGift( id ){
+function highlightGift( id ) {
        YAHOO.util.Dom.addClass( 'give_gift_' + id, 'g-give-all-highlight' );
 }
 
-function unHighlightGift( id ){
+function unHighlightGift( id ) {
        YAHOO.util.Dom.removeClass( 'give_gift_' + id, 'g-give-all-highlight' );
 }
 
-function sendGift(){
-       if( !selected_gift ){
+function sendGift() {
+       if( !selected_gift ) {
                alert( 'Please select a gift' );
                return false;
        }
@@ -29,7 +29,7 @@
        document.gift.submit();
 }
 
-function chooseFriend( friend ){
+function chooseFriend( friend ) {
        // Now, this is a rather nasty hack since the original (commented out 
below) wouldn't work when $wgScriptPath was set
        //window.location = window.location + "&user=" + friend;
        window.location = wgServer + wgScript + '?title=Special:GiveGift' + 
'&user=' + friend;

Modified: trunk/extensions/SocialProfile/UserProfile/UpdateProfile.js
===================================================================
--- trunk/extensions/SocialProfile/UserProfile/UpdateProfile.js 2010-01-16 
16:50:25 UTC (rev 61135)
+++ trunk/extensions/SocialProfile/UserProfile/UpdateProfile.js 2010-01-16 
17:40:45 UTC (rev 61136)
@@ -3,13 +3,29 @@
  * Displays the "State" dropdown menu if selected country is the United States
  */
 var countries = new Array();
-countries[0] = {country:"United 
States",name:"State",sections:["Alabama","Alaska","Arizona","Arkansas","California","Colorado","Connecticut","Delaware","Florida","Georgia","Hawaii","Idaho","Illinois","Indiana","Iowa","Kansas","Kentucky","Louisiana","Maine","Maryland","Massachusetts","Michigan","Minnesota","Mississippi","Missouri","Montana","Nebraska","Nevada","New
 Hampshire","New Jersey","New Mexico","New York","North Carolina","North 
Dakota","Ohio","Oklahoma","Oregon","Pennsylvania","Puerto Rico","Rhode 
Island","South Carolina","South 
Dakota","Tennessee","Texas","Utah","Vermont","Virginia","Washington","Washington,
 D.C.","West Virginia","Wisconsin","Wyoming"]}
+countries[0] = {
+       country: 'United States',
+       name: 'State',
+       sections: [
+               'Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California', 
'Colorado',
+               'Connecticut', 'Delaware', 'Florida', 'Georgia', 'Hawaii', 
'Idaho',
+               'Illinois', 'Indiana', 'Iowa', 'Kansas', 'Kentucky', 
'Louisiana',
+               'Maine', 'Maryland', 'Massachusetts', 'Michigan', 'Minnesota',
+               'Mississippi', 'Missouri', 'Montana', 'Nebraska', 'Nevada',
+               'New Hampshire', 'New Jersey', 'New Mexico', 'New York',
+               'North Carolina', 'North Dakota', 'Ohio', 'Oklahoma', 'Oregon',
+               'Pennsylvania', 'Puerto Rico', 'Rhode Island', 'South Carolina',
+               'South Dakota', 'Tennessee', 'Texas', 'Utah', 'Vermont', 
'Virginia',
+               'Washington', 'Washington, D.C.', 'West Virginia', 'Wisconsin', 
'Wyoming'
+       ]
+};
 
 function displaySection( id, country, section ) {
        country_id = -1;
        for( x = 0; x <= countries.length-1; x++ ) {
-               if( country == countries[x].country )
+               if( country == countries[x].country ) {
                        country_id = x;
+               }
        }
 
        section_select = '';

Modified: trunk/extensions/SocialProfile/UserProfile/UserProfilePage.js
===================================================================
--- trunk/extensions/SocialProfile/UserProfile/UserProfilePage.js       
2010-01-16 16:50:25 UTC (rev 61135)
+++ trunk/extensions/SocialProfile/UserProfile/UserProfilePage.js       
2010-01-16 17:40:45 UTC (rev 61136)
@@ -34,8 +34,8 @@
 var oldHtml = '';
 
 function showUploadFrame() {
-       document.getElementById( 'upload-container' ).style['display'] = 
'block';
-       document.getElementById( 'upload-container' ).style['visibility'] = 
'visible';
+       document.getElementById( 'upload-container' ).style.display = 'block';
+       document.getElementById( 'upload-container' ).style.visibility = 
'visible';
 }
 
 function uploadError( message ) {
@@ -43,33 +43,34 @@
        document.getElementById('upload-frame-errors').innerHTML = message;
        document.getElementById('imageUpload-frame').src = 
'index.php?title=Special:MiniAjaxUpload&wpThumbWidth=75';
 
-       document.getElementById( 'upload-container' ).style['display'] = 
'block';
-       document.getElementById( 'upload-container' ).style['visibility'] = 
'visible';
+       document.getElementById( 'upload-container' ).style.display = 'block';
+       document.getElementById( 'upload-container' ).style.visibility = 
'visible';
 }
 
 function textError( message ) {
        document.getElementById( 'upload-frame-errors' ).innerHTML = message;
-       document.getElementById( 'upload-frame-errors' ).style['display'] = 
'block';
-       document.getElementById( 'upload-frame-errors' ).style['visibility'] = 
'visible';
+       document.getElementById( 'upload-frame-errors' ).style.display = 
'block';
+       document.getElementById( 'upload-frame-errors' ).style.visibility = 
'visible';
 }
 
 function completeImageUpload() {
-       document.getElementById( 'upload-frame-errors' ).style['display'] = 
'none';
-       document.getElementById( 'upload-frame-errors' ).style['visibility'] = 
'hidden';
+       document.getElementById( 'upload-frame-errors' ).style.display = 'none';
+       document.getElementById( 'upload-frame-errors' ).style.visibility = 
'hidden';
        document.getElementById('upload-frame-errors').innerHTML = '';
        oldHtml = document.getElementById('mini-gallery-' + 
replaceID).innerHTML;
 
        for( x = 7; x > 0; x-- ) {
-               document.getElementById('mini-gallery-' + (x) ).innerHTML = 
document.getElementById('mini-gallery-' + (x-1) 
).innerHTML.replace('slideShowLink('+(x-1)+')','slideShowLink('+(x)+')');
+               document.getElementById('mini-gallery-' + ( x ) ).innerHTML =
+                       document.getElementById('mini-gallery-' + ( x - 1 ) 
).innerHTML.replace( 'slideShowLink(' + ( x - 1 ) + ')','slideShowLink(' + ( x 
) + ')' );
        }
        document.getElementById('mini-gallery-0').innerHTML = '<a><img 
height="75" width="75" 
src="http://images.wikia.com/common/wikiany/images/ajax-loader-white.gif"; 
alt="" /></a>';
 
        if( document.getElementById( 'no-pictures-containers' ) ) {
-               document.getElementById( 'no-pictures-containers' 
).style['display'] = 'none';
-               document.getElementById( 'no-pictures-containers' 
).style['visibility'] = 'hidden';
+               document.getElementById( 'no-pictures-containers' 
).style.display = 'none';
+               document.getElementById( 'no-pictures-containers' 
).style.visibility = 'hidden';
        }
-       document.getElementById( 'pictures-containers' ).style['display'] = 
'block';
-       document.getElementById( 'pictures-containers' ).style['visibility'] = 
'visible';
+       document.getElementById( 'pictures-containers' ).style.display = 
'block';
+       document.getElementById( 'pictures-containers' ).style.visibility = 
'visible';
 }
 
 function uploadComplete( imgSrc, imgName, imgDesc ) {

Modified: trunk/extensions/SocialProfile/UserRelationship/UserRelationship.js
===================================================================
--- trunk/extensions/SocialProfile/UserRelationship/UserRelationship.js 
2010-01-16 16:50:25 UTC (rev 61135)
+++ trunk/extensions/SocialProfile/UserRelationship/UserRelationship.js 
2010-01-16 17:40:45 UTC (rev 61136)
@@ -2,11 +2,11 @@
  * JavaScript for UserRelationship
  * Used on Special:ViewRelationshipRequests
  */
-function requestResponse( response, id ){
-       document.getElementById( 'request_action_' + id ).style['display'] = 
'none';
-       document.getElementById( 'request_action_' + id ).style['visibility'] = 
'hidden';
+function requestResponse( response, id ) {
+       document.getElementById( 'request_action_' + id ).style.display = 
'none';
+       document.getElementById( 'request_action_' + id ).style.visibility = 
'hidden';
        sajax_request_type = 'POST';
-       sajax_do_call( 'wfRelationshipRequestResponse', [ response, id ], 
function( request ){
+       sajax_do_call( 'wfRelationshipRequestResponse', [ response, id ], 
function( request ) {
                document.getElementById( 'request_action_' + id ).innerHTML = 
request.responseText;
                YAHOO.widget.Effects.Appear( 'request_action_' + id, { 
duration:2.0 } );
        } );



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

Reply via email to