includes/clientside/static/autofill.js
changeset 1046 cfc6c30c5e2d
parent 787 b0d0d429d8cf
child 1053 bdbb49cf6f1b
equal deleted inserted replaced
1045:ce069a06906c 1046:cfc6c30c5e2d
    58         noResultsHTML: '<tr><td class="row1" style="font-size: smaller;">' + $lang.get('user_autofill_msg_no_suggestions') + '</td></tr>',
    58         noResultsHTML: '<tr><td class="row1" style="font-size: smaller;">' + $lang.get('user_autofill_msg_no_suggestions') + '</td></tr>',
    59     });
    59     });
    60   }
    60   }
    61 }
    61 }
    62 
    62 
    63 window.autofill_onload = function()
       
    64 {
       
    65   if ( this.loaded )
       
    66   {
       
    67     return true;
       
    68   }
       
    69   
       
    70   var inputs = document.getElementsByClassName('input', 'autofill');
       
    71   
       
    72   if ( inputs.length > 0 )
       
    73   {
       
    74     // we have at least one input that needs to be made an autofill element.
       
    75     // is spry data loaded?
       
    76     load_component('l10n');
       
    77   }
       
    78   
       
    79   this.loaded = true;
       
    80   
       
    81   for ( var i = 0; i < inputs.length; i++ )
       
    82   {
       
    83     autofill_init_element(inputs[i]);
       
    84   }
       
    85 }
       
    86 
       
    87 window.autofill_init_element = function(element, params)
    63 window.autofill_init_element = function(element, params)
    88 {
    64 {
    89   if ( element.af_initted )
    65   if ( element.af_initted )
    90     return false;
    66     return false;
    91   
    67   
   122 window.AutofillPage = function(el)
    98 window.AutofillPage = function(el)
   123 {
    99 {
   124   el.onkeyup = null;
   100   el.onkeyup = null;
   125   el.className = 'autofill page';
   101   el.className = 'autofill page';
   126   autofill_init_element(el, {});
   102   autofill_init_element(el, {});
       
   103 }
       
   104 
       
   105 // note: init, then onload (the latter is called automatically)
       
   106 
       
   107 window.autofill_onload = function()
       
   108 {
       
   109   if ( this.loaded )
       
   110   {
       
   111     return true;
       
   112   }
       
   113   
       
   114   var inputs = document.getElementsByClassName('input', 'autofill');
       
   115   
       
   116   if ( inputs.length > 0 )
       
   117   {
       
   118     // we have at least one input that needs to be made an autofill element.
       
   119     // is spry data loaded?
       
   120     load_component('l10n');
       
   121   }
       
   122   
       
   123   this.loaded = true;
       
   124   
       
   125   for ( var i = 0; i < inputs.length; i++ )
       
   126   {
       
   127     autofill_init_element(inputs[i]);
       
   128   }
   127 }
   129 }
   128 
   130 
   129 window.autofill_init = function()
   131 window.autofill_init = function()
   130 {
   132 {
   131   load_component(['l10n', 'jquery', 'jquery-ui']);
   133   load_component(['l10n', 'jquery', 'jquery-ui']);