all repos — h3rald @ b388098916e6f848dbaad9ef3b816e1591caac56

The sources of https://h3rald.com

Removed jQuery.
h3rald h3rald@h3rald.com
Sat, 05 Jul 2014 22:23:00 +0200
commit

b388098916e6f848dbaad9ef3b816e1591caac56

parent

336a6b7e5bfd2becc17efc2a889e12e278ee9d50

1 files changed, 7 insertions(+), 29 deletions(-)

jump to
M javascripts/hastyscribe.jsjavascripts/hastyscribe.js

@@ -1,37 +1,15 @@

-$(function(){ +document.addEventListener('DOMContentLoaded', function(){ + hljs.configure({tabReplace: ' '}); - $('.highlight pre code').each(function(i, e){ + + Array.prototype.forEach.call(document.querySelectorAll('.highlight pre code'), function(e){ hljs.highlightBlock(e); }); + var link_to_top = '<a href="#document-top" title="Back to top">&#8593</a>'; - $('h2, h3, h4, h5, h6').each(function(i, e){ - $(e).append(link_to_top); + Array.prototype.forEach.call(document.querySelectorAll('h2, h3, h4, h5, h6'), function(e){ + e.appendChild(link_to_top); }); - $('.conditional-sidebar').prepend('<div class="conditions"></div>'); - $('.conditional-sidebar > div > p:first-child').each(function(i, e){ - var inner_sidebar = $(e).parent(); - var dest = $(e).parent().parent(); - var p = $(e).clone(); - var cls = inner_sidebar.attr('class'); - inner_sidebar.removeClass(); - inner_sidebar.addClass(cls+"-target") - $(e).remove(); - ($("<div />").addClass(cls).append(p)).appendTo($('.conditions', dest)); - }) - $('.conditional-sidebar .conditions > div:first').addClass('selected'); - $('.conditional-sidebar > div[class$=target]').hide(); - $('.conditional-sidebar > div[class$=target]:first').show(); - $('.conditional-sidebar .conditions > div').click(function(){ - var conditional_sidebar = $(this).parent().parent(); - var target = $("."+$(this).attr('class')+"-target", conditional_sidebar); - var targets = $("div[class$='target']", conditional_sidebar); - $(this).siblings().removeClass('selected'); - $(this).addClass('selected'); - targets.hide(); - console.log(target); - target.show(); - }) }) -