From 70db3ca0f0d28a975c7a1a65726e5f31392c6a40 Mon Sep 17 00:00:00 2001 From: Master Yoda Date: Mon, 21 Sep 2015 07:17:40 -0700 Subject: Fixed the pulldown nav Signed-off-by:Master Yoda --- .../_themes/sphinx_rtd_theme/static/js/theme.js | 202 ++++++++++++--------- 1 file changed, 117 insertions(+), 85 deletions(-) (limited to 'user_guide_src/source/_themes/sphinx_rtd_theme/static/js/theme.js') diff --git a/user_guide_src/source/_themes/sphinx_rtd_theme/static/js/theme.js b/user_guide_src/source/_themes/sphinx_rtd_theme/static/js/theme.js index 66edf2fa2..8aee6ca29 100644 --- a/user_guide_src/source/_themes/sphinx_rtd_theme/static/js/theme.js +++ b/user_guide_src/source/_themes/sphinx_rtd_theme/static/js/theme.js @@ -1,84 +1,116 @@ -$( document ).ready(function() { +$(document).ready(function () { // Shift nav in mobile when clicking the menu. - $(document).on('click', "[data-toggle='wy-nav-top']", function() { - $("[data-toggle='wy-nav-shift']").toggleClass("shift"); - $("[data-toggle='rst-versions']").toggleClass("shift"); + $(document).on('click', "[data-toggle='wy-nav-top']", function () { + $("[data-toggle='wy-nav-shift']").toggleClass("shift"); + $("[data-toggle='rst-versions']").toggleClass("shift"); }); // Close menu when you click a link. - $(document).on('click', ".wy-menu-vertical .current ul li a", function() { - $("[data-toggle='wy-nav-shift']").removeClass("shift"); - $("[data-toggle='rst-versions']").toggleClass("shift"); + $(document).on('click', ".wy-menu-vertical .current ul li a", function () { + $("[data-toggle='wy-nav-shift']").removeClass("shift"); + $("[data-toggle='rst-versions']").toggleClass("shift"); + }); + $(document).on('click', "[data-toggle='rst-current-version']", function () { + $("[data-toggle='rst-versions']").toggleClass("shift-up"); }); - $(document).on('click', "[data-toggle='rst-current-version']", function() { - $("[data-toggle='rst-versions']").toggleClass("shift-up"); - }); // Make tables responsive - $("table.docutils:not(.field-list)").wrap("
"); - // --- - // START DOC MODIFICATION BY RUFNEX - // v1.0 04.02.2015 - // Add ToogleButton to get FullWidth-View by Johannes Gamperl codeigniter.de - var ciNav = ''; - ciNav += '
'; - $('body').prepend(ciNav); - // - var a = ['Index', 'CodeIgniter User Guide¶', 'Change Log¶', 'Developer’s Certificate of Origin 1.1¶', 'The MIT License (MIT)¶']; - if ($.inArray($('h1').text(), a) > 0 || $('h2').text() == 'Search Results') - { - $('table.ciNav a').each(function(){ - $(this).attr('href', $(this).attr("href").replace('../', '')); - }); - console.log(1111); - } - // - $('#openToc').click(function(){ - $('#nav').slideToggle(); - }); - $('.wy-breadcrumbs').append('
toc
'); - $('#closeMe').toggle( - function() - { - setCookie('ciNav', true, 365); - $('#nav2').show(); - $('#topMenu').remove(); - $('body').css({ background:'none' }); - $('.wy-nav-content-wrap').css({ background:'none', 'margin-left':0 }); - $('.wy-breadcrumbs').append('
'+$('.wy-form').parent().html()+'
');$('.wy-nav-side').toggle(); - }, - function() - { - setCookie('ciNav', false, 365); - $('#topMenu').remove(); - $('#nav').hide(); - $('#nav2').hide(); - $('body').css({ background:'#edf0f2;' }); - $('.wy-nav-content-wrap').css({ background:'none repeat scroll 0 0 #fcfcfc;', 'margin-left':'300px' }); - $('.wy-nav-side').show(); - } - ); - if (getCookie('ciNav') == 'true') - { - $('#closeMe').trigger('click'); - //$('#nav').slideToggle(); - } - // END MODIFICATION --- + $("table.docutils:not(.field-list)").wrap("
"); + // --- + // START DOC MODIFICATION BY RUFNEX + // v1.0 04.02.2015 + // Add ToogleButton to get FullWidth-View by Johannes Gamperl codeigniter.de + // JLP - reformatted to make additions or corrections easier. Still hard-coded :(( + var ciNav = '\ +\ +
\ +'; + $('body').prepend(ciNav); + // + var a = ['Index', 'CodeIgniter User Guide¶', 'Change Log¶', 'Developer’s Certificate of Origin 1.1¶', 'The MIT License (MIT)¶']; + if ($.inArray($('h1').text(), a) > 0 || $('#search-results').length) + { + $('table.ciNav a').each(function () { + $(this).attr('href', $(this).attr("href").replace('../', '')); + }); + } + + // + $('#openToc').click(function () { + $('#nav').slideToggle(); + }); + $('.wy-breadcrumbs').append('
toc
'); + $('#closeMe').toggle( + function () + { + setCookie('ciNav', true, 365); + $('#nav2').show(); + $('#topMenu').remove(); + $('body').css({background: 'none'}); + $('.wy-nav-content-wrap').css({background: 'none', 'margin-left': 0}); + $('.wy-breadcrumbs').append('
' + $('.wy-form').parent().html() + '
'); + $('.wy-nav-side').toggle(); + }, + function () + { + setCookie('ciNav', false, 365); + $('#topMenu').remove(); + $('#nav').hide(); + $('#nav2').hide(); + $('body').css({background: '#edf0f2;'}); + $('.wy-nav-content-wrap').css({background: 'none repeat scroll 0 0 #fcfcfc;', 'margin-left': '300px'}); + $('.wy-nav-side').show(); + } + ); + if (getCookie('ciNav') == 'true') + { + $('#closeMe').trigger('click'); + //$('#nav').slideToggle(); + } + // END MODIFICATION --- }); // Rufnex Cookie functions -function setCookie(cname,cvalue,exdays) { +function setCookie(cname, cvalue, exdays) { var d = new Date(); - d.setTime(d.getTime() + (exdays*24*60*60*1000)); + d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000)); var expires = "expires=" + d.toGMTString(); - document.cookie = cname+"="+cvalue+"; "+expires; + document.cookie = cname + "=" + cvalue + "; " + expires; } function getCookie(cname) { var name = cname + "="; var ca = document.cookie.split(';'); - for(var i=0; i Date: Tue, 29 Sep 2015 17:42:29 -0700 Subject: refactor pulldown menu generation using sphinx toctree Signed-off-by: Hongyi Zhang --- .../_themes/sphinx_rtd_theme/static/js/theme.js | 90 ++++++---------------- 1 file changed, 22 insertions(+), 68 deletions(-) (limited to 'user_guide_src/source/_themes/sphinx_rtd_theme/static/js/theme.js') diff --git a/user_guide_src/source/_themes/sphinx_rtd_theme/static/js/theme.js b/user_guide_src/source/_themes/sphinx_rtd_theme/static/js/theme.js index 8aee6ca29..267d87c6e 100644 --- a/user_guide_src/source/_themes/sphinx_rtd_theme/static/js/theme.js +++ b/user_guide_src/source/_themes/sphinx_rtd_theme/static/js/theme.js @@ -12,89 +12,43 @@ $(document).ready(function () { $(document).on('click', "[data-toggle='rst-current-version']", function () { $("[data-toggle='rst-versions']").toggleClass("shift-up"); }); - // Make tables responsive - $("table.docutils:not(.field-list)").wrap("
"); + // // Make tables responsive + // $("table.docutils:not(.field-list)").wrap("
"); // --- // START DOC MODIFICATION BY RUFNEX // v1.0 04.02.2015 // Add ToogleButton to get FullWidth-View by Johannes Gamperl codeigniter.de - // JLP - reformatted to make additions or corrections easier. Still hard-coded :(( - var ciNav = '\ -\ -
\ -'; - $('body').prepend(ciNav); - // - var a = ['Index', 'CodeIgniter User Guide¶', 'Change Log¶', 'Developer’s Certificate of Origin 1.1¶', 'The MIT License (MIT)¶']; - if ($.inArray($('h1').text(), a) > 0 || $('#search-results').length) - { - $('table.ciNav a').each(function () { - $(this).attr('href', $(this).attr("href").replace('../', '')); - }); - } - // $('#openToc').click(function () { $('#nav').slideToggle(); }); - $('.wy-breadcrumbs').append('
toc
'); $('#closeMe').toggle( - function () - { - setCookie('ciNav', true, 365); - $('#nav2').show(); - $('#topMenu').remove(); - $('body').css({background: 'none'}); - $('.wy-nav-content-wrap').css({background: 'none', 'margin-left': 0}); - $('.wy-breadcrumbs').append('
' + $('.wy-form').parent().html() + '
'); - $('.wy-nav-side').toggle(); - }, - function () - { - setCookie('ciNav', false, 365); - $('#topMenu').remove(); - $('#nav').hide(); - $('#nav2').hide(); - $('body').css({background: '#edf0f2;'}); - $('.wy-nav-content-wrap').css({background: 'none repeat scroll 0 0 #fcfcfc;', 'margin-left': '300px'}); - $('.wy-nav-side').show(); - } + function () + { + setCookie('ciNav', true, 365); + $('#nav2').show(); + $('#topMenu').remove(); + $('body').css({background: 'none'}); + $('.wy-nav-content-wrap').css({background: 'none', 'margin-left': 0}); + $('.wy-breadcrumbs').append('
' + $('.wy-form').parent().html() + '
'); + $('.wy-nav-side').toggle(); + }, + function () + { + setCookie('ciNav', false, 365); + $('#topMenu').remove(); + $('#nav').hide(); + $('#nav2').hide(); + $('body').css({background: '#edf0f2;'}); + $('.wy-nav-content-wrap').css({background: 'none repeat scroll 0 0 #fcfcfc;', 'margin-left': '300px'}); + $('.wy-nav-side').show(); + } ); if (getCookie('ciNav') == 'true') { $('#closeMe').trigger('click'); //$('#nav').slideToggle(); } - // END MODIFICATION --- }); // Rufnex Cookie functions -- cgit v1.2.3-24-g4f1b From b881ba33067000117f50ede4a9b76aaef99a3605 Mon Sep 17 00:00:00 2001 From: Hongyi Zhang Date: Tue, 29 Sep 2015 17:46:48 -0700 Subject: add end modification message back Signed-off-by: Hongyi Zhang --- user_guide_src/source/_themes/sphinx_rtd_theme/static/js/theme.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'user_guide_src/source/_themes/sphinx_rtd_theme/static/js/theme.js') diff --git a/user_guide_src/source/_themes/sphinx_rtd_theme/static/js/theme.js b/user_guide_src/source/_themes/sphinx_rtd_theme/static/js/theme.js index 267d87c6e..f7ea328bf 100644 --- a/user_guide_src/source/_themes/sphinx_rtd_theme/static/js/theme.js +++ b/user_guide_src/source/_themes/sphinx_rtd_theme/static/js/theme.js @@ -49,6 +49,8 @@ $(document).ready(function () { $('#closeMe').trigger('click'); //$('#nav').slideToggle(); } + // END MODIFICATION --- + }); // Rufnex Cookie functions -- cgit v1.2.3-24-g4f1b From ce5734911bcfe31e0a56d6e38f625d81ceb9c1b6 Mon Sep 17 00:00:00 2001 From: Hongyi Zhang Date: Thu, 1 Oct 2015 15:00:58 -0700 Subject: Fix indentations Signed-off-by: Hongyi Zhang --- user_guide_src/source/_themes/sphinx_rtd_theme/static/js/theme.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'user_guide_src/source/_themes/sphinx_rtd_theme/static/js/theme.js') diff --git a/user_guide_src/source/_themes/sphinx_rtd_theme/static/js/theme.js b/user_guide_src/source/_themes/sphinx_rtd_theme/static/js/theme.js index f7ea328bf..17ded53f1 100644 --- a/user_guide_src/source/_themes/sphinx_rtd_theme/static/js/theme.js +++ b/user_guide_src/source/_themes/sphinx_rtd_theme/static/js/theme.js @@ -49,8 +49,7 @@ $(document).ready(function () { $('#closeMe').trigger('click'); //$('#nav').slideToggle(); } - // END MODIFICATION --- - + // END MODIFICATION --- }); // Rufnex Cookie functions -- cgit v1.2.3-24-g4f1b From e8ea8ec857425575b7c3c7dfdce76c693d7f5b5c Mon Sep 17 00:00:00 2001 From: Hongyi Zhang Date: Thu, 1 Oct 2015 15:26:42 -0700 Subject: minor fixes: add back theme codes Signed-off-by: Hongyi Zhang --- user_guide_src/source/_themes/sphinx_rtd_theme/static/js/theme.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'user_guide_src/source/_themes/sphinx_rtd_theme/static/js/theme.js') diff --git a/user_guide_src/source/_themes/sphinx_rtd_theme/static/js/theme.js b/user_guide_src/source/_themes/sphinx_rtd_theme/static/js/theme.js index 17ded53f1..b77789d06 100644 --- a/user_guide_src/source/_themes/sphinx_rtd_theme/static/js/theme.js +++ b/user_guide_src/source/_themes/sphinx_rtd_theme/static/js/theme.js @@ -12,8 +12,8 @@ $(document).ready(function () { $(document).on('click', "[data-toggle='rst-current-version']", function () { $("[data-toggle='rst-versions']").toggleClass("shift-up"); }); - // // Make tables responsive - // $("table.docutils:not(.field-list)").wrap("
"); + // Make tables responsive + $("table.docutils:not(.field-list)").wrap("
"); // --- // START DOC MODIFICATION BY RUFNEX // v1.0 04.02.2015 -- cgit v1.2.3-24-g4f1b From 89c7123621f22533e1777796237a9b06bd190976 Mon Sep 17 00:00:00 2001 From: Hongyi Zhang Date: Fri, 16 Oct 2015 00:57:08 -0700 Subject: revert img alt changes, fix cookies, and improve pulldown menu in multiple screen size Signed-off-by: Hongyi Zhang --- .../_themes/sphinx_rtd_theme/static/js/theme.js | 32 ++++++++++++++++++++-- 1 file changed, 29 insertions(+), 3 deletions(-) (limited to 'user_guide_src/source/_themes/sphinx_rtd_theme/static/js/theme.js') diff --git a/user_guide_src/source/_themes/sphinx_rtd_theme/static/js/theme.js b/user_guide_src/source/_themes/sphinx_rtd_theme/static/js/theme.js index b77789d06..52580a056 100644 --- a/user_guide_src/source/_themes/sphinx_rtd_theme/static/js/theme.js +++ b/user_guide_src/source/_themes/sphinx_rtd_theme/static/js/theme.js @@ -25,7 +25,7 @@ $(document).ready(function () { $('#closeMe').toggle( function () { - setCookie('ciNav', true, 365); + setCookie('ciNav', 'true', 365); $('#nav2').show(); $('#topMenu').remove(); $('body').css({background: 'none'}); @@ -35,7 +35,7 @@ $(document).ready(function () { }, function () { - setCookie('ciNav', false, 365); + setCookie('ciNav', 'false', 365); $('#topMenu').remove(); $('#nav').hide(); $('#nav2').hide(); @@ -50,14 +50,19 @@ $(document).ready(function () { //$('#nav').slideToggle(); } // END MODIFICATION --- + }); // Rufnex Cookie functions function setCookie(cname, cvalue, exdays) { + // expire the old cookie if existed to avoid multiple cookies with the same name + if (getCookie(cname) != false) { + document.cookie = cname + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT"; + } var d = new Date(); d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000)); var expires = "expires=" + d.toGMTString(); - document.cookie = cname + "=" + cvalue + "; " + expires; + document.cookie = cname + "=" + cvalue + "; " + expires + "; path=/"; } function getCookie(cname) { var name = cname + "="; @@ -74,6 +79,27 @@ function getCookie(cname) { } // End +// resize window +$(window).on('resize', function(){ + // show side nav on small screens when pulldown is enabled + if (getCookie('ciNav') == 'true' && $(window).width() <= 768) { // 768px is the tablet size defined by the theme + $('.wy-nav-side').show(); + } + // changing css with jQuenry seems to override the default css media query + // change margin + else if (getCookie('ciNav') == 'false' && $(window).width() <= 768) { + $('.wy-nav-content-wrap').css({'margin-left': 0}); + } + // hide side nav on large screens when pulldown is enabled + else if (getCookie('ciNav') == 'true' && $(window).width() > 768) { + $('.wy-nav-side').hide(); + } + // change margin + else if (getCookie('ciNav') == 'false' && $(window).width() > 768) { + $('.wy-nav-content-wrap').css({'margin-left': '300px'}); + } +}); + window.SphinxRtdTheme = (function (jquery) { var stickyNav = (function () { var navBar, -- cgit v1.2.3-24-g4f1b From af042458194867ce9a9304eae2c261c14676b83a Mon Sep 17 00:00:00 2001 From: Hongyi Zhang Date: Fri, 16 Oct 2015 01:47:04 -0700 Subject: fix a typo in comment Signed-off-by: Hongyi Zhang --- user_guide_src/source/_themes/sphinx_rtd_theme/static/js/theme.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'user_guide_src/source/_themes/sphinx_rtd_theme/static/js/theme.js') diff --git a/user_guide_src/source/_themes/sphinx_rtd_theme/static/js/theme.js b/user_guide_src/source/_themes/sphinx_rtd_theme/static/js/theme.js index 52580a056..bc996b710 100644 --- a/user_guide_src/source/_themes/sphinx_rtd_theme/static/js/theme.js +++ b/user_guide_src/source/_themes/sphinx_rtd_theme/static/js/theme.js @@ -85,7 +85,7 @@ $(window).on('resize', function(){ if (getCookie('ciNav') == 'true' && $(window).width() <= 768) { // 768px is the tablet size defined by the theme $('.wy-nav-side').show(); } - // changing css with jQuenry seems to override the default css media query + // changing css with jquery seems to override the default css media query // change margin else if (getCookie('ciNav') == 'false' && $(window).width() <= 768) { $('.wy-nav-content-wrap').css({'margin-left': 0}); -- cgit v1.2.3-24-g4f1b From 99c8ff3d03a95b1e8f589ecfc9de925d5fecedac Mon Sep 17 00:00:00 2001 From: Hongyi Zhang Date: Mon, 19 Oct 2015 12:54:17 -0700 Subject: rename cookie values to make codes clear Signed-off-by: Hongyi Zhang --- .../source/_themes/sphinx_rtd_theme/static/js/theme.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'user_guide_src/source/_themes/sphinx_rtd_theme/static/js/theme.js') diff --git a/user_guide_src/source/_themes/sphinx_rtd_theme/static/js/theme.js b/user_guide_src/source/_themes/sphinx_rtd_theme/static/js/theme.js index bc996b710..081d77bdf 100644 --- a/user_guide_src/source/_themes/sphinx_rtd_theme/static/js/theme.js +++ b/user_guide_src/source/_themes/sphinx_rtd_theme/static/js/theme.js @@ -25,7 +25,7 @@ $(document).ready(function () { $('#closeMe').toggle( function () { - setCookie('ciNav', 'true', 365); + setCookie('ciNav', 'yes', 365); $('#nav2').show(); $('#topMenu').remove(); $('body').css({background: 'none'}); @@ -35,7 +35,7 @@ $(document).ready(function () { }, function () { - setCookie('ciNav', 'false', 365); + setCookie('ciNav', 'no', 365); $('#topMenu').remove(); $('#nav').hide(); $('#nav2').hide(); @@ -44,7 +44,7 @@ $(document).ready(function () { $('.wy-nav-side').show(); } ); - if (getCookie('ciNav') == 'true') + if (getCookie('ciNav') == 'yes') { $('#closeMe').trigger('click'); //$('#nav').slideToggle(); @@ -56,7 +56,7 @@ $(document).ready(function () { // Rufnex Cookie functions function setCookie(cname, cvalue, exdays) { // expire the old cookie if existed to avoid multiple cookies with the same name - if (getCookie(cname) != false) { + if (getCookie(cname)) { document.cookie = cname + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT"; } var d = new Date(); @@ -75,27 +75,27 @@ function getCookie(cname) { return c.substring(name.length, c.length); } } - return false; + return ''; } // End // resize window $(window).on('resize', function(){ // show side nav on small screens when pulldown is enabled - if (getCookie('ciNav') == 'true' && $(window).width() <= 768) { // 768px is the tablet size defined by the theme + if (getCookie('ciNav') == 'yes' && $(window).width() <= 768) { // 768px is the tablet size defined by the theme $('.wy-nav-side').show(); } // changing css with jquery seems to override the default css media query // change margin - else if (getCookie('ciNav') == 'false' && $(window).width() <= 768) { + else if (getCookie('ciNav') == 'no' && $(window).width() <= 768) { $('.wy-nav-content-wrap').css({'margin-left': 0}); } // hide side nav on large screens when pulldown is enabled - else if (getCookie('ciNav') == 'true' && $(window).width() > 768) { + else if (getCookie('ciNav') == 'yes' && $(window).width() > 768) { $('.wy-nav-side').hide(); } // change margin - else if (getCookie('ciNav') == 'false' && $(window).width() > 768) { + else if (getCookie('ciNav') == 'no' && $(window).width() > 768) { $('.wy-nav-content-wrap').css({'margin-left': '300px'}); } }); -- cgit v1.2.3-24-g4f1b