diff --git a/core/modules/tour/css/tour.css b/core/modules/tour/css/tour.css index 6c35005..9125c61 100644 --- a/core/modules/tour/css/tour.css +++ b/core/modules/tour/css/tour.css @@ -6,6 +6,10 @@ display: none; } +.js .toolbar .bar .tour-toolbar-tab.tab { + float: right; +} + .joyride-tip-guide { z-index: 502 } diff --git a/core/modules/tour/js/tour.js b/core/modules/tour/js/tour.js index 32f9ce9..a13b696 100644 --- a/core/modules/tour/js/tour.js +++ b/core/modules/tour/js/tour.js @@ -42,10 +42,16 @@ return false; } if ($(toolbar_id + ".touring", scope).length) { + // Allow other scripts to respond to this event. + $(document).trigger('drupalTourBeforeClose'); + $(items).prop("hidden", true).joyride("destroy"); closeTour(scope); } else { + // Allow other scripts to respond to this event. + $(document).trigger('drupalTourBeforeOpen'); + $toolbar.addClass("touring"); $(items).prop("hidden", false).joyride({ "postRideCallback": function() { @@ -61,7 +67,7 @@ * Cleans up the tour. */ function closeTour(scope) { - $("#toolbar-tab-tour", scope).removeClass("touring"); + $(toolbar_id, scope).removeClass("touring"); } /** @@ -69,13 +75,18 @@ */ function detachTour(scope) { closeTour(scope); - $("#toolbar-tab-tour", scope).unbind("click.tour"); + $(toolbar_id, scope).unbind("click.tour"); } /** * Initialize the appropriate tour. */ if ($(overlay_content).length) { + $(document).bind('drupalOverlayBeforeLoad.drupal-overlay.drupal-overlay-child-loading', function() { + // Remove tour events associated with overlay. + detachTour(window.parent.document); + }); + // Remove tour events associated with overlay. detachTour(window.parent.document); // Attach it based on outer content. @@ -92,6 +103,14 @@ // Remove tour events associated with overlay. detachTour(window.document); }); + $(document).bind("drupalOverlayReady", function() { + if ($(tour_items).length) { + $(toolbar_id, window.parent.document).addClass(toolbar_class); + } + else { + $(toolbar_id, window.parent.document).removeClass(toolbar_class); + } + }); // Don't run this in overlay. // This only runs once in the parent. diff --git a/core/modules/tour/tour.module b/core/modules/tour/tour.module index cf750bd..7c6725a 100644 --- a/core/modules/tour/tour.module +++ b/core/modules/tour/tour.module @@ -80,10 +80,13 @@ function tour_toolbar() { 'id' => 'toolbar-tab-tour', ), ), - '#attached' => array( - 'library' => array( - array('tour', 'tour'), - ), + ), + '#wrapper_attributes' => array( + 'class' => array('tour-toolbar-tab'), + ), + '#attached' => array( + 'library' => array( + array('tour', 'tour'), ), ), ); @@ -96,9 +99,6 @@ function tour_toolbar() { */ function tour_theme($existing, $type, $theme, $path) { return array( - 'tour_items' => array( - 'variables' => array('tour_items' => NULL), - ), 'tour_tooltip' => array( 'variables' => array('tooltip' => NULL), ), @@ -110,8 +110,8 @@ function tour_theme($existing, $type, $theme, $path) { */ function theme_tour_tooltip($vars) { $tooltip = $vars['tooltip']; - return '

' . check_plain($tooltip->label()) . '

-

' . filter_xss_admin($tooltip->get('body')) . '

'; + return '

' . check_plain($tooltip->label()) . '

+

' . filter_xss_admin($tooltip->get('body')) . '

'; } /**