Advertisement
Guest User

Untitled

a guest
Apr 21st, 2015
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. function showLoginPopup(){
  2. mMain.showPopup('popup_login');
  3. }
  4. function login(){
  5. mMain.login();
  6. }
  7. function getInput(which){
  8. var selector,
  9. input;
  10. switch(which){
  11. case 'mail': selector = 'input#login_email';
  12. break;
  13. case 'password': selector = 'input#login_pwd';
  14. break;
  15. default : alert("t'as craque ton switch");
  16. }
  17. if(!(input=document.querySelector(selector))){
  18. alert("echec de selector, z'ont change leur DOM");
  19. } else {
  20. return input;
  21. }
  22. }
  23. function fillFields(){
  24. // var mailInput = getInput('mail')
  25. // , pwdInput = getInput('password')
  26. // ;
  27. getInput('mail').value = credentials.mail;
  28. getInput('password').value = credentials.pwd;
  29. }
  30. var credentials = {
  31. mail:'MAIL@EXAMPLE.com',
  32. pwd: 'PASSWORD'
  33. }
  34. ;
  35.  
  36. // Displaying the popup isn't necessary as we can call the login action directly
  37. // (without simulating click event on the "Se connecter" button)
  38. // showLoginPopup();
  39. fillFields();
  40. login();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement