Index: trunk/extensions/SocialProfile/UserProfile/UserProfilePage.js |
— | — | @@ -1,30 +1,30 @@ |
| 2 | +/** |
| 3 | + * JavaScript functions used by UserProfile |
| 4 | + */ |
2 | 5 | var posted = 0; |
3 | 6 | function send_message(){ |
4 | | - if($("message").value && !posted){ |
| 7 | + if( document.getElementById('message').value && !posted ){ |
5 | 8 | posted = 1; |
6 | | - var url = "index.php?action=ajax"; |
7 | | - var pars = 'rs=wfSendBoardMessage&rsargs[]=' + $("user_name_to").value +'&rsargs[]=' + encodeURIComponent($("message").value) + '&rsargs[]=' + $("message_type").value +'&rsargs[]=10' |
8 | | - var callback = { |
9 | | - success: function(originalRequest){ |
10 | | - $("user-page-board").innerHTML = originalRequest.responseText |
| 9 | + sajax_request_type = 'POST'; |
| 10 | + sajax_do_call( 'wfSendBoardMessage', [ |
| 11 | + document.getElementById('user_name_to').value, |
| 12 | + encodeURIComponent( document.getElementById('message').value ), |
| 13 | + document.getElementById('message_type').value, |
| 14 | + 10 ], function( originalRequest ){ |
| 15 | + document.getElementById('user-page-board').innerHTML = originalRequest.responseText; |
11 | 16 | posted = 0; |
12 | | - $("message").value=''; |
| 17 | + document.getElementById('message').value = ''; |
13 | 18 | } |
14 | | - }; |
15 | | - var request = YAHOO.util.Connect.asyncRequest('POST', url, callback, pars); |
| 19 | + ); |
16 | 20 | } |
17 | 21 | } |
18 | 22 | |
19 | | -function delete_message(id){ |
20 | | - if(confirm('Are you sure you want to delete this message?')){ |
21 | | - var url = "index.php?action=ajax"; |
22 | | - var pars = 'rs=wfDeleteBoardMessage&rsargs[]=' + id |
23 | | - var callback = { |
24 | | - success: function(originalRequest){ |
25 | | - window.location.reload(); |
26 | | - } |
27 | | - }; |
28 | | - var request = YAHOO.util.Connect.asyncRequest('POST', url, callback, pars); |
| 23 | +function delete_message( id ){ |
| 24 | + if( confirm( 'Are you sure you want to delete this message?' ) ){ |
| 25 | + sajax_request_type = 'POST'; |
| 26 | + sajax_do_call( 'wfDeleteBoardMessage', [ id ], function( originalRequest ){ |
| 27 | + window.location.reload(); |
| 28 | + } ); |
29 | 29 | } |
30 | 30 | } |
31 | 31 | |
— | — | @@ -37,66 +37,65 @@ |
38 | 38 | new YAHOO.widget.Effects.Show('upload-container'); |
39 | 39 | } |
40 | 40 | |
41 | | -function uploadError(message){ |
42 | | - $('mini-gallery-' + replaceID).innerHTML = oldHtml; |
43 | | - $('upload-frame-errors').innerHTML = message; |
44 | | - $('imageUpload-frame').src = 'index.php?title=Special:MiniAjaxUpload&wpThumbWidth=75'; |
| 41 | +function uploadError( message ){ |
| 42 | + document.getElementById('mini-gallery-' + replaceID).innerHTML = oldHtml; |
| 43 | + document.getElementById('upload-frame-errors').innerHTML = message; |
| 44 | + document.getElementById('imageUpload-frame').src = 'index.php?title=Special:MiniAjaxUpload&wpThumbWidth=75'; |
45 | 45 | |
46 | 46 | new YAHOO.widget.Effects.Show('upload-container'); |
47 | 47 | } |
48 | 48 | |
49 | | -function textError(message){ |
50 | | - $('upload-frame-errors').innerHTML = message; |
| 49 | +function textError( message ){ |
| 50 | + document.getElementById('upload-frame-errors').innerHTML = message; |
51 | 51 | new YAHOO.widget.Effects.Show('upload-frame-errors'); |
52 | 52 | } |
53 | 53 | |
54 | 54 | function completeImageUpload(){ |
55 | 55 | new YAHOO.widget.Effects.Hide('upload-frame-errors'); |
56 | | - $('upload-frame-errors').innerHTML = ''; |
57 | | - oldHtml = $('mini-gallery-' + replaceID).innerHTML; |
| 56 | + document.getElementById('upload-frame-errors').innerHTML = ''; |
| 57 | + oldHtml = document.getElementById('mini-gallery-' + replaceID).innerHTML; |
58 | 58 | |
59 | | - for(x=7;x>0;x--){ |
60 | | - $('mini-gallery-' + (x) ).innerHTML = $('mini-gallery-' + (x-1) ).innerHTML.replace('slideShowLink('+(x-1)+')','slideShowLink('+(x)+')') |
| 59 | + for( x = 7; x > 0; x-- ){ |
| 60 | + document.getElementById('mini-gallery-' + (x) ).innerHTML = document.getElementById('mini-gallery-' + (x-1) ).innerHTML.replace('slideShowLink('+(x-1)+')','slideShowLink('+(x)+')'); |
61 | 61 | } |
62 | | - $('mini-gallery-0').innerHTML ='<a><img height=\"75\" width=\"75\" src=\"http://images.wikia.com/common/wikiany/images/ajax-loader-white.gif\"/></a>'; |
| 62 | + 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>'; |
63 | 63 | |
64 | 64 | //new YAHOO.widget.Effects.Hide('mini-gallery-nopics'); |
65 | | - if($('no-pictures-containers')) { |
66 | | - new YAHOO.widget.Effects.Hide('no-pictures-containers'); |
| 65 | + if( document.getElementById( 'no-pictures-containers' ) ) { |
| 66 | + new YAHOO.widget.Effects.Hide( 'no-pictures-containers' ); |
67 | 67 | } |
68 | | - new YAHOO.widget.Effects.Show('pictures-containers'); |
| 68 | + new YAHOO.widget.Effects.Show( 'pictures-containers' ); |
69 | 69 | } |
70 | 70 | |
71 | | -function uploadComplete(imgSrc, imgName, imgDesc){ |
| 71 | +function uploadComplete( imgSrc, imgName, imgDesc ){ |
72 | 72 | replaceSrc = imgSrc; |
73 | 73 | |
74 | | - $('upload-frame-errors').innerHTML = ''; |
| 74 | + document.getElementById('upload-frame-errors').innerHTML = ''; |
75 | 75 | |
76 | | - //$('imageUpload-frame').onload = function(){ |
| 76 | + //document.getElementById('imageUpload-frame').onload = function(){ |
77 | 77 | var idOffset = -1 - numReplaces; |
78 | 78 | //$D.addClass('mini-gallery-0','mini-gallery'); |
79 | | - //$('mini-gallery-0').innerHTML = '<a href=\"javascript:slideShowLink(' + idOffset + ')\">' + replaceSrc + '</a>'; |
80 | | - $('mini-gallery-0').innerHTML = '<a href=\"' + __image_prefix + imgName + '\">' + replaceSrc + '</a>'; |
| 79 | + //document.getElementById('mini-gallery-0').innerHTML = '<a href=\"javascript:slideShowLink(' + idOffset + ')\">' + replaceSrc + '</a>'; |
| 80 | + document.getElementById('mini-gallery-0').innerHTML = '<a href=\"' + __image_prefix + imgName + '\">' + replaceSrc + '</a>'; |
81 | 81 | |
82 | 82 | //replaceID = (replaceID == 7) ? 0 : (replaceID + 1); |
83 | 83 | numReplaces += 1; |
84 | 84 | |
85 | 85 | //} |
86 | | - //if ($('imageUpload-frame').captureEvents) $('imageUpload-frame').captureEvents(Event.LOAD); |
| 86 | + //if (document.getElementById('imageUpload-frame').captureEvents) document.getElementById('imageUpload-frame').captureEvents(Event.LOAD); |
87 | 87 | |
88 | | - $('imageUpload-frame').src = 'index.php?title=Special:MiniAjaxUpload&wpThumbWidth=75&extra=' + numReplaces; |
| 88 | + document.getElementById('imageUpload-frame').src = 'index.php?title=Special:MiniAjaxUpload&wpThumbWidth=75&extra=' + numReplaces; |
89 | 89 | } |
90 | 90 | |
91 | | -function slideShowLink(id){ |
| 91 | +function slideShowLink( id ){ |
92 | 92 | //window.location = 'index.php?title=Special:UserSlideShow&user=' + __slideshow_user + '&picture=' + ( numReplaces + id ); |
93 | 93 | window.location = 'Image:' + id; |
94 | 94 | } |
95 | 95 | |
96 | | -function doHover(divID) { |
| 96 | +function doHover( divID ) { |
97 | 97 | $El(divID).setStyle('backgroundColor', '#4B9AF6'); |
98 | | - |
99 | 98 | } |
100 | 99 | |
101 | | -function endHover(divID){ |
| 100 | +function endHover( divID ){ |
102 | 101 | $El(divID).setStyle('backgroundColor', ''); |
103 | | -} |
| 102 | +} |
\ No newline at end of file |
Index: trunk/extensions/SocialProfile/UserProfile/UpdateProfile.js |
— | — | @@ -1,19 +1,27 @@ |
2 | | -var countries = new Array(); |
| 2 | +/** |
| 3 | + * JavaScript used on Special:UpdateProfile |
| 4 | + * Displays the "State" dropdown menu if selected country is the United States |
| 5 | + */ |
| 6 | +var countries = new Array(); |
3 | 7 | 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"]} |
4 | 8 | |
5 | | -function displaySection(id,country,section){ |
| 9 | +function displaySection( id, country, section ){ |
6 | 10 | country_id = -1; |
7 | | - for(x=0;x<=countries.length-1;x++){if(country==countries[x].country)country_id=x} |
| 11 | + for( x = 0; x <= countries.length-1; x++ ){ |
| 12 | + if( country == countries[x].country ) |
| 13 | + country_id = x; |
| 14 | + } |
8 | 15 | |
9 | | - section_select = ""; |
10 | | - if(countries[country_id]){ |
11 | | - $(id+"_label").innerHTML = countries[country_id].name |
12 | | - section_select += "<select class='profile-form' name=" + id + " id=" + id + "><option></option>" |
13 | | - for(x=0;x<=countries[country_id].sections.length-1;x++){ |
14 | | - section_select += "<option value=\"" + countries[country_id].sections[x] + "\"" + ((countries[country_id].sections[x]==section)?" selected":"") + ">" + countries[country_id].sections[x] + "</option>"; |
| 16 | + section_select = ''; |
| 17 | + if( countries[country_id] ){ |
| 18 | + document.getElementById( id + '_label' ).innerHTML = countries[country_id].name; |
| 19 | + section_select += '<select class="profile-form" name="' + id + '" id="' + id + '"><option></option>'; |
| 20 | + for( x = 0; x <= countries[country_id].sections.length-1; x++ ){ |
| 21 | + section_select += '<option value="' + countries[country_id].sections[x] + '"' + |
| 22 | + ( ( countries[country_id].sections[x] == section ) ? ' selected="selected"' : '' ) + '">' + countries[country_id].sections[x] + '</option>'; |
15 | 23 | } |
16 | | - section_select += "</select>"; |
| 24 | + section_select += '</select>'; |
17 | 25 | } |
18 | 26 | |
19 | | - $(id+"_form").innerHTML = section_select |
20 | | -} |
| 27 | + document.getElementById( id + '_form' ).innerHTML = section_select; |
| 28 | +} |
\ No newline at end of file |