aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorHeinrich Fenkart <[email protected]>2014-06-27 02:08:58 +0200
committerHeinrich Fenkart <[email protected]>2014-06-27 02:08:58 +0200
commit92ca842830477c35d4449477c4b51afe08d55521 (patch)
treee438b1938507e3651b28fd398122766fb3ac0bec /docs
parent2b6f00c2a7f255fbc250a10ec16cb3071cadc32e (diff)
downloadbootstrap-92ca842830477c35d4449477c4b51afe08d55521.tar.xz
bootstrap-92ca842830477c35d4449477c4b51afe08d55521.zip
Save "Preview theme" state; resolves #13940
Diffstat (limited to 'docs')
-rw-r--r--docs/assets/js/_src/application.js22
1 files changed, 15 insertions, 7 deletions
diff --git a/docs/assets/js/_src/application.js b/docs/assets/js/_src/application.js
index 62823baf1..792fc9779 100644
--- a/docs/assets/js/_src/application.js
+++ b/docs/assets/js/_src/application.js
@@ -27,13 +27,11 @@
$body.scrollspy('refresh')
})
-
// Kill links
$('.bs-docs-container [href=#]').click(function (e) {
e.preventDefault()
})
-
// Sidenav affixing
setTimeout(function () {
var $sideBar = $('.bs-docs-sidebar')
@@ -62,15 +60,25 @@
;(function () {
var stylesheetLink = $('#bs-theme-stylesheet')
var themeBtn = $('.bs-docs-theme-toggle')
+
+ var activateTheme = function () {
+ stylesheetLink.attr('href', stylesheetLink.attr('data-href'))
+ themeBtn.text('Disable theme preview')
+ localStorage.setItem('previewTheme', true)
+ }
+
+ if (localStorage.getItem('previewTheme')) {
+ activateTheme()
+ }
+
themeBtn.click(function () {
- var href = stylesheetLink.attr('href');
+ var href = stylesheetLink.attr('href')
if (!href || href.indexOf('data') === 0) {
- stylesheetLink.attr('href', stylesheetLink.attr('data-href'))
- themeBtn.text('Disable theme preview')
- }
- else {
+ activateTheme()
+ } else {
stylesheetLink.attr('href', '')
themeBtn.text('Preview theme')
+ localStorage.removeItem('previewTheme')
}
})
})();