@codersrank/activity
Advanced tools
Comparing version 0.9.8 to 0.9.9
@@ -8,3 +8,4 @@ "use strict"; | ||
var fetchData = function fetchData(username, id) { | ||
if (cache[username]) return Promise.resolve(cache[username]); | ||
if (username && cache[username]) return Promise.resolve(cache[username]); | ||
if (id && cache[id]) return Promise.resolve(cache[id]); | ||
var endpoint = "https://grpcgateway.codersrank.io/candidate/activity/" + (username || id); | ||
@@ -20,3 +21,8 @@ if (id) endpoint += '?id=true'; | ||
}).then(function (data) { | ||
cache[username] = data; | ||
if (id) { | ||
cache[id] = data; | ||
} else { | ||
cache[username] = data; | ||
} | ||
return data; | ||
@@ -23,0 +29,0 @@ })["catch"](function (err) { |
/** | ||
* Codersrank Activity Widget 0.9.8 | ||
* Codersrank Activity Widget 0.9.9 | ||
* undefined | ||
@@ -10,3 +10,3 @@ * https://github.com/codersrank-org/activity-widget#readme | ||
* | ||
* Released on: November 23, 2020 | ||
* Released on: December 1, 2020 | ||
*/ | ||
@@ -153,3 +153,4 @@ | ||
var fetchData = function fetchData(username, id) { | ||
if (cache[username]) return Promise.resolve(cache[username]); | ||
if (username && cache[username]) return Promise.resolve(cache[username]); | ||
if (id && cache[id]) return Promise.resolve(cache[id]); | ||
var endpoint = "https://grpcgateway.codersrank.io/candidate/activity/" + (username || id); | ||
@@ -165,3 +166,8 @@ if (id) endpoint += '?id=true'; | ||
}).then(function (data) { | ||
cache[username] = data; | ||
if (id) { | ||
cache[id] = data; | ||
} else { | ||
cache[username] = data; | ||
} | ||
return data; | ||
@@ -168,0 +174,0 @@ })["catch"](function (err) { |
/** | ||
* Codersrank Activity Widget 0.9.8 | ||
* Codersrank Activity Widget 0.9.9 | ||
* undefined | ||
@@ -10,6 +10,6 @@ * https://github.com/codersrank-org/activity-widget#readme | ||
* | ||
* Released on: November 23, 2020 | ||
* Released on: December 1, 2020 | ||
*/ | ||
!function(t){"function"==typeof define&&define.amd?define(t):t()}((function(){"use strict";function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function e(){return(e=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}function n(t){return(n=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function r(t,e){return(r=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function i(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}function o(t,e,n){return(o=i()?Reflect.construct:function(t,e,n){var i=[null];i.push.apply(i,e);var o=new(Function.bind.apply(t,i));return n&&r(o,n.prototype),o}).apply(null,arguments)}function a(t){var e="function"==typeof Map?new Map:void 0;return(a=function(t){if(null===t||(i=t,-1===Function.toString.call(i).indexOf("[native code]")))return t;var i;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,a)}function a(){return o(t,arguments,n(this).constructor)}return a.prototype=Object.create(t.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),r(a,t)})(t)}function s(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}var l={},c=function(t){for(var e=void 0===t?{}:t,n=e.data,r=e.weeks,i=e.svgWidth,o=e.legend,a=e.labels,s=e.preloader,l=e.step,c=i,d=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],u=a?25:0,h=a?18:0,v=[],p=0;p<r;p+=1)v.push(p);for(var f=[],g=0;g<7;g+=1)f.push(g);var y,b=(c-u-4*(r-1))/r,m=c+5,w=h+7*b+24+7,k=(y=7*r,y-=7-(new Date).getDay()),x=function(){for(var t,e=[],n=(new Date).getTime()-24*k*60*60*1e3,i=0;i<r;i+=1){var o=new Date(n+7*i*24*60*60*1e3).getMonth();t!==o&&(e.push({weekIndex:i,month:o}),t=o)}return e}(),L=function(t,e){var n=k-(7*t+e+1),r=new Date((new Date).getTime()-24*n*60*60*1e3),i=function(t){return t<10?"0"+t:t};return r.getFullYear()+"-"+i(r.getMonth()+1)+"-"+i(r.getDate())},C=function(t,e){var r=["codersrank-activity-day"],i=function(t){var e=0;if(!n||!t)return e;var r=n[t];return r&&Object.keys(r).forEach((function(t){e+=r[t]})),e}(L(t,e)),o=i>0?Math.min(Math.floor(i/l),3)+1:0;return o&&r.push("codersrank-activity-day-"+o),function(t,e){return 7*t+e+1>k}(t,e)&&r.push("codersrank-activity-day-disabled"),r.join(" ")};return'\n <div class="codersrank-activity">\n <div class="codersrank-activity-chart">\n <svg viewBox="0 0 '+m+" "+w+'" height="'+w+'">\n <g transform="translate('+u+", "+h+')">\n '+v.map((function(t){return'\n <g transform="translate('+(b+4)*t+', 0)">\n '+f.map((function(e){return'\n <rect\n width="'+b+'"\n height="'+b+'"\n rx="1.5"\n x="0"\n y="'+(b+4)*e+'"\n data-date="'+L(t,e)+'"\n class="'+C(t,e)+'"\n />\n '})).join("")+"\n </g>\n "})).join("")+"\n </g>\n\n "+(a?"\n <g>\n "+["Mon","Tue","Wed","Thu","Fri","Sat","Sun"].map((function(t,e){return'\n <text\n class="codersrank-activity-wday"\n text-anchor="start"\n dominant-baseline="hanging"\n dx="0"\n dy="'+((b+4)*e+2.5+h)+'"\n >\n '+t+"\n </text>\n "})).join("")+"\n </g>\n\n <g>\n "+x.map((function(t){return'\n <text\n class="codersrank-activity-month"\n text-anchor="start"\n dominant-baseline="text-before-edge"\n dx="'+((b+4)*t.weekIndex+u)+'"\n dy="0"\n >\n '+d[t.month]+"\n </text>\n "})).join("")+"\n </g>\n ":"")+"\n </svg>\n "+(s?'\n <div class="codersrank-activity-preloader"></div>\n ':"")+"\n </div>\n "+(o?'\n <div class="codersrank-activity-legend">\n <span class="codersrank-activity-legend-label">Less</span>\n <span class="codersrank-activity-legend-item"></span>\n <span class="codersrank-activity-legend-item codersrank-activity-legend-item-1"></span>\n <span class="codersrank-activity-legend-item codersrank-activity-legend-item-2"></span>\n <span class="codersrank-activity-legend-item codersrank-activity-legend-item-3"></span>\n <span class="codersrank-activity-legend-item codersrank-activity-legend-item-4"></span>\n <span class="codersrank-activity-legend-label">More</span>\n </div>\n ':"")+"\n </div>\n "},d='<svg xmlns="http://www.w3.org/2000/svg" width="56" height="56" viewBox="0 0 56 56"><path fill="#fff" fill-rule="evenodd" d="M0,25.0007674 C0,36.0462261 7.1625894,45.4157586 17.0969029,48.7215691 C18.3477086,48.9517788 18.8035237,48.1798091 18.8035237,47.5168053 C18.8035237,46.9243992 18.7820375,45.3512999 18.7697597,43.2656005 C11.8158937,44.7757758 10.3486909,39.9137481 10.3486909,39.9137481 C9.21145523,37.0253845 7.57236256,36.2564842 7.57236256,36.2564842 C5.30249547,34.706406 7.74425243,34.7371006 7.74425243,34.7371006 C10.2535376,34.9135946 11.5734062,37.3139139 11.5734062,37.3139139 C13.8033703,41.1338592 17.4253353,40.0303877 18.8495657,39.3904049 C19.0767059,37.7758679 19.7228276,36.6739311 20.4364775,36.0492956 C14.8853556,35.4185211 9.04877375,33.2729672 9.04877375,23.6931766 C9.04877375,20.9644249 10.0233279,18.7313914 11.6225176,16.9848676 C11.3646828,16.3525584 10.5067682,13.8095092 11.8680745,10.3686424 C11.8680745,10.3686424 13.9660518,9.69643022 18.7421345,12.9316431 C20.73575,12.3760705 22.875165,12.0998189 25.0007674,12.0890758 C27.124835,12.0998189 29.2627152,12.3760705 31.2594002,12.9316431 C36.0324135,9.69643022 38.1273213,10.3686424 38.1273213,10.3686424 C39.4916971,13.8095092 38.6337825,16.3525584 38.3774824,16.9848676 C39.9797416,18.7313914 40.9466221,20.9644249 40.9466221,23.6931766 C40.9466221,33.2975229 35.1008318,35.4108475 29.5328279,36.0293441 C30.4291108,36.8013137 31.2287056,38.3268363 31.2287056,40.6596274 C31.2287056,44.0007367 31.198011,46.697259 31.198011,47.5168053 C31.198011,48.185948 31.6492219,48.9640566 32.9169097,48.7200344 C42.8435495,45.4065502 50,36.0431566 50,25.0007674 C50,11.1927929 38.8056724,0 24.9976979,0 C11.1943276,0 0,11.1927929 0,25.0007674 Z" transform="translate(3 3)"/></svg>',u='<svg xmlns="http://www.w3.org/2000/svg" width="56" height="56" viewBox="0 0 56 56"><path fill="#ee7a06" d="M5.22307574,30.9345 L5.22307574,44.4341791 L36.3289243,44.4341791 L36.3289243,30.9345 L40.776,30.9345 L40.776,48.9345 L0.776,48.9345 L0.776,30.9345 L5.22307574,30.9345 Z M32,35 L32,40 L10,40 L10,35 L32,35 Z M10.9277895,25 L33,29.6115033 L32.0722105,34 L10,29.3884967 L10.9277895,25 Z M14.8746402,16 L35,25.0945103 L33.1253598,29 L13,19.9054897 L14.8746402,16 Z M20.8556275,7 L38,20.7080348 L35.1443725,24 L18,10.2919652 L20.8556275,7 Z M29.6024511,0 L43,17.4101966 L39.3975489,20 L26,2.58980337 L29.6024511,0 Z" transform="translate(6 4)"/></svg>',h='<svg xmlns="http://www.w3.org/2000/svg" width="56" height="56" viewBox="0 0 56 56"><path fill="#fff" d="M 47.5700 10.5625 L 24.7655 10.5625 C 23.1718 10.5625 22.2108 10.1641 21.0389 9.1797 L 19.6093 7.9844 C 18.0624 6.6953 16.8671 6.2500 14.5468 6.2500 L 7.5624 6.2500 C 3.4608 6.2500 1.0936 8.5937 1.0936 13.3281 L 1.0936 19.5859 L 54.9064 19.5859 L 54.9064 17.8047 C 54.9064 12.9766 52.4454 10.5625 47.5700 10.5625 Z M 8.4530 49.7500 L 48.2732 49.7500 C 52.4684 49.7500 54.9064 47.3125 54.9064 42.4844 L 54.9064 22.7735 L 1.0936 22.7735 L 1.0936 42.4844 C 1.0936 47.3359 3.5780 49.7500 8.4530 49.7500 Z"/></svg>',v='\n <svg xmlns="http://www.w3.org/2000/svg" width="350" height="350" viewBox="0 0 350 350"><g fill="none" transform="translate(6 20)"><path fill="#FC6D26" d="M337.17,177.83 L318.26,119.71 L280.84,4.43 C279.956602,1.7925919 277.486423,0.0149148401 274.705,0.0149148401 C271.923577,0.0149148401 269.453398,1.7925919 268.57,4.43 L231.15,119.64 L106.82,119.64 L69.4,4.43 C68.5220965,1.78979642 66.0523353,0.00830812195 63.27,0.00830812195 C60.4876647,0.00830812195 58.0179035,1.78979642 57.14,4.43 L19.78,119.64 L0.87,177.83 C-0.853328917,183.12969 1.02714845,188.936572 5.53,192.22 L169,311 L332.44,192.22 C336.963325,188.951421 338.871954,183.144831 337.17,177.83"/><polygon fill="#E24329" points="63 191.91 63 191.91 125.16 .63 .87 .63" transform="translate(106 119)"/><polygon fill="#FC6D26" points="150 191.91 87.82 .63 .82 .63" transform="translate(19 119)"/><path fill="#FCA326" d="M19.75,0.69 L19.75,0.69 L0.84,58.81 C-0.883328917,64.1096898 0.997148451,69.9165716 5.5,73.2 L169,192 L19.75,0.69 Z" transform="translate(0 119)"/><path fill="#E24329" d="M0.78,119.69 L87.89,119.69 L50.4,4.49 C49.5166016,1.8525919 47.046423,0.0749148401 44.265,0.0749148401 C41.483577,0.0749148401 39.0133984,1.8525919 38.13,4.49 L0.78,119.69 Z" transform="translate(19)"/><polygon fill="#FC6D26" points="0 191.91 62.16 .63 149.3 .63" transform="translate(169 119)"/><path fill="#FCA326" d="M149.24,0.69 L149.24,0.69 L168.15,58.81 C169.883261,64.1096795 168.000893,69.9224023 163.49,73.2 L0,191.91 L149.2,0.69 L149.24,0.69 Z" transform="translate(169 119)"/><path fill="#E24329" d="M87.28,119.69 L0.18,119.69 L37.6,4.49 C38.4779035,1.84979642 40.9476647,0.0683081219 43.73,0.0683081219 C46.5123353,0.0683081219 48.9820965,1.84979642 49.86,4.49 L87.28,119.69 Z" transform="translate(231)"/></g></svg>\n ',p="codersrank-activity",f=function(n){var r,i;function o(){var t;return(t=n.call(this)||this).tempDiv=document.createElement("div"),t.shadowEl=t.attachShadow({mode:"closed"}),t.stylesEl=document.createElement("style"),t.stylesEl.textContent=":host{--font-family:Open Sans,Helvetica Neue,Helvetica,Arial,sans-serif;--label-font-size:9px;--label-text-color:#999ea4;--legend-font-size:12px;--legend-text-color:#999ea4;--legend-item-width:14px;--legend-item-height:14px;--legend-margin:1em 0 0 0;--bg-color-0:#f6f6f6;--bg-color-1:rgba(80, 176, 186, 0.3);--bg-color-2:rgba(80, 176, 186, 0.6);--bg-color-3:rgba(80, 176, 186, 1);--bg-color-4:#24565a;--border-color-0:transparent;--border-color-1:transparent;--border-color-2:transparent;--border-color-3:transparent;--border-color-4:transparent;--svg-width:100%;--svg-height:auto;--preloader-color:#72a0a8;--tooltip-font-size:14px;width:100%;display:block;position:relative}.codersrank-activity{font-family:var(--font-family);position:relative}.codersrank-activity-preloader{position:absolute;left:50%;top:50%;width:32px;height:32px;margin:-16px 0 0 -16px;border:3px solid var(--preloader-color);border-left-color:transparent;border-bottom-color:transparent;border-radius:50%;box-sizing:border-box;-webkit-animation:preloader 1s infinite linear;animation:preloader 1s infinite linear}.codersrank-activity-chart{width:100%;position:relative}.codersrank-activity-chart svg{width:var(--svg-width);height:var(--svg-height)}.codersrank-activity-day{fill:var(--bg-color-0);stroke-width:1;stroke:var(--border-color-0)}.codersrank-activity-day-1{fill:var(--bg-color-1);stroke:var(--border-color-1)}.codersrank-activity-day-2{fill:var(--bg-color-2);stroke:var(--border-color-2)}.codersrank-activity-day-3{fill:var(--bg-color-3);stroke:var(--border-color-3)}.codersrank-activity-day-4{fill:var(--bg-color-4);stroke:var(--border-color-4)}.codersrank-activity-day-disabled{display:none}.codersrank-activity-month,.codersrank-activity-wday{font-size:var(--label-font-size);fill:var(--label-text-color)}.codersrank-activity-wday:nth-child(2n){display:none}.codersrank-activity-tooltip{text-align:left;position:absolute;background:#000;transform:translateX(-50%) translateY(-100%);border-radius:4px;color:#fff;font-family:var(--font-family);padding:8px;font-size:var(--tooltip-font-size);white-space:nowrap;pointer-events:none;margin-top:-10px;width:200px;line-height:1.5}.codersrank-activity-tooltip-angle{width:0px;height:0px;position:absolute;left:50%;top:100%;border-left:10px solid transparent;border-right:10px solid transparent;border-top:10px solid #000;margin-left:-5px}.codersrank-activity-tooltip-header{padding-bottom:4px;margin-bottom:4px;border-bottom:1px solid rgba(255,255,255,.25)}.codersrank-activity-tooltip-list{list-style:none;margin:0;padding:0}.codersrank-activity-tooltip-list li{display:flex;align-items:center}.codersrank-activity-tooltip-list i{text-align:center;font-size:16px;width:16px;height:16px;margin-right:8px;display:block}.codersrank-activity-tooltip-list i svg{display:block;width:16px;height:16px}.codersrank-activity-legend{display:flex;justify-content:flex-end;align-items:center;color:var(--legend-text-color);line-height:1;font-size:var(--legend-font-size);margin:var(--legend-margin)}.codersrank-activity-legend-label:first-child{margin-right:8px}.codersrank-activity-legend-label:last-child{margin-left:8px}.codersrank-activity-legend-item{box-sizing:border-box;width:var(--legend-item-width);height:var(--legend-item-height);background-color:var(--bg-color-0);border:1px solid var(--border-color-0);margin:0 2px;border-radius:2px}.codersrank-activity-legend-item-1{background-color:var(--bg-color-1);border-color:var(--border-color-1)}.codersrank-activity-legend-item-2{background-color:var(--bg-color-2);border-color:var(--border-color-2)}.codersrank-activity-legend-item-3{background-color:var(--bg-color-3);border-color:var(--border-color-3)}.codersrank-activity-legend-item-4{background-color:var(--bg-color-4);border-color:var(--border-color-4)}@-webkit-keyframes preloader{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}@keyframes preloader{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}",t.shadowEl.appendChild(t.stylesEl),t.onMouseEnter=t.onMouseEnter.bind(s(t)),t.onMouseLeave=t.onMouseLeave.bind(s(t)),t.mounted=!1,t.state=0,t.data=null,t}i=n,(r=o).prototype=Object.create(i.prototype),r.prototype.constructor=r,r.__proto__=i;var a,p,f,g=o.prototype;return g.getTotalActivities=function(t){void 0===t&&(t={});var e=0;return Object.keys(t).forEach((function(n){Object.keys(t[n]).forEach((function(r){e+=t[n][r]||0}))})),e},g.emitData=function(t){void 0===t&&(t={});var e=new CustomEvent("data",{detail:{data:t,total:this.getTotalActivities(t)}});this.dispatchEvent(e)},g.emitError=function(t){var e=new CustomEvent("error",{detail:t});this.dispatchEvent(e)},g.render=function(){var t=this.username,n=this.id,r=this.mounted,i=this.state,o=this.shadowEl,a=this.data,s=this.weeks,l=this.svgWidth,d=this.legend,u=this.labels,h=this.step,v=this.tempDiv,p={data:a,weeks:s,svgWidth:l,legend:d,labels:u,step:h};if((t||n)&&r){3===i?v.innerHTML=c(p):2===i?v.innerHTML="":0!==i&&1!==i||(v.innerHTML=function(t){return c(e({},t,{preloader:!0,data:{}}))}(p));var f=o.querySelector(".codersrank-activity");f&&f.parentNode.removeChild(f),(f=v.querySelector(".codersrank-activity"))&&(this.widgetEl=f,this.detachEvents(),this.attachEvents(),o.appendChild(f))}},g.loadAndRender=function(){var t=this,e=this.username,n=this.id;this.state=1,this.render(),function(t,e){if(l[t])return Promise.resolve(l[t]);var n="https://grpcgateway.codersrank.io/candidate/activity/"+(t||e);return e&&(n+="?id=true"),fetch(n,{method:"GET",headers:{"Content-Type":"application/json"}}).then((function(t){return t.json()})).then((function(e){return l[t]=e,e})).catch((function(t){return Promise.reject(t)}))}(e,n).then((function(e){t.emitData(e),t.data=e,t.state=3,t.render()})).catch((function(e){t.emitError(e),t.state=2,t.render()}))},g.activitiesInDay=function(t){var e=0;if(!this.data||!t)return e;var n=this.data[t];return n&&Object.keys(n).forEach((function(t){e+=n[t]})),e},g.tooltipText=function(t){var e=this.data[t],n=this.activitiesInDay(t);return'\n <div class="codersrank-activity-tooltip-header">\n '+Intl.DateTimeFormat().format(new Date(t))+" - <b>"+n+' activities</b>\n </div>\n <ul class="codersrank-activity-tooltip-list">\n '+(e.github?"\n <li><i>"+d+"</i>"+e.github+" activities</li>\n ":"")+"\n "+(e.gitlab?"\n <li><i>"+v+"</i>"+e.gitlab+" activities</li>\n ":"")+"\n "+(e.private?"\n <li><i>"+h+"</i>"+e.private+" activities</li>\n ":"")+"\n "+(e.stackoverflow?"\n <li><i>"+u+"</i>"+e.stackoverflow+" activities</li>\n ":"")+"\n </ul>\n "},g.showTooltip=function(t){if(this.data&&t&&this.tooltip&&this.widgetEl&&this.data[t]){var e=this.shadowEl.querySelector('[data-date="'+t+'"]');if(e){this.tempDiv.innerHTML='\n <div class="codersrank-activity-tooltip">\n '+this.tooltipText(t)+'\n <div class="codersrank-activity-tooltip-angle"></div>\n </div>\n ';var n=this.getBoundingClientRect(),r=e.getBoundingClientRect(),i=this.tempDiv.querySelector(".codersrank-activity-tooltip"),o=r.left-n.left,a=-5;o<110&&(a=-5-(110-o),o=110),o+110>n.width&&(a=105-(n.width-o),o=n.width-110),a=Math.max(Math.min(a,105),-105),i.style.left=o+"px",i.style.top=r.top-n.top+"px",i.querySelector(".codersrank-activity-tooltip-angle").style.marginLeft=a+"px",this.shadowEl.appendChild(i)}}},g.hideTooltip=function(){if(this.tooltip&&this.widgetEl){var t=this.shadowEl.querySelector(".codersrank-activity-tooltip");t&&this.shadowEl.removeChild(t)}},g.onMouseEnter=function(t){if("rect"===t.target.tagName){var e=t.target.getAttribute("data-date");this.showTooltip(e)}},g.onMouseLeave=function(){this.hideTooltip()},g.attributeChangedCallback=function(){this.mounted&&this.loadAndRender()},g.attachEvents=function(){this.widgetEl&&(this.widgetEl.addEventListener("mouseenter",this.onMouseEnter,!0),this.widgetEl.addEventListener("mouseleave",this.onMouseLeave,!0))},g.detachEvents=function(){this.widgetEl&&(this.widgetEl.removeEventListener("mouseenter",this.onMouseEnter,!0),this.widgetEl.removeEventListener("mouseleave",this.onMouseLeave,!0))},g.connectedCallback=function(){this.width=this.offsetWidth,this.mounted=!0,this.loadAndRender()},g.disconnectedCallback=function(){this.mounted=!1,this.detachEvents()},a=o,f=[{key:"observedAttributes",get:function(){return["username","weeks","svg-width","legend","labels","id"]}}],(p=[{key:"tooltip",get:function(){var t=this.getAttribute("tooltip");return""===t||"true"===t},set:function(t){this.setAttribute("tooltip",t)}},{key:"id",get:function(){return this.getAttribute("id")},set:function(t){this.setAttribute("id",t)}},{key:"username",get:function(){return this.getAttribute("username")},set:function(t){this.setAttribute("username",t)}},{key:"weeks",get:function(){return Math.min(parseInt(this.getAttribute("weeks")||52,10),52)},set:function(t){this.setAttribute("weeks",t)}},{key:"svgWidth",get:function(){var t=parseInt(this.getAttribute("svg-width")||0,10);return!t&&this.weeks<52?800/(52/this.weeks):t||800},set:function(t){this.setAttribute("svg-width",t)}},{key:"svg-width",set:function(t){this.setAttribute("svg-width",t)}},{key:"legend",get:function(){var t=this.getAttribute("legend");return""===t||"true"===t},set:function(t){this.setAttribute("legend",t)}},{key:"labels",get:function(){var t=this.getAttribute("labels");return""===t||"true"===t},set:function(t){this.setAttribute("labels",t)}},{key:"step",get:function(){return parseInt(this.getAttribute("step")||10,10)},set:function(t){this.setAttribute("step",t)}}])&&t(a.prototype,p),f&&t(a,f),o}(a(HTMLElement));window.customElements&&!window.customElements.get(p)&&window.customElements.define(p,f)})); | ||
!function(t){"function"==typeof define&&define.amd?define(t):t()}((function(){"use strict";function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function e(){return(e=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}function n(t){return(n=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function r(t,e){return(r=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function i(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}function o(t,e,n){return(o=i()?Reflect.construct:function(t,e,n){var i=[null];i.push.apply(i,e);var o=new(Function.bind.apply(t,i));return n&&r(o,n.prototype),o}).apply(null,arguments)}function a(t){var e="function"==typeof Map?new Map:void 0;return(a=function(t){if(null===t||(i=t,-1===Function.toString.call(i).indexOf("[native code]")))return t;var i;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,a)}function a(){return o(t,arguments,n(this).constructor)}return a.prototype=Object.create(t.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),r(a,t)})(t)}function s(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}var l={},c=function(t){for(var e=void 0===t?{}:t,n=e.data,r=e.weeks,i=e.svgWidth,o=e.legend,a=e.labels,s=e.preloader,l=e.step,c=i,d=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],u=a?25:0,h=a?18:0,v=[],p=0;p<r;p+=1)v.push(p);for(var f=[],g=0;g<7;g+=1)f.push(g);var y,b=(c-u-4*(r-1))/r,m=c+5,w=h+7*b+24+7,k=(y=7*r,y-=7-(new Date).getDay()),x=function(){for(var t,e=[],n=(new Date).getTime()-24*k*60*60*1e3,i=0;i<r;i+=1){var o=new Date(n+7*i*24*60*60*1e3).getMonth();t!==o&&(e.push({weekIndex:i,month:o}),t=o)}return e}(),L=function(t,e){var n=k-(7*t+e+1),r=new Date((new Date).getTime()-24*n*60*60*1e3),i=function(t){return t<10?"0"+t:t};return r.getFullYear()+"-"+i(r.getMonth()+1)+"-"+i(r.getDate())},C=function(t,e){var r=["codersrank-activity-day"],i=function(t){var e=0;if(!n||!t)return e;var r=n[t];return r&&Object.keys(r).forEach((function(t){e+=r[t]})),e}(L(t,e)),o=i>0?Math.min(Math.floor(i/l),3)+1:0;return o&&r.push("codersrank-activity-day-"+o),function(t,e){return 7*t+e+1>k}(t,e)&&r.push("codersrank-activity-day-disabled"),r.join(" ")};return'\n <div class="codersrank-activity">\n <div class="codersrank-activity-chart">\n <svg viewBox="0 0 '+m+" "+w+'" height="'+w+'">\n <g transform="translate('+u+", "+h+')">\n '+v.map((function(t){return'\n <g transform="translate('+(b+4)*t+', 0)">\n '+f.map((function(e){return'\n <rect\n width="'+b+'"\n height="'+b+'"\n rx="1.5"\n x="0"\n y="'+(b+4)*e+'"\n data-date="'+L(t,e)+'"\n class="'+C(t,e)+'"\n />\n '})).join("")+"\n </g>\n "})).join("")+"\n </g>\n\n "+(a?"\n <g>\n "+["Mon","Tue","Wed","Thu","Fri","Sat","Sun"].map((function(t,e){return'\n <text\n class="codersrank-activity-wday"\n text-anchor="start"\n dominant-baseline="hanging"\n dx="0"\n dy="'+((b+4)*e+2.5+h)+'"\n >\n '+t+"\n </text>\n "})).join("")+"\n </g>\n\n <g>\n "+x.map((function(t){return'\n <text\n class="codersrank-activity-month"\n text-anchor="start"\n dominant-baseline="text-before-edge"\n dx="'+((b+4)*t.weekIndex+u)+'"\n dy="0"\n >\n '+d[t.month]+"\n </text>\n "})).join("")+"\n </g>\n ":"")+"\n </svg>\n "+(s?'\n <div class="codersrank-activity-preloader"></div>\n ':"")+"\n </div>\n "+(o?'\n <div class="codersrank-activity-legend">\n <span class="codersrank-activity-legend-label">Less</span>\n <span class="codersrank-activity-legend-item"></span>\n <span class="codersrank-activity-legend-item codersrank-activity-legend-item-1"></span>\n <span class="codersrank-activity-legend-item codersrank-activity-legend-item-2"></span>\n <span class="codersrank-activity-legend-item codersrank-activity-legend-item-3"></span>\n <span class="codersrank-activity-legend-item codersrank-activity-legend-item-4"></span>\n <span class="codersrank-activity-legend-label">More</span>\n </div>\n ':"")+"\n </div>\n "},d='<svg xmlns="http://www.w3.org/2000/svg" width="56" height="56" viewBox="0 0 56 56"><path fill="#fff" fill-rule="evenodd" d="M0,25.0007674 C0,36.0462261 7.1625894,45.4157586 17.0969029,48.7215691 C18.3477086,48.9517788 18.8035237,48.1798091 18.8035237,47.5168053 C18.8035237,46.9243992 18.7820375,45.3512999 18.7697597,43.2656005 C11.8158937,44.7757758 10.3486909,39.9137481 10.3486909,39.9137481 C9.21145523,37.0253845 7.57236256,36.2564842 7.57236256,36.2564842 C5.30249547,34.706406 7.74425243,34.7371006 7.74425243,34.7371006 C10.2535376,34.9135946 11.5734062,37.3139139 11.5734062,37.3139139 C13.8033703,41.1338592 17.4253353,40.0303877 18.8495657,39.3904049 C19.0767059,37.7758679 19.7228276,36.6739311 20.4364775,36.0492956 C14.8853556,35.4185211 9.04877375,33.2729672 9.04877375,23.6931766 C9.04877375,20.9644249 10.0233279,18.7313914 11.6225176,16.9848676 C11.3646828,16.3525584 10.5067682,13.8095092 11.8680745,10.3686424 C11.8680745,10.3686424 13.9660518,9.69643022 18.7421345,12.9316431 C20.73575,12.3760705 22.875165,12.0998189 25.0007674,12.0890758 C27.124835,12.0998189 29.2627152,12.3760705 31.2594002,12.9316431 C36.0324135,9.69643022 38.1273213,10.3686424 38.1273213,10.3686424 C39.4916971,13.8095092 38.6337825,16.3525584 38.3774824,16.9848676 C39.9797416,18.7313914 40.9466221,20.9644249 40.9466221,23.6931766 C40.9466221,33.2975229 35.1008318,35.4108475 29.5328279,36.0293441 C30.4291108,36.8013137 31.2287056,38.3268363 31.2287056,40.6596274 C31.2287056,44.0007367 31.198011,46.697259 31.198011,47.5168053 C31.198011,48.185948 31.6492219,48.9640566 32.9169097,48.7200344 C42.8435495,45.4065502 50,36.0431566 50,25.0007674 C50,11.1927929 38.8056724,0 24.9976979,0 C11.1943276,0 0,11.1927929 0,25.0007674 Z" transform="translate(3 3)"/></svg>',u='<svg xmlns="http://www.w3.org/2000/svg" width="56" height="56" viewBox="0 0 56 56"><path fill="#ee7a06" d="M5.22307574,30.9345 L5.22307574,44.4341791 L36.3289243,44.4341791 L36.3289243,30.9345 L40.776,30.9345 L40.776,48.9345 L0.776,48.9345 L0.776,30.9345 L5.22307574,30.9345 Z M32,35 L32,40 L10,40 L10,35 L32,35 Z M10.9277895,25 L33,29.6115033 L32.0722105,34 L10,29.3884967 L10.9277895,25 Z M14.8746402,16 L35,25.0945103 L33.1253598,29 L13,19.9054897 L14.8746402,16 Z M20.8556275,7 L38,20.7080348 L35.1443725,24 L18,10.2919652 L20.8556275,7 Z M29.6024511,0 L43,17.4101966 L39.3975489,20 L26,2.58980337 L29.6024511,0 Z" transform="translate(6 4)"/></svg>',h='<svg xmlns="http://www.w3.org/2000/svg" width="56" height="56" viewBox="0 0 56 56"><path fill="#fff" d="M 47.5700 10.5625 L 24.7655 10.5625 C 23.1718 10.5625 22.2108 10.1641 21.0389 9.1797 L 19.6093 7.9844 C 18.0624 6.6953 16.8671 6.2500 14.5468 6.2500 L 7.5624 6.2500 C 3.4608 6.2500 1.0936 8.5937 1.0936 13.3281 L 1.0936 19.5859 L 54.9064 19.5859 L 54.9064 17.8047 C 54.9064 12.9766 52.4454 10.5625 47.5700 10.5625 Z M 8.4530 49.7500 L 48.2732 49.7500 C 52.4684 49.7500 54.9064 47.3125 54.9064 42.4844 L 54.9064 22.7735 L 1.0936 22.7735 L 1.0936 42.4844 C 1.0936 47.3359 3.5780 49.7500 8.4530 49.7500 Z"/></svg>',v='\n <svg xmlns="http://www.w3.org/2000/svg" width="350" height="350" viewBox="0 0 350 350"><g fill="none" transform="translate(6 20)"><path fill="#FC6D26" d="M337.17,177.83 L318.26,119.71 L280.84,4.43 C279.956602,1.7925919 277.486423,0.0149148401 274.705,0.0149148401 C271.923577,0.0149148401 269.453398,1.7925919 268.57,4.43 L231.15,119.64 L106.82,119.64 L69.4,4.43 C68.5220965,1.78979642 66.0523353,0.00830812195 63.27,0.00830812195 C60.4876647,0.00830812195 58.0179035,1.78979642 57.14,4.43 L19.78,119.64 L0.87,177.83 C-0.853328917,183.12969 1.02714845,188.936572 5.53,192.22 L169,311 L332.44,192.22 C336.963325,188.951421 338.871954,183.144831 337.17,177.83"/><polygon fill="#E24329" points="63 191.91 63 191.91 125.16 .63 .87 .63" transform="translate(106 119)"/><polygon fill="#FC6D26" points="150 191.91 87.82 .63 .82 .63" transform="translate(19 119)"/><path fill="#FCA326" d="M19.75,0.69 L19.75,0.69 L0.84,58.81 C-0.883328917,64.1096898 0.997148451,69.9165716 5.5,73.2 L169,192 L19.75,0.69 Z" transform="translate(0 119)"/><path fill="#E24329" d="M0.78,119.69 L87.89,119.69 L50.4,4.49 C49.5166016,1.8525919 47.046423,0.0749148401 44.265,0.0749148401 C41.483577,0.0749148401 39.0133984,1.8525919 38.13,4.49 L0.78,119.69 Z" transform="translate(19)"/><polygon fill="#FC6D26" points="0 191.91 62.16 .63 149.3 .63" transform="translate(169 119)"/><path fill="#FCA326" d="M149.24,0.69 L149.24,0.69 L168.15,58.81 C169.883261,64.1096795 168.000893,69.9224023 163.49,73.2 L0,191.91 L149.2,0.69 L149.24,0.69 Z" transform="translate(169 119)"/><path fill="#E24329" d="M87.28,119.69 L0.18,119.69 L37.6,4.49 C38.4779035,1.84979642 40.9476647,0.0683081219 43.73,0.0683081219 C46.5123353,0.0683081219 48.9820965,1.84979642 49.86,4.49 L87.28,119.69 Z" transform="translate(231)"/></g></svg>\n ',p="codersrank-activity",f=function(n){var r,i;function o(){var t;return(t=n.call(this)||this).tempDiv=document.createElement("div"),t.shadowEl=t.attachShadow({mode:"closed"}),t.stylesEl=document.createElement("style"),t.stylesEl.textContent=":host{--font-family:Open Sans,Helvetica Neue,Helvetica,Arial,sans-serif;--label-font-size:9px;--label-text-color:#999ea4;--legend-font-size:12px;--legend-text-color:#999ea4;--legend-item-width:14px;--legend-item-height:14px;--legend-margin:1em 0 0 0;--bg-color-0:#f6f6f6;--bg-color-1:rgba(80, 176, 186, 0.3);--bg-color-2:rgba(80, 176, 186, 0.6);--bg-color-3:rgba(80, 176, 186, 1);--bg-color-4:#24565a;--border-color-0:transparent;--border-color-1:transparent;--border-color-2:transparent;--border-color-3:transparent;--border-color-4:transparent;--svg-width:100%;--svg-height:auto;--preloader-color:#72a0a8;--tooltip-font-size:14px;width:100%;display:block;position:relative}.codersrank-activity{font-family:var(--font-family);position:relative}.codersrank-activity-preloader{position:absolute;left:50%;top:50%;width:32px;height:32px;margin:-16px 0 0 -16px;border:3px solid var(--preloader-color);border-left-color:transparent;border-bottom-color:transparent;border-radius:50%;box-sizing:border-box;-webkit-animation:preloader 1s infinite linear;animation:preloader 1s infinite linear}.codersrank-activity-chart{width:100%;position:relative}.codersrank-activity-chart svg{width:var(--svg-width);height:var(--svg-height)}.codersrank-activity-day{fill:var(--bg-color-0);stroke-width:1;stroke:var(--border-color-0)}.codersrank-activity-day-1{fill:var(--bg-color-1);stroke:var(--border-color-1)}.codersrank-activity-day-2{fill:var(--bg-color-2);stroke:var(--border-color-2)}.codersrank-activity-day-3{fill:var(--bg-color-3);stroke:var(--border-color-3)}.codersrank-activity-day-4{fill:var(--bg-color-4);stroke:var(--border-color-4)}.codersrank-activity-day-disabled{display:none}.codersrank-activity-month,.codersrank-activity-wday{font-size:var(--label-font-size);fill:var(--label-text-color)}.codersrank-activity-wday:nth-child(2n){display:none}.codersrank-activity-tooltip{text-align:left;position:absolute;background:#000;transform:translateX(-50%) translateY(-100%);border-radius:4px;color:#fff;font-family:var(--font-family);padding:8px;font-size:var(--tooltip-font-size);white-space:nowrap;pointer-events:none;margin-top:-10px;width:200px;line-height:1.5}.codersrank-activity-tooltip-angle{width:0px;height:0px;position:absolute;left:50%;top:100%;border-left:10px solid transparent;border-right:10px solid transparent;border-top:10px solid #000;margin-left:-5px}.codersrank-activity-tooltip-header{padding-bottom:4px;margin-bottom:4px;border-bottom:1px solid rgba(255,255,255,.25)}.codersrank-activity-tooltip-list{list-style:none;margin:0;padding:0}.codersrank-activity-tooltip-list li{display:flex;align-items:center}.codersrank-activity-tooltip-list i{text-align:center;font-size:16px;width:16px;height:16px;margin-right:8px;display:block}.codersrank-activity-tooltip-list i svg{display:block;width:16px;height:16px}.codersrank-activity-legend{display:flex;justify-content:flex-end;align-items:center;color:var(--legend-text-color);line-height:1;font-size:var(--legend-font-size);margin:var(--legend-margin)}.codersrank-activity-legend-label:first-child{margin-right:8px}.codersrank-activity-legend-label:last-child{margin-left:8px}.codersrank-activity-legend-item{box-sizing:border-box;width:var(--legend-item-width);height:var(--legend-item-height);background-color:var(--bg-color-0);border:1px solid var(--border-color-0);margin:0 2px;border-radius:2px}.codersrank-activity-legend-item-1{background-color:var(--bg-color-1);border-color:var(--border-color-1)}.codersrank-activity-legend-item-2{background-color:var(--bg-color-2);border-color:var(--border-color-2)}.codersrank-activity-legend-item-3{background-color:var(--bg-color-3);border-color:var(--border-color-3)}.codersrank-activity-legend-item-4{background-color:var(--bg-color-4);border-color:var(--border-color-4)}@-webkit-keyframes preloader{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}@keyframes preloader{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}",t.shadowEl.appendChild(t.stylesEl),t.onMouseEnter=t.onMouseEnter.bind(s(t)),t.onMouseLeave=t.onMouseLeave.bind(s(t)),t.mounted=!1,t.state=0,t.data=null,t}i=n,(r=o).prototype=Object.create(i.prototype),r.prototype.constructor=r,r.__proto__=i;var a,p,f,g=o.prototype;return g.getTotalActivities=function(t){void 0===t&&(t={});var e=0;return Object.keys(t).forEach((function(n){Object.keys(t[n]).forEach((function(r){e+=t[n][r]||0}))})),e},g.emitData=function(t){void 0===t&&(t={});var e=new CustomEvent("data",{detail:{data:t,total:this.getTotalActivities(t)}});this.dispatchEvent(e)},g.emitError=function(t){var e=new CustomEvent("error",{detail:t});this.dispatchEvent(e)},g.render=function(){var t=this.username,n=this.id,r=this.mounted,i=this.state,o=this.shadowEl,a=this.data,s=this.weeks,l=this.svgWidth,d=this.legend,u=this.labels,h=this.step,v=this.tempDiv,p={data:a,weeks:s,svgWidth:l,legend:d,labels:u,step:h};if((t||n)&&r){3===i?v.innerHTML=c(p):2===i?v.innerHTML="":0!==i&&1!==i||(v.innerHTML=function(t){return c(e({},t,{preloader:!0,data:{}}))}(p));var f=o.querySelector(".codersrank-activity");f&&f.parentNode.removeChild(f),(f=v.querySelector(".codersrank-activity"))&&(this.widgetEl=f,this.detachEvents(),this.attachEvents(),o.appendChild(f))}},g.loadAndRender=function(){var t=this,e=this.username,n=this.id;this.state=1,this.render(),function(t,e){if(t&&l[t])return Promise.resolve(l[t]);if(e&&l[e])return Promise.resolve(l[e]);var n="https://grpcgateway.codersrank.io/candidate/activity/"+(t||e);return e&&(n+="?id=true"),fetch(n,{method:"GET",headers:{"Content-Type":"application/json"}}).then((function(t){return t.json()})).then((function(n){return e?l[e]=n:l[t]=n,n})).catch((function(t){return Promise.reject(t)}))}(e,n).then((function(e){t.emitData(e),t.data=e,t.state=3,t.render()})).catch((function(e){t.emitError(e),t.state=2,t.render()}))},g.activitiesInDay=function(t){var e=0;if(!this.data||!t)return e;var n=this.data[t];return n&&Object.keys(n).forEach((function(t){e+=n[t]})),e},g.tooltipText=function(t){var e=this.data[t],n=this.activitiesInDay(t);return'\n <div class="codersrank-activity-tooltip-header">\n '+Intl.DateTimeFormat().format(new Date(t))+" - <b>"+n+' activities</b>\n </div>\n <ul class="codersrank-activity-tooltip-list">\n '+(e.github?"\n <li><i>"+d+"</i>"+e.github+" activities</li>\n ":"")+"\n "+(e.gitlab?"\n <li><i>"+v+"</i>"+e.gitlab+" activities</li>\n ":"")+"\n "+(e.private?"\n <li><i>"+h+"</i>"+e.private+" activities</li>\n ":"")+"\n "+(e.stackoverflow?"\n <li><i>"+u+"</i>"+e.stackoverflow+" activities</li>\n ":"")+"\n </ul>\n "},g.showTooltip=function(t){if(this.data&&t&&this.tooltip&&this.widgetEl&&this.data[t]){var e=this.shadowEl.querySelector('[data-date="'+t+'"]');if(e){this.tempDiv.innerHTML='\n <div class="codersrank-activity-tooltip">\n '+this.tooltipText(t)+'\n <div class="codersrank-activity-tooltip-angle"></div>\n </div>\n ';var n=this.getBoundingClientRect(),r=e.getBoundingClientRect(),i=this.tempDiv.querySelector(".codersrank-activity-tooltip"),o=r.left-n.left,a=-5;o<110&&(a=-5-(110-o),o=110),o+110>n.width&&(a=105-(n.width-o),o=n.width-110),a=Math.max(Math.min(a,105),-105),i.style.left=o+"px",i.style.top=r.top-n.top+"px",i.querySelector(".codersrank-activity-tooltip-angle").style.marginLeft=a+"px",this.shadowEl.appendChild(i)}}},g.hideTooltip=function(){if(this.tooltip&&this.widgetEl){var t=this.shadowEl.querySelector(".codersrank-activity-tooltip");t&&this.shadowEl.removeChild(t)}},g.onMouseEnter=function(t){if("rect"===t.target.tagName){var e=t.target.getAttribute("data-date");this.showTooltip(e)}},g.onMouseLeave=function(){this.hideTooltip()},g.attributeChangedCallback=function(){this.mounted&&this.loadAndRender()},g.attachEvents=function(){this.widgetEl&&(this.widgetEl.addEventListener("mouseenter",this.onMouseEnter,!0),this.widgetEl.addEventListener("mouseleave",this.onMouseLeave,!0))},g.detachEvents=function(){this.widgetEl&&(this.widgetEl.removeEventListener("mouseenter",this.onMouseEnter,!0),this.widgetEl.removeEventListener("mouseleave",this.onMouseLeave,!0))},g.connectedCallback=function(){this.width=this.offsetWidth,this.mounted=!0,this.loadAndRender()},g.disconnectedCallback=function(){this.mounted=!1,this.detachEvents()},a=o,f=[{key:"observedAttributes",get:function(){return["username","weeks","svg-width","legend","labels","id"]}}],(p=[{key:"tooltip",get:function(){var t=this.getAttribute("tooltip");return""===t||"true"===t},set:function(t){this.setAttribute("tooltip",t)}},{key:"id",get:function(){return this.getAttribute("id")},set:function(t){this.setAttribute("id",t)}},{key:"username",get:function(){return this.getAttribute("username")},set:function(t){this.setAttribute("username",t)}},{key:"weeks",get:function(){return Math.min(parseInt(this.getAttribute("weeks")||52,10),52)},set:function(t){this.setAttribute("weeks",t)}},{key:"svgWidth",get:function(){var t=parseInt(this.getAttribute("svg-width")||0,10);return!t&&this.weeks<52?800/(52/this.weeks):t||800},set:function(t){this.setAttribute("svg-width",t)}},{key:"svg-width",set:function(t){this.setAttribute("svg-width",t)}},{key:"legend",get:function(){var t=this.getAttribute("legend");return""===t||"true"===t},set:function(t){this.setAttribute("legend",t)}},{key:"labels",get:function(){var t=this.getAttribute("labels");return""===t||"true"===t},set:function(t){this.setAttribute("labels",t)}},{key:"step",get:function(){return parseInt(this.getAttribute("step")||10,10)},set:function(t){this.setAttribute("step",t)}}])&&t(a.prototype,p),f&&t(a,f),o}(a(HTMLElement));window.customElements&&!window.customElements.get(p)&&window.customElements.define(p,f)})); | ||
//# sourceMappingURL=codersrank-activity.min.js.map |
var cache = {}; | ||
export var fetchData = function fetchData(username, id) { | ||
if (cache[username]) return Promise.resolve(cache[username]); | ||
if (username && cache[username]) return Promise.resolve(cache[username]); | ||
if (id && cache[id]) return Promise.resolve(cache[id]); | ||
var endpoint = "https://grpcgateway.codersrank.io/candidate/activity/" + (username || id); | ||
@@ -14,3 +15,8 @@ if (id) endpoint += '?id=true'; | ||
}).then(function (data) { | ||
cache[username] = data; | ||
if (id) { | ||
cache[id] = data; | ||
} else { | ||
cache[username] = data; | ||
} | ||
return data; | ||
@@ -17,0 +23,0 @@ })["catch"](function (err) { |
{ | ||
"name": "@codersrank/activity", | ||
"version": "0.9.8", | ||
"version": "0.9.9", | ||
"description": "CodersRank activity widget", | ||
@@ -5,0 +5,0 @@ "main": "cjs/codersrank-activity.js", |
# CodersRank Activity Widget | ||
<!-- DOCS_START --> | ||
CodersRank Activity Widget is a web component that allows you easily integrate nice looking activity chart from your [CodersRank](https://codersrank.io) profile to your personal website: | ||
@@ -9,3 +11,3 @@ | ||
Widget script available through NPM: | ||
The widget script available through NPM: | ||
@@ -12,0 +14,0 @@ ``` |
Sorry, the diff of this file is not supported yet
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
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
166751
1693
156