function main(){ var p = 0; // Заходим на главную страницу document.location="https://login.mgts.ru/amserver/UI/Login"; if(!external.WaitBrowser) return; response.pages[p++]=external.source; // Вводим логин и пароль и submit форму if (document.all.IDToken1){ document.all.IDToken1.value=request.loginValue; document.all.IDToken2.value=request.passwValue; document.getElementById("IDButton").form.getElementsByTagName("button")[0].click(); if(!external.WaitBrowser) return; response.pages[p++]=external.source; }; // Забираем информацию html=document.documentElement.outerHTML; // Преобразуем в одну строку и удаляем лишние пробелмы после > html = html.replace(/\r|\n/g, "").replace(/>\s+/g, ">"); // Баланс regexp=/balance_value.*?>.*?>([-|\d|,]+)</i; if (res=regexp.exec(html)) { tmpBalance=res[1].replace(/ |\xA0/, ""); // Удаляем пробелы и т.п. tmpBalance=tmpBalance.replace(",", "."); // Заменяем запятую на точку response.Balance=parseFloat(tmpBalance); }; // ФИО regexp=/account-info_header.*?>.*?>(.*?)<.*?>.*?>(.*?)<.*?>.*?>(.*?)<.*?>/i; if (res=regexp.exec(html)) { response.UserName=res[1]+" "+res[2]+" "+res[3]; }; // Лицевой счет regexp=/Лицевой счет:.*?>.*?account-info_item_value\">(.*?)<\/div>/i; if (res=regexp.exec(html)){ response.licSchet=res[1]; }; // Тарифный план regexp=/Ваш тариф:.*?>.*?text-link\">(.*?)<\/span/i; if (res=regexp.exec(html)){ response.TarifPlan=res[1]; }; // Если не в дебаге, то выходим if (!external.isDebugMode) { document.location="https://login.mgts.ru/amserver/UI/Logout"; } }; main();