Advertisement
Guest User

Atelier 801 - Auto log in

a guest
Jan 9th, 2016
281
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name       Atelier 801 Account Manager
  3. // @description  Allows you to go in any account you have in anytime at Atelier 801.
  4. // @match         http://atelier801.com/*
  5. // @grant         none
  6. // ==/UserScript==
  7.  
  8. var dC={gI:function(e){return e?decodeURIComponent(document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*"+encodeURIComponent(e).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=\\s*([^;]*).*$)|^.*$"),"$1"))||null:null},sI:function(e,n,o,t,r,c){if(!e||/^(?:expires|max\-age|path|domain|secure)$/i.test(e))return!1;var s="";if(o)switch(o.constructor){case Number:s=o===1/0?"; expires=Fri, 31 Dec 9999 23:59:59 GMT":"; max-age="+o;break;case String:s="; expires="+o;break;case Date:s="; expires="+o.toUTCString()}return document.cookie=encodeURIComponent(e)+"="+encodeURIComponent(n)+s+(r?"; domain="+r:"")+(t?"; path="+t:"")+(c?"; secure":""),!0},rI:function(e,n,o){return this.hI(e)?(document.cookie=encodeURIComponent(e)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT"+(o?"; domain="+o:"")+(n?"; path="+n:""),!0):!1},hI:function(e){return e?new RegExp("(?:^|;\\s*)"+encodeURIComponent(e).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=").test(document.cookie):!1},k:function(){for(var e=document.cookie.replace(/((?:^|\s*;)[^\=]+)(?=;|$)|^\s*|\s*(?:\=[^;]*)?(?:\1|$)/g,"").split(/\s*(?:\=[^;]*)?;\s*/),n=e.length,o=0;n>o;o++)e[o]=decodeURIComponent(e[o]);return e}};
  9. (function(){
  10.     'use strict';
  11.    
  12.    
  13.     var MyAccounts={
  14.         "MyAccount":"Password",
  15.         "MyAccount2":"Password",
  16.     },MEM=[[],[]];
  17.    
  18.    
  19.     String.prototype.rA=function(a,b){
  20.         return this.split(a).join(b)
  21.     },
  22.     String.prototype.bT=function(a,b){
  23.         MEM[0][0]=this.substring(this.indexOf(a)+a.length);
  24.         return MEM[0][0].substring(0,MEM[0][0].indexOf(b))
  25.     };
  26.     function BTNs(){
  27.         var r=(document.getElementById("identification")||document.getElementById("barre_navigation").getElementsByClassName("dropdown")[0]).parentElement;
  28.         for(var i in MyAccounts)
  29.             !function(i){
  30.                 var n=document.createElement("button")
  31.                 n.setAttribute("class","btn"),
  32.                 n.setAttribute("data-acc",i),
  33.                 n.style.marginRight="4px",
  34.                 n.onclick=function(){SIGN_IN(this.getAttribute("data-acc"))},
  35.                 n.innerHTML=i;
  36.                 r.appendChild(n);
  37.                 n=null
  38.             }(i);
  39.         r=null
  40.     }
  41.     BTNs();
  42.     if(dC.hI("nextlogin")){
  43.         MEM[1][0]=document.cookie.bT("nextlogin=",";");
  44.         //document.cookie.replace("nextlogin"+MEM[1][0]+";","");
  45.         dC.rI("nextlogin");
  46.         SIGN_IN(MEM[1][0])
  47.     }
  48.     function SIGN_IN(a){
  49.         MEM[0][1]=document.cookie.bT('login=',';');
  50.         if(typeof MEM[0][1]=="string"&&MEM[0][1].length>0&&MEM[0][1]!='""'){
  51.             MEM[0][3]=!!document.querySelector("form[action=deconnexion]")?document.querySelector("form[action=deconnexion]").querySelector("button"):null;
  52.             if(!!MEM[0][3]){
  53.                 //MEM[0][2]=document.cookie.length;
  54.                 //document.cookie=document.cookie+(document.cookie.substring(MEM[0][2]-1,MEM[0][2])==";"?"nextlogin="+a+";":";nextlogin="+a+";");
  55.                 dC.sI("nextlogin",a);
  56.                 MEM[0][3].click()
  57.             }
  58.         }else{
  59.             document.querySelector("#auth_login_1").value=a,
  60.             document.querySelector("#auth_pass_1").value=MyAccounts[a];
  61.             auth({"preventDefault":function(){}})
  62.         }
  63.     }
  64. }())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement