Move less and js

This commit is contained in:
Oliver Davies 2017-11-01 20:58:58 +00:00
parent 662c446b02
commit af64453ef8
10 changed files with 2 additions and 2 deletions

View file

@ -1,9 +0,0 @@
(function ($) {
$('html.no-js').addClass('js').removeClass('no-js');
$('.nav-toggle').on('click', function (e) {
e.preventDefault();
$(this).siblings('.nav-right').toggleClass('is-active');
});
})(jQuery);

View file

@ -1,199 +0,0 @@
/*
* author: Blair Vanderhoof
* https://github.com/blairvanderhoof/gist-embed
* version 2.4
*/
(function($) {
'use strict';
function getLineNumbers(lineRangeString) {
var lineNumbers = [], range, lineNumberSections;
if (typeof lineRangeString === 'number') {
lineNumbers.push(lineRangeString);
} else {
lineNumberSections = lineRangeString.split(',');
for (var i = 0; i < lineNumberSections.length; i++) {
range = lineNumberSections[i].split('-');
if (range.length === 2) {
for (var j = parseInt(range[0], 10); j <= range[1]; j++) {
lineNumbers.push(j);
}
} else if (range.length === 1) {
lineNumbers.push(parseInt(range[0], 10));
}
}
}
return lineNumbers;
}
$.fn.gist = function() {
return this.each(function() {
var $elem = $(this),
id,
url,
file,
lines,
loading,
highlightLines,
hideFooterOption,
hideLineNumbersOption,
showLoading,
showSpinner,
data = {};
// make block level so loading text shows properly
$elem.css('display', 'block');
id = $elem.data('gist-id') || '';
file = $elem.data('gist-file');
hideFooterOption = $elem.data('gist-hide-footer') === true;
hideLineNumbersOption = $elem.data('gist-hide-line-numbers') === true;
lines = $elem.data('gist-line');
highlightLines = $elem.data('gist-highlight-line');
showSpinner = $elem.data('gist-show-spinner') === true;
if (showSpinner) {
showLoading = false;
} else {
showLoading = $elem.data('gist-show-loading') !== undefined ?
$elem.data('gist-show-loading') : true;
}
if (file) {
data.file = file;
}
// if the id doesn't exist, then ignore the code block
if (!id) {
return false;
}
url = 'https://gist.github.com/' + id + '.json';
loading = 'Loading gist ' + url + (data.file ? ', file: ' + data.file : '') + '...';
// loading
if (showLoading) {
$elem.html(loading);
}
// loading spinner
if (showSpinner) {
$elem.html('<img style="display:block;margin-left:auto;margin-right:auto" alt="' + loading + '" src="https://assets-cdn.github.com/images/spinners/octocat-spinner-32.gif">');
}
// request the json version of this gist
$.ajax({
url: url,
data: data,
dataType: 'jsonp',
timeout: 10000,
success: function(response) {
var linkTag,
head,
lineNumbers,
highlightLineNumbers,
$responseDiv;
// the html payload is in the div property
if (response && response.div) {
// github returns /assets/embed-id.css now, but let's be sure about that
if (response.stylesheet) {
// github passes down html instead of a url for the stylehsheet now
// parse off the href
if (response.stylesheet.indexOf('<link') === 0) {
response.stylesheet =
response.stylesheet
.replace(/\\/g,'')
.match(/href=\"([^\s]*)\"/)[1];
} else if (response.stylesheet.indexOf('http') !== 0) {
// add leading slash if missing
if (response.stylesheet.indexOf('/') !== 0) {
response.stylesheet = '/' + response.stylesheet;
}
response.stylesheet = 'https://gist.github.com' + response.stylesheet;
}
}
// add the stylesheet if it does not exist
if (response.stylesheet && $('link[href="' + response.stylesheet + '"]').length === 0) {
linkTag = document.createElement('link');
head = document.getElementsByTagName('head')[0];
linkTag.type = 'text/css';
linkTag.rel = 'stylesheet';
linkTag.href = response.stylesheet;
head.insertBefore(linkTag, head.firstChild);
}
// refernce to div
$responseDiv = $(response.div);
// remove id for uniqueness constraints
$responseDiv.removeAttr('id');
$elem.html('').append($responseDiv);
// option to highlight lines
if (highlightLines) {
highlightLineNumbers = getLineNumbers(highlightLines);
// we need to set the line-data td to 100% so the highlight expands the whole line
$responseDiv.find('td.line-data').css({
'width': '100%'
});
// find all .js-file-line tds (actual code lines) that match the highlightLines and add the highlight class
$responseDiv.find('.js-file-line').each(function(index) {
if ($.inArray(index + 1, highlightLineNumbers) !== -1) {
$(this).css({
'background-color': 'rgb(255, 255, 204)'
});
}
});
}
// if user provided a line param, get the line numbers based on the criteria
if (lines) {
lineNumbers = getLineNumbers(lines);
// find all trs containing code lines that don't exist in the line param
$responseDiv.find('.js-file-line').each(function(index) {
if (($.inArray(index + 1, lineNumbers)) === -1) {
$(this).parent().remove();
}
});
}
// option to remove footer
if (hideFooterOption) {
$responseDiv.find('.gist-meta').remove();
// present a uniformed border when footer is hidden
$responseDiv.find('.gist-data').css('border-bottom', '0px');
$responseDiv.find('.gist-file').css('border-bottom', '1px solid #ddd');
}
// option to remove
if (hideLineNumbersOption) {
$responseDiv.find('.js-line-number').remove();
}
} else {
$elem.html('Failed loading gist ' + url);
}
},
error: function(jqXHR, textStatus) {
$elem.html('Failed loading gist ' + url + ': ' + textStatus);
}
});
});
};
$(function() {
// find all elements containing "data-gist-id" attribute.
$('[data-gist-id]').gist();
});
})(jQuery);

View file

@ -1 +0,0 @@
(function(b){function a(d){var c=[],e,g;if(typeof d==="number"){c.push(d)}else{g=d.split(",");for(var h=0;h<g.length;h++){e=g[h].split("-");if(e.length===2){for(var f=parseInt(e[0],10);f<=e[1];f++){c.push(f)}}else{if(e.length===1){c.push(parseInt(e[0],10))}}}}return c}b.fn.gist=function(){return this.each(function(){var e=b(this),d,c,h,m,k,j,f,g,l,i={};e.css("display","block");d=e.data("gist-id")||"";h=e.data("gist-file");j=e.data("gist-hide-footer")===true;f=e.data("gist-hide-line-numbers")===true;m=e.data("gist-line");k=e.data("gist-highlight-line");l=e.data("gist-show-spinner")===true;if(l){g=false}else{g=e.data("gist-show-loading")!==undefined?e.data("gist-show-loading"):true}if(h){i.file=h}if(!d){return false}c="https://gist.github.com/"+d+".json";loading="Loading gist "+c+(i.file?", file: "+i.file:"")+"...";if(g){e.html(loading)}if(l){e.html('<img style="display:block;margin-left:auto;margin-right:auto" alt="'+loading+'" src="https://assets-cdn.github.com/images/spinners/octocat-spinner-32.gif">')}b.ajax({url:c,data:i,dataType:"jsonp",timeout:10000,success:function(p){var s,r,o,q,n;if(p&&p.div){if(p.stylesheet){if(p.stylesheet.indexOf("<link")===0){p.stylesheet=p.stylesheet.replace(/\\/g,"").match(/href=\"([^\s]*)\"/)[1]}else{if(p.stylesheet.indexOf("http")!==0){if(p.stylesheet.indexOf("/")!==0){p.stylesheet="/"+p.stylesheet}p.stylesheet="https://gist.github.com"+p.stylesheet}}}if(p.stylesheet&&b('link[href="'+p.stylesheet+'"]').length===0){s=document.createElement("link");r=document.getElementsByTagName("head")[0];s.type="text/css";s.rel="stylesheet";s.href=p.stylesheet;r.insertBefore(s,r.firstChild)}n=b(p.div);n.removeAttr("id");e.html("").append(n);if(k){q=a(k);n.find("td.line-data").css({width:"100%"});n.find(".js-file-line").each(function(t){if(b.inArray(t+1,q)!==-1){b(this).css({"background-color":"rgb(255, 255, 204)"})}})}if(m){o=a(m);n.find(".js-file-line").each(function(t){if((b.inArray(t+1,o))===-1){b(this).parent().remove()}})}if(j){n.find(".gist-meta").remove();n.find(".gist-data").css("border-bottom","0px");n.find(".gist-file").css("border-bottom","1px solid #ddd")}if(f){n.find(".js-line-number").remove()}}else{e.html("Failed loading gist "+c)}},error:function(n,o){e.html("Failed loading gist "+c+": "+o)}})})};b(function(){b("[data-gist-id]").gist()})})(jQuery);

View file

@ -1 +0,0 @@
(function(e){var t="//cdn.jsdelivr.net/github-cards/1.0.2/";var r,i=0;var a=e.getElementsByTagName("meta");var n,d,l,c;for(r=0;r<a.length;r++){var s=a[r].getAttribute("name");var f=a[r].getAttribute("content");if(s==="gc:url"){n=f}else if(s==="gc:base"){t=f}else if(s==="gc:client-id"){d=f}else if(s==="gc:client-secret"){l=f}else if(s==="gc:theme"){c=f}}function u(t){if(e.querySelectorAll){return e.querySelectorAll("."+t)}var i=e.getElementsByTagName("div");var a=[];for(r=0;r<i.length;r++){if(~i[r].className.split(" ").indexOf(t)){a.push(i[r])}}return a}function g(e,t){return e.getAttribute("data-"+t)}function h(e){if(window.addEventListener){window.addEventListener("message",function(t){if(e.id===t.data.sender){e.height=t.data.height}},false)}}function v(r,a){a=a||n;if(!a){var s=g(r,"theme")||c||"default";a=t+"cards/"+s+".html"}var f=g(r,"user");var u=g(r,"repo");var v=g(r,"github");if(v){v=v.split("/");if(v.length&&!f){f=v[0];u=u||v[1]}}if(!f){return}i+=1;var o=g(r,"width");var m=g(r,"height");var b=g(r,"target");var w=g(r,"client-id")||d;var p=g(r,"client-secret")||l;var A="ghcard-"+f+"-"+i;var y=e.createElement("iframe");y.setAttribute("id",A);y.setAttribute("frameborder",0);y.setAttribute("scrolling",0);y.setAttribute("allowtransparency",true);var E=a+"?user="+f+"&identity="+A;if(u){E+="&repo="+u}if(b){E+="&target="+b}if(w&&p){E+="&client_id="+w+"&client_secret="+p}y.src=E;y.width=o||Math.min(r.parentNode.clientWidth||400,400);if(m){y.height=m}h(y);r.parentNode.replaceChild(y,r);return y}var o=u("github-card");for(r=0;r<o.length;r++){v(o[r])}if(window.githubCard){window.githubCard.render=v}})(document);

File diff suppressed because one or more lines are too long

View file

@ -1,17 +0,0 @@
.nav-item {
.black-70;
.dib;
.f6;
.link;
.ml3;
.pv3;
&:first-child { .ml0 }
}
.nav-item--active {
.b--blue;
.bb;
.black;
.bw1;
}

View file

@ -1,32 +0,0 @@
pre {
.db;
.overflow-auto;
word-break: normal;
word-wrap: no-wrap;
}
pre[class*="language-"] { .bn; .br0 }
pre code {
.pre;
word-break: normal;
}
pre code .number {
.h-auto;
.mr0;
.pa0;
background-color: inherit;
font-size: inherit;
min-width: auto;
}
code.hljs {
.pa0;
background-color: inherit;
}
code[data-gist-id] {
.pa0;
background: transparent;
}

View file

@ -1,23 +0,0 @@
.video { padding-top: 56.25% }
.video iframe,
.video embed {
.absolute;
.h-100;
.left-0;
.top-0;
.w-100;
}
.slides {
background-image: url('../images/loading.gif');
min-height: 275px;
@media @breakpoint-medium {
min-height: 460px;
}
@media @breakpoint-large {
min-height: 540px;
}
}

View file

@ -1,69 +0,0 @@
@import (less) "~font-awesome/css/font-awesome.css";
// @import (less) "~prismjs/themes/prism-twilight.css";
@import "~tachyons-less/less/_colors";
@blue: #0678be;
@import "~tachyons-less/tachyons";
p,
li,
td {
a { color: @blue }
}
pre code,
p code {
font-size: .8125rem;
}
pre code {
.db;
.bg-black-10;
.pa3;
.bl;
.bw2;
.b--black-40;
.mv2;
}
p code {
.bg-black-10;
padding: 1px 3px;
}
.button {
.bg-blue;
.bn;
.br2;
.dib;
.dim;
.link;
.no-underline;
.ph3;
.pv2;
.white-90;
&:hover {
background: darken(@blue, 10%);
cursor: pointer;
}
}
blockquote {
.ma0;
.pl3;
.bl;
.bw2;
.b--blue;
}
img.with-border {
.ba;
.b--silver;
}
@import "components/nav";
@import "components/post";
@import "components/talk";