Ghost theme (MIT license)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

81 lines
2.3 KiB

'use strict';
var abc = (function ($) {
var
mainMenu = function () {
var menuOvrl = $('.js-main-menu-ovrl'),
menuHamburger = $('.js-main-menu-open');
$('.js-main-menu-open').on('click', function (e) {
e.preventDefault();
menuHamburger.hide();
menuOvrl.addClass('open');
});
$('.js-main-menu-close').on('click', function (e) {
e.preventDefault();
menuOvrl.removeClass('open');
menuHamburger.show();
});
},
// change color according to the background
headerTitles = function () {
if ($('.js-bg-check').length && $('.js-blog-bg-image').length) {
var imgPath = $('.js-blog-bg-image').css('background-image');
imgPath = imgPath && imgPath.match(/url\((['"])?(.*?)\1\)/);
imgPath = imgPath && imgPath[2];
if (imgPath) {
$('<img>').attr('src', imgPath).load(function() {
$(this).remove();
BackgroundCheck.init({
targets: '.js-bg-check',
images: '.js-blog-bg-image',
threshold: 70,
classes: {
light: 'element-dark', // when background is light
dark: 'element-light', // when background is dark
complex: 'element-complex'
}
});
});
}
}
},
niceSroll = function() {
$('html').niceScroll({
cursorcolor:'#fff',
cursorwidth: 5,
cursorborder: '1px solid #fff',
zindex: 99999,
cursorborderradius: 10,
scrollspeed: 80,
mousescrollstep: 40,
autohidemode: 'cursor',
railpadding: {right: 5}
});
},
// https://highlightjs.org/
syntaxHighlighter = function () {
hljs.initHighlightingOnLoad();
},
// abc javascripts initialization
init = function () {
mainMenu();
$(document).foundation();
headerTitles();
niceSroll();
syntaxHighlighter();
};
return {
init: init
};
})(jQuery);
(function () {
abc.init();
})();