github-buttons
Advanced tools
Comparing version 2.0.5 to 2.1.0
/*! | ||
* github-buttons v2.0.5 | ||
* github-buttons v2.1.0 | ||
* (c) 2019 なつき | ||
@@ -20,72 +20,71 @@ * @license BSD-2-Clause | ||
var createElement = function(tag) { | ||
return document.createElement(tag); | ||
}; | ||
var HTMLElement = window.HTMLElement; | ||
var name = "github-buttons"; | ||
var version = "2.0.5"; | ||
var XMLHttpRequest = window.XMLHttpRequest; | ||
var apiBaseURL, iframeURL; | ||
/* istanbul ignore next */ | ||
iframeURL = (/^http:/.test(location) ? "http" : "https") + "://" + ("unpkg.com/" + name + "@" + version + "/dist") + "/buttons.html"; | ||
apiBaseURL = "https://api.github.com"; | ||
var parseOptions = function(anchor) { | ||
var attribute, i, len, options, ref; | ||
options = { | ||
"href": anchor.href, | ||
"title": anchor.title, | ||
"aria-label": anchor.getAttribute("aria-label") | ||
}; | ||
ref = ["icon", "text", "size", "show-count"]; | ||
for (i = 0, len = ref.length; i < len; i++) { | ||
attribute = ref[i]; | ||
attribute = "data-" + attribute; | ||
options[attribute] = anchor.getAttribute(attribute); | ||
var createElementInDocument = function (document) { | ||
return function (tag, props, children) { | ||
var el = document.createElement(tag); | ||
if (props) { | ||
for (var prop in props) { | ||
var val = props[prop]; | ||
if (val != null) { | ||
if (el[prop] != null) { | ||
el[prop] = val; | ||
} else { | ||
el.setAttribute(prop, val); | ||
} | ||
} | ||
} | ||
} | ||
if (children) { | ||
for (var i = 0, len = children.length; i < len; i++) { | ||
var child = children[i]; | ||
el.appendChild(typeof child === 'string' ? document.createTextNode(child) : child); | ||
} | ||
} | ||
return el | ||
} | ||
if (options["data-text"] == null) { | ||
options["data-text"] = anchor.textContent || anchor.innerText; | ||
} | ||
return options; | ||
}; | ||
var stringify = function(obj) { | ||
var name, params, value; | ||
params = []; | ||
for (name in obj) { | ||
value = obj[name]; | ||
if (value != null) { | ||
params.push((encodeURIComponent(name)) + "=" + (encodeURIComponent(value))); | ||
var createElement = createElementInDocument(document); | ||
var dispatchOnce = function (func) { | ||
var onceToken = 0; | ||
return function () { | ||
if (!onceToken && (onceToken = 1)) { | ||
func.apply(this, arguments); | ||
} | ||
} | ||
return params.join("&"); | ||
}; | ||
var onEvent, onceEvent; | ||
var name = "github-buttons"; | ||
var version = "2.1.0"; | ||
onEvent = function(target, eventName, func) { | ||
var iframeURL = (/* istanbul ignore next */ /^http:/.test(location) ? 'http' : 'https') + '://' + (/* istanbul ignore next */ 'unpkg.com/' + name + '@' + version + '/dist') + '/buttons.html'; | ||
var apiBaseURL = 'https://api.github.com'; | ||
var useShadowDOM = HTMLElement && HTMLElement.prototype.attachShadow && !HTMLElement.prototype.attachShadow.prototype; | ||
var useXHR = XMLHttpRequest && XMLHttpRequest.prototype && 'withCredentials' in XMLHttpRequest.prototype; | ||
var onEvent = function (target, eventName, func) { | ||
/* istanbul ignore else: IE lt 9 */ | ||
if (target.addEventListener) { | ||
target.addEventListener("" + eventName, func); | ||
target.addEventListener(eventName, func); | ||
} else { | ||
target.attachEvent("on" + eventName, func); | ||
target.attachEvent('on' + eventName, func); | ||
} | ||
}; | ||
onceEvent = function(target, eventName, func) { | ||
var callback; | ||
callback = function(event) { | ||
var onceEvent = function (target, eventName, func) { | ||
var callback = function (event) { | ||
/* istanbul ignore else: IE lt 9 */ | ||
if (target.removeEventListener) { | ||
target.removeEventListener("" + eventName, callback); | ||
target.removeEventListener(eventName, callback); | ||
} else { | ||
target.detachEvent("on" + eventName, callback); | ||
target.detachEvent('on' + eventName, callback); | ||
} | ||
return func(event); | ||
return func(event) | ||
}; | ||
@@ -95,59 +94,83 @@ onEvent(target, eventName, callback); | ||
var css = "body{margin:0}a{color:#24292e;text-decoration:none;outline:0}.widget{display:inline-block;overflow:hidden;font-family:-apple-system, BlinkMacSystemFont, \"Segoe UI\", Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\";font-size:0;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.btn,.social-count{display:inline-block;font-weight:600;vertical-align:bottom;cursor:pointer;border:1px solid #d1d2d3;border-radius:0.25em}.btn:focus,.social-count:focus{border-color:#c8e1ff}.btn{background-color:#eff3f6;background-image:-webkit-linear-gradient(top, #fafbfc, #e4ebf0);background-image:-moz-linear-gradient(top, #fafbfc, #e4ebf0);background-image:linear-gradient(to bottom, #fafbfc, #e4ebf0);background-repeat:repeat-x;background-size:110% 110%;-ms-filter:\"progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFAFBFC', endColorstr='#FFE4EBF0')\";*filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFAFBFC', endColorstr='#FFE4EBF0')}.btn:active{background-color:#e9ecef;background-image:none;border-color:#afb1b2;box-shadow:inset 0 0.15em 0.3em rgba(27,31,35,0.15)}.btn:hover{background-color:#e6ebf1;background-image:-webkit-linear-gradient(top, #f0f3f6, #dce3ec);background-image:-moz-linear-gradient(top, #f0f3f6, #dce3ec);background-image:linear-gradient(to bottom, #f0f3f6, #dce3ec);border-color:#afb1b2;-ms-filter:\"progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFF0F3F6', endColorstr='#FFDCE3EC')\";*filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFF0F3F6', endColorstr='#FFDCE3EC')}.social-count{position:relative;background-color:#fff}.social-count:hover{color:#0366d6}.octicon{position:relative;display:inline-block;vertical-align:top;fill:currentColor}.btn,.social-count{height:18px;padding:0 5px;line-height:18px}.btn{font-size:11px}.social-count{margin-left:5px;font-size:10px}.octicon{top:2px}.large .btn,.large .social-count{height:26px;line-height:26px}.large .btn{padding:0 10px;font-size:12px}.large .social-count{padding:0 7px;margin-left:7px;font-size:11px}.large .octicon{top:4px}.social-count b,.social-count i{position:absolute;top:50%;left:0;display:block;width:0;height:0;margin:-4px 0 0 -4px;_font-size:0;_line-height:0;border:solid transparent;border-width:4px 4px 4px 0}.social-count b{border-right-color:#d1d2d3}.social-count:focus b{border-right-color:#c8e1ff}.social-count i{margin-left:-3px;border-right-color:#fff}.social-count b,.social-count i{_border-top-color:red !important;_border-bottom-color:red !important;_border-left-color:red !important;_filter:chroma(color=red)}.large .social-count b,.large .social-count i{margin:-5px 0 0 -5px;border-width:5px 5px 5px 0}.large .social-count i{margin-left:-4px}\n"; | ||
var onceReadyStateChange = /* istanbul ignore next: IE lt 9 */ function (target, regex, func) { | ||
var eventName = 'onreadystatechange'; | ||
var callback = function (event) { | ||
if (regex.test(target.readyState)) { | ||
target.detachEvent(eventName, callback); | ||
return func(event) | ||
} | ||
}; | ||
target.attachEvent(eventName, callback); | ||
}; | ||
var parseOptions = function (anchor) { | ||
var options = { | ||
href: anchor.href, | ||
title: anchor.title, | ||
'aria-label': anchor.getAttribute('aria-label') | ||
}; | ||
var ref = ['icon', 'text', 'size', 'show-count']; | ||
for (var i = 0, len = ref.length; i < len; i++) { | ||
var attribute = 'data-' + ref[i]; | ||
options[attribute] = anchor.getAttribute(attribute); | ||
} | ||
if (options['data-text'] == null) { | ||
options['data-text'] = anchor.textContent || anchor.innerText; | ||
} | ||
return options | ||
}; | ||
var cssText = "body{margin:0}a{color:#24292e;text-decoration:none;outline:0}.widget{display:inline-block;overflow:hidden;font-family:-apple-system, BlinkMacSystemFont, \"Segoe UI\", Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\";font-size:0;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.btn,.social-count{display:inline-block;font-weight:600;vertical-align:bottom;cursor:pointer;border:1px solid #d1d2d3;border-radius:0.25em}.btn:focus,.social-count:focus{border-color:#c8e1ff}.btn{background-color:#eff3f6;background-image:-webkit-linear-gradient(top, #fafbfc, #e4ebf0);background-image:-moz-linear-gradient(top, #fafbfc, #e4ebf0);background-image:linear-gradient(to bottom, #fafbfc, #e4ebf0);background-repeat:repeat-x;background-size:110% 110%;-ms-filter:\"progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFAFBFC', endColorstr='#FFE4EBF0')\";*filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFAFBFC', endColorstr='#FFE4EBF0')}.btn:active{background-color:#e9ecef;background-image:none;border-color:#afb1b2;box-shadow:inset 0 0.15em 0.3em rgba(27,31,35,0.15)}.btn:hover{background-color:#e6ebf1;background-image:-webkit-linear-gradient(top, #f0f3f6, #dce3ec);background-image:-moz-linear-gradient(top, #f0f3f6, #dce3ec);background-image:linear-gradient(to bottom, #f0f3f6, #dce3ec);border-color:#afb1b2;-ms-filter:\"progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFF0F3F6', endColorstr='#FFDCE3EC')\";*filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFF0F3F6', endColorstr='#FFDCE3EC')}.social-count{position:relative;background-color:#fff}.social-count:hover{color:#0366d6}.octicon{position:relative;display:inline-block;vertical-align:top;fill:currentColor}.btn,.social-count{height:18px;padding:0 5px;line-height:18px}.btn{font-size:11px}.social-count{margin-left:5px;font-size:10px}.octicon{top:2px}.large .btn,.large .social-count{height:26px;line-height:26px}.large .btn{padding:0 10px;font-size:12px}.large .social-count{padding:0 7px;margin-left:7px;font-size:11px}.large .octicon{top:4px}.social-count b,.social-count i{position:absolute;top:50%;left:0;display:block;width:0;height:0;margin:-4px 0 0 -4px;_font-size:0;_line-height:0;border:solid transparent;border-width:4px 4px 4px 0}.social-count b{border-right-color:#d1d2d3}.social-count:focus b{border-right-color:#c8e1ff}.social-count i{margin-left:-3px;border-right-color:#fff}.social-count b,.social-count i{_border-top-color:red !important;_border-bottom-color:red !important;_border-left-color:red !important;_filter:chroma(color=red)}.large .social-count b,.large .social-count i{margin:-5px 0 0 -5px;border-width:5px 5px 5px 0}.large .social-count i{margin-left:-4px}\n"; | ||
var data = {"mark-github":{"width":16,"height":16,"path":"<path fill-rule=\"evenodd\" d=\"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z\"/>"},"eye":{"width":16,"height":16,"path":"<path fill-rule=\"evenodd\" d=\"M8.06 2C3 2 0 8 0 8s3 6 8.06 6C13 14 16 8 16 8s-3-6-7.94-6zM8 12c-2.2 0-4-1.78-4-4 0-2.2 1.8-4 4-4 2.22 0 4 1.8 4 4 0 2.22-1.78 4-4 4zm2-4c0 1.11-.89 2-2 2-1.11 0-2-.89-2-2 0-1.11.89-2 2-2 1.11 0 2 .89 2 2z\"/>"},"star":{"width":14,"height":16,"path":"<path fill-rule=\"evenodd\" d=\"M14 6l-4.9-.64L7 1 4.9 5.36 0 6l3.6 3.26L2.67 14 7 11.67 11.33 14l-.93-4.74L14 6z\"/>"},"repo-forked":{"width":10,"height":16,"path":"<path fill-rule=\"evenodd\" d=\"M8 1a1.993 1.993 0 0 0-1 3.72V6L5 8 3 6V4.72A1.993 1.993 0 0 0 2 1a1.993 1.993 0 0 0-1 3.72V6.5l3 3v1.78A1.993 1.993 0 0 0 5 15a1.993 1.993 0 0 0 1-3.72V9.5l3-3V4.72A1.993 1.993 0 0 0 8 1zM2 4.2C1.34 4.2.8 3.65.8 3c0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zm3 10c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zm3-10c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2z\"/>"},"issue-opened":{"width":14,"height":16,"path":"<path fill-rule=\"evenodd\" d=\"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z\"/>"},"cloud-download":{"width":16,"height":16,"path":"<path fill-rule=\"evenodd\" d=\"M9 12h2l-3 3-3-3h2V7h2v5zm3-8c0-.44-.91-3-4.5-3C5.08 1 3 2.92 3 5 1.02 5 0 6.52 0 8c0 1.53 1 3 3 3h3V9.7H3C1.38 9.7 1.3 8.28 1.3 8c0-.17.05-1.7 1.7-1.7h1.3V5c0-1.39 1.56-2.7 3.2-2.7 2.55 0 3.13 1.55 3.2 1.8v1.2H12c.81 0 2.7.22 2.7 2.2 0 2.09-2.25 2.2-2.7 2.2h-2V11h2c2.08 0 4-1.16 4-3.5C16 5.06 14.08 4 12 4z\"/>"}}; | ||
var octicon; | ||
octicon = function(icon, height) { | ||
var width; | ||
icon = ("" + icon).toLowerCase().replace(/^octicon-/, ""); | ||
var octicon = function (icon, height) { | ||
icon = ('' + icon).toLowerCase().replace(/^octicon-/, ''); | ||
if (!data.hasOwnProperty(icon)) { | ||
icon = "mark-github"; | ||
icon = 'mark-github'; | ||
} | ||
width = height * data[icon].width / data[icon].height; | ||
return "<svg version=\"1.1\" width=\"" + width + "\" height=\"" + height + "\" viewBox=\"0 0 " + data[icon].width + " " + data[icon].height + "\" class=\"octicon octicon-" + icon + "\" aria-hidden=\"true\">" + data[icon].path + "</svg>"; | ||
return '<svg version="1.1" width="' + (height * data[icon].width / data[icon].height) + '" height="' + height + '" viewBox="0 0 ' + data[icon].width + ' ' + data[icon].height + '" class="octicon octicon-' + icon + '" aria-hidden="true">' + data[icon].path + '</svg>' | ||
}; | ||
var fetch, queues; | ||
var queues = {}; | ||
queues = {}; | ||
var fetch = function (url, func) { | ||
var queue = queues[url] || (queues[url] = []); | ||
if (queue.push(func) > 1) { | ||
return | ||
} | ||
fetch = function(url, func) { | ||
var XMLHttpRequest, callback, contentWindow, onceToken, onloadend, queue, script, xhr; | ||
if (1 < (queue = (queues[url] || (queues[url] = []))).push(func)) { | ||
return; | ||
} | ||
onceToken = 0; | ||
callback = function() { | ||
if (!onceToken && (onceToken = 1)) { | ||
delete queues[url]; | ||
while (func = queue.shift()) { | ||
func.apply(null, arguments); | ||
} | ||
var callback = dispatchOnce(function () { | ||
delete queues[url]; | ||
while ((func = queue.shift())) { | ||
func.apply(null, arguments); | ||
} | ||
}; | ||
if ((XMLHttpRequest = window.XMLHttpRequest) && "withCredentials" in XMLHttpRequest.prototype) { | ||
xhr = new XMLHttpRequest(); | ||
onEvent(xhr, "abort", callback); | ||
onEvent(xhr, "error", callback); | ||
onEvent(xhr, "load", function() { | ||
callback(xhr.status !== 200, (function() { | ||
}); | ||
if (useXHR) { | ||
var xhr = new XMLHttpRequest(); | ||
onEvent(xhr, 'abort', callback); | ||
onEvent(xhr, 'error', callback); | ||
onEvent(xhr, 'load', function () { | ||
// eslint-disable-next-line standard/no-callback-literal | ||
callback(xhr.status !== 200, (function () { | ||
try { | ||
return JSON.parse(xhr.responseText); | ||
} catch (error) {} | ||
return JSON.parse(xhr.responseText) | ||
} catch (_) {} | ||
})()); | ||
}); | ||
xhr.open("GET", url); | ||
xhr.open('GET', url); | ||
xhr.send(); | ||
} else { | ||
contentWindow = this || window; | ||
contentWindow._ = function(json) { | ||
var contentWindow = this || window; | ||
contentWindow._ = function (json) { | ||
contentWindow._ = null; | ||
// eslint-disable-next-line standard/no-callback-literal | ||
callback(json.meta.status !== 200, json.data); | ||
}; | ||
script = contentWindow.document.createElement("script"); | ||
script.async = true; | ||
script.src = url + (/\?/.test(url) ? "&" : "?") + "callback=_"; | ||
onloadend = function() { | ||
var script = createElementInDocument(contentWindow.document)('script', { | ||
async: true, | ||
src: url + (/\?/.test(url) ? '&' : '?') + 'callback=_' | ||
}); | ||
var onloadend = /* istanbul ignore next: IE lt 9 */ function () { | ||
if (contentWindow._) { | ||
@@ -159,44 +182,49 @@ contentWindow._({ | ||
}; | ||
onEvent(script, "error", onloadend); | ||
onEvent(script, 'load', onloadend); | ||
onEvent(script, 'error', onloadend); | ||
/* istanbul ignore if: IE lt 9 */ | ||
if (script.readyState) { | ||
/* istanbul ignore next: IE lt 9 */ | ||
onEvent(script, "readystatechange", function() { | ||
if (script.readyState === "loaded") { | ||
onloadend(); | ||
} | ||
}); | ||
onceReadyStateChange(script, /de|m/, onloadend); | ||
} | ||
contentWindow.document.getElementsByTagName("head")[0].appendChild(script); | ||
contentWindow.document.getElementsByTagName('head')[0].appendChild(script); | ||
} | ||
}; | ||
var render; | ||
var render = function (root, options, func) { | ||
var createElement = createElementInDocument(root.ownerDocument); | ||
render = function(root, options, func) { | ||
var button, callback, contentWindow, createElement, createTextNode, document, style, widget; | ||
if (!options) { | ||
return; | ||
} | ||
contentWindow = this; | ||
document = root.ownerDocument; | ||
createElement = function(tag) { | ||
return document.createElement(tag); | ||
}; | ||
createTextNode = function(text) { | ||
return document.createTextNode(text); | ||
}; | ||
style = createElement("style"); | ||
style.type = "text/css"; | ||
root.appendChild(style); | ||
/* istanbul ignore if */ | ||
var style = root.appendChild(createElement('style', { | ||
type: 'text/css' | ||
})); | ||
/* istanbul ignore if: IE lt 9 */ | ||
if (style.styleSheet) { | ||
style.styleSheet.cssText = css; | ||
style.styleSheet.cssText = cssText; | ||
} else { | ||
style.appendChild(createTextNode(css)); | ||
style.appendChild(root.ownerDocument.createTextNode(cssText)); | ||
} | ||
widget = root.appendChild(createElement("div")); | ||
widget.className = "widget" + (/^large$/i.test(options["data-size"]) ? " large" : ""); | ||
callback = function() { | ||
var btn = createElement('a', { | ||
className: 'btn', | ||
href: options.href, | ||
target: '_blank', | ||
innerHTML: octicon(options['data-icon'], /^large$/i.test(options['data-size']) ? 18 : 14), | ||
'aria-label': options['aria-label'] || void 0 | ||
}, [ | ||
' ', | ||
createElement('span', {}, [options['data-text'] || '']) | ||
]); | ||
if (!/\.github\.com$/.test('.' + btn.hostname)) { | ||
btn.href = '#'; | ||
btn.target = '_self'; | ||
} else if (/^https?:\/\/((gist\.)?github\.com\/[^/?#]+\/[^/?#]+\/archive\/|github\.com\/[^/?#]+\/[^/?#]+\/releases\/download\/|codeload\.github\.com\/)/.test(btn.href)) { | ||
btn.target = '_top'; | ||
} | ||
var widget = root.appendChild(createElement('div', { | ||
className: 'widget' + (/^large$/i.test(options['data-size']) ? ' large' : '') | ||
}, [ | ||
btn | ||
])); | ||
var callback = function () { | ||
if (func) { | ||
@@ -206,105 +234,86 @@ func(widget); | ||
}; | ||
button = (function() { | ||
var a, ariaLabel, span; | ||
a = createElement("a"); | ||
a.href = options.href; | ||
a.target = "_blank"; | ||
if (!/\.github\.com$/.test("." + a.hostname)) { | ||
a.href = "#"; | ||
a.target = "_self"; | ||
} else if (/^https?:\/\/((gist\.)?github\.com\/[^\/?#]+\/[^\/?#]+\/archive\/|github\.com\/[^\/?#]+\/[^\/?#]+\/releases\/download\/|codeload\.github\.com\/)/.test(a.href)) { | ||
a.target = "_top"; | ||
if (!(/^(true|1)$/i.test(options['data-show-count']) && btn.hostname === 'github.com')) { | ||
callback(); | ||
return | ||
} | ||
var match = btn.pathname.replace(/^(?!\/)/, '/').match(/^\/([^/?#]+)(?:\/([^/?#]+)(?:\/(?:(subscription)|(fork)|(issues)|([^/?#]+)))?)?(?:[/?#]|$)/); | ||
if (!(match && !match[6])) { | ||
callback(); | ||
return | ||
} | ||
var api, href, property; | ||
if (match[2]) { | ||
api = '/repos/' + match[1] + '/' + match[2]; | ||
if (match[3]) { | ||
property = 'subscribers_count'; | ||
href = 'watchers'; | ||
} else if (match[4]) { | ||
property = 'forks_count'; | ||
href = 'network'; | ||
} else if (match[5]) { | ||
property = 'open_issues_count'; | ||
href = 'issues'; | ||
} else { | ||
property = 'stargazers_count'; | ||
href = 'stargazers'; | ||
} | ||
a.className = "btn"; | ||
if (ariaLabel = options["aria-label"]) { | ||
a.setAttribute("aria-label", ariaLabel); | ||
} else { | ||
api = '/users/' + match[1]; | ||
href = property = 'followers'; | ||
} | ||
fetch.call(this, apiBaseURL + api, function (error, json) { | ||
if (!error) { | ||
var data = json[property]; | ||
widget.appendChild(createElement('a', { | ||
className: 'social-count', | ||
href: json.html_url + '/' + href, | ||
target: '_blank', | ||
'aria-label': data + ' ' + property.replace(/_count$/, '').replace('_', ' ').slice(0, data < 2 ? -1 : void 0) + ' on GitHub' | ||
}, [ | ||
createElement('b'), | ||
createElement('i'), | ||
createElement('span', {}, [('' + data).replace(/\B(?=(\d{3})+(?!\d))/g, ',')]) | ||
])); | ||
} | ||
a.innerHTML = octicon(options["data-icon"], /^large$/i.test(options["data-size"]) ? 18 : 14); | ||
a.appendChild(createTextNode(" ")); | ||
span = a.appendChild(createElement("span")); | ||
span.appendChild(createTextNode(options["data-text"] || "")); | ||
return widget.appendChild(a); | ||
})(); | ||
(function() { | ||
var api, href, match, property; | ||
if (!(/^(true|1)$/i.test(options["data-show-count"]) && button.hostname === "github.com")) { | ||
return callback(); | ||
callback(); | ||
}); | ||
}; | ||
var stringify = function (obj) { | ||
var params = []; | ||
for (var name in obj) { | ||
var value = obj[name]; | ||
if (value != null) { | ||
params.push(encodeURIComponent(name) + '=' + encodeURIComponent(value)); | ||
} | ||
match = button.pathname.replace(/^(?!\/)/, "/").match(/^\/([^\/?#]+)(?:\/([^\/?#]+)(?:\/(?:(subscription)|(fork)|(issues)|([^\/?#]+)))?)?(?:[\/?#]|$)/); | ||
if (!(match && !match[6])) { | ||
return callback(); | ||
} | ||
if (match[2]) { | ||
api = "/repos/" + match[1] + "/" + match[2]; | ||
if (match[3]) { | ||
property = "subscribers_count"; | ||
href = "watchers"; | ||
} else if (match[4]) { | ||
property = "forks_count"; | ||
href = "network"; | ||
} else if (match[5]) { | ||
property = "open_issues_count"; | ||
href = "issues"; | ||
} else { | ||
property = "stargazers_count"; | ||
href = "stargazers"; | ||
} | ||
} else { | ||
api = "/users/" + match[1]; | ||
href = property = "followers"; | ||
} | ||
fetch.call(contentWindow, apiBaseURL + api, function(error, json) { | ||
var a, data, span; | ||
if (!error) { | ||
data = json[property]; | ||
a = createElement("a"); | ||
a.href = json.html_url + "/" + href; | ||
a.target = "_blank"; | ||
a.className = "social-count"; | ||
a.setAttribute("aria-label", data + " " + (property.replace(/_count$/, "").replace("_", " ").slice(0, data < 2 ? -1 : void 0)) + " on GitHub"); | ||
a.appendChild(createElement("b")); | ||
a.appendChild(createElement("i")); | ||
span = a.appendChild(createElement("span")); | ||
span.appendChild(document.createTextNode(("" + data).replace(/\B(?=(\d{3})+(?!\d))/g, ","))); | ||
button.parentNode.insertBefore(a, button.nextSibling); | ||
} | ||
callback(); | ||
}); | ||
})(); | ||
} | ||
return params.join('&') | ||
}; | ||
var ceilPixel, devicePixelRatio; | ||
var devicePixelRatio = window.devicePixelRatio || /* istanbul ignore next */ 1; | ||
/* istanbul ignore next */ | ||
devicePixelRatio = window.devicePixelRatio || 1; | ||
ceilPixel = function(px) { | ||
return (devicePixelRatio > 1 ? Math.ceil(Math.round(px * devicePixelRatio) / devicePixelRatio * 2) / 2 : Math.ceil(px)) || 0; | ||
var ceilPixel = function (px) { | ||
return (devicePixelRatio > 1 ? Math.ceil(Math.round(px * devicePixelRatio) / devicePixelRatio * 2) / 2 : Math.ceil(px)) || 0 | ||
}; | ||
var get, set; | ||
get = function(el) { | ||
var boundingClientRect, height, width; | ||
width = el.scrollWidth; | ||
height = el.scrollHeight; | ||
var get = function (el) { | ||
var width = el.scrollWidth; | ||
var height = el.scrollHeight; | ||
if (el.getBoundingClientRect) { | ||
boundingClientRect = el.getBoundingClientRect(); | ||
var boundingClientRect = el.getBoundingClientRect(); | ||
width = Math.max(width, ceilPixel(boundingClientRect.width || boundingClientRect.right - boundingClientRect.left)); | ||
height = Math.max(height, ceilPixel(boundingClientRect.height || boundingClientRect.bottom - boundingClientRect.top)); | ||
} | ||
return [width, height]; | ||
return [width, height] | ||
}; | ||
set = function(el, size) { | ||
el.style.width = size[0] + "px"; | ||
el.style.height = size[1] + "px"; | ||
var set = function (el, size) { | ||
el.style.width = size[0] + 'px'; | ||
el.style.height = size[1] + 'px'; | ||
}; | ||
exports.render = function(options, func) { | ||
var HTMLElement, host, iframe, name, ref, title, value; | ||
if (!((options != null) && (func != null))) { | ||
return; | ||
var render$1 = function (options, func) { | ||
if (options == null || func == null) { | ||
return | ||
} | ||
@@ -314,40 +323,28 @@ if (options.getAttribute) { | ||
} | ||
if ((HTMLElement = window.HTMLElement) && HTMLElement.prototype.attachShadow && !HTMLElement.prototype.attachShadow.prototype) { | ||
host = createElement("span"); | ||
if (title = options.title) { | ||
host.title = title; | ||
} | ||
render(host.attachShadow({ | ||
mode: "closed" | ||
}), options, function() { | ||
if (useShadowDOM) { | ||
var host = createElement('span', { | ||
title: options.title || void 0 | ||
}); | ||
render(host.attachShadow({ mode: 'closed' }), options, function () { | ||
func(host); | ||
}); | ||
} else { | ||
iframe = createElement("iframe"); | ||
ref = { | ||
var iframe = createElement('iframe', { | ||
src: 'javascript:0', | ||
title: options.title || void 0, | ||
allowtransparency: true, | ||
scrolling: "no", | ||
scrolling: 'no', | ||
frameBorder: 0 | ||
}; | ||
for (name in ref) { | ||
value = ref[name]; | ||
iframe.setAttribute(name, value); | ||
} | ||
}); | ||
set(iframe, [1, 0]); | ||
iframe.style.border = "none"; | ||
iframe.src = "javascript:0"; | ||
onceEvent(iframe, "load", function() { | ||
var contentWindow; | ||
contentWindow = iframe.contentWindow; | ||
render.call(contentWindow, contentWindow.document.body, options, function(widget) { | ||
var size; | ||
size = get(widget); | ||
iframe.style.border = 'none'; | ||
onceEvent(iframe, 'load', function () { | ||
var contentWindow = iframe.contentWindow; | ||
render.call(contentWindow, contentWindow.document.body, options, function (widget) { | ||
var size = get(widget); | ||
iframe.parentNode.removeChild(iframe); | ||
onceEvent(iframe, "load", function() { | ||
onceEvent(iframe, 'load', function () { | ||
set(iframe, size); | ||
}); | ||
iframe.src = iframeURL + "#" + stringify(options); | ||
if (title = options.title) { | ||
iframe.title = title; | ||
} | ||
iframe.src = iframeURL + '#' + stringify(options); | ||
func(iframe); | ||
@@ -359,1 +356,3 @@ }); | ||
}; | ||
exports.render = render$1; |
/*! | ||
* github-buttons v2.0.5 | ||
* github-buttons v2.1.0 | ||
* (c) 2019 なつき | ||
@@ -16,72 +16,71 @@ * @license BSD-2-Clause | ||
var createElement = function(tag) { | ||
return document.createElement(tag); | ||
}; | ||
var HTMLElement = window.HTMLElement; | ||
var name = "github-buttons"; | ||
var version = "2.0.5"; | ||
var XMLHttpRequest = window.XMLHttpRequest; | ||
var apiBaseURL, iframeURL; | ||
/* istanbul ignore next */ | ||
iframeURL = (/^http:/.test(location) ? "http" : "https") + "://" + ("unpkg.com/" + name + "@" + version + "/dist") + "/buttons.html"; | ||
apiBaseURL = "https://api.github.com"; | ||
var parseOptions = function(anchor) { | ||
var attribute, i, len, options, ref; | ||
options = { | ||
"href": anchor.href, | ||
"title": anchor.title, | ||
"aria-label": anchor.getAttribute("aria-label") | ||
}; | ||
ref = ["icon", "text", "size", "show-count"]; | ||
for (i = 0, len = ref.length; i < len; i++) { | ||
attribute = ref[i]; | ||
attribute = "data-" + attribute; | ||
options[attribute] = anchor.getAttribute(attribute); | ||
var createElementInDocument = function (document) { | ||
return function (tag, props, children) { | ||
var el = document.createElement(tag); | ||
if (props) { | ||
for (var prop in props) { | ||
var val = props[prop]; | ||
if (val != null) { | ||
if (el[prop] != null) { | ||
el[prop] = val; | ||
} else { | ||
el.setAttribute(prop, val); | ||
} | ||
} | ||
} | ||
} | ||
if (children) { | ||
for (var i = 0, len = children.length; i < len; i++) { | ||
var child = children[i]; | ||
el.appendChild(typeof child === 'string' ? document.createTextNode(child) : child); | ||
} | ||
} | ||
return el | ||
} | ||
if (options["data-text"] == null) { | ||
options["data-text"] = anchor.textContent || anchor.innerText; | ||
} | ||
return options; | ||
}; | ||
var stringify = function(obj) { | ||
var name, params, value; | ||
params = []; | ||
for (name in obj) { | ||
value = obj[name]; | ||
if (value != null) { | ||
params.push((encodeURIComponent(name)) + "=" + (encodeURIComponent(value))); | ||
var createElement = createElementInDocument(document); | ||
var dispatchOnce = function (func) { | ||
var onceToken = 0; | ||
return function () { | ||
if (!onceToken && (onceToken = 1)) { | ||
func.apply(this, arguments); | ||
} | ||
} | ||
return params.join("&"); | ||
}; | ||
var onEvent, onceEvent; | ||
var name = "github-buttons"; | ||
var version = "2.1.0"; | ||
onEvent = function(target, eventName, func) { | ||
var iframeURL = (/* istanbul ignore next */ /^http:/.test(location) ? 'http' : 'https') + '://' + (/* istanbul ignore next */ 'unpkg.com/' + name + '@' + version + '/dist') + '/buttons.html'; | ||
var apiBaseURL = 'https://api.github.com'; | ||
var useShadowDOM = HTMLElement && HTMLElement.prototype.attachShadow && !HTMLElement.prototype.attachShadow.prototype; | ||
var useXHR = XMLHttpRequest && XMLHttpRequest.prototype && 'withCredentials' in XMLHttpRequest.prototype; | ||
var onEvent = function (target, eventName, func) { | ||
/* istanbul ignore else: IE lt 9 */ | ||
if (target.addEventListener) { | ||
target.addEventListener("" + eventName, func); | ||
target.addEventListener(eventName, func); | ||
} else { | ||
target.attachEvent("on" + eventName, func); | ||
target.attachEvent('on' + eventName, func); | ||
} | ||
}; | ||
onceEvent = function(target, eventName, func) { | ||
var callback; | ||
callback = function(event) { | ||
var onceEvent = function (target, eventName, func) { | ||
var callback = function (event) { | ||
/* istanbul ignore else: IE lt 9 */ | ||
if (target.removeEventListener) { | ||
target.removeEventListener("" + eventName, callback); | ||
target.removeEventListener(eventName, callback); | ||
} else { | ||
target.detachEvent("on" + eventName, callback); | ||
target.detachEvent('on' + eventName, callback); | ||
} | ||
return func(event); | ||
return func(event) | ||
}; | ||
@@ -91,59 +90,83 @@ onEvent(target, eventName, callback); | ||
var css = "body{margin:0}a{color:#24292e;text-decoration:none;outline:0}.widget{display:inline-block;overflow:hidden;font-family:-apple-system, BlinkMacSystemFont, \"Segoe UI\", Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\";font-size:0;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.btn,.social-count{display:inline-block;font-weight:600;vertical-align:bottom;cursor:pointer;border:1px solid #d1d2d3;border-radius:0.25em}.btn:focus,.social-count:focus{border-color:#c8e1ff}.btn{background-color:#eff3f6;background-image:-webkit-linear-gradient(top, #fafbfc, #e4ebf0);background-image:-moz-linear-gradient(top, #fafbfc, #e4ebf0);background-image:linear-gradient(to bottom, #fafbfc, #e4ebf0);background-repeat:repeat-x;background-size:110% 110%;-ms-filter:\"progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFAFBFC', endColorstr='#FFE4EBF0')\";*filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFAFBFC', endColorstr='#FFE4EBF0')}.btn:active{background-color:#e9ecef;background-image:none;border-color:#afb1b2;box-shadow:inset 0 0.15em 0.3em rgba(27,31,35,0.15)}.btn:hover{background-color:#e6ebf1;background-image:-webkit-linear-gradient(top, #f0f3f6, #dce3ec);background-image:-moz-linear-gradient(top, #f0f3f6, #dce3ec);background-image:linear-gradient(to bottom, #f0f3f6, #dce3ec);border-color:#afb1b2;-ms-filter:\"progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFF0F3F6', endColorstr='#FFDCE3EC')\";*filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFF0F3F6', endColorstr='#FFDCE3EC')}.social-count{position:relative;background-color:#fff}.social-count:hover{color:#0366d6}.octicon{position:relative;display:inline-block;vertical-align:top;fill:currentColor}.btn,.social-count{height:18px;padding:0 5px;line-height:18px}.btn{font-size:11px}.social-count{margin-left:5px;font-size:10px}.octicon{top:2px}.large .btn,.large .social-count{height:26px;line-height:26px}.large .btn{padding:0 10px;font-size:12px}.large .social-count{padding:0 7px;margin-left:7px;font-size:11px}.large .octicon{top:4px}.social-count b,.social-count i{position:absolute;top:50%;left:0;display:block;width:0;height:0;margin:-4px 0 0 -4px;_font-size:0;_line-height:0;border:solid transparent;border-width:4px 4px 4px 0}.social-count b{border-right-color:#d1d2d3}.social-count:focus b{border-right-color:#c8e1ff}.social-count i{margin-left:-3px;border-right-color:#fff}.social-count b,.social-count i{_border-top-color:red !important;_border-bottom-color:red !important;_border-left-color:red !important;_filter:chroma(color=red)}.large .social-count b,.large .social-count i{margin:-5px 0 0 -5px;border-width:5px 5px 5px 0}.large .social-count i{margin-left:-4px}\n"; | ||
var onceReadyStateChange = /* istanbul ignore next: IE lt 9 */ function (target, regex, func) { | ||
var eventName = 'onreadystatechange'; | ||
var callback = function (event) { | ||
if (regex.test(target.readyState)) { | ||
target.detachEvent(eventName, callback); | ||
return func(event) | ||
} | ||
}; | ||
target.attachEvent(eventName, callback); | ||
}; | ||
var parseOptions = function (anchor) { | ||
var options = { | ||
href: anchor.href, | ||
title: anchor.title, | ||
'aria-label': anchor.getAttribute('aria-label') | ||
}; | ||
var ref = ['icon', 'text', 'size', 'show-count']; | ||
for (var i = 0, len = ref.length; i < len; i++) { | ||
var attribute = 'data-' + ref[i]; | ||
options[attribute] = anchor.getAttribute(attribute); | ||
} | ||
if (options['data-text'] == null) { | ||
options['data-text'] = anchor.textContent || anchor.innerText; | ||
} | ||
return options | ||
}; | ||
var cssText = "body{margin:0}a{color:#24292e;text-decoration:none;outline:0}.widget{display:inline-block;overflow:hidden;font-family:-apple-system, BlinkMacSystemFont, \"Segoe UI\", Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\";font-size:0;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.btn,.social-count{display:inline-block;font-weight:600;vertical-align:bottom;cursor:pointer;border:1px solid #d1d2d3;border-radius:0.25em}.btn:focus,.social-count:focus{border-color:#c8e1ff}.btn{background-color:#eff3f6;background-image:-webkit-linear-gradient(top, #fafbfc, #e4ebf0);background-image:-moz-linear-gradient(top, #fafbfc, #e4ebf0);background-image:linear-gradient(to bottom, #fafbfc, #e4ebf0);background-repeat:repeat-x;background-size:110% 110%;-ms-filter:\"progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFAFBFC', endColorstr='#FFE4EBF0')\";*filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFAFBFC', endColorstr='#FFE4EBF0')}.btn:active{background-color:#e9ecef;background-image:none;border-color:#afb1b2;box-shadow:inset 0 0.15em 0.3em rgba(27,31,35,0.15)}.btn:hover{background-color:#e6ebf1;background-image:-webkit-linear-gradient(top, #f0f3f6, #dce3ec);background-image:-moz-linear-gradient(top, #f0f3f6, #dce3ec);background-image:linear-gradient(to bottom, #f0f3f6, #dce3ec);border-color:#afb1b2;-ms-filter:\"progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFF0F3F6', endColorstr='#FFDCE3EC')\";*filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFF0F3F6', endColorstr='#FFDCE3EC')}.social-count{position:relative;background-color:#fff}.social-count:hover{color:#0366d6}.octicon{position:relative;display:inline-block;vertical-align:top;fill:currentColor}.btn,.social-count{height:18px;padding:0 5px;line-height:18px}.btn{font-size:11px}.social-count{margin-left:5px;font-size:10px}.octicon{top:2px}.large .btn,.large .social-count{height:26px;line-height:26px}.large .btn{padding:0 10px;font-size:12px}.large .social-count{padding:0 7px;margin-left:7px;font-size:11px}.large .octicon{top:4px}.social-count b,.social-count i{position:absolute;top:50%;left:0;display:block;width:0;height:0;margin:-4px 0 0 -4px;_font-size:0;_line-height:0;border:solid transparent;border-width:4px 4px 4px 0}.social-count b{border-right-color:#d1d2d3}.social-count:focus b{border-right-color:#c8e1ff}.social-count i{margin-left:-3px;border-right-color:#fff}.social-count b,.social-count i{_border-top-color:red !important;_border-bottom-color:red !important;_border-left-color:red !important;_filter:chroma(color=red)}.large .social-count b,.large .social-count i{margin:-5px 0 0 -5px;border-width:5px 5px 5px 0}.large .social-count i{margin-left:-4px}\n"; | ||
var data = {"mark-github":{"width":16,"height":16,"path":"<path fill-rule=\"evenodd\" d=\"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z\"/>"},"eye":{"width":16,"height":16,"path":"<path fill-rule=\"evenodd\" d=\"M8.06 2C3 2 0 8 0 8s3 6 8.06 6C13 14 16 8 16 8s-3-6-7.94-6zM8 12c-2.2 0-4-1.78-4-4 0-2.2 1.8-4 4-4 2.22 0 4 1.8 4 4 0 2.22-1.78 4-4 4zm2-4c0 1.11-.89 2-2 2-1.11 0-2-.89-2-2 0-1.11.89-2 2-2 1.11 0 2 .89 2 2z\"/>"},"star":{"width":14,"height":16,"path":"<path fill-rule=\"evenodd\" d=\"M14 6l-4.9-.64L7 1 4.9 5.36 0 6l3.6 3.26L2.67 14 7 11.67 11.33 14l-.93-4.74L14 6z\"/>"},"repo-forked":{"width":10,"height":16,"path":"<path fill-rule=\"evenodd\" d=\"M8 1a1.993 1.993 0 0 0-1 3.72V6L5 8 3 6V4.72A1.993 1.993 0 0 0 2 1a1.993 1.993 0 0 0-1 3.72V6.5l3 3v1.78A1.993 1.993 0 0 0 5 15a1.993 1.993 0 0 0 1-3.72V9.5l3-3V4.72A1.993 1.993 0 0 0 8 1zM2 4.2C1.34 4.2.8 3.65.8 3c0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zm3 10c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zm3-10c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2z\"/>"},"issue-opened":{"width":14,"height":16,"path":"<path fill-rule=\"evenodd\" d=\"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z\"/>"},"cloud-download":{"width":16,"height":16,"path":"<path fill-rule=\"evenodd\" d=\"M9 12h2l-3 3-3-3h2V7h2v5zm3-8c0-.44-.91-3-4.5-3C5.08 1 3 2.92 3 5 1.02 5 0 6.52 0 8c0 1.53 1 3 3 3h3V9.7H3C1.38 9.7 1.3 8.28 1.3 8c0-.17.05-1.7 1.7-1.7h1.3V5c0-1.39 1.56-2.7 3.2-2.7 2.55 0 3.13 1.55 3.2 1.8v1.2H12c.81 0 2.7.22 2.7 2.2 0 2.09-2.25 2.2-2.7 2.2h-2V11h2c2.08 0 4-1.16 4-3.5C16 5.06 14.08 4 12 4z\"/>"}}; | ||
var octicon; | ||
octicon = function(icon, height) { | ||
var width; | ||
icon = ("" + icon).toLowerCase().replace(/^octicon-/, ""); | ||
var octicon = function (icon, height) { | ||
icon = ('' + icon).toLowerCase().replace(/^octicon-/, ''); | ||
if (!data.hasOwnProperty(icon)) { | ||
icon = "mark-github"; | ||
icon = 'mark-github'; | ||
} | ||
width = height * data[icon].width / data[icon].height; | ||
return "<svg version=\"1.1\" width=\"" + width + "\" height=\"" + height + "\" viewBox=\"0 0 " + data[icon].width + " " + data[icon].height + "\" class=\"octicon octicon-" + icon + "\" aria-hidden=\"true\">" + data[icon].path + "</svg>"; | ||
return '<svg version="1.1" width="' + (height * data[icon].width / data[icon].height) + '" height="' + height + '" viewBox="0 0 ' + data[icon].width + ' ' + data[icon].height + '" class="octicon octicon-' + icon + '" aria-hidden="true">' + data[icon].path + '</svg>' | ||
}; | ||
var fetch, queues; | ||
var queues = {}; | ||
queues = {}; | ||
var fetch = function (url, func) { | ||
var queue = queues[url] || (queues[url] = []); | ||
if (queue.push(func) > 1) { | ||
return | ||
} | ||
fetch = function(url, func) { | ||
var XMLHttpRequest, callback, contentWindow, onceToken, onloadend, queue, script, xhr; | ||
if (1 < (queue = (queues[url] || (queues[url] = []))).push(func)) { | ||
return; | ||
} | ||
onceToken = 0; | ||
callback = function() { | ||
if (!onceToken && (onceToken = 1)) { | ||
delete queues[url]; | ||
while (func = queue.shift()) { | ||
func.apply(null, arguments); | ||
} | ||
var callback = dispatchOnce(function () { | ||
delete queues[url]; | ||
while ((func = queue.shift())) { | ||
func.apply(null, arguments); | ||
} | ||
}; | ||
if ((XMLHttpRequest = window.XMLHttpRequest) && "withCredentials" in XMLHttpRequest.prototype) { | ||
xhr = new XMLHttpRequest(); | ||
onEvent(xhr, "abort", callback); | ||
onEvent(xhr, "error", callback); | ||
onEvent(xhr, "load", function() { | ||
callback(xhr.status !== 200, (function() { | ||
}); | ||
if (useXHR) { | ||
var xhr = new XMLHttpRequest(); | ||
onEvent(xhr, 'abort', callback); | ||
onEvent(xhr, 'error', callback); | ||
onEvent(xhr, 'load', function () { | ||
// eslint-disable-next-line standard/no-callback-literal | ||
callback(xhr.status !== 200, (function () { | ||
try { | ||
return JSON.parse(xhr.responseText); | ||
} catch (error) {} | ||
return JSON.parse(xhr.responseText) | ||
} catch (_) {} | ||
})()); | ||
}); | ||
xhr.open("GET", url); | ||
xhr.open('GET', url); | ||
xhr.send(); | ||
} else { | ||
contentWindow = this || window; | ||
contentWindow._ = function(json) { | ||
var contentWindow = this || window; | ||
contentWindow._ = function (json) { | ||
contentWindow._ = null; | ||
// eslint-disable-next-line standard/no-callback-literal | ||
callback(json.meta.status !== 200, json.data); | ||
}; | ||
script = contentWindow.document.createElement("script"); | ||
script.async = true; | ||
script.src = url + (/\?/.test(url) ? "&" : "?") + "callback=_"; | ||
onloadend = function() { | ||
var script = createElementInDocument(contentWindow.document)('script', { | ||
async: true, | ||
src: url + (/\?/.test(url) ? '&' : '?') + 'callback=_' | ||
}); | ||
var onloadend = /* istanbul ignore next: IE lt 9 */ function () { | ||
if (contentWindow._) { | ||
@@ -155,44 +178,49 @@ contentWindow._({ | ||
}; | ||
onEvent(script, "error", onloadend); | ||
onEvent(script, 'load', onloadend); | ||
onEvent(script, 'error', onloadend); | ||
/* istanbul ignore if: IE lt 9 */ | ||
if (script.readyState) { | ||
/* istanbul ignore next: IE lt 9 */ | ||
onEvent(script, "readystatechange", function() { | ||
if (script.readyState === "loaded") { | ||
onloadend(); | ||
} | ||
}); | ||
onceReadyStateChange(script, /de|m/, onloadend); | ||
} | ||
contentWindow.document.getElementsByTagName("head")[0].appendChild(script); | ||
contentWindow.document.getElementsByTagName('head')[0].appendChild(script); | ||
} | ||
}; | ||
var render; | ||
var render = function (root, options, func) { | ||
var createElement = createElementInDocument(root.ownerDocument); | ||
render = function(root, options, func) { | ||
var button, callback, contentWindow, createElement, createTextNode, document, style, widget; | ||
if (!options) { | ||
return; | ||
} | ||
contentWindow = this; | ||
document = root.ownerDocument; | ||
createElement = function(tag) { | ||
return document.createElement(tag); | ||
}; | ||
createTextNode = function(text) { | ||
return document.createTextNode(text); | ||
}; | ||
style = createElement("style"); | ||
style.type = "text/css"; | ||
root.appendChild(style); | ||
/* istanbul ignore if */ | ||
var style = root.appendChild(createElement('style', { | ||
type: 'text/css' | ||
})); | ||
/* istanbul ignore if: IE lt 9 */ | ||
if (style.styleSheet) { | ||
style.styleSheet.cssText = css; | ||
style.styleSheet.cssText = cssText; | ||
} else { | ||
style.appendChild(createTextNode(css)); | ||
style.appendChild(root.ownerDocument.createTextNode(cssText)); | ||
} | ||
widget = root.appendChild(createElement("div")); | ||
widget.className = "widget" + (/^large$/i.test(options["data-size"]) ? " large" : ""); | ||
callback = function() { | ||
var btn = createElement('a', { | ||
className: 'btn', | ||
href: options.href, | ||
target: '_blank', | ||
innerHTML: octicon(options['data-icon'], /^large$/i.test(options['data-size']) ? 18 : 14), | ||
'aria-label': options['aria-label'] || void 0 | ||
}, [ | ||
' ', | ||
createElement('span', {}, [options['data-text'] || '']) | ||
]); | ||
if (!/\.github\.com$/.test('.' + btn.hostname)) { | ||
btn.href = '#'; | ||
btn.target = '_self'; | ||
} else if (/^https?:\/\/((gist\.)?github\.com\/[^/?#]+\/[^/?#]+\/archive\/|github\.com\/[^/?#]+\/[^/?#]+\/releases\/download\/|codeload\.github\.com\/)/.test(btn.href)) { | ||
btn.target = '_top'; | ||
} | ||
var widget = root.appendChild(createElement('div', { | ||
className: 'widget' + (/^large$/i.test(options['data-size']) ? ' large' : '') | ||
}, [ | ||
btn | ||
])); | ||
var callback = function () { | ||
if (func) { | ||
@@ -202,107 +230,86 @@ func(widget); | ||
}; | ||
button = (function() { | ||
var a, ariaLabel, span; | ||
a = createElement("a"); | ||
a.href = options.href; | ||
a.target = "_blank"; | ||
if (!/\.github\.com$/.test("." + a.hostname)) { | ||
a.href = "#"; | ||
a.target = "_self"; | ||
} else if (/^https?:\/\/((gist\.)?github\.com\/[^\/?#]+\/[^\/?#]+\/archive\/|github\.com\/[^\/?#]+\/[^\/?#]+\/releases\/download\/|codeload\.github\.com\/)/.test(a.href)) { | ||
a.target = "_top"; | ||
if (!(/^(true|1)$/i.test(options['data-show-count']) && btn.hostname === 'github.com')) { | ||
callback(); | ||
return | ||
} | ||
var match = btn.pathname.replace(/^(?!\/)/, '/').match(/^\/([^/?#]+)(?:\/([^/?#]+)(?:\/(?:(subscription)|(fork)|(issues)|([^/?#]+)))?)?(?:[/?#]|$)/); | ||
if (!(match && !match[6])) { | ||
callback(); | ||
return | ||
} | ||
var api, href, property; | ||
if (match[2]) { | ||
api = '/repos/' + match[1] + '/' + match[2]; | ||
if (match[3]) { | ||
property = 'subscribers_count'; | ||
href = 'watchers'; | ||
} else if (match[4]) { | ||
property = 'forks_count'; | ||
href = 'network'; | ||
} else if (match[5]) { | ||
property = 'open_issues_count'; | ||
href = 'issues'; | ||
} else { | ||
property = 'stargazers_count'; | ||
href = 'stargazers'; | ||
} | ||
a.className = "btn"; | ||
if (ariaLabel = options["aria-label"]) { | ||
a.setAttribute("aria-label", ariaLabel); | ||
} else { | ||
api = '/users/' + match[1]; | ||
href = property = 'followers'; | ||
} | ||
fetch.call(this, apiBaseURL + api, function (error, json) { | ||
if (!error) { | ||
var data = json[property]; | ||
widget.appendChild(createElement('a', { | ||
className: 'social-count', | ||
href: json.html_url + '/' + href, | ||
target: '_blank', | ||
'aria-label': data + ' ' + property.replace(/_count$/, '').replace('_', ' ').slice(0, data < 2 ? -1 : void 0) + ' on GitHub' | ||
}, [ | ||
createElement('b'), | ||
createElement('i'), | ||
createElement('span', {}, [('' + data).replace(/\B(?=(\d{3})+(?!\d))/g, ',')]) | ||
])); | ||
} | ||
a.innerHTML = octicon(options["data-icon"], /^large$/i.test(options["data-size"]) ? 18 : 14); | ||
a.appendChild(createTextNode(" ")); | ||
span = a.appendChild(createElement("span")); | ||
span.appendChild(createTextNode(options["data-text"] || "")); | ||
return widget.appendChild(a); | ||
})(); | ||
(function() { | ||
var api, href, match, property; | ||
if (!(/^(true|1)$/i.test(options["data-show-count"]) && button.hostname === "github.com")) { | ||
return callback(); | ||
callback(); | ||
}); | ||
}; | ||
var stringify = function (obj) { | ||
var params = []; | ||
for (var name in obj) { | ||
var value = obj[name]; | ||
if (value != null) { | ||
params.push(encodeURIComponent(name) + '=' + encodeURIComponent(value)); | ||
} | ||
match = button.pathname.replace(/^(?!\/)/, "/").match(/^\/([^\/?#]+)(?:\/([^\/?#]+)(?:\/(?:(subscription)|(fork)|(issues)|([^\/?#]+)))?)?(?:[\/?#]|$)/); | ||
if (!(match && !match[6])) { | ||
return callback(); | ||
} | ||
if (match[2]) { | ||
api = "/repos/" + match[1] + "/" + match[2]; | ||
if (match[3]) { | ||
property = "subscribers_count"; | ||
href = "watchers"; | ||
} else if (match[4]) { | ||
property = "forks_count"; | ||
href = "network"; | ||
} else if (match[5]) { | ||
property = "open_issues_count"; | ||
href = "issues"; | ||
} else { | ||
property = "stargazers_count"; | ||
href = "stargazers"; | ||
} | ||
} else { | ||
api = "/users/" + match[1]; | ||
href = property = "followers"; | ||
} | ||
fetch.call(contentWindow, apiBaseURL + api, function(error, json) { | ||
var a, data, span; | ||
if (!error) { | ||
data = json[property]; | ||
a = createElement("a"); | ||
a.href = json.html_url + "/" + href; | ||
a.target = "_blank"; | ||
a.className = "social-count"; | ||
a.setAttribute("aria-label", data + " " + (property.replace(/_count$/, "").replace("_", " ").slice(0, data < 2 ? -1 : void 0)) + " on GitHub"); | ||
a.appendChild(createElement("b")); | ||
a.appendChild(createElement("i")); | ||
span = a.appendChild(createElement("span")); | ||
span.appendChild(document.createTextNode(("" + data).replace(/\B(?=(\d{3})+(?!\d))/g, ","))); | ||
button.parentNode.insertBefore(a, button.nextSibling); | ||
} | ||
callback(); | ||
}); | ||
})(); | ||
} | ||
return params.join('&') | ||
}; | ||
var ceilPixel, devicePixelRatio; | ||
var devicePixelRatio = window.devicePixelRatio || /* istanbul ignore next */ 1; | ||
/* istanbul ignore next */ | ||
devicePixelRatio = window.devicePixelRatio || 1; | ||
ceilPixel = function(px) { | ||
return (devicePixelRatio > 1 ? Math.ceil(Math.round(px * devicePixelRatio) / devicePixelRatio * 2) / 2 : Math.ceil(px)) || 0; | ||
var ceilPixel = function (px) { | ||
return (devicePixelRatio > 1 ? Math.ceil(Math.round(px * devicePixelRatio) / devicePixelRatio * 2) / 2 : Math.ceil(px)) || 0 | ||
}; | ||
var get, set; | ||
get = function(el) { | ||
var boundingClientRect, height, width; | ||
width = el.scrollWidth; | ||
height = el.scrollHeight; | ||
var get = function (el) { | ||
var width = el.scrollWidth; | ||
var height = el.scrollHeight; | ||
if (el.getBoundingClientRect) { | ||
boundingClientRect = el.getBoundingClientRect(); | ||
var boundingClientRect = el.getBoundingClientRect(); | ||
width = Math.max(width, ceilPixel(boundingClientRect.width || boundingClientRect.right - boundingClientRect.left)); | ||
height = Math.max(height, ceilPixel(boundingClientRect.height || boundingClientRect.bottom - boundingClientRect.top)); | ||
} | ||
return [width, height]; | ||
return [width, height] | ||
}; | ||
set = function(el, size) { | ||
el.style.width = size[0] + "px"; | ||
el.style.height = size[1] + "px"; | ||
var set = function (el, size) { | ||
el.style.width = size[0] + 'px'; | ||
el.style.height = size[1] + 'px'; | ||
}; | ||
var render$1; | ||
render$1 = function(options, func) { | ||
var HTMLElement, host, iframe, name, ref, title, value; | ||
if (!((options != null) && (func != null))) { | ||
return; | ||
var render$1 = function (options, func) { | ||
if (options == null || func == null) { | ||
return | ||
} | ||
@@ -312,40 +319,28 @@ if (options.getAttribute) { | ||
} | ||
if ((HTMLElement = window.HTMLElement) && HTMLElement.prototype.attachShadow && !HTMLElement.prototype.attachShadow.prototype) { | ||
host = createElement("span"); | ||
if (title = options.title) { | ||
host.title = title; | ||
} | ||
render(host.attachShadow({ | ||
mode: "closed" | ||
}), options, function() { | ||
if (useShadowDOM) { | ||
var host = createElement('span', { | ||
title: options.title || void 0 | ||
}); | ||
render(host.attachShadow({ mode: 'closed' }), options, function () { | ||
func(host); | ||
}); | ||
} else { | ||
iframe = createElement("iframe"); | ||
ref = { | ||
var iframe = createElement('iframe', { | ||
src: 'javascript:0', | ||
title: options.title || void 0, | ||
allowtransparency: true, | ||
scrolling: "no", | ||
scrolling: 'no', | ||
frameBorder: 0 | ||
}; | ||
for (name in ref) { | ||
value = ref[name]; | ||
iframe.setAttribute(name, value); | ||
} | ||
}); | ||
set(iframe, [1, 0]); | ||
iframe.style.border = "none"; | ||
iframe.src = "javascript:0"; | ||
onceEvent(iframe, "load", function() { | ||
var contentWindow; | ||
contentWindow = iframe.contentWindow; | ||
render.call(contentWindow, contentWindow.document.body, options, function(widget) { | ||
var size; | ||
size = get(widget); | ||
iframe.style.border = 'none'; | ||
onceEvent(iframe, 'load', function () { | ||
var contentWindow = iframe.contentWindow; | ||
render.call(contentWindow, contentWindow.document.body, options, function (widget) { | ||
var size = get(widget); | ||
iframe.parentNode.removeChild(iframe); | ||
onceEvent(iframe, "load", function() { | ||
onceEvent(iframe, 'load', function () { | ||
set(iframe, size); | ||
}); | ||
iframe.src = iframeURL + "#" + stringify(options); | ||
if (title = options.title) { | ||
iframe.title = title; | ||
} | ||
iframe.src = iframeURL + '#' + stringify(options); | ||
func(iframe); | ||
@@ -352,0 +347,0 @@ }); |
/*! | ||
* github-buttons v2.0.5 | ||
* github-buttons v2.1.0 | ||
* (c) 2019 なつき | ||
@@ -19,70 +19,61 @@ * @license BSD-2-Clause | ||
var createElement = function(tag) { | ||
return document.createElement(tag); | ||
}; | ||
var HTMLElement = window.HTMLElement; | ||
var XMLHttpRequest = window.XMLHttpRequest; | ||
var name = "github-buttons"; | ||
var version = "2.0.5"; | ||
var version = "2.1.0"; | ||
var apiBaseURL, buttonClass, iframeURL; | ||
var buttonClass = 'github-button'; | ||
buttonClass = "github-button"; | ||
var iframeURL = (/* istanbul ignore next */ /^http:/.test(location) ? 'http' : 'https') + '://' + (/* istanbul ignore next */ 'unpkg.com/' + name + '@' + version + '/dist') + '/buttons.html'; | ||
var apiBaseURL = 'https://api.github.com'; | ||
/* istanbul ignore next */ | ||
var useShadowDOM = HTMLElement && HTMLElement.prototype.attachShadow && !HTMLElement.prototype.attachShadow.prototype; | ||
iframeURL = (/^http:/.test(location) ? "http" : "https") + "://" + ("unpkg.com/" + name + "@" + version + "/dist") + "/buttons.html"; | ||
var useXHR = XMLHttpRequest && XMLHttpRequest.prototype && 'withCredentials' in XMLHttpRequest.prototype; | ||
apiBaseURL = "https://api.github.com"; | ||
var stringify = function(obj) { | ||
var name, params, value; | ||
params = []; | ||
for (name in obj) { | ||
value = obj[name]; | ||
var stringify = function (obj) { | ||
var params = []; | ||
for (var name in obj) { | ||
var value = obj[name]; | ||
if (value != null) { | ||
params.push((encodeURIComponent(name)) + "=" + (encodeURIComponent(value))); | ||
params.push(encodeURIComponent(name) + '=' + encodeURIComponent(value)); | ||
} | ||
} | ||
return params.join("&"); | ||
return params.join('&') | ||
}; | ||
var parse = function(str) { | ||
var i, len, pair, params, ref, ref1; | ||
params = {}; | ||
ref1 = str.split("&"); | ||
for (i = 0, len = ref1.length; i < len; i++) { | ||
pair = ref1[i]; | ||
if (!(pair !== "")) { | ||
continue; | ||
var parse = function (str) { | ||
var obj = {}; | ||
var params = str.split('&'); | ||
for (var i = 0, len = params.length; i < len; i++) { | ||
var entry = params[i]; | ||
if (entry !== '') { | ||
var ref = entry.split('='); | ||
obj[decodeURIComponent(ref[0])] = (ref[1] != null ? decodeURIComponent(ref.slice(1).join('=')) : void 0); | ||
} | ||
ref = pair.split("="); | ||
params[decodeURIComponent(ref[0])] = (ref[1] != null ? decodeURIComponent(ref.slice(1).join("=")) : void 0); | ||
} | ||
return params; | ||
return obj | ||
}; | ||
var onEvent, onceEvent; | ||
onEvent = function(target, eventName, func) { | ||
var onEvent = function (target, eventName, func) { | ||
/* istanbul ignore else: IE lt 9 */ | ||
if (target.addEventListener) { | ||
target.addEventListener("" + eventName, func); | ||
target.addEventListener(eventName, func); | ||
} else { | ||
target.attachEvent("on" + eventName, func); | ||
target.attachEvent('on' + eventName, func); | ||
} | ||
}; | ||
onceEvent = function(target, eventName, func) { | ||
var callback; | ||
callback = function(event) { | ||
var onceEvent = function (target, eventName, func) { | ||
var callback = function (event) { | ||
/* istanbul ignore else: IE lt 9 */ | ||
if (target.removeEventListener) { | ||
target.removeEventListener("" + eventName, callback); | ||
target.removeEventListener(eventName, callback); | ||
} else { | ||
target.detachEvent("on" + eventName, callback); | ||
target.detachEvent('on' + eventName, callback); | ||
} | ||
return func(event); | ||
return func(event) | ||
}; | ||
@@ -92,29 +83,60 @@ onEvent(target, eventName, callback); | ||
var defer; | ||
var onceReadyStateChange = /* istanbul ignore next: IE lt 9 */ function (target, regex, func) { | ||
var eventName = 'onreadystatechange'; | ||
var callback = function (event) { | ||
if (regex.test(target.readyState)) { | ||
target.detachEvent(eventName, callback); | ||
return func(event) | ||
} | ||
}; | ||
target.attachEvent(eventName, callback); | ||
}; | ||
var createElementInDocument = function (document) { | ||
return function (tag, props, children) { | ||
var el = document.createElement(tag); | ||
if (props) { | ||
for (var prop in props) { | ||
var val = props[prop]; | ||
if (val != null) { | ||
if (el[prop] != null) { | ||
el[prop] = val; | ||
} else { | ||
el.setAttribute(prop, val); | ||
} | ||
} | ||
} | ||
} | ||
if (children) { | ||
for (var i = 0, len = children.length; i < len; i++) { | ||
var child = children[i]; | ||
el.appendChild(typeof child === 'string' ? document.createTextNode(child) : child); | ||
} | ||
} | ||
return el | ||
} | ||
}; | ||
/* istanbul ignore next */ | ||
var createElement = createElementInDocument(document); | ||
defer = function(func) { | ||
var callback, onceToken; | ||
if (/m/.test(document.readyState) || (!/g/.test(document.readyState) && !document.documentElement.doScroll)) { | ||
var dispatchOnce = function (func) { | ||
var onceToken = 0; | ||
return function () { | ||
if (!onceToken && (onceToken = 1)) { | ||
func.apply(this, arguments); | ||
} | ||
} | ||
}; | ||
var defer = function (func) { | ||
/* istanbul ignore else */ | ||
if (/m/.test(document.readyState) || /* istanbul ignore next */ (!/g/.test(document.readyState) && !document.documentElement.doScroll)) { | ||
setTimeout(func); | ||
} else { | ||
if (document.addEventListener) { | ||
onceToken = 0; | ||
callback = function() { | ||
if (!onceToken && (onceToken = 1)) { | ||
func(); | ||
} | ||
}; | ||
onceEvent(document, "DOMContentLoaded", callback); | ||
onceEvent(window, "load", callback); | ||
var callback = dispatchOnce(func); | ||
onceEvent(document, 'DOMContentLoaded', callback); | ||
onceEvent(window, 'load', callback); | ||
} else { | ||
callback = function() { | ||
if (/m/.test(document.readyState)) { | ||
document.detachEvent("onreadystatechange", callback); | ||
func(); | ||
} | ||
}; | ||
document.attachEvent("onreadystatechange", callback); | ||
onceReadyStateChange(document, /m/, func); | ||
} | ||
@@ -124,59 +146,55 @@ } | ||
var css = "body{margin:0}a{color:#24292e;text-decoration:none;outline:0}.widget{display:inline-block;overflow:hidden;font-family:-apple-system, BlinkMacSystemFont, \"Segoe UI\", Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\";font-size:0;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.btn,.social-count{display:inline-block;font-weight:600;vertical-align:bottom;cursor:pointer;border:1px solid #d1d2d3;border-radius:0.25em}.btn:focus,.social-count:focus{border-color:#c8e1ff}.btn{background-color:#eff3f6;background-image:-webkit-linear-gradient(top, #fafbfc, #e4ebf0);background-image:-moz-linear-gradient(top, #fafbfc, #e4ebf0);background-image:linear-gradient(to bottom, #fafbfc, #e4ebf0);background-repeat:repeat-x;background-size:110% 110%;-ms-filter:\"progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFAFBFC', endColorstr='#FFE4EBF0')\";*filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFAFBFC', endColorstr='#FFE4EBF0')}.btn:active{background-color:#e9ecef;background-image:none;border-color:#afb1b2;box-shadow:inset 0 0.15em 0.3em rgba(27,31,35,0.15)}.btn:hover{background-color:#e6ebf1;background-image:-webkit-linear-gradient(top, #f0f3f6, #dce3ec);background-image:-moz-linear-gradient(top, #f0f3f6, #dce3ec);background-image:linear-gradient(to bottom, #f0f3f6, #dce3ec);border-color:#afb1b2;-ms-filter:\"progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFF0F3F6', endColorstr='#FFDCE3EC')\";*filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFF0F3F6', endColorstr='#FFDCE3EC')}.social-count{position:relative;background-color:#fff}.social-count:hover{color:#0366d6}.octicon{position:relative;display:inline-block;vertical-align:top;fill:currentColor}.btn,.social-count{height:18px;padding:0 5px;line-height:18px}.btn{font-size:11px}.social-count{margin-left:5px;font-size:10px}.octicon{top:2px}.large .btn,.large .social-count{height:26px;line-height:26px}.large .btn{padding:0 10px;font-size:12px}.large .social-count{padding:0 7px;margin-left:7px;font-size:11px}.large .octicon{top:4px}.social-count b,.social-count i{position:absolute;top:50%;left:0;display:block;width:0;height:0;margin:-4px 0 0 -4px;_font-size:0;_line-height:0;border:solid transparent;border-width:4px 4px 4px 0}.social-count b{border-right-color:#d1d2d3}.social-count:focus b{border-right-color:#c8e1ff}.social-count i{margin-left:-3px;border-right-color:#fff}.social-count b,.social-count i{_border-top-color:red !important;_border-bottom-color:red !important;_border-left-color:red !important;_filter:chroma(color=red)}.large .social-count b,.large .social-count i{margin:-5px 0 0 -5px;border-width:5px 5px 5px 0}.large .social-count i{margin-left:-4px}\n"; | ||
var cssText = "body{margin:0}a{color:#24292e;text-decoration:none;outline:0}.widget{display:inline-block;overflow:hidden;font-family:-apple-system, BlinkMacSystemFont, \"Segoe UI\", Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\";font-size:0;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.btn,.social-count{display:inline-block;font-weight:600;vertical-align:bottom;cursor:pointer;border:1px solid #d1d2d3;border-radius:0.25em}.btn:focus,.social-count:focus{border-color:#c8e1ff}.btn{background-color:#eff3f6;background-image:-webkit-linear-gradient(top, #fafbfc, #e4ebf0);background-image:-moz-linear-gradient(top, #fafbfc, #e4ebf0);background-image:linear-gradient(to bottom, #fafbfc, #e4ebf0);background-repeat:repeat-x;background-size:110% 110%;-ms-filter:\"progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFAFBFC', endColorstr='#FFE4EBF0')\";*filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFAFBFC', endColorstr='#FFE4EBF0')}.btn:active{background-color:#e9ecef;background-image:none;border-color:#afb1b2;box-shadow:inset 0 0.15em 0.3em rgba(27,31,35,0.15)}.btn:hover{background-color:#e6ebf1;background-image:-webkit-linear-gradient(top, #f0f3f6, #dce3ec);background-image:-moz-linear-gradient(top, #f0f3f6, #dce3ec);background-image:linear-gradient(to bottom, #f0f3f6, #dce3ec);border-color:#afb1b2;-ms-filter:\"progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFF0F3F6', endColorstr='#FFDCE3EC')\";*filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFF0F3F6', endColorstr='#FFDCE3EC')}.social-count{position:relative;background-color:#fff}.social-count:hover{color:#0366d6}.octicon{position:relative;display:inline-block;vertical-align:top;fill:currentColor}.btn,.social-count{height:18px;padding:0 5px;line-height:18px}.btn{font-size:11px}.social-count{margin-left:5px;font-size:10px}.octicon{top:2px}.large .btn,.large .social-count{height:26px;line-height:26px}.large .btn{padding:0 10px;font-size:12px}.large .social-count{padding:0 7px;margin-left:7px;font-size:11px}.large .octicon{top:4px}.social-count b,.social-count i{position:absolute;top:50%;left:0;display:block;width:0;height:0;margin:-4px 0 0 -4px;_font-size:0;_line-height:0;border:solid transparent;border-width:4px 4px 4px 0}.social-count b{border-right-color:#d1d2d3}.social-count:focus b{border-right-color:#c8e1ff}.social-count i{margin-left:-3px;border-right-color:#fff}.social-count b,.social-count i{_border-top-color:red !important;_border-bottom-color:red !important;_border-left-color:red !important;_filter:chroma(color=red)}.large .social-count b,.large .social-count i{margin:-5px 0 0 -5px;border-width:5px 5px 5px 0}.large .social-count i{margin-left:-4px}\n"; | ||
var data = {"mark-github":{"width":16,"height":16,"path":"<path fill-rule=\"evenodd\" d=\"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z\"/>"},"eye":{"width":16,"height":16,"path":"<path fill-rule=\"evenodd\" d=\"M8.06 2C3 2 0 8 0 8s3 6 8.06 6C13 14 16 8 16 8s-3-6-7.94-6zM8 12c-2.2 0-4-1.78-4-4 0-2.2 1.8-4 4-4 2.22 0 4 1.8 4 4 0 2.22-1.78 4-4 4zm2-4c0 1.11-.89 2-2 2-1.11 0-2-.89-2-2 0-1.11.89-2 2-2 1.11 0 2 .89 2 2z\"/>"},"star":{"width":14,"height":16,"path":"<path fill-rule=\"evenodd\" d=\"M14 6l-4.9-.64L7 1 4.9 5.36 0 6l3.6 3.26L2.67 14 7 11.67 11.33 14l-.93-4.74L14 6z\"/>"},"repo-forked":{"width":10,"height":16,"path":"<path fill-rule=\"evenodd\" d=\"M8 1a1.993 1.993 0 0 0-1 3.72V6L5 8 3 6V4.72A1.993 1.993 0 0 0 2 1a1.993 1.993 0 0 0-1 3.72V6.5l3 3v1.78A1.993 1.993 0 0 0 5 15a1.993 1.993 0 0 0 1-3.72V9.5l3-3V4.72A1.993 1.993 0 0 0 8 1zM2 4.2C1.34 4.2.8 3.65.8 3c0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zm3 10c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zm3-10c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2z\"/>"},"issue-opened":{"width":14,"height":16,"path":"<path fill-rule=\"evenodd\" d=\"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z\"/>"},"cloud-download":{"width":16,"height":16,"path":"<path fill-rule=\"evenodd\" d=\"M9 12h2l-3 3-3-3h2V7h2v5zm3-8c0-.44-.91-3-4.5-3C5.08 1 3 2.92 3 5 1.02 5 0 6.52 0 8c0 1.53 1 3 3 3h3V9.7H3C1.38 9.7 1.3 8.28 1.3 8c0-.17.05-1.7 1.7-1.7h1.3V5c0-1.39 1.56-2.7 3.2-2.7 2.55 0 3.13 1.55 3.2 1.8v1.2H12c.81 0 2.7.22 2.7 2.2 0 2.09-2.25 2.2-2.7 2.2h-2V11h2c2.08 0 4-1.16 4-3.5C16 5.06 14.08 4 12 4z\"/>"}}; | ||
var octicon; | ||
octicon = function(icon, height) { | ||
var width; | ||
icon = ("" + icon).toLowerCase().replace(/^octicon-/, ""); | ||
var octicon = function (icon, height) { | ||
icon = ('' + icon).toLowerCase().replace(/^octicon-/, ''); | ||
if (!data.hasOwnProperty(icon)) { | ||
icon = "mark-github"; | ||
icon = 'mark-github'; | ||
} | ||
width = height * data[icon].width / data[icon].height; | ||
return "<svg version=\"1.1\" width=\"" + width + "\" height=\"" + height + "\" viewBox=\"0 0 " + data[icon].width + " " + data[icon].height + "\" class=\"octicon octicon-" + icon + "\" aria-hidden=\"true\">" + data[icon].path + "</svg>"; | ||
return '<svg version="1.1" width="' + (height * data[icon].width / data[icon].height) + '" height="' + height + '" viewBox="0 0 ' + data[icon].width + ' ' + data[icon].height + '" class="octicon octicon-' + icon + '" aria-hidden="true">' + data[icon].path + '</svg>' | ||
}; | ||
var fetch, queues; | ||
var queues = {}; | ||
queues = {}; | ||
var fetch = function (url, func) { | ||
var queue = queues[url] || (queues[url] = []); | ||
if (queue.push(func) > 1) { | ||
return | ||
} | ||
fetch = function(url, func) { | ||
var XMLHttpRequest, callback, contentWindow, onceToken, onloadend, queue, script, xhr; | ||
if (1 < (queue = (queues[url] || (queues[url] = []))).push(func)) { | ||
return; | ||
} | ||
onceToken = 0; | ||
callback = function() { | ||
if (!onceToken && (onceToken = 1)) { | ||
delete queues[url]; | ||
while (func = queue.shift()) { | ||
func.apply(null, arguments); | ||
} | ||
var callback = dispatchOnce(function () { | ||
delete queues[url]; | ||
while ((func = queue.shift())) { | ||
func.apply(null, arguments); | ||
} | ||
}; | ||
if ((XMLHttpRequest = window.XMLHttpRequest) && "withCredentials" in XMLHttpRequest.prototype) { | ||
xhr = new XMLHttpRequest(); | ||
onEvent(xhr, "abort", callback); | ||
onEvent(xhr, "error", callback); | ||
onEvent(xhr, "load", function() { | ||
callback(xhr.status !== 200, (function() { | ||
}); | ||
if (useXHR) { | ||
var xhr = new XMLHttpRequest(); | ||
onEvent(xhr, 'abort', callback); | ||
onEvent(xhr, 'error', callback); | ||
onEvent(xhr, 'load', function () { | ||
// eslint-disable-next-line standard/no-callback-literal | ||
callback(xhr.status !== 200, (function () { | ||
try { | ||
return JSON.parse(xhr.responseText); | ||
} catch (error) {} | ||
return JSON.parse(xhr.responseText) | ||
} catch (_) {} | ||
})()); | ||
}); | ||
xhr.open("GET", url); | ||
xhr.open('GET', url); | ||
xhr.send(); | ||
} else { | ||
contentWindow = this || window; | ||
contentWindow._ = function(json) { | ||
var contentWindow = this || window; | ||
contentWindow._ = function (json) { | ||
contentWindow._ = null; | ||
// eslint-disable-next-line standard/no-callback-literal | ||
callback(json.meta.status !== 200, json.data); | ||
}; | ||
script = contentWindow.document.createElement("script"); | ||
script.async = true; | ||
script.src = url + (/\?/.test(url) ? "&" : "?") + "callback=_"; | ||
onloadend = function() { | ||
var script = createElementInDocument(contentWindow.document)('script', { | ||
async: true, | ||
src: url + (/\?/.test(url) ? '&' : '?') + 'callback=_' | ||
}); | ||
var onloadend = /* istanbul ignore next: IE lt 9 */ function () { | ||
if (contentWindow._) { | ||
@@ -188,44 +206,49 @@ contentWindow._({ | ||
}; | ||
onEvent(script, "error", onloadend); | ||
onEvent(script, 'load', onloadend); | ||
onEvent(script, 'error', onloadend); | ||
/* istanbul ignore if: IE lt 9 */ | ||
if (script.readyState) { | ||
/* istanbul ignore next: IE lt 9 */ | ||
onEvent(script, "readystatechange", function() { | ||
if (script.readyState === "loaded") { | ||
onloadend(); | ||
} | ||
}); | ||
onceReadyStateChange(script, /de|m/, onloadend); | ||
} | ||
contentWindow.document.getElementsByTagName("head")[0].appendChild(script); | ||
contentWindow.document.getElementsByTagName('head')[0].appendChild(script); | ||
} | ||
}; | ||
var render; | ||
var render = function (root, options, func) { | ||
var createElement = createElementInDocument(root.ownerDocument); | ||
render = function(root, options, func) { | ||
var button, callback, contentWindow, createElement, createTextNode, document, style, widget; | ||
if (!options) { | ||
return; | ||
} | ||
contentWindow = this; | ||
document = root.ownerDocument; | ||
createElement = function(tag) { | ||
return document.createElement(tag); | ||
}; | ||
createTextNode = function(text) { | ||
return document.createTextNode(text); | ||
}; | ||
style = createElement("style"); | ||
style.type = "text/css"; | ||
root.appendChild(style); | ||
/* istanbul ignore if */ | ||
var style = root.appendChild(createElement('style', { | ||
type: 'text/css' | ||
})); | ||
/* istanbul ignore if: IE lt 9 */ | ||
if (style.styleSheet) { | ||
style.styleSheet.cssText = css; | ||
style.styleSheet.cssText = cssText; | ||
} else { | ||
style.appendChild(createTextNode(css)); | ||
style.appendChild(root.ownerDocument.createTextNode(cssText)); | ||
} | ||
widget = root.appendChild(createElement("div")); | ||
widget.className = "widget" + (/^large$/i.test(options["data-size"]) ? " large" : ""); | ||
callback = function() { | ||
var btn = createElement('a', { | ||
className: 'btn', | ||
href: options.href, | ||
target: '_blank', | ||
innerHTML: octicon(options['data-icon'], /^large$/i.test(options['data-size']) ? 18 : 14), | ||
'aria-label': options['aria-label'] || void 0 | ||
}, [ | ||
' ', | ||
createElement('span', {}, [options['data-text'] || '']) | ||
]); | ||
if (!/\.github\.com$/.test('.' + btn.hostname)) { | ||
btn.href = '#'; | ||
btn.target = '_self'; | ||
} else if (/^https?:\/\/((gist\.)?github\.com\/[^/?#]+\/[^/?#]+\/archive\/|github\.com\/[^/?#]+\/[^/?#]+\/releases\/download\/|codeload\.github\.com\/)/.test(btn.href)) { | ||
btn.target = '_top'; | ||
} | ||
var widget = root.appendChild(createElement('div', { | ||
className: 'widget' + (/^large$/i.test(options['data-size']) ? ' large' : '') | ||
}, [ | ||
btn | ||
])); | ||
var callback = function () { | ||
if (func) { | ||
@@ -235,126 +258,92 @@ func(widget); | ||
}; | ||
button = (function() { | ||
var a, ariaLabel, span; | ||
a = createElement("a"); | ||
a.href = options.href; | ||
a.target = "_blank"; | ||
if (!/\.github\.com$/.test("." + a.hostname)) { | ||
a.href = "#"; | ||
a.target = "_self"; | ||
} else if (/^https?:\/\/((gist\.)?github\.com\/[^\/?#]+\/[^\/?#]+\/archive\/|github\.com\/[^\/?#]+\/[^\/?#]+\/releases\/download\/|codeload\.github\.com\/)/.test(a.href)) { | ||
a.target = "_top"; | ||
if (!(/^(true|1)$/i.test(options['data-show-count']) && btn.hostname === 'github.com')) { | ||
callback(); | ||
return | ||
} | ||
var match = btn.pathname.replace(/^(?!\/)/, '/').match(/^\/([^/?#]+)(?:\/([^/?#]+)(?:\/(?:(subscription)|(fork)|(issues)|([^/?#]+)))?)?(?:[/?#]|$)/); | ||
if (!(match && !match[6])) { | ||
callback(); | ||
return | ||
} | ||
var api, href, property; | ||
if (match[2]) { | ||
api = '/repos/' + match[1] + '/' + match[2]; | ||
if (match[3]) { | ||
property = 'subscribers_count'; | ||
href = 'watchers'; | ||
} else if (match[4]) { | ||
property = 'forks_count'; | ||
href = 'network'; | ||
} else if (match[5]) { | ||
property = 'open_issues_count'; | ||
href = 'issues'; | ||
} else { | ||
property = 'stargazers_count'; | ||
href = 'stargazers'; | ||
} | ||
a.className = "btn"; | ||
if (ariaLabel = options["aria-label"]) { | ||
a.setAttribute("aria-label", ariaLabel); | ||
} else { | ||
api = '/users/' + match[1]; | ||
href = property = 'followers'; | ||
} | ||
fetch.call(this, apiBaseURL + api, function (error, json) { | ||
if (!error) { | ||
var data = json[property]; | ||
widget.appendChild(createElement('a', { | ||
className: 'social-count', | ||
href: json.html_url + '/' + href, | ||
target: '_blank', | ||
'aria-label': data + ' ' + property.replace(/_count$/, '').replace('_', ' ').slice(0, data < 2 ? -1 : void 0) + ' on GitHub' | ||
}, [ | ||
createElement('b'), | ||
createElement('i'), | ||
createElement('span', {}, [('' + data).replace(/\B(?=(\d{3})+(?!\d))/g, ',')]) | ||
])); | ||
} | ||
a.innerHTML = octicon(options["data-icon"], /^large$/i.test(options["data-size"]) ? 18 : 14); | ||
a.appendChild(createTextNode(" ")); | ||
span = a.appendChild(createElement("span")); | ||
span.appendChild(createTextNode(options["data-text"] || "")); | ||
return widget.appendChild(a); | ||
})(); | ||
(function() { | ||
var api, href, match, property; | ||
if (!(/^(true|1)$/i.test(options["data-show-count"]) && button.hostname === "github.com")) { | ||
return callback(); | ||
} | ||
match = button.pathname.replace(/^(?!\/)/, "/").match(/^\/([^\/?#]+)(?:\/([^\/?#]+)(?:\/(?:(subscription)|(fork)|(issues)|([^\/?#]+)))?)?(?:[\/?#]|$)/); | ||
if (!(match && !match[6])) { | ||
return callback(); | ||
} | ||
if (match[2]) { | ||
api = "/repos/" + match[1] + "/" + match[2]; | ||
if (match[3]) { | ||
property = "subscribers_count"; | ||
href = "watchers"; | ||
} else if (match[4]) { | ||
property = "forks_count"; | ||
href = "network"; | ||
} else if (match[5]) { | ||
property = "open_issues_count"; | ||
href = "issues"; | ||
} else { | ||
property = "stargazers_count"; | ||
href = "stargazers"; | ||
} | ||
} else { | ||
api = "/users/" + match[1]; | ||
href = property = "followers"; | ||
} | ||
fetch.call(contentWindow, apiBaseURL + api, function(error, json) { | ||
var a, data, span; | ||
if (!error) { | ||
data = json[property]; | ||
a = createElement("a"); | ||
a.href = json.html_url + "/" + href; | ||
a.target = "_blank"; | ||
a.className = "social-count"; | ||
a.setAttribute("aria-label", data + " " + (property.replace(/_count$/, "").replace("_", " ").slice(0, data < 2 ? -1 : void 0)) + " on GitHub"); | ||
a.appendChild(createElement("b")); | ||
a.appendChild(createElement("i")); | ||
span = a.appendChild(createElement("span")); | ||
span.appendChild(document.createTextNode(("" + data).replace(/\B(?=(\d{3})+(?!\d))/g, ","))); | ||
button.parentNode.insertBefore(a, button.nextSibling); | ||
} | ||
callback(); | ||
}); | ||
})(); | ||
callback(); | ||
}); | ||
}; | ||
var parseOptions = function(anchor) { | ||
var attribute, i, len, options, ref; | ||
options = { | ||
"href": anchor.href, | ||
"title": anchor.title, | ||
"aria-label": anchor.getAttribute("aria-label") | ||
var parseOptions = function (anchor) { | ||
var options = { | ||
href: anchor.href, | ||
title: anchor.title, | ||
'aria-label': anchor.getAttribute('aria-label') | ||
}; | ||
ref = ["icon", "text", "size", "show-count"]; | ||
for (i = 0, len = ref.length; i < len; i++) { | ||
attribute = ref[i]; | ||
attribute = "data-" + attribute; | ||
var ref = ['icon', 'text', 'size', 'show-count']; | ||
for (var i = 0, len = ref.length; i < len; i++) { | ||
var attribute = 'data-' + ref[i]; | ||
options[attribute] = anchor.getAttribute(attribute); | ||
} | ||
if (options["data-text"] == null) { | ||
options["data-text"] = anchor.textContent || anchor.innerText; | ||
if (options['data-text'] == null) { | ||
options['data-text'] = anchor.textContent || anchor.innerText; | ||
} | ||
return options; | ||
return options | ||
}; | ||
var ceilPixel, devicePixelRatio; | ||
var devicePixelRatio = window.devicePixelRatio || /* istanbul ignore next */ 1; | ||
/* istanbul ignore next */ | ||
devicePixelRatio = window.devicePixelRatio || 1; | ||
ceilPixel = function(px) { | ||
return (devicePixelRatio > 1 ? Math.ceil(Math.round(px * devicePixelRatio) / devicePixelRatio * 2) / 2 : Math.ceil(px)) || 0; | ||
var ceilPixel = function (px) { | ||
return (devicePixelRatio > 1 ? Math.ceil(Math.round(px * devicePixelRatio) / devicePixelRatio * 2) / 2 : Math.ceil(px)) || 0 | ||
}; | ||
var get, set; | ||
get = function(el) { | ||
var boundingClientRect, height, width; | ||
width = el.scrollWidth; | ||
height = el.scrollHeight; | ||
var get = function (el) { | ||
var width = el.scrollWidth; | ||
var height = el.scrollHeight; | ||
if (el.getBoundingClientRect) { | ||
boundingClientRect = el.getBoundingClientRect(); | ||
var boundingClientRect = el.getBoundingClientRect(); | ||
width = Math.max(width, ceilPixel(boundingClientRect.width || boundingClientRect.right - boundingClientRect.left)); | ||
height = Math.max(height, ceilPixel(boundingClientRect.height || boundingClientRect.bottom - boundingClientRect.top)); | ||
} | ||
return [width, height]; | ||
return [width, height] | ||
}; | ||
set = function(el, size) { | ||
el.style.width = size[0] + "px"; | ||
el.style.height = size[1] + "px"; | ||
var set = function (el, size) { | ||
el.style.width = size[0] + 'px'; | ||
el.style.height = size[1] + 'px'; | ||
}; | ||
var render$1; | ||
render$1 = function(options, func) { | ||
var HTMLElement, host, iframe, name, ref, title, value; | ||
if (!((options != null) && (func != null))) { | ||
return; | ||
var render$1 = function (options, func) { | ||
if (options == null || func == null) { | ||
return | ||
} | ||
@@ -364,40 +353,28 @@ if (options.getAttribute) { | ||
} | ||
if ((HTMLElement = window.HTMLElement) && HTMLElement.prototype.attachShadow && !HTMLElement.prototype.attachShadow.prototype) { | ||
host = createElement("span"); | ||
if (title = options.title) { | ||
host.title = title; | ||
} | ||
render(host.attachShadow({ | ||
mode: "closed" | ||
}), options, function() { | ||
if (useShadowDOM) { | ||
var host = createElement('span', { | ||
title: options.title || void 0 | ||
}); | ||
render(host.attachShadow({ mode: 'closed' }), options, function () { | ||
func(host); | ||
}); | ||
} else { | ||
iframe = createElement("iframe"); | ||
ref = { | ||
var iframe = createElement('iframe', { | ||
src: 'javascript:0', | ||
title: options.title || void 0, | ||
allowtransparency: true, | ||
scrolling: "no", | ||
scrolling: 'no', | ||
frameBorder: 0 | ||
}; | ||
for (name in ref) { | ||
value = ref[name]; | ||
iframe.setAttribute(name, value); | ||
} | ||
}); | ||
set(iframe, [1, 0]); | ||
iframe.style.border = "none"; | ||
iframe.src = "javascript:0"; | ||
onceEvent(iframe, "load", function() { | ||
var contentWindow; | ||
contentWindow = iframe.contentWindow; | ||
render.call(contentWindow, contentWindow.document.body, options, function(widget) { | ||
var size; | ||
size = get(widget); | ||
iframe.style.border = 'none'; | ||
onceEvent(iframe, 'load', function () { | ||
var contentWindow = iframe.contentWindow; | ||
render.call(contentWindow, contentWindow.document.body, options, function (widget) { | ||
var size = get(widget); | ||
iframe.parentNode.removeChild(iframe); | ||
onceEvent(iframe, "load", function() { | ||
onceEvent(iframe, 'load', function () { | ||
set(iframe, size); | ||
}); | ||
iframe.src = iframeURL + "#" + stringify(options); | ||
if (title = options.title) { | ||
iframe.title = title; | ||
} | ||
iframe.src = iframeURL + '#' + stringify(options); | ||
func(iframe); | ||
@@ -410,38 +387,28 @@ }); | ||
var render$2; | ||
/* istanbul ignore next */ | ||
render$2 = function() { | ||
var anchor, anchors, fn, i, j, len, len1, ref; | ||
anchors = []; | ||
if (document.querySelectorAll) { | ||
anchors = document.querySelectorAll("a." + buttonClass); | ||
} else { | ||
ref = document.getElementsByTagName("a"); | ||
for (i = 0, len = ref.length; i < len; i++) { | ||
anchor = ref[i]; | ||
if (~(" " + anchor.className + " ").replace(/[ \t\n\f\r]+/g, " ").indexOf(" " + buttonClass + " ")) { | ||
anchors.push(anchor); | ||
} | ||
if (location.protocol + '//' + location.host + location.pathname === iframeURL) { | ||
render(document.body, parse(location.hash.replace(/^#/, ''))); | ||
} else { | ||
defer(function () { | ||
var ref = document.querySelectorAll | ||
? document.querySelectorAll('a.' + buttonClass) | ||
: (function () { | ||
var results = []; | ||
var ref = document.getElementsByTagName('a'); | ||
for (var i = 0, len = ref.length; i < len; i++) { | ||
if (~(' ' + ref[i].className + ' ').replace(/[ \t\n\f\r]+/g, ' ').indexOf(' ' + buttonClass + ' ')) { | ||
results.push(ref[i]); | ||
} | ||
} | ||
return results | ||
})(); | ||
for (var i = 0, len = ref.length; i < len; i++) { | ||
(function (anchor) { | ||
render$1(anchor, function (el) { | ||
anchor.parentNode.replaceChild(el, anchor); | ||
}); | ||
})(ref[i]); | ||
} | ||
} | ||
fn = function(anchor) { | ||
render$1(anchor, function(el) { | ||
anchor.parentNode.replaceChild(el, anchor); | ||
}); | ||
}; | ||
for (j = 0, len1 = anchors.length; j < len1; j++) { | ||
anchor = anchors[j]; | ||
fn(anchor); | ||
} | ||
}; | ||
if (location.protocol + "//" + location.host + location.pathname === iframeURL) { | ||
render(document.body, parse(location.hash.replace(/^#/, ""))); | ||
} else { | ||
defer(render$2); | ||
}); | ||
} | ||
}()); |
/*! | ||
* github-buttons v2.0.5 | ||
* github-buttons v2.1.0 | ||
* (c) 2019 なつき | ||
* @license BSD-2-Clause | ||
*/ | ||
!function(){"use strict";var t,e=window.document,o=e.location,n=window.encodeURIComponent,r=window.decodeURIComponent,a=window.Math,i=function(t){return e.createElement(t)};t=(/^http:/.test(o)?"http":"https")+"://unpkg.com/github-buttons@2.0.5/dist/buttons.html";var l,c,d;l=function(t,e,o){t.addEventListener?t.addEventListener(""+e,o):t.attachEvent("on"+e,o)},c=function(t,e,o){var n;n=function(r){return t.removeEventListener?t.removeEventListener(""+e,n):t.detachEvent("on"+e,n),o(r)},l(t,e,n)},d=function(t){var o,n;/m/.test(e.readyState)||!/g/.test(e.readyState)&&!e.documentElement.doScroll?setTimeout(t):e.addEventListener?(n=0,c(e,"DOMContentLoaded",o=function(){!n&&(n=1)&&t()}),c(window,"load",o)):(o=function(){/m/.test(e.readyState)&&(e.detachEvent("onreadystatechange",o),t())},e.attachEvent("onreadystatechange",o))};var s,h,u,p,f="body{margin:0}a{color:#24292e;text-decoration:none;outline:0}.widget{display:inline-block;overflow:hidden;font-family:-apple-system, BlinkMacSystemFont, \"Segoe UI\", Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\";font-size:0;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.btn,.social-count{display:inline-block;font-weight:600;vertical-align:bottom;cursor:pointer;border:1px solid #d1d2d3;border-radius:0.25em}.btn:focus,.social-count:focus{border-color:#c8e1ff}.btn{background-color:#eff3f6;background-image:-webkit-linear-gradient(top, #fafbfc, #e4ebf0);background-image:-moz-linear-gradient(top, #fafbfc, #e4ebf0);background-image:linear-gradient(to bottom, #fafbfc, #e4ebf0);background-repeat:repeat-x;background-size:110% 110%;-ms-filter:\"progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFAFBFC', endColorstr='#FFE4EBF0')\";*filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFAFBFC', endColorstr='#FFE4EBF0')}.btn:active{background-color:#e9ecef;background-image:none;border-color:#afb1b2;box-shadow:inset 0 0.15em 0.3em rgba(27,31,35,0.15)}.btn:hover{background-color:#e6ebf1;background-image:-webkit-linear-gradient(top, #f0f3f6, #dce3ec);background-image:-moz-linear-gradient(top, #f0f3f6, #dce3ec);background-image:linear-gradient(to bottom, #f0f3f6, #dce3ec);border-color:#afb1b2;-ms-filter:\"progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFF0F3F6', endColorstr='#FFDCE3EC')\";*filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFF0F3F6', endColorstr='#FFDCE3EC')}.social-count{position:relative;background-color:#fff}.social-count:hover{color:#0366d6}.octicon{position:relative;display:inline-block;vertical-align:top;fill:currentColor}.btn,.social-count{height:18px;padding:0 5px;line-height:18px}.btn{font-size:11px}.social-count{margin-left:5px;font-size:10px}.octicon{top:2px}.large .btn,.large .social-count{height:26px;line-height:26px}.large .btn{padding:0 10px;font-size:12px}.large .social-count{padding:0 7px;margin-left:7px;font-size:11px}.large .octicon{top:4px}.social-count b,.social-count i{position:absolute;top:50%;left:0;display:block;width:0;height:0;margin:-4px 0 0 -4px;_font-size:0;_line-height:0;border:solid transparent;border-width:4px 4px 4px 0}.social-count b{border-right-color:#d1d2d3}.social-count:focus b{border-right-color:#c8e1ff}.social-count i{margin-left:-3px;border-right-color:#fff}.social-count b,.social-count i{_border-top-color:red !important;_border-bottom-color:red !important;_border-left-color:red !important;_filter:chroma(color=red)}.large .social-count b,.large .social-count i{margin:-5px 0 0 -5px;border-width:5px 5px 5px 0}.large .social-count i{margin-left:-4px}\n",g={"mark-github":{width:16,height:16,path:'<path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"/>'},eye:{width:16,height:16,path:'<path fill-rule="evenodd" d="M8.06 2C3 2 0 8 0 8s3 6 8.06 6C13 14 16 8 16 8s-3-6-7.94-6zM8 12c-2.2 0-4-1.78-4-4 0-2.2 1.8-4 4-4 2.22 0 4 1.8 4 4 0 2.22-1.78 4-4 4zm2-4c0 1.11-.89 2-2 2-1.11 0-2-.89-2-2 0-1.11.89-2 2-2 1.11 0 2 .89 2 2z"/>'},star:{width:14,height:16,path:'<path fill-rule="evenodd" d="M14 6l-4.9-.64L7 1 4.9 5.36 0 6l3.6 3.26L2.67 14 7 11.67 11.33 14l-.93-4.74L14 6z"/>'},"repo-forked":{width:10,height:16,path:'<path fill-rule="evenodd" d="M8 1a1.993 1.993 0 0 0-1 3.72V6L5 8 3 6V4.72A1.993 1.993 0 0 0 2 1a1.993 1.993 0 0 0-1 3.72V6.5l3 3v1.78A1.993 1.993 0 0 0 5 15a1.993 1.993 0 0 0 1-3.72V9.5l3-3V4.72A1.993 1.993 0 0 0 8 1zM2 4.2C1.34 4.2.8 3.65.8 3c0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zm3 10c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zm3-10c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2z"/>'},"issue-opened":{width:14,height:16,path:'<path fill-rule="evenodd" d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"/>'},"cloud-download":{width:16,height:16,path:'<path fill-rule="evenodd" d="M9 12h2l-3 3-3-3h2V7h2v5zm3-8c0-.44-.91-3-4.5-3C5.08 1 3 2.92 3 5 1.02 5 0 6.52 0 8c0 1.53 1 3 3 3h3V9.7H3C1.38 9.7 1.3 8.28 1.3 8c0-.17.05-1.7 1.7-1.7h1.3V5c0-1.39 1.56-2.7 3.2-2.7 2.55 0 3.13 1.55 3.2 1.8v1.2H12c.81 0 2.7.22 2.7 2.2 0 2.09-2.25 2.2-2.7 2.2h-2V11h2c2.08 0 4-1.16 4-3.5C16 5.06 14.08 4 12 4z"/>'}};s=function(t,e){return t=(""+t).toLowerCase().replace(/^octicon-/,""),g.hasOwnProperty(t)||(t="mark-github"),'<svg version="1.1" width="'+e*g[t].width/g[t].height+'" height="'+e+'" viewBox="0 0 '+g[t].width+" "+g[t].height+'" class="octicon octicon-'+t+'" aria-hidden="true">'+g[t].path+"</svg>"},u={},h=function(t,e){var o,n,r,a,i,c,d,s;1<(c=u[t]||(u[t]=[])).push(e)||(a=0,n=function(){if(!a&&(a=1))for(delete u[t];e=c.shift();)e.apply(null,arguments)},(o=window.XMLHttpRequest)&&"withCredentials"in o.prototype?(s=new o,l(s,"abort",n),l(s,"error",n),l(s,"load",function(){n(200!==s.status,function(){try{return JSON.parse(s.responseText)}catch(t){}}())}),s.open("GET",t),s.send()):((r=this||window)._=function(t){r._=null,n(200!==t.meta.status,t.data)},(d=r.document.createElement("script")).async=!0,d.src=t+(/\?/.test(t)?"&":"?")+"callback=_",l(d,"error",i=function(){r._&&r._({meta:{}})}),d.readyState&&l(d,"readystatechange",function(){"loaded"===d.readyState&&i()}),r.document.getElementsByTagName("head")[0].appendChild(d)))},p=function(t,e,o){var n,r,a,i,l,c,d,u,p,g,b,m,v,w;e&&(a=this,c=t.ownerDocument,l=function(t){return c.createTextNode(t)},(d=(i=function(t){return c.createElement(t)})("style")).type="text/css",t.appendChild(d),d.styleSheet?d.styleSheet.cssText=f:d.appendChild(l(f)),(u=t.appendChild(i("div"))).className="widget"+(/^large$/i.test(e["data-size"])?" large":""),r=function(){o&&o(u)},(p=i("a")).href=e.href,p.target="_blank",/\.github\.com$/.test("."+p.hostname)?/^https?:\/\/((gist\.)?github\.com\/[^\/?#]+\/[^\/?#]+\/archive\/|github\.com\/[^\/?#]+\/[^\/?#]+\/releases\/download\/|codeload\.github\.com\/)/.test(p.href)&&(p.target="_top"):(p.href="#",p.target="_self"),p.className="btn",(g=e["aria-label"])&&p.setAttribute("aria-label",g),p.innerHTML=s(e["data-icon"],/^large$/i.test(e["data-size"])?18:14),p.appendChild(l(" ")),p.appendChild(i("span")).appendChild(l(e["data-text"]||"")),n=u.appendChild(p),/^(true|1)$/i.test(e["data-show-count"])&&"github.com"===n.hostname?!(v=n.pathname.replace(/^(?!\/)/,"/").match(/^\/([^\/?#]+)(?:\/([^\/?#]+)(?:\/(?:(subscription)|(fork)|(issues)|([^\/?#]+)))?)?(?:[\/?#]|$)/))||v[6]?r():(v[2]?(b="/repos/"+v[1]+"/"+v[2],v[3]?(w="subscribers_count",m="watchers"):v[4]?(w="forks_count",m="network"):v[5]?(w="open_issues_count",m="issues"):(w="stargazers_count",m="stargazers")):(b="/users/"+v[1],m=w="followers"),h.call(a,"https://api.github.com"+b,function(t,e){var o,a;t||(a=e[w],(o=i("a")).href=e.html_url+"/"+m,o.target="_blank",o.className="social-count",o.setAttribute("aria-label",a+" "+w.replace(/_count$/,"").replace("_"," ").slice(0,a<2?-1:void 0)+" on GitHub"),o.appendChild(i("b")),o.appendChild(i("i")),o.appendChild(i("span")).appendChild(c.createTextNode((""+a).replace(/\B(?=(\d{3})+(?!\d))/g,","))),n.parentNode.insertBefore(o,n.nextSibling)),r()})):r())};var b,m,v,w,x,C;m=window.devicePixelRatio||1,b=function(t){return(m>1?a.ceil(a.round(t*m)/m*2)/2:a.ceil(t))||0},v=function(t){var e,o,n;return n=t.scrollWidth,o=t.scrollHeight,t.getBoundingClientRect&&(e=t.getBoundingClientRect(),n=a.max(n,b(e.width||e.right-e.left)),o=a.max(o,b(e.height||e.bottom-e.top))),[n,o]},w=function(t,e){t.style.width=e[0]+"px",t.style.height=e[1]+"px"},x=function(o,r){var a,l,d,s,h,u,f;if(null!=o&&null!=r)if(o.getAttribute&&(o=function(t){var e,o,n,r,a;for(r={href:t.href,title:t.title,"aria-label":t.getAttribute("aria-label")},o=0,n=(a=["icon","text","size","show-count"]).length;o<n;o++)r[e="data-"+(e=a[o])]=t.getAttribute(e);return null==r["data-text"]&&(r["data-text"]=t.textContent||t.innerText),r}(o)),(a=window.HTMLElement)&&a.prototype.attachShadow&&!a.prototype.attachShadow.prototype)l=i("span"),(u=o.title)&&(l.title=u),p(l.attachShadow({mode:"closed"}),o,function(){r(l)});else{for(s in d=i("iframe"),h={allowtransparency:!0,scrolling:"no",frameBorder:0})f=h[s],d.setAttribute(s,f);w(d,[1,0]),d.style.border="none",d.src="javascript:0",c(d,"load",function(){var e;e=d.contentWindow,p.call(e,e.document.body,o,function(e){var a;a=v(e),d.parentNode.removeChild(d),c(d,"load",function(){w(d,a)}),d.src=t+"#"+function(t){var e,o,r;for(e in o=[],t)null!=(r=t[e])&&o.push(n(e)+"="+n(r));return o.join("&")}(o),(u=o.title)&&(d.title=u),r(d)})}),e.body.appendChild(d)}},C=function(){var t,o,n,r,a,i,l,c;if(o=[],e.querySelectorAll)o=e.querySelectorAll("a.github-button");else for(r=0,i=(c=e.getElementsByTagName("a")).length;r<i;r++)~(" "+(t=c[r]).className+" ").replace(/[ \t\n\f\r]+/g," ").indexOf(" github-button ")&&o.push(t);for(n=function(t){x(t,function(e){t.parentNode.replaceChild(e,t)})},a=0,l=o.length;a<l;a++)n(t=o[a])},o.protocol+"//"+o.host+o.pathname===t?p(e.body,function(t){var e,o,n,a,i,l;for(a={},e=0,o=(l=t.split("&")).length;e<o;e++)""!==(n=l[e])&&(i=n.split("="),a[r(i[0])]=null!=i[1]?r(i.slice(1).join("=")):void 0);return a}(o.hash.replace(/^#/,""))):d(C)}(); | ||
!function(){"use strict";var t=window.document,e=t.location,o=window.encodeURIComponent,r=window.decodeURIComponent,n=window.Math,a=window.HTMLElement,i=window.XMLHttpRequest,l=(/^http:/.test(e)?"http":"https")+"://unpkg.com/github-buttons@2.1.0/dist/buttons.html",c=a&&a.prototype.attachShadow&&!a.prototype.attachShadow.prototype,s=i&&i.prototype&&"withCredentials"in i.prototype,d=function(t,e,o){t.addEventListener?t.addEventListener(e,o):t.attachEvent("on"+e,o)},u=function(t,e,o){var r=function(n){return t.removeEventListener?t.removeEventListener(e,r):t.detachEvent("on"+e,r),o(n)};d(t,e,r)},h=function(t,e,o){var r=function(n){if(e.test(t.readyState))return t.detachEvent("onreadystatechange",r),o(n)};t.attachEvent("onreadystatechange",r)},f=function(t){return function(e,o,r){var n=t.createElement(e);if(o)for(var a in o){var i=o[a];null!=i&&(null!=n[a]?n[a]=i:n.setAttribute(a,i))}if(r)for(var l=0,c=r.length;l<c;l++){var s=r[l];n.appendChild("string"==typeof s?t.createTextNode(s):s)}return n}},p=f(t),g=function(t){var e=0;return function(){!e&&(e=1)&&t.apply(this,arguments)}},b="body{margin:0}a{color:#24292e;text-decoration:none;outline:0}.widget{display:inline-block;overflow:hidden;font-family:-apple-system, BlinkMacSystemFont, \"Segoe UI\", Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\";font-size:0;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.btn,.social-count{display:inline-block;font-weight:600;vertical-align:bottom;cursor:pointer;border:1px solid #d1d2d3;border-radius:0.25em}.btn:focus,.social-count:focus{border-color:#c8e1ff}.btn{background-color:#eff3f6;background-image:-webkit-linear-gradient(top, #fafbfc, #e4ebf0);background-image:-moz-linear-gradient(top, #fafbfc, #e4ebf0);background-image:linear-gradient(to bottom, #fafbfc, #e4ebf0);background-repeat:repeat-x;background-size:110% 110%;-ms-filter:\"progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFAFBFC', endColorstr='#FFE4EBF0')\";*filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFAFBFC', endColorstr='#FFE4EBF0')}.btn:active{background-color:#e9ecef;background-image:none;border-color:#afb1b2;box-shadow:inset 0 0.15em 0.3em rgba(27,31,35,0.15)}.btn:hover{background-color:#e6ebf1;background-image:-webkit-linear-gradient(top, #f0f3f6, #dce3ec);background-image:-moz-linear-gradient(top, #f0f3f6, #dce3ec);background-image:linear-gradient(to bottom, #f0f3f6, #dce3ec);border-color:#afb1b2;-ms-filter:\"progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFF0F3F6', endColorstr='#FFDCE3EC')\";*filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFF0F3F6', endColorstr='#FFDCE3EC')}.social-count{position:relative;background-color:#fff}.social-count:hover{color:#0366d6}.octicon{position:relative;display:inline-block;vertical-align:top;fill:currentColor}.btn,.social-count{height:18px;padding:0 5px;line-height:18px}.btn{font-size:11px}.social-count{margin-left:5px;font-size:10px}.octicon{top:2px}.large .btn,.large .social-count{height:26px;line-height:26px}.large .btn{padding:0 10px;font-size:12px}.large .social-count{padding:0 7px;margin-left:7px;font-size:11px}.large .octicon{top:4px}.social-count b,.social-count i{position:absolute;top:50%;left:0;display:block;width:0;height:0;margin:-4px 0 0 -4px;_font-size:0;_line-height:0;border:solid transparent;border-width:4px 4px 4px 0}.social-count b{border-right-color:#d1d2d3}.social-count:focus b{border-right-color:#c8e1ff}.social-count i{margin-left:-3px;border-right-color:#fff}.social-count b,.social-count i{_border-top-color:red !important;_border-bottom-color:red !important;_border-left-color:red !important;_filter:chroma(color=red)}.large .social-count b,.large .social-count i{margin:-5px 0 0 -5px;border-width:5px 5px 5px 0}.large .social-count i{margin-left:-4px}\n",m={"mark-github":{width:16,height:16,path:'<path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"/>'},eye:{width:16,height:16,path:'<path fill-rule="evenodd" d="M8.06 2C3 2 0 8 0 8s3 6 8.06 6C13 14 16 8 16 8s-3-6-7.94-6zM8 12c-2.2 0-4-1.78-4-4 0-2.2 1.8-4 4-4 2.22 0 4 1.8 4 4 0 2.22-1.78 4-4 4zm2-4c0 1.11-.89 2-2 2-1.11 0-2-.89-2-2 0-1.11.89-2 2-2 1.11 0 2 .89 2 2z"/>'},star:{width:14,height:16,path:'<path fill-rule="evenodd" d="M14 6l-4.9-.64L7 1 4.9 5.36 0 6l3.6 3.26L2.67 14 7 11.67 11.33 14l-.93-4.74L14 6z"/>'},"repo-forked":{width:10,height:16,path:'<path fill-rule="evenodd" d="M8 1a1.993 1.993 0 0 0-1 3.72V6L5 8 3 6V4.72A1.993 1.993 0 0 0 2 1a1.993 1.993 0 0 0-1 3.72V6.5l3 3v1.78A1.993 1.993 0 0 0 5 15a1.993 1.993 0 0 0 1-3.72V9.5l3-3V4.72A1.993 1.993 0 0 0 8 1zM2 4.2C1.34 4.2.8 3.65.8 3c0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zm3 10c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zm3-10c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2z"/>'},"issue-opened":{width:14,height:16,path:'<path fill-rule="evenodd" d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"/>'},"cloud-download":{width:16,height:16,path:'<path fill-rule="evenodd" d="M9 12h2l-3 3-3-3h2V7h2v5zm3-8c0-.44-.91-3-4.5-3C5.08 1 3 2.92 3 5 1.02 5 0 6.52 0 8c0 1.53 1 3 3 3h3V9.7H3C1.38 9.7 1.3 8.28 1.3 8c0-.17.05-1.7 1.7-1.7h1.3V5c0-1.39 1.56-2.7 3.2-2.7 2.55 0 3.13 1.55 3.2 1.8v1.2H12c.81 0 2.7.22 2.7 2.2 0 2.09-2.25 2.2-2.7 2.2h-2V11h2c2.08 0 4-1.16 4-3.5C16 5.06 14.08 4 12 4z"/>'}},v={},w=function(t,e,o){var r=f(t.ownerDocument),n=t.appendChild(r("style",{type:"text/css"}));n.styleSheet?n.styleSheet.cssText=b:n.appendChild(t.ownerDocument.createTextNode(b));var a,l,c=r("a",{className:"btn",href:e.href,target:"_blank",innerHTML:(a=e["data-icon"],l=/^large$/i.test(e["data-size"])?18:14,a=(""+a).toLowerCase().replace(/^octicon-/,""),m.hasOwnProperty(a)||(a="mark-github"),'<svg version="1.1" width="'+l*m[a].width/m[a].height+'" height="'+l+'" viewBox="0 0 '+m[a].width+" "+m[a].height+'" class="octicon octicon-'+a+'" aria-hidden="true">'+m[a].path+"</svg>"),"aria-label":e["aria-label"]||void 0},[" ",r("span",{},[e["data-text"]||""])]);/\.github\.com$/.test("."+c.hostname)?/^https?:\/\/((gist\.)?github\.com\/[^\/?#]+\/[^\/?#]+\/archive\/|github\.com\/[^\/?#]+\/[^\/?#]+\/releases\/download\/|codeload\.github\.com\/)/.test(c.href)&&(c.target="_top"):(c.href="#",c.target="_self");var u=t.appendChild(r("div",{className:"widget"+(/^large$/i.test(e["data-size"])?" large":"")},[c])),p=function(){o&&o(u)};if(/^(true|1)$/i.test(e["data-show-count"])&&"github.com"===c.hostname){var w,x,y,C=c.pathname.replace(/^(?!\/)/,"/").match(/^\/([^\/?#]+)(?:\/([^\/?#]+)(?:\/(?:(subscription)|(fork)|(issues)|([^\/?#]+)))?)?(?:[\/?#]|$)/);if(C&&!C[6])C[2]?(w="/repos/"+C[1]+"/"+C[2],C[3]?(y="subscribers_count",x="watchers"):C[4]?(y="forks_count",x="network"):C[5]?(y="open_issues_count",x="issues"):(y="stargazers_count",x="stargazers")):(w="/users/"+C[1],x=y="followers"),function(t,e){var o=v[t]||(v[t]=[]);if(!(o.push(e)>1)){var r=g(function(){for(delete v[t];e=o.shift();)e.apply(null,arguments)});if(s){var n=new i;d(n,"abort",r),d(n,"error",r),d(n,"load",function(){r(200!==n.status,function(){try{return JSON.parse(n.responseText)}catch(t){}}())}),n.open("GET",t),n.send()}else{var a=this||window;a._=function(t){a._=null,r(200!==t.meta.status,t.data)};var l=f(a.document)("script",{async:!0,src:t+(/\?/.test(t)?"&":"?")+"callback=_"}),c=function(){a._&&a._({meta:{}})};d(l,"load",c),d(l,"error",c),l.readyState&&h(l,/de|m/,c),a.document.getElementsByTagName("head")[0].appendChild(l)}}}.call(this,"https://api.github.com"+w,function(t,e){if(!t){var o=e[y];u.appendChild(r("a",{className:"social-count",href:e.html_url+"/"+x,target:"_blank","aria-label":o+" "+y.replace(/_count$/,"").replace("_"," ").slice(0,o<2?-1:void 0)+" on GitHub"},[r("b"),r("i"),r("span",{},[(""+o).replace(/\B(?=(\d{3})+(?!\d))/g,",")])]))}p()});else p()}else p()},x=window.devicePixelRatio||1,y=function(t){return(x>1?n.ceil(n.round(t*x)/x*2)/2:n.ceil(t))||0},C=function(t,e){t.style.width=e[0]+"px",t.style.height=e[1]+"px"},k=function(e,r){if(null!=e&&null!=r)if(e.getAttribute&&(e=function(t){for(var e={href:t.href,title:t.title,"aria-label":t.getAttribute("aria-label")},o=["icon","text","size","show-count"],r=0,n=o.length;r<n;r++){var a="data-"+o[r];e[a]=t.getAttribute(a)}return null==e["data-text"]&&(e["data-text"]=t.textContent||t.innerText),e}(e)),c){var a=p("span",{title:e.title||void 0});w(a.attachShadow({mode:"closed"}),e,function(){r(a)})}else{var i=p("iframe",{src:"javascript:0",title:e.title||void 0,allowtransparency:!0,scrolling:"no",frameBorder:0});C(i,[1,0]),i.style.border="none",u(i,"load",function(){var t=i.contentWindow;w.call(t,t.document.body,e,function(t){var a=function(t){var e=t.scrollWidth,o=t.scrollHeight;if(t.getBoundingClientRect){var r=t.getBoundingClientRect();e=n.max(e,y(r.width||r.right-r.left)),o=n.max(o,y(r.height||r.bottom-r.top))}return[e,o]}(t);i.parentNode.removeChild(i),u(i,"load",function(){C(i,a)}),i.src=l+"#"+function(t){var e=[];for(var r in t){var n=t[r];null!=n&&e.push(o(r)+"="+o(n))}return e.join("&")}(e),r(i)})}),t.body.appendChild(i)}};e.protocol+"//"+e.host+e.pathname===l?w(t.body,function(t){for(var e={},o=t.split("&"),n=0,a=o.length;n<a;n++){var i=o[n];if(""!==i){var l=i.split("=");e[r(l[0])]=null!=l[1]?r(l.slice(1).join("=")):void 0}}return e}(e.hash.replace(/^#/,""))):function(e){if(/m/.test(t.readyState)||!/g/.test(t.readyState)&&!t.documentElement.doScroll)setTimeout(e);else if(t.addEventListener){var o=g(e);u(t,"DOMContentLoaded",o),u(window,"load",o)}else h(t,/m/,e)}(function(){for(var e=t.querySelectorAll?t.querySelectorAll("a.github-button"):function(){for(var e=[],o=t.getElementsByTagName("a"),r=0,n=o.length;r<n;r++)~(" "+o[r].className+" ").replace(/[ \t\n\f\r]+/g," ").indexOf(" github-button ")&&e.push(o[r]);return e}(),o=0,r=e.length;o<r;o++)!function(t){k(t,function(e){t.parentNode.replaceChild(e,t)})}(e[o])})}(); |
{ | ||
"name": "github-buttons", | ||
"version": "2.0.5", | ||
"version": "2.1.0", | ||
"description": "GitHub Buttons", | ||
@@ -31,4 +31,4 @@ "keywords": [ | ||
"scripts": { | ||
"build": "rollup -c rollup.config.js && eslint dist", | ||
"pretest": "coffeelint src/ test/", | ||
"build": "rollup -c rollup.config.js", | ||
"pretest": "eslint .", | ||
"test": "karma start --single-run" | ||
@@ -38,7 +38,8 @@ }, | ||
"chai": "^4.2.0", | ||
"codecov": "^3.2.0", | ||
"coffee-loader": "^0.9.0", | ||
"coffeelint": "^2.1.0", | ||
"coffeescript": "=1.12.7", | ||
"eslint": "^5.15.0", | ||
"eslint": "^5.15.1", | ||
"eslint-config-standard": "^12.0.0", | ||
"eslint-plugin-import": "^2.16.0", | ||
"eslint-plugin-node": "^8.0.1", | ||
"eslint-plugin-promise": "^4.0.1", | ||
"eslint-plugin-standard": "^4.0.0", | ||
"istanbul-instrumenter-loader": "^3.0.1", | ||
@@ -61,4 +62,3 @@ "karma": "^4.0.1", | ||
"raw-loader": "^1.0.0", | ||
"rollup": "^1.4.0", | ||
"rollup-plugin-coffee-script": "^2.0.0", | ||
"rollup": "^1.5.0", | ||
"rollup-plugin-json": "^3.1.0", | ||
@@ -69,3 +69,3 @@ "rollup-plugin-node-resolve": "^4.0.1", | ||
"sass-loader": "^7.1.0", | ||
"sinon": "^7.2.6", | ||
"sinon": "^7.2.7", | ||
"sinon-chai": "^3.3.0", | ||
@@ -72,0 +72,0 @@ "webpack": "^4.29.6" |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
66239
1093
4