Add Support for Hiding Code Blocks at UI level. Set Overflow of Left-Column to Hidden to remove unnecessary Scrollbar.
This commit is contained in:
45
js/custom.js
45
js/custom.js
@ -19,4 +19,47 @@ $(function() {
|
||||
if ($(window).width() >= 768)
|
||||
$('#sub-nav-collapse').removeAttr('style');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
//Toggle Code Block Visibility
|
||||
function toggleCodeBlocks() {
|
||||
var t = localStorage.getItem("toggleCodeStats")
|
||||
t = (t + 1) % 3;
|
||||
localStorage.setItem("toggleCodeStats", t);
|
||||
var a = $('.content-page article');
|
||||
var b = a.children();
|
||||
var c = b.filter('pre');
|
||||
var d = $('.right-column');
|
||||
if (d.hasClass('float-view')) {
|
||||
d.removeClass('float-view');
|
||||
$('#toggleCodeBlockBtn')[0].innerHTML = "Hide Code Blocks";
|
||||
} else {
|
||||
if (a.hasClass('hideCode')) {
|
||||
d.addClass('float-view');
|
||||
a.removeClass('hideCode');
|
||||
b.removeClass('hideCode2');
|
||||
c.removeClass('hideCode3');
|
||||
$('#toggleCodeBlockBtn')[0].innerHTML = "Show Code Blocks Inline";
|
||||
} else {
|
||||
a.addClass('hideCode');
|
||||
b.addClass('hideCode2');
|
||||
c.addClass('hideCode3');
|
||||
$('#toggleCodeBlockBtn')[0].innerHTML = "Show Code Blocks";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (localStorage.getItem("toggleCodeStats") >= 0) {
|
||||
var t = localStorage.getItem("toggleCodeStats");
|
||||
if (t == 1) {
|
||||
toggleCodeBlocks();
|
||||
localStorage.setItem("toggleCodeStats", 1);
|
||||
}
|
||||
if (t == 2) {
|
||||
toggleCodeBlocks();
|
||||
toggleCodeBlocks();
|
||||
localStorage.setItem("toggleCodeStats", 2);
|
||||
}
|
||||
} else {
|
||||
localStorage.setItem("toggleCodeStats", 0);
|
||||
}
|
Reference in New Issue
Block a user