From c25d56f3065dd2dbe7169e1d71cfef004b997e92 Mon Sep 17 00:00:00 2001 From: Master Yoda Date: Mon, 21 Sep 2015 07:17:40 -0700 Subject: [ci skip] Cherry-pick docs pulldown nav fix from develop --- .../_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') 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