-
-
Save cneill/6ecf9fee470eee16f38c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var a2a_config = a2a_config || {}; | |
a2a_config.vars = { | |
vars : ["menu_type", "static_server", "linkname", "linkurl", "linkname_escape", ["ssl", document.location.protocol != "http:" ? "https://static.addtoany.com/menu" : false], "show_title", "onclick", "num_services", "hide_embeds", "prioritize", "exclude_services", "custom_services", ["templates", {}], "orientation", ["track_links", false], ["track_links_key", ""], "awesm", "tracking_callback", "track_pub", "color_main", "color_bg", "color_border", "color_link_text", "color_link_text_hover", "color_arrow", | |
"color_arrow_hover", ["localize", "", 1], ["add_services", false, 1], "locale", "delay", "icon_color", "no_3p", "show_menu", "target"], | |
/** | |
* @return {undefined} | |
*/ | |
process : function() { | |
var tmp_keys = a2a_config.vars.vars; | |
/** @type {number} */ | |
var i = 0; | |
/** @type {string} */ | |
var name = "a2a_"; | |
var valuesLen = tmp_keys.length; | |
var key; | |
var value; | |
var val; | |
var l; | |
var b; | |
for (;i < valuesLen;i++) { | |
if (typeof tmp_keys[i] == "string") { | |
key = tmp_keys[i]; | |
value = window[name + key]; | |
/** @type {boolean} */ | |
l = false; | |
} else { | |
key = tmp_keys[i][0]; | |
value = window[name + key]; | |
val = tmp_keys[i][1]; | |
/** @type {boolean} */ | |
l = true; | |
b = tmp_keys[i][2]; | |
} | |
if (typeof value != "undefined" && value != null) { | |
a2a_config[key] = value; | |
if (!b) { | |
try { | |
delete window[name + key]; | |
} catch (h) { | |
/** @type {null} */ | |
window[name + key] = null; | |
} | |
} | |
} else { | |
if (l && !a2a_config[key]) { | |
a2a_config[key] = val; | |
} | |
} | |
} | |
} | |
}; | |
a2a_config.vars.process(); | |
a2a_config.static_server = a2a_config.static_server || (a2a_config.ssl ? a2a_config.ssl : "http://static.addtoany.com/menu"); | |
var a2a = a2a || { | |
total : 0, | |
kit_services : [], | |
icons_img_url : a2a_config.static_server + "/icons.33.png", | |
head_tag : document.getElementsByTagName("head")[0], | |
/** | |
* @return {?} | |
*/ | |
ieo : function() { | |
/** @type {number} */ | |
var ieo = -1; | |
/** @type {Element} */ | |
var blue = document.createElement("b"); | |
for (;blue.innerHTML = "\x3c!--[if gt IE " + ++ieo + "]>1<![endif]--\x3e", +blue.innerHTML;) { | |
} | |
/** | |
* @return {?} | |
*/ | |
a2a.ieo = function() { | |
return ieo; | |
}; | |
return ieo; | |
}, | |
quirks : document.compatMode && document.compatMode == "BackCompat" ? 1 : null, | |
has_touch : "ontouchend" in window, | |
has_pointer : navigator.msPointerEnabled, | |
fn_queue : [], | |
dom : { | |
isReady : false, | |
/** | |
* @param {Function} callback | |
* @return {undefined} | |
*/ | |
ready : function(callback) { | |
/** | |
* @return {?} | |
*/ | |
var ready = function() { | |
if (!document.body) { | |
return setTimeout(a2a.dom.ready(callback)); | |
} | |
callback(); | |
/** @type {boolean} */ | |
a2a.dom.isReady = true; | |
}; | |
/** | |
* @param {Event} e | |
* @return {undefined} | |
*/ | |
var completed = function(e) { | |
if (document.addEventListener || (e.type === "load" || document.readyState === "complete")) { | |
init(); | |
ready(); | |
} | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
var init = function() { | |
if (document.addEventListener) { | |
document.removeEventListener("DOMContentLoaded", completed, false); | |
window.removeEventListener("load", completed, false); | |
} else { | |
document.detachEvent("onreadystatechange", completed); | |
window.detachEvent("onload", completed); | |
} | |
}; | |
if (document.readyState === "complete") { | |
ready(); | |
} else { | |
if (document.addEventListener) { | |
document.addEventListener("DOMContentLoaded", completed, false); | |
window.addEventListener("load", completed, false); | |
} else { | |
document.attachEvent("onreadystatechange", completed); | |
window.attachEvent("onload", completed); | |
/** @type {boolean} */ | |
var top = false; | |
try { | |
/** @type {(Element|boolean)} */ | |
top = window.frameElement == null && document.documentElement; | |
} catch (d) { | |
} | |
if (top && top.doScroll) { | |
(function doScrollCheck() { | |
if (!a2a.dom.isReady) { | |
try { | |
top.doScroll("left"); | |
} catch (i) { | |
return setTimeout(doScrollCheck, 50); | |
} | |
init(); | |
ready(); | |
} | |
})(); | |
} | |
} | |
} | |
} | |
}, | |
/** | |
* @param {string} type | |
* @param {Object} opts | |
* @param {number} dataAndEvents | |
* @return {undefined} | |
*/ | |
init : function(type, opts, dataAndEvents) { | |
var options = a2a.c; | |
opts = opts || {}; | |
var d = {}; | |
/** @type {null} */ | |
var elem = null; | |
var ret; | |
var self = {}; | |
var p; | |
var image; | |
var i; | |
var classToRemove; | |
/** @type {string} */ | |
var origin = location.href; | |
/** | |
* @param {Object} config | |
* @param {Object} e | |
* @return {undefined} | |
*/ | |
var init = function(config, e) { | |
a2a.total++; | |
a2a.n = a2a.total; | |
/** @type {Object} */ | |
a2a["n" + a2a.n] = config; | |
var item = config.node = a2a.set_this_index(config.node); | |
/** @type {Element} */ | |
var main = document.createElement("div"); | |
var result; | |
var temp; | |
var name = a2a.getData(item)["a2a-title"]; | |
var opt_button = a2a.getData(item)["a2a-url"]; | |
if (!item) { | |
if (!a2a.c.show_menu) { | |
a2a.total--; | |
} | |
return; | |
} | |
if (config.linkname_escape) { | |
temp = a2a.getByClass("a2a_linkname_escape", item.parentNode)[0] || a2a.getByClass("a2a_linkname_escape", item.parentNode.parentNode)[0]; | |
if (temp) { | |
config.linkname = temp.innerHTML; | |
} | |
} | |
config.linkname = e.linkname = name || config.linkname; | |
config.linkurl = e.linkurl = opt_button || config.linkurl; | |
if (name) { | |
/** @type {boolean} */ | |
config.linkname_implicit = false; | |
} | |
if (opt_button) { | |
/** @type {boolean} */ | |
config.linkurl_implicit = false; | |
} | |
main.innerHTML = config.linkname; | |
result = main.childNodes[0]; | |
if (result) { | |
config.linkname = result.nodeValue; | |
} | |
delete main; | |
if (item.a2a_kit) { | |
a2a.kit(config, e); | |
} else { | |
a2a.button(config); | |
} | |
}; | |
a2a.make_once(type); | |
for (p in opts) { | |
options[p] = opts[p]; | |
} | |
for (p in options) { | |
d[p] = options[p]; | |
} | |
image = options.target; | |
if (image) { | |
if (typeof image == "string") { | |
/** @type {string} */ | |
i = image.substr(0, 1); | |
/** @type {string} */ | |
classToRemove = image.substr(1); | |
if (i == ".") { | |
a2a.multi_init(a2a.HTMLcollToArray(a2a.getByClass(classToRemove, document)), type, opts); | |
/** @type {boolean} */ | |
options.target = false; | |
return; | |
} else { | |
elem = a2a.gEl(classToRemove); | |
ret = elem.className; | |
if (ret.indexOf("a2a_kit") >= 0 && ret.indexOf("a2a_target") < 0) { | |
/** @type {null} */ | |
elem = null; | |
} | |
} | |
} else { | |
elem = options.target; | |
} | |
} | |
type = options.menu_type ? "mail" : type; | |
if (type) { | |
/** @type {string} */ | |
a2a.type = type; | |
options.vars.process(); | |
} | |
self.type = a2a.type; | |
self.node = elem; | |
self.linkname = a2a[self.type].last_linkname = options.linkname || (a2a[self.type].last_linkname || (document.title || location.href)); | |
self.linkurl = a2a[self.type].last_linkurl = options.linkurl || (a2a[self.type].last_linkurl || location.href); | |
self.linkname_escape = options.linkname_escape; | |
/** @type {boolean} */ | |
self.linkname_implicit = !options.linkname_escape && (document.title || origin) == self.linkname; | |
/** @type {boolean} */ | |
self.linkurl_implicit = origin == self.linkurl; | |
self.orientation = options.orientation || false; | |
self.track_links = options.track_links || false; | |
self.track_links_key = options.track_links_key || ""; | |
self.track_pub = options.track_pub || false; | |
/** @type {boolean} */ | |
options.linkname = options.linkurl = options.onclick = options.linkname_escape = options.show_title = options.custom_services = options.exclude_services = options.orientation = options.num_services = options.track_pub = options.target = false; | |
if (options.track_links == "custom") { | |
/** @type {boolean} */ | |
options.track_links = false; | |
/** @type {string} */ | |
options.track_links_key = ""; | |
} | |
a2a.last_type = a2a.type; | |
/** @type {number} */ | |
window["a2a" + a2a.type + "_init"] = 1; | |
if (a2a.locale && !dataAndEvents) { | |
a2a.fn_queue.push(function(self, data) { | |
return function() { | |
init(self, data); | |
}; | |
}(self, d)); | |
} else { | |
init(self, d); | |
/** @type {boolean} */ | |
options.menu_type = false; | |
a2a.init_show(); | |
} | |
}, | |
/** | |
* @param {string} param | |
* @return {undefined} | |
*/ | |
init_all : function(param) { | |
var a2a_menu_container = a2a.unindexed(function(elem) { | |
if (elem.className.indexOf("a2a_follow") >= 0) { | |
a2a.init("feed"); | |
} else { | |
a2a.init(param); | |
} | |
}, true); | |
if (!a2a_menu_container && a2a.gEl("a2a_menu_container")) { | |
a2a.init(param); | |
} | |
}, | |
/** | |
* @param {Array} values | |
* @param {string} listener | |
* @param {Object} el | |
* @return {undefined} | |
*/ | |
multi_init : function(values, listener, el) { | |
/** @type {number} */ | |
var i = 0; | |
var valuesLen = values.length; | |
for (;i < valuesLen;i++) { | |
el.target = values[i]; | |
a2a.init(listener, el); | |
} | |
}, | |
/** | |
* @param {Object} data | |
* @return {undefined} | |
*/ | |
button : function(data) { | |
var node = data.node; | |
var eventType = data.type; | |
var testNode = a2a.gEl("a2a" + eventType + "_dropdown"); | |
/** @type {string} */ | |
var down = "mousedown"; | |
/** @type {string} */ | |
var up = "mouseup"; | |
if ((!node.getAttribute("onclick") || (node.getAttribute("onclick") + "").indexOf("a2a_") == -1) && (!node.getAttribute("onmouseover") || (node.getAttribute("onmouseover") + "").indexOf("a2a_") == -1)) { | |
a2a.fast_click.make(node, function(ev) { | |
a2a.preventDefault(ev); | |
a2a.stopPropagation(ev); | |
if (testNode.style.display == "block") { | |
var name = a2a[eventType].time_open; | |
if (a2a[eventType].onclick || name && name == "OK") { | |
a2a.toggle_dropdown("none", eventType); | |
} else { | |
a2a[eventType].last_focus = document.activeElement; | |
testNode.focus(); | |
} | |
} else { | |
a2a.show_menu(node); | |
a2a[eventType].last_focus = document.activeElement; | |
testNode.focus(); | |
} | |
}); | |
if (a2a.has_touch) { | |
/** @type {string} */ | |
down = "touchstart"; | |
/** @type {string} */ | |
up = "touchend"; | |
} else { | |
if (a2a.has_pointer) { | |
/** @type {string} */ | |
down = "MSPointerDown"; | |
/** @type {string} */ | |
up = "MSPointerUp"; | |
} | |
} | |
a2a.add_event(node, down, a2a.stopPropagation); | |
a2a.add_event(node, up, function(e) { | |
a2a.stopPropagation(e); | |
/** @type {number} */ | |
a2a.touch_used = 1; | |
}); | |
if (!a2a[a2a.type].onclick) { | |
if (a2a.c.delay) { | |
/** | |
* @return {undefined} | |
*/ | |
node.onmouseover = function() { | |
/** @type {number} */ | |
a2a[a2a.type].over_delay = setTimeout(function() { | |
a2a.show_menu(node); | |
}, a2a.c.delay); | |
}; | |
} else { | |
/** | |
* @return {undefined} | |
*/ | |
node.onmouseover = function() { | |
a2a.show_menu(node); | |
}; | |
} | |
/** | |
* @return {undefined} | |
*/ | |
node.onmouseout = function() { | |
a2a.onMouseOut_delay(); | |
if (a2a[a2a.type].over_delay) { | |
clearTimeout(a2a[a2a.type].over_delay); | |
} | |
}; | |
} | |
} | |
if (!node.getAttribute("aria-label")) { | |
node.setAttribute("aria-label", eventType == "feed" ? a2a.c.localize.Subscribe : a2a.c.localize.Share); | |
} | |
if (node.tagName.toLowerCase() == "a" && a2a.type == "page") { | |
/** @type {string} */ | |
node.href = "https://www.addtoany.com/share#url=" + encodeURIComponent(data.linkurl) + "&title=" + encodeURIComponent(data.linkname).replace(/'/g, "%27") + "&description=" + encodeURIComponent(a2a.selection()).replace(/'/g, "%27"); | |
} | |
}, | |
/** | |
* @param {Object} params | |
* @param {Object} arg | |
* @return {undefined} | |
*/ | |
kit : function(params, arg) { | |
var type = a2a.type; | |
var posts = { | |
behance : { | |
icon : "behance", | |
url : "https://www.behance.net/${id}" | |
}, | |
facebook : { | |
icon : "facebook", | |
url : "https://www.facebook.com/${id}" | |
}, | |
flickr : { | |
icon : "flickr", | |
url : "https://www.flickr.com/photos/${id}" | |
}, | |
foursquare : { | |
icon : "foursquare", | |
url : "https://foursquare.com/${id}" | |
}, | |
google_plus : { | |
icon : "google_plus", | |
url : "https://plus.google.com/${id}" | |
}, | |
instagram : { | |
icon : "instagram", | |
url : "https://instagram.com/${id}" | |
}, | |
linkedin : { | |
icon : "linkedin", | |
url : "https://www.linkedin.com/in/${id}" | |
}, | |
linkedin_company : { | |
icon : "linkedin", | |
url : "https://www.linkedin.com/company/${id}" | |
}, | |
pinterest : { | |
icon : "pinterest", | |
url : "https://www.pinterest.com/${id}" | |
}, | |
tumblr : { | |
icon : "tumblr", | |
url : "http://${id}.tumblr.com" | |
}, | |
twitter : { | |
icon : "twitter", | |
url : "https://twitter.com/${id}" | |
}, | |
vimeo : { | |
icon : "vimeo", | |
url : "https://vimeo.com/${id}" | |
}, | |
youtube : { | |
icon : "youtube", | |
url : "https://www.youtube.com/user/${id}" | |
}, | |
youtube_channel : { | |
icon : "youtube", | |
url : "https://www.youtube.com/channel/${id}" | |
} | |
}; | |
/** | |
* @param {(Object|string)} node | |
* @param {?} name | |
* @return {?} | |
*/ | |
var fn = function(node, name) { | |
var data; | |
var ps = getDataset(node, {}); | |
var key = ps["a2a-follow"]; | |
if (key) { | |
data = posts[name].url.replace("${id}", key); | |
} | |
return data || node.href; | |
}; | |
/** @type {Array} */ | |
var stringProps = ["facebook_like", "twitter_tweet", "google_plusone", "google_plus_share", "pinterest_pin"]; | |
var reversed = a2a.counters.avail; | |
/** | |
* @param {string} c | |
* @param {boolean} dataAndEvents | |
* @return {?} | |
*/ | |
var some = function(c, dataAndEvents) { | |
if (c != "facebook_like" && c != "twitter_tweet") { | |
/** @type {number} */ | |
var i = 0; | |
var codeSegments = a2a[type].services; | |
var valuesLen = codeSegments.length; | |
for (;i < valuesLen;i++) { | |
if (c == codeSegments[i][1]) { | |
return[codeSegments[i][0], codeSegments[i][2], codeSegments[i][3], codeSegments[i][4]]; | |
} | |
} | |
} | |
if (dataAndEvents) { | |
return false; | |
} | |
return[c, c]; | |
}; | |
/** | |
* @param {Object} node | |
* @param {?} obj | |
* @return {?} | |
*/ | |
var getDataset = function(node, obj) { | |
/** @type {number} */ | |
var i = 0; | |
var valuesLen = node.attributes.length; | |
var attribute; | |
var dataset = obj; | |
for (;i < valuesLen;i++) { | |
attribute = node.attributes[i]; | |
if (attribute.name && attribute.name.substr(0, 5) == "data-") { | |
dataset[attribute.name.substr(5)] = attribute.value; | |
} | |
} | |
return dataset; | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
var onEvent = function() { | |
a2a.linker(this); | |
}; | |
/** | |
* @param {string} name | |
* @param {string} x | |
* @param {Event} data | |
* @return {undefined} | |
*/ | |
var init = function(name, x, data) { | |
var defaults = { | |
node : x, | |
service : name, | |
title : title, | |
url : url | |
}; | |
var options = a2a.cbs("share", defaults); | |
if (typeof options != "undefined") { | |
if (options.url) { | |
params.linkurl = options.url; | |
/** @type {boolean} */ | |
params.linkurl_implicit = false; | |
} | |
if (options.title) { | |
params.linkname = options.title; | |
/** @type {boolean} */ | |
params.linkname_implicit = false; | |
} | |
a2a.linker(x); | |
if (options.stop && data) { | |
a2a.preventDefault(data); | |
} | |
} | |
}; | |
var templates = a2a.c.templates; | |
var el = params.node; | |
var fontSize = a2a.getData(el); | |
var parentElement = el.a2a_follow; | |
var nodes = a2a.HTMLcollToArray(el.getElementsByTagName("a")); | |
var len = nodes.length; | |
/** @type {Element} */ | |
var star = document.createElement("div"); | |
/** @type {function (string): string} */ | |
var trim = encodeURIComponent; | |
var url = params.linkurl; | |
/** @type {string} */ | |
var camelKey = trim(params.linkurl).replace(/'/g, "%27"); | |
var title = params.linkname; | |
/** @type {string} */ | |
var l = trim(params.linkname).replace(/'/g, "%27"); | |
var text = fontSize["a2a-icon-color"] || a2a.c.icon_color; | |
var horizontalOffset = el.className.match(/a2a_kit_size_([\w\.]+)(?:\s|$)/); | |
var width = horizontalOffset ? horizontalOffset[1] : false; | |
/** @type {string} */ | |
var val = width + "px"; | |
/** @type {string} */ | |
var className = "a2a_img a2a_i_"; | |
var options = {}; | |
var style = {}; | |
/** @type {boolean} */ | |
var isFixed = el.className.indexOf("a2a_vertical_style") >= 0 ? true : false; | |
if (width && !isNaN(width)) { | |
a2a.svg_css(); | |
if (text && (text != "unset" && a2a.svg_works())) { | |
/** @type {string} */ | |
className = "a2a_svg a2a_w__default a2a_w_"; | |
options.backgroundColor = text; | |
} else { | |
/** @type {string} */ | |
className = "a2a_svg a2a_s__default a2a_s_"; | |
} | |
/** @type {string} */ | |
el.style.lineHeight = style.height = style.lineHeight = val; | |
/** @type {string} */ | |
style.width = width * 2 + "px"; | |
/** @type {string} */ | |
style.fontSize = "16px"; | |
if (isFixed) { | |
/** @type {string} */ | |
style.height = style.lineHeight = width / 2 + "px"; | |
/** @type {string} */ | |
style.fontSize = "10px"; | |
/** @type {string} */ | |
style.width = width + "px"; | |
} | |
if (width != 32) { | |
/** @type {string} */ | |
options.backgroundSize = options.height = options.lineHeight = options.width = val; | |
/** @type {string} */ | |
style.borderRadius = options.borderRadius = (width * 0.14).toFixed() + "px"; | |
/** @type {string} */ | |
style.fontSize = (parseInt(style.height, 10) + (isFixed ? 4 : 0)) / 2 + "px"; | |
} | |
} | |
/** | |
* @return {undefined} | |
*/ | |
a2a.kit.facebook_like = function() { | |
settings.href = url; | |
/** @type {string} */ | |
settings.width = "90"; | |
/** @type {string} */ | |
settings.layout = "button_count"; | |
/** @type {string} */ | |
settings.ref = "addtoany"; | |
settings = getDataset(node, settings); | |
/** @type {string} */ | |
node.style.width = settings.width + "px"; | |
/** | |
* @return {undefined} | |
*/ | |
var initialize = function() { | |
FB.init({ | |
appId : "0", | |
status : false, | |
xfbml : true, | |
version : "v2.3" | |
}); | |
FB.Event.subscribe("edge.create", function(url, dataAndEvents) { | |
a2a.GA.track("Facebook Like", "facebook_like", url, "pages", "AddToAny Share/Save Button"); | |
init("Facebook Like", node); | |
}); | |
}; | |
var text = a2a.i18n(); | |
text = text ? text.replace(/-/g, "_") : "en_US"; | |
if (text.length == 2) { | |
text += "_" + text.toUpperCase(); | |
} | |
for (key in settings) { | |
optsData += " data-" + key + '="' + settings[key] + '"'; | |
} | |
if (!window.fbAsyncInit) { | |
/** @type {function (): undefined} */ | |
window.fbAsyncInit = initialize; | |
/** @type {Element} */ | |
elem = document.createElement("span"); | |
/** @type {string} */ | |
elem.id = "fb-root"; | |
document.body.insertBefore(elem, document.body.firstChild); | |
} | |
if (!a2a.kit.facebook_like_script) { | |
(function(d, s, id) { | |
var js; | |
var insertAt = d.getElementsByTagName(s)[0]; | |
if (d.getElementById(id)) { | |
return; | |
} | |
/** @type {Element} */ | |
js = d.createElement(s); | |
/** @type {string} */ | |
js.id = id; | |
/** @type {string} */ | |
js.src = "//connect.facebook.net/" + text + "/sdk.js"; | |
insertAt.parentNode.insertBefore(js, insertAt); | |
})(document, "script", "facebook-jssdk"); | |
} | |
/** @type {number} */ | |
a2a.kit.facebook_like_script = 1; | |
/** @type {string} */ | |
node.innerHTML = '<div class="fb-like"' + optsData + "></div>"; | |
try { | |
FB.XFBML.parse(node); | |
} catch (n) { | |
} | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
a2a.kit.twitter_tweet = function() { | |
settings.url = url; | |
settings.lang = a2a.i18n() || "en"; | |
/** @type {string} */ | |
settings.related = "AddToAny,micropat"; | |
var x = templates.twitter; | |
var p = x ? x.lastIndexOf("@") : null; | |
if (p && p !== -1) { | |
p++; | |
p = x.substr(p).split(" ", 1); | |
p = p[0].replace(/:/g, "").replace(/\//g, "").replace(/-/g, "").replace(/\./g, "").replace(/,/g, "").replace(/;/g, "").replace(/!/g, ""); | |
/** @type {string} */ | |
settings.related = p + ",AddToAny"; | |
} | |
settings = getDataset(node, settings); | |
/** @type {Element} */ | |
var element = document.createElement("a"); | |
/** @type {string} */ | |
element.className = "twitter-share-button"; | |
for (key in settings) { | |
element.setAttribute("data-" + key, settings[key]); | |
} | |
node.appendChild(element); | |
if (!a2a.kit.twitter_tweet_script) { | |
(function(d, s, id) { | |
var self; | |
var js; | |
var insertAt = d.getElementsByTagName(s)[0]; | |
if (d.getElementById(id)) { | |
return; | |
} | |
/** @type {Element} */ | |
js = d.createElement(s); | |
/** @type {string} */ | |
js.id = id; | |
/** @type {string} */ | |
js.src = "//platform.twitter.com/widgets.js"; | |
insertAt.parentNode.insertBefore(js, insertAt); | |
window.twttr = window.twttr || (self = { | |
_e : [], | |
/** | |
* @param {Function} socket | |
* @return {undefined} | |
*/ | |
ready : function(socket) { | |
self._e.push(socket); | |
} | |
}); | |
})(document, "script", "twitter-wjs"); | |
} | |
/** @type {number} */ | |
a2a.kit.twitter_tweet_script = 1; | |
try { | |
twttr.ready(function($scope) { | |
if (!a2a.twitter_bind) { | |
$scope.events.bind("click", function(e) { | |
if (e && e.region == "tweet") { | |
var entry = function() { | |
var fullName = e.target.src.split("#")[1] || ""; | |
if (fullName && fullName.indexOf("url=") > -1) { | |
var dst = {}; | |
var values = fullName.split("&"); | |
var valuesLen = values.length; | |
/** @type {number} */ | |
var i = 0; | |
for (;i < valuesLen;i++) { | |
var src = values[i].split("="); | |
dst[src[0]] = src[1]; | |
} | |
return dst; | |
} else { | |
return false; | |
} | |
}(); | |
if (entry && entry.url) { | |
a2a.GA.track("Twitter Tweet", "twitter_tweet", unescape(entry.url), "pages", "AddToAny Share/Save Button"); | |
init("Twitter Tweet", node); | |
} | |
} | |
}); | |
/** @type {number} */ | |
a2a.twitter_bind = 1; | |
} | |
if ($scope.widgets) { | |
$scope.widgets.load(); | |
} | |
}); | |
} catch (n) { | |
} | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
a2a.kit.pinterest_pin = function() { | |
/** @type {string} */ | |
settings["pin-config"] = "beside"; | |
/** @type {string} */ | |
settings["pin-do"] = "buttonPin"; | |
settings.url = url; | |
settings = getDataset(node, settings); | |
/** @type {Element} */ | |
var element = document.createElement("a"); | |
for (key in settings) { | |
element.setAttribute("data-" + key, settings[key]); | |
} | |
if (settings["pin-config"] == "beside" && settings["pin-do"] == "buttonPin") { | |
/** @type {string} */ | |
node.style.width = "76px"; | |
} | |
/** @type {string} */ | |
element.href = "//www.pinterest.com/pin/create/button/?url=" + settings.url + (settings.media ? "&media=" + encodeURIComponent(settings.media) : "") + (settings.description ? "&description=" + encodeURIComponent(settings.description).replace(/'/g, "%27") : ""); | |
a2a.add_event(node, "click", function() { | |
a2a.GA.track("Pinterest Pin", "pinterest_pin", url, "pages", "AddToAny Share/Save Button"); | |
init("Pinterest Pin", node); | |
}); | |
node.appendChild(element); | |
if (!a2a.kit.pinterest_pin_script) { | |
(function(doc) { | |
/** @type {Element} */ | |
var ga = doc.createElement("script"); | |
var insertAt = doc.getElementsByTagName("script")[0]; | |
/** @type {string} */ | |
ga.type = "text/javascript"; | |
/** @type {boolean} */ | |
ga.async = true; | |
/** @type {string} */ | |
ga.src = "//assets.pinterest.com/js/pinit.js"; | |
insertAt.parentNode.insertBefore(ga, insertAt); | |
})(document); | |
} | |
/** @type {number} */ | |
a2a.kit.pinterest_pin_script = 1; | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
a2a.kit.google_plus = function() { | |
/** | |
* @param {(Object|string)} result | |
* @return {undefined} | |
*/ | |
window.google_plus_cb_a2a = function(result) { | |
if (result.state && result.state == "off") { | |
return; | |
} | |
a2a.GA.track("Google +1", "google_plusone", result.href, "pages", "AddToAny Share/Save Button"); | |
init("Google +1", node); | |
}; | |
settings.href = url; | |
/** @type {string} */ | |
settings.size = "medium"; | |
/** @type {string} */ | |
settings.annotation = "bubble"; | |
if (prefix == "google_plus_share") { | |
/** @type {string} */ | |
settings.action = "share"; | |
} | |
settings = getDataset(node, settings); | |
var lang = a2a.i18n() || "en-US"; | |
window.___gcfg = window.___gcfg || { | |
lang : lang | |
}; | |
for (key in settings) { | |
optsData += " data-" + key + '="' + settings[key] + '"'; | |
} | |
/** @type {string} */ | |
node.innerHTML = '<div class="g-plus' + (settings.action == "share" ? "" : "one") + '" data-callback="google_plus_cb_a2a"' + optsData + "></div>"; | |
if (!a2a.kit.google_plus_script) { | |
(function(doc) { | |
/** @type {Element} */ | |
var ga = doc.createElement("script"); | |
var insertAt = doc.getElementsByTagName("script")[0]; | |
/** @type {string} */ | |
ga.type = "text/javascript"; | |
/** @type {boolean} */ | |
ga.async = true; | |
/** @type {string} */ | |
ga.src = "https://apis.google.com/js/platform.js"; | |
insertAt.parentNode.insertBefore(ga, insertAt); | |
})(document); | |
/** @type {number} */ | |
a2a.kit.google_plus_script = 1; | |
} | |
}; | |
/** @type {function (): undefined} */ | |
a2a.kit.google_plusone = a2a.kit.google_plus_share = a2a.kit.google_plus; | |
/** @type {number} */ | |
var idx = 0; | |
for (;idx < len;idx++) { | |
var node = nodes[idx]; | |
var cls = node.className; | |
var cons = cls.match(/a2a_button_([\w\.]+)(?:\s|$)/); | |
/** @type {boolean} */ | |
var c = cls.indexOf("a2a_dd") >= 0; | |
/** @type {boolean} */ | |
var name = cls.indexOf("a2a_counter") >= 0; | |
var prefix = cons ? cons[1] : false; | |
var childNodes = node.childNodes; | |
var testSource = some(prefix); | |
var classes = testSource[0]; | |
/** @type {string} */ | |
var target = "_blank"; | |
var value = parentElement && posts[prefix] ? posts[prefix].icon : testSource[1]; | |
var first = testSource[2] || {}; | |
var pos = first.type; | |
var ref = testSource[3]; | |
/** @type {boolean} */ | |
var w = false; | |
/** @type {boolean} */ | |
var names = false; | |
var elem; | |
var K; | |
var key; | |
/** @type {string} */ | |
var optsData = ""; | |
var settings = {}; | |
if (c) { | |
arg.target = node; | |
a2a.init(type, arg, 1); | |
/** @type {string} */ | |
prefix = "a2a"; | |
/** @type {string} */ | |
value = "a2a"; | |
/** @type {(boolean|number)} */ | |
names = name ? 1 : false; | |
} else { | |
if (prefix == "feed" || prefix == "print") { | |
/** @type {string} */ | |
target = ""; | |
} else { | |
if (name && (prefix && a2a.in_array(prefix, reversed))) { | |
/** @type {number} */ | |
names = 1; | |
} else { | |
if (prefix && a2a.in_array(prefix, stringProps)) { | |
a2a.kit[prefix](); | |
/** @type {number} */ | |
w = 1; | |
} | |
} | |
} | |
} | |
if (!prefix || w) { | |
continue; | |
} | |
if (!c) { | |
/** @type {string} */ | |
node.target = target; | |
if (parentElement && (posts[prefix] || !some(prefix, true))) { | |
node.href = fn(node, prefix); | |
} else { | |
if (prefix == "feed") { | |
node.href = params.linkurl; | |
} else { | |
/** @type {string} */ | |
node.href = "/"; | |
/** @type {function (): undefined} */ | |
node.onmousedown = onEvent; | |
/** @type {function (): undefined} */ | |
node.onkeydown = onEvent; | |
/** @type {string} */ | |
node.rel = "nofollow"; | |
} | |
} | |
node.a2a = {}; | |
node.a2a.customserviceuri = ref; | |
node.a2a.stype = pos; | |
node.a2a.linkurl = params.linkurl; | |
node.a2a.servicename = classes; | |
node.a2a.safename = prefix; | |
if (!node.getAttribute("aria-label")) { | |
node.setAttribute("aria-label", classes); | |
} | |
if (first.src) { | |
node.a2a.js_src = first.src; | |
} | |
if (first.pu) { | |
/** @type {number} */ | |
node.a2a.popup = 1; | |
} | |
if (!parentElement) { | |
a2a.add_event(node, "click", function(prop, name, url, source, event) { | |
return function(ev) { | |
var winHeight = screen.height; | |
/** @type {number} */ | |
var am = 550; | |
/** @type {number} */ | |
var height = 450; | |
/** @type {string} */ | |
var r20 = "event=service_click&url=" + trim(location.href) + "&title=" + trim(document.title || "") + "&ev_service=" + trim(prop) + "&ev_service_type=kit&ev_menu_type=" + type + "&ev_url=" + trim(url) + "&ev_title=" + trim(source).replace(/'/g, "%27"); | |
init(name, event, ev); | |
if (event.a2a.popup && !a2a.defaultPrevented(ev)) { | |
a2a.preventDefault(ev); | |
window.open(event.href, "_blank", "toolbar=0,personalbar=0,resizable,scrollbars,status,width=550,height=450,top=" + (winHeight > height ? Math.round(winHeight / 2 - height / 2) : 40) + ",left=" + Math.round(screen.width / 2 - am / 2)); | |
} | |
a2a.util_frame_post(type, r20); | |
a2a.GA.track(name, prop, url, "pages", "AddToAny Share/Save Button"); | |
}; | |
}(prefix, classes, url, title, node)); | |
} | |
} | |
if (childNodes.length) { | |
/** @type {number} */ | |
var i = 0; | |
var length = childNodes.length; | |
for (;i < length;i++) { | |
if (childNodes[i].nodeType == 1) { | |
/** @type {boolean} */ | |
K = true; | |
break; | |
} | |
} | |
if (!K) { | |
/** @type {Element} */ | |
elem = document.createElement("span"); | |
/** @type {string} */ | |
elem.className = className + value + " a2a_img_text"; | |
for (prop_name in options) { | |
elem.style[prop_name] = options[prop_name]; | |
} | |
node.insertBefore(elem, childNodes[0]); | |
} | |
} else { | |
/** @type {Element} */ | |
elem = document.createElement("span"); | |
/** @type {string} */ | |
elem.className = className + value; | |
for (prop_name in options) { | |
elem.style[prop_name] = options[prop_name]; | |
} | |
node.appendChild(elem); | |
} | |
if (isFixed && (width && width < 20)) { | |
/** @type {boolean} */ | |
names = false; | |
} | |
if (names) { | |
/** @type {Element} */ | |
elem = document.createElement("span"); | |
/** @type {string} */ | |
elem.className = "a2a_count"; | |
elem.a2a = {}; | |
elem.a2a.kit = el; | |
for (prop_name in style) { | |
elem.style[prop_name] = style[prop_name]; | |
} | |
node.appendChild(elem); | |
if (c) { | |
a2a.counters.get("facebook", elem, camelKey); | |
a2a.counters.get("twitter", elem, camelKey); | |
/** @type {number} */ | |
elem.a2a.is_a2a_dd_counter = 1; | |
el.a2a_dd_counter = elem; | |
} else { | |
a2a.counters.get(prefix, elem, camelKey); | |
} | |
} | |
if (cls != "a2a_dd") { | |
a2a.kit_services.push(node); | |
} | |
} | |
if (el.className.indexOf("a2a_default_style") >= 0) { | |
/** @type {string} */ | |
star.style.clear = "both"; | |
el.appendChild(star); | |
} | |
}, | |
counters : { | |
/** | |
* @param {string} id | |
* @param {Element} obj | |
* @param {string} key | |
* @return {undefined} | |
*/ | |
get : function(id, obj, key) { | |
/** @type {string} */ | |
var query = decodeURIComponent(key); | |
var o = a2a.counters[id]; | |
var oL = o.api; | |
var cb = o.cb; | |
var is_a2a_dd_counter = obj.a2a.is_a2a_dd_counter; | |
var self; | |
var suiteView; | |
self = o[query] = o[query] || {}; | |
if (self.num) { | |
if (is_a2a_dd_counter) { | |
a2a.counters.sum(obj, self.num, id); | |
} else { | |
a2a.counters.set(obj, self.num, id); | |
} | |
return; | |
} | |
self.queued = self.queued || []; | |
self.queued.push(obj); | |
o.n = o.n || 0; | |
o.n++; | |
/** | |
* @param {Object} rvar | |
* @return {undefined} | |
*/ | |
o["cb" + o.n] = function(rvar) { | |
var i = a2a.counters[id].cb(rvar, obj); | |
if (typeof i == "undefined") { | |
return; | |
} | |
/** @type {number} */ | |
var c = 0; | |
var n; | |
for (;c < self.queued.length;c++) { | |
queued_count_element = self.queued[c]; | |
self.num = i; | |
if (queued_count_element.a2a.is_a2a_dd_counter) { | |
a2a.counters.sum(queued_count_element, i, id); | |
} else { | |
a2a.counters.set(queued_count_element, i, id); | |
} | |
} | |
}; | |
if (self.queued.length == 1) { | |
/** @type {string} */ | |
suiteView = oL[0] + key + (oL[1] || "&callback") + "=a2a.counters." + id + ".cb" + o.n; | |
a2a.dom.ready(function() { | |
a2a.loadExtScript(suiteView); | |
}); | |
} | |
}, | |
/** | |
* @param {Element} obj | |
* @param {?} key | |
* @param {string} callback | |
* @return {undefined} | |
*/ | |
set : function(obj, key, callback) { | |
/** @type {string} */ | |
obj.innerHTML = "<span>" + a2a.counters.format(key) + "</span>"; | |
if (callback != "a2a") { | |
a2a.counters.sum(obj, key, callback); | |
} | |
}, | |
/** | |
* @param {Element} var_args | |
* @param {?} key | |
* @param {string} callback | |
* @return {undefined} | |
*/ | |
sum : function(var_args, key, callback) { | |
var self = var_args.a2a.kit; | |
var camelKey = self.a2a_counts_sum || 0; | |
var steps = self.a2a_counts_summed; | |
if (callback != "a2a" && (!steps || steps.indexOf(callback) == -1)) { | |
camelKey = self.a2a_counts_sum = camelKey + key; | |
steps = self.a2a_counts_summed = steps || []; | |
steps.push(callback); | |
} | |
if (self.a2a_dd_counter) { | |
a2a.counters.set(self.a2a_dd_counter, camelKey, "a2a"); | |
} | |
}, | |
/** | |
* @param {number} num | |
* @return {?} | |
*/ | |
format : function(num) { | |
/** @type {number} */ | |
var base = 1E6; | |
/** @type {number} */ | |
var den = 1E3; | |
if (num > 999) { | |
if (num < base) { | |
if (num > 1E4) { | |
/** @type {string} */ | |
num = (num / den).toFixed() + "k"; | |
} else { | |
/** @type {string} */ | |
num = num + ""; | |
/** @type {string} */ | |
num = num.charAt(0) + "," + num.substring(1); | |
} | |
} else { | |
if (num < 1E9) { | |
/** @type {string} */ | |
num = (num / base).toFixed(num % base > 94999) + "M"; | |
} else { | |
/** @type {string} */ | |
num = "1B+"; | |
} | |
} | |
} | |
return num; | |
}, | |
avail : ["facebook", "linkedin", "pinterest", "reddit", "tumblr", "twitter"], | |
facebook : { | |
api : ['https://graph.facebook.com/fql?q=SELECT%20url,%20normalized_url,%20share_count,%20like_count,%20comment_count,%20total_count,commentsbox_count,%20comments_fbid,%20click_count%20FROM%20link_stat%20WHERE%20url="', '"&callback'], | |
/** | |
* @param {string} res | |
* @param {Element} label | |
* @return {?} | |
*/ | |
cb : function(res, label) { | |
if (res && (res.data && (res.data[0] && !isNaN(res.data[0].total_count)))) { | |
return res.data[0].total_count; | |
} | |
} | |
}, | |
linkedin : { | |
api : ["https://www.linkedin.com/countserv/count/share?url="], | |
/** | |
* @param {Object} res | |
* @param {Element} label | |
* @return {?} | |
*/ | |
cb : function(res, label) { | |
if (res && !isNaN(res.count)) { | |
return res.count; | |
} | |
} | |
}, | |
pinterest : { | |
api : ["https://widgets.pinterest.com/v1/urls/count.json?url="], | |
/** | |
* @param {Object} res | |
* @param {Element} label | |
* @return {?} | |
*/ | |
cb : function(res, label) { | |
if (res && !isNaN(res.count)) { | |
return res.count; | |
} | |
} | |
}, | |
reddit : { | |
api : ["https://www.reddit.com/api/info.json?url=", "&jsonp"], | |
/** | |
* @param {?} res | |
* @param {Element} label | |
* @return {?} | |
*/ | |
cb : function(res, label) { | |
var data = res.data; | |
if (res && (data && data.children)) { | |
/** @type {number} */ | |
var i = 0; | |
/** @type {Array} */ | |
var newArguments = []; | |
var codeSegments = data.children; | |
var p; | |
for (;i < codeSegments.length;i++) { | |
p = codeSegments[i].data; | |
if (p && !isNaN(p.ups)) { | |
newArguments.push(p.ups); | |
} | |
} | |
if (newArguments.length > 0) { | |
return Math.max.apply(null, newArguments); | |
} | |
} | |
} | |
}, | |
tumblr : { | |
api : ["https://api.tumblr.com/v2/share/stats?url="], | |
/** | |
* @param {Function} res | |
* @param {Element} label | |
* @return {?} | |
*/ | |
cb : function(res, label) { | |
if (res && (res.response && !isNaN(res.response.note_count))) { | |
return res.response.note_count; | |
} | |
} | |
}, | |
twitter : { | |
api : ["https://cdn.api.twitter.com/1/urls/count.json?url="], | |
/** | |
* @param {Object} res | |
* @param {Element} label | |
* @return {?} | |
*/ | |
cb : function(res, label) { | |
if (res && !isNaN(res.count)) { | |
return res.count; | |
} | |
} | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
init_show : function() { | |
var body = a2a_config; | |
var no_hide = a2a[a2a.type]; | |
var do_body = a2a.show_menu; | |
if (body.bookmarklet) { | |
/** @type {number} */ | |
no_hide.no_hide = 1; | |
do_body(); | |
} | |
if (body.show_menu) { | |
/** @type {number} */ | |
no_hide.no_hide = 1; | |
do_body(false, body.show_menu); | |
} | |
}, | |
/** | |
* @param {Function} $ | |
* @param {boolean} dataAndEvents | |
* @return {?} | |
*/ | |
unindexed : function($, dataAndEvents) { | |
/** | |
* @param {Array} a | |
* @return {?} | |
*/ | |
function enter(a) { | |
/** @type {number} */ | |
var i = 0; | |
var aLength = a.length; | |
var el; | |
var v; | |
for (;i < aLength;i++) { | |
el = a[i]; | |
if ((typeof el.a2a_index === "undefined" || el.a2a_index === "") && (el.className.indexOf("a2a_target") < 0 && el.parentNode.className.indexOf("a2a_kit") < 0)) { | |
v = $(el); | |
} | |
if (v) { | |
return v; | |
} else { | |
continue; | |
} | |
} | |
return null; | |
} | |
if (dataAndEvents) { | |
return enter(a2a.getByClass("a2a_kit", document)) || enter(a2a.HTMLcollToArray(document.getElementsByName("a2a_dd")).concat(a2a.getByClass("a2a_dd", document))); | |
} else { | |
enter(a2a.getByClass("a2a_kit", document).concat(a2a.getByClass("a2a_dd", document), a2a.HTMLcollToArray(document.getElementsByName("a2a_dd")))); | |
} | |
}, | |
/** | |
* @param {Element} el | |
* @return {?} | |
*/ | |
set_this_index : function(el) { | |
/** | |
* @param {Element} el | |
* @return {?} | |
*/ | |
function hasClass(el) { | |
if (el.className.indexOf("a2a_kit") >= 0) { | |
/** @type {number} */ | |
el.a2a_kit = 1; | |
} else { | |
return false; | |
} | |
if (el.className.indexOf("a2a_follow") >= 0) { | |
/** @type {number} */ | |
el.a2a_follow = 1; | |
} | |
} | |
var node = a2a.n; | |
var c; | |
if (el) { | |
el.a2a_index = node; | |
hasClass(el); | |
return el; | |
} else { | |
return a2a.unindexed(function(el) { | |
el.a2a_index = node; | |
hasClass(el); | |
return el; | |
}, true); | |
} | |
}, | |
/** | |
* @param {string} elem | |
* @return {?} | |
*/ | |
gEl : function(elem) { | |
return document.getElementById(elem); | |
}, | |
/** | |
* @param {string} classToRemove | |
* @param {?} element | |
* @param {string} match | |
* @return {?} | |
*/ | |
getByClass : function(classToRemove, element, match) { | |
if (document.getElementsByClassName && Object.prototype.getElementsByClassName === document.getElementsByClassName) { | |
/** | |
* @param {string} className | |
* @param {?} element | |
* @param {string} tag | |
* @return {?} | |
*/ | |
a2a.getByClass = function(className, element, tag) { | |
element = element || a2a.gEl("a2a" + a2a.type + "_dropdown"); | |
var unmatched = element.getElementsByClassName(className); | |
/** @type {(RegExp|null)} */ | |
var rfocusable = tag ? new RegExp("\\b" + tag + "\\b", "i") : null; | |
/** @type {Array} */ | |
var result = []; | |
var elem; | |
/** @type {number} */ | |
var i = 0; | |
var len = unmatched.length; | |
for (;i < len;i += 1) { | |
elem = unmatched[i]; | |
if (!rfocusable || rfocusable.test(elem.nodeName)) { | |
result.push(elem); | |
} | |
} | |
return result; | |
}; | |
} else { | |
if (document.evaluate) { | |
/** | |
* @param {string} className | |
* @param {?} element | |
* @param {string} tag | |
* @return {?} | |
*/ | |
a2a.getByClass = function(className, element, tag) { | |
tag = tag || "*"; | |
element = element || a2a.gEl("a2a" + a2a.type + "_dropdown"); | |
var codeSegments = className.split(" "); | |
/** @type {string} */ | |
var classesToCheck = ""; | |
/** @type {string} */ | |
var xhtmlNamespace = "http://www.w3.org/1999/xhtml"; | |
/** @type {(null|string)} */ | |
var namespaceResolver = document.documentElement.namespaceURI === xhtmlNamespace ? xhtmlNamespace : null; | |
/** @type {Array} */ | |
var assigns = []; | |
var evaluationResults; | |
var vvar; | |
/** @type {number} */ | |
var i = 0; | |
var valuesLen = codeSegments.length; | |
for (;i < valuesLen;i += 1) { | |
classesToCheck += "[contains(concat(' ',@class,' '), ' " + codeSegments[i] + " ')]"; | |
} | |
try { | |
evaluationResults = document.evaluate(".//" + tag + classesToCheck, element, namespaceResolver, 0, null); | |
} catch (m) { | |
evaluationResults = document.evaluate(".//" + tag + classesToCheck, element, null, 0, null); | |
} | |
for (;vvar = evaluationResults.iterateNext();) { | |
assigns.push(vvar); | |
} | |
return assigns; | |
}; | |
} else { | |
/** | |
* @param {string} className | |
* @param {HTMLElement} element | |
* @param {string} tag | |
* @return {?} | |
*/ | |
a2a.getByClass = function(className, element, tag) { | |
tag = tag || "*"; | |
element = element || a2a.gEl("a2a" + a2a.type + "_dropdown"); | |
var codeSegments = className.split(" "); | |
/** @type {Array} */ | |
var tests = []; | |
var seed = tag === "*" && element.all ? element.all : element.getElementsByTagName(tag); | |
var elem; | |
/** @type {Array} */ | |
var result = []; | |
var o; | |
/** @type {number} */ | |
var i = 0; | |
var valuesLen = codeSegments.length; | |
for (;i < valuesLen;i += 1) { | |
tests.push(new RegExp("(^|\\s)" + codeSegments[i] + "(\\s|$)")); | |
} | |
/** @type {number} */ | |
var idx = 0; | |
var len = seed.length; | |
for (;idx < len;idx += 1) { | |
elem = seed[idx]; | |
/** @type {boolean} */ | |
o = false; | |
/** @type {number} */ | |
var k = 0; | |
/** @type {number} */ | |
var numrows = tests.length; | |
for (;k < numrows;k += 1) { | |
o = tests[k].test(elem.className); | |
if (!o) { | |
break; | |
} | |
} | |
if (o) { | |
result.push(elem); | |
} | |
} | |
return result; | |
}; | |
} | |
} | |
return a2a.getByClass(classToRemove, element, match); | |
}, | |
/** | |
* @param {Object} b | |
* @return {?} | |
*/ | |
HTMLcollToArray : function(b) { | |
/** @type {Array} */ | |
var a = []; | |
var bufferLength = b.length; | |
/** @type {number} */ | |
var i = 0; | |
for (;i < bufferLength;i++) { | |
a[a.length] = b[i]; | |
} | |
return a; | |
}, | |
/** | |
* @param {Object} o | |
* @param {string} type | |
* @param {Function} evtHandler | |
* @param {boolean} useCapture | |
* @return {?} | |
*/ | |
add_event : function(o, type, evtHandler, useCapture) { | |
if (o.addEventListener) { | |
o.addEventListener(type, evtHandler, useCapture); | |
return{ | |
/** | |
* @return {undefined} | |
*/ | |
destroy : function() { | |
o.removeEventListener(type, evtHandler, useCapture); | |
} | |
}; | |
} else { | |
o.attachEvent("on" + type, evtHandler); | |
return{ | |
/** | |
* @return {undefined} | |
*/ | |
destroy : function() { | |
o.detachEvent("on" + type, evtHandler); | |
} | |
}; | |
} | |
}, | |
fast_click : { | |
/** | |
* @param {Object} dataAndEvents | |
* @param {Function} deepDataAndEvents | |
* @param {boolean} attributes | |
* @return {undefined} | |
*/ | |
make : function(dataAndEvents, deepDataAndEvents, attributes) { | |
this.init(); | |
/** | |
* @param {Object} dataAndEvents | |
* @param {Function} deepDataAndEvents | |
* @param {boolean} attributes | |
* @return {undefined} | |
*/ | |
this.make = function(dataAndEvents, deepDataAndEvents, attributes) { | |
new this.FastButton(dataAndEvents, deepDataAndEvents, attributes); | |
}; | |
this.make(dataAndEvents, deepDataAndEvents, attributes); | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
init : function() { | |
/** | |
* @param {Object} target | |
* @param {string} type | |
* @param {Function} listener | |
* @param {?} useCapture | |
* @return {?} | |
*/ | |
function addListener(target, type, listener, useCapture) { | |
var r20 = target.attachEvent ? function(dataAndEvents) { | |
listener.handleEvent(window.event, listener); | |
} : listener; | |
return a2a.add_event(target, type, r20, useCapture); | |
} | |
/** | |
* @param {Element} element | |
* @param {Function} handler | |
* @param {?} useCapture | |
* @return {undefined} | |
*/ | |
this.FastButton = function(element, handler, useCapture) { | |
/** @type {Array} */ | |
this.events = []; | |
/** @type {Array} */ | |
this.touchEvents = []; | |
/** @type {Element} */ | |
this.element = element; | |
/** @type {Function} */ | |
this.handler = handler; | |
this.useCapture = useCapture; | |
if (a2a.has_touch) { | |
this.events.push(addListener(element, "touchstart", this, this.useCapture)); | |
} else { | |
if (a2a.has_pointer) { | |
/** @type {string} */ | |
element.style.msTouchAction = "manipulation"; | |
} | |
} | |
this.events.push(addListener(element, "click", this, this.useCapture)); | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
this.FastButton.prototype.destroy = function() { | |
/** @type {number} */ | |
var name = this.events.length - 1; | |
for (;name >= 0;name -= 1) { | |
this.events[name].destroy(); | |
} | |
/** @type {null} */ | |
this.events = this.touchEvents = this.element = this.handler = this.fast_click = null; | |
}; | |
/** | |
* @param {Event} event | |
* @return {undefined} | |
*/ | |
this.FastButton.prototype.handleEvent = function(event) { | |
switch(event.type) { | |
case "touchstart": | |
this.onTouchStart(event); | |
break; | |
case "touchmove": | |
this.onTouchMove(event); | |
break; | |
case "touchend": | |
this.onClick(event); | |
break; | |
case "click": | |
this.onClick(event); | |
break; | |
} | |
}; | |
/** | |
* @param {Event} event | |
* @return {undefined} | |
*/ | |
this.FastButton.prototype.onTouchStart = function(event) { | |
a2a.stopPropagation(event); | |
this.touchEvents.push(addListener(this.element, "touchend", this, this.useCapture)); | |
this.touchEvents.push(addListener(document.body, "touchmove", this, this.useCapture)); | |
this.startX = event.touches[0].clientX; | |
this.startY = event.touches[0].clientY; | |
}; | |
/** | |
* @param {Object} event | |
* @return {undefined} | |
*/ | |
this.FastButton.prototype.onTouchMove = function(event) { | |
if (Math.abs(event.touches[0].clientX - this.startX) > 10 || Math.abs(event.touches[0].clientY - this.startY) > 10) { | |
this.reset(); | |
} | |
}; | |
/** | |
* @param {Event} event | |
* @return {?} | |
*/ | |
this.FastButton.prototype.onClick = function(event) { | |
a2a.stopPropagation(event); | |
this.reset(); | |
var result = this.handler.call(this.element, event); | |
if (event.type == "touchend") { | |
a2a.fast_click.clickbuster.preventGhostClick(this.startX, this.startY); | |
} | |
return result; | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
this.FastButton.prototype.reset = function() { | |
/** @type {number} */ | |
var _idx = this.touchEvents.length - 1; | |
for (;_idx >= 0;_idx -= 1) { | |
this.touchEvents[_idx].destroy(); | |
} | |
/** @type {Array} */ | |
this.touchEvents = []; | |
}; | |
this.clickbuster = { | |
coordinates : [], | |
/** | |
* @param {?} spaceName | |
* @param {?} y | |
* @return {undefined} | |
*/ | |
preventGhostClick : function(spaceName, y) { | |
this.coordinates.push(spaceName, y); | |
window.setTimeout(this.pop2, 2500); | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
pop2 : function() { | |
a2a.fast_click.clickbuster.coordinates.splice(0, 2); | |
}, | |
/** | |
* @param {Event} event | |
* @return {undefined} | |
*/ | |
onClick : function(event) { | |
/** @type {number} */ | |
var i = 0; | |
var x; | |
var y; | |
var data = a2a.fast_click.clickbuster; | |
for (;i < data.coordinates.length;i += 2) { | |
x = data.coordinates[i]; | |
y = data.coordinates[i + 1]; | |
if (Math.abs(event.clientX - x) < 25 && Math.abs(event.clientY - y) < 25) { | |
a2a.stopPropagation(event); | |
a2a.preventDefault(event); | |
} | |
} | |
} | |
}; | |
if (a2a.has_touch) { | |
a2a.add_event(document, "click", this.clickbuster.onClick, true); | |
} | |
} | |
}, | |
/** | |
* @param {Event} event | |
* @return {undefined} | |
*/ | |
stopPropagation : function(event) { | |
if (!event) { | |
event = window.event; | |
} | |
/** @type {boolean} */ | |
event.cancelBubble = true; | |
if (event.stopPropagation) { | |
event.stopPropagation(); | |
} | |
}, | |
/** | |
* @param {Event} ev | |
* @return {undefined} | |
*/ | |
preventDefault : function(ev) { | |
if (ev.preventDefault) { | |
ev.preventDefault(); | |
} else { | |
/** @type {boolean} */ | |
ev.returnValue = false; | |
} | |
}, | |
/** | |
* @param {Event} eventData | |
* @return {?} | |
*/ | |
defaultPrevented : function(eventData) { | |
return eventData.defaultPrevented || (eventData.returnValue === false || typeof eventData.defaultPrevented === "undefined" && (eventData.getPreventDefault && eventData.getPreventDefault())) ? true : false; | |
}, | |
/** | |
* @param {Function} callback | |
* @return {undefined} | |
*/ | |
onLoad : function(callback) { | |
/** @type {(function ((Event|null)): ?|null)} */ | |
var prevOnLoad = window.onload; | |
if (typeof window.onload != "function") { | |
/** @type {Function} */ | |
window.onload = callback; | |
} else { | |
/** | |
* @return {undefined} | |
*/ | |
window.onload = function() { | |
if (prevOnLoad) { | |
prevOnLoad(); | |
} | |
callback(); | |
}; | |
} | |
}, | |
/** | |
* @param {string} item | |
* @param {Array} arr | |
* @param {boolean} recurring | |
* @param {string} name | |
* @param {string} i | |
* @return {?} | |
*/ | |
in_array : function(item, arr, recurring, name, i) { | |
if (typeof arr == "object") { | |
item = item.toLowerCase(); | |
var e = arr.length; | |
/** @type {number} */ | |
var id = 0; | |
var l; | |
for (;id < e;id++) { | |
l = name ? arr[id][name] : arr[id]; | |
l = i ? l[i] : l; | |
if (recurring) { | |
if (item == l.toLowerCase()) { | |
return arr[id]; | |
} | |
} else { | |
if (item.indexOf(l.toLowerCase()) != -1 && l !== "") { | |
return arr[id]; | |
} | |
} | |
} | |
} | |
return false; | |
}, | |
/** | |
* @param {Object} object | |
* @param {?} obj | |
* @return {?} | |
*/ | |
serialize : function(object, obj) { | |
/** @type {Array} */ | |
var tagNameArr = []; | |
var property; | |
for (property in object) { | |
if (object.hasOwnProperty(property)) { | |
/** @type {string} */ | |
var val = obj ? obj + "[" + property + "]" : property; | |
var value = object[property]; | |
tagNameArr.push(typeof value == "object" ? a2a.serialize(value, val) : encodeURIComponent(val) + "=" + encodeURIComponent(value)); | |
} | |
} | |
return tagNameArr.join("&"); | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
onMouseOut_delay : function() { | |
var eventType = a2a.type; | |
var val = a2a.gEl("a2a" + eventType + "_dropdown").style.display; | |
if (val != "none" && (val != "" && (!a2a[eventType].find_focused && (!a2a[eventType].service_focused && !a2a.touch_used)))) { | |
/** @type {number} */ | |
a2a[eventType].out_delay = setTimeout(function() { | |
a2a.toggle_dropdown("none", eventType); | |
/** @type {null} */ | |
a2a[eventType].out_delay = null; | |
}, 501); | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
onMouseOver_stay : function() { | |
if (a2a[a2a.type].out_delay) { | |
clearTimeout(a2a[a2a.type].out_delay); | |
} | |
}, | |
/** | |
* @param {string} type | |
* @param {string} key | |
* @return {undefined} | |
*/ | |
toggle_dropdown : function(type, key) { | |
if (type == "none" && a2a[key].no_hide) { | |
return; | |
} | |
var target; | |
var flag = a2a.gEl; | |
var obj = flag("a2a" + key + "_dropdown"); | |
var next = flag("a2a" + key + "_shim"); | |
/** @type {string} */ | |
var event = "mousedown"; | |
/** @type {string} */ | |
var name = "mouseup"; | |
var focus = document.activeElement; | |
/** @type {string} */ | |
obj.style.display = type; | |
if (next && a2a.getStyle(flag("a2a" + key + "_full"), "display") == "none") { | |
/** @type {string} */ | |
next.style.display = type; | |
} | |
a2a.onMouseOver_stay(); | |
if (type == "none") { | |
if (!window.addEventListener) { | |
target = document.detachEvent; | |
target("on" + event, a2a.doc_mousedown_check_scroll); | |
target("on" + name, a2a[key].doc_mouseup_toggle_dropdown); | |
} else { | |
if (a2a.has_touch) { | |
/** @type {string} */ | |
event = "touchstart"; | |
/** @type {string} */ | |
name = "touchend"; | |
} else { | |
if (a2a.has_pointer) { | |
/** @type {string} */ | |
event = "MSPointerDown"; | |
/** @type {string} */ | |
name = "MSPointerUp"; | |
} | |
} | |
document.removeEventListener(event, a2a.doc_mousedown_check_scroll, false); | |
document.removeEventListener(name, a2a[key].doc_mouseup_toggle_dropdown, false); | |
/** @type {null} */ | |
a2a.touch_used = null; | |
} | |
delete a2a[key].doc_mouseup_toggle_dropdown; | |
} else { | |
if (!a2a[key].onclick) { | |
/** @type {number} */ | |
a2a[key].time_open = setTimeout(function() { | |
/** @type {string} */ | |
a2a[key].time_open = "OK"; | |
}, 501); | |
} | |
} | |
if (a2a[key].prev_keydown) { | |
document.onkeydown = a2a[key].prev_keydown; | |
} else { | |
/** @type {string} */ | |
document.onkeydown = ""; | |
} | |
}, | |
/** | |
* @param {?} node | |
* @return {?} | |
*/ | |
getData : function(node) { | |
if (!node) { | |
return{}; | |
} | |
/** @type {number} */ | |
var i = 0; | |
var valuesLen = node.attributes.length; | |
var field; | |
var data = {}; | |
for (;i < valuesLen;i++) { | |
field = node.attributes[i]; | |
if (field.name && field.name.substr(0, 5) == "data-") { | |
data[field.name.substr(5)] = field.value; | |
} | |
} | |
return data; | |
}, | |
/** | |
* @param {Element} node | |
* @param {string} style | |
* @return {?} | |
*/ | |
getStyle : function(node, style) { | |
return node.currentStyle ? node.currentStyle[style.replace(/-(\w)/gi, function(dataAndEvents, letter) { | |
return letter.toUpperCase(); | |
})] : window.getComputedStyle(node, null).getPropertyValue(style); | |
}, | |
/** | |
* @param {Element} elm | |
* @return {?} | |
*/ | |
getPos : function(elm) { | |
var otherElementRect; | |
/** @type {function (*): number} */ | |
var round = Math.round; | |
if (typeof elm.getBoundingClientRect == "undefined") { | |
return a2a.getPosOld(elm); | |
} else { | |
otherElementRect = elm.getBoundingClientRect(); | |
} | |
return{ | |
left : round(otherElementRect.left + a2a.getScrollDocDims("w")), | |
top : round(otherElementRect.top + a2a.getScrollDocDims("h")) | |
}; | |
}, | |
/** | |
* @param {Element} elm | |
* @return {?} | |
*/ | |
getPosOld : function(elm) { | |
/** @type {number} */ | |
var pickWinLeft = 0; | |
/** @type {number} */ | |
var pickWinTop = 0; | |
do { | |
pickWinLeft += elm.offsetLeft || 0; | |
pickWinTop += elm.offsetTop || 0; | |
elm = elm.offsetParent; | |
} while (elm); | |
return{ | |
left : pickWinLeft, | |
top : pickWinTop | |
}; | |
}, | |
/** | |
* @param {string} x | |
* @return {?} | |
*/ | |
getDocDims : function(x) { | |
/** @type {number} */ | |
var viewportwidth = 0; | |
/** @type {number} */ | |
var viewportheight = 0; | |
if (typeof window.innerWidth == "number") { | |
/** @type {number} */ | |
viewportwidth = window.innerWidth; | |
/** @type {number} */ | |
viewportheight = window.innerHeight; | |
} else { | |
if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) { | |
/** @type {number} */ | |
viewportwidth = document.documentElement.clientWidth; | |
/** @type {number} */ | |
viewportheight = document.documentElement.clientHeight; | |
} else { | |
if (document.body && (document.body.clientWidth || document.body.clientHeight)) { | |
/** @type {number} */ | |
viewportwidth = document.body.clientWidth; | |
/** @type {number} */ | |
viewportheight = document.body.clientHeight; | |
} | |
} | |
} | |
if (x == "w") { | |
return viewportwidth; | |
} else { | |
return viewportheight; | |
} | |
}, | |
/** | |
* @param {string} x | |
* @return {?} | |
*/ | |
getScrollDocDims : function(x) { | |
/** @type {number} */ | |
var scroll_width = 0; | |
/** @type {number} */ | |
var s = 0; | |
if (typeof window.pageYOffset == "number") { | |
/** @type {number} */ | |
scroll_width = window.pageXOffset; | |
/** @type {number} */ | |
s = window.pageYOffset; | |
} else { | |
if (document.body && (document.body.scrollLeft || document.body.scrollTop)) { | |
/** @type {number} */ | |
scroll_width = document.body.scrollLeft; | |
/** @type {number} */ | |
s = document.body.scrollTop; | |
} else { | |
if (document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop)) { | |
/** @type {number} */ | |
scroll_width = document.documentElement.scrollLeft; | |
/** @type {number} */ | |
s = document.documentElement.scrollTop; | |
} | |
} | |
} | |
if (x == "w") { | |
return scroll_width; | |
} else { | |
return s; | |
} | |
}, | |
/** | |
* @param {number} recurring | |
* @return {?} | |
*/ | |
show_more_less : function(recurring) { | |
a2a.onMouseOver_stay(); | |
var type = a2a.type; | |
/** @type {string} */ | |
var msg = "a2a" + type; | |
var toVLQSigned = a2a.gEl; | |
var vlq = toVLQSigned(msg + "_show_more_less"); | |
a2a.show_full(); | |
a2a.embeds_fix(true); | |
if (recurring == 0) { | |
return false; | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
focus_find : function() { | |
var el = a2a.gEl("a2a" + a2a.type + "_find"); | |
if (el.parentNode.style.display != "none") { | |
el.focus(); | |
} | |
}, | |
/** | |
* @param {string} regex | |
* @return {undefined} | |
*/ | |
default_services : function(regex) { | |
var unlock = regex || a2a.type; | |
var cTaskName1 = a2a[unlock].main_services_col_1; | |
var numrows = cTaskName1.length; | |
/** @type {number} */ | |
var k = 0; | |
for (;k < numrows;k++) { | |
/** @type {string} */ | |
cTaskName1[k].style.display = ""; | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
do_find : function() { | |
var networkState = a2a.type; | |
var cTaskName1 = a2a[networkState].main_services; | |
var numrows = cTaskName1.length; | |
var filter = a2a.gEl("a2a" + networkState + "_find").value; | |
var reversed; | |
var hasKey = a2a.in_array; | |
if (filter !== "") { | |
reversed = filter.split(" "); | |
/** @type {number} */ | |
var k = 0; | |
var result; | |
for (;k < numrows;k++) { | |
result = cTaskName1[k].a2a.serviceNameLowerCase; | |
if (hasKey(result, reversed, false)) { | |
/** @type {string} */ | |
cTaskName1[k].style.display = ""; | |
} else { | |
/** @type {string} */ | |
cTaskName1[k].style.display = "none"; | |
} | |
} | |
} else { | |
a2a.default_services(); | |
} | |
}, | |
/** | |
* @return {?} | |
*/ | |
selection : function() { | |
var title; | |
/** @type {NodeList} */ | |
var metas = document.getElementsByTagName("meta"); | |
/** @type {number} */ | |
var l = metas.length; | |
if (window.getSelection) { | |
/** @type {(Selection|null)} */ | |
title = window.getSelection(); | |
} else { | |
if (document.selection) { | |
try { | |
/** @type {(ControlRange|TextRange|null)} */ | |
title = document.selection.createRange(); | |
} catch (f) { | |
/** @type {string} */ | |
title = ""; | |
} | |
title = title.text ? title.text : ""; | |
} | |
} | |
if (title && title != "") { | |
return title; | |
} | |
if (a2a["n" + a2a.n].linkurl == location.href) { | |
/** @type {number} */ | |
var i = 0; | |
var v; | |
var pos; | |
for (;i < l;i++) { | |
v = metas[i].getAttribute("name"); | |
if (v) { | |
if (v.toLowerCase() == "description") { | |
pos = metas[i].getAttribute("content"); | |
break; | |
} | |
} | |
} | |
} | |
return pos ? pos.substring(0, 1200) : ""; | |
}, | |
/** | |
* @param {string} n | |
* @return {undefined} | |
*/ | |
collections : function(n) { | |
var md5_cmn = a2a.gEl; | |
var a = a2a[n]; | |
/** @type {string} */ | |
var endOffset = "a2a" + n; | |
a.main_services_col_1 = a2a.getByClass("a2a_i", md5_cmn(endOffset + "_full_services"), "a"); | |
a.main_services = a.main_services_col_1; | |
a.email_services = a2a.getByClass("a2a_i", md5_cmn(endOffset + "_2_col1", "a")); | |
a.all_services = a.main_services.concat(a.email_services); | |
}, | |
/** | |
* @param {string} name | |
* @param {?} classProps | |
* @return {?} | |
*/ | |
cbs : function(name, classProps) { | |
var values = a2a.c.callbacks || []; | |
var old = a2a.c.tracking_callback; | |
var obj = {}; | |
if (old) { | |
if (old[name]) { | |
values.push(old); | |
} else { | |
if (old[0] == name) { | |
obj[name] = old[1]; | |
values.push(obj); | |
} else { | |
if (typeof old == "function") { | |
/** @type {Function} */ | |
obj[name] = old; | |
values.push(obj); | |
} | |
} | |
} | |
/** @type {null} */ | |
a2a.c.tracking_callback = null; | |
} | |
/** @type {number} */ | |
var i = 0; | |
var valuesLen = values.length; | |
var callback; | |
for (;i < valuesLen;i++) { | |
callback = values[i][name]; | |
if (typeof callback == "function") { | |
returned = callback(classProps); | |
if (name == "ready") { | |
/** @type {null} */ | |
callback = null; | |
} | |
if (typeof returned != "undefined") { | |
return returned; | |
} | |
} | |
} | |
}, | |
/** | |
* @param {Element} a | |
* @return {?} | |
*/ | |
linker : function(a) { | |
/** @type {string} */ | |
var myUrl = location.href; | |
/** @type {string} */ | |
var html = document.title || myUrl; | |
var opts = a2a["n" + (a.parentNode.a2a_index || a2a.n)]; | |
var p = opts.node; | |
var type = opts.type; | |
var auto = a2a.getData(p)["a2a-url"] || opts.linkurl; | |
var dir = opts.linkurl_implicit && myUrl != auto ? myUrl : auto; | |
/** @type {string} */ | |
var guess = encodeURIComponent(dir).replace(/'/g, "%27"); | |
var report = a2a.getData(p)["a2a-title"] || opts.linkname; | |
var text = opts.linkname_implicit && html != report ? html : report; | |
/** @type {string} */ | |
var js = encodeURIComponent(text).replace(/'/g, "%27"); | |
/** @type {string} */ | |
var camelKey = encodeURIComponent(a2a.selection()).replace(/'/g, "%27"); | |
/** @type {string} */ | |
var args = opts.track_links && (type == "page" || type == "mail") ? "&linktrack=" + opts.track_links + "&linktrackkey=" + encodeURIComponent(opts.track_links_key) : ""; | |
var unique = a.a2a.customserviceuri || false; | |
var name = a.a2a.safename; | |
var op = a.a2a.stype; | |
var no_in = a.a2a.js_src; | |
var data; | |
var item = a2a.c.templates; | |
if (op && (op == "js" && no_in)) { | |
/** @type {string} */ | |
a.target = ""; | |
data = no_in.substr(0, 11) == "javascript:" ? no_in : 'javascript:a2a.loadExtScript("' + no_in + '")'; | |
} else { | |
if (unique && unique != "undefined") { | |
data = unique.replace(/A2A_LINKNAME_ENC/, js).replace(/A2A_LINKURL_ENC/, guess).replace(/A2A_LINKNOTE_ENC/, camelKey); | |
} | |
} | |
a.href = data || "http://www.addtoany.com/add_to/" + name + "?linkurl=" + guess + "&linkname=" + js + args + (a2a.c.awesm ? "&linktrack_parent=" + a2a.c.awesm : "") + (name == "twitter" && item[name] ? "&template=" + encodeURIComponent(item[name]) : "") + ((name == "email" || op && op == "email") && item.email ? "&" + a2a.serialize({ | |
template : item.email | |
}) : "") + (type == "feed" ? "&type=feed" : "") + "&linknote=" + camelKey; | |
return true; | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
show_full : function() { | |
var value = a2a.type; | |
/** @type {string} */ | |
var tval = "a2a" + value; | |
var jqLite = a2a.gEl; | |
var requestFrame = a2a.getByClass; | |
var selector = jqLite(tval + "_find"); | |
var elm = jqLite(tval + "_overlay"); | |
var d = jqLite(tval + "_shim"); | |
var element = jqLite(tval + "_full"); | |
var node = requestFrame("a2a_full_header", element)[0]; | |
var select = jqLite(tval + "_full_services"); | |
var p = requestFrame("a2a_full_footer", element)[0]; | |
var animation = element.style.animation; | |
/** @type {string} */ | |
element.style.animation = elm.style.animation = "none"; | |
element.offsetTop; | |
elm.offsetTop; | |
/** @type {string} */ | |
element.style.animation = elm.style.animation = ""; | |
/** @type {string} */ | |
element.style.display = elm.style.display = "block"; | |
if (d) { | |
/** @type {string} */ | |
d.style.display = "block"; | |
} | |
if (document.addEventListener) { | |
element.addEventListener("animationend", function(dataAndEvents) { | |
/** @type {string} */ | |
element.style.animation = elm.style.animation = "none"; | |
}, false); | |
} | |
/** @type {string} */ | |
select.style.cssText = "height:calc(10px)"; | |
if (!!select.style.height.length) { | |
/** @type {string} */ | |
select.style.height = "calc(100% - " + (node.offsetHeight + p.offsetHeight) + "px)"; | |
} | |
element.focus(); | |
a2a.show_full.key_listener = a2a.add_event(document, "keydown", function(e) { | |
e = e || window.event; | |
var chunkNumber = e.which || e.keyCode; | |
var focus = document.activeElement; | |
if (chunkNumber == 27 && selector != focus) { | |
a2a.hide_full(value); | |
} else { | |
if (chunkNumber > 40 && (chunkNumber < 91 && selector != focus)) { | |
selector.focus(); | |
} | |
} | |
}); | |
}, | |
/** | |
* @param {string} putativeSpy | |
* @return {undefined} | |
*/ | |
hide_full : function(putativeSpy) { | |
var getElement = a2a.gEl; | |
/** @type {string} */ | |
var cb = "a2a" + putativeSpy; | |
/** @type {string} */ | |
getElement(cb + "_overlay").style.display = getElement(cb + "_full").style.display = "none"; | |
shim = getElement(cb + "_shim"); | |
if (shim) { | |
if (a2a.getStyle(getElement(cb + "_dropdown"), "display") == "none") { | |
/** @type {string} */ | |
shim.style.display = "none"; | |
} else { | |
a2a.embeds_fix(); | |
getElement(cb + "_show_more_less").focus(); | |
} | |
} | |
a2a.show_full.key_listener.destroy(); | |
}, | |
/** | |
* @param {Element} target | |
* @param {Object} o | |
* @return {undefined} | |
*/ | |
show_menu : function(target, o) { | |
if (target) { | |
a2a.n = target.a2a_index; | |
} else { | |
a2a.n = a2a.total; | |
/** @type {number} */ | |
a2a[a2a.type].no_hide = 1; | |
} | |
var event = a2a["n" + a2a.n]; | |
var type = a2a.type = event.type; | |
/** @type {string} */ | |
var key = "a2a" + type; | |
var popup = a2a.gEl(key + "_dropdown"); | |
/** @type {string} */ | |
var name = "mousedown"; | |
/** @type {string} */ | |
var eventType = "mouseup"; | |
a2a.gEl(key + "_title").value = event.linkname; | |
a2a.toggle_dropdown("block", type); | |
/** @type {Array} */ | |
var diff = [popup.clientWidth, popup.clientHeight]; | |
var right = a2a.getDocDims("w"); | |
var i = a2a.getDocDims("h"); | |
var c = a2a.getScrollDocDims("w"); | |
var bHeight = a2a.getScrollDocDims("h"); | |
var e; | |
var r; | |
var width; | |
var h; | |
if (target) { | |
e = target.getElementsByTagName("img")[0]; | |
if (e) { | |
r = a2a.getPos(e); | |
width = e.clientWidth; | |
h = e.clientHeight; | |
} else { | |
r = a2a.getPos(target); | |
width = target.offsetWidth; | |
h = target.offsetHeight; | |
} | |
if (r.left - c + diff[0] + width > right) { | |
/** @type {number} */ | |
r.left = r.left - diff[0] + width - 8; | |
} | |
if (event.orientation == "up" || event.orientation != "down" && (r.top - bHeight + diff[1] + h > i && r.top > diff[1])) { | |
/** @type {number} */ | |
r.top = r.top - diff[1] - h; | |
} | |
/** @type {string} */ | |
popup.style.left = (r.left < 0 ? 0 : r.left) + 2 + "px"; | |
/** @type {string} */ | |
popup.style.top = r.top + h + "px"; | |
a2a.embeds_fix(); | |
} else { | |
if (!o) { | |
o = {}; | |
} | |
popup.style.position = o.position || "absolute"; | |
popup.style.left = o.left || right / 2 - diff[0] / 2 + "px"; | |
popup.style.top = o.top || i / 2 - diff[1] / 2 + "px"; | |
} | |
if (!a2a[type].doc_mouseup_toggle_dropdown && !a2a[type].no_hide) { | |
/** | |
* @return {undefined} | |
*/ | |
a2a.doc_mousedown_check_scroll = function() { | |
a2a.last_scroll_pos = a2a.getScrollDocDims("h"); | |
}; | |
a2a[type].doc_mouseup_toggle_dropdown = function(events) { | |
return function() { | |
if (a2a.last_scroll_pos == a2a.getScrollDocDims("h")) { | |
if (a2a[type].last_focus) { | |
a2a[type].last_focus.focus(); | |
} | |
a2a.toggle_dropdown("none", events); | |
} | |
}; | |
}(type); | |
if (!window.addEventListener) { | |
document.attachEvent("on" + name, a2a.doc_mousedown_check_scroll); | |
document.attachEvent("on" + eventType, a2a[type].doc_mouseup_toggle_dropdown); | |
} else { | |
if (a2a.has_touch) { | |
/** @type {string} */ | |
name = "touchstart"; | |
/** @type {string} */ | |
eventType = "touchend"; | |
} else { | |
if (a2a.has_pointer) { | |
/** @type {string} */ | |
name = "MSPointerDown"; | |
/** @type {string} */ | |
eventType = "MSPointerUp"; | |
} | |
} | |
document.addEventListener(name, a2a.doc_mousedown_check_scroll, false); | |
document.addEventListener(eventType, a2a[type].doc_mouseup_toggle_dropdown, false); | |
} | |
} | |
a2a.svg_css(); | |
/** @type {function (string): string} */ | |
var getLocation = encodeURIComponent; | |
/** @type {string} */ | |
var r20 = "event=menu_show&url=" + getLocation(location.href) + "&title=" + getLocation(document.title || "") + "&ev_menu_type=" + type; | |
a2a.util_frame_post(type, r20); | |
}, | |
/** | |
* @param {boolean} dataAndEvents | |
* @return {undefined} | |
*/ | |
embeds_fix : function(dataAndEvents) { | |
var $ = a2a.gEl; | |
var type = a2a.type; | |
/** @type {string} */ | |
var prefix = "a2a" + type; | |
var iframe = $(prefix + "_shim"); | |
var el; | |
var to; | |
var newTop; | |
var w; | |
var iHeight; | |
if (!iframe) { | |
/** @type {Element} */ | |
iframe = document.createElement("iframe"); | |
/** @type {string} */ | |
iframe.className = "a2a_shim"; | |
/** @type {string} */ | |
iframe.id = prefix + "_shim"; | |
/** @type {string} */ | |
iframe.title = "AddToAny Shim"; | |
iframe.setAttribute("frameBorder", "0"); | |
iframe.setAttribute("src", 'javascript:"";'); | |
/** @type {number} */ | |
iframe.tabIndex = -1; | |
document.body.appendChild(iframe); | |
} | |
if (dataAndEvents) { | |
/** @type {string} */ | |
iframe.style.left = iframe.style.top = "0"; | |
/** @type {string} */ | |
iframe.style.width = ""; | |
/** @type {string} */ | |
iframe.style.height = ""; | |
} else { | |
el = $(prefix + "_dropdown"); | |
/** @type {number} */ | |
to = parseInt(el.style.left); | |
/** @type {number} */ | |
newTop = parseInt(el.style.top); | |
w = el.clientWidth || el.offsetWidth; | |
iHeight = el.clientHeight || el.offsetHeight; | |
/** @type {string} */ | |
iframe.style.left = to + "px"; | |
/** @type {string} */ | |
iframe.style.top = newTop + "px"; | |
/** @type {string} */ | |
iframe.style.width = w + "px"; | |
/** @type {string} */ | |
iframe.style.height = iHeight + "px"; | |
} | |
}, | |
/** | |
* @param {number} dataAndEvents | |
* @return {?} | |
*/ | |
bmBrowser : function(dataAndEvents) { | |
var Bookmark = a2a.c.localize.Bookmark; | |
var opts = a2a["n" + a2a.n]; | |
if (document.all) { | |
if (dataAndEvents == 1) { | |
Bookmark = a2a.c.localize.AddToYourFavorites; | |
} else { | |
window.external.AddFavorite(opts.linkurl, opts.linkname); | |
} | |
} else { | |
if (dataAndEvents != 1) { | |
/** @type {string} */ | |
a2a.gEl("a2apage_note_BROWSER").innerHTML = '<div class="a2a_note_note">' + a2a.c.localize.BookmarkInstructions + "</div>"; | |
} | |
} | |
if (dataAndEvents == 1) { | |
return Bookmark; | |
} | |
}, | |
/** | |
* @param {string} obj | |
* @param {Function} successCb | |
* @param {Function} next_callback | |
* @return {undefined} | |
*/ | |
loadExtScript : function(obj, successCb, next_callback) { | |
/** @type {Element} */ | |
var s = document.createElement("script"); | |
/** @type {string} */ | |
s.charset = "UTF-8"; | |
/** @type {string} */ | |
s.src = obj; | |
document.body.appendChild(s); | |
if (typeof successCb == "function") { | |
/** @type {number} */ | |
var poll = setInterval(function() { | |
/** @type {boolean} */ | |
var f = false; | |
try { | |
f = successCb.call(); | |
} catch (g) { | |
} | |
if (f) { | |
clearInterval(poll); | |
next_callback.call(); | |
} | |
}, 100) | |
} | |
}, | |
/** | |
* @param {string} path | |
* @return {undefined} | |
*/ | |
track : function(path) { | |
/** @type {Image} */ | |
var imageElement = new Image(1, 1); | |
/** @type {string} */ | |
imageElement.src = path; | |
/** @type {number} */ | |
imageElement.width = 1; | |
/** @type {number} */ | |
imageElement.height = 1; | |
}, | |
/** | |
* @param {boolean} dataAndEvents | |
* @return {undefined} | |
*/ | |
GA : function(dataAndEvents) { | |
/** @type {Window} */ | |
var self = window; | |
var type = a2a.type; | |
/** | |
* @return {undefined} | |
*/ | |
var walk = function() { | |
if (typeof urchinTracker == "function") { | |
/** | |
* @param {string} keepData | |
* @param {string} object | |
* @param {Node} path | |
* @param {string} fn | |
* @param {string} category | |
* @return {undefined} | |
*/ | |
a2a.GA.track = function(keepData, object, path, fn, category) { | |
urchinTracker("/addtoany.com/" + fn); | |
urchinTracker("/addtoany.com/" + fn + "/" + (path || a2a["n" + a2a.n].linkurl)); | |
urchinTracker("/addtoany.com/services/" + object); | |
}; | |
} else { | |
if (typeof pageTracker == "object") { | |
/** | |
* @param {string} action | |
* @param {string} object | |
* @param {string} url | |
* @param {string} fn | |
* @param {string} category | |
* @return {undefined} | |
*/ | |
a2a.GA.track = function(action, object, url, fn, category) { | |
if (type != "feed") { | |
pageTracker._trackSocial("AddToAny", action, url || a2a["n" + a2a.n].linkurl); | |
} | |
pageTracker._trackEvent(category, action, url || a2a["n" + a2a.n].linkurl); | |
}; | |
} else { | |
if (typeof _gaq == "object") { | |
/** | |
* @param {string} url | |
* @param {string} object | |
* @param {Node} property | |
* @param {string} fn | |
* @param {string} category | |
* @return {undefined} | |
*/ | |
a2a.GA.track = function(url, object, property, fn, category) { | |
if (type != "feed") { | |
_gaq.push(["_trackSocial", "AddToAny", url, property || a2a["n" + a2a.n].linkurl]); | |
} | |
_gaq.push(["_trackEvent", category, url, property || a2a["n" + a2a.n].linkurl]); | |
}; | |
} else { | |
if (typeof GoogleAnalyticsObject == "string") { | |
/** | |
* @param {string} label | |
* @param {string} object | |
* @param {Node} url | |
* @param {string} fn | |
* @param {string} category | |
* @return {undefined} | |
*/ | |
a2a.GA.track = function(label, object, url, fn, category) { | |
if (type != "feed") { | |
self[GoogleAnalyticsObject]("send", "social", "AddToAny", label, { | |
page : url || a2a["n" + a2a.n].linkurl | |
}); | |
} | |
self[GoogleAnalyticsObject]("send", "event", category, label, url || a2a["n" + a2a.n].linkurl); | |
}; | |
} else { | |
return; | |
} | |
} | |
} | |
} | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
a2a.GA.track = function() { | |
}; | |
if (dataAndEvents || /loaded|complete/.test(document.readyState)) { | |
walk(); | |
} else { | |
a2a.onLoad(walk); | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
add_services : function() { | |
var type = a2a.type; | |
var getParent = a2a.gEl; | |
/** @type {number} */ | |
var j = parseInt(a2a[type].num_services); | |
var table = getParent("a2a" + type + "_full_services"); | |
var parent = getParent("a2a" + type + "_mini_services"); | |
var resolveValues; | |
if (a2a[type].custom_services) { | |
var models = a2a[type].custom_services; | |
var l = models.length; | |
var put = a2a.make_service; | |
/** @type {number} */ | |
var o = 0; | |
models.reverse(); | |
/** @type {number} */ | |
var i = 0; | |
var tr; | |
for (;i < l;i++) { | |
if (models[i]) { | |
o += 1; | |
tr = put(models[i][0], models[i][0].replace(" ", "_"), false, {}, models[i][1], models[i][2]); | |
table.insertBefore(tr, table.firstChild); | |
tr = put(models[i][0], models[i][0].replace(" ", "_"), false, {}, models[i][1], models[i][2]); | |
parent.insertBefore(tr, parent.firstChild); | |
} | |
} | |
} | |
if (type == "page" && a2a.c.add_services) { | |
models = a2a.c.add_services; | |
l = models.length; | |
put = a2a.make_service; | |
/** @type {number} */ | |
o = 0; | |
var ssl = a2a.c.ssl; | |
/** @type {number} */ | |
i = 0; | |
for (;i < l;i++) { | |
if (models[i]) { | |
o += 1; | |
if (ssl) { | |
/** @type {boolean} */ | |
models[i].icon = false; | |
} | |
tr = put(models[i].name, models[i].safe_name, false, {}, false, models[i].icon); | |
table.insertBefore(tr, table.firstChild); | |
tr = put(models[i].name, models[i].safe_name, false, {}, false, models[i].icon); | |
parent.insertBefore(tr, parent.firstChild); | |
} | |
} | |
} | |
resolveValues = a2a.getByClass("a2a_i", parent, "a"); | |
if (resolveValues.length > j) { | |
/** @type {number} */ | |
i = 0; | |
var length = resolveValues.length; | |
for (;i < length - j;i++) { | |
parent.removeChild(parent.lastChild); | |
} | |
} | |
}, | |
/** | |
* @param {string} keepData | |
* @return {undefined} | |
*/ | |
util_frame_make : function(keepData) { | |
/** @type {Element} */ | |
var frame = document.createElement("iframe"); | |
/** @type {Element} */ | |
var el = document.createElement("div"); | |
/** @type {function (string): string} */ | |
var getLocation = encodeURIComponent; | |
/** @type {string} */ | |
var icon = document.referrer ? getLocation(document.referrer) : ""; | |
/** @type {string} */ | |
var recipient = getLocation(location.href); | |
/** @type {string} */ | |
var url = getLocation(document.title || ""); | |
/** @type {string} */ | |
var g = navigator.browserLanguage || navigator.language; | |
/** @type {string} */ | |
frame.id = "a2a" + keepData + "_sm_ifr"; | |
/** @type {number} */ | |
frame.width = frame.height = 1; | |
/** @type {string} */ | |
frame.style.width = frame.style.height = el.style.width = el.style.height = "1px"; | |
/** @type {number} */ | |
frame.style.top = frame.style.left = frame.frameborder = frame.style.border = 0; | |
/** @type {string} */ | |
frame.style.position = el.style.position = "absolute"; | |
/** @type {number} */ | |
frame.style.zIndex = el.style.zIndex = 1E5; | |
/** @type {string} */ | |
frame.title = "AddToAny Utility Frame"; | |
frame.setAttribute("transparency", "true"); | |
frame.setAttribute("allowTransparency", "true"); | |
frame.setAttribute("frameBorder", "0"); | |
/** @type {string} */ | |
frame.src = (a2a.c.ssl ? a2a.c.ssl : "http://static.addtoany.com/menu") + "/sm13.html#type=" + keepData + "&event=load&url=" + recipient + "&referrer=" + icon; | |
/** @type {string} */ | |
el.style.top = "0"; | |
/** @type {string} */ | |
el.style.visibility = "hidden"; | |
a2a.gEl("a2a" + keepData + "_dropdown").parentNode.insertBefore(el, null); | |
el.insertBefore(frame, null); | |
}, | |
/** | |
* @param {string} key | |
* @return {undefined} | |
*/ | |
util_frame_listen : function(key) { | |
a2a.util_frame_make(key); | |
if (window.postMessage && !a2a[key].message_event) { | |
a2a.add_event(window, "message", function(e) { | |
if (e.origin.substr(e.origin.length - 13) == ".addtoany.com") { | |
var parts = e.data.split("="); | |
var selector = parts[0].substr(4); | |
var parentName = parts[1]; | |
var r20 = selector.substr(0, 4); | |
if (selector == r20 + "_services") { | |
parentName = parentName != "" ? parentName.split(",") : false; | |
a2a.top_services(parentName, r20, " a2a_sss"); | |
a2a.collections(r20); | |
a2a.default_services(r20); | |
} | |
/** @type {string} */ | |
a2a.gEl("a2a" + r20 + "_sm_ifr").style.display = "none"; | |
} | |
}); | |
/** @type {number} */ | |
a2a[key].message_event = 1; | |
} | |
}, | |
/** | |
* @param {?} keepData | |
* @param {string} regex | |
* @return {undefined} | |
*/ | |
util_frame_post : function(keepData, regex) { | |
if (window.postMessage) { | |
a2a.gEl("a2a" + keepData + "_sm_ifr").contentWindow.postMessage(regex, "*"); | |
} | |
}, | |
/** | |
* @return {?} | |
*/ | |
fix_icons : function() { | |
var ffversion = a2a.ieo(); | |
var el = a2a.getByClass("a2a_s_a2a", document); | |
el = el[0]; | |
var tryNum = a2a.fix_icons.tryNum || 0; | |
if (ffversion && ffversion < 9) { | |
if (el && (!el.a2aFixed && (!el.currentStyle.backgroundImage.split('"')[1] && tryNum < 999))) { | |
a2a.fix_icons.tryNum = tryNum + 1; | |
return setTimeout(a2a.fix_icons, 99); | |
} | |
/** @type {number} */ | |
var i = 0; | |
var canvas; | |
var new_image_url; | |
var img; | |
var node; | |
var nodes = a2a.getByClass("a2a_svg", document); | |
var len = nodes.length; | |
for (;i < len;i++) { | |
node = nodes[i]; | |
canvas = node.currentStyle; | |
new_image_url = canvas.backgroundImage.split('"')[1]; | |
if (!node.a2aFixed && new_image_url) { | |
/** @type {Image} */ | |
img = new Image; | |
/** @type {number} */ | |
img.style.border = 0; | |
img.style.height = canvas.height; | |
img.style.width = canvas.width; | |
img.src = new_image_url; | |
/** @type {string} */ | |
node.style.background = "none"; | |
node.insertBefore(img, node.firstChild); | |
} | |
/** @type {number} */ | |
node.a2aFixed = 1; | |
} | |
} else { | |
/** | |
* @return {undefined} | |
*/ | |
fix_icons = function() { | |
}; | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
arrange_services : function() { | |
var r20 = a2a.type; | |
var parentName = a2a.c.prioritize; | |
var c; | |
if (parentName) { | |
a2a.top_services(parentName, r20); | |
} | |
a2a.add_services(); | |
}, | |
/** | |
* @param {Array} baseName | |
* @param {(Document|string)} regex | |
* @param {?} className | |
* @return {undefined} | |
*/ | |
top_services : function(baseName, regex, className) { | |
var unlock = regex || a2a.type; | |
var makeElement = a2a.in_array; | |
var template = a2a.make_service; | |
/** @type {number} */ | |
var j = parseInt(a2a[unlock].num_services); | |
var container = a2a.gEl("a2a" + unlock + "_full_services"); | |
var wrapper = a2a.gEl("a2a" + unlock + "_mini_services"); | |
var li = a2a.getByClass("a2a_i", container, "a"); | |
var data = a2a.getByClass("a2a_i", wrapper, "a"); | |
/** @type {Array} */ | |
var codeSegments = []; | |
if (baseName) { | |
/** @type {number} */ | |
var i = baseName.length - 1; | |
className = className; | |
for (;i > -1;i--) { | |
var div = baseName[i]; | |
var node = makeElement(div, li, true, "a2a", "safename"); | |
if (node) { | |
if (className) { | |
node.className = node.className + className; | |
} | |
container.insertBefore(node, container.firstChild); | |
codeSegments.push(node); | |
} | |
} | |
if (codeSegments.length > 0) { | |
/** @type {number} */ | |
i = 0; | |
className = className; | |
var el; | |
var options; | |
var element; | |
for (;i < codeSegments.length;i++) { | |
if (el = makeElement(codeSegments[i].a2a.safename, data, true, "a2a", "safename")) { | |
element = el; | |
} else { | |
options = codeSegments[i].a2a; | |
element = template(options.servicename, options.safename, options.serviceIcon, { | |
type : options.serviceType, | |
pu : options.popup | |
}); | |
} | |
if (className) { | |
element.className = element.className + className; | |
} | |
wrapper.insertBefore(element, wrapper.firstChild); | |
} | |
data = a2a.getByClass("a2a_i", wrapper, "a"); | |
if (data.length > j) { | |
/** @type {number} */ | |
i = 0; | |
var length = data.length; | |
for (;i < length - j;i++) { | |
wrapper.removeChild(wrapper.lastChild); | |
} | |
} | |
} | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
css : function() { | |
var str; | |
var i; | |
var settings = a2a.c; | |
/** @type {Element} */ | |
var sheet = settings.css = document.createElement("style"); | |
var method = settings.color_main || "EEE"; | |
var whiteKeyColour = settings.color_bg || "FFF"; | |
var index = settings.color_border || "CCC"; | |
var tag = settings.color_link_text || "0166FF"; | |
var srcDir = settings.color_link_text_hover || "2A2A2A"; | |
var m = settings.color_link_text_hover || "2A2A2A"; | |
var yyyy = settings.color_link_text || "2A2A2A"; | |
var f = method.toLowerCase() == "ffffff" ? "EEE" : method; | |
var b = settings.color_link_text || "2A2A2A"; | |
var id = settings.color_border || index; | |
/** @type {string} */ | |
var first = ".a2a_"; | |
/** @type {string} */ | |
var news_source = "{background-position:0 "; | |
/** @type {string} */ | |
var sum = "px!important}"; | |
/** @type {string} */ | |
var value = first + "i_"; | |
/** @type {string} */ | |
var tval = sum + value; | |
/** @type {string} */ | |
var res = first + "menu"; | |
/** @type {string} */ | |
var second = first + "tab"; | |
/** @type {string} */ | |
var name = "border"; | |
/** @type {string} */ | |
var letter = "background-color:"; | |
/** @type {string} */ | |
var open = "color:"; | |
/** @type {string} */ | |
var o = "margin:"; | |
/** @type {string} */ | |
var n = "padding:"; | |
/** @type {string} */ | |
str = "" + res + "," + res + " * {-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box;float:none;" + o + "0;" + n + "0;position: static;height:auto;width:auto;}" + res + " {" + name + "-radius: 6px;display:none;direction:ltr;background:#" + whiteKeyColour + ';font: 16px sans-serif-light, "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Arial, Helvetica, "Liberation Sans", sans-serif;' + open + "#000;line-height:12px;" + name + ": 1px solid #" + index + | |
";vertical-align:baseline;outline: 0; overflow:hidden;}" + first + "mini {min-width:200px;position:absolute;width: 300px;z-index:9999997;}" + first + "overlay {display: none;background: #" + index + '; _height: expression( ((e=document.documentElement.clientHeight)?e:document.body.clientHeight)+"px" ); _width: expression( ((e=document.documentElement.clientWidth)?e:document.body.clientWidth)+"px" ); filter: alpha(opacity=50); opacity: .7;position: fixed;_position: absolute; top: 0;right: 0;left: 0;bottom: 0;z-index: 9999998;-webkit-animation: a2aFadeInOverlay .14s ease-out;animation: a2aFadeInOverlay .14s ease-out;}' + | |
first + "full {background: #" + whiteKeyColour + ';height: auto;height: calc(320px);top: 15%;_top: expression(40+((e=document.documentElement.scrollTop)?e:document.body.scrollTop)+"px"); left: 50%;margin-left: -320px; position: fixed;_position: absolute; text-align: center;width: 640px;z-index: 9999999; -webkit-animation: a2aFadeIn .14s ease-in; animation: a2aFadeIn .14s ease-in;}' + first + "full_header," + first + "full_services," + first + "full_footer {" + name + ": 0;" + o + " 0;" + n + | |
" 12px;box-sizing: " + name + "-box;}" + first + "full_header {padding-bottom: 8px;}" + first + "full_services {height: 280px; overflow-y: scroll;" + n + " 0 12px;-webkit-overflow-scrolling: touch;}" + first + "full_services " + first + "i {display: inline-block;float: none;width: 181px;width: calc(33.334% - 18px);}div" + first + "full_footer {font-size: 12px;text-align: center;" + n + " 8px 14px;}div" + first + "full_footer a,div" + first + "full_footer a:visited {display: inline;font-size: 12px;line-height:14px;" + | |
n + " 8px 14px; }div" + first + "full_footer a:hover,div" + first + "full_footer a:focus {background: none;" + name + ": 0;" + open + " #" + tag + ";}div" + first + "full_footer a span" + first + "s_a2a,div" + first + "full_footer a span" + first + "w_a2a {background-size: 14px;" + name + "-radius: 3px;display: inline-block;height:14px;line-height:14px;" + o + " 0 3px 0 0;vertical-align: top;*vertical-align: middle; width:14px;}@media print {" + res + "," + first + "overlay {visibility: hidden;}}@-webkit-keyframes a2aFadeIn {from { opacity: 0; } to { opacity: 1; }}@keyframes a2aFadeIn {from { opacity: 0; } to { opacity: 1; }}@-webkit-keyframes a2aFadeInOverlay {from { opacity: 0; } to { opacity: .7; }}@keyframes a2aFadeInOverlay {from { opacity: 0; } to { opacity: .7; }}@media (max-width: 639px) {" + | |
first + "full {top: 15%;left: 0;margin-left: auto;width: 100%;}}@media (min-width: 318px) and (max-width: 437px) {" + first + "full " + first + "full_services " + first + "i {width: calc(50% - 18px);}}@media (max-width: 317px) {" + first + "full " + first + "full_services " + first + "i {width: calc(100% - 18px);}}@media (max-height: 436px) {" + first + "full {bottom: 40px;height: auto;top: 40px;}}" + res + " a {" + open + "#" + tag + ';text-decoration:none;font: 16px sans-serif-light, "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Arial, Helvetica, "Liberation Sans", sans-serif;line-height:14px;height:auto;width:auto;outline:none;-moz-outline:none;}' + | |
res + " a:visited{" + open + "#" + tag + "}" + res + " a:hover," + res + " a:active," + res + " a:focus{" + open + "#" + srcDir + ";" + name + ":1px solid #" + method + ";" + letter + "#" + method + ";text-decoration:none}" + res + " span" + first + "s_find {background-size: 24px;height:24px;left: 8px;position:absolute;top: 7px;width:24px;}" + res + " span" + first + "s_find svg {" + letter + " #" + whiteKeyColour + ";}" + res + " span" + first + "s_find svg path {fill: #" + id + ";}#a2a_menu_container{display:inline-block} #a2a_menu_container{_display:inline} " + | |
res + "_title_container {" + n + " 6px 8px;}" + res + "_find_container {" + name + ": 1px solid #" + id + ";" + name + "-radius: 6px;" + n + " 2px 24px 2px 0;position: relative;text-align: left;}" + first + "cols_container " + first + "col1{overflow-x:hidden;overflow-y:auto;-webkit-overflow-scrolling:touch}" + res + " input, " + res + ' input[type="text"]{display:block;background-image:none;box-shadow:none;line-height:100%;' + o + "0;overflow:hidden;" + n + "0;-moz-box-shadow:none;-webkit-box-shadow:none;-webkit-appearance:none} " + | |
res + "_title_container input" + res + "_title {" + letter + " #" + whiteKeyColour + ";" + name + ": 0;" + open + " #" + b + ";font: inherit;" + o + " 0;" + n + " 0;width: 99%;}" + res + "_find_container input" + res + "_find {" + letter + " transparent;_" + letter + " #" + whiteKeyColour + ";" + name + ": 0;" + open + " #" + b + ";font: inherit;font-size: 16px;height: 28px;line-height: 20px;left: 38px;outline: 0;" + n + " 2px 0;position: relative;width: 99%;}" + (typeof document.body.style.maxHeight != | |
"undefined" ? "" + first + "clear{clear:both}" : "" + first + "clear{clear:both;height:0;width:0;line-height:0;font-size:0}") + " " + first + "img {background:url(" + a2a.icons_img_url + ");" + name + ":0;line-height:16px}" + first + "img," + first + "svg {background-repeat:no-repeat;display:block;overflow:hidden;}" + first + "img{height:16px;line-height:16px;width:16px;}" + first + "svg{height:32px;line-height:32px;width:32px;}a" + first + "i,i" + first + "i{display:block;float:left;" + name + | |
":1px solid #" + whiteKeyColour + ";line-height:24px;" + n + "6px 8px;text-align:left;white-space:nowrap;overflow: hidden;text-overflow: ellipsis;width:132px;}a" + first + "i span,a" + first + "more span {display: inline-block;overflow: hidden;vertical-align: top;*vertical-align: middle; }a" + first + "i " + first + "img,a" + first + "i " + first + "svg {" + o + " 0 6px 0 0;}a" + first + "i " + first + "svg,a" + first + "more " + first + "svg {background-size: 24px;height:24px;line-height:24px;width:24px;}a" + | |
first + "sss:hover {" + name + "-left: 1px solid #" + index + ";}a" + res + "_show_more_less{" + name + "-bottom:1px solid #" + whiteKeyColour + ";" + name + "-left:0;" + name + "-right:0;line-height:24px;" + o + "6px 0 0;" + n + "6px}a" + res + "_show_more_less span{display:inline-block;height:24px;" + o + "0 6px 0 0;} " + first + "kit " + first + "svg { background-repeat: repeat; }" + first + "default_style a{float:left;line-height:16px;" + n + "0 2px}" + first + "default_style a:hover " + | |
first + "img," + first + "default_style a:hover " + first + "svg," + first + "floating_style a:hover " + first + "img," + first + "floating_style a:hover " + first + "svg {opacity: .7;}" + first + "default_style " + first + "count," + first + "default_style " + first + "svg," + first + "floating_style " + first + "svg," + first + "vertical_style " + first + "count," + res + " " + first + "svg {" + name + "-radius:4px ;}" + first + "default_style " + first + "img, " + first + "default_style " + | |
first + "dd, " + first + "default_style " + first + "svg { float:left;}" + first + "default_style " + first + "img_text{margin-right:4px}" + first + "default_style " + first + "divider{" + name + "-left:1px solid #000;display:inline;float:left;height:16px;line-height:16px;" + o + "0 5px}" + first + "kit a{cursor:pointer}" + first + "floating_style { " + letter + " #fff; " + name + "-radius: 6px; " + n + " 4px; position: fixed; z-index: 9999995;}" + first + "vertical_style a { clear: left;display: block; " + | |
n + " 4px;overflow: hidden;}" + first + "floating_style" + first + "default_style { bottom: 0; }" + first + "floating_style" + first + "default_style a { " + n + " 4px; }" + first + "count {" + letter + " #fff;" + name + ": 1px solid #ccc;box-sizing: " + name + "-box;" + open + " #2a2a2a;display: block;float: left;font: 12px Arial,Helvetica,sans-serif;height: 16px;margin-left: 4px;position: relative;text-align: center;width: 50px;}" + first + "count:before," + first + "count:after {" + name + | |
": solid transparent;" + name + '-width: 4px 4px 4px 0;content: "";height: 0;left: 0;line-height: 0;' + o + " -4px 0 0 -4px;position: absolute;top: 50%;width: 0;}" + first + "count:before {" + name + "-right-" + open + " #ccc;}" + first + "count:after {" + name + "-right-" + open + " #fff;margin-left: -3px;}" + first + "count span {-webkit-animation: a2aFadeIn .14s ease-in; animation: a2aFadeIn .14s ease-in;}" + first + "vertical_style " + first + "count {margin-left: 0;margin-top: 6px; }" + | |
first + "vertical_style " + first + "count:before," + first + "vertical_style " + first + "count:after {" + name + ": solid transparent;" + name + '-width: 0 4px 4px 4px;content: "";height: 0;left: 50%;line-height: 0;' + o + " -4px 0 0 -4px;position: absolute;top: 0;width: 0;}" + first + "vertical_style " + first + "count:before {" + name + "-bottom-" + open + " #ccc;}" + first + "vertical_style " + first + "count:after {" + name + "-bottom-" + open + " #fff;margin-top: -3px;}" + first + "nowrap{white-space:nowrap}" + | |
first + "note{" + o + "0 auto;" + n + "9px;font-size:12px;text-align:center}" + first + "note " + first + "note_note{" + o + "0;" + open + "#" + yyyy + "}" + first + "wide a{display:block;margin-top:3px;" + name + "-top:1px solid #" + method + ";text-align:center}iframe" + first + "shim {" + letter + " transparent;" + name + ': 0;bottom: 0;filter: alpha(opacity=0); height: 100%;left: 0;right: 0;top: 0;position: absolute;width: 100%;z-index: 9999996;_height: expression( ((e=document.documentElement.clientHeight)?e:document.body.clientHeight)+"px" ); _width: expression( ((e=document.documentElement.clientWidth)?e:document.body.clientWidth)+"px" ); }' + | |
first + "dd img {" + name + ':0;-ms-touch-action:manipulation;}iframe[id^="PIN_"][id$="_nag"] {display: none !important;}' + value + "a2a" + news_source + "0!important}" + value + "a2a_sm" + news_source + "-17" + tval + "agregator" + news_source + "-34" + tval + "aim" + news_source + "-51" + tval + "amazon" + news_source + "-68" + tval + "aol" + news_source + "-85" + tval + "app_net" + news_source + "-102" + tval + "baidu" + news_source + "-119" + tval + "balatarin" + news_source + "-136" + tval + | |
"behance" + news_source + "-153" + tval + "bibsonomy" + news_source + "-170" + tval + "bitty" + news_source + "-187" + tval + "blinklist" + news_source + "-204" + tval + "blogger" + news_source + "-221" + tval + "blogmarks" + news_source + "-238" + tval + "bookmark" + news_source + "-255" + tval + "bookmarks_fr" + news_source + "-272" + tval + "box" + news_source + "-289" + tval + "buddymarks" + news_source + "-306" + tval + "buffer" + news_source + "-323" + tval + "care2" + news_source + "-340" + | |
tval + "chrome" + news_source + "-357" + tval + "citeulike" + news_source + "-374" + tval + "dailyrotation" + news_source + "-391" + tval + "default" + news_source + "-408" + tval + "delicious" + news_source + "-425" + tval + "designfloat" + news_source + "-442" + tval + "diary_ru" + news_source + "-459" + tval + "diaspora" + news_source + "-476" + tval + "digg" + news_source + "-493" + tval + "dihitt" + news_source + "-510" + tval + "diigo" + news_source + "-527" + tval + "dzone" + news_source + | |
"-544" + tval + "email" + news_source + "-561" + tval + "evernote" + news_source + "-578" + tval + "facebook" + news_source + "-595" + tval + "fark" + news_source + "-612" + tval + "feed" + news_source + "-629" + tval + "feedblitz" + news_source + "-646" + tval + "feedbucket" + news_source + "-663" + tval + "feedly" + news_source + "-680" + tval + "feedmailer" + news_source + "-697" + tval + "find" + news_source + "-714" + tval + "firefox" + news_source + "-731" + tval + "flickr" + news_source + | |
"-748" + tval + "flipboard" + news_source + "-765" + tval + "folkd" + news_source + "-782" + tval + "foursquare" + news_source + "-799" + tval + "gmail" + news_source + "-816" + tval + "google" + news_source + "-833" + tval + "google_plus" + news_source + "-850" + tval + "hatena" + news_source + "-867" + tval + "instagram" + news_source + "-884" + tval + "instapaper" + news_source + "-901" + tval + "itunes" + news_source + "-918" + tval + "jamespot" + news_source + "-935" + tval + "kakao" + news_source + | |
"-952" + tval + "kindle" + news_source + "-969" + tval + "klipfolio" + news_source + "-986" + tval + "known" + news_source + "-1003" + tval + "line" + news_source + "-1020" + tval + "linkedin" + news_source + "-1037" + tval + "livejournal" + news_source + "-1054" + tval + "mail_ru" + news_source + "-1071" + tval + "mendeley" + news_source + "-1088" + tval + "meneame" + news_source + "-1105" + tval + "miro" + news_source + "-1122" + tval + "mixi" + news_source + "-1139" + tval + "myspace" + news_source + | |
"-1156" + tval + "netlog" + news_source + "-1173" + tval + "netvibes" + news_source + "-1190" + tval + "netvouz" + news_source + "-1207" + tval + "newsalloy" + news_source + "-1224" + tval + "newsisfree" + news_source + "-1241" + tval + "newsvine" + news_source + "-1258" + tval + "nujij" + news_source + "-1275" + tval + "odnoklassniki" + news_source + "-1292" + tval + "oknotizie" + news_source + "-1309" + tval + "oldreader" + news_source + "-1326" + tval + "outlook_com" + news_source + "-1343" + | |
tval + "pinboard" + news_source + "-1360" + tval + "pinterest" + news_source + "-1377" + tval + "plurk" + news_source + "-1394" + tval + "pocket" + news_source + "-1411" + tval + "podnova" + news_source + "-1428" + tval + "print" + news_source + "-1445" + tval + "printfriendly" + news_source + "-1462" + tval + "protopage" + news_source + "-1479" + tval + "pusha" + news_source + "-1496" + tval + "qzone" + news_source + "-1513" + tval + "reddit" + news_source + "-1530" + tval + "rediff" + news_source + | |
"-1547" + tval + "renren" + news_source + "-1564" + tval + "segnalo" + news_source + "-1581" + tval + "share" + news_source + "-1598" + tval + "sina_weibo" + news_source + "-1615" + tval + "sitejot" + news_source + "-1632" + tval + "slashdot" + news_source + "-1649" + tval + "stumbleupon" + news_source + "-1666" + tval + "stumpedia" + news_source + "-1683" + tval + "svejo" + news_source + "-1700" + tval + "symbaloo" + news_source + "-1717" + tval + "thefreedictionary" + news_source + "-1734" + | |
tval + "thefreelibrary" + news_source + "-1751" + tval + "tuenti" + news_source + "-1768" + tval + "tumblr" + news_source + "-1785" + tval + "twiddla" + news_source + "-1802" + tval + "twitter" + news_source + "-1819" + tval + "typepad" + news_source + "-1836" + tval + "viadeo" + news_source + "-1853" + tval + "vimeo" + news_source + "-1870" + tval + "vk" + news_source + "-1887" + tval + "wanelo" + news_source + "-1904" + tval + "webnews" + news_source + "-1921" + tval + "whatsapp" + news_source + | |
"-1938" + tval + "winksite" + news_source + "-1955" + tval + "wordpress" + news_source + "-1972" + tval + "wykop" + news_source + "-1989" + tval + "xing" + news_source + "-2006" + tval + "y18" + news_source + "-2023" + tval + "yahoo" + news_source + "-2040" + tval + "yim" + news_source + "-2057" + tval + "yoolink" + news_source + "-2074" + tval + "youmob" + news_source + "-2091" + tval + "youtube" + news_source + "-2108" + tval + "yummly" + news_source + "-2125" + sum + ""; | |
sheet.setAttribute("type", "text/css"); | |
a2a.head_tag.appendChild(sheet); | |
if (sheet.styleSheet) { | |
/** @type {string} */ | |
sheet.styleSheet.cssText = str; | |
} else { | |
/** @type {Text} */ | |
i = document.createTextNode(str); | |
sheet.appendChild(i); | |
} | |
}, | |
/** | |
* @return {undefined} | |
*/ | |
svg_css : function() { | |
/** @type {Window} */ | |
var w = window; | |
var compiled = a2a.fix_icons; | |
/** @type {Array} */ | |
var groups = ["icons.14.svg.css", "icons.14.png.css", "icons.14.old.css"]; | |
var svg = a2a.svg_works(); | |
/** | |
* @param {boolean} data | |
* @return {undefined} | |
*/ | |
var load = function(data) { | |
/** @type {Element} */ | |
var el = w.document.createElement("link"); | |
/** @type {string} */ | |
var prefix = (a2a.c.ssl ? a2a.c.ssl : "http://static.addtoany.com/menu") + "/svg/"; | |
/** @type {string} */ | |
el.rel = "stylesheet"; | |
el.href = prefix + groups[data && svg ? 0 : data ? 1 : 2]; | |
a2a.head_tag.appendChild(el); | |
compiled(); | |
}; | |
var datauri = new w.Image; | |
/** | |
* @return {undefined} | |
*/ | |
datauri.onerror = function() { | |
load(false); | |
}; | |
/** | |
* @return {undefined} | |
*/ | |
datauri.onload = function() { | |
load(datauri.width === 1 && datauri.height === 1); | |
}; | |
/** @type {string} */ | |
datauri.src = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw=="; | |
a2a.svg_css = compiled; | |
}, | |
/** | |
* @return {?} | |
*/ | |
svg_works : function() { | |
/** @type {Window} */ | |
var w = window; | |
/** @type {boolean} */ | |
var svg_works = !!w.document.createElementNS && (!!w.document.createElementNS("http://www.w3.org/2000/svg", "svg").createSVGRect && (!!document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#Image", "1.1") && !(w.opera && navigator.userAgent.indexOf("Chrome") === -1))); | |
/** | |
* @return {?} | |
*/ | |
a2a.svg_works = function() { | |
return svg_works; | |
}; | |
return svg_works; | |
}, | |
/** | |
* @param {string} name | |
* @param {string} variables | |
* @param {Object} recurring | |
* @param {Object} outstandingDataSize | |
* @param {string} mayParseLabeledStatementInstead | |
* @param {string} dataAndEvents | |
* @return {?} | |
*/ | |
make_service : function(name, variables, recurring, outstandingDataSize, mayParseLabeledStatementInstead, dataAndEvents) { | |
/** @type {Element} */ | |
var self = document.createElement("a"); | |
var c = a2a.c; | |
/** | |
* @return {undefined} | |
*/ | |
var onEvent = function() { | |
a2a.linker(this); | |
}; | |
var type = a2a.type; | |
outstandingDataSize = outstandingDataSize || {}; | |
var elem; | |
var cl = c.icon_color; | |
/** @type {string} */ | |
self.rel = "nofollow"; | |
/** @type {string} */ | |
self.className = "a2a_i"; | |
/** @type {string} */ | |
self.href = "/"; | |
/** @type {string} */ | |
self.target = "_blank"; | |
/** @type {function (): undefined} */ | |
self.onmousedown = onEvent; | |
/** @type {function (): undefined} */ | |
self.onkeydown = onEvent; | |
self.a2a = {}; | |
/** @type {string} */ | |
self.a2a.safename = variables; | |
/** @type {string} */ | |
self.a2a.servicename = name; | |
self.a2a.serviceNameLowerCase = name.toLowerCase(); | |
/** @type {Object} */ | |
self.a2a.serviceIcon = recurring; | |
self.a2a.serviceType = outstandingDataSize.type; | |
/** @type {string} */ | |
self.innerHTML = "<span></span>" + name; | |
/** @type {(Node|null)} */ | |
elem = self.firstChild; | |
if (outstandingDataSize.type) { | |
self.a2a.stype = outstandingDataSize.type; | |
} | |
if (outstandingDataSize.src) { | |
self.a2a.js_src = outstandingDataSize.src; | |
} | |
if (outstandingDataSize.pu) { | |
/** @type {number} */ | |
self.a2a.popup = 1; | |
} | |
if (mayParseLabeledStatementInstead) { | |
/** @type {string} */ | |
self.a2a.customserviceuri = mayParseLabeledStatementInstead; | |
} | |
if (dataAndEvents) { | |
/** @type {string} */ | |
elem.style.backgroundImage = "url(" + dataAndEvents + ")"; | |
/** @type {string} */ | |
elem.className = "a2a_svg a2a_s__default"; | |
} else { | |
if (cl && a2a.svg_works()) { | |
/** @type {string} */ | |
elem.className = "a2a_svg a2a_w__default a2a_w_" + recurring; | |
elem.style.backgroundColor = cl; | |
} else { | |
if (recurring) { | |
/** @type {string} */ | |
elem.className = "a2a_svg a2a_s__default a2a_s_" + recurring; | |
} else { | |
/** @type {string} */ | |
elem.className = "a2a_svg a2a_s__default"; | |
} | |
} | |
} | |
a2a.add_event(self, "click", function(ev) { | |
var params = a2a["n" + a2a.n]; | |
var defaults = { | |
node : self, | |
service : name, | |
title : params.linkname, | |
url : params.linkurl | |
}; | |
var options = a2a.cbs("share", defaults); | |
if (typeof options != "undefined") { | |
if (options.url) { | |
params.linkurl = options.url; | |
/** @type {boolean} */ | |
params.linkurl_implicit = false; | |
} | |
if (options.title) { | |
params.linkname = options.title; | |
/** @type {boolean} */ | |
params.linkname_implicit = false; | |
} | |
a2a.linker(self); | |
if (options.stop) { | |
a2a.preventDefault(ev); | |
} | |
} | |
}); | |
a2a.add_event(self, "click", function(ev) { | |
/** @type {function (string): string} */ | |
var escape = encodeURIComponent; | |
var suite = a2a["n" + a2a.n]; | |
/** @type {string} */ | |
var task = type == "page" ? "pages" : "subscriptions"; | |
/** @type {string} */ | |
var category = type == "page" ? "AddToAny Share/Save Button" : "AddToAny Subscribe Button"; | |
var winHeight = screen.height; | |
/** @type {number} */ | |
var s = 550; | |
/** @type {number} */ | |
var height = 450; | |
/** @type {string} */ | |
var r20 = "event=service_click&url=" + escape(location.href) + "&title=" + escape(document.title || "") + "&ev_service=" + escape(variables) + "&ev_service_type=menu&ev_menu_type=" + type + "&ev_url=" + escape(suite.linkurl) + "&ev_title=" + escape(suite.linkname).replace(/'/g, "%27"); | |
if (self.a2a.popup && !a2a.defaultPrevented(ev)) { | |
a2a.preventDefault(ev); | |
window.open(self.href, "_blank", "toolbar=0,personalbar=0,resizable,scrollbars,status,width=550,height=450,top=" + (winHeight > height ? Math.round(winHeight / 2 - height / 2) : 40) + ",left=" + Math.round(screen.width / 2 - s / 2)); | |
} | |
a2a.util_frame_post(type, r20); | |
a2a.GA.track(name, variables, suite.linkurl, task, category); | |
}); | |
return self; | |
}, | |
/** | |
* @return {?} | |
*/ | |
i18n : function() { | |
if (a2a.c.static_server != (a2a.c.ssl ? a2a.c.ssl : "http://static.addtoany.com/menu")) { | |
return false; | |
} | |
/** @type {Array} */ | |
var value = ["ar", "id", "ms", "bn", "bs", "bg", "ca", "ca-AD", "ca-ES", "cs", "cy", "da", "de", "dv", "el", "et", "es", "es-AR", "es-VE", "eo", "en-US", "eu", "fa", "fr", "fr-CA", "gd", "he", "hi", "hr", "is", "it", "ja", "ko", "ku", "lv", "lt", "li", "hu", "mk", "nl", "no", "pl", "pt", "pt-BR", "pt-PT", "ro", "ru", "sr", "fi", "sk", "sl", "sv", "ta", "te", "tr", "uk", "vi", "zh-CN", "zh-TW"]; | |
var key = a2a.c.locale || (navigator.browserLanguage || navigator.language).toLowerCase(); | |
var ret = a2a.in_array(key, value, true); | |
if (!ret) { | |
var index = key.indexOf("-"); | |
if (index != -1) { | |
ret = a2a.in_array(key.substr(0, index), value, true); | |
} | |
} | |
if (key != "en-us" && ret) { | |
return ret; | |
} else { | |
return false; | |
} | |
} | |
}; | |
a2a.c = a2a_config; | |
/** | |
* @param {string} keepData | |
* @return {undefined} | |
*/ | |
a2a.make_once = function(keepData) { | |
a2a.type = a2a.c.menu_type || keepData; | |
if (!a2a[a2a.type] && !window["a2a" + a2a.type + "_init"]) { | |
a2a[a2a.type] = {}; | |
window.a2a_show_dropdown = a2a.show_menu; | |
window.a2a_onMouseOut_delay = a2a.onMouseOut_delay; | |
window.a2a_init = a2a.init; | |
/** | |
* @param {?} originalType | |
* @param {Object} result | |
* @return {undefined} | |
*/ | |
a2a["create_" + a2a.type + "_dropdown"] = function(originalType, result) { | |
var getById = a2a.gEl; | |
var value = a2a.type = originalType; | |
/** @type {string} */ | |
var tval = "a2a" + value; | |
var ctx = a2a.c; | |
var ffversion = a2a.ieo(); | |
var s; | |
/** @type {Element} */ | |
var cell = document.createElement("i"); | |
var shadowDiv; | |
var l; | |
var element; | |
/** @type {Element} */ | |
var ap = document.createElement("a"); | |
var name = ctx.icon_color; | |
/** @type {string} */ | |
var x = name && a2a.svg_works() ? "a2a_svg a2a_w__default a2a_w_" : "a2a_svg a2a_s__default a2a_s_"; | |
/** @type {string} */ | |
var nameSuffix = name ? ' style="background-color:' + name + '"' : ""; | |
var kids = ctx.localize; | |
a2a.css(); | |
kids = ctx.localize = { | |
Share : kids.Share || "Share", | |
Save : kids.Save || "Save", | |
Subscribe : kids.Subscribe || "Subscribe", | |
Email : kids.Email || "Email", | |
Bookmark : kids.Bookmark || "Bookmark", | |
ShowAll : kids.ShowAll || "Show all", | |
ShowLess : kids.ShowLess || "Show less", | |
FindAnyServiceToAddTo : kids.FindAnyServiceToAddTo || "Find any service", | |
PoweredBy : kids.PoweredBy || "By", | |
AnyEmail : "Any email", | |
ShareViaEmail : kids.ShareViaEmail || "Share via email", | |
SubscribeViaEmail : kids.SubscribeViaEmail || "Subscribe via email", | |
BookmarkInYourBrowser : kids.BookmarkInYourBrowser || "Bookmark in your browser", | |
BookmarkInstructions : kids.BookmarkInstructions || "Press Ctrl+D or ⌘+D to bookmark this page", | |
AddToYourFavorites : kids.AddToYourFavorites || "Add to Favorites", | |
SendFromWebOrProgram : kids.SendFromWebOrProgram || "Send from any other email service", | |
EmailProgram : kids.EmailProgram || "Email application", | |
More : kids.More || "More…" | |
}; | |
/** @type {string} */ | |
var xhtml = '<div class="a2a_overlay" id="a2a' + value + '_overlay"></div><div class="a2a_menu a2a_full" id="a2a' + value + '_full" role="dialog" tabindex="-1" aria-label="' + (value == "feed" ? kids.Subscribe : kids.Share) + '"><div class="a2a_full_header"><div id="a2a' + value + '_find_container" class="a2a_menu_find_container"><input id="a2a' + value + '_find" class="a2a_menu_find" type="text" onclick="a2a.focus_find()" onkeyup="a2a.do_find()" autocomplete="off" title="' + kids.FindAnyServiceToAddTo + | |
'"/><span id="a2a' + value + '_find_icon" class="a2a_svg a2a_s_find" onclick="a2a.focus_find()"><svg focusable="false" xmlns="http://www.w3.org/2000/svg" version="1.1" x="0" y="0" width="24" height="24" viewBox="0 0 24 24" enable-background="new 0 0 24 24" xml:space="preserve"><path fill="#CCCCCC" d="M19.7 18.2l-4.5-4.5c0.7-1.1 1.2-2.3 1.2-3.6 0-3.5-2.8-6.3-6.3-6.3 -3.5 0-6.3 2.8-6.3 6.3 0 3.5 2.8 6.3 6.3 6.3 1.4 0 2.6-0.4 3.6-1.2l4.5 4.5c0.6 0.6 1.3 0.7 1.7 0.2C20.4 19.5 20.3 18.8 19.7 18.2zM10.1 14.6c-2.5 0-4.5-2.1-4.5-4.5 0-2.5 2.1-4.5 4.5-4.5 2.5 0 4.5 2.1 4.5 4.5C14.6 12.5 12.6 14.6 10.1 14.6z"/></svg></span></div></div><div class="a2a_full_services" id="a2a' + | |
value + '_full_services" role="presentation"></div><div class="a2a_full_footer"><a href="https://www.addtoany.com" title="Share Buttons" target="_blank"><span class="' + x + 'a2a"' + nameSuffix + '></span>AddToAny</a></div></div><div id="a2a' + value + '_dropdown" class="a2a_menu a2a_mini" onmouseover="a2a.onMouseOver_stay()"' + (a2a[value].onclick ? "" : ' onmouseout="a2a.onMouseOut_delay()"') + ' tabindex="-1" aria-label="' + (value == "feed" ? kids.Subscribe : kids.Share) + '" style="display:none"><div id="a2a' + | |
value + '_title_container" class="a2a_menu_title_container"' + (a2a[value].show_title ? "" : ' style="display:none"') + '><input id="a2a' + value + '_title" class="a2a_menu_title"/></div><div class="a2a_mini_services" id="a2a' + value + '_mini_services"></div>'; | |
xhtml += '<div id="a2a' + value + '_cols_container" class="a2a_cols_container"><div class="a2a_col1" id="a2a' + value + '_col1"' + (value == "mail" ? ' style="display:none"' : "") + '></div><div id="a2a' + value + '_2_col1"' + (value != "mail" ? ' style="display:none"' : "") + '></div><div class="a2a_clear"></div></div>'; | |
if (value != "mail") { | |
xhtml += '<div class="a2a' + value + '_wide a2a_wide"><a href="" id="a2a' + value + '_show_more_less" class="a2a_menu_show_more_less a2a_more" title="' + kids.ShowAll + '"><span class="' + x + 'a2a"' + nameSuffix + "></span>" + kids.More + "</a></div>"; | |
} | |
xhtml += "</div>"; | |
/** @type {string} */ | |
var key = "a2a_menu_container"; | |
var e = getById(key) || document.createElement("div"); | |
a2a.add_event(e, "mouseup", a2a.stopPropagation); | |
a2a.add_event(e, "mousedown", a2a.stopPropagation); | |
a2a.add_event(e, "touchstart", a2a.stopPropagation); | |
a2a.add_event(e, "touchend", a2a.stopPropagation); | |
a2a.add_event(e, "MSPointerDown", a2a.stopPropagation); | |
a2a.add_event(e, "MSPointerUp", a2a.stopPropagation); | |
/** @type {string} */ | |
e.innerHTML = xhtml; | |
if (e.id != key) { | |
/** @type {string} */ | |
e.style.position = "static"; | |
if (ffversion && ffversion < 9) { | |
document.body.insertBefore(e, document.body.firstChild); | |
} else { | |
document.body.insertBefore(e, null); | |
} | |
} | |
/** @type {RegExp} */ | |
var regex = new RegExp("[\\?&]awesm=([^&#]*)"); | |
/** @type {(Array.<string>|null)} */ | |
var colorArray = regex.exec(window.location.href); | |
if (colorArray != null) { | |
/** @type {string} */ | |
ctx.awesm = colorArray[1]; | |
} else { | |
/** @type {boolean} */ | |
ctx.awesm = false; | |
} | |
var getDirection = a2a.make_service; | |
if (value != "mail") { | |
/** @type {number} */ | |
var i = 0; | |
var context = result.most; | |
var j = context.length; | |
/** @type {number} */ | |
var numGuis = parseInt(a2a[value].num_services); | |
var reversed = a2a[value].exclude_services; | |
for (;i < j;i++) { | |
var item = context[i]; | |
if (!reversed || !a2a.in_array(item[1], reversed, true)) { | |
getById(tval + "_full_services").appendChild(getDirection(item[0], item[1], item[2], item[3])); | |
} | |
if (i < numGuis && (!reversed || !a2a.in_array(item[1], reversed, true))) { | |
getById(tval + "_mini_services").appendChild(getDirection(item[0], item[1], item[2], item[3])); | |
} | |
} | |
} | |
s = getById(tval + "_full_services"); | |
/** @type {string} */ | |
cell.className = "a2a_i"; | |
/** @type {Element} */ | |
shadowDiv = cell.cloneNode(); | |
s.appendChild(cell); | |
s.appendChild(shadowDiv); | |
/** @type {number} */ | |
i = 0; | |
var values = result.email; | |
var valuesLen = values.length; | |
for (;i < valuesLen;i++) { | |
item = values[i]; | |
if (!reversed || !a2a.in_array(item[1], reversed, true)) { | |
getById(tval + "_2_col1").appendChild(getDirection(item[0], item[1], item[2], item[3])); | |
} | |
} | |
if (value != "feed") { | |
var bodyElem = getDirection(kids.AnyEmail, "email_form", "email", null, "http://www.addtoany.com/email?linkurl=A2A_LINKURL_ENC&linkname=A2A_LINKNAME_ENC"); | |
/** @type {string} */ | |
bodyElem.className = "a2a_i a2a_emailer"; | |
/** @type {string} */ | |
bodyElem.id = "a2a" + value + "_any_email"; | |
getById(tval + "_2_col1").appendChild(bodyElem); | |
var li = getDirection("Email (mailto)", "email_form", "email", null, "mailto:?subject=A2A_LINKNAME_ENC&body=A2A_LINKURL_ENC"); | |
/** @type {string} */ | |
li.className = "a2a_i a2a_emailer a2a_email_client"; | |
/** @type {string} */ | |
li.id = "a2a" + value + "_email_client"; | |
/** @type {string} */ | |
li.innerHTML = '<span class="' + x + 'email"' + nameSuffix + "></span>Email app"; | |
/** @type {string} */ | |
li.target = ""; | |
getById(tval + "_2_col1").appendChild(li); | |
} | |
a2a[value].services = result.most.concat(result.email); | |
if (value != "mail") { | |
a2a.fast_click.make(getById(tval + "_overlay"), function(dataAndEvents) { | |
a2a.hide_full(value); | |
}); | |
a2a.fast_click.make(getById(tval + "_show_more_less"), function(ev) { | |
a2a.preventDefault(ev); | |
a2a.show_more_less(0); | |
}); | |
} | |
a2a.arrange_services(); | |
a2a.util_frame_listen(value); | |
a2a.collections(value); | |
a2a.default_services(); | |
if (value != "mail") { | |
element = getById(tval + "_find"); | |
/** | |
* @param {Event} event | |
* @return {?} | |
*/ | |
element.onkeydown = function(event) { | |
event = event || window.event; | |
var S = event.which || event.keyCode; | |
var networkState = a2a.type; | |
if (S == 13) { | |
/** @type {number} */ | |
var i = 0; | |
var codeSegments = a2a[networkState].main_services; | |
var valuesLen = codeSegments.length; | |
var iframe; | |
for (;i < valuesLen;i++) { | |
iframe = codeSegments[i]; | |
if (iframe.style.display != "none") { | |
iframe.focus(); | |
return false; | |
} | |
} | |
} else { | |
if (S == 27) { | |
if (element.value == "") { | |
element.blur(); | |
} | |
/** @type {string} */ | |
element.value = ""; | |
a2a.do_find(); | |
} | |
} | |
}; | |
if (navigator.userAgent.match(/iPhone|iPad|iPod/i)) { | |
element.addEventListener("touchstart", element.focus, false); | |
} | |
} | |
}; | |
var $scope = {}; | |
$scope.page = { | |
most : [["Facebook", "facebook", "facebook", { | |
pu : 1 | |
}], ["Twitter", "twitter", "twitter", { | |
pu : 1 | |
}], ["Google+", "google_plus", "google_plus", { | |
pu : 1 | |
}], ["Pinterest", "pinterest", "pinterest", { | |
type : "js", | |
src : "https://static.addtoany.com/menu/pinmarklet.js" | |
}], ["Email", "email", "email"], ["LinkedIn", "linkedin", "linkedin", { | |
pu : 1 | |
}], ["Reddit", "reddit", "reddit"], ["Tumblr", "tumblr", "tumblr", { | |
pu : 1 | |
}], ["WordPress", "wordpress", "wordpress"], ["StumbleUpon", "stumbleupon", "stumbleupon"], ["Google Gmail", "google_gmail", "gmail", { | |
type : "email", | |
pu : 1 | |
}], ["WhatsApp", "whatsapp", "whatsapp"], ["AIM", "aim", "aim"], ["Amazon Wish List", "amazon_wish_list", "amazon"], ["AOL Mail", "aol_mail", "aol", { | |
type : "email", | |
pu : 1 | |
}], ["App.net", "app_net", "app_net"], ["Baidu", "baidu", "baidu"], ["Balatarin", "balatarin", "balatarin"], ["BibSonomy", "bibsonomy", "bibsonomy"], ["Bitty Browser", "bitty_browser", "bitty"], ["Blinklist", "blinklist", "blinklist"], ["Blogger Post", "blogger_post", "blogger"], ["BlogMarks", "blogmarks", "blogmarks"], ["Bookmarks.fr", "bookmarks_fr", "bookmarks_fr"], ["Box.net", "box_net", "box"], ["BuddyMarks", "buddymarks", "buddymarks"], ["Buffer", "buffer", "buffer"], ["Care2 News", "care2_news", | |
"care2"], ["CiteULike", "citeulike", "citeulike"], ["Delicious", "delicious", "delicious"], ["Design Float", "design_float", "designfloat"], ["Diary.Ru", "diary_ru", "diary_ru"], ["Diaspora", "diaspora", "diaspora"], ["Digg", "digg", "digg"], ["diHITT", "dihitt", "dihitt"], ["Diigo", "diigo", "diigo"], ["DZone", "dzone", "dzone"], ["Evernote", "evernote", "evernote"], ["Fark", "fark", "fark"], ["Flipboard", "flipboard", "flipboard", { | |
pu : 1 | |
}], ["Folkd", "folkd", "folkd"], ["Google Bookmarks", "google_bookmarks", "google"], ["Hacker News", "hacker_news", "y18"], ["Hatena", "hatena", "hatena"], ["Instapaper", "instapaper", "instapaper"], ["Jamespot", "jamespot", "jamespot"], ["Kakao", "kakao", "kakao", { | |
pu : 1 | |
}], ["Kindle It", "kindle_it", "kindle"], ["Known", "known", "known"], ["Line", "line", "line"], ["LiveJournal", "livejournal", "livejournal"], ["Mail.Ru", "mail_ru", "mail_ru"], ["Mendeley", "mendeley", "mendeley"], ["Meneame", "meneame", "meneame"], ["Mixi", "mixi", "mixi"], ["MySpace", "myspace", "myspace"], ["Netlog", "netlog", "netlog"], ["Netvouz", "netvouz", "netvouz"], ["NewsVine", "newsvine", "newsvine"], ["NUjij", "nujij", "nujij"], ["Odnoklassniki", "odnoklassniki", "odnoklassniki"], | |
["Oknotizie", "oknotizie", "oknotizie"], ["Outlook.com", "outlook_com", "outlook_com", { | |
type : "email" | |
}], ["Pinboard", "pinboard", "pinboard", { | |
pu : 1 | |
}], ["Plurk", "plurk", "plurk"], ["Pocket", "pocket", "pocket"], ["Print", "print", "print", { | |
type : "js", | |
src : "javascript:print()" | |
}], ["PrintFriendly", "printfriendly", "printfriendly"], ["Protopage Bookmarks", "protopage_bookmarks", "protopage"], ["Pusha", "pusha", "pusha"], ["Qzone", "qzone", "qzone"], ["Rediff MyPage", "rediff", "rediff"], ["Renren", "renren", "renren", { | |
pu : 1 | |
}], ["Segnalo", "segnalo", "segnalo"], ["Sina Weibo", "sina_weibo", "sina_weibo"], ["SiteJot", "sitejot", "sitejot"], ["Slashdot", "slashdot", "slashdot"], ["Stumpedia", "stumpedia", "stumpedia"], ["Svejo", "svejo", "svejo"], ["Symbaloo Feeds", "symbaloo_feeds", "symbaloo"], ["Tuenti", "tuenti", "tuenti"], ["Twiddla", "twiddla", "twiddla"], ["TypePad Post", "typepad_post", "typepad"], ["Viadeo", "viadeo", "viadeo", { | |
pu : 1 | |
}], ["VK", "vk", "vk"], ["Wanelo", "wanelo", "wanelo"], ["Webnews", "webnews", "webnews"], ["Wykop", "wykop", "wykop"], ["XING", "xing", "xing", { | |
pu : 1 | |
}], ["Yahoo Bookmarks", "yahoo_bookmarks", "yahoo"], ["Yahoo Mail", "yahoo_mail", "yahoo", { | |
type : "email" | |
}], ["Yahoo Messenger", "yahoo_messenger", "yim"], ["Yoolink", "yoolink", "yoolink"], ["YouMob", "youmob", "youmob"], ["Yummly", "yummly", "yummly", { | |
type : "js", | |
src : "https://www.yummly.com/js/yumlet.js" | |
}]], | |
email : [["Google Gmail", "google_gmail", "gmail", { | |
type : "email", | |
pu : 1 | |
}], ["AOL Mail", "aol_mail", "aol", { | |
type : "email", | |
pu : 1 | |
}], ["Outlook.com", "outlook_com", "outlook_com", { | |
type : "email" | |
}], ["Yahoo Mail", "yahoo_mail", "yahoo", { | |
type : "email" | |
}]] | |
}; | |
$scope.feed = { | |
most : [["Feed", "feed", "feed"], ["Feedly", "feedly", "feedly"], ["My Yahoo", "my_yahoo", "yahoo"], ["FeedBlitz", "feedblitz", "feedblitz", { | |
type : "email" | |
}], ["AOL Reader", "my_aol", "aol"], ["Netvibes", "netvibes", "netvibes"], ["The Free Dictionary", "the_free_dictionary", "thefreedictionary"], ["The Old Reader", "oldreader", "oldreader"], ["Protopage News Feeds", "protopage_news_feeds", "protopage"], ["Agregator", "agregator", "agregator"], ["Bitty Browser Preview", "bitty_browser_preview", "bitty"], ["Daily Rotation", "daily_rotation", "dailyrotation"], ["Feed Mailer", "feed_mailer", "feedmailer"], ["FeedBucket", "feedbucket", "feedbucket"], | |
["iTunes", "itunes", "itunes"], ["KlipFolio", "klipfolio", "klipfolio"], ["Miro", "miro", "miro"], ["NewsAlloy", "newsalloy", "newsalloy"], ["NewsIsFree", "newsisfree", "newsisfree"], ["Outlook", "outlook", "outlook_com"], ["PodNova", & |