Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function showLoginPopup(){
- mMain.showPopup('popup_login');
- }
- function login(){
- mMain.login();
- }
- function getInput(which){
- var selector,
- input;
- switch(which){
- case 'mail': selector = 'input#login_email';
- break;
- case 'password': selector = 'input#login_pwd';
- break;
- default : alert("t'as craque ton switch");
- }
- if(!(input=document.querySelector(selector))){
- alert("echec de selector, z'ont change leur DOM");
- } else {
- return input;
- }
- }
- function fillFields(){
- // var mailInput = getInput('mail')
- // , pwdInput = getInput('password')
- // ;
- getInput('mail').value = credentials.mail;
- getInput('password').value = credentials.pwd;
- }
- var credentials = {
- mail:'MAIL@EXAMPLE.com',
- pwd: 'PASSWORD'
- }
- ;
- // Displaying the popup isn't necessary as we can call the login action directly
- // (without simulating click event on the "Se connecter" button)
- // showLoginPopup();
- fillFields();
- login();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement