Mattflaschen has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/60788


Change subject: Allow arbitrary function for okay button, fix to resumeTour:
......................................................................

Allow arbitrary function for okay button, fix to resumeTour:

* Correctly handle default step in resumeTour.

Change-Id: I59add6878b10a111c19efab57562634116bec182
---
M modules/ext.guidedTour.lib.js
1 file changed, 8 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GuidedTour 
refs/changes/88/60788/1

diff --git a/modules/ext.guidedTour.lib.js b/modules/ext.guidedTour.lib.js
index 25da1bc..180a91f 100644
--- a/modules/ext.guidedTour.lib.js
+++ b/modules/ext.guidedTour.lib.js
@@ -389,6 +389,9 @@
                                        case 'next':
                                                okayButton = 
getConditionalOkayButton( next );
                                                break;
+                                       case 'okay':
+                                               okayButton = 
getConditionalOkayButton( currentButton.onclick );
+                                               break;
                                        case 'end':
                                                okayButton = getOkayButton( 
endTour );
                                                break;
@@ -950,20 +953,20 @@
                 * @return {void}
                 */
                resumeTour: function ( tourName ) {
-                       var step = gt.getStep();
+                       var step = gt.getStep() || 0;
                        // Bind failure step (in case there are problems).
                        guiders.failStep = gt.makeTourId( {
                                name: tourName,
                                step: 'fail'
                        } );
-                       if ( (step === 0) && $.cookie( guiders.cookie ) ) {
+                       if ( ( step === 0 ) && $.cookie( guiders.cookie ) ) {
                                // start from cookie position
                                if ( guiders.resume() ) {
                                        return;
                                }
                        }
 
-                       if (step === 0) {
+                       if ( step === 0 ) {
                                step = 1;
                        }
                        // start from step specified
@@ -1062,7 +1065,7 @@
                 * @param {Function} tourSpec.steps.buttons.onclick Function to 
execute
                 *  when button is clicked
                 *
-                * @param {"next"|"end"|"wikiLink"|"externalLink"} 
tourSpec.steps.buttons.action
+                * @param {"next"|"okay"|"end"|"wikiLink"|"externalLink"} 
tourSpec.steps.buttons.action
                 *  Action keyword.  For actions listed below, you do not need 
to manually
                 *  specify button name and onclick.
                 *
@@ -1070,6 +1073,7 @@
                 *  actions currently supported are:
                 *
                 *  - next - Goes to the next step.
+                *  - okay - Arbitrary function (passed as onclick) used for 
okay button
                 *  - end - Ends the tour.
                 *  - wikiLink - links to a page on the same wiki
                 *  - externalLink - links to an external page

-- 
To view, visit https://gerrit.wikimedia.org/r/60788
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I59add6878b10a111c19efab57562634116bec182
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GuidedTour
Gerrit-Branch: master
Gerrit-Owner: Mattflaschen <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to