From efce8ae3ea3ffe49d81faad6cc507b8c6cf8b8af Mon Sep 17 00:00:00 2001 From: Manuel Cillero Date: Mon, 11 Sep 2017 00:01:39 +0200 Subject: [PATCH] Fixed tour navigation in iPhone browsers --- themes/zuitedesk/js/runapp.js | 4 ++-- themes/zuitedesk/js/tourmenu.js | 26 +++++++++++++++++--------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/themes/zuitedesk/js/runapp.js b/themes/zuitedesk/js/runapp.js index 95f2344..c13f072 100644 --- a/themes/zuitedesk/js/runapp.js +++ b/themes/zuitedesk/js/runapp.js @@ -1,7 +1,7 @@ $jq(function () { // Bind to scroll. - $(window).scroll(function () { + $(window).scroll(function() { //Display or hide scroll to top button. if ($(this).scrollTop() > 100) { $('#scroll-top-link').fadeIn(); @@ -11,7 +11,7 @@ $jq(function () { }); // Function for scrolling to top. - $('#scroll-top-link').click(function (e) { + $('#scroll-top-link').click(function(e) { $("html, body").animate({ scrollTop: 0 }, 600); diff --git a/themes/zuitedesk/js/tourmenu.js b/themes/zuitedesk/js/tourmenu.js index f99012f..2b0e3be 100644 --- a/themes/zuitedesk/js/tourmenu.js +++ b/themes/zuitedesk/js/tourmenu.js @@ -1,15 +1,23 @@ $jq(function() { - // Destination, relative path starting with a slash. - var path = '/'; + // Destination, relative path, don't start with a slash. + var path = ''; - var langPath = location.pathname.replace(/^\/+/, '') + '/'; - var basePath = Drupal.settings.basePath ? Drupal.settings.basePath : ''; - basePath = basePath == '/' ? '' : basePath; - if (basePath.length > 0 && langPath.indexOf(basePath) == 0) { - langPath = langPath.substring(basePath.length); + var langPath = ''; + var mainPath = location.pathname ? location.pathname : '/'; + var basePath = Drupal.settings.basePath ? Drupal.settings.basePath : '/'; + if (mainPath.indexOf(basePath) == 0) { + mainPath = mainPath.substring(basePath.length); + } + argPath = mainPath.split('/'); + if (argPath[0] && argPath[0].length == 2) { + langPath = argPath[0] + '/'; + argPath.shift(); + } + if (path == '' && ((argPath[0] == 'user' && !argPath[1]) || (argPath[0] == 'user' && !argPath[2]))) { + path = basePath + mainPath; + } else { + path = basePath + langPath + path; } - langPath = langPath.substring(0, langPath.indexOf('/')); - path = langPath.length == 2 ? basePath + '/' + langPath + path : basePath + path; var prev = Drupal.t("« Prev"); var next = Drupal.t("Next »");