Файловый менеджер - Редактировать - /home/digitalm/www/zetaworks/wp-content/themes/uncode/library/js/lib/share.min.js
Назад
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.Share=e()}}(function(){function getStyles(config){}var define,module,exports,ShareUtils;!("classList"in document.documentElement)&&Object.defineProperty&&typeof HTMLElement!="undefined"&&Object.defineProperty(HTMLElement.prototype,"classList",{get:function(){var ret,self,update;return update=function(fn){return function(value){var classes,index;classes=self.className.split(/\s+/),index=classes.indexOf(value),fn(classes,index,value),self.className=classes.join(" ")}},self=this,ret={add:update(function(classes,index,value){~index||classes.push(value)}),remove:update(function(classes,index){~index&&classes.splice(index,1)}),toggle:update(function(classes,index,value){~index?classes.splice(index,1):classes.push(value)}),contains:function(value){return!!~self.className.split(/\s+/).indexOf(value)},item:function(i){return self.className.split(/\s+/)[i]||null}},Object.defineProperty(ret,"length",{get:function(){return self.className.split(/\s+/).length}}),ret}}),String.prototype.to_rfc3986=function(){var tmp;return tmp=encodeURIComponent(this),tmp.replace(/[!'()*]/g,function(c){return"%"+c.charCodeAt(0).toString(16)})},ShareUtils=function(){function ShareUtils(){}return ShareUtils.prototype.extend=function(to,from,overwrite){var hasProp,prop;for(prop in from){hasProp=to[prop]!==undefined;if(hasProp&&typeof from[prop]=="object")this.extend(to[prop],from[prop],overwrite);else if(overwrite||!hasProp)to[prop]=from[prop]}},ShareUtils.prototype.hide=function(el){return el.style.display="none"},ShareUtils.prototype.show=function(el){return el.style.display="block"},ShareUtils.prototype.has_class=function(el,class_name){return el.classList.contains(class_name)},ShareUtils.prototype.add_class=function(el,class_name){return el.classList.add(class_name)},ShareUtils.prototype.remove_class=function(el,class_name){return el.classList.remove(class_name)},ShareUtils.prototype.is_encoded=function(str){return str=str.to_rfc3986(),decodeURIComponent(str)!==str},ShareUtils.prototype.encode=function(str){return typeof str=="undefined"||this.is_encoded(str)?str:str.to_rfc3986()},ShareUtils.prototype.popup=function(url,params){var k,popup,qs,v;return params==null&&(params={}),popup={width:500,height:350},popup.top=screen.height/2-popup.height/2,popup.left=screen.width/2-popup.width/2,qs=function(){var _results;_results=[];for(k in params)v=params[k],_results.push(""+k+"="+this.encode(v));return _results}.call(this).join("&"),qs&&(qs="?"+qs),window.open(url+qs,"targetWindow","toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,left="+popup.left+",top="+popup.top+",width="+popup.width+",height="+popup.height)},ShareUtils}();var Share,__hasProp={}.hasOwnProperty,__extends=function(child,parent){function ctor(){this.constructor=child}for(var key in parent)__hasProp.call(parent,key)&&(child[key]=parent[key]);return ctor.prototype=parent.prototype,child.prototype=new ctor,child.__super__=parent.prototype,child};return Share=function(_super){function Share(element,options){return this.element=element,this.el={head:document.getElementsByTagName("head")[0],body:document.getElementsByTagName("body")[0]},this.config={enabled_networks:0,protocol:["http","https"].indexOf(window.location.href.split(":")[0])===-1?"https://":"//",url:window.location.href.replace("&","%26"),caption:null,title:this.default_title(),image:this.default_image(),description:this.default_description(),ui:{flyout:"top center",button_text:"Share",button_font:!0,icon_font:!0},networks:{twitter:{enabled:!0,url:null,title:null,description:null},facebook:{enabled:!0,load_sdk:!0,url:null,app_id:null,title:null,caption:null,description:null,image:null},pinterest:{enabled:!0,url:null,image:null,description:null},reddit:{enabled:!0,url:null,title:null},linkedin:{enabled:!0,url:null,title:null,description:null},xing:{enabled:!0,url:null,title:null,image:null,description:null},whatsapp:{enabled:!0,description:null,url:null},email:{enabled:!0,title:null,description:null,url:null}}},this.setup(element,options),this}return __extends(Share,_super),Share.prototype.setup=function(element,opts){var index,instance,instances,_i,_len;instances=document.querySelectorAll(element),this.extend(this.config,opts,!0),this.set_global_configuration(),this.normalize_network_configuration(),this.config.ui.icon_font&&this.inject_icons(),this.config.ui.button_font&&this.inject_fonts(),this.config.networks.facebook.enabled&&this.config.networks.facebook.load_sdk&&this.inject_facebook_sdk();for(index=_i=0,_len=instances.length;_i<_len;index=++_i)instance=instances[index],this.setup_instance(element,index)},Share.prototype.setup_instance=function(element,index){var button,instance,label,network,networks,_i,_len,_results,_this=this;instance=document.querySelectorAll(element)[index],this.hide(instance),this.add_class(instance,"sharer-"+index),instance=document.querySelectorAll(element)[index],this.inject_css(instance),this.inject_html(instance),this.show(instance),label=instance.getElementsByTagName("label")[0],button=instance.getElementsByClassName("social")[0],networks=instance.getElementsByTagName("li"),this.add_class(button,"networks-"+this.config.enabled_networks),label.addEventListener("click",function(){return _this.event_toggle(button)}),_this=this,_results=[];for(index=_i=0,_len=networks.length;_i<_len;index=++_i)network=networks[index],_results.push(network.addEventListener("click",function(){return _this.event_network(instance,this),_this.event_close(button)}));return _results},Share.prototype.event_toggle=function(button){return this.has_class(button,"active")?this.event_close(button):this.event_open(button)},Share.prototype.event_open=function(button){return this.has_class(button,"load")&&this.remove_class(button,"load"),this.add_class(button,"active")},Share.prototype.event_close=function(button){return this.remove_class(button,"active")},Share.prototype.event_network=function(instance,network){var name;return name=network.getAttribute("data-network"),this.hook("before",name,instance),this["network_"+name](),this.hook("after",name,instance)},Share.prototype.open=function(){return this["public"]("open")},Share.prototype.close=function(){return this["public"]("close")},Share.prototype.toggle=function(){return this["public"]("toggle")},Share.prototype["public"]=function(action){var button,index,instance,_i,_len,_ref,_results;_ref=document.querySelectorAll(this.element),_results=[];for(index=_i=0,_len=_ref.length;_i<_len;index=++_i)instance=_ref[index],button=instance.getElementsByClassName("social")[0],_results.push(this["event_"+action](button));return _results},Share.prototype.network_facebook=function(){return this.config.networks.facebook.load_sdk?window.FB?FB.ui({method:"feed",name:this.config.networks.facebook.title,link:this.config.networks.facebook.url,picture:this.config.networks.facebook.image,caption:this.config.networks.facebook.caption,description:this.config.networks.facebook.description}):console.error("The Facebook JS SDK hasn't loaded yet."):this.popup("https://www.facebook.com/sharer/sharer.php",{u:this.config.networks.facebook.url})},Share.prototype.network_twitter=function(){return this.popup("https://twitter.com/intent/tweet",{text:this.config.networks.twitter.title,url:this.config.networks.twitter.url})},Share.prototype.network_pinterest=function(){return this.popup("https://www.pinterest.com/pin/create/button",{url:this.config.networks.pinterest.url,media:this.config.networks.pinterest.image,description:this.config.networks.pinterest.description})},Share.prototype.network_linkedin=function(){return this.popup("https://www.linkedin.com/shareArticle",{url:this.config.networks.linkedin.url,title:this.config.networks.linkedin.title,summary:this.config.networks.linkedin.description})},Share.prototype.network_xing=function(){return this.popup("https://www.xing.com/spi/shares/new",{url:this.config.networks.xing.url,image:this.config.networks.xing.image,title:this.config.networks.xing.title,summary:this.config.networks.xing.description})},Share.prototype.network_email=function(){return this.popup("mailto:",{subject:this.config.networks.email.title,body:this.config.networks.email.url+"%0A%0A"+this.config.networks.email.description})},Share.prototype.inject_icons=function(){},Share.prototype.inject_fonts=function(){},Share.prototype.inject_stylesheet=function(url){var link;if(!this.el.head.querySelector('link[href="'+url+'"]'))return link=document.createElement("link"),link.setAttribute("rel","stylesheet"),link.setAttribute("href",url),this.el.head.appendChild(link)},Share.prototype.inject_css=function(instance){var css,meta,selector,style;selector="."+instance.getAttribute("class").split(" ").join(".");if(!this.el.head.querySelector("meta[name='sharer"+selector+"']"))return this.config.selector=selector,css=getStyles(this.config),style=document.createElement("style"),style.type="text/css",style.styleSheet?style.styleSheet.cssText=css:style.appendChild(document.createTextNode(css)),this.el.head.appendChild(style),delete this.config.selector,meta=document.createElement("meta"),meta.setAttribute("name","sharer"+selector),this.el.head.appendChild(meta)},Share.prototype.inject_html=function(instance){return instance.innerHTML="<label class='social-export'><span>"+this.config.ui.button_text+"</span></label><div class='social load "+this.config.ui.flyout+"'><ul><li class='social-facebook' data-network='facebook' tabindex='0'></li><li class='social-twitter' data-network='twitter' tabindex='0'></li><li class='social-pinterest' data-network='pinterest' tabindex='0'></li><li class='social-linkedin' data-network='linkedin' tabindex='0'></li><li class='social-xing' data-network='xing' tabindex='0'></li><li class='social-paper-plane' data-network='email' tabindex='0'></li></ul></div>"},Share.prototype.inject_facebook_sdk=function(){var fb_root,script;if(!window.FB&&this.config.networks.facebook.app_id&&!this.el.body.querySelector("#fb-root"))return script=document.createElement("script"),script.text="window.fbAsyncInit=function(){FB.init({appId:'"+this.config.networks.facebook.app_id+"',status:true,xfbml:true})};(function(e,t,n){var r,i=e.getElementsByTagName(t)[0];if(e.getElementById(n)){return}r=e.createElement(t);r.id=n;r.src='"+this.config.protocol+"connect.facebook.net/en_US/all.js';i.parentNode.insertBefore(r,i)})(document,'script','facebook-jssdk')",fb_root=document.createElement("div"),fb_root.id="fb-root",this.el.body.appendChild(fb_root),this.el.body.appendChild(script)},Share.prototype.hook=function(type,network,instance){var fn,opts;fn=this.config.networks[network][type],typeof fn=="function"&&(opts=fn.call(this.config.networks[network],instance),opts!==void 0&&(opts=this.normalize_filter_config_updates(opts),this.extend(this.config.networks[network],opts,!0),this.normalize_network_configuration()))},Share.prototype.default_title=function(){var content;if(content=document.querySelector('meta[property="og:title"]')||document.querySelector('meta[name="twitter:title"]'))return encodeURIComponent(content.getAttribute("content"));if(content=document.querySelector("title"))return encodeURIComponent(content.innerText)},Share.prototype.default_image=function(){var content;if(content=document.querySelector('meta[property="og:image"]')||document.querySelector('meta[name="twitter:image"]'))return content.getAttribute("content")},Share.prototype.default_description=function(){var content;return(content=document.querySelector('meta[property="og:description"]')||document.querySelector('meta[name="twitter:description"]')||document.querySelector('meta[name="description"]'))?encodeURIComponent(content.getAttribute("content")):""},Share.prototype.set_global_configuration=function(){var display,network,option,options,_ref,_results;_ref=this.config.networks,_results=[];for(network in _ref){options=_ref[network];for(option in options)this.config.networks[network][option]==null&&(this.config.networks[network][option]=this.config[option]);this.config.networks[network].enabled?(display="block",this.config.enabled_networks+=1):display="none",_results.push(this.config.networks[network].display=display)}return _results},Share.prototype.normalize_network_configuration=function(){this.config.networks.facebook.app_id||(this.config.networks.facebook.load_sdk=!1),this.is_encoded(this.config.networks.twitter.description)||(this.config.networks.twitter.description=encodeURIComponent(this.config.networks.twitter.description));if(typeof this.config.networks.facebook.app_id=="number")return this.config.networks.facebook.app_id=this.config.networks.facebook.app_id.toString()},Share.prototype.normalize_filter_config_updates=function(opts){return this.config.networks.facebook.app_id!==opts.app_id&&(console.warn("You are unable to change the Facebook app_id after the button has been initialized. Please-in-out update your Facebook filters accordingly."),delete opts.app_id),this.config.networks.facebook.load_sdk!==opts.load_sdk&&(console.warn("You are unable to change the Facebook load_sdk option after the button has been initialized. Please-in-out update your Facebook filters accordingly."),delete opts.app_id),opts},Share}(ShareUtils),Share})
| ver. 1.4 |
Github
|
.
| PHP 8.3.23 | Генерация страницы: 0.05 |
proxy
|
phpinfo
|
Настройка