1// Init LikeBtn 2(function(d, e, s) { 3 /// Load script if it has not been loaded in footer 4 if (typeof(likebtn_wl) == "undefined") { 5 a = d.createElement(e); 6 m = d.getElementsByTagName(e)[0]; 7 a.async = 1; 8 a.src = s; 9 m.parentNode.insertBefore(a, m); 10 } 11 likebtn_init(); 12})(document, 'script', '//w.likebtn.com/js/w/widget.js'); 13 14function likebtn_init() 15{ 16 if (typeof(LikeBtn) != "undefined") { 17 LikeBtn.init(); 18 } 19 setTimeout(likebtn_init, 250); 20} 21 22// Call ajax handler and custom event handler if set 23function likebtn_eh(event) 24{ 25 var old_type = 0; 26 27 // Call custom event_handler if set 28 if (event.wrapper) { 29 var custom_eh = event.wrapper.getAttribute('data-custom_eh'); 30 if (custom_eh) { 31 var callback = window[custom_eh]; 32 if (typeof(callback) === 'function') { 33 try { 34 callback(event); 35 } catch(e) { 36 likebtn_log("Error occured calling event handler function '" + custom_eh + "': " + e.message); 37 } 38 } 39 } 40 } 41 42 var modal_content = event.wrapper.getAttribute('data-clk_modal'); 43 if (event.type === "likebtn.click" && modal_content) { 44 likebtn_modal(modal_content); 45 return; 46 } 47 48 // Do not send ajax request if proxy request is being sent 49 if (typeof(event.settings.prx) !== "undefined" && event.settings.prx) { 50 return; 51 } 52 53 var type = 0; 54 55 if (event.type === "likebtn.like") { 56 type = 1; 57 } else if (event.type === "likebtn.dislike") { 58 type = -1; 59 } else if (event.type === "likebtn.unlike") { 60 old_type = 1; 61 type = 0; 62 } else if (event.type === "likebtn.undislike") { 63 old_type = -1; 64 type = 0; 65 } else { 66 return; 67 } 68 69 // Check if ajax data is set using wp_localize_script 70 if (typeof(likebtn_eh_data) === "undefined") { 71 likebtn_log('likebtn_eh_data not set'); 72 return; 73 } 74 75 // Ajax 76 var data = { 77 action: 'likebtn_event_handler', 78 old_type: old_type, 79 type: type, 80 identifier: event.settings.identifier, 81 security: likebtn_eh_data.security 82 }; 83 84 // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php 85 likebtn_ajax(likebtn_eh_data.ajaxurl, data, function() { 86 if (this.readyState == XMLHttpRequest.DONE ) { 87 if (this.status == 200) { 88 var response = JSON.parse(this.responseText); 89 90 if (response) { 91 if (response.result && response.result == 'success') { 92 93 } else { 94 var msg = 'Error sending ajax request'; 95 if (response.message) { 96 msg += ': '+response.message; 97 } 98 likebtn_log(msg); 99 } 100 } else { 101 likebtn_log('Error parsing ajax response'); 102 } 103 } else { 104 likebtn_log('Error sending ajax request'); 105 } 106 } 107 }); 108} 109 110// Send ajax request to the server 111function likebtn_ajax(url, data, callback, method) 112{ 113 var xmlhttp; 114 115 if (typeof(method) === "undefined") { 116 method = "POST"; 117 } 118 119 if (window.XMLHttpRequest) { 120 // code for IE7+, Firefox, Chrome, Opera, Safari 121 xmlhttp = new XMLHttpRequest(); 122 } else { 123 // code for IE6, IE5 124 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); 125 } 126 127 xmlhttp.onreadystatechange = callback; 128 129 xmlhttp.open(method, url, true); 130 xmlhttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); 131 xmlhttp.send(likebtn_http_build_query(data)); 132} 133 134// Log a message 135function likebtn_log(msg) 136{ 137 if (typeof(console) !== "undefined") { 138 console.log(msg); 139 } 140} 141 142// Convert array to params string 143function likebtn_http_build_query(params) { 144 var lst = []; 145 for (var key in params) { 146 if (params.hasOwnProperty(key)) { 147 lst.push(encodeURIComponent(key)+"="+encodeURIComponent(params[key])); 148 } 149 } 150 return lst.join("&"); 151} 152 153// Display modal window 154function likebtn_modal(content) 155{ 156 if (typeof(window['likebtn_modal_popup']) !== "undefined") { 157 window['likebtn_modal_popup'].open(); 158 return; 159 } 160 var html = 161 '<div class="likebtn-mdl-wrapper">'+ 162 '<div class="likebtn-mdl-content">'+ 163 '<div class="likebtn-mdl-title">'+ 164 '<button type="button" class="likebtn-mdl-close">×</button>'+ 165 //'<h3>
165 </h3>'+ 166 '</div>'+ 167 '<div class="likebtn-mdl-body">'+ 168 '<p>'+content+'</p>'+ 169 '</div>'+ 170 '</div>'+ 171 '</div>'; 172 173 var popup_el = document.createElement('div'); 174 popup_el.innerHTML = html; 175 if (popup_el.childNodes[0]) { 176 popup_el = popup_el.childNodes[0]; 177 } 178 document.body.appendChild(popup_el); 179 180 // As a native plugin 181 window['likebtn_modal_popup'] = new Popup(popup_el, { 182 width: 400, 183 height: 300, 184 closeBtnClass: 'likebtn-mdl-close' 185 }); 186 187 window['likebtn_modal_popup'].open(); 188} 189 190// Simple Popup 191// http://www.cssscript.com/simple-clean-popup-window-with-pure-javascript-simple-popup/ 192!function(t,e){e(0,t)}(this,function(t,e){"use strict";function n(t,e){return this instanceof n?(this.opts=f({},f(c,e)),this.el=t,void this.init()):new n(t,e)}var i=window,o=document,s=o.documentElement,c={width:500,height:400,offsetX:0,offsetY:0,zIndex:999,closeBtnClass:"popup-close"},f=function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t},u=function(){return i.innerWidth||s.clientWidth},r=function(){return i.innerHeight||s.clientHeight},h=function(){return i.pageXOffset||s.scrollLeft},l=function(){return i.pageYOffset||s.scrollTop},a=function(t,e){if(e=e||o,e.getElementsByClassName)return e.getElementsByClassName(t);for(var n=[],i=new RegExp("^|\\s+"+t+"\\s+|$"),s=e.getElementsByTagName("*"),c=0,f=s.length;f>c;c++)i.test(s[c].className)&&n.push(s[c]);return n},p=function(t,e,n){t.addEventListener?t.addEventListener(e,n,!1):t.attachEvent("on"+e,n)};return f(n.prototype,{init:function(){var t=this.opts;f(this.el.style,{position:"absolute",width:t.width+"px",height:'auto',zIndex:t.zIndex}),this.bindEvent()},bindEvent:function(){var t=a(this.opts.closeBtnClass)[0],e=this;p(t,"click",function(){e.close()}),p(o,"keydown",function(t){t=t||window.event;var n=t.which||t.keyCode;27===n&&e.close()}),p(i,"resize",function(){e.setPosition()})},open:function(){this.el.style.display="block",this.setPosition()},close:function(){this.el.style.display="none"},setPosition:function(){var t=this.opts,e=l()+Math.max(0,(r()-t.height)/2),n=h()+Math.max(0,(u()-t.width)/2);f(this.el.style,{top:e+t.offsetY+"px",left:n+t.offsetX+"px"})}}),t&&t.fn?t.fn.popup=function(e){var i=[];return this.each(function(t,o){i.push(new n(o,e))}),{open:function(){t.each(i,function(t,e){e.open()})},close:function(){t.each(i,function(t,e){e.close()})}}}:e&&(e.Popup=n),n});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.