includes/clientside/static/autofill.js
changeset 367 ee4defc9321a
parent 263 d57af0b0302e
child 407 35d94240a197
equal deleted inserted replaced
366:7e16181545e1 367:ee4defc9321a
   114     table.cellSpacing = '1';
   114     table.cellSpacing = '1';
   115     table.cellPadding = '3';
   115     table.cellPadding = '3';
   116     
   116     
   117     var tr = document.createElement('tr');
   117     var tr = document.createElement('tr');
   118     var th = document.createElement('th');
   118     var th = document.createElement('th');
   119     th.appendChild(document.createTextNode('Username suggestions'));
   119     th.appendChild(document.createTextNode($lang.get('user_autofill_heading_suggestions')));
   120     tr.appendChild(th);
   120     tr.appendChild(th);
   121     table.appendChild(tr);
   121     table.appendChild(tr);
   122     
   122     
   123     if ( users.length < 1 )
   123     if ( users.length < 1 )
   124     {
   124     {
   125       var tr = document.createElement('tr');
   125       var tr = document.createElement('tr');
   126       var td = document.createElement('td');
   126       var td = document.createElement('td');
   127       td.className = 'row1';
   127       td.className = 'row1';
   128       td.appendChild(document.createTextNode('No suggestions'));
   128       td.appendChild(document.createTextNode($lang.get('user_autofill_msg_no_suggestions')));
   129       td.afobj = autofill;
   129       td.afobj = autofill;
   130       tr.appendChild(td);
   130       tr.appendChild(td);
   131       table.appendChild(tr);
   131       table.appendChild(tr);
   132     }
   132     }
   133     else
   133     else
   313     if ( !state_td )
   313     if ( !state_td )
   314       return false;
   314       return false;
   315     if ( state_td.parentNode.nextSibling )
   315     if ( state_td.parentNode.nextSibling )
   316     {
   316     {
   317       // Ooh boy, DOM stuff can be so complicated...
   317       // Ooh boy, DOM stuff can be so complicated...
   318       // <tr>  -->  <tr>
   318       //   <tr>   →   <tr>
   319       // <td>       <td>
   319       // ↑ <td>       <td> ↓
   320       // user       user
   320       //   user       user
   321       
   321       
   322       var newstate = state_td.parentNode.nextSibling.firstChild.firstChild.nodeValue;
   322       var newstate = state_td.parentNode.nextSibling.firstChild.firstChild.nodeValue;
   323       if ( !newstate )
   323       if ( !newstate )
   324         return false;
   324         return false;
   325       this.state = newstate;
   325       this.state = newstate;
   366     if ( !state_td )
   366     if ( !state_td )
   367       return false;
   367       return false;
   368     if ( state_td.parentNode.previousSibling && state_td.parentNode.previousSibling.firstChild.tagName != 'TH' )
   368     if ( state_td.parentNode.previousSibling && state_td.parentNode.previousSibling.firstChild.tagName != 'TH' )
   369     {
   369     {
   370       // Ooh boy, DOM stuff can be so complicated...
   370       // Ooh boy, DOM stuff can be so complicated...
   371       // <tr>  <--  <tr>
   371       //   <tr>   ←   <tr>
   372       // <td>       <td>
   372       // ↓ <td>       <td> ↑
   373       // user       user
   373       //   user       user
   374       
   374       
   375       var newstate = state_td.parentNode.previousSibling.firstChild.firstChild.nodeValue;
   375       var newstate = state_td.parentNode.previousSibling.firstChild.firstChild.nodeValue;
   376       if ( !newstate )
   376       if ( !newstate )
   377       {
   377       {
   378         return false;
   378         return false;