function ajax(url, myData, to){
var response;
$.ajax({
url: url,
type: "POST",
data: myData,
success : function (response) {
var elem = $("#"+to);
elem.animate({ scrollTop: 0});
elem.html(response);
}
});
//return false;
}
var nousehistory = false;
function ajaxobj(url, myData, to){
var response;
$.ajax({
url: url,
type: "POST",
data: myData,
success : function (response) {
to.html(response);
}
});
//return false;
}
function ajaxreplace(url, myData, to){
var response;
$.ajax({
url: url,
type: "POST",
data: myData,
success : function (response) {
$('#'+to).replaceWith(response);
}
});
//return false;
}
function createsub(){
ajax('ajax.php','type=subs&subtype=newsub&'+$('#newsub').serialize(),'mysubs');
$('#newsubdiv').toggleClass('visible');
$('#createsubfab').toggleClass('rotate');
return false;
}
function reradio(obj1,obj2){
$(obj1).removeAttr('checked');
$(obj2).prop('checked', true);
}
function loadSubs(name, url, id, color1, color2) {
if(typeof ColorThief == 'undefined'){
$.ajaxSetup({
cache: true
});
$.ajax({
type: "GET",
url: "/static/color-thief.js",
success: function( data, textStatus, jqxhr ) {
loadSubsIn(name, url, id, color1, color2);
},
dataType: "script"
});
$.ajaxSetup({
cache: false
});
}else{
loadSubsIn(name, url, id, color1, color2);
}
}
function loadSubsIn(name, url, id, color1, color2){
if(id !== undefined)
onOpenSub(name, url, id);
imagesLoaded( "#logoimage", function() {
materialhead(0,color1,color2);
});
}
function loadSubAdmin(golden, color1, color2) {
if(typeof ColorThief == 'undefined'){
$.ajax({
type: "GET",
url: "/static/color-thief.js",
success: function( data, textStatus, jqxhr ) {
loadSubsIn(golden, color1, color2);
},
dataType: "script"
});
}else{
loadSubsAdminIn(golden, color1, color2);
}
}
function loadSubsAdminIn(golden, color1, color2){
$("#subcard").toggleClass("visible");
imagesLoaded( "#logoimage", function() {
materialhead(golden ,color1,color2);
});
}
function materialhead(dev, color1, color2){
var color;
if((color1 == undefined) && (color2 == undefined)) {
var colorThief = new ColorThief();
//var res=colorThief.getColor(logoimage);
var pal = colorThief.getPalette(logoimage, 2);
if (Math.abs(384 - pal[0][0] + pal[0][1] + pal[0][2]) > Math.abs(384 - pal[1][0] + pal[1][1] + pal[1][2])) {
var res = pal[1];
} else
var res = pal[0];
if ((pal[0][0] + pal[0][1] + pal[0][2])) { //один черный, сделать главным второй.
var res = pal[1];
}
if ((pal[1][0] + pal[1][1] + pal[1][2])) { //один черный, сделать главным второй.
var res = pal[0];
}
var hsl = calc(res[0], res[1], res[2]);
if (hsl[2] < 60) {
color = "white";
hsl[2] = hsl[2] / 100 * 70;
}
else {
color = "#333";
hsl[2] = hsl[2] / 70 * 100;
}
hsl[2] = hsl[2] / 100 * 70;
if (hsl[2] < 10) {
hsl[2] = hsl[2] / 100 * 200;
if (hsl[2] < 5 && Math.abs(Math.abs(384 - pal[0][0] + pal[0][1] + pal[0][2]) - Math.abs(384 - pal[1][0] + pal[1][1] + pal[1][2])) < 10) {
hsl[2] = 30;
}
}
//$(".bubblehead").removeClass('transition');
$(".bubblehead").cssNoTransition({"background-color":"hsl("+hsl[0]+","+hsl[1]+"%,"+hsl[2]+"%)"});
}else{
color = color1;
$(".bubblehead").cssNoTransition({"background-color":color2});
}
$(".bubblehead").addClass('transition');
$(".bubblehead").toggleClass("active");
$("#subheader").css("color" , color);
if(dev == 1) {
document.querySelector('#colorpickertext').color = color;
if(color1 == 'undefined' && color2 == 'undefined') {
document.querySelector('#colorpicker').color = "hsl(" + hsl[0] + "," + hsl[1] + "%," + hsl[2] + "%)";
}else{
document.querySelector('#colorpicker').color = color2;
}
}
}
function OpenInNewTab(url) {
var win = window.open(url, '_blank');
win.focus();
}
function subpubview(sub){
ajax('ajax.php','type=subs&subtype=subpubview&id='+sub,'subright');
$("html, body").animate({ scrollTop: 0 }, "fast");
}
function subpubviewnew(sub, fromhistory, key){
if(fromhistory == 'undefined')
fromhistory = 0;
$("#content").toggleClass("blur");
$("#popup").toggleClass("view");
$("#popupcont").css('margin-top',$(window).scrollTop());
$('#popupcont').html('');
ajax('ajax.php','type=subs&subtype=subpubview&id='+sub+"&key="+key+"&fromhistory="+fromhistory,'popupcont');
}
function popupclose(){
$("#content").removeClass("blur");
$("#popup").removeClass("view");
$("#popupcont").html('');
openCatalog();
}
$( document ).ready(function() {
$.fn.redraw = function(){
var redraw = $(this).first()[0].offsetHeight || $('body')[0].offsetHeight; // forces a draw in the main window if the element is off screen
return this;
};
$.fn.cssNoTransition = function(){
$(this)
.css('transition', 'none')
.css.apply(this,arguments)
.redraw()
.css('transition', '');
return this;
};
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
ga('create', 'UA-62344550-1', 'auto');
ga('send', 'pageview');
$('#popup').on('click', function (e) {
if (e.target !== this)
return;
popupclose();
});
});
function onOpenSub(subname, suburl, subid){ //если открывается канал, нужно записать в историю
document.title = "PushAll - "+subname;
var data={
"url":suburl,
"name": subname,
"type": "subs",
"subid": subid
};
if(!nousehistory){
history.pushState(data, null, '/'+suburl);
ga('send', 'pageview', location.pathname);
}
}
function openCatalog(){
document.title = "PushAll - Каталог";
var data={
"url":'',
"name": 'Каталог'
};
if(!nousehistory) {
history.pushState(data, null, '/');
ga('send', 'pageview', location.pathname);
}
}
function subpubviewhome(sub){
$('#subhome').css('min-height','450px');
$('#fastsub').html('');
$('.stathome').slideUp('slow');
ajax('ajax.php','type=subs&subtype=subpubview&id='+sub,'subhome');
$("html, body").animate({ scrollTop: 350}, "slow");
}
function subfs(){
$("#subcard").toggleClass("subfs");
}
function openpage(pagename, title, nonpush) {
ajax('ajax.php','type=openpage&page='+pagename,'right');
document.title = "PushAll - " + title;
var data={
"url": pagename,
"name": title,
"type": 'menu'
};
if(!nousehistory) {
if (nonpush != 1) history.pushState(data, null, '/' + pagename);
ga('send', 'pageview', location.pathname);
}
}
function calc(r,g,b)
{
if( r=="" ) r=0;
if( g=="" ) g=0;
if( b=="" ) b=0;
r = parseFloat(r);
g = parseFloat(g);
b = parseFloat(b);
if( r<0 ) r=0;
if( g<0 ) g=0;
if( b<0 ) b=0;
if( r>255 ) r=255;
if( g>255 ) g=255;
if( b>255 ) b=255;
hex = r*65536+g*256+b;
hex = hex.toString(16,6);
len = hex.length;
if( len<6 )
for(i=0; i<6-len; i++)
hex = '0'+hex;
r/=255;
g/=255;
b/=255;
M = Math.max(r,g,b);
m = Math.min(r,g,b);
d = M-m;
if( d==0 ) h=0;
else if( M==r ) h=((g-b)/d)%6;
else if( M==g ) h=(b-r)/d+2;
else h=(r-g)/d+4;
h*=60;
if( h<0 ) h+=360;
l = (M+m)/2;
if( d==0 )
s = 0;
else
s = d/(1-Math.abs(2*l-1));
s*=100;
l*=100;
return [h.toFixed(0), s.toFixed(1), l.toFixed(1)];
}
function editsubclick(){
$('.subbut').toggleClass('rot');
$('.oksub').toggleClass('rot');
$('.bubbleedit').toggleClass('active');
$('#desccard .view').slideToggle();
$('#desccard .edit').slideToggle();
}
function oksub(){
var params = 'type=subs&subtype=subedit';
params = params + '&'+$("#nameedit").serialize()+'&'+$("#deskedit").serialize();
params = params + '&hiddenlist='+$("#hiddenlistbut").prop('checked');
params = params + '&oauthonly='+$("#oauthonly").prop('checked');
params = params + '&hiddensubpush='+$("#hiddensubpush").prop('checked');
params = params + '&noads='+$("#noads").prop('checked');
params = params + '&nopromo='+$("#nopromo").prop('checked');
params = params + '&cat='+$('#catsettings .iron-selected').attr( "value" );
ajax('ajax.php',params,'addright');
}
function hidelog(el,lid){
$(el).parent().toggleClass('hide');
/*$(el).parent().children('.imgcont').toggleClass('hide');*/
$(el).parent().children('.logtext').toggleClass('hidetext');
$(el).toggleClass('hideebut');
ajax('ajax.php','type=log&subtype=hide&lid='+lid,'empty');
}
function hidelogsub(el,lid){
$(el).parent().toggleClass('hide');
/*$(el).parent().children('.imgcont').toggleClass('hide');*/
$(el).parent().children('.logtext').toggleClass('hidetext');
$(el).toggleClass('hideebut');
ajax('ajax.php','type=log&subtype=hide&admin=1&lid='+lid,'empty');
}
function bysub(el,sub){
$(el).parent().children('.leftsub').removeClass('choose');
$(el).addClass('choose');
$('#loadernotif').addClass('loaderactive');
ajax('ajax.php','type=log&subtype=bysub&subid='+sub,'notiflist');
}
function bysubnext(el,sub,last,oint){
$.ajax({
url: 'ajax.php',
type: "POST",
data: 'type=log&subtype=bysub&subid='+sub+'&last='+last+'&oint='+oint,
success : function (response) {
$("#bysubnext").parent().append(response);
$(el).remove();
}
});
}
function nextajax(el,data){
$.ajax({
url: 'ajax.php',
type: "POST",
data: data,
success : function (response) {
$(el).parent().append(response);
$(el).remove();
}
});
}
function logsubnext(el,sub,last){
$.ajax({
url: 'ajax.php',
type: "POST",
data: 'type=log&subtype=logsub&subid='+sub+'&last='+last,
success : function (response) {
$("#logsubnext").parent().append(response);
$(el).remove();
}
});
}
function moresubs(el,cat,last){
$.ajax({
url: 'ajax.php',
type: "POST",
data: 'type=subs&subtype=moresubs&cat='+cat+'&last='+last,
success : function (response) {
$(el).parent().append(response);
$(el).remove();
}
});
}
var paybalstart;
var paybalfinish;
function money(id, start, finish){
var decimal_places = 2;
var decimal_factor = decimal_places === 0 ? 1 : decimal_places * 10;
$("#"+id)
.prop("number", start*20)
.animateNumber(
{
number: finish * decimal_factor,
numberStep: function(now, tween) {
var floored_number = Math.floor(now) / decimal_factor,
target = $(tween.elem);
if (decimal_places > 0) {
// force decimal places even if they are 0
floored_number = floored_number.toFixed(decimal_places);
// replace "." separator with ","
floored_number = floored_number.toString().replace(".", ",");
}
target.text(floored_number);
}
},
1000
);
}
function help(){
$("#homebutc").toggleClass("cardtop");
}
var conn,wsstatus;
function startsocket(){
if(wsstatus==1)
return false;
checkpush();
wsstatus=1;
conn = new WebSocket('wss://pushall.ru/websocket/');
conn.onmessage = function(event) {
checkpush();
};
conn.onclose = function() { if(stops==0){wsstatus=0;setTimeout(startsocket, 5000);} };
}
var stops=0;
function stopsocket(){
stops=1;
conn.close();
}
function checkpush(){
Notification.requestPermission().then(function(permission) {
if (permission === 'denied') {
console.log('Permission wasn\'t granted. Allow a retry.');
return;
}
if (permission === 'default') {
console.log('The permission request was dismissed.');
return;
}
arStatus = [];
$.ajax({
url: 'https://pushall.ru/push.php?getpush=1®id=SocketPush',
type: "GET",
success : function (dat) {
if(dat.length==0){return 0;}
console.log(dat);
JSON.parse(dat).forEach(function(entry) {
arStatus.push(entry['notId']);
var notif=new Notification(entry['title'], {
tag : entry['notId'],
body : entry['text'],
icon : entry['icon']
});
notif.onclick=function(){
OpenInNewTab(entry['url']);
setstatus(entry['notId'], 2);
};
notif.onclose=function(){
setstatus(entry['notId'], 3);
};
}); //foreach
if(arStatus.length>0) {
setstatus(arStatus.join(), 1);
}
}
});//ajax
});
}
function setstatus(notID, status){
/*var xhr = new XMLHttpRequest();
xhr.open("POST", 'https://pushall.ru/api.php', true)
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded')
//xhr.onreadystatechange = ...;
xhr.send(body);
*/
/*fetch('https://pushall.ru/api.php', {
credentials: 'include' ,
method: 'post',
headers: {
"Content-type": "application/x-www-form-urlencoded; charset=UTF-8"
},
body: body
})
.then(function (data) {
console.log('Request succeeded with JSON response', data);
})
.catch(function (error) {
console.log('Request failed', error);
});
*/
$.ajax({
url: 'https://pushall.ru/api.php',
type: "POST",
data: 'type=setstatus&socket=1&status=' + status + '&lid=' + notID,
success : function (response) {
}
});
}
function OpenInNewTab(url) {
var win = window.open(url, '_blank');
win.focus();
}
var webPushId = "web.ru.pushall";
var safaritoken;
var checkRemotePermissionSafari = function (permissionData) {
if (permissionData.permission === 'default') {
// This is a new web service URL and its validity is unknown.
window.safari.pushNotification.requestPermission(
'https://pushall.ru/safari', // The web service URL.
webPushId, // The Website Push ID.
{"token": safaritoken}, // Data that you choose to send to your server to help you identify the user.
checkRemotePermissionSafari // The callback function.
);
}
else if (permissionData.permission === 'denied') {
// The user said no.
$('#webpush').html('Вы запретили WebPush ');
$('#webpush').css('width','400px');
}
else if (permissionData.permission === 'granted') {
// The web service URL is a valid push provider, and the user said yes.
// permissionData.deviceToken is now available to use.
$('#webpush').html('WebPush (Safari) ');
$('#webpush').css('width','300px');
}
};
function enablesafaripush(){
var permissionData = window.safari.pushNotification.permission(webPushId);
checkRemotePermissionSafari(permissionData);
}
$( document ).ready(function() {
//console.log("onload");
if ('safari' in window && 'pushNotification' in window.safari) {
//var permissionData = window.safari.pushNotification.permission(webPushId);
//checkRemotePermissionSafari(permissionData);
$( document ).ready(function() {
var permissionData = window.safari.pushNotification.permission(webPushId);
if (permissionData.permission === 'default') {
$.ajax({
url: 'https://pushall.ru/push.php?shareRegId=7',
type: "GET",
success : function (token) {
safaritoken=token;
$('#webpush').html('WebPush (Safari) ');
$('#webpush').css('width','300px');
}});
}
else if (permissionData.permission === 'denied') {
$('#webpush').html('Вы запретили WebPush ');
$('#webpush').css('width','400px');
}
else if (permissionData.permission === 'granted') {
$('#webpush').html('WebPush (Safari) ');
$('#webpush').css('width','300px');
}
$('#webpushtext').html('Уведомления в браузере Safari (OSX), нажмите на переключатель ниже и разрешите доступ к уведомлениям
');
});
}
});
function devicesettings(el){
$(el).find('.icon').toggleClass("rotate");
$(el).parent().parent().next().first().toggleClass("view");
}
function manualdelivery(subid){
$('#manualresult').html('Идет отправка, подождите...');
ajax('ajax.php','type=subs&subtype=manualdelivery&id='+subid+'&priority='+$('#prioritymanual .iron-selected').attr( "value" )+'&background='+$("#manualbackground").prop('checked')+'&'+$('#manualdelivery').serialize(),'manualresult');
}
function savecolor(subid) {
ajax('ajax.php','type=subs&subtype=savecolor&id='+subid+'&color1='+color1+'&color2='+color2,'empty');
}
function clearcolor(subid) {
ajax('ajax.php','type=subs&subtype=savecolor&id='+subid,'empty');
materialhead(1);
materialhead(1);
}
function emailregisteropen() {
$('#passwordauth').slideDown();
$("#content").scrollTop($("#content")[0].scrollHeight);
}
function tabs(clas,id) {
$(clas).hide();
$(id).show();
}
function openstatistic(subid){
$('#statisticdiv').slideToggle();
if(substatopen == 0)
ajax('ajax.php','type=log&subtype=statistic&id='+subid,'statisticdiv');
}
function openpeople(subid){
$('#subuserslist').slideToggle();
$('#sublistsearch').slideToggle();
if(subpeopleopen == 0)
ajax('ajax.php','type=subs&subtype=people&id='+subid,'subuserslist');
}
/*
jQuery animateNumber plugin v0.0.14
(c) 2013, Alexandr Borisov.
https://github.com/aishek/jquery-animateNumber
*/
(function(d){var r=function(b){return b.split("").reverse().join("")},m={numberStep:function(b,a){var e=Math.floor(b);d(a.elem).text(e)}},g=function(b){var a=b.elem;a.nodeType&&a.parentNode&&(a=a._animateNumberSetter,a||(a=m.numberStep),a(b.now,b))};d.Tween&&d.Tween.propHooks?d.Tween.propHooks.number={set:g}:d.fx.step.number=g;d.animateNumber={numberStepFactories:{append:function(b){return function(a,e){var f=Math.floor(a);d(e.elem).prop("number",a).text(f+b)}},separator:function(b,a,e){b=b||" ";
a=a||3;e=e||"";return function(f,k){var u=0>f,c=Math.floor((u?-1:1)*f).toString(),n=d(k.elem);if(c.length>a){for(var h=c,l=a,m=h.split("").reverse(),c=[],p,s,q,t=0,g=Math.ceil(h.length/l);tg;++fa)p=Z.charCodeAt(fa),128>p?e[g>>2]|=p<p?e[g>>2]|=(192|p>>6)<p||57344<=p?e[g>>2]|=(224|p>>12)<>2]|=(240|p>>18)<>2]|=(128|p>>12&63)<>2]|=(128|p>>6&63)<>2]|=(128|p&63)<>2]|=ra[g&
3],++fa);p=e[32];fa>na&&112>g&&(e[31]=ma<<3,ka=!0);for(g=32;160>g;g+=2)h=e[g-30],k=e[g-29],L=(h>>>1|k<<31)^(h>>>8|k<<24)^h>>>7,M=(k>>>1|h<<31)^(k>>>8|h<<24)^(k>>>7|h<<25),h=e[g-4],k=e[g-3],f=(h>>>19|k<<13)^(k>>>29|h<<3)^h>>>6,b=(k>>>19|h<<13)^(h>>>29|k<<3)^(k>>>6|h<<26),h=e[g-32],k=e[g-31],l=e[g-14],m=e[g-13],d=(m&65535)+(k&65535)+(M&65535)+(b&65535),b=(m>>>16)+(k>>>16)+(M>>>16)+(b>>>16)+(d>>>16),c=(l&65535)+(h&65535)+(L&65535)+(f&65535)+(b>>>16),f=(l>>>16)+(h>>>16)+(L>>>16)+(f>>>16)+(c>>>16),e[g]=
f<<16|c&65535,e[g+1]=b<<16|d&65535;var N=n,O=q,G=r,H=t,I=u,J=v,P=w,Q=x,R=y,S=z,T=A,U=B,V=C,W=D,X=E,Y=F;ga=G&I;ha=H&J;for(g=0;160>g;g+=8)L=(N>>>28|O<<4)^(O>>>2|N<<30)^(O>>>7|N<<25),M=(O>>>28|N<<4)^(N>>>2|O<<30)^(N>>>7|O<<25),f=(R>>>14|S<<18)^(R>>>18|S<<14)^(S>>>9|R<<23),b=(S>>>14|R<<18)^(S>>>18|R<<14)^(R>>>9|S<<23),ia=N&G,ja=O&H,aa=ia^N&I^ga,ba=ja^O&J^ha,ca=R&T^~R&V,c=S&U^~S&W,h=e[g],k=e[g+1],l=da[g],m=da[g+1],d=(m&65535)+(k&65535)+(c&65535)+(b&65535)+(Y&65535),b=(m>>>16)+(k>>>16)+(c>>>16)+(b>>>16)+
(Y>>>16)+(d>>>16),c=(l&65535)+(h&65535)+(ca&65535)+(f&65535)+(X&65535)+(b>>>16),f=(l>>>16)+(h>>>16)+(ca>>>16)+(f>>>16)+(X>>>16)+(c>>>16),h=f<<16|c&65535,k=b<<16|d&65535,d=(ba&65535)+(M&65535),b=(ba>>>16)+(M>>>16)+(d>>>16),c=(aa&65535)+(L&65535)+(b>>>16),f=(aa>>>16)+(L>>>16)+(c>>>16),l=f<<16|c&65535,m=b<<16|d&65535,d=(Q&65535)+(k&65535),b=(Q>>>16)+(k>>>16)+(d>>>16),c=(P&65535)+(h&65535)+(b>>>16),f=(P>>>16)+(h>>>16)+(c>>>16),X=f<<16|c&65535,Y=b<<16|d&65535,d=(m&65535)+(k&65535),b=(m>>>16)+(k>>>16)+
(d>>>16),c=(l&65535)+(h&65535)+(b>>>16),f=(l>>>16)+(h>>>16)+(c>>>16),P=f<<16|c&65535,Q=b<<16|d&65535,L=(P>>>28|Q<<4)^(Q>>>2|P<<30)^(Q>>>7|P<<25),M=(Q>>>28|P<<4)^(P>>>2|Q<<30)^(P>>>7|Q<<25),f=(X>>>14|Y<<18)^(X>>>18|Y<<14)^(Y>>>9|X<<23),b=(Y>>>14|X<<18)^(Y>>>18|X<<14)^(X>>>9|Y<<23),ga=P&N,ha=Q&O,aa=ga^P&G^ia,ba=ha^Q&H^ja,ca=X&R^~X&T,c=Y&S^~Y&U,h=e[g+2],k=e[g+3],l=da[g+2],m=da[g+3],d=(m&65535)+(k&65535)+(c&65535)+(b&65535)+(W&65535),b=(m>>>16)+(k>>>16)+(c>>>16)+(b>>>16)+(W>>>16)+(d>>>16),c=(l&65535)+
(h&65535)+(ca&65535)+(f&65535)+(V&65535)+(b>>>16),f=(l>>>16)+(h>>>16)+(ca>>>16)+(f>>>16)+(V>>>16)+(c>>>16),h=f<<16|c&65535,k=b<<16|d&65535,d=(ba&65535)+(M&65535),b=(ba>>>16)+(M>>>16)+(d>>>16),c=(aa&65535)+(L&65535)+(b>>>16),f=(aa>>>16)+(L>>>16)+(c>>>16),l=f<<16|c&65535,m=b<<16|d&65535,d=(J&65535)+(k&65535),b=(J>>>16)+(k>>>16)+(d>>>16),c=(I&65535)+(h&65535)+(b>>>16),f=(I>>>16)+(h>>>16)+(c>>>16),V=f<<16|c&65535,W=b<<16|d&65535,d=(m&65535)+(k&65535),b=(m>>>16)+(k>>>16)+(d>>>16),c=(l&65535)+(h&65535)+
(b>>>16),f=(l>>>16)+(h>>>16)+(c>>>16),I=f<<16|c&65535,J=b<<16|d&65535,L=(I>>>28|J<<4)^(J>>>2|I<<30)^(J>>>7|I<<25),M=(J>>>28|I<<4)^(I>>>2|J<<30)^(I>>>7|J<<25),f=(V>>>14|W<<18)^(V>>>18|W<<14)^(W>>>9|V<<23),b=(W>>>14|V<<18)^(W>>>18|V<<14)^(V>>>9|W<<23),ia=I&P,ja=J&Q,aa=ia^I&N^ga,ba=ja^J&O^ha,ca=V&X^~V&R,c=W&Y^~W&S,h=e[g+4],k=e[g+5],l=da[g+4],m=da[g+5],d=(m&65535)+(k&65535)+(c&65535)+(b&65535)+(U&65535),b=(m>>>16)+(k>>>16)+(c>>>16)+(b>>>16)+(U>>>16)+(d>>>16),c=(l&65535)+(h&65535)+(ca&65535)+(f&65535)+
(T&65535)+(b>>>16),f=(l>>>16)+(h>>>16)+(ca>>>16)+(f>>>16)+(T>>>16)+(c>>>16),h=f<<16|c&65535,k=b<<16|d&65535,d=(ba&65535)+(M&65535),b=(ba>>>16)+(M>>>16)+(d>>>16),c=(aa&65535)+(L&65535)+(b>>>16),f=(aa>>>16)+(L>>>16)+(c>>>16),l=f<<16|c&65535,m=b<<16|d&65535,d=(H&65535)+(k&65535),b=(H>>>16)+(k>>>16)+(d>>>16),c=(G&65535)+(h&65535)+(b>>>16),f=(G>>>16)+(h>>>16)+(c>>>16),T=f<<16|c&65535,U=b<<16|d&65535,d=(m&65535)+(k&65535),b=(m>>>16)+(k>>>16)+(d>>>16),c=(l&65535)+(h&65535)+(b>>>16),f=(l>>>16)+(h>>>16)+(c>>>
16),G=f<<16|c&65535,H=b<<16|d&65535,L=(G>>>28|H<<4)^(H>>>2|G<<30)^(H>>>7|G<<25),M=(H>>>28|G<<4)^(G>>>2|H<<30)^(G>>>7|H<<25),f=(T>>>14|U<<18)^(T>>>18|U<<14)^(U>>>9|T<<23),b=(U>>>14|T<<18)^(U>>>18|T<<14)^(T>>>9|U<<23),ga=G&I,ha=H&J,aa=ga^G&P^ia,ba=ha^H&Q^ja,ca=T&V^~T&X,c=U&W^~U&Y,h=e[g+6],k=e[g+7],l=da[g+6],m=da[g+7],d=(m&65535)+(k&65535)+(c&65535)+(b&65535)+(S&65535),b=(m>>>16)+(k>>>16)+(c>>>16)+(b>>>16)+(S>>>16)+(d>>>16),c=(l&65535)+(h&65535)+(ca&65535)+(f&65535)+(R&65535)+(b>>>16),f=(l>>>16)+(h>>>
16)+(ca>>>16)+(f>>>16)+(R>>>16)+(c>>>16),h=f<<16|c&65535,k=b<<16|d&65535,d=(ba&65535)+(M&65535),b=(ba>>>16)+(M>>>16)+(d>>>16),c=(aa&65535)+(L&65535)+(b>>>16),f=(aa>>>16)+(L>>>16)+(c>>>16),l=f<<16|c&65535,m=b<<16|d&65535,d=(O&65535)+(k&65535),b=(O>>>16)+(k>>>16)+(d>>>16),c=(N&65535)+(h&65535)+(b>>>16),f=(N>>>16)+(h>>>16)+(c>>>16),R=f<<16|c&65535,S=b<<16|d&65535,d=(m&65535)+(k&65535),b=(m>>>16)+(k>>>16)+(d>>>16),c=(l&65535)+(h&65535)+(b>>>16),f=(l>>>16)+(h>>>16)+(c>>>16),N=f<<16|c&65535,O=b<<16|d&65535;
d=(q&65535)+(O&65535);b=(q>>>16)+(O>>>16)+(d>>>16);c=(n&65535)+(N&65535)+(b>>>16);f=(n>>>16)+(N>>>16)+(c>>>16);n=f<<16|c&65535;q=b<<16|d&65535;d=(t&65535)+(H&65535);b=(t>>>16)+(H>>>16)+(d>>>16);c=(r&65535)+(G&65535)+(b>>>16);f=(r>>>16)+(G>>>16)+(c>>>16);r=f<<16|c&65535;t=b<<16|d&65535;d=(v&65535)+(J&65535);b=(v>>>16)+(J>>>16)+(d>>>16);c=(u&65535)+(I&65535)+(b>>>16);f=(u>>>16)+(I>>>16)+(c>>>16);u=f<<16|c&65535;v=b<<16|d&65535;d=(x&65535)+(Q&65535);b=(x>>>16)+(Q>>>16)+(d>>>16);c=(w&65535)+(P&65535)+
(b>>>16);f=(w>>>16)+(P>>>16)+(c>>>16);w=f<<16|c&65535;x=b<<16|d&65535;d=(z&65535)+(S&65535);b=(z>>>16)+(S>>>16)+(d>>>16);c=(y&65535)+(R&65535)+(b>>>16);f=(y>>>16)+(R>>>16)+(c>>>16);y=f<<16|c&65535;z=b<<16|d&65535;d=(B&65535)+(U&65535);b=(B>>>16)+(U>>>16)+(d>>>16);c=(A&65535)+(T&65535)+(b>>>16);f=(A>>>16)+(T>>>16)+(c>>>16);A=f<<16|c&65535;B=b<<16|d&65535;d=(D&65535)+(W&65535);b=(D>>>16)+(W>>>16)+(d>>>16);c=(C&65535)+(V&65535)+(b>>>16);f=(C>>>16)+(V>>>16)+(c>>>16);C=f<<16|c&65535;D=b<<16|d&65535;d=
(F&65535)+(Y&65535);b=(F>>>16)+(Y>>>16)+(d>>>16);c=(E&65535)+(X&65535)+(b>>>16);f=(E>>>16)+(X>>>16)+(c>>>16);E=f<<16|c&65535;F=b<<16|d&65535}while(!ka);n=a[n>>28&15]+a[n>>24&15]+a[n>>20&15]+a[n>>16&15]+a[n>>12&15]+a[n>>8&15]+a[n>>4&15]+a[n&15]+a[q>>28&15]+a[q>>24&15]+a[q>>20&15]+a[q>>16&15]+a[q>>12&15]+a[q>>8&15]+a[q>>4&15]+a[q&15]+a[r>>28&15]+a[r>>24&15]+a[r>>20&15]+a[r>>16&15]+a[r>>12&15]+a[r>>8&15]+a[r>>4&15]+a[r&15]+a[t>>28&15]+a[t>>24&15]+a[t>>20&15]+a[t>>16&15]+a[t>>12&15]+a[t>>8&15]+a[t>>4&
15]+a[t&15]+a[u>>28&15]+a[u>>24&15]+a[u>>20&15]+a[u>>16&15]+a[u>>12&15]+a[u>>8&15]+a[u>>4&15]+a[u&15]+a[v>>28&15]+a[v>>24&15]+a[v>>20&15]+a[v>>16&15]+a[v>>12&15]+a[v>>8&15]+a[v>>4&15]+a[v&15]+a[w>>28&15]+a[w>>24&15]+a[w>>20&15]+a[w>>16&15]+a[w>>12&15]+a[w>>8&15]+a[w>>4&15]+a[w&15];256<=K&&(n+=a[x>>28&15]+a[x>>24&15]+a[x>>20&15]+a[x>>16&15]+a[x>>12&15]+a[x>>8&15]+a[x>>4&15]+a[x&15]);384<=K&&(n+=a[y>>28&15]+a[y>>24&15]+a[y>>20&15]+a[y>>16&15]+a[y>>12&15]+a[y>>8&15]+a[y>>4&15]+a[y&15]+a[z>>28&15]+a[z>>
24&15]+a[z>>20&15]+a[z>>16&15]+a[z>>12&15]+a[z>>8&15]+a[z>>4&15]+a[z&15]+a[A>>28&15]+a[A>>24&15]+a[A>>20&15]+a[A>>16&15]+a[A>>12&15]+a[A>>8&15]+a[A>>4&15]+a[A&15]+a[B>>28&15]+a[B>>24&15]+a[B>>20&15]+a[B>>16&15]+a[B>>12&15]+a[B>>8&15]+a[B>>4&15]+a[B&15]);512==K&&(n+=a[C>>28&15]+a[C>>24&15]+a[C>>20&15]+a[C>>16&15]+a[C>>12&15]+a[C>>8&15]+a[C>>4&15]+a[C&15]+a[D>>28&15]+a[D>>24&15]+a[D>>20&15]+a[D>>16&15]+a[D>>12&15]+a[D>>8&15]+a[D>>4&15]+a[D&15]+a[E>>28&15]+a[E>>24&15]+a[E>>20&15]+a[E>>16&15]+a[E>>12&
15]+a[E>>8&15]+a[E>>4&15]+a[E&15]+a[F>>28&15]+a[F>>24&15]+a[F>>20&15]+a[F>>16&15]+a[F>>12&15]+a[F>>8&15]+a[F>>4&15]+a[F&15]);return n};!K.JS_SHA512_TEST&&ka?(Z.sha512=Z,Z.sha384=oa,Z.sha512_256=pa,Z.sha512_224=qa,module.exports=Z):K&&(K.sha512=Z,K.sha384=oa,K.sha512_256=pa,K.sha512_224=qa)})(this);
/*!
* imagesLoaded PACKAGED v3.1.8
* JavaScript is all like "You images are done yet or what?"
* MIT License
*/
(function(){function e(){}function t(e,t){for(var n=e.length;n--;)if(e[n].listener===t)return n;return-1}function n(e){return function(){return this[e].apply(this,arguments)}}var i=e.prototype,r=this,o=r.EventEmitter;i.getListeners=function(e){var t,n,i=this._getEvents();if("object"==typeof e){t={};for(n in i)i.hasOwnProperty(n)&&e.test(n)&&(t[n]=i[n])}else t=i[e]||(i[e]=[]);return t},i.flattenListeners=function(e){var t,n=[];for(t=0;e.length>t;t+=1)n.push(e[t].listener);return n},i.getListenersAsObject=function(e){var t,n=this.getListeners(e);return n instanceof Array&&(t={},t[e]=n),t||n},i.addListener=function(e,n){var i,r=this.getListenersAsObject(e),o="object"==typeof n;for(i in r)r.hasOwnProperty(i)&&-1===t(r[i],n)&&r[i].push(o?n:{listener:n,once:!1});return this},i.on=n("addListener"),i.addOnceListener=function(e,t){return this.addListener(e,{listener:t,once:!0})},i.once=n("addOnceListener"),i.defineEvent=function(e){return this.getListeners(e),this},i.defineEvents=function(e){for(var t=0;e.length>t;t+=1)this.defineEvent(e[t]);return this},i.removeListener=function(e,n){var i,r,o=this.getListenersAsObject(e);for(r in o)o.hasOwnProperty(r)&&(i=t(o[r],n),-1!==i&&o[r].splice(i,1));return this},i.off=n("removeListener"),i.addListeners=function(e,t){return this.manipulateListeners(!1,e,t)},i.removeListeners=function(e,t){return this.manipulateListeners(!0,e,t)},i.manipulateListeners=function(e,t,n){var i,r,o=e?this.removeListener:this.addListener,s=e?this.removeListeners:this.addListeners;if("object"!=typeof t||t instanceof RegExp)for(i=n.length;i--;)o.call(this,t,n[i]);else for(i in t)t.hasOwnProperty(i)&&(r=t[i])&&("function"==typeof r?o.call(this,i,r):s.call(this,i,r));return this},i.removeEvent=function(e){var t,n=typeof e,i=this._getEvents();if("string"===n)delete i[e];else if("object"===n)for(t in i)i.hasOwnProperty(t)&&e.test(t)&&delete i[t];else delete this._events;return this},i.removeAllListeners=n("removeEvent"),i.emitEvent=function(e,t){var n,i,r,o,s=this.getListenersAsObject(e);for(r in s)if(s.hasOwnProperty(r))for(i=s[r].length;i--;)n=s[r][i],n.once===!0&&this.removeListener(e,n.listener),o=n.listener.apply(this,t||[]),o===this._getOnceReturnValue()&&this.removeListener(e,n.listener);return this},i.trigger=n("emitEvent"),i.emit=function(e){var t=Array.prototype.slice.call(arguments,1);return this.emitEvent(e,t)},i.setOnceReturnValue=function(e){return this._onceReturnValue=e,this},i._getOnceReturnValue=function(){return this.hasOwnProperty("_onceReturnValue")?this._onceReturnValue:!0},i._getEvents=function(){return this._events||(this._events={})},e.noConflict=function(){return r.EventEmitter=o,e},"function"==typeof define&&define.amd?define("eventEmitter/EventEmitter",[],function(){return e}):"object"==typeof module&&module.exports?module.exports=e:this.EventEmitter=e}).call(this),function(e){function t(t){var n=e.event;return n.target=n.target||n.srcElement||t,n}var n=document.documentElement,i=function(){};n.addEventListener?i=function(e,t,n){e.addEventListener(t,n,!1)}:n.attachEvent&&(i=function(e,n,i){e[n+i]=i.handleEvent?function(){var n=t(e);i.handleEvent.call(i,n)}:function(){var n=t(e);i.call(e,n)},e.attachEvent("on"+n,e[n+i])});var r=function(){};n.removeEventListener?r=function(e,t,n){e.removeEventListener(t,n,!1)}:n.detachEvent&&(r=function(e,t,n){e.detachEvent("on"+t,e[t+n]);try{delete e[t+n]}catch(i){e[t+n]=void 0}});var o={bind:i,unbind:r};"function"==typeof define&&define.amd?define("eventie/eventie",o):e.eventie=o}(this),function(e,t){"function"==typeof define&&define.amd?define(["eventEmitter/EventEmitter","eventie/eventie"],function(n,i){return t(e,n,i)}):"object"==typeof exports?module.exports=t(e,require("wolfy87-eventemitter"),require("eventie")):e.imagesLoaded=t(e,e.EventEmitter,e.eventie)}(window,function(e,t,n){function i(e,t){for(var n in t)e[n]=t[n];return e}function r(e){return"[object Array]"===d.call(e)}function o(e){var t=[];if(r(e))t=e;else if("number"==typeof e.length)for(var n=0,i=e.length;i>n;n++)t.push(e[n]);else t.push(e);return t}function s(e,t,n){if(!(this instanceof s))return new s(e,t);"string"==typeof e&&(e=document.querySelectorAll(e)),this.elements=o(e),this.options=i({},this.options),"function"==typeof t?n=t:i(this.options,t),n&&this.on("always",n),this.getImages(),a&&(this.jqDeferred=new a.Deferred);var r=this;setTimeout(function(){r.check()})}function f(e){this.img=e}function c(e){this.src=e,v[e]=this}var a=e.jQuery,u=e.console,h=u!==void 0,d=Object.prototype.toString;s.prototype=new t,s.prototype.options={},s.prototype.getImages=function(){this.images=[];for(var e=0,t=this.elements.length;t>e;e++){var n=this.elements[e];"IMG"===n.nodeName&&this.addImage(n);var i=n.nodeType;if(i&&(1===i||9===i||11===i))for(var r=n.querySelectorAll("img"),o=0,s=r.length;s>o;o++){var f=r[o];this.addImage(f)}}},s.prototype.addImage=function(e){var t=new f(e);this.images.push(t)},s.prototype.check=function(){function e(e,r){return t.options.debug&&h&&u.log("confirm",e,r),t.progress(e),n++,n===i&&t.complete(),!0}var t=this,n=0,i=this.images.length;if(this.hasAnyBroken=!1,!i)return this.complete(),void 0;for(var r=0;i>r;r++){var o=this.images[r];o.on("confirm",e),o.check()}},s.prototype.progress=function(e){this.hasAnyBroken=this.hasAnyBroken||!e.isLoaded;var t=this;setTimeout(function(){t.emit("progress",t,e),t.jqDeferred&&t.jqDeferred.notify&&t.jqDeferred.notify(t,e)})},s.prototype.complete=function(){var e=this.hasAnyBroken?"fail":"done";this.isComplete=!0;var t=this;setTimeout(function(){if(t.emit(e,t),t.emit("always",t),t.jqDeferred){var n=t.hasAnyBroken?"reject":"resolve";t.jqDeferred[n](t)}})},a&&(a.fn.imagesLoaded=function(e,t){var n=new s(this,e,t);return n.jqDeferred.promise(a(this))}),f.prototype=new t,f.prototype.check=function(){var e=v[this.img.src]||new c(this.img.src);if(e.isConfirmed)return this.confirm(e.isLoaded,"cached was confirmed"),void 0;if(this.img.complete&&void 0!==this.img.naturalWidth)return this.confirm(0!==this.img.naturalWidth,"naturalWidth"),void 0;var t=this;e.on("confirm",function(e,n){return t.confirm(e.isLoaded,n),!0}),e.check()},f.prototype.confirm=function(e,t){this.isLoaded=e,this.emit("confirm",this,t)};var v={};return c.prototype=new t,c.prototype.check=function(){if(!this.isChecked){var e=new Image;n.bind(e,"load",this),n.bind(e,"error",this),e.src=this.src,this.isChecked=!0}},c.prototype.handleEvent=function(e){var t="on"+e.type;this[t]&&this[t](e)},c.prototype.onload=function(e){this.confirm(!0,"onload"),this.unbindProxyEvents(e)},c.prototype.onerror=function(e){this.confirm(!1,"onerror"),this.unbindProxyEvents(e)},c.prototype.confirm=function(e,t){this.isConfirmed=!0,this.isLoaded=e,this.emit("confirm",this,t)},c.prototype.unbindProxyEvents=function(e){n.unbind(e.target,"load",this),n.unbind(e.target,"error",this)},s});