Gaia AutoComplete

Auto Complete for gaia

目前为 2014-05-25 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Gaia AutoComplete
  3. // @namespace http://userscripts.org/users/62850
  4. // @description Auto Complete for gaia
  5. // @include http://www.gaiaonline.com/*
  6. // @include https://www.gaiaonline.com/*
  7. // @version 0.0.1.20140525024111
  8. // ==/UserScript==
  9. function AutoComplete(LL,UN,PW,AL){
  10. if(GM_getValue('runct')==0){
  11. GM_setValue('runct',1);
  12. if(LL.length==3){
  13. if(unescape(LL[0])==UN.value&&unescape(LL[1])==PW.value){
  14. return;
  15. }
  16. }
  17. if(confirm('Enable Autocomplete for this account.')===true&&PW.value.length>0){
  18. GM_setValue('LastGaiaLogin',escape(UN.value)+','+escape(PW.value)+','+AL.checked);
  19. }
  20. }
  21. }
  22. if(document.getElementById('memberloginForm')){
  23. var LL=GM_getValue('LastGaiaLogin','').split(',');
  24. var UN=document.getElementById('username');
  25. var PW=document.getElementById('password');
  26. var AL=document.getElementById('autologin');
  27. var LB=document.getElementById('signInButton');
  28. if(UN.value==''){
  29. LB.addEventListener('click',function(){AutoComplete(LL,UN,PW,AL)},false);
  30. UN.addEventListener('keypress',function(e){if(e.keyCode==13){AutoComplete(LL,UN,PW,AL)}},false);
  31. PW.addEventListener('keypress',function(e){if(e.keyCode==13){AutoComplete(LL,UN,PW,AL)}},false);
  32. AL.addEventListener('keypress',function(e){if(e.keyCode==13){AutoComplete(LL,UN,PW,AL)}},false);
  33. if(LL.length==3){
  34. UN.value=unescape(LL[0]);
  35. PW.value=unescape(LL[1]);
  36. AL.checked=LL[2];
  37. UN.className='textbox';
  38. PW.className='textbox';
  39. }
  40. GM_setValue('runct',0);
  41. }
  42. }
  43. else if(document.location.href.indexOf('/marketplace/')!=-1){
  44. try{
  45. document.getElementsByName('password')[0].value=unescape(GM_getValue('LastGaiaLogin','').split(',')[1]);
  46. }
  47. catch(e){}
  48. }else if(document.location.href.indexOf('/gaia/bank.php')!=-1){
  49. try{
  50. document.getElementById('password_entry').value=unescape(GM_getValue('LastGaiaLogin','').split(',')[1]);
  51. }
  52. catch(e){}
  53. }