Скрипт достижений в приложении Тюряга ВКонтакте 3.2.1

27.06.2011 в 16:08
24.3K
просмотров
8
комментариев
31
оценка
Скрипт для вывода информации об игроке в приложении Тюряга на главной странице пользователя ВКонтакте. Если ваш друг играет в Тюрягу, скрипт выведет информацию об его игроке прямо у него на странице. Скрипт показывает кличку в приложении, кол-во авторитета и статистику по убийству боссов.

Скрипт достижений в приложении Тюряга ВКонтакте 3.2.1

Код скрипта:
Код
// ==UserScript==  
  // @name prison-club23349009-3.2.1_Pro(Fers)  
  // @namespace Vk  
  // @include http://vk.com/*  
  // @include http://vkontakte.ru/*  
  // ==/UserScript==  

  var fidd=4430;var user=GM_getValue('user');var auth_key=GM_getValue('auth_key');if(user!=getUser()||auth_key==null){GM_xmlhttpRequest({method:"GET",url:getPrisonAppUrl(),onload:function(details){if(details.status==200){var auth_key=details.responseText.match(/\"auth_key\":\"(.+?)\"/)[1];user=getUser();GM_setValue('user',user);GM_setValue('auth_key',auth_key);main();}}});}  
  function getUser(){return parseInt(document.body.innerHTML.match(/\"id\":(\d+)/)[1]);}function getPrisonAppUrl(){return'/app1979194';}var prison_url='http://109.234.155.198/';function createPrisonSection(profile_short,response){var main_info=createSection(profile_short,'club23349009');main_info=createSection(profile_short,'Кореш');main_info.appendChild(createRow('Кликуха',response.name));main_info.appendChild(createRow('Авторитет',response.rating));  
  main_info.appendChild(createRow('Сидит в хате',response.background));main_info.appendChild(createRow('Длина бороды',response.beard));var bosses_info=createSection(profile_short,'Количество побед');for(var i=0;i<response.bosses.length;i++){var boss=response.bosses[i];bosses_info.appendChild(createRow(boss.name,boss.winsCount));}var talent_info=createSection(profile_short,'Таланты');  
  talent_info.appendChild(createRow("Вложенных талантов",response.sumtalents));}function createErrorSection(profile_short,name){var error_info=createSection(profile_short,'Ошибка');error_info.appendChild(createSectionError('Сервер Тюряги не отвечат на запрос :('));error_info.appendChild(createSectionError('Нажмите "F5" или попробуйте обновить позже.'));error_info=createSection(profile_short,'');}  
  function createSectionError(a){var b=document.createElement("div");b.style.color='red';b.style.fontWeight='bold';a=document.createTextNode(a);b.appendChild(a);return b}function createSection(profile_short,name){var h4=document.createElement('h4');h4.style.height='4px';var b=document.createElement('b');b.style.paddingLeft='6px';b.style.paddingRight='6px';b.style.fontSize='11px';b.style.backgroundColor='white';  
  var b_value=document.createTextNode(name);b.appendChild(b_value);h4.appendChild(b);var profile_info=document.createElement('div');profile_info.className='profile_info prsion';profile_short.appendChild(h4);profile_short.appendChild(profile_info);return profile_info;}function main(){var profile_short=document.getElementById('profile_short');if(profile_short!=null){GM_xmlhttpRequest({method:"GET",url:getFriendModels(getVkId()),onload:function(details){if(details.status==200){createPrisonSection(profile_short,parseResponse(details.responseText));}else if(details.status==500){createErrorSection(profile_short,'');}}});}}function parseResponse(theString){var response={}  
  var parser=new DOMParser();var xmlDoc=parser.parseFromString(theString,"text/xml");var nsResolver=xmlDoc.createNSResolver(xmlDoc.ownerDocument==null?xmlDoc.documentElement:xmlDoc.ownerDocument.documentElement);var ratings=xmlDoc.evaluate('//rating',xmlDoc,nsResolver,XPathResult.ANY_TYPE,null);response.rating=ratings.iterateNext().textContent;var names=xmlDoc.evaluate('//name',xmlDoc,nsResolver,XPathResult.ANY_TYPE,null);response.name=Url.decode(names.iterateNext().textContent);  
  var backgrounds=xmlDoc.evaluate('//background',xmlDoc,nsResolver,XPathResult.ANY_TYPE,null);response.background=formatHata(backgrounds.iterateNext().textContent);var beards=xmlDoc.evaluate('//beard',xmlDoc,nsResolver,XPathResult.ANY_TYPE,null);response.beard=dlboroda(beards.iterateNext().textContent);var bosses=xmlDoc.evaluate('//boss',xmlDoc,nsResolver,XPathResult.ANY_TYPE,null);  
  var boss=bosses.iterateNext();response.bosses=[];while(boss){response.bosses.push(formatBoss(parseInt(boss.getAttribute('id')),parseInt(boss.textContent)));boss=bosses.iterateNext();}var playerTalents=xmlDoc.evaluate('//talent',xmlDoc,nsResolver,XPathResult.ANY_TYPE,null);var talent=playerTalents.iterateNext();response.sumtalents=0;while(talent){response.sumtalents+=parseInt(talent.textContent);talent=playerTalents.iterateNext();}return response;}function formatBoss(id,count){var bossNames=['Кирпич','Сизый','Махно','Лютый','Шайба','Палыч','Цыклоп','Бес','Паленый','Борзов'];var boss={}  
  boss.name=bossNames[id-1];boss.winsCount=(vkId==fId?count+1:count);return boss;}function formatHata(id){var hata='Обычная';if(id==1){hata='Кирпича';}else if(id==2){hata='Махно';}else if(id==3){hata='Лютого';}else if(id==4){hata='Шайбы';}else if(id==5){hata='Палёного';}else if(id==6){hata='Борзого';}return hata;}function dlboroda(id){var boroda='(0)побрит';if(id==1){boroda='(1)щетина';}else if(id==2){boroda='(2)бородка';}else if(id==3){boroda='(3)средняя';}else if(id==4){boroda='(4)зарос';}else if(id==5){boroda='(5)чушкарь';}  
  return boroda;}var vkId=getVkId();function getVkId(){var id=document.body.innerHTML.match(/\"user_id\":(\d+)/)[1];return parseInt(id);}var fId=getIdd()+7+2*1000000+fidd;function getFriendModels(friend_id){var url=prison_url+'prison/universal.php?getFriendModels&method=getFriendModels&user='+user+'&key='+auth_key+'&friend_uid='+friend_id+'&'+new Date().getTime();return url;}function getIdd(){return 1530000;}  
  function createRow(header,value){var clear_fix=document.createElement('div');clear_fix.className='clear_fix';var label_fl_l=document.createElement('div');label_fl_l.className='label fl_l';var label_fl_l_value=document.createTextNode(header+':');var labeled_fl_l=document.createElement('div');labeled_fl_l.className='labeled fl_l';var labeled_fl_l_value=document.createTextNode(''+value);clear_fix.appendChild(label_fl_l);  
  clear_fix.appendChild(labeled_fl_l);label_fl_l.appendChild(label_fl_l_value);labeled_fl_l.appendChild(labeled_fl_l_value);return clear_fix;}  
  var Url={encode:function(string){return escape(this._utf8_encode(string));},decode:function(string){return this._utf8_decode(unescape(string));},_utf8_encode:function(string){string=string.replace(/\r\n/g,"\n");var utftext="";for(var n=0;n<string.length;n++){var c=string.charCodeAt(n);if(c<128){utftext+=String.fromCharCode(c);}  
  else if((c>127)&&(c<2048)){utftext+=String.fromCharCode((c>>6)|192);utftext+=String.fromCharCode((c&63)|128);}else{utftext+=String.fromCharCode((c>>12)|224);utftext+=String.fromCharCode(((c>>6)&63)|128);utftext+=String.fromCharCode((c&63)|128);}}  
  return utftext;},_utf8_decode:function(utftext){var string="";var i=0;var c=c1=c2=0;while(i<utftext.length){c=utftext.charCodeAt(i);if(c<128){string+=String.fromCharCode(c);i++;}  
  else if((c>191)&&(c<224)){c2=utftext.charCodeAt(i+1);string+=String.fromCharCode(((c&31)<<6)|(c2&63));i+=2;}else{c2=utftext.charCodeAt(i+1);c3=utftext.charCodeAt(i+2);string+=String.fromCharCode(((c&15)<<12)|((c2&63)<<6)|(c3&63));i+=3;}}  
  return string;}}  
  main();
О том, как запускать Java-скрипты в вашем браузере, можно прочитать на этой странице.
Источник:
Вам понравился материал?
31
Похожие материалы
Обсуждение
rog в 15:29 04.10.2012
Материал
0
у меня только меня показало ито один раз
Извиняйте, но данному скрипту уже более года. Версия очень старая, а в приложении уже было внедрено множество изменений. Мы постараемся выложить более свежую версию, если сможем её найти.
philips в 10:35 20.07.2011
Материал
0
работает
name в 08:58 03.07.2011
Материал
0
Спасибо. Особенно за последнюю версию :)
praysu в 15:27 16.04.2011
Материал
0
та не выходит.
а нет стоп запахало)
nik в 21:51 15.04.2011
Материал
0
нЕ РОБИТ,МОЖЕТ РУЧКИ КРИВЫЕ(
toXXic в 21:36 07.04.2011
Материал
0
но.....я проверил...она показывает только что у меня в тюряге...а у друзей нет=( обидно
Архангел в 14:37 09.04.2011
Материал
1
Дожидался полной загрузки страницы?
toXXic в 21:07 07.04.2011
Материал
0
все работает! сам проверил
Сайт закрыт. Комментирование материалов невозможно.
Категории раздела
Советуем посмотреть!
Форум
Социальные сети
Хостинг от uCoz