Skip to content

Commit 99c8ff3

Browse files
committed
rename cookie values to make codes clear
Signed-off-by: Hongyi Zhang <hongyi73.zhang@gmail.com>
1 parent af04245 commit 99c8ff3

File tree

1 file changed

+9
-9
lines changed
  • user_guide_src/source/_themes/sphinx_rtd_theme/static/js

1 file changed

+9
-9
lines changed

user_guide_src/source/_themes/sphinx_rtd_theme/static/js/theme.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ $(document).ready(function () {
2525
$('#closeMe').toggle(
2626
function ()
2727
{
28-
setCookie('ciNav', 'true', 365);
28+
setCookie('ciNav', 'yes', 365);
2929
$('#nav2').show();
3030
$('#topMenu').remove();
3131
$('body').css({background: 'none'});
@@ -35,7 +35,7 @@ $(document).ready(function () {
3535
},
3636
function ()
3737
{
38-
setCookie('ciNav', 'false', 365);
38+
setCookie('ciNav', 'no', 365);
3939
$('#topMenu').remove();
4040
$('#nav').hide();
4141
$('#nav2').hide();
@@ -44,7 +44,7 @@ $(document).ready(function () {
4444
$('.wy-nav-side').show();
4545
}
4646
);
47-
if (getCookie('ciNav') == 'true')
47+
if (getCookie('ciNav') == 'yes')
4848
{
4949
$('#closeMe').trigger('click');
5050
//$('#nav').slideToggle();
@@ -56,7 +56,7 @@ $(document).ready(function () {
5656
// Rufnex Cookie functions
5757
function setCookie(cname, cvalue, exdays) {
5858
// expire the old cookie if existed to avoid multiple cookies with the same name
59-
if (getCookie(cname) != false) {
59+
if (getCookie(cname)) {
6060
document.cookie = cname + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT";
6161
}
6262
var d = new Date();
@@ -75,27 +75,27 @@ function getCookie(cname) {
7575
return c.substring(name.length, c.length);
7676
}
7777
}
78-
return false;
78+
return '';
7979
}
8080
// End
8181

8282
// resize window
8383
$(window).on('resize', function(){
8484
// show side nav on small screens when pulldown is enabled
85-
if (getCookie('ciNav') == 'true' && $(window).width() <= 768) { // 768px is the tablet size defined by the theme
85+
if (getCookie('ciNav') == 'yes' && $(window).width() <= 768) { // 768px is the tablet size defined by the theme
8686
$('.wy-nav-side').show();
8787
}
8888
// changing css with jquery seems to override the default css media query
8989
// change margin
90-
else if (getCookie('ciNav') == 'false' && $(window).width() <= 768) {
90+
else if (getCookie('ciNav') == 'no' && $(window).width() <= 768) {
9191
$('.wy-nav-content-wrap').css({'margin-left': 0});
9292
}
9393
// hide side nav on large screens when pulldown is enabled
94-
else if (getCookie('ciNav') == 'true' && $(window).width() > 768) {
94+
else if (getCookie('ciNav') == 'yes' && $(window).width() > 768) {
9595
$('.wy-nav-side').hide();
9696
}
9797
// change margin
98-
else if (getCookie('ciNav') == 'false' && $(window).width() > 768) {
98+
else if (getCookie('ciNav') == 'no' && $(window).width() > 768) {
9999
$('.wy-nav-content-wrap').css({'margin-left': '300px'});
100100
}
101101
});

0 commit comments

Comments
 (0)