9 lines
22 KiB
JavaScript
9 lines
22 KiB
JavaScript
function setPreviewPaneHeight(t){var e=t.find(".header"),i=t.find(".preview-body"),o=t.outerHeight()-e.outerHeight();i.css("height",o+"px")}function showProjectSignupBar(){var t,e=Cookies.get("projectSignupBarType");if(e)t=Cookies.get("projectSignupBarCount"),t=parseInt(t)+1,Cookies.set("projectSignupBarCount",t);else{e=["channel","part"][getRandomIntInclusive(0,1)],t=1,Cookies.set("projectSignupBarType",e,{expires:1}),Cookies.set("projectSignupBarCount",t,{expires:1})}var i=document.querySelector(".project-signup-bar."+e);if(i){var o=window.HAnalytics&&window.HAnalytics.keenService?window.HAnalytics.keenService:null;if(o){o.recordEvent({eventName:"Sign up prompt shown"});var r=i.querySelector(".reactPortal");r&&r.addEventListener("click",function(){o.recordEvent({eventName:"Sign up prompt clicked"})})}i.style.display="block",i.classList.add("project-signup-bar-show"),i.classList.remove("project-signup-bar-hide")}}!function(t,e){function i(e){var i=t(this).addClass("bitbucket-widget");if(!i.data("bitbucket-repo-inited")){i.data("bitbucket-repo-inited",!0);var o=e&&e.author&&e.repo?e.author+"/"+e.repo:i.attr("data-repo");if(!o)throw new Error("Either a data-repo attribute or author and repo options are required.");var r=o.split("/");if(2!==r.length)throw new Error("data-repo attribute must be in 'username/repository' format.");var n=r[0],a=r[1];i.html('<div class="repo-header"><div class="repo-stats"></div><span class="repo-name"><a href=""></a> / <a href=""></a></span> <span class="repo-last-update"></span></div><div class="repo-body"></div>');var s=t(":first-child",i);s.children(".repo-name").children(":first-child").attr("href","http://www.bitbucket.org/"+n).attr("target","_blank").text(n).end().children().eq(1).attr("href","http://www.bitbucket.org/"+o).attr("target","_blank").text(a),t.ajax({dataType:"jsonp",url:"https://api.bitbucket.org/1.0/repositories/"+o}).done(function(e){function o(t,e,i){return 1===t?e:i}var r=s.children(".repo-last-update");r.text(e.last_updated?"Last updated on "+e.last_updated:"Never updated"),e.logo&&t('<img class="repo-logo" src="'+e.logo+'" />').insertBefore(r);var n=e.forks_count||0,a=e.followers_count||0;s.children(".repo-stats").html('<div class="repo-forks" title="Has '+n+o(n," fork."," forks.")+'">'+n+'</div><div class="repo-followers" title="Has '+a+o(a," follower."," followers.")+'">'+a+"</div>");var c="";e.website&&(c+='<a class="repo-website" target="_blank" href="'+e.website+'">'+e.website+"</a>"),e.description&&(c+='<div class="repo-description">'+e.description.replace(/\n/g,"<br/>")+"</div>"),i.children(".repo-body").html(c),i.trigger("repo-retrieved")}).fail(function(){var t="http://bitbucket.org/"+o;i.children(".repo-body").html('<div class="error">There was error getting this repository\'s info. Try visiting <a target="_blank" href="'+t+'">'+t+"</a></div>")})}}t.fn.bitbucketRepo=function(t){return this.each(function(){i.call(this,t)}),this},t.fn.bitbucketRepo.loadOnDocumentReady=!0,t(document).ready(function(){(e.setImmediate||e.setTimeout)(function(){t.fn.bitbucketRepo.loadOnDocumentReady&&t(".bitbucket-widget").bitbucketRepo()})})}(jQuery,this);var githubWidgetLoader={fetchGithubData:function(t,e){$.ajax({url:e,dataType:"jsonp",context:this,success:function(e){var i=e.meta;switch(i.status){case 301:return void this.fetchGithubData(t,i.Location);case 403:return void console.error("Github: "+e.data.message);case 404:return void $(t).text("Repo not found. Make sure the repo is public!")}var o=e.data,r=new Date(o.pushed_at),n=r.getMonth()+1+"-"+r.getDate()+"-"+r.getFullYear(),a=$(' <div class="github-box repo"> <div class="github-box-title"> <h3> <a rel="nofollow" target="_blank" class="owner" href="'+o.owner.url.replace("api.","").replace("users/","")+'">'+o.owner.login+'</a> / <a rel="nofollow" target="_blank" class="repo" href="'+o.url.replace("api.","").replace("repos/","")+'">'+o.name+'</a> </h3> <div class="github-stats"> <a rel="nofollow" target="_blank" class="watchers" href="'+o.url.replace("api.","").replace("repos/","")+'/watchers">'+o.watchers+'</a> <a rel="nofollow" target="_blank" class="forks" href="'+o.url.replace("api.","").replace("repos/","")+'/forks">'+o.forks+'</a> </div> </div> <div class="github-box-content"> <p class="description">'+(null!=o.description?o.description:"No description")+' \u2014 <a rel="nofollow" target="_blank" href="'+o.url.replace("api.","").replace("repos/","")+'#readme">Read More</a></p> <p class="link github-homepage"></p> </div> <div class="github-box-download"> <p class="updated">Latest commit to the <strong>master</strong> branch on '+n+'</p> <a rel="nofollow" target="_blank" class="download" href="'+o.html_url+"/archive/"+o.default_branch+'.zip">Download as zip</a> </div> </div> ');null!=o.homepage&&(homepage=0!=o.homepage.indexOf("http")?"http://"+o.homepage:o.homepage,$(".github-homepage",a).html($('<a rel="nofollow" target="_blank" href="'+homepage+'">'+o.homepage+"</a>"))),t.replaceWith(a)}})},a:0,initializeGithubWidget:function(t){0==this.a&&$("head").append('<style type="text/css">.github-box{font-family:helvetica,arial,sans-serif;font-size:13px;line-height:18px;background:#fafafa;border:1px solid #ddd;color:#666;border-radius:3px}.github-box a{color:#4183c4;border:0;text-decoration:none}.github-box .github-box-title{position:relative;border-bottom:1px solid #ddd;border-radius:3px 3px 0 0;background:#fcfcfc;background:-moz-linear-gradient(#fcfcfc,#ebebeb);background:-webkit-linear-gradient(#fcfcfc,#ebebeb);}.github-box .github-box-title h3{font-family:helvetica,arial,sans-serif;font-weight:normal;font-size:16px;color:gray;margin:0;padding:10px 10px 10px 30px;background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAAXCAMAAAAx3e/WAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYxIDY0LjE0MDk0OSwgMjAxMC8xMi8wNy0xMDo1NzowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNS4xIE1hY2ludG9zaCIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDpEQjIyNkJERkM0NjYxMUUxOEFDQzk3ODcxRDkzRjhCRSIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDpEQjIyNkJFMEM0NjYxMUUxOEFDQzk3ODcxRDkzRjhCRSI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOkRCMjI2QkREQzQ2NjExRTE4QUNDOTc4NzFEOTNGOEJFIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOkRCMjI2QkRFQzQ2NjExRTE4QUNDOTc4NzFEOTNGOEJFIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+dka2KgAAAEVQTFRFxMTEyMjI0tLSvb29vr6+zc3Ny8vLxcXFz8/P6enp3t7ex8fH0dHR1NTUw8PDwMDAzs7OvLy8wcHBu7u7v7+/zMzM////budQFwAAABd0Uk5T/////////////////////////////wDmQOZeAAAAcklEQVR42tSQSQ7DMAwD6chOukWs5eX/Ty2coo0T9wOdEzEgdRBuzNmnDofgja52JDyz5TCqUp0O6kfrb4bzSXkRiTviEZZ6JKLMJ5VQ2v8iGbtbfEwXmjFMG0VwdQo10hQNxYqtLMv9O6xvpZ/QeAkwAKjwHiJLaJc3AAAAAElFTkSuQmCC) 7px center no-repeat}.github-box .github-box-title h3 .repo{font-weight:bold}.github-box .github-box-title .github-stats{position:absolute;top:8px;right:10px;background:white;border:1px solid #ddd;border-radius:3px;font-size:11px;font-weight:bold;line-height:21px;height:21px}.github-box .github-box-title .github-stats a{display:inline-block;height:21px;color:#666;padding:0 5px 0 18px;background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAqCAMAAACEJ4viAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYxIDY0LjE0MDk0OSwgMjAxMC8xMi8wNy0xMDo1NzowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNS4xIE1hY2ludG9zaCIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDpEQjIyNkJEQkM0NjYxMUUxOEFDQzk3ODcxRDkzRjhCRSIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDpEQjIyNkJEQ0M0NjYxMUUxOEFDQzk3ODcxRDkzRjhCRSI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOkRCMjI2QkQ5QzQ2NjExRTE4QUNDOTc4NzFEOTNGOEJFIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOkRCMjI2QkRBQzQ2NjExRTE4QUNDOTc4NzFEOTNGOEJFIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+h1kA9gAAAK5QTFRF+fn5sbGx8fHx09PTmpqa2dnZ/f3919fX9PT00NDQ1dXVpKSk+vr6+/v7vb298vLyycnJ8/PztLS0zc3N6enp/v7+q6ur2NjY9/f3srKy/Pz8p6en7u7uoaGhnJyc4eHhtbW1pqam6Ojo9fX17e3toqKirKys1NTUzs7Ox8fHwcHBwMDA5eXlnZ2dpaWl0dHR9vb25ubm4uLi3d3dqqqqwsLCv7+/oKCgmZmZ////8yEsbwAAAMBJREFUeNrE0tcOgjAUBuDSliUoMhTEvfdef9//xUQjgaLX0Ium/ZLT/+SkRPxZpGykvuf5VMJogy5jY9yjDHcWFhqlcRuHc4o6B1QK0BDg+hcZgNDh3NWTwzItH/bRrhvT+g3zSxZkNGCZpoWGIbU0a3Y6zV5VA6keyeDxiw62P0gUqEW0FbDim4nVikFJbU2zZXybUEaxhCqOQqyh5/G0wpWICUwthyqwD4InOMuXJ7/gs7WkoPdVg1vykF8CDACEFanKO3aSYwAAAABJRU5ErkJggg==) no-repeat}.github-box .github-box-title .github-stats .watchers{border-right:1px solid #ddd}.github-box .github-box-title .github-stats .forks{background-position:-4px -21px;padding-left:15px}.github-box .github-box-content{padding:10px;font-weight:300}.github-box .github-box-content p{margin:0}.github-box .github-box-content .link{font-weight:bold}.github-box .github-box-download{position:relative;border-top:1px solid #ddd;background:white;border-radius:0 0 3px 3px;padding:10px;height:24px}.github-box .github-box-download .updated{margin:0;font-size:11px;color:#666;line-height:24px;font-weight:300}.github-box .github-box-download .updated strong{font-weight:bold;color:#000}.github-box .github-box-download .download{position:absolute;display:block;top:10px;right:10px;height:24px;line-height:24px;font-size:12px;color:#666;font-weight:bold;text-shadow:0 1px 0 rgba(255,255,255,0.9);padding:0 10px;border:1px solid #ddd;border-bottom-color:#bbb;border-radius:3px;background:#f5f5f5;background:-moz-linear-gradient(#f5f5f5,#e5e5e5);background:-webkit-linear-gradient(#f5f5f5,#e5e5e5);}.github-box .github-box-download .download:hover{color:#527894;border-color:#cfe3ed;border-bottom-color:#9fc7db;background:#f1f7fa;background:-moz-linear-gradient(#f1f7fa,#dbeaf1);background:-webkit-linear-gradient(#f1f7fa,#dbeaf1);</style>'),this.a++;var e=$(t),i=e.data("repo"),o="https://api.github.com/repos/"+i;this.fetchGithubData(e,o)}};$(".github-widget").each(function(){githubWidgetLoader.initializeGithubWidget(this)}),/*!
|
|
* clipboard.js v1.5.3
|
|
* https://zenorocha.github.io/clipboard.js
|
|
*
|
|
* Licensed MIT © Zeno Rocha
|
|
*/
|
|
function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.Clipboard=t()}}(function(){return function t(e,i,o){function r(a,s){if(!i[a]){if(!e[a]){var c="function"==typeof require&&require;if(!s&&c)return c(a,!0);if(n)return n(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var d=i[a]={exports:{}};e[a][0].call(d.exports,function(t){var i=e[a][1][t];return r(i||t)},d,d.exports,t,e,i,o)}return i[a].exports}for(var n="function"==typeof require&&require,a=0;a<o.length;a++)r(o[a]);return r}({1:[function(t,e){var i=t("matches-selector");e.exports=function(t,e,o){for(var r=o?t:t.parentNode;r&&r!==document;){if(i(r,e))return r;r=r.parentNode}}},{"matches-selector":2}],2:[function(t,e){function i(t,e){if(r)return r.call(t,e);for(var i=t.parentNode.querySelectorAll(e),o=0;o<i.length;++o)if(i[o]==t)return!0;return!1}var o=Element.prototype,r=o.matchesSelector||o.webkitMatchesSelector||o.mozMatchesSelector||o.msMatchesSelector||o.oMatchesSelector;e.exports=i},{}],3:[function(t,e){function i(t,e,i){var r=o.apply(this,arguments);return t.addEventListener(i,r),{destroy:function(){t.removeEventListener(i,r)}}}function o(t,e,i,o){return function(i){var n=r(i.target,e,!0);n&&(Object.defineProperty(i,"target",{value:n}),o.call(t,i))}}var r=t("closest");e.exports=i},{closest:1}],4:[function(t,e,i){i.node=function(t){return t!==undefined&&t instanceof HTMLElement&&1===t.nodeType},i.nodeList=function(t){var e=Object.prototype.toString.call(t);return t!==undefined&&("[object NodeList]"===e||"[object HTMLCollection]"===e)&&"length"in t&&(0===t.length||i.node(t[0]))},i.string=function(t){return"string"==typeof t||t instanceof String},i["function"]=function(t){return"[object Function]"===Object.prototype.toString.call(t)}},{}],5:[function(t,e){function i(t,e,i){if(!t&&!e&&!i)throw new Error("Missing required arguments");if(!a.string(e))throw new TypeError("Second argument must be a String");if(!a["function"](i))throw new TypeError("Third argument must be a Function");if(a.node(t))return o(t,e,i);if(a.nodeList(t))return r(t,e,i);if(a.string(t))return n(t,e,i);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}function o(t,e,i){return t.addEventListener(e,i),{destroy:function(){t.removeEventListener(e,i)}}}function r(t,e,i){return Array.prototype.forEach.call(t,function(t){t.addEventListener(e,i)}),{destroy:function(){Array.prototype.forEach.call(t,function(t){t.removeEventListener(e,i)})}}}function n(t,e,i){return s(document.body,t,e,i)}var a=t("./is"),s=t("delegate");e.exports=i},{"./is":4,delegate:3}],6:[function(t,e){function i(t){var e;if("INPUT"===t.nodeName||"TEXTAREA"===t.nodeName)t.select(),e=t.value;else{var i=window.getSelection(),o=document.createRange();o.selectNodeContents(t),i.removeAllRanges(),i.addRange(o),e=i.toString()}return e}e.exports=i},{}],7:[function(t,e){function i(){}i.prototype={on:function(t,e,i){var o=this.e||(this.e={});return(o[t]||(o[t]=[])).push({fn:e,ctx:i}),this},once:function(t,e,i){function o(){r.off(t,o),e.apply(i,arguments)}var r=this;return o._=e,this.on(t,o,i)},emit:function(t){var e=[].slice.call(arguments,1),i=((this.e||(this.e={}))[t]||[]).slice(),o=0,r=i.length;for(o;o<r;o++)i[o].fn.apply(i[o].ctx,e);return this},off:function(t,e){var i=this.e||(this.e={}),o=i[t],r=[];if(o&&e)for(var n=0,a=o.length;n<a;n++)o[n].fn!==e&&o[n].fn._!==e&&r.push(o[n]);return r.length?i[t]=r:delete i[t],this}},e.exports=i},{}],8:[function(t,e,i){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}i.__esModule=!0;var n=function(){function t(t,e){for(var i=0;i<e.length;i++){var o=e[i];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,i,o){return i&&t(e.prototype,i),o&&t(e,o),e}}(),a=t("select"),s=o(a),c=function(){function t(e){r(this,t),this.resolveOptions(e),this.initSelection()}return t.prototype.resolveOptions=function(){var t=arguments.length<=0||arguments[0]===undefined?{}:arguments[0];this.action=t.action,this.emitter=t.emitter,this.target=t.target,this.text=t.text,this.trigger=t.trigger,this.selectedText=""},t.prototype.initSelection=function(){if(this.text&&this.target)throw new Error('Multiple attributes declared, use either "target" or "text"');if(this.text)this.selectFake();else{if(!this.target)throw new Error('Missing required attributes, use either "target" or "text"');this.selectTarget()}},t.prototype.selectFake=function(){var t=this;this.removeFake(),this.fakeHandler=document.body.addEventListener("click",function(){return t.removeFake()}),this.fakeElem=document.createElement("textarea"),this.fakeElem.style.position="absolute",this.fakeElem.style.left="-9999px",this.fakeElem.style.top=(window.pageYOffset||document.documentElement.scrollTop)+"px",this.fakeElem.setAttribute("readonly",""),this.fakeElem.value=this.text,document.body.appendChild(this.fakeElem),this.selectedText=s["default"](this.fakeElem),this.copyText()},t.prototype.removeFake=function(){this.fakeHandler&&(document.body.removeEventListener("click"),this.fakeHandler=null),this.fakeElem&&(document.body.removeChild(this.fakeElem),this.fakeElem=null)},t.prototype.selectTarget=function(){this.selectedText=s["default"](this.target),this.copyText()},t.prototype.copyText=function(){var t=undefined;try{t=document.execCommand(this.action)}catch(e){t=!1}this.handleResult(t)},t.prototype.handleResult=function(t){t?this.emitter.emit("success",{action:this.action,text:this.selectedText,trigger:this.trigger,clearSelection:this.clearSelection.bind(this)}):this.emitter.emit("error",{action:this.action,trigger:this.trigger,clearSelection:this.clearSelection.bind(this)})},t.prototype.clearSelection=function(){this.target&&this.target.blur(),window.getSelection().removeAllRanges()},t.prototype.destroy=function(){this.removeFake()},n(t,[{key:"action",set:function(){var t=arguments.length<=0||arguments[0]===undefined?"copy":arguments[0];if(this._action=t,"copy"!==this._action&&"cut"!==this._action)throw new Error('Invalid "action" value, use either "copy" or "cut"')},get:function(){return this._action}},{key:"target",set:function(t){if(t!==undefined){if(!t||"object"!=typeof t||1!==t.nodeType)throw new Error('Invalid "target" value, use a valid Element');this._target=t}},get:function(){return this._target}}]),t}();i["default"]=c,e.exports=i["default"]},{select:6}],9:[function(t,e,i){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function a(t,e){var i="data-clipboard-"+t;if(e.hasAttribute(i))return e.getAttribute(i)}i.__esModule=!0;var s=t("./clipboard-action"),c=o(s),l=t("tiny-emitter"),d=o(l),u=t("good-listener"),p=o(u),h=function(t){function e(i,o){r(this,e),t.call(this),this.resolveOptions(o),this.listenClick(i)}return n(e,t),e.prototype.resolveOptions=function(){var t=arguments.length<=0||arguments[0]===undefined?{}:arguments[0];this.action="function"==typeof t.action?t.action:this.defaultAction,this.target="function"==typeof t.target?t.target:this.defaultTarget,this.text="function"==typeof t.text?t.text:this.defaultText},e.prototype.listenClick=function(t){var e=this;this.listener=p["default"](t,"click",function(t){return e.onClick(t)})},e.prototype.onClick=function(t){this.clipboardAction&&(this.clipboardAction=null),this.clipboardAction=new c["default"]({action:this.action(t.target),target:this.target(t.target),text:this.text(t.target),trigger:t.target,emitter:this})},e.prototype.defaultAction=function(t){return a("action",t)},e.prototype.defaultTarget=function(t){var e=a("target",t);if(e)return document.querySelector(e)},e.prototype.defaultText=function(t){return a("text",t)},e.prototype.destroy=function(){this.listener.destroy(),this.clipboardAction&&(this.clipboardAction.destroy(),this.clipboardAction=null)},e}(d["default"]);i["default"]=h,e.exports=i["default"]},{"./clipboard-action":8,"good-listener":5,"tiny-emitter":7}]},{},[9])(9)});var actionBar={initialized:!1,bar:$(".project-actions-bar"),lastScrollTop:0,toggle:function(){!this.initialized&&this.bar.parent().is(":visible")&&(this.initialized=!0,this.bar.slideDown(),window.addEventListener("scroll",function(){var t=window.pageYOffset||document.documentElement.scrollTop;t>this.lastScrollTop?(this.bar.is(":visible")&&this.bar.slideUp(),this.lastScrollTop=t):t+80<this.lastScrollTop&&(this.bar.is(":visible")||this.bar.slideDown(),this.lastScrollTop=t)}.bind(this)))}};$(function(){affixer.init(),$(".project-page").resize(window.lodashDebounce(function(){affixer.initialized&&affixer.reInit(),actionBar.toggle(),$(".related-projects.affixable").width($(".project-page .right-column").width())},100)),$(".project-page").on("click","a.scroll",function(t){t.preventDefault(),target=$($(this).data("target")),offsetTop=$(this).data("offset")||0,smoothScrollTo(target,offsetTop)})}),$(window).on("load",function(){actionBar.toggle(),$(".hljs-active > pre").each(function(t,e){window.hljs.highlightBlock(e)}),new Clipboard(".project-code-widget .copy-code",{target:function(t){return $(t).closest(".preview-pane").find("pre")[0]}}).on("success",function(t){var e=$(t.trigger);e.tooltip("destroy"),e.attr("title","Copied!"),e.tooltip({trigger:"manual"}).tooltip("show"),window.setTimeout(function(){e.tooltip("destroy"),e.attr("title","Copy the code")},1500),e.blur(),t.clearSelection()}).on("error",function(t){var e=$(t.trigger),i=e.parent();e.tooltip("hide"),i.tooltip({title:"Press CTRL+C to copy",trigger:"manual",placement:"top",container:"body"}).tooltip("show"),window.setTimeout(function(){i.tooltip("destroy")},1500),e.blur()}),$(".project-code-widget .tabs a").on("click",function(){$(this).closest(".project-code-widget").find(".tabs li, .preview-pane").removeClass("active"),$(this).parent().addClass("active");var t=$($(this).data("target"));t.addClass("active"),setPreviewPaneHeight(t)});var t=$(".project-code-widget");if(t.length)if(t.hasClass("single-file")&&t.hasClass("no-preview")){var e=t.find(".header");t.css("height",e.outerHeight()+"px"),affixer.init()}else t.find(".preview-pane").length&&setPreviewPaneHeight(t.find(".preview-pane").first());!function(){if(window.frameElement){var t=function(t){var e=t.getBoundingClientRect();window.parent.postMessage({source:"hster-project-iframe",payload:{main:{height:e.height}}},"*")},e=document.querySelector(".project-page");e&&($(e).resize(function(){t(e)}),t(e))}}()});
|
|
//# sourceMappingURL=/assets/projects/page-cd773f31a4a4a368cad2204e9d270a800c93c2015efba7d22698d0c064255a8a.js.map
|