Clean up custom.js, rename to daux.js
This commit is contained in:
parent
848e68ea55
commit
0298b7bf91
@ -1,26 +1,48 @@
|
||||
$(function () {
|
||||
$('.aj-nav').click(function (e) {
|
||||
e.preventDefault();
|
||||
$(this).parent().siblings().find('ul').slideUp();
|
||||
$(this).next().slideToggle();
|
||||
});
|
||||
|
||||
$('table').addClass('table');
|
||||
$('#menu-spinner-button').click(function () {
|
||||
$('#sub-nav-collapse').slideToggle();
|
||||
});
|
||||
_ = {};
|
||||
|
||||
$(window).resize(function () {
|
||||
// Remove transition inline style on large screens
|
||||
if ($(window).width() >= 768)
|
||||
$('#sub-nav-collapse').removeAttr('style');
|
||||
});
|
||||
});
|
||||
_.now = Date.now || function() {
|
||||
return new Date().getTime();
|
||||
};
|
||||
|
||||
//Fix GitHub Ribbon overlapping Scrollbar
|
||||
var t = $('#github-ribbon');
|
||||
var a = $('article');
|
||||
if (t[0] && a[0] && a[0].scrollHeight > $('.right-column').height()) t[0].style.right = '16px';
|
||||
_.debounce = function(func, wait, immediate) {
|
||||
var timeout, args, context, timestamp, result;
|
||||
|
||||
var later = function() {
|
||||
var last = _.now() - timestamp;
|
||||
|
||||
if (last < wait && last >= 0) {
|
||||
timeout = setTimeout(later, wait - last);
|
||||
} else {
|
||||
timeout = null;
|
||||
if (!immediate) {
|
||||
result = func.apply(context, args);
|
||||
if (!timeout) context = args = null;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return function() {
|
||||
context = this;
|
||||
args = arguments;
|
||||
timestamp = _.now();
|
||||
var callNow = immediate && !timeout;
|
||||
if (!timeout) timeout = setTimeout(later, wait);
|
||||
if (callNow) {
|
||||
result = func.apply(context, args);
|
||||
context = args = null;
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
};
|
||||
|
||||
var codeBlocks, codeBlockView, toggleCodeBlockBtn, codeBlockState;
|
||||
function toggleCodeBlocks() {
|
||||
codeBlockState = (codeBlockState + 1) % 3;
|
||||
localStorage.setItem("codeBlockState", codeBlockState);
|
||||
setCodeBlockStyle(codeBlockState);
|
||||
}
|
||||
|
||||
function setCodeBlockStyle(x) {
|
||||
switch (x) {
|
||||
@ -43,14 +65,34 @@ function setCodeBlockStyle(x) {
|
||||
}
|
||||
}
|
||||
|
||||
function toggleCodeBlocks() {
|
||||
codeBlockState = (codeBlockState + 1) % 3;
|
||||
localStorage.setItem("codeBlockState", codeBlockState);
|
||||
setCodeBlockStyle(codeBlockState);
|
||||
$(function () {
|
||||
// Tree navigation
|
||||
$('.aj-nav').click(function (e) {
|
||||
e.preventDefault();
|
||||
$(this).parent().siblings().find('ul').slideUp();
|
||||
$(this).next().slideToggle();
|
||||
});
|
||||
|
||||
// Responsive navigation
|
||||
$('#menu-spinner-button').click(function () {
|
||||
$('#sub-nav-collapse').slideToggle();
|
||||
});
|
||||
|
||||
//Github ribbon placement
|
||||
var ribbon = $('#github-ribbon');
|
||||
function onResize() {
|
||||
//Fix GitHub Ribbon overlapping Scrollbar
|
||||
var a = $('article');
|
||||
if (ribbon[0] && a[0] && a[0].scrollHeight > $('.right-column').height()) {
|
||||
ribbon[0].style.right = '16px';
|
||||
} else {
|
||||
ribbon[0].style.right = '';
|
||||
}
|
||||
}
|
||||
$(window).resize(_.debounce(onResize, 100));
|
||||
onResize();
|
||||
|
||||
//Initialize CodeBlock Visibility Settings
|
||||
$(function () {
|
||||
toggleCodeBlockBtn = $('#toggleCodeBlockBtn')[0];
|
||||
codeBlockView = $('.right-column');
|
||||
codeBlocks = $('.content-page article > pre');
|
@ -56,6 +56,6 @@
|
||||
echo '<script src="' . $js . '"></script>';
|
||||
} ?>
|
||||
|
||||
<script src="<?= $base_url; ?>resources/js/custom.js"></script>
|
||||
<script src="<?= $base_url; ?>resources/js/daux.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
Reference in New Issue
Block a user