1 2/* $Id: core.js 7244 2010-09-01 01:49:53Z john $ */ 3 4 5en4.user = { 6 7 viewer : { 8 type : false, 9 id : false 10 }, 11 12 attachEmailTaken : function(element, callback) 13 { 14 var bind = this; 15 element.addEvent('blur', function(){ 16 bind.checkEmailTaken(element.value, callback); 17 }); 18 19 /* 20 var lastElementValue = element.value; 21 (function(){ 22 if( element.value != lastElementValue ) 23 { 24 25 lastElementValue = element.value; 26 } 27 }).periodical(500, this); 28 */ 29 }, 30 31 attachUsernameTaken : function(element, callback) 32 { 33 var bind = this; 34 element.addEvent('blur', function(){ 35 bind.checkUsernameTaken(element.value, callback); 36 }); 37 38 /* 39 var lastElementValue = element.value; 40 (function(){ 41 if( element.value != lastElementValue ) 42 { 43 bind.checkUsernameTaken(element.value, callback); 44 lastElementValue = element.value; 45 } 46 }).periodical(500, this); 47 */ 48 }, 49 50 checkEmailTaken : function(email, callback) 51 { 52 en4.core.request.send(new Request.JSON({ 53 url : en4.core.baseUrl + 'user/signup/taken', 54 data : { 55 format : 'json', 56 email : email 57 }, 58 onSuccess : function(responseObject) 59 { 60 if( $type(responseObject.taken) ){ 61 callback(responseObject.taken); 62 } 63 } 64 })); 65 66 return this; 67 }, 68 69 checkUsernameTaken : function(username) 70 { 71 en4.core.request.send(new Request.JSON({ 72 url : en4.core.baseUrl + 'user/signup/taken', 73 data : { 74 format : 'json', 75 username : username 76 }, 77 onSuccess : function(responseObject) 78 { 79 if( $type(responseObject.taken) ){ 80 callback(responseObject.taken); 81 } 82 } 83 })); 84 85 return this; 86 }, 87 88 clearStatus : function() { 89 var request = new Request.JSON({ 90 url : en4.core.baseUrl + 'user/edit/clear-status', 91 method : 'post', 92 data : { 93 format : 'json' 94 } 95 }); 96 request.send(); 97 if( $('user_profile_status_container') ) { 98 $('user_profile_status_container').empty(); 99 } 100 return request; 101 } 102 103}; 104 105en4.user.friends = { 106 107 refreshLists : function(){ 108 109 }, 110 111 addToList : function(list_id, user_id){ 112 var request = new Request.JSON({ 113 url : en4.core.baseUrl + 'user/friends/list-add', 114 data : { 115 format : 'json', 116 friend_id : user_id, 117 list_id : list_id 118 } 119 }); 120 request.send(); 121 return request; 122 123 /* 124 $('profile_friends_lists_menu_' + user_id).style.display = 'none'; 125 126 var bind = this; 127 en4.core.request.send(new Request.JSON({ 128 url : en4.core.baseUrl + 'user/friends/list-add', 129 data : { 130 format : 'json', 131 friend_id : user_id, 132 list_id : list_id 133 } 134 }), { 135 'element' : $('user_friend_' + user_id) 136 }); 137 138 return this; 139 */ 140 }, 141 142 removeFromList : function(list_id, user_id){ 143 var request = new Request.JSON({ 144 url : en4.core.baseUrl + 'user/friends/list-remove', 145 data : { 146 format : 'json', 147 friend_id : user_id, 148 list_id : list_id 149 } 150 }); 151 request.send(); 152 return request; 153 /* 154 var bind = this; 155 en4.core.request.send(new Request.JSON({ 156 url : en4.core.baseUrl + 'user/friends/list-remove', 157 data : { 158 format : 'json', 159 friend_id : user_id, 160 list_id : list_id 161 } 162 }), { 163 'element' : $('user_friend_' + user_id) 164 }); 165 166 return this; 167 */ 168 }, 169 170 createList : function(title, user_id){ 171 var request = new Request.JSON({ 172 url : en4.core.baseUrl + 'user/friends/list-create', 173 data : { 174 format : 'json', 175 friend_id : user_id, 176 title : title 177 } 178 }); 179 request.send(); 180 return request; 181 182 /* 183 $('profile_friends_lists_menu_' + user_id).style.display = 'none'; 184 var bind = this; 185 en4.core.request.send(new Request.JSON({ 186 url : en4.core.baseUrl + 'user/friends/list-create', 187 data : { 188 format : 'json', 189 friend_id : user_id, 190 list_title : title 191 } 192 }), { 193 'element' : $('user_friend_' + user_id) 194 }); 195 196 return this; 197 */ 198 }, 199 200 deleteList : function(list_id){ 201 202 var bind = this; 203 en4.core.request.send(new Request.JSON({ 204 url : en4.core.baseUrl + 'user/friends/list-delete', 205 data : { 206 format : 'json', 207 user_id : en4.user.viewer.id, 208 list_id : list_id 209 } 210 })); 211 212 return this; 213 }, 214 215 216 showMenu : function(user_id){ 217 $('profile_friends_lists_menu_' + user_id).style.visibility = 'visible'; 218 $('friends_lists_menu_input_' + user_id).focus(); 219 $('friends_lists_menu_input_' + user_id).select(); 220 }, 221 222 hideMenu : function(user_id){ 223 $('profile_friends_lists_menu_' + user_id).style.visibility = 'hidden'; 224 }, 225 226 clearAddList : function(user_id){ 227 $('friends_lists_menu_input_' + user_id).value = ""; 228 } 229 230}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.