mirror of
https://code.mensbeam.com/MensBeam/Arsse.git
synced 2024-12-22 21:22:40 +00:00
Fix JS bug in Daux
See https://github.com/dauxio/daux.io/pull/122 for patch to upstream
This commit is contained in:
parent
440ea11e27
commit
294f3648a2
1 changed files with 11 additions and 3 deletions
10
docs/theme/arsse/daux.js
vendored
10
docs/theme/arsse/daux.js
vendored
|
@ -22,7 +22,11 @@ $(function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
function setCodeBlockStyle(codeBlockState) {
|
function setCodeBlockStyle(codeBlockState) {
|
||||||
|
try {
|
||||||
localStorage.setItem("codeBlockState", codeBlockState);
|
localStorage.setItem("codeBlockState", codeBlockState);
|
||||||
|
} catch (e) {
|
||||||
|
// local storage operations can fail with the file:// protocol
|
||||||
|
}
|
||||||
|
|
||||||
toggleCodeBlockBtns.removeClass("Button--active");
|
toggleCodeBlockBtns.removeClass("Button--active");
|
||||||
|
|
||||||
|
@ -60,7 +64,12 @@ $(function () {
|
||||||
toggleCodeBlockBtnFloat.click(function() { setCodeBlockStyle(2); });
|
toggleCodeBlockBtnFloat.click(function() { setCodeBlockStyle(2); });
|
||||||
|
|
||||||
var floating = $(document.body).hasClass("with-float");
|
var floating = $(document.body).hasClass("with-float");
|
||||||
|
try {
|
||||||
var codeBlockState = localStorage.getItem("codeBlockState");
|
var codeBlockState = localStorage.getItem("codeBlockState");
|
||||||
|
} catch (e) {
|
||||||
|
// local storage operations can fail with the file:// protocol
|
||||||
|
var codeBlockState = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!codeBlockState) {
|
if (!codeBlockState) {
|
||||||
codeBlockState = floating? 2 : 1;
|
codeBlockState = floating? 2 : 1;
|
||||||
|
@ -95,4 +104,3 @@ $(function () {
|
||||||
$('.Collapsible__content').slideToggle();
|
$('.Collapsible__content').slideToggle();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue