cdn.rawgit无法访问

最近发现rawgit国内访问有问题,不翻墙访问不了,难怪最近tag cloud都加载失败。不过好在tag cloud的代码不多,可以直接在ghost的code inject中添加tag cloud的压缩代码即可。


!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n=e();for(var o in n)("object"==typeof exports?exports:t)[o]=n[o]}}(this,function(){return function(t){function e(o){if(n[o])return n[o].exports;var i=n[o]={i:o,l:!1,exports:{}};return t[o].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var n={};return e.m=t,e.c=n,e.d=function(t,n,o){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:o})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=0)}([function(t,e){!function(t){"use strict";var e=function(t,n,o){this.config=Object.assign({parentNode:document.body,width:"400px",containerClass:null,containerStyle:"position: fixed; display: flex; z-Index:100; top:10%;",itemClass:null,itemStyle:"text-decoration: none;                        display: inline-block;                        border-radius:3px;                        padding:2px 4px;                        position: absolute;",plugin:n||e.prototype.plugins.ellpise},o);var i=document.createElement("div");this.config.containerClass&&(i.className=this.config.containerClass),this.config.containerStyle&&(i.style.cssText=this.config.containerStyle),this.getContainer=function(){return i};var s=!1;this.setRunning=function(t){s=t},this.isRunning=function(){return s},this.tagNodes=this.createTags(t),this.mountTo(this.config.parentNode)};e.prototype.plugins={none:{},ellpise:{init:function(t,e){var n=e.tagNodes;this.rotate=Math.PI/2*(1+t)/n.length,this.velocity=.01,this.pos=function(t){t=t||this.t;var n=e.getContainer().offsetWidth/2,o=e.getContainer().offsetHeight/4,i=n*Math.cos(t),s=o*Math.sin(t),r=i*Math.cos(-this.rotate)+s*Math.sin(-this.rotate),a=s*Math.cos(-this.rotate)-i*Math.sin(-this.rotate);this.style.left=r+n+"px",this.style.top=a+n+"px",this.style.opacity=Math.abs(Math.sin(t)),this.style.fontSize=2*Math.abs(Math.sin(t))+"em",this.t=t+this.velocity},this.pos((t+1)/n.length*4*Math.PI)},move:function(){this.pos()},mouseover:function(t){return function(){this.velocity=.001}},mouseout:function(t){return function(){this.velocity=.01}}}},e.prototype.injectEvent=function(t,e){return t.onmouseover=e.mouseover(this),t.onmouseout=e.mouseout(this),t.init=e.init||function(){},t.move=e.move||function(){},t},e.prototype.createTags=function(t){var e=[];return t.forEach(function(n,o){var i=Object.assign({mouseover:function(t){return function(){t.setRunning(!1)}},mouseout:function(t){return function(){t.setRunning(!0)}},init:function(){},move:function(){},className:this.config.itemClass,href:n.href,style:this.config.itemStyle},this.config.plugin),s=this.createTag(n,i);s.style.zIndex=t.length-1-o,this.getContainer().appendChild(s),e.push(s)},this),e},e.prototype.colors=["#34495d","#ee7738","#f59d2a","#78bbe6"],e.prototype.randomColor=function(){return e.prototype.colors[parseInt(e.prototype.colors.length*Math.random())]},e.prototype.createTag=function(t,n){var o=document.createElement("a");return o.innerText=t.name,o.href=n.href,o.title=t.description||"",n.className&&(o.className=n.className),n.style&&(o.style.cssText=n.style),o.style.backgroundColor=e.prototype.randomColor(),o.style.color="#FFF",o.target=n.target||"_blank",this.injectEvent(o,n)},e.prototype.mountTo=function(t){t.appendChild(this.getContainer()),this.getContainer().style.width=this.config.width,this.getContainer().style.height=this.config.width,this.tagNodes.forEach(function(t,e){t.init(e,this)},this)},e.prototype.start=function(e){this.moveInterval=e||this.moveInterval||60,this.setRunning(!0);var n=function(e){return function(){e.isRunning()&&e.tagNodes.forEach(function(t){t.move()}),e.timerId=t.setTimeout(n(e),e.moveInterval)}};n(this)()},t.TagCloud=e}(window)}])});
Show Comments

Get the latest posts delivered right to your inbox.