Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Bootstrap
bootstrap
Commits
018114fc
Commit
018114fc
authored
10 years ago
by
Mark Otto
Browse files
Options
Download
Plain Diff
Merge pull request #13954 from hnrch02/persist-preview-theme
Save "Preview theme" state; resolves
#13940
parents
51f924ea
92ca8428
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
docs/assets/js/_src/application.js
+15
-7
docs/assets/js/_src/application.js
with
15 additions
and
7 deletions
+15
-7
docs/assets/js/_src/application.js
+
15
-
7
View file @
018114fc
...
@@ -27,13 +27,11 @@
...
@@ -27,13 +27,11 @@
$body
.
scrollspy
(
'
refresh
'
)
$body
.
scrollspy
(
'
refresh
'
)
})
})
// Kill links
// Kill links
$
(
'
.bs-docs-container [href=#]
'
).
click
(
function
(
e
)
{
$
(
'
.bs-docs-container [href=#]
'
).
click
(
function
(
e
)
{
e
.
preventDefault
()
e
.
preventDefault
()
})
})
// Sidenav affixing
// Sidenav affixing
setTimeout
(
function
()
{
setTimeout
(
function
()
{
var
$sideBar
=
$
(
'
.bs-docs-sidebar
'
)
var
$sideBar
=
$
(
'
.bs-docs-sidebar
'
)
...
@@ -62,15 +60,25 @@
...
@@ -62,15 +60,25 @@
;(
function
()
{
;(
function
()
{
var
stylesheetLink
=
$
(
'
#bs-theme-stylesheet
'
)
var
stylesheetLink
=
$
(
'
#bs-theme-stylesheet
'
)
var
themeBtn
=
$
(
'
.bs-docs-theme-toggle
'
)
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
()
{
themeBtn
.
click
(
function
()
{
var
href
=
stylesheetLink
.
attr
(
'
href
'
)
;
var
href
=
stylesheetLink
.
attr
(
'
href
'
)
if
(
!
href
||
href
.
indexOf
(
'
data
'
)
===
0
)
{
if
(
!
href
||
href
.
indexOf
(
'
data
'
)
===
0
)
{
stylesheetLink
.
attr
(
'
href
'
,
stylesheetLink
.
attr
(
'
data-href
'
))
activateTheme
()
themeBtn
.
text
(
'
Disable theme preview
'
)
}
else
{
}
else
{
stylesheetLink
.
attr
(
'
href
'
,
''
)
stylesheetLink
.
attr
(
'
href
'
,
''
)
themeBtn
.
text
(
'
Preview theme
'
)
themeBtn
.
text
(
'
Preview theme
'
)
localStorage
.
removeItem
(
'
previewTheme
'
)
}
}
})
})
})();
})();
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment