Fix float behaviour fixes #246
This commit is contained in:
parent
abfc3fa597
commit
edb670ba3e
@ -27,7 +27,7 @@
|
|||||||
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||||
<![endif]-->
|
<![endif]-->
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body class="<?= $params['html']['float'] ? 'with-float' : ''; ?>">
|
||||||
<?= $this->section('content'); ?>
|
<?= $this->section('content'); ?>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
@ -39,7 +39,8 @@ _.debounce = function(func, wait, immediate) {
|
|||||||
|
|
||||||
var codeBlocks, codeBlockView, toggleCodeBlockBtn, codeBlockState;
|
var codeBlocks, codeBlockView, toggleCodeBlockBtn, codeBlockState;
|
||||||
function toggleCodeBlocks() {
|
function toggleCodeBlocks() {
|
||||||
codeBlockState = (codeBlockState + 1) % 3;
|
var hasFloat = $(document.body).hasClass("with-float")? 3 : 2;
|
||||||
|
codeBlockState = (codeBlockState + 1) % hasFloat;
|
||||||
localStorage.setItem("codeBlockState", codeBlockState);
|
localStorage.setItem("codeBlockState", codeBlockState);
|
||||||
setCodeBlockStyle(codeBlockState);
|
setCodeBlockStyle(codeBlockState);
|
||||||
}
|
}
|
||||||
@ -48,23 +49,47 @@ function setCodeBlockStyle(x) {
|
|||||||
switch (x) {
|
switch (x) {
|
||||||
default:
|
default:
|
||||||
case 0:
|
case 0:
|
||||||
toggleCodeBlockBtn.innerHTML = "Show Code Blocks Inline";
|
toggleCodeBlockBtn.html("Show Code Blocks");
|
||||||
codeBlockView.addClass('float-view');
|
codeBlockView.removeClass('float-view');
|
||||||
codeBlocks.removeClass('hidden');
|
codeBlocks.addClass('hidden');
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
toggleCodeBlockBtn.innerHTML = "Hide Code Blocks";
|
toggleCodeBlockBtn.html("Hide Code Blocks");
|
||||||
codeBlockView.removeClass('float-view');
|
codeBlockView.removeClass('float-view');
|
||||||
codeBlocks.removeClass('hidden');
|
codeBlocks.removeClass('hidden');
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
toggleCodeBlockBtn.innerHTML = "Show Code Blocks";
|
toggleCodeBlockBtn.html("Show Code Blocks Inline");
|
||||||
codeBlockView.removeClass('float-view');
|
codeBlockView.addClass('float-view');
|
||||||
codeBlocks.addClass('hidden');
|
codeBlocks.removeClass('hidden');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Initialize CodeBlock Visibility Settings
|
||||||
|
$(function () {
|
||||||
|
codeBlocks = $('.content-page article > pre');
|
||||||
|
toggleCodeBlockBtn = $('#toggleCodeBlockBtn');
|
||||||
|
|
||||||
|
// If there is no code block we hide the link
|
||||||
|
if (!codeBlocks.size()) {
|
||||||
|
toggleCodeBlockBtn.addClass('hidden');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
codeBlockView = $('.right-column');
|
||||||
|
if (!codeBlockView.size()) return;
|
||||||
|
|
||||||
|
codeBlockState = localStorage.getItem("codeBlockState");
|
||||||
|
if (!codeBlockState) {
|
||||||
|
codeBlockState = 2;
|
||||||
|
localStorage.setItem("codeBlockState", codeBlockState);
|
||||||
|
} else codeBlockState = parseInt(codeBlockState);
|
||||||
|
|
||||||
|
setCodeBlockStyle(codeBlockState);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
// Tree navigation
|
// Tree navigation
|
||||||
$('.aj-nav').click(function (e) {
|
$('.aj-nav').click(function (e) {
|
||||||
@ -91,20 +116,5 @@ $(function () {
|
|||||||
}
|
}
|
||||||
$(window).resize(_.debounce(onResize, 100));
|
$(window).resize(_.debounce(onResize, 100));
|
||||||
onResize();
|
onResize();
|
||||||
|
|
||||||
//Initialize CodeBlock Visibility Settings
|
|
||||||
toggleCodeBlockBtn = $('#toggleCodeBlockBtn')[0];
|
|
||||||
codeBlockView = $('.right-column');
|
|
||||||
codeBlocks = $('.content-page article > pre');
|
|
||||||
codeBlockState = localStorage.getItem("codeBlockState");
|
|
||||||
if (!codeBlockState) {
|
|
||||||
codeBlockState = 0;
|
|
||||||
localStorage.setItem("codeBlockState", codeBlockState);
|
|
||||||
} else codeBlockState = parseInt(codeBlockState);
|
|
||||||
if (!codeBlockView.size()) return;
|
|
||||||
if (!codeBlocks.size()) {
|
|
||||||
codeBlockState = 2;
|
|
||||||
toggleCodeBlockBtn.classList.add('hidden');
|
|
||||||
}
|
|
||||||
setCodeBlockStyle(codeBlockState);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user