Commit 9e49307d authored by Dries's avatar Dries
Browse files

Issue #1809352 by nick_schuch, larowlan, jthorson, Wim Leers, Devin Carlson,...

Issue #1809352 by nick_schuch, larowlan, jthorson, Wim Leers, Devin Carlson, effulgentsia, tim.plunkett, jessebeach | cweagans: Added Write tour.module and add it to core.
parent 395d3a6b
/* Artfully masterminded by ZURB */
#joyRideTipContent { display: none; }
/* Default styles for the container */
.joyride-tip-guide {
position: absolute;
background: #000;
background: rgba(0,0,0,0.8);
display: none;
color: #fff;
width: 300px;
z-index: 101;
top: 0; /* keeps the page from scrolling when calculating position */
left: 0;
font-family: "HelveticaNeue", "Helvetica Neue", "Helvetica", Helvetica, Arial, Lucida, sans-serif;
font-weight: normal;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
}
.joyride-content-wrapper {
padding: 10px 10px 15px 15px;
}
/* Mobile */
@media only screen and (max-width: 767px) {
.joyride-tip-guide {
width: 95% !important;
-moz-border-radius: 0;
-webkit-border-radius: 0;
border-radius: 0;
left: 2.5% !important;
}
.joyride-tip-guide-wrapper {
width: 100%;
}
}
/* Add a little css triangle pip, older browser just miss out on the fanciness of it */
.joyride-tip-guide span.joyride-nub {
display: block;
position: absolute;
left: 22px;
width: 0;
height: 0;
border: solid 14px;
border: solid 14px;
}
.joyride-tip-guide span.joyride-nub.top {
/*
IE7/IE8 Don't support rgba so we set the fallback
border color here. However, IE7/IE8 are also buggy
in that the fallback color doesn't work for
border-bottom-color so here we set the border-color
and override the top,left,right colors below.
*/
border-color: #000;
border-color: rgba(0,0,0,0.8);
border-top-color: transparent !important;
border-left-color: transparent !important;
border-right-color: transparent !important;
top: -28px;
bottom: none;
}
.joyride-tip-guide span.joyride-nub.bottom {
/*
IE7/IE8 Don't support rgba so we set the fallback
border color here. However, IE7/IE8 are also buggy
in that the fallback color doesn't work for
border-top-color so here we set the border-color
and override the bottom,left,right colors below.
*/
border-color: #000;
border-color: rgba(0,0,0,0.8) !important;
border-bottom-color: transparent !important;
border-left-color: transparent !important;
border-right-color: transparent !important;
bottom: -28px;
bottom: none;
}
.joyride-tip-guide span.joyride-nub.right {
border-color: #000;
border-color: rgba(0,0,0,0.8) !important;
border-top-color: transparent !important;
border-right-color: transparent !important;
border-bottom-color: transparent !important;
top: 22px;
bottom: none;
left: auto;
right: -28px;
}
.joyride-tip-guide span.joyride-nub.left {
border-color: #000;
border-color: rgba(0,0,0,0.8) !important;
border-top-color: transparent !important;
border-left-color: transparent !important;
border-bottom-color: transparent !important;
top: 22px;
left: -28px;
right: auto;
bottom: none;
}
/* Typography */
.joyride-tip-guide h1,.joyride-tip-guide h2,.joyride-tip-guide h3,.joyride-tip-guide h4,.joyride-tip-guide h5,.joyride-tip-guide h6 {
line-height: 1.25;
margin: 0;
font-weight: bold;
color: #fff;
}
.joyride-tip-guide h1 { font-size: 30px; }
.joyride-tip-guide h2 { font-size: 26px; }
.joyride-tip-guide h3 { font-size: 22px; }
.joyride-tip-guide h4 { font-size: 18px; }
.joyride-tip-guide h5 { font-size: 16px; }
.joyride-tip-guide h6 { font-size: 14px; }
.joyride-tip-guide p {
margin: 0 0 18px 0;
font-size: 14px;
line-height: 18px;
}
.joyride-tip-guide a {
color: rgb(255,255,255);
text-decoration: none;
border-bottom: dotted 1px rgba(255,255,255,0.6);
}
.joyride-tip-guide a:hover {
color: rgba(255,255,255,0.8);
border-bottom: none;
}
/* Button Style */
.joyride-tip-guide .joyride-next-tip {
width: auto;
padding: 6px 18px 4px;
font-size: 13px;
text-decoration: none;
color: rgb(255,255,255);
border: solid 1px rgb(0,60,180);
background: rgb(0,99,255);
background: -moz-linear-gradient(top, rgb(0,99,255) 0%, rgb(0,85,214) 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgb(0,99,255)), color-stop(100%,rgb(0,85,214)));
background: -webkit-linear-gradient(top, rgb(0,99,255) 0%,rgb(0,85,214) 100%);
background: -o-linear-gradient(top, rgb(0,99,255) 0%,rgb(0,85,214) 100%);
background: -ms-linear-gradient(top, rgb(0,99,255) 0%,rgb(0,85,214) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#0063ff', endColorstr='#0055d6',GradientType=0 );
background: linear-gradient(top, rgb(0,99,255) 0%,rgb(0,85,214) 100%);
text-shadow: 0 -1px 0 rgba(0,0,0,0.5);
-webkit-border-radius: 2px;
-moz-border-radius: 2px;
border-radius: 2px;
-webkit-box-shadow: 0px 1px 0px rgba(255,255,255,0.3) inset;
-moz-box-shadow: 0px 1px 0px rgba(255,255,255,0.3) inset;
box-shadow: 0px 1px 0px rgba(255,255,255,0.3) inset;
}
.joyride-next-tip:hover {
color: rgb(255,255,255) !important;
border: solid 1px rgb(0,60,180) !important;
background: rgb(43,128,255);
background: -moz-linear-gradient(top, rgb(43,128,255) 0%, rgb(29,102,211) 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgb(43,128,255)), color-stop(100%,rgb(29,102,211)));
background: -webkit-linear-gradient(top, rgb(43,128,255) 0%,rgb(29,102,211) 100%);
background: -o-linear-gradient(top, rgb(43,128,255) 0%,rgb(29,102,211) 100%);
background: -ms-linear-gradient(top, rgb(43,128,255) 0%,rgb(29,102,211) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#2b80ff', endColorstr='#1d66d3',GradientType=0 );
background: linear-gradient(top, rgb(43,128,255) 0%,rgb(29,102,211) 100%);
}
.joyride-timer-indicator-wrap {
width: 50px;
height: 3px;
border: solid 1px rgba(255,255,255,0.1);
position: absolute;
right: 17px;
bottom: 16px;
}
.joyride-timer-indicator {
display: block;
width: 0;
height: inherit;
background: rgba(255,255,255,0.25);
}
.joyride-close-tip {
position: absolute;
right: 10px;
top: 10px;
color: rgba(255,255,255,0.4) !important;
text-decoration: none;
font-family: Verdana, sans-serif;
font-size: 10px;
font-weight: bold;
border-bottom: none !important;
}
.joyride-close-tip:hover {
color: rgba(255,255,255,0.9) !important;
}
.joyride-modal-bg {
position: fixed;
height: 100%;
width: 100%;
background: rgb(0,0,0);
background: transparent;
background: rgba(0,0,0, 0.5);
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
filter: alpha(opacity=50);
opacity: 0.5;
z-index: 100;
display: none;
top: 0;
left: 0;
cursor: pointer;
}
/**
* @file
* RTL styling for tour module.
*/
.js .toolbar .bar .tour-toolbar-tab.tab {
float: left;
}
.tour-progress {
right: 0;
left: 15px;
}
/**
* @file
* Styling for tour module.
*/
/* Tab appearance. */
.js .toolbar .bar .tour-toolbar-tab.tab {
float: right; /* LTR */
}
.js .toolbar .bar .tour-toolbar-tab button {
padding-bottom: 1em;
padding-top: 1em;
color: #fff;
font-weight: bold;
}
.js .toolbar .bar .tour-toolbar-tab button.active {
background-image: -webkit-linear-gradient(rgba(255, 255, 255, 0.25) 20%, transparent 200%);
background-image: linear-gradient(rgba(255, 255, 255, 0.25) 20%, transparent 200%);
}
/* Joyride tips should always be on top of everything else. */
.joyride-tip-guide {
z-index: 999;
}
/* Override placement of the tour progress indicator. */
.tour-progress {
position: absolute;
bottom: 10px;
right: 15px; /* LTR */
}
/* @todo Remove once http://drupal.org/node/1916690 is resolved. */
.js .toolbar .bar .tour-toolbar-tab.tab.element-hidden {
display: none;
}
/*
* 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();