diff --git a/core/modules/tour/css/joyride-2.0.3.css b/core/modules/tour/css/joyride-2.0.3.css
index ba103f0..3c01296 100644
--- a/core/modules/tour/css/joyride-2.0.3.css
+++ b/core/modules/tour/css/joyride-2.0.3.css
@@ -136,7 +136,8 @@
}
/* Button Style */
-.joyride-tip-guide .joyride-next-tip {
+.joyride-tip-guide .joyride-next-tip,
+.joyride-tip-guide .joyride-prev-tip {
width: auto;
padding: 6px 18px 4px;
font-size: 13px;
@@ -160,6 +161,10 @@
box-shadow: 0px 1px 0px rgba(255,255,255,0.3) inset;
}
+.joyride-tip-guide .joyride-prev-tip {
+ margin-right: 5px;
+}
+
.joyride-next-tip:hover {
color: rgb(255,255,255) !important;
border: solid 1px rgb(0,60,180) !important;
diff --git a/core/modules/tour/js/jquery.joyride-2.0.3.js b/core/modules/tour/js/jquery.joyride-2.0.3.js
index b144fb9..b8f7887 100644
--- a/core/modules/tour/js/jquery.joyride-2.0.3.js
+++ b/core/modules/tour/js/jquery.joyride-2.0.3.js
@@ -19,6 +19,7 @@
'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)
+ 'prevButton' : true, // true or false to control whether a prev button is used
'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
@@ -34,7 +35,8 @@
'timer' : '
',
'tip' : '
',
'wrapper' : '',
- 'button' : ''
+ 'prevButton' : '',
+ 'nextButton' : ''
}
},
@@ -109,6 +111,23 @@
});
+ settings.$document.on('click.joyride', '.joyride-prev-tip', function (e) {
+ e.preventDefault();
+
+ if (settings.$li.prev().length < 1) {
+ methods.end();
+ } else if (settings.timer > 0) {
+ clearTimeout(settings.automate);
+ methods.hide();
+ methods.show();
+ methods.startTimer();
+ } else {
+ methods.hide();
+ methods.show(false, true);
+ }
+
+ });
+
settings.$document.on('click.joyride', '.joyride-close-tip', function (e) {
e.preventDefault();
methods.end();
@@ -141,7 +160,8 @@
$blank = $(settings.template.tip).addClass(opts.tip_class);
content = $.trim($(opts.li).html()) +
- methods.button_text(opts.button_text) +
+ methods.prev_button_text(opts.next_prev_text, opts.index) +
+ methods.next_button_text(opts.next_button_text) +
settings.template.link +
methods.timer_instance(opts.index);
@@ -170,10 +190,20 @@
return txt;
},
- button_text : function (txt) {
+ next_button_text : function (txt) {
if (settings.nextButton) {
txt = $.trim(txt) || 'Next';
- txt = methods.outerHTML($(settings.template.button).append(txt)[0]);
+ txt = methods.outerHTML($(settings.template.nextButton).append(txt)[0]);
+ } else {
+ txt = '';
+ }
+ return txt;
+ },
+
+ prev_button_text : function (txt, index) {
+ if (settings.prevButton && index > 0) {
+ txt = $.trim(txt) || 'Previous';
+ txt = methods.outerHTML($(settings.template.prevButton).append(txt)[0]);
} else {
txt = '';
}
@@ -182,19 +212,21 @@
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
- }));
+ var nextButtonText = opts.$li.attr('data-next-button') || opts.$li.attr('data-button') || opts.$li.attr('data-text');
+ var prevButtonText = opts.$li.attr('data-prev-button');
+ var tipClass = opts.$li.attr('class');
+ var $tip_content = $(methods.tip_template({
+ tip_class : tipClass,
+ index : opts.index,
+ next_button_text : nextButtonText,
+ prev_button_text : prevButtonText,
+ li : opts.$li
+ }));
$(settings.tipContainer).append($tip_content);
},
- show : function (init) {
+ show : function (init, prev) {
var opts = {}, ii, opts_arr = [], opts_len = 0, p,
$timer = null;
@@ -205,7 +237,7 @@
if (settings.paused) {
settings.paused = false;
} else {
- methods.set_li(init);
+ methods.set_li(init, prev);
}
settings.attempts = 0;
@@ -315,13 +347,18 @@
settings.$current_tip.hide();
},
- set_li : function (init) {
+ set_li : function (init, prev) {
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();
+ if (prev) {
+ settings.$li = settings.$li.prev();
+ }
+ else {
+ settings.$li = settings.$li.next();
+ }
methods.set_next_tip();
}