diff --git a/_includes/sidebar.html b/_includes/sidebar.html index a4ca1ca781..62029be8dc 100644 --- a/_includes/sidebar.html +++ b/_includes/sidebar.html @@ -1,4 +1,4 @@ -{% if page.author_profile or layout.author_profile or page.sidebar %} + + +{% if page.sidebar %} + +
+ +{% endif %} \ No newline at end of file diff --git a/_sass/minimal-mistakes/_navigation.scss b/_sass/minimal-mistakes/_navigation.scss index 5d1c5615be..dd4787bca1 100644 --- a/_sass/minimal-mistakes/_navigation.scss +++ b/_sass/minimal-mistakes/_navigation.scss @@ -454,19 +454,36 @@ .nav__list .nav__items { margin: 0; - font-size: 1.25rem; + font-size: 1.4rem; a { color: inherit; + line-height: 1.6; } + // progress list, guide-specific + ol { + padding-left: 0.9rem; + } + + li { + list-style: inherit; + } + + .completed { + color: $gray; + text-decoration: line-through; + } + // end guide-specific + .active { - margin-left: -0.5em; - padding-left: 0.5em; - padding-right: 0.5em; + // margin-left: -0.5em; + // padding-left: 0.5em; + // padding-right: 0.5em; font-weight: bold; } + @include breakpoint(max-width $large - 1px) { position: relative; max-height: 0; diff --git a/assets/js/_main.js b/assets/js/_main.js index 0efc970269..04512374e2 100644 --- a/assets/js/_main.js +++ b/assets/js/_main.js @@ -3,6 +3,16 @@ ========================================================================== */ $(document).ready(function() { + + // external links should open in a new tab + var host = location.hostname + var allLinks = document.querySelectorAll('a') + for (var i = 0; i < allLinks.length; ++i) { + if (allLinks[i].hostname !== host && allLinks[i].hostname !== '') { + allLinks[i].target = '_blank' + } + } + // FitVids init $("#main").fitVids(); @@ -133,4 +143,173 @@ $(document).ready(function() { $(this).append(anchor); } }); + + // Custom sidebar, guide-specific + + if((window.location.href.indexOf("/he_IL/") > -1) || (window.location.href.indexOf("/ar_SA/") > -1)) { + $("body").css("direction", "rtl"); + + $("nav.greedy-nav .nav-selector").css("left", "2.5rem"); + $("nav.greedy-nav .lang-selector").css("left", ".2rem"); + + $("nav.greedy-nav .links-menu").css("right", "auto"); + $("nav.greedy-nav .lang-menu").css("right", "auto"); + + $("nav.greedy-nav .links-menu").css("left", "2.5rem"); + $("nav.greedy-nav .lang-menu").css("left", ".2rem"); + + $("nav.greedy-nav .visible-links").css("padding-right", "0"); + $("nav.greedy-nav .visible-links").css("padding-left", "2rem"); + + $("nav.greedy-nav .visible-links li:first-child a").css("margin-right", "0"); + $("nav.greedy-nav .visible-links li:first-child a").css("margin-left", "1rem"); + + $("nav.greedy-nav .visible-links li:first-child").css("padding-right", "0"); + $("nav.greedy-nav .visible-links li:first-child").css("padding-left", "2em"); + + $("nav.greedy-nav .visible-links li:last-child a").css("margin-right", "1rem"); + $("nav.greedy-nav .visible-links li:last-child a").css("margin-left", "0"); + + // for some reason js cannot directly modify :before and :after pseudo-elements' css + $('nav.greedy-nav').prepend(''); + $('nav.greedy-nav').prepend(''); + + $('nav.greedy-nav').prepend(''); + $('nav.greedy-nav').prepend(''); + } + + var sidebar_shown = true; + var sidebar_hidden_pages = ["404", "a9lh-to-b9s", "credits", "donations", "dumping-titles-and-game-cartridges", + "f3-(linux)", "f3xswift-(mac)", "faq", "file-extensions-(windows)", "get-started", + "godmode9-usage", "h2testw-(windows)", "region-changing", "site-navigation", "troubleshooting", + "uninstall-cfw","updating-b9s", "why-ads", "privacy-policy", "checking-for-cfw"]; + + for(var i = 0; i < sidebar_hidden_pages.length; i++){ + if(window.location.href.indexOf(sidebar_hidden_pages[i]) > -1) { + sidebar_shown = false; + } + } + + var devices = { + "get-started-(old-3ds)": "0", + "get-started-(new-3ds)": "1", + }; + + // The pages used to lookup which route to display + // parsed from the location of the url + // the value is the key to the displayed route in the device_common/old/new variable below + // + var methods = { + "installing-boot9strap-(2xrsa)": "0", + "installing-boot9strap-(mset)": "1", + "installing-boot9strap-(browser)": "2", + "homebrew-launcher-(soundhax)": "3", + "homebrew-launcher-(alternatives)": "4", + "installing-boot9strap-(soundhax)": "7", + "ntrboot": "8", + "flashing-ntrboot-(3ds-single-system)": "9", + "flashing-ntrboot-(3ds-multi-system)": "10", + "flashing-ntrboot-(dsi)": "11", + "flashing-ntrboot-(nds)": "12", + "installing-boot9strap-(hardmod)": "14", + "seedminer": "15", + "installing-boot9strap-(fredtool)": "17", + "bannerbomb3": "18", + "homebrew-launcher-(pichaxx)": "19", + "installing-boot9strap-(usm)": "20", + "installing-boot9strap-(safecerthax)": "22", + "installing-boot9strap-(ssloth-browser)": "23", + "installing-boot9strap-(pichaxx)": "24", + }; + + for(var device in devices){ + if(window.location.href.indexOf("/" + device) > -1) { + localStorage.setItem('device', devices[device]); + } + } + + for(var method in methods){ + if(window.location.href.indexOf("/" + method) > -1) { + localStorage.setItem('method', methods[method]); + } + } + + var device, method; + if(!(method = localStorage.getItem('method'))){ + sidebar_shown = false; + } + if (!(device = localStorage.getItem('device'))) { + device = "-1"; + } + if(sidebar_shown){ + var unhide = []; + + // Common paths for navigation. Added to both routes. + // These values of the array will be mapped to the _data/navigation/country_lang.yml files + // be sure to add the relevent values to it, in the order of display. (finalizing setup last, for instance) + // + // The key/propery name must match the value associated with the page in the methods variable above + // + var device_common = { + "0": ["installing-boot9strap-(2xrsa)", "finalizing-setup"], + "1": ["installing-boot9strap-(mset)", "finalizing-setup"], + "2": ["installing-boot9strap-(browser)", "finalizing-setup"], + "3": ["homebrew-launcher-(soundhax)", "installing-boot9strap-(homebrew-launcher)", "finalizing-setup"], + "4": ["homebrew-launcher-(alternatives)", "installing-boot9strap-(homebrew-launcher)", "finalizing-setup"], + "7": ["installing-boot9strap-(soundhax)", "finalizing-setup"], + "8": ["ntrboot", "multiple-options", "installing-boot9strap-(ntrboot)", "finalizing-setup"], + "9": ["ntrboot", "flashing-ntrboot-(3ds-single-system)", "installing-boot9strap-(ntrboot)", "finalizing-setup"], + "10": ["ntrboot", "flashing-ntrboot-(3ds-multi-system)", "installing-boot9strap-(ntrboot)", "finalizing-setup"], + "11": ["ntrboot", "flashing-ntrboot-(dsi)", "installing-boot9strap-(ntrboot)", "finalizing-setup"], + "12": ["ntrboot", "flashing-ntrboot-(nds)", "installing-boot9strap-(ntrboot)", "finalizing-setup"], + "14": ["installing-boot9strap-(hardmod)", "finalizing-setup"], + "15": ["seedminer", "multiple-options", "finalizing-setup"], + "17": ["seedminer", "multiple-options", "installing-boot9strap-(fredtool)", "finalizing-setup"], + "18": ["seedminer", "bannerbomb3", "installing-boot9strap-(fredtool)", "finalizing-setup"], + "19": ["seedminer", "homebrew-launcher-(pichaxx)", "installing-boot9strap-(frogtool)", "finalizing-setup"], + "20": ["seedminer", "installing-boot9strap-(usm)", "finalizing-setup"], + "22": ["installing-boot9strap-(safecerthax)", "finalizing-setup"], + "23": ["installing-boot9strap-(ssloth-browser)", "finalizing-setup"], + "24": ["seedminer", "installing-boot9strap-(pichaxx)", "finalizing-setup"], + + } + // Can add custom routing if necessary but currently both routes are identical + var device_old = Object.assign({}, device_common,{ + // custom routing here + // example: "24": ["seedminer", "multiple-options", "installing-boot9strap-(pichaxx)", "finalizing-setup"], + }); + var device_new = Object.assign({}, device_common,{ + // custom routing here + }); + var route = { + "-1": device_common, + "0": device_old, + "1": device_new, + } + unhide = unhide.concat(route[device][method]); + if(typeof unhide !== 'undefined' && unhide.length > 0){ + unhide.push("home"); + unhide.push("get-started"); + var ol = $('.sidebar.sticky .nav__list .nav__items ol'); + for (var i = 0; i < unhide.length; i++){ + ol.children('li[data-name="' + unhide[i] + '"]').css("display", ""); + } + ol.children().each(function(idx, li) { + var link = $(li).find("a").attr('href'); + var name = $(li).attr('data-name'); + if((window.location.href.endsWith(link) || + window.location.href.endsWith(link + "/") || + window.location.href.indexOf(link + "#") > -1 || + window.location.href.indexOf(link + ".html") > -1) + && name !== "home"){ + $(li).addClass("active"); + return false; + } + $(li).addClass("completed"); + }); + if (ol.children(".active").css("display") != "none"){ + $('.sidebar.sticky').css("display", "inherit"); + } + } + } }); diff --git a/assets/js/main.min.js b/assets/js/main.min.js index 900a9081e2..05b830b395 100644 --- a/assets/js/main.min.js +++ b/assets/js/main.min.js @@ -3,4 +3,4 @@ * Copyright 2013-2021 Michael Rose - mademistakes.com | @mmistakes * Licensed under MIT */ -!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(C,e){"use strict";function m(e){return null!=e&&e===e.window}var t=[],n=Object.getPrototypeOf,s=t.slice,g=t.flat?function(e){return t.flat.call(e)}:function(e){return t.concat.apply([],e)},l=t.push,o=t.indexOf,r={},i=r.toString,v=r.hasOwnProperty,a=v.toString,u=a.call(Object),y={},b=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},T=C.document,c={type:!0,src:!0,nonce:!0,noModule:!0};function x(e,t,n){var r,o,i=(n=n||T).createElement("script");if(i.text=e,t)for(r in c)(o=t[r]||t.getAttribute&&t.getAttribute(r))&&i.setAttribute(r,o);n.head.appendChild(i).parentNode.removeChild(i)}function h(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?r[i.call(e)]||"object":typeof e}var d="3.5.1",E=function(e,t){return new E.fn.init(e,t)};function f(e){var t=!!e&&"length"in e&&e.length,n=h(e);return!b(e)&&!m(e)&&("array"===n||0===t||"number"==typeof t&&0\s*$/g;function je(e,t){return A(e,"table")&&A(11!==t.nodeType?t:t.firstChild,"tr")&&E(e).children("tbody")[0]||e}function Ie(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Le(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function De(e,t){var n,r,o,i;if(1===t.nodeType){if(V.hasData(e)&&(i=V.get(e).events))for(o in V.remove(t,"handle events"),i)for(n=0,r=i[o].length;n").append(E.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,i||[e.responseText,t,e])})}),this},E.expr.pseudos.animated=function(t){return E.grep(E.timers,function(e){return t===e.elem}).length},E.offset={setOffset:function(e,t,n){var r,o,i,a,s=E.css(e,"position"),l=E(e),u={};"static"===s&&(e.style.position="relative"),i=l.offset(),r=E.css(e,"top"),a=E.css(e,"left"),a=("absolute"===s||"fixed"===s)&&-1<(r+a).indexOf("auto")?(o=(s=l.position()).top,s.left):(o=parseFloat(r)||0,parseFloat(a)||0),null!=(t=b(t)?t.call(e,n,E.extend({},i)):t).top&&(u.top=t.top-i.top+o),null!=t.left&&(u.left=t.left-i.left+a),"using"in t?t.using.call(e,u):("number"==typeof u.top&&(u.top+="px"),"number"==typeof u.left&&(u.left+="px"),l.css(u))}},E.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){E.offset.setOffset(this,t,e)});var e,n=this[0];return n?n.getClientRects().length?(e=n.getBoundingClientRect(),n=n.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],o={top:0,left:0};if("fixed"===E.css(r,"position"))t=r.getBoundingClientRect();else{for(t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;e&&(e===n.body||e===n.documentElement)&&"static"===E.css(e,"position");)e=e.parentNode;e&&e!==r&&1===e.nodeType&&((o=E(e).offset()).top+=E.css(e,"borderTopWidth",!0),o.left+=E.css(e,"borderLeftWidth",!0))}return{top:t.top-o.top-E.css(r,"marginTop",!0),left:t.left-o.left-E.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var e=this.offsetParent;e&&"static"===E.css(e,"position");)e=e.offsetParent;return e||re})}}),E.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,o){var i="pageYOffset"===o;E.fn[t]=function(e){return F(this,function(e,t,n){var r;return m(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n?r?r[o]:e[t]:void(r?r.scrollTo(i?r.pageXOffset:n,i?n:r.pageYOffset):e[t]=n)},t,e,arguments.length)}}),E.each(["top","left"],function(e,n){E.cssHooks[n]=Ge(y.pixelPosition,function(e,t){if(t)return t=Ve(e,n),We.test(t)?E(e).position()[n]+"px":t})}),E.each({Height:"height",Width:"width"},function(a,s){E.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,i){E.fn[i]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),o=r||(!0===e||!0===t?"margin":"border");return F(this,function(e,t,n){var r;return m(e)?0===i.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?E.css(e,t,o):E.style(e,t,n,o)},s,n?e:void 0,n)}})}),E.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){E.fn[t]=function(e){return this.on(t,e)}}),E.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),E.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){E.fn[n]=function(e,t){return 0
\s*$/g;function je(e,t){return A(e,"table")&&A(11!==t.nodeType?t:t.firstChild,"tr")&&k(e).children("tbody")[0]||e}function Ie(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Le(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Oe(e,t){var n,r,i,o;if(1===t.nodeType){if(V.hasData(e)&&(o=V.get(e).events))for(i in V.remove(t,"handle events"),o)for(n=0,r=o[i].length;n").append(k.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},k.expr.pseudos.animated=function(t){return k.grep(k.timers,function(e){return t===e.elem}).length},k.offset={setOffset:function(e,t,n){var r,i,o,a,s=k.css(e,"position"),l=k(e),u={};"static"===s&&(e.style.position="relative"),o=l.offset(),r=k.css(e,"top"),a=k.css(e,"left"),a=("absolute"===s||"fixed"===s)&&-1<(r+a).indexOf("auto")?(i=(s=l.position()).top,s.left):(i=parseFloat(r)||0,parseFloat(a)||0),null!=(t=b(t)?t.call(e,n,k.extend({},o)):t).top&&(u.top=t.top-o.top+i),null!=t.left&&(u.left=t.left-o.left+a),"using"in t?t.using.call(e,u):("number"==typeof u.top&&(u.top+="px"),"number"==typeof u.left&&(u.left+="px"),l.css(u))}},k.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){k.offset.setOffset(this,t,e)});var e,n=this[0];return n?n.getClientRects().length?(e=n.getBoundingClientRect(),n=n.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===k.css(r,"position"))t=r.getBoundingClientRect();else{for(t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;e&&(e===n.body||e===n.documentElement)&&"static"===k.css(e,"position");)e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=k(e).offset()).top+=k.css(e,"borderTopWidth",!0),i.left+=k.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-k.css(r,"marginTop",!0),left:t.left-i.left-k.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var e=this.offsetParent;e&&"static"===k.css(e,"position");)e=e.offsetParent;return e||re})}}),k.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;k.fn[t]=function(e){return B(this,function(e,t,n){var r;return m(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n?r?r[i]:e[t]:void(r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n)},t,e,arguments.length)}}),k.each(["top","left"],function(e,n){k.cssHooks[n]=Ge(y.pixelPosition,function(e,t){if(t)return t=Ve(e,n),We.test(t)?k(e).position()[n]+"px":t})}),k.each({Height:"height",Width:"width"},function(a,s){k.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){k.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return B(this,function(e,t,n){var r;return m(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?k.css(e,t,i):k.style(e,t,n,i)},s,n?e:void 0,n)}})}),k.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){k.fn[t]=function(e){return this.on(t,e)}}),k.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),k.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){k.fn[n]=function(e,t){return 0