summaryrefslogtreecommitdiff
path: root/public/vendor
diff options
context:
space:
mode:
authorWu Cheng-Han2016-07-02 16:15:56 +0800
committerWu Cheng-Han2016-07-02 16:15:56 +0800
commit4734d0ebe1d12f5cd7cacc8e4578c010e1b5d8a5 (patch)
treece9d48c3cb720e54debcaa73fb39615477e7f7d2 /public/vendor
parentda7b6a340d74878ded59c50780463ddc9a9bfabc (diff)
Add callback feature for gist-embed to be called after ajax complete
Diffstat (limited to 'public/vendor')
-rw-r--r--public/vendor/gist-embed.min.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/public/vendor/gist-embed.min.js b/public/vendor/gist-embed.min.js
index 308e8740..880adc7e 100644
--- a/public/vendor/gist-embed.min.js
+++ b/public/vendor/gist-embed.min.js
@@ -1 +1 @@
-!function(a){"use strict";function b(a){var c,d,b=[];if("number"==typeof a)b.push(a);else{d=a.split(",");for(var e=0;e<d.length;e++)if(c=d[e].split("-"),2===c.length)for(var f=parseInt(c[0],10);f<=c[1];f++)b.push(f);else 1===c.length&&b.push(parseInt(c[0],10))}return b}a.fn.gist=function(){return this.each(function(){var d,e,f,g,h,i,j,k,l,m,c=a(this),n={};return c.css("display","block"),d=c.data("gist-id")||"",f=c.data("gist-file"),j=c.data("gist-hide-footer")===!0,k=c.data("gist-hide-line-numbers")===!0,g=c.data("gist-line"),i=c.data("gist-highlight-line"),m=c.data("gist-show-spinner")===!0,l=m?!1:void 0!==c.data("gist-show-loading")?c.data("gist-show-loading"):!0,f&&(n.file=f),d?(e="https://gist.github.com/"+d+".json",h="Loading gist "+e+(n.file?", file: "+n.file:"")+"...",l&&c.html(h),m&&c.html('<img style="display:block;margin-left:auto;margin-right:auto" alt="'+h+'" src="https://assets-cdn.github.com/images/spinners/octocat-spinner-32.gif">'),void a.ajax({url:e,data:n,dataType:"jsonp",timeout:1e4,success:function(d){var f,h,l,m,n;d&&d.div?(d.stylesheet&&(0===d.stylesheet.indexOf("<link")?d.stylesheet=d.stylesheet.replace(/\\/g,"").match(/href=\"([^\s]*)\"/)[1]:0!==d.stylesheet.indexOf("http")&&(0!==d.stylesheet.indexOf("/")&&(d.stylesheet="/"+d.stylesheet),d.stylesheet="https://gist.github.com"+d.stylesheet)),d.stylesheet&&0===a('link[href="'+d.stylesheet+'"]').length&&(f=document.createElement("link"),h=document.getElementsByTagName("head")[0],f.type="text/css",f.rel="stylesheet",f.href=d.stylesheet,h.insertBefore(f,h.firstChild)),n=a(d.div),n.removeAttr("id"),c.html("").append(n),i&&(m=b(i),n.find("td.line-data").css({width:"100%"}),n.find(".js-file-line").each(function(b){-1!==a.inArray(b+1,m)&&a(this).css({"background-color":"rgb(255, 255, 204)"})})),g&&(l=b(g),n.find(".js-file-line").each(function(b){-1===a.inArray(b+1,l)&&a(this).parent().remove()})),j&&(n.find(".gist-meta").remove(),n.find(".gist-data").css("border-bottom","0px"),n.find(".gist-file").css("border-bottom","1px solid #ddd")),k&&n.find(".js-line-number").remove()):c.html("Failed loading gist "+e)},error:function(a,b){c.html("Failed loading gist "+e+": "+b)}})):!1})},a(function(){a("[data-gist-id]").gist()})}(jQuery);
+!function(t){"use strict";function e(t){var e,i,s=[];if("number"==typeof t)s.push(t);else{i=t.split(",");for(var n=0;n<i.length;n++)if(e=i[n].split("-"),2===e.length)for(var a=parseInt(e[0],10);a<=e[1];a++)s.push(a);else 1===e.length&&s.push(parseInt(e[0],10))}return s}t.fn.gist=function(i){return this.each(function(){var s,n,a,l,o,r,d,h,g,f,c=t(this),u={};return c.css("display","block"),s=c.data("gist-id")||"",a=c.data("gist-file"),d=c.data("gist-hide-footer")===!0,h=c.data("gist-hide-line-numbers")===!0,l=c.data("gist-line"),r=c.data("gist-highlight-line"),f=c.data("gist-show-spinner")===!0,g=!f&&(void 0===c.data("gist-show-loading")||c.data("gist-show-loading")),a&&(u.file=a),!!s&&(n="https://gist.github.com/"+s+".json",o="Loading gist "+n+(u.file?", file: "+u.file:"")+"...",g&&c.html(o),f&&c.html('<img style="display:block;margin-left:auto;margin-right:auto" alt="'+o+'" src="https://assets-cdn.github.com/images/spinners/octocat-spinner-32.gif">'),void t.ajax({url:n,data:u,dataType:"jsonp",timeout:1e4,success:function(i){var s,a,o,g,f;i&&i.div?(i.stylesheet&&(0===i.stylesheet.indexOf("<link")?i.stylesheet=i.stylesheet.replace(/\\/g,"").match(/href=\"([^\s]*)\"/)[1]:0!==i.stylesheet.indexOf("http")&&(0!==i.stylesheet.indexOf("/")&&(i.stylesheet="/"+i.stylesheet),i.stylesheet="https://gist.github.com"+i.stylesheet)),i.stylesheet&&0===t('link[href="'+i.stylesheet+'"]').length&&(s=document.createElement("link"),a=document.getElementsByTagName("head")[0],s.type="text/css",s.rel="stylesheet",s.href=i.stylesheet,a.insertBefore(s,a.firstChild)),f=t(i.div),f.removeAttr("id"),c.html("").append(f),r&&(g=e(r),f.find("td.line-data").css({width:"100%"}),f.find(".js-file-line").each(function(e){t.inArray(e+1,g)!==-1&&t(this).css({"background-color":"rgb(255, 255, 204)"})})),l&&(o=e(l),f.find(".js-file-line").each(function(e){t.inArray(e+1,o)===-1&&t(this).parent().remove()})),d&&(f.find(".gist-meta").remove(),f.find(".gist-data").css("border-bottom","0px"),f.find(".gist-file").css("border-bottom","1px solid #ddd")),h&&f.find(".js-line-number").remove()):c.html("Failed loading gist "+n)},error:function(t,e){c.html("Failed loading gist "+n+": "+e)},complete:function(){i&&"function"==typeof i&&i()}}))})},t(function(){t("[data-gist-id]").gist()})}(jQuery); \ No newline at end of file