all repos — h3rald @ e0362db7642ef8263db2f6d33da6c878f5977398

The sources of https://h3rald.com

resources/js/init.js

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
$('img.hover').preload({find: '.png', replace: '_h.png'})
$('img.hover').hover(function(){
		this.src = this.src.replace('.png','_h.png');	
	},function(){
		this.src = this.src.replace('_h','');
	});

$(document).ready(function() {
		$('.timeago').timeago();
		// Drop Caps
		$('h2 + p').each(function(){
			var first_paragraph = this;//$('#content p')[0];
			if (!first_paragraph) return false;
			var node = first_paragraph;
			while (node.childNodes.length) {
			node = node.firstChild;
			}
			var text = node.nodeValue;
			if (!text) return false;
			var first_letter = text.substr(0,1);
			if (first_letter.match(/[a-z]/i)){
				node.nodeValue = text.slice(1,text.length);
				$('<span></span>').addClass('dropcap').html(first_letter).prependTo( first_paragraph );
			}
			});
		});