core/skin/shkola5nt.ru/js/pluso-like.js

153 lines
43 KiB
JavaScript
Raw Normal View History

2023-02-08 16:59:59 +05:00
(function(w,d){
var prot=/^((https|chrome-extension):)/i.test(w.location.protocol)?"https":"http",u=prot+"://share.pluso.ru",uid="7831379660540294578",tags="getElementsByTagName",h=d[tags]("body")[0],b=d.documentElement,db=d.body,compat=0;
function js(url,id,callback){
if(typeof id=="function"){
callback=id;id=null
}
if(id&&d.getElementById(id))return;
if(url.charAt(0)=="+")url=u+"/"+url.substring(1);
s=d.createElement("script");
s.type="text/javascript";
s.charset="UTF-8";
s.async=true;
if(typeof id=="string")s.id=id;
s.src=url;
if(typeof callback=="function"){
var called=false;
s.onreadystatechange=function(){
if(this.readyState=="complete"&&!called){
called=true;
callback()
}
};
s.onload=function(){
if(!called){
called=true;
callback()
}
}
}
h.appendChild(s)
}
function styled(rules){
var s=d.createElement("style");
s.setAttribute("type","text/css");
h.appendChild(s);
if(s.styleSheet){
s.styleSheet.cssText=rules
}else{
s.appendChild(d.createTextNode(rules))
}
}
function pointed(event){
return{
pageX:typeof event.pageX!="undefined"?event.pageX:event.clientX+d.body.scrollLeft+b.scrollLeft,pageY:typeof event.pageY!="undefined"?event.pageY:event.clientY+d.body.scrollTop+b.scrollTop
}
}
function dimensions(){
return{
width:w.innerWidth||b.clientWidth||db&&db.clientWidth,height:Math.max(db&&db.scrollHeight,db&&db.offsetHeight,b.clientHeight,b.scrollHeight,b.offsetHeight)
}
}
function numk(num,mini){
var d=typeof mini!="undefined"?0:1;if(num>=1e9){return(num/1e9).toFixed(d).replace(/\.0$/,"")+"G"
}
if(num>=1e6){
return(num/1e6).toFixed(d).replace(/\.0$/,"")+"M"}if(num>=1e3){
return(num/1e3).toFixed(d).replace(/\.0$/,"")+"K"
}
return num
}
function osize(opt){
return opt.small==1?"small":opt.medium==1?"medium":"big"
}
function getImg(url){
var img;try {img = new Image();
} catch (ignore) {
img = document.createElement("img");
}
img.src = url;
}function rnd(min,max){
if(!max){
max=min;min=0
}
return Math.floor(Math.random()*(max-min+1))+min
}
if(!Array.indexOf){
Array.prototype.indexOf=function(obj){
for(var i=0,l=this.length;i<l;i++){
if(this[i]==obj){return i}
}return-1}}
if(!Array.prototype.map){
Array.prototype.map=function(f){var result=[];
for(var i=0,l=this.length;i<l;i++){
result.push(f(this[i]))
}
return result}
}
var iterate=function(obj,callback){
for(var key in obj)
if(obj.hasOwnProperty(key))callback(key,obj)};
var elements=d.querySelectorAll?function(className,context){
return(context||d).querySelectorAll("."+className)}:function(className,context){
if(!className)return[];
var e=(context||d)[tags]("*");
var list=[];
for(var i=0,length=e.length;i<length;i++){
var clss=e[i].className.split(" ");
if(clss.indexOf(className)>-1)list.push(e[i])}return list};
var encode=encodeURIComponent;
var cloned=function(obj){
if(typeof obj.length!="undefined")return obj.slice(0);var clone={};
for(var i in obj){if(typeof obj[i]=="object")clone[i]=cloned(obj[i]);
else clone[i]=obj[i]}return clone};
var arrayed=function(obj){
return Object.prototype.toString.call(obj)==="[object Array]"};
var lang=function(elem,service,title){
var language=elem.pluso.params.lang;if(title){
return pluso.lang[language]&&pluso.lang[language].titles&&pluso.lang[language].titles[service]||title}else return pluso.lang[language]&&pluso.lang[language][service]||pluso.lang["ru"]&&pluso.lang["ru"][service]||service};
var ready=function(w,d){
var inited=false,loaded=false,queue=[],done,old;
function go(){
if(!inited){
if(!d.body)return setTimeout(go,13);
inited=true;if(queue){var j,k=0;
while(j=queue[k++])j.call(null);
queue=null}}}
function check(){
if(loaded)return;
loaded=true;
if(d.readyState==="complete")return go();
if(d.addEventListener){
d.addEventListener("DOMContentLoaded",done,false);
w.addEventListener("load",go,false)}else{
if(d.attachEvent){
d.attachEvent("onreadystatechange",done);
w.attachEvent("onload",go);
var k=false;
try{k=w.frameElement==null}catch(j){}
if(b.doScroll&&k)ie()}else{
old=w.onload;w.onload=function(e){old(e);go()}}}}
if(d.addEventListener){done=function(){d.removeEventListener("DOMContentLoaded",done,false);
go()}}else{
if(d.attachEvent){done=function(){
if(d.readyState==="complete"){
d.detachEvent("onreadystatechange",done);
go()}}}}function ie(){
if(inited)return;
try{b.doScroll("left")}catch(j){setTimeout(ie,1);
return}go()}return function(callback){check();
if(inited){callback.call(null)}else{queue.push(callback)}}}(w,d);
if(w.pluso&&typeof w.pluso.start=="function")return;
if(!w.pluso)w.pluso={};
pluso.cnt=0;
pluso.uid=uid;
if(!w.pluso.lang)w.pluso.lang={};
pluso.lang["ru"]={
close:"Закрыть",get:"Кнопки увеличивают трафик",share:"Поделитесь с друзьями!",bookmark:"Скопируйте и добавьте эту ссылку в Закладки",buy:"Купить"};
pluso.lang["ua"]={close:"Закрити",get:"Отримаєте свої кнопки",share:"Поділитеся з друзями!",bookmark:"Скопіюйте та додайте цю посилання в Закладки",buy:"Купити"};
pluso.lang["by"]={close:"Зачыніць",get:"Атрымаеце свае кнопкі",share:"Падзяліцеся з сябрамі!",bookmark:"Скапіюйце і дадайце гэтую спасылку ў Закладкі",buy:"Купіць"};
pluso.lang["en"]={close:"Close",get:"Get Your Buttons",share:"Share With Friends!",bookmark:"Copy the link and paste to your Bookmarks",buy:"Buy",titles:{vkontakte:"VKontakte",odnoklassniki:"Odnoklassniki",moimir:"MoiMir@Mail.Ru",bobrdobr:"BobrDobr",vkrugu:"VKruguDruzei",yandex:"ya.ru",yazakladki:"Yandex.Bookmarks",moikrug:"MoiKrug",googlebookmark:"Google Bookmarks",yahoo:"Yahoo Bookmarks",moemesto:"MoeMesto",bookmark:"Add to Favorite",email:"Send by E-mail",print:"Print"}};
pluso.css=[[["",".pluso"],"position:relative;z-index:1;display:inline-block;padding:0;-webkit-border-radius:22px;-moz-border-radius:22px;border-radius:22px;background:transparent;text-align:left;font-size:0;line-height:0;*display:inline;*zoom:1;"],[["",".pluso span"],"float:none;"],[["0","a:active"]," opacity:.6; "],[[32,".pluso-wrap a"],"display:inline-block;vertical-align:inherit;margin:5px 0 0 5px;padding:0;width:40px;height:40px;background:url({i}/img/pluso-like/round/big/04.png) 0 0 transparent no-repeat;"],[[64,".pluso-wrap a"],"display:inline-block;vertical-align:inherit;margin:3px 0 0 3px;padding:0;width:20px;height:20px;background:url({i}/img/pluso-like/round/small/04.png) 0 0 transparent no-repeat;"],[[16,".pluso-wrap a"],"display:inline-block;vertical-align:inherit;margin:3px 0 0 3px;padding:0;width:30px;height:30px;background:url({i}/img/pluso-like/round/medium/04.png) 0 0 transparent no-repeat;"],[["",".pluso-wrap"],"margin:0px !important;"],[["0",".pluso-wrap"],"position:relative;z-index:1;display:inline-block;padding:0 5px 5px 0;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;background:{bb};text-align:left;font-size:0;line-height:0;*display:inline;*zoom:1;"],[[64,".pluso-wrap"],"padding:0 3px 3px 0px;"],[[66,".pluso-wrap"],"-webkit-border-radius:12px;-moz-border-radius:12px;border-radius:12px;"],[[16,".pluso-wrap"],"padding:0 3px 3px 0px;"],[[18,".pluso-wrap"],"-webkit-border-radius:12px;-moz-border-radius:12px;border-radius:12px;"],[[34,".pluso-wrap"],"-webkit-border-radius:22px;-moz-border-radius:22px;border-radius:22px;"],[[544,""],"width:50px;"],[[800,""],"width:95px;"],[[576,""],"width:26px;"],[[528,""],"width:36px;"],[[832,""],"width:49px;"],[[784,""],"width:69px;"],[[32,"a.pluso-more"],"width:40px;height:40px;background:url({i}/img/plus.png) 0 -60px no-repeat!important;position:relative;"],[[64,"a.pluso-more"],"width:20px;height:20px;background:url({i}/img/plus.png) 0 0 no-repeat!important;position:relative;"],[[16,"a.pluso-more"],"width:30px;height:30px;background:url({i}/img/plus.png) 0 -25px no-repeat!important;position:relative;"],[[1280,".pluso-wrap a"],"float:left;text-align:middle;"],[[2048,".pluso-wrap > div"],"cursor:default;display:inline-block;text-decoration:none !important;color:white;"],[[2048,".pluso-wrap a"],"margin:0px;"],[[2048,".pluso-wrap div b"],"float:right;font-weight:normal;color:white;"],[[2080,".pluso-wrap > div"],"border-radius:6px;margin-right:4px;"],[[2080,".pluso-wrap a"],"width:40px;"],[[2080,".pluso-wrap div b"],"padding-left:5px;padding-right:10px;font-size:16px;line-height:40px;"],[[2064,".pluso-wrap >div"],"border-radius:4px;margin-right:3px;height:30px;"],[[2064,".pluso-wrap a"],"margin:2px;"],[[2064,".pluso-wrap div b"],"padding-right:3px;font-size:12px;line-height:30px;"],[[2112,".pluso-wrap >div"],"border-radius:3px;margin-right:3px;height:20px;"],[[2112,".pluso-wrap a"],"margin:1px;"],[[2112,".pluso-wrap div b"],"padding-right:3px;font-size:11px;line-height:20px;"],[[576,"a.pluso-more"],"margin-bottom:-12px;*left:5px;"],[[832,"a.pluso-more"],"margin-left:13px;*left:13px;"],[[832,".pluso-wrap a:nth-child(even).pluso-more"],"margin-left:3px;margin-bottom:0px"],[[1216,"a.pluso-more"],"margin-right:-12px;*left:5px;"],[[1344,"a.pluso-more"],"margin-right:-12px;top:-12px;*left:auto;"],[[528,"a.pluso-more"],"margin-bottom:-12px;*left:5px;"],[[784,"a.pluso-more"],"margin-left:18px;*left:18px;"],[[784,".pluso-wrap a:nth-child(even).pluso-more"],"margin-left:3px;margin-bottom:0px;"],[[1280,".pluso-wrap a:nth-child(even).pluso-more"],"top: 0px;"],[[1168,"a.pluso-more"],"margin-right:-12px;*left:5px;"],[[1296,"a.pluso-more"],"margin-right:-18px;top:-17px;*left:auto;"],[[1296,".pluso-wrap a:nth-child(even).pluso-more"],"top:inherit;"],[[544,"a.pluso-more"],"margin-bottom:-22px;*left:5px;"],[[800,"a.pluso-more"],"margin-left:27px;*left:27px;"],[[800,".pluso-wrap a:nth-child(even).pluso-more"],"margin-left:5px;margin-bottom:0px;"],[[1056,"a.pluso-more"],"margin-right:-22px;*left:5px;"],[[1312,"a.pluso-more"],"top:-22px;*left:auto;"],[[
};pluso.share_pinme=function(){js("http://b-install.ru/templates/b-install/js/pluso/pinbutton.js?r="+Math.random()*99999999)};pluso.share_readability=function(){js("http://www.readability.com/bookmarklet/save.js?r="+Math.random()*99999999)};pluso.share_print=function(){window.print()};pluso.share_bookmark=function(ep){if(typeof window.sidebar=="object"&&typeof window.sidebar.addPanel=="function"){window.sidebar.addPanel(ep.params.title,ep.params.url,"")}else if(typeof window.external=="object"&&!window.chrome){window.external.AddFavorite(ep.params.url,ep.params.title)}else prompt("Скопируйте и добавьте эту ссылку в Закладки",ep.params.url)};pluso.share_email=function(ep){var link="mailto:?Subject="+ep.params.title+"&body="+encodeURIComponent(ep.params.url)+"%0A";window.open(link,"mailto")};pluso.params=function(elem){return"u="+encode(elem.pluso.params.url)+(pluso.screenWidth&&pluso.screenHeight?"&w="+pluso.screenWidth+"&h="+pluso.screenHeight:"")+"&ref="+encode(d.referrer)+(elem.pluso.params.user>0?"&user="+encode(elem.pluso.params.user):"")+"&uid="+uid+"&k="+pluso.randomString(16)};pluso.share=function(t,elem,menu){var sharer=t.className.substring(6),share=pluso["share_"+sharer],sharelink=pluso.sharelink(sharer,elem,menu);pluso.counter[elem.pluso.params.url]+=1;elem.counter.title=pluso.counter[elem.pluso.params.url];elem.counter.innerHTML=numk(pluso.counter[elem.pluso.params.url]);if(elem.pluso.options.sepcounter=="1"){var serviceClass=t.className;if(!pluso.sepcounters[sharer])pluso.sepcounters[sharer]=0;pluso.sepcounters[sharer]=parseInt(pluso.sepcounters[sharer])+1;var serviceCounter=t.parentNode.getElementsByTagName("b")[0];serviceCounter.title=pluso.sepcounters[sharer];serviceCounter.innerHTML=numk(pluso.sepcounters[sharer])}if(typeof share=="function"){js(sharelink);if(window.opera&&sharer=="bookmark"){t.href=elem.pluso.params.url;return true}else{share(elem.pluso)}}else{if(!window.open(sharelink,sharer,pluso.tabbed.indexOf(sharer)==-1?"toolbar=0,status=0,resizable=1,width=626,height=436":"")){w.location.href=sharelink}}return false};pluso.more=function(xy,elem){if(elem.box){var div=elem.box}else{var div=d.createElement("div"),html=[];div.className="pluso-box";html.push('<a href="'+u+'/?new_a" target="_blank" class="pluso-logo">+PLUSO</a>');html.push('<a href="'+u+'/?new_a" target="_blank" class="pluso-go">'+lang(elem,"get")+"</a>");html.push('<a href="#close" title="'+lang(elem,"close")+'" class="pluso-close">&times;</a>');html.push('<div class="pluso-list">');for(var i=0,l=pluso.titles.length;i<l;i++){p=pluso.titles[i];pt=lang(elem,p[0],p[1]);html.push('<a href="'+elem.pluso.params.url.replace(/"/g,"&quot;")+'" title="'+pt+'" class="pluso-'+p[0]+'"'+(p[0]=="bookmark"?' rel="sidebar"':"")+"><b></b>"+pt+"</a>")}var bn=Math.random()>.5?"1":"2";html.push('<a class="pluso-promo" style="display:block;width:100%;height:200px;margin:0;padding:0;background:url('+u+"/img/pluso-like/promo_"+bn+'.png) center center no-repeat" href="http://watson.pluso.com/?new'+(bn==1?"chromeaddon":"music")+'" target="_blank"></a>');html.push("</div>");div.innerHTML=html.join("");div.onmouseover=function(ev){if(div.timer)clearTimeout(div.timer)};div.onmouseout=function(ev){var ev=ev||w.event,e=ev.toElement||ev.relatedTarget,t=ev.target||ev.srcElement;if(e&&e.tagName&&e.tagName.toUpperCase()=="B")e=e.parentNode;if(!e||e==div||e.parentNode==div||e.parentNode.parentNode==div){return false}div.timer=setTimeout(function(){div.style.display="none"},777)};div.onclick=pluso.click(elem,1)}if(elem.box&&elem.box.style.display=="block")return;var z=pluso.offsets[osize(elem.pluso.options)]/2,x=xy.pageX-z,y=xy.pageY-z,ws=dimensions();if(x<0)x=10;else if(x+310>ws.width)x=ws.width-350;if(y<0)y=5;else if(y+265>ws.height)y=ws.height-265;div.style.left=x+"px";div.style.top=y+"px";if(elem.box){elem.box.style.display="block"}else{elem.box=div;d[tags]("body")[0].appendChild(div)}pluso.process("menu",elem)};pluso.sharelink=function(sharer,elem,menu){var k=d.getSelection,y=w.getSelection,x=d.selection;var s=y?y():k?k():x?x.cre