From f509e14139f185220f886fd14e5e35b9ffff31a9 Mon Sep 17 00:00:00 2001 From: webchick <drupal@webchick.net> Date: Thu, 8 Jan 2015 23:20:01 -0800 Subject: [PATCH] Issue #2027623 by hampercm, larowlan, hussainweb, nick_schuch, droplet, sun, clemens.tolboom: De-fork jQuery Joyride and update to latest stable release --- .../jquery-joyride/jquery.joyride-2.0.3.js | 675 ------------------ .../jquery-joyride/jquery.joyride-2.1.min.js | 2 + core/core.libraries.yml | 6 +- core/modules/tour/css/tour.module.css | 19 + core/modules/tour/js/tour.js | 1 + .../seven/css/components/tour.theme.css | 13 + 6 files changed, 38 insertions(+), 678 deletions(-) delete mode 100644 core/assets/vendor/jquery-joyride/jquery.joyride-2.0.3.js create mode 100644 core/assets/vendor/jquery-joyride/jquery.joyride-2.1.min.js diff --git a/core/assets/vendor/jquery-joyride/jquery.joyride-2.0.3.js b/core/assets/vendor/jquery-joyride/jquery.joyride-2.0.3.js deleted file mode 100644 index b144fb90c489..000000000000 --- a/core/assets/vendor/jquery-joyride/jquery.joyride-2.0.3.js +++ /dev/null @@ -1,675 +0,0 @@ -/* - * jQuery Foundation Joyride Plugin 2.0.3 - * http://foundation.zurb.com - * Copyright 2012, ZURB - * Free to use under the MIT license. - * http://www.opensource.org/licenses/mit-license.php -*/ - -/*jslint unparam: true, browser: true, indent: 2 */ - -;(function ($, window, undefined) { - 'use strict'; - - var defaults = { - 'version' : '2.0.3', - 'tipLocation' : 'bottom', // 'top' or 'bottom' in relation to parent - 'nubPosition' : 'auto', // override on a per tooltip bases - 'scrollSpeed' : 300, // Page scrolling speed in milliseconds - 'timer' : 0, // 0 = no timer , all other numbers = timer in milliseconds - 'startTimerOnClick' : true, // true or false - true requires clicking the first button start the timer - 'startOffset' : 0, // the index of the tooltip you want to start on (index of the li) - 'nextButton' : true, // true or false to control whether a next button is used - 'tipAnimation' : 'fade', // 'pop' or 'fade' in each tip - 'pauseAfter' : [], // array of indexes where to pause the tour after - 'tipAnimationFadeSpeed': 300, // when tipAnimation = 'fade' this is speed in milliseconds for the transition - 'cookieMonster' : false, // true or false to control whether cookies are used - 'cookieName' : 'joyride', // Name the cookie you'll use - 'cookieDomain' : false, // Will this cookie be attached to a domain, ie. '.notableapp.com' - 'tipContainer' : 'body', // Where will the tip be attached - 'postRideCallback' : $.noop, // A method to call once the tour closes (canceled or complete) - 'postStepCallback' : $.noop, // A method to call after each step - 'template' : { // HTML segments for tip layout - 'link' : '<a href="#close" class="joyride-close-tip">X</a>', - 'timer' : '<div class="joyride-timer-indicator-wrap"><span class="joyride-timer-indicator"></span></div>', - 'tip' : '<div class="joyride-tip-guide"><span class="joyride-nub"></span></div>', - 'wrapper' : '<div class="joyride-content-wrapper" role="dialog"></div>', - 'button' : '<a href="#" class="joyride-next-tip"></a>' - } - }, - - Modernizr = Modernizr || false, - - settings = {}, - - methods = { - - init : function (opts) { - return this.each(function () { - - if ($.isEmptyObject(settings)) { - settings = $.extend(true, defaults, opts); - - // non configurable settings - settings.document = window.document; - settings.$document = $(settings.document); - settings.$window = $(window); - settings.$content_el = $(this); - settings.body_offset = $(settings.tipContainer).position(); - settings.$tip_content = $('> li', settings.$content_el); - settings.paused = false; - settings.attempts = 0; - - settings.tipLocationPatterns = { - top: ['bottom'], - bottom: [], // bottom should not need to be repositioned - left: ['right', 'top', 'bottom'], - right: ['left', 'top', 'bottom'] - }; - - // are we using jQuery 1.7+ - methods.jquery_check(); - - // can we create cookies? - if (!$.isFunction($.cookie)) { - settings.cookieMonster = false; - } - - // generate the tips and insert into dom. - if (!settings.cookieMonster || !$.cookie(settings.cookieName)) { - - settings.$tip_content.each(function (index) { - methods.create({$li : $(this), index : index}); - }); - - // show first tip - if (!settings.startTimerOnClick && settings.timer > 0) { - methods.show('init'); - methods.startTimer(); - } else { - methods.show('init'); - } - - } - - settings.$document.on('click.joyride', '.joyride-next-tip, .joyride-modal-bg', function (e) { - e.preventDefault(); - - if (settings.$li.next().length < 1) { - methods.end(); - } else if (settings.timer > 0) { - clearTimeout(settings.automate); - methods.hide(); - methods.show(); - methods.startTimer(); - } else { - methods.hide(); - methods.show(); - } - - }); - - settings.$document.on('click.joyride', '.joyride-close-tip', function (e) { - e.preventDefault(); - methods.end(); - }); - - settings.$window.bind('resize.joyride', function (e) { - if (methods.is_phone()) { - methods.pos_phone(); - } else { - methods.pos_default(); - } - }); - } else { - methods.restart(); - } - - }); - }, - - // call this method when you want to resume the tour - resume : function () { - methods.set_li(); - methods.show(); - }, - - tip_template : function (opts) { - var $blank, content, $wrapper; - - opts.tip_class = opts.tip_class || ''; - - $blank = $(settings.template.tip).addClass(opts.tip_class); - content = $.trim($(opts.li).html()) + - methods.button_text(opts.button_text) + - settings.template.link + - methods.timer_instance(opts.index); - - $wrapper = $(settings.template.wrapper); - if (opts.li.attr('data-aria-labelledby')) { - $wrapper.attr('aria-labelledby', opts.li.attr('data-aria-labelledby')) - } - if (opts.li.attr('data-aria-describedby')) { - $wrapper.attr('aria-describedby', opts.li.attr('data-aria-describedby')) - } - $blank.append($wrapper); - $blank.first().attr('data-index', opts.index); - $('.joyride-content-wrapper', $blank).append(content); - - return $blank[0]; - }, - - timer_instance : function (index) { - var txt; - - if ((index === 0 && settings.startTimerOnClick && settings.timer > 0) || settings.timer === 0) { - txt = ''; - } else { - txt = methods.outerHTML($(settings.template.timer)[0]); - } - return txt; - }, - - button_text : function (txt) { - if (settings.nextButton) { - txt = $.trim(txt) || 'Next'; - txt = methods.outerHTML($(settings.template.button).append(txt)[0]); - } else { - txt = ''; - } - return txt; - }, - - create : function (opts) { - // backwards compatibility with data-text attribute - var buttonText = opts.$li.attr('data-button') || opts.$li.attr('data-text'), - tipClass = opts.$li.attr('class'), - $tip_content = $(methods.tip_template({ - tip_class : tipClass, - index : opts.index, - button_text : buttonText, - li : opts.$li - })); - - $(settings.tipContainer).append($tip_content); - }, - - show : function (init) { - var opts = {}, ii, opts_arr = [], opts_len = 0, p, - $timer = null; - - // are we paused? - if (settings.$li === undefined || ($.inArray(settings.$li.index(), settings.pauseAfter) === -1)) { - - // don't go to the next li if the tour was paused - if (settings.paused) { - settings.paused = false; - } else { - methods.set_li(init); - } - - settings.attempts = 0; - - if (settings.$li.length && settings.$target.length > 0) { - opts_arr = (settings.$li.data('options') || ':').split(';'); - opts_len = opts_arr.length; - - // parse options - for (ii = opts_len - 1; ii >= 0; ii--) { - p = opts_arr[ii].split(':'); - - if (p.length === 2) { - opts[$.trim(p[0])] = $.trim(p[1]); - } - } - - settings.tipSettings = $.extend({}, settings, opts); - - settings.tipSettings.tipLocationPattern = settings.tipLocationPatterns[settings.tipSettings.tipLocation]; - - // scroll if not modal - if (!/body/i.test(settings.$target.selector)) { - methods.scroll_to(); - } - - if (methods.is_phone()) { - methods.pos_phone(true); - } else { - methods.pos_default(true); - } - - $timer = $('.joyride-timer-indicator', settings.$next_tip); - - if (/pop/i.test(settings.tipAnimation)) { - - $timer.outerWidth(0); - - if (settings.timer > 0) { - - settings.$next_tip.show(); - $timer.animate({ - width: $('.joyride-timer-indicator-wrap', settings.$next_tip).outerWidth() - }, settings.timer); - - } else { - - settings.$next_tip.show(); - - } - - - } else if (/fade/i.test(settings.tipAnimation)) { - - $timer.outerWidth(0); - - if (settings.timer > 0) { - - settings.$next_tip.fadeIn(settings.tipAnimationFadeSpeed); - - settings.$next_tip.show(); - $timer.animate({ - width: $('.joyride-timer-indicator-wrap', settings.$next_tip).outerWidth() - }, settings.timer); - - } else { - - settings.$next_tip.fadeIn(settings.tipAnimationFadeSpeed); - - } - } - - settings.$current_tip = settings.$next_tip; - $('.joyride-next-tip', settings.$current_tip).focus(); - methods.tabbable(settings.$current_tip); - - // skip non-existent targets - } else if (settings.$li && settings.$target.length < 1) { - - methods.show(); - - } else { - - methods.end(); - - } - } else { - - settings.paused = true; - - } - - }, - - // detect phones with media queries if supported. - is_phone : function () { - if (Modernizr) { - return Modernizr.mq('only screen and (max-width: 767px)'); - } - - return (settings.$window.width() < 767) ? true : false; - }, - - hide : function () { - settings.postStepCallback(settings.$li.index(), settings.$current_tip); - $('.joyride-modal-bg').hide(); - settings.$current_tip.hide(); - }, - - set_li : function (init) { - if (init) { - settings.$li = settings.$tip_content.eq(settings.startOffset); - methods.set_next_tip(); - settings.$current_tip = settings.$next_tip; - } else { - settings.$li = settings.$li.next(); - methods.set_next_tip(); - } - - methods.set_target(); - }, - - set_next_tip : function () { - settings.$next_tip = $('.joyride-tip-guide[data-index=' + settings.$li.index() + ']'); - }, - - set_target : function () { - var cl = settings.$li.attr('data-class'), - id = settings.$li.attr('data-id'), - $sel = function () { - if (id) { - return $(settings.document.getElementById(id)); - } else if (cl) { - return $('.' + cl).first(); - } else { - return $('body'); - } - }; - - settings.$target = $sel(); - }, - - scroll_to : function () { - var window_half, tipOffset; - - window_half = settings.$window.height() / 2; - tipOffset = Math.ceil(settings.$target.offset().top - window_half + settings.$next_tip.outerHeight()); - - $("html, body").stop().animate({ - scrollTop: tipOffset - }, settings.scrollSpeed); - }, - - paused : function () { - if (($.inArray((settings.$li.index() + 1), settings.pauseAfter) === -1)) { - return true; - } - - return false; - }, - - destroy : function () { - settings.$document.off('.joyride'); - $(window).off('.joyride'); - $('.joyride-close-tip, .joyride-next-tip, .joyride-modal-bg').off('.joyride'); - $('.joyride-tip-guide, .joyride-modal-bg').remove(); - clearTimeout(settings.automate); - settings = {}; - }, - - restart : function () { - methods.hide(); - settings.$li = undefined; - methods.show('init'); - }, - - pos_default : function (init) { - var half_fold = Math.ceil(settings.$window.height() / 2), - tip_position = settings.$next_tip.offset(), - $nub = $('.joyride-nub', settings.$next_tip), - nub_height = Math.ceil($nub.outerHeight() / 2), - toggle = init || false; - - // tip must not be "display: none" to calculate position - if (toggle) { - settings.$next_tip.css('visibility', 'hidden'); - settings.$next_tip.show(); - } - - if (!/body/i.test(settings.$target.selector)) { - - if (methods.bottom()) { - settings.$next_tip.css({ - top: (settings.$target.offset().top + nub_height + settings.$target.outerHeight()), - left: settings.$target.offset().left}); - - methods.nub_position($nub, settings.tipSettings.nubPosition, 'top'); - - } else if (methods.top()) { - - settings.$next_tip.css({ - top: (settings.$target.offset().top - settings.$next_tip.outerHeight() - nub_height), - left: settings.$target.offset().left}); - - methods.nub_position($nub, settings.tipSettings.nubPosition, 'bottom'); - - } else if (methods.right()) { - - settings.$next_tip.css({ - top: settings.$target.offset().top, - left: (settings.$target.outerWidth() + settings.$target.offset().left)}); - - methods.nub_position($nub, settings.tipSettings.nubPosition, 'left'); - - } else if (methods.left()) { - - settings.$next_tip.css({ - top: settings.$target.offset().top, - left: (settings.$target.offset().left - settings.$next_tip.outerWidth() - nub_height)}); - - methods.nub_position($nub, settings.tipSettings.nubPosition, 'right'); - - } - - if (!methods.visible(methods.corners(settings.$next_tip)) && settings.attempts < settings.tipSettings.tipLocationPattern.length) { - - $nub.removeClass('bottom') - .removeClass('top') - .removeClass('right') - .removeClass('left'); - - settings.tipSettings.tipLocation = settings.tipSettings.tipLocationPattern[settings.attempts]; - - settings.attempts++; - - methods.pos_default(true); - - } - - } else if (settings.$li.length) { - - methods.pos_modal($nub); - - } - - if (toggle) { - settings.$next_tip.hide(); - settings.$next_tip.css('visibility', 'visible'); - } - - }, - - pos_phone : function (init) { - var tip_height = settings.$next_tip.outerHeight(), - tip_offset = settings.$next_tip.offset(), - target_height = settings.$target.outerHeight(), - $nub = $('.joyride-nub', settings.$next_tip), - nub_height = Math.ceil($nub.outerHeight() / 2), - toggle = init || false; - - $nub.removeClass('bottom') - .removeClass('top') - .removeClass('right') - .removeClass('left'); - - if (toggle) { - settings.$next_tip.css('visibility', 'hidden'); - settings.$next_tip.show(); - } - - if (!/body/i.test(settings.$target.selector)) { - - if (methods.top()) { - - settings.$next_tip.offset({top: settings.$target.offset().top - tip_height - nub_height}); - $nub.addClass('bottom'); - - } else { - - settings.$next_tip.offset({top: settings.$target.offset().top + target_height + nub_height}); - $nub.addClass('top'); - - } - - } else if (settings.$li.length) { - - methods.pos_modal($nub); - - } - - if (toggle) { - settings.$next_tip.hide(); - settings.$next_tip.css('visibility', 'visible'); - } - }, - - pos_modal : function ($nub) { - methods.center(); - $nub.hide(); - - if ($('.joyride-modal-bg').length < 1) { - $('body').append('<div class="joyride-modal-bg">').show(); - } - - if (/pop/i.test(settings.tipAnimation)) { - $('.joyride-modal-bg').show(); - } else { - $('.joyride-modal-bg').fadeIn(settings.tipAnimationFadeSpeed); - } - }, - - center : function () { - var $w = settings.$window; - - settings.$next_tip.css({ - top : ((($w.height() - settings.$next_tip.outerHeight()) / 2) + $w.scrollTop()), - left : ((($w.width() - settings.$next_tip.outerWidth()) / 2) + $w.scrollLeft()) - }); - - return true; - }, - - bottom : function () { - return /bottom/i.test(settings.tipSettings.tipLocation); - }, - - top : function () { - return /top/i.test(settings.tipSettings.tipLocation); - }, - - right : function () { - return /right/i.test(settings.tipSettings.tipLocation); - }, - - left : function () { - return /left/i.test(settings.tipSettings.tipLocation); - }, - - corners : function (el) { - var w = settings.$window, - right = w.width() + w.scrollLeft(), - bottom = w.width() + w.scrollTop(); - - return [ - el.offset().top <= w.scrollTop(), - right <= el.offset().left + el.outerWidth(), - bottom <= el.offset().top + el.outerHeight(), - w.scrollLeft() >= el.offset().left - ]; - }, - - visible : function (hidden_corners) { - var i = hidden_corners.length; - - while (i--) { - if (hidden_corners[i]) return false; - } - - return true; - }, - - nub_position : function (nub, pos, def) { - if (pos === 'auto') { - nub.addClass(def); - } else { - nub.addClass(pos); - } - }, - - startTimer : function () { - if (settings.$li.length) { - settings.automate = setTimeout(function () { - methods.hide(); - methods.show(); - methods.startTimer(); - }, settings.timer); - } else { - clearTimeout(settings.automate); - } - }, - - end : function () { - if (settings.cookieMonster) { - $.cookie(settings.cookieName, 'ridden', { expires: 365, domain: settings.cookieDomain }); - } - - if (settings.timer > 0) { - clearTimeout(settings.automate); - } - - $('.joyride-modal-bg').hide(); - settings.$current_tip.hide(); - settings.postStepCallback(settings.$li.index(), settings.$current_tip); - settings.postRideCallback(settings.$li.index(), settings.$current_tip); - }, - - jquery_check : function () { - // define on() and off() for older jQuery - if (!$.isFunction($.fn.on)) { - - $.fn.on = function (types, sel, fn) { - - return this.delegate(sel, types, fn); - - }; - - $.fn.off = function (types, sel, fn) { - - return this.undelegate(sel, types, fn); - - }; - - return false; - } - - return true; - }, - - outerHTML : function (el) { - // support FireFox < 11 - return el.outerHTML || new XMLSerializer().serializeToString(el); - }, - - version : function () { - return settings.version; - }, - - tabbable : function (el) { - $(el).on('keydown', function( event ) { - if (!event.isDefaultPrevented() && event.keyCode && - // Escape key. - event.keyCode === 27 ) { - event.preventDefault(); - methods.end(); - return; - } - - // Prevent tabbing out of tour items. - if ( event.keyCode !== 9 ) { - return; - } - var tabbables = $(el).find(":tabbable"), - first = tabbables.filter(":first"), - last = tabbables.filter(":last"); - if ( event.target === last[0] && !event.shiftKey ) { - first.focus( 1 ); - event.preventDefault(); - } else if ( event.target === first[0] && event.shiftKey ) { - last.focus( 1 ); - event.preventDefault(); - } - }); - } - - }; - - $.fn.joyride = function (method) { - if (methods[method]) { - return methods[method].apply(this, Array.prototype.slice.call(arguments, 1)); - } else if (typeof method === 'object' || !method) { - return methods.init.apply(this, arguments); - } else { - $.error('Method ' + method + ' does not exist on jQuery.joyride'); - } - }; - -}(jQuery, this)); diff --git a/core/assets/vendor/jquery-joyride/jquery.joyride-2.1.min.js b/core/assets/vendor/jquery-joyride/jquery.joyride-2.1.min.js new file mode 100644 index 000000000000..e6d6961eb6ec --- /dev/null +++ b/core/assets/vendor/jquery-joyride/jquery.joyride-2.1.min.js @@ -0,0 +1,2 @@ +/* jQuery Foundation Joyride Plugin 2.1 | Copyright 2012, ZURB | www.opensource.org/licenses/mit-license.php */ +(function(e,t,n){"use strict";var r={version:"2.0.3",tipLocation:"bottom",nubPosition:"auto",scroll:!0,scrollSpeed:300,timer:0,autoStart:!1,startTimerOnClick:!0,startOffset:0,nextButton:!0,tipAnimation:"fade",pauseAfter:[],tipAnimationFadeSpeed:300,cookieMonster:!1,cookieName:"joyride",cookieDomain:!1,cookiePath:!1,localStorage:!1,localStorageKey:"joyride",tipContainer:"body",modal:!1,expose:!1,postExposeCallback:e.noop,preRideCallback:e.noop,postRideCallback:e.noop,preStepCallback:e.noop,postStepCallback:e.noop,template:{link:'<a href="#close" class="joyride-close-tip">X</a>',timer:'<div class="joyride-timer-indicator-wrap"><span class="joyride-timer-indicator"></span></div>',tip:'<div class="joyride-tip-guide"><span class="joyride-nub"></span></div>',wrapper:'<div class="joyride-content-wrapper" role="dialog"></div>',button:'<a href="#" class="joyride-next-tip"></a>',modal:'<div class="joyride-modal-bg"></div>',expose:'<div class="joyride-expose-wrapper"></div>',exposeCover:'<div class="joyride-expose-cover"></div>'}},i=i||!1,s={},o={init:function(n){return this.each(function(){e.isEmptyObject(s)?(s=e.extend(!0,r,n),s.document=t.document,s.$document=e(s.document),s.$window=e(t),s.$content_el=e(this),s.$body=e(s.tipContainer),s.body_offset=e(s.tipContainer).position(),s.$tip_content=e("> li",s.$content_el),s.paused=!1,s.attempts=0,s.tipLocationPatterns={top:["bottom"],bottom:[],left:["right","top","bottom"],right:["left","top","bottom"]},o.jquery_check(),e.isFunction(e.cookie)||(s.cookieMonster=!1),(!s.cookieMonster||!e.cookie(s.cookieName))&&(!s.localStorage||!o.support_localstorage()||!localStorage.getItem(s.localStorageKey))&&(s.$tip_content.each(function(t){o.create({$li:e(this),index:t})}),s.autoStart&&(!s.startTimerOnClick&&s.timer>0?(o.show("init"),o.startTimer()):o.show("init"))),s.$document.on("click.joyride",".joyride-next-tip, .joyride-modal-bg",function(e){e.preventDefault(),s.$li.next().length<1?o.end():s.timer>0?(clearTimeout(s.automate),o.hide(),o.show(),o.startTimer()):(o.hide(),o.show())}),s.$document.on("click.joyride",".joyride-close-tip",function(e){e.preventDefault(),o.end()}),s.$window.bind("resize.joyride",function(t){if(s.$li){if(s.exposed&&s.exposed.length>0){var n=e(s.exposed);n.each(function(){var t=e(this);o.un_expose(t),o.expose(t)})}o.is_phone()?o.pos_phone():o.pos_default()}})):o.restart()})},resume:function(){o.set_li(),o.show()},nextTip:function(){s.$li.next().length<1?o.end():s.timer>0?(clearTimeout(s.automate),o.hide(),o.show(),o.startTimer()):(o.hide(),o.show())},tip_template:function(t){var n,r,i;return t.tip_class=t.tip_class||"",n=e(s.template.tip).addClass(t.tip_class),r=e.trim(e(t.li).html())+o.button_text(t.button_text)+s.template.link+o.timer_instance(t.index),i=e(s.template.wrapper),t.li.attr("data-aria-labelledby")&&i.attr("aria-labelledby",t.li.attr("data-aria-labelledby")),t.li.attr("data-aria-describedby")&&i.attr("aria-describedby",t.li.attr("data-aria-describedby")),n.append(i),n.first().attr("data-index",t.index),e(".joyride-content-wrapper",n).append(r),n[0]},timer_instance:function(t){var n;return t===0&&s.startTimerOnClick&&s.timer>0||s.timer===0?n="":n=o.outerHTML(e(s.template.timer)[0]),n},button_text:function(t){return s.nextButton?(t=e.trim(t)||"Next",t=o.outerHTML(e(s.template.button).append(t)[0])):t="",t},create:function(t){var n=t.$li.attr("data-button")||t.$li.attr("data-text"),r=t.$li.attr("class"),i=e(o.tip_template({tip_class:r,index:t.index,button_text:n,li:t.$li}));e(s.tipContainer).append(i)},show:function(t){var r={},i,u=[],a=0,f,l=null;if(s.$li===n||e.inArray(s.$li.index(),s.pauseAfter)===-1){s.paused?s.paused=!1:o.set_li(t),s.attempts=0;if(s.$li.length&&s.$target.length>0){t&&(s.preRideCallback(s.$li.index(),s.$next_tip),s.modal&&o.show_modal()),s.preStepCallback(s.$li.index(),s.$next_tip),u=(s.$li.data("options")||":").split(";"),a=u.length;for(i=a-1;i>=0;i--)f=u[i].split(":"),f.length===2&&(r[e.trim(f[0])]=e.trim(f[1]));s.tipSettings=e.extend({},s,r),s.tipSettings.tipLocationPattern=s.tipLocationPatterns[s.tipSettings.tipLocation],s.modal&&s.expose&&o.expose(),!/body/i.test(s.$target.selector)&&s.scroll&&o.scroll_to(),o.is_phone()?o.pos_phone(!0):o.pos_default(!0),l=e(".joyride-timer-indicator",s.$next_tip),/pop/i.test(s.tipAnimation)?(l.outerWidth(0),s.timer>0?(s.$next_tip.show(),l.animate({width:e(".joyride-timer-indicator-wrap",s.$next_tip).outerWidth()},s.timer)):s.$next_tip.show()):/fade/i.test(s.tipAnimation)&&(l.outerWidth(0),s.timer>0?(s.$next_tip.fadeIn(s.tipAnimationFadeSpeed),s.$next_tip.show(),l.animate({width:e(".joyride-timer-indicator-wrap",s.$next_tip).outerWidth()},s.timer)):s.$next_tip.fadeIn(s.tipAnimationFadeSpeed)),s.$current_tip=s.$next_tip,e(".joyride-next-tip",s.$current_tip).focus(),o.tabbable(s.$current_tip)}else s.$li&&s.$target.length<1?o.show():o.end()}else s.paused=!0},is_phone:function(){return i?i.mq("only screen and (max-width: 767px)"):s.$window.width()<767?!0:!1},support_localstorage:function(){return i?i.localstorage:!!t.localStorage},hide:function(){s.modal&&s.expose&&o.un_expose(),s.modal||e(".joyride-modal-bg").hide(),s.$current_tip.hide(),s.postStepCallback(s.$li.index(),s.$current_tip)},set_li:function(e){e?(s.$li=s.$tip_content.eq(s.startOffset),o.set_next_tip(),s.$current_tip=s.$next_tip):(s.$li=s.$li.next(),o.set_next_tip()),o.set_target()},set_next_tip:function(){s.$next_tip=e(".joyride-tip-guide[data-index="+s.$li.index()+"]")},set_target:function(){var t=s.$li.attr("data-class"),n=s.$li.attr("data-id"),r=function(){return n?e(s.document.getElementById(n)):t?e("."+t).filter(":visible").first():e("body")};s.$target=r()},scroll_to:function(){var t,n;t=s.$window.height()/2,n=Math.ceil(s.$target.offset().top-t+s.$next_tip.outerHeight()),e("html, body").stop().animate({scrollTop:n},s.scrollSpeed)},paused:function(){return e.inArray(s.$li.index()+1,s.pauseAfter)===-1?!0:!1},destroy:function(){e.isEmptyObject(s)||s.$document.off(".joyride"),e(t).off(".joyride"),e(".joyride-close-tip, .joyride-next-tip, .joyride-modal-bg").off(".joyride"),e(".joyride-tip-guide, .joyride-modal-bg").remove(),clearTimeout(s.automate),s={}},restart:function(){s.autoStart?(o.hide(),s.$li=n,o.show("init")):(!s.startTimerOnClick&&s.timer>0?(o.show("init"),o.startTimer()):o.show("init"),s.autoStart=!0)},pos_default:function(t){var n=Math.ceil(s.$window.height()/2),r=s.$next_tip.offset(),i=e(".joyride-nub",s.$next_tip),u=Math.ceil(i.outerWidth()/2),a=Math.ceil(i.outerHeight()/2),f=t||!1;f&&(s.$next_tip.css("visibility","hidden"),s.$next_tip.show());if(!/body/i.test(s.$target.selector)){var l=s.tipSettings.tipAdjustmentY?parseInt(s.tipSettings.tipAdjustmentY):0,c=s.tipSettings.tipAdjustmentX?parseInt(s.tipSettings.tipAdjustmentX):0;o.bottom()?(s.$next_tip.css({top:s.$target.offset().top+a+s.$target.outerHeight()+l,left:s.$target.offset().left+c}),/right/i.test(s.tipSettings.nubPosition)&&s.$next_tip.css("left",s.$target.offset().left-s.$next_tip.outerWidth()+s.$target.outerWidth()),o.nub_position(i,s.tipSettings.nubPosition,"top")):o.top()?(s.$next_tip.css({top:s.$target.offset().top-s.$next_tip.outerHeight()-a+l,left:s.$target.offset().left+c}),o.nub_position(i,s.tipSettings.nubPosition,"bottom")):o.right()?(s.$next_tip.css({top:s.$target.offset().top+l,left:s.$target.outerWidth()+s.$target.offset().left+u+c}),o.nub_position(i,s.tipSettings.nubPosition,"left")):o.left()&&(s.$next_tip.css({top:s.$target.offset().top+l,left:s.$target.offset().left-s.$next_tip.outerWidth()-u+c}),o.nub_position(i,s.tipSettings.nubPosition,"right")),!o.visible(o.corners(s.$next_tip))&&s.attempts<s.tipSettings.tipLocationPattern.length&&(i.removeClass("bottom").removeClass("top").removeClass("right").removeClass("left"),s.tipSettings.tipLocation=s.tipSettings.tipLocationPattern[s.attempts],s.attempts++,o.pos_default(!0))}else s.$li.length&&o.pos_modal(i);f&&(s.$next_tip.hide(),s.$next_tip.css("visibility","visible"))},pos_phone:function(t){var n=s.$next_tip.outerHeight(),r=s.$next_tip.offset(),i=s.$target.outerHeight(),u=e(".joyride-nub",s.$next_tip),a=Math.ceil(u.outerHeight()/2),f=t||!1;u.removeClass("bottom").removeClass("top").removeClass("right").removeClass("left"),f&&(s.$next_tip.css("visibility","hidden"),s.$next_tip.show()),/body/i.test(s.$target.selector)?s.$li.length&&o.pos_modal(u):o.top()?(s.$next_tip.offset({top:s.$target.offset().top-n-a}),u.addClass("bottom")):(s.$next_tip.offset({top:s.$target.offset().top+i+a}),u.addClass("top")),f&&(s.$next_tip.hide(),s.$next_tip.css("visibility","visible"))},pos_modal:function(e){o.center(),e.hide(),o.show_modal()},show_modal:function(){e(".joyride-modal-bg").length<1&&e("body").append(s.template.modal).show(),/pop/i.test(s.tipAnimation)?e(".joyride-modal-bg").show():e(".joyride-modal-bg").fadeIn(s.tipAnimationFadeSpeed)},expose:function(){var n,r,i,u,a="expose-"+Math.floor(Math.random()*1e4);if(arguments.length>0&&arguments[0]instanceof e)i=arguments[0];else{if(!s.$target||!!/body/i.test(s.$target.selector))return!1;i=s.$target}if(i.length<1)return t.console&&console.error("element not valid",i),!1;n=e(s.template.expose),s.$body.append(n),n.css({top:i.offset().top,left:i.offset().left,width:i.outerWidth(!0),height:i.outerHeight(!0)}),r=e(s.template.exposeCover),u={zIndex:i.css("z-index"),position:i.css("position")},i.css("z-index",n.css("z-index")*1+1),u.position=="static"&&i.css("position","relative"),i.data("expose-css",u),r.css({top:i.offset().top,left:i.offset().left,width:i.outerWidth(!0),height:i.outerHeight(!0)}),s.$body.append(r),n.addClass(a),r.addClass(a),s.tipSettings.exposeClass&&(n.addClass(s.tipSettings.exposeClass),r.addClass(s.tipSettings.exposeClass)),i.data("expose",a),s.postExposeCallback(s.$li.index(),s.$next_tip,i),o.add_exposed(i)},un_expose:function(){var n,r,i,u,a=!1;if(arguments.length>0&&arguments[0]instanceof e)r=arguments[0];else{if(!s.$target||!!/body/i.test(s.$target.selector))return!1;r=s.$target}if(r.length<1)return t.console&&console.error("element not valid",r),!1;n=r.data("expose"),i=e("."+n),arguments.length>1&&(a=arguments[1]),a===!0?e(".joyride-expose-wrapper,.joyride-expose-cover").remove():i.remove(),u=r.data("expose-css"),u.zIndex=="auto"?r.css("z-index",""):r.css("z-index",u.zIndex),u.position!=r.css("position")&&(u.position=="static"?r.css("position",""):r.css("position",u.position)),r.removeData("expose"),r.removeData("expose-z-index"),o.remove_exposed(r)},add_exposed:function(t){s.exposed=s.exposed||[],t instanceof e?s.exposed.push(t[0]):typeof t=="string"&&s.exposed.push(t)},remove_exposed:function(t){var n;t instanceof e?n=t[0]:typeof t=="string"&&(n=t),s.exposed=s.exposed||[];for(var r=0;r<s.exposed.length;r++)if(s.exposed[r]==n){s.exposed.splice(r,1);return}},center:function(){var e=s.$window;return s.$next_tip.css({top:(e.height()-s.$next_tip.outerHeight())/2+e.scrollTop(),left:(e.width()-s.$next_tip.outerWidth())/2+e.scrollLeft()}),!0},bottom:function(){return/bottom/i.test(s.tipSettings.tipLocation)},top:function(){return/top/i.test(s.tipSettings.tipLocation)},right:function(){return/right/i.test(s.tipSettings.tipLocation)},left:function(){return/left/i.test(s.tipSettings.tipLocation)},corners:function(e){var t=s.$window,n=t.height()/2,r=Math.ceil(s.$target.offset().top-n+s.$next_tip.outerHeight()),i=t.width()+t.scrollLeft(),o=t.height()+r,u=t.height()+t.scrollTop(),a=t.scrollTop();return r<a&&(r<0?a=0:a=r),o>u&&(u=o),[e.offset().top<a,i<e.offset().left+e.outerWidth(),u<e.offset().top+e.outerHeight(),t.scrollLeft()>e.offset().left]},visible:function(e){var t=e.length;while(t--)if(e[t])return!1;return!0},nub_position:function(e,t,n){t==="auto"?e.addClass(n):e.addClass(t)},startTimer:function(){s.$li.length?s.automate=setTimeout(function(){o.hide(),o.show(),o.startTimer()},s.timer):clearTimeout(s.automate)},end:function(){s.cookieMonster&&e.cookie(s.cookieName,"ridden",{expires:365,domain:s.cookieDomain,path:s.cookiePath}),s.localStorage&&localStorage.setItem(s.localStorageKey,!0),s.timer>0&&clearTimeout(s.automate),s.modal&&s.expose&&o.un_expose(),s.$current_tip&&s.$current_tip.hide(),s.$li&&(s.postStepCallback(s.$li.index(),s.$current_tip),s.postRideCallback(s.$li.index(),s.$current_tip)),e(".joyride-modal-bg").hide()},jquery_check:function(){return e.isFunction(e.fn.on)?!0:(e.fn.on=function(e,t,n){return this.delegate(t,e,n)},e.fn.off=function(e,t,n){return this.undelegate(t,e,n)},!1)},outerHTML:function(e){return e.outerHTML||(new XMLSerializer).serializeToString(e)},version:function(){return s.version},tabbable:function(t){e(t).on("keydown",function(n){if(!n.isDefaultPrevented()&&n.keyCode&&n.keyCode===27){n.preventDefault(),o.end();return}if(n.keyCode!==9)return;var r=e(t).find(":tabbable"),i=r.filter(":first"),s=r.filter(":last");n.target===s[0]&&!n.shiftKey?(i.focus(1),n.preventDefault()):n.target===i[0]&&n.shiftKey&&(s.focus(1),n.preventDefault())})}};e.fn.joyride=function(t){if(o[t])return o[t].apply(this,Array.prototype.slice.call(arguments,1));if(typeof t=="object"||!t)return o.init.apply(this,arguments);e.error("Method "+t+" does not exist on jQuery.joyride")}})(jQuery,this); diff --git a/core/core.libraries.yml b/core/core.libraries.yml index 93c75768373f..121d74a3ab50 100644 --- a/core/core.libraries.yml +++ b/core/core.libraries.yml @@ -371,13 +371,13 @@ jquery.intrinsic: jquery.joyride: remote: https://github.com/zurb/joyride - version: v2.0.3 + version: v2.1.0 license: name: MIT - url: https://github.com/zurb/joyride/blob/v2.0.3/README.markdown + url: https://github.com/zurb/joyride/blob/v2.1.0/README.markdown gpl-compatible: true js: - assets/vendor/jquery-joyride/jquery.joyride-2.0.3.js: {} + assets/vendor/jquery-joyride/jquery.joyride-2.1.min.js: { minified: true } dependencies: - core/jquery - core/jquery.cookie diff --git a/core/modules/tour/css/tour.module.css b/core/modules/tour/css/tour.module.css index a9fb1c0c37c2..eef5301fa9e8 100644 --- a/core/modules/tour/css/tour.module.css +++ b/core/modules/tour/css/tour.module.css @@ -109,6 +109,13 @@ bottom: auto; } +.joyride-tip-guide .joyride-nub.top-right { + top: -28px; + bottom: auto; + left: auto; + right: 28px; +} + .joyride-tip-guide p { margin: 0 0 1.4em; } @@ -145,3 +152,15 @@ left: 0; cursor: pointer; } + +.joyride-expose-wrapper { + position: absolute; + z-index: 102; +} + +.joyride-expose-cover { + position: absolute; + z-index: 10000; + top: 0; + left: 0; +} diff --git a/core/modules/tour/js/tour.js b/core/modules/tour/js/tour.js index acede2b201d0..487bdd56c73d 100644 --- a/core/modules/tour/js/tour.js +++ b/core/modules/tour/js/tour.js @@ -102,6 +102,7 @@ var that = this; if ($tour.find('li').length) { $tour.joyride({ + autoStart: true, postRideCallback: function () { that.model.set('isActive', false); }, template: { // HTML segments for tip layout link: '<a href=\"#close\" class=\"joyride-close-tip\">×</a>', diff --git a/core/themes/seven/css/components/tour.theme.css b/core/themes/seven/css/components/tour.theme.css index 6353df374a42..a5e0cc424f00 100644 --- a/core/themes/seven/css/components/tour.theme.css +++ b/core/themes/seven/css/components/tour.theme.css @@ -42,6 +42,11 @@ border-left-color: transparent; border-bottom-color: transparent; } +.joyride-tip-guide .joyride-nub.top-right { + border-top-color: transparent; + border-left-color: transparent; + border-right-color: transparent; +} /* Typography */ .joyride-tip-guide h2 { @@ -80,3 +85,11 @@ .joyride-modal-bg { background: rgba(0,0,0, 0.5); } + +.joyride-expose-wrapper { + background-color: #ffffff; +} + +.joyride-expose-cover { + background: transparent; +} -- GitLab