PageSourceSearch

https://generatorspoleczny.pl/vendor/jquery-smartwizard/dist/js/jquery.smartWizard.js

js generatorspoleczny.pl collected 2026-10-05 23:07:45 UTC 31,964 bytes, 1,053 lines download raw bytes

vendor: 4,856 bytes, lines 1-123
1"use strict";
2
3function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4
5function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
6
7function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
8
9function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
10
11/*!
12 * jQuery SmartWizard v5.1.1
13 * The awesome jQuery step wizard plugin
14 * http://www.techlaboratory.net/jquery-smartwizard
15 *
16 * Created by Dipu Raj
17 * http://dipu.me
18 *
19 * @license Licensed under the terms of the MIT License
20 * https://github.com/techlab/jquery-smartwizard/blob/master/LICENSE
21 */
22(function (factory) {
23  if (typeof define === 'function' && define.amd) {
24    // AMD. Register as an anonymous module.
25    define(['jquery'], factory);
26  } else if ((typeof module === "undefined" ? "undefined" : _typeof(module)) === 'object' && module.exports) {
27    // Node/CommonJS
28    module.exports = function (root, jQuery) {
29      if (jQuery === undefined) {
30        // require('jQuery') returns a factory that requires window to
31        // build a jQuery instance, we normalize how we use modules
32        // that require this pattern but the window provided is a noop
33        // if it's defined (how jquery works)
34        if (typeof window !== 'undefined') {
35          jQuery = require('jquery');
36        } else {
37          jQuery = require('jquery')(root);
38        }
39      }
40
41      factory(jQuery);
42      return jQuery;
43    };
44  } else {
45    // Browser globals
46    factory(jQuery);
47  }
48})(function ($) {
49  "use strict"; // Default options
50
51  var defaults = {
52    selected: 0,
53    // Initial selected step, 0 = first step
54    theme: 'default',
55    // theme for the wizard, related css need to include for other than default theme
56    justified: true,
57    // Nav menu justification. true/false
58    darkMode: false,
59    // Enable/disable Dark Mode if the theme supports. true/false
60    autoAdjustHeight: true,
61    // Automatically adjust content height
62    cycleSteps: false,
63    // Allows to cycle the navigation of steps
64    backButtonSupport: true,
65    // Enable the back button support
66    enableURLhash: true,
67    // Enable selection of the step based on url hash
68    transition: {
69      animation: 'none',
70      // Effect on navigation, none/fade/slide-horizontal/slide-vertical/slide-swing
71      speed: '400',
72      // Transion animation speed
73      easing: '' // Transition animation easing. Not supported without a jQuery easing plugin
74
75    },
76    toolbarSettings: {
77      toolbarPosition: 'bottom',
78      // none, top, bottom, both
79      toolbarButtonPosition: 'right',
80      // left, right, center
81      showNextButton: true,
82      // show/hide a Next button
83      showPreviousButton: true,
84      // show/hide a Previous button
85      toolbarExtraButtons: [] // Extra buttons to show on toolbar, array of jQuery input/buttons elements
86
87    },
88    anchorSettings: {
89      anchorClickable: true,
90      // Enable/Disable anchor navigation
91      enableAllAnchors: false,
92      // Activates all anchors clickable all times
93      markDoneStep: true,
94      // Add done state on navigation
95      markAllPreviousStepsAsDone: true,
96      // When a step selected by url hash, all previous steps are marked done
97      removeDoneStepOnNavigateBack: false,
98      // While navigate back done step after active step will be cleared
99      enableAnchorOnDoneStep: true // Enable/Disable the done steps navigation
100
101    },
102    keyboardSettings: {
103      keyNavigation: true,
104      // Enable/Disable keyboard navigation(left and right keys are used if enabled)
105      keyLeft: [37],
106      // Left key code
107      keyRight: [39] // Right key code
108
109    },
110    lang: {
111      // Language variables for button
112      next: 'Next',
113      previous: 'Previous'
114    },
115    disabledSteps: [],
116    // Array Steps disabled
117    errorSteps: [],
118    // Highlight step with errors
119    hiddenSteps: [] // Hidden steps
120
121  };
122
123  var SmartWizard = /*#__PURE__*/function () {
124    function SmartWizard(element, options) {
125      _classCallCheck(this, SmartWizard);
126
127      // Merge user settings with default
128      this.options = $.extend(true, {}, defaults, options); // Main container element
129
130      this.main = $(element); // Navigation bar element
131
132      this.nav = this._getFirstDescendant('.nav'); // Step anchor elements
133
134      this.steps = this.nav.find('.nav-link'); // Content container
135
136      this.container = this._getFirstDescendant('.tab-content'); // Content pages
137
138      this.pages = this.container.children('.tab-pane'); // Assign options
139
140      this._initOptions(); // Initial load
141
142
143      this._initLoad();
144    } // Initial Load Method
145
146
147    _createClass(SmartWizard, [{
148      key: "_initLoad",
149      value: function _initLoad() {
150        // Clean the elements
151        this.pages.hide();
152        this.steps.removeClass('done active'); // Active step index
153
154        this.current_index = null; // Get the initial step index
155
156        var idx = this._getStepIndex(); // Mark any previous steps done
157
158
159        this._setPreviousStepsDone(idx); // Show the initial step
160
161
162        this._showStep(idx);
163      } // Initialize options
164
165    }, {
166      key: "_initOptions",
167      value: function _initOptions() {
168        // Set the elements
169        this._setElements(); // Add toolbar
170
171
172        this._setToolbar(); // Assign plugin events
173
174
175        this._setEvents();
176      }
177    }, {
178      key: "_getFirstDescendant",
179      value: function _getFirstDescendant(selector) {
180        // Check for first level element
181        var elm = this.main.children(selector);
182
183        if (elm.length > 0) {
184          return elm;
185        } // Check for second level element
186
187
188        this.main.children().each(function (i, n) {
189          var tmp = $(n).children(selector);
190
191          if (tmp.length > 0) {
192            elm = tmp;
193            return false;
194          }
195        });
196
197        if (elm.length > 0) {
198          return elm;
199        } // Element not found
200
201
202        this._showError("Element not found " + selector);
203
204        return false;
205      }
206    }, {
207      key: "_setElements",
208      value: function _setElements() {
209        // Set the main element
210        this.main.addClass('sw');
211
212        this._setTheme(this.options.theme);
213
214        this._setJustify(this.options.justified);
215
216        this._setDarkMode(this.options.darkMode); // Set the anchor default style
217
218
219        if (this.options.anchorSettings.enableAllAnchors !== true || this.options.anchorSettings.anchorClickable !== true) {
220          this.steps.addClass('inactive');
221        } // Disabled steps
222
223
224        this._setCSSClass(this.options.disabledSteps, "disabled"); // Error steps
225
226
227        this._setCSSClass(this.options.errorSteps, "danger"); // Hidden steps
228
229
230        this._setCSSClass(this.options.hiddenSteps, "hidden");
231      }
232    }, {
233      key: "_setEvents",
234      value: function _setEvents() {
235        var _this = this;
236
237        // Check if event handler already exists
238        if (this.main.data('click-init')) {
239          return true;
240        } // Flag item to prevent attaching handler again
241
242
243        this.main.data('click-init', true); // Anchor click event
244
245        $(this.steps).on("click", function (e) {
246          e.preventDefault();
247
248          if (_this.options.anchorSettings.anchorClickable === false) {
249            return true;
250          } // Get the step index
251
252
253          var idx = _this.steps.index(e.currentTarget);
254
255          if (idx === _this.current_index) {
256            return true;
257          }
258
259          if (_this.options.anchorSettings.enableAnchorOnDoneStep === false && _this._isDone(idx)) {
260            return true;
261          }
262
263          if (_this.options.anchorSettings.enableAllAnchors !== false || _this._isDone(idx)) {
264            _this._showStep(idx);
265          }
266        }); // Next button event
267
268        this.main.find('.sw-btn-next').on("click", function (e) {
269          e.preventDefault();
270
271          _this._showNext();
272        }); // Previous button event
273
274        this.main.find('.sw-btn-prev').on("click", function (e) {
275          e.preventDefault();
276
277          _this._showPrevious();
278        }); // Keyboard navigation event
279
280        if (this.options.keyboardSettings.keyNavigation) {
281          $(document).keyup(function (e) {
282            _this._keyNav(e);
283          });
284        } // Back/forward browser button event
285
286
287        if (this.options.backButtonSupport) {
288          $(window).on('hashchange', function (e) {
289            var idx = _this._getURLHashIndex();
290
291            if (idx !== false) {
292              e.preventDefault();
293
294              _this._showStep(idx);
295            }
296          });
297        }
298      }
299    }, {
300      key: "_setToolbar",
301      value: function _setToolbar() {
302        // Skip right away if the toolbar is not enabled
303        if (this.options.toolbarSettings.toolbarPosition === 'none') {
304          return true;
305        } // Append toolbar based on the position
306
307
308        switch (this.options.toolbarSettings.toolbarPosition) {
309          case 'top':
310            this.container.before(this._createToolbar('top'));
311            break;
312
313          case 'bottom':
314            this.container.after(this._createToolbar('bottom'));
315            break;
316
317          case 'both':
318            this.container.before(this._createToolbar('top'));
319            this.container.after(this._createToolbar('bottom'));
320            break;
321
322          default:
323            this.container.after(this._createToolbar('bottom'));
324            break;
325        }
326      }
327    }, {
328      key: "_createToolbar",
329      value: function _createToolbar(position) {
330        // Skip if the toolbar is already created
331        if (this.main.find('.toolbar-' + position).length > 0) {
332          return null;
333        }
334
335        var toolbar = $('<div></div>').addClass('toolbar toolbar-' + position).attr('role', 'toolbar'); // Create the toolbar buttons
336
337        var btnNext = this.options.toolbarSettings.showNextButton !== false ? $('<button></button>').text(this.options.lang.next).addClass('btn btn-primary   sw-btn-next').attr('type', 'button') : null;
338        var btnPrevious = this.options.toolbarSettings.showPreviousButton !== false ? $('<button></button>').text(this.options.lang.previous).addClass('btn btn-primary sw-btn-prev').attr('type', 'button') : null;
339        toolbar.append(btnPrevious, btnNext); // Add extra toolbar buttons
340
341        if (this.options.toolbarSettings.toolbarExtraButtons && this.options.toolbarSettings.toolbarExtraButtons.length > 0) {
342          $.each(this.options.toolbarSettings.toolbarExtraButtons, function (_i, n) {
343            toolbar.append(n.clone(true));
344          });
345        }
346
347        toolbar.css('text-align', this.options.toolbarSettings.toolbarButtonPosition);
348        return toolbar;
349      }
350    }, {
351      key: "_showNext",
352      value: function _showNext() {
353        var si = this._getNextShowable(this.current_index);
354
355        if (si === false) {
356          return false;
357        }
358
359        this._showStep(si);
360      }
361    }, {
362      key: "_showPrevious",
363      value: function _showPrevious() {
364        var si = this._getPreviousShowable(this.current_index);
365
366        if (si === false) {
367          return false;
368        }
369
370        this._showStep(si);
371      }
372    }, {
373      key: "_showStep",
374      value: function _showStep(idx) {
375        // If current step is requested again, skip
376        if (idx == this.current_index) {
377          return false;
378        } // If step not found, skip
379
380
381        if (!this.steps.eq(idx)) {
382          return false;
383        } // If it is a disabled step, skip
384
385
386        if (!this._isShowable(idx)) {
387          return false;
388        }
388 // Load step content
389
390
391        this._loadStep(idx);
392      }
393    }, {
394      key: "_getNextShowable",
395      value: function _getNextShowable(idx) {
396        var si = false; // Find the next showable step
397
398        for (var i = idx + 1; i < this.steps.length; i++) {
399          if (this._isShowable(i)) {
400            si = i;
401            break;
402          }
403        }
404
405        if (si !== false && this.steps.length <= si) {
406          if (!this.options.cycleSteps) {
407            return false;
408          }
409
410          si = 0;
411        }
412
413        return si;
414      }
415    }, {
416      key: "_getPreviousShowable",
417      value: function _getPreviousShowable(idx) {
418        var si = false; // Find the previous showable step
419
420        for (var i = idx - 1; i >= 0; i--) {
421          if (this._isShowable(i)) {
422            si = i;
423            break;
424          }
425        }
426
427        if (si !== false && 0 > si) {
428          if (!this.options.cycleSteps) {
429            return false;
430          }
431
432          si = this.steps.length - 1;
433        }
434
435        return si;
436      }
437    }, {
438      key: "_isShowable",
439      value: function _isShowable(idx) {
440        var elm = this.steps.eq(idx);
441
442        if (elm.hasClass('disabled') || elm.hasClass('hidden')) {
443          return false;
444        }
445
446        return true;
447      }
448    }, {
449      key: "_isDone",
450      value: function _isDone(idx) {
451        var elm = this.steps.eq(idx);
452
453        if (elm.hasClass('done')) {
454          return true;
455        }
456
457        return false;
458      }
459    }, {
460      key: "_setPreviousStepsDone",
461      value: function _setPreviousStepsDone(idx) {
462        if (idx > 0 && this.options.anchorSettings.markDoneStep && this.options.anchorSettings.markAllPreviousStepsAsDone) {
463          // Mark previous steps of the active step as done
464          for (var i = idx; i >= 0; i--) {
465            this._setCSSClass(i, "done");
466          }
467        }
468      }
469    }, {
470      key: "_setCSSClass",
471      value: function _setCSSClass(idx, cls) {
472        var _this2 = this;
473
474        if (idx === null) {
475          return false;
476        }
477
478        var idxs = $.isArray(idx) ? idx : [idx];
479        idxs.map(function (i) {
480          _this2.steps.eq(i).addClass(cls);
481        });
482      }
483    }, {
484      key: "_resetCSSClass",
485      value: function _resetCSSClass(idx, cls) {
486        var _this3 = this;
487
488        var idxs = $.isArray(idx) ? idx : [idx];
489        idxs.map(function (i) {
490          _this3.steps.eq(i).removeClass(cls);
491        });
492      }
493    }, {
494      key: "_getStepDirection",
495      value: function _getStepDirection(idx) {
496        if (this.current_index == null) {
497          return '';
498        }
499
500        return this.current_index < idx ? "forward" : "backward";
501      }
502    }, {
503      key: "_getStepPosition",
504      value: function _getStepPosition(idx) {
505        var stepPosition = 'middle';
506
507        if (idx === 0) {
508          stepPosition = 'first';
509        } else if (idx === this.steps.length - 1) {
510          stepPosition = 'last';
511        }
512
513        return stepPosition;
514      }
515    }, {
516      key: "_getStepAnchor",
517      value: function _getStepAnchor(idx) {
518        if (idx == null) {
519          return null;
520        }
521
522        return this.steps.eq(idx);
523      }
524    }, {
525      key: "_getStepPage",
526      value: function _getStepPage(idx) {
527        if (idx == null) {
528          return null;
529        }
530
531        var anchor = this._getStepAnchor(idx);
532
533        return anchor.length > 0 ? this.main.find(anchor.attr("href")) : null;
534      }
535    }, {
536      key: "_setStepContent",
537      value: function _setStepContent(idx, html) {
538        var page = this._getStepPage(idx);
539
540        if (page) {
541          page.html(html);
542        }
543      }
544    }, {
545      key: "_loadStep",
546      value: function _loadStep(idx) {
547        var _this4 = this;
548
549        // Get current step element
550        var curStep = this._getStepAnchor(this.current_index); // Get step direction
551
552
553        var stepDirection = this._getStepDirection(idx); // Get the direction of step navigation
554
555
556        if (this.current_index !== null) {
557          // Trigger "leaveStep" event
558          if (this._triggerEvent("leaveStep", [curStep, this.current_index, idx, stepDirection]) === false) {
559            return false;
560          }
561        } // Get next step element
562
563
564        var selStep = this._getStepAnchor(idx); // Get the content if used
565
566
567        var getStepContent = this._triggerEvent("stepContent", [selStep, idx, stepDirection]);
568
569        if (getStepContent) {
570          if (_typeof(getStepContent) == "object") {
571            getStepContent.then(function (res) {
572              _this4._setStepContent(idx, res);
573
574              _this4._transitStep(idx);
575            })["catch"](function (err) {
576              console.error(err);
577
578              _this4._setStepContent(idx, err);
579
580              _this4._transitStep(idx);
581            });
582          } else if (typeof getStepContent == "string") {
583            this._setStepContent(idx, getStepContent);
584
585            this._transitStep(idx);
586          } else {
587            this._transitStep(idx);
588          }
589        } else {
590          this._transitStep(idx);
591        }
592      }
593    }, {
594      key: "_transitStep",
595      value: function _transitStep(idx) {
596        var _this5 = this;
597
598        // Get step to show element
599        var selStep = this._getStepAnchor(idx); // Change the url hash to new step
600
601
602        this._setURLHash(selStep.attr("href")); // Update controls
603
604
605        this._setAnchor(idx); // Get the direction of step navigation
606
607
608        var stepDirection = this._getStepDirection(idx); // Get the position of step
609
610
611        var stepPosition = this._getStepPosition(idx); // Animate the step
612
613
614        this._doStepAnimation(idx, function () {
615          // Fix height with content
616          _this5._fixHeight(idx);
616 // Trigger "showStep" event
617
618
619          _this5._triggerEvent("showStep", [selStep, _this5.current_index, stepDirection, stepPosition]);
620        }); // Update the current index
621
622
623        this.current_index = idx; // Set the buttons based on the step
624
625        this._setButtons(idx);
626      }
627    }, {
628      key: "_doStepAnimation",
629      value: function _doStepAnimation(idx, callback) {
630        var _this6 = this;
631
632        // Get current step element
633        var curPage = this._getStepPage(this.current_index); // Get next step element
634
635
636        var selPage = this._getStepPage(idx); // Get the animation
637
638
639        var animation = this.options.transition.animation.toLowerCase(); // Complete any ongoing animations
640
641        this._stopAnimations();
642
643        switch (animation) {
644          case 'slide-horizontal':
645          case 'slide-h':
646            // horizontal slide
647            var containerWidth = this.container.width();
648            var curLastLeft = containerWidth;
649            var nextFirstLeft = containerWidth * -2; // Forward direction
650
651            if (idx > this.current_index) {
652              curLastLeft = containerWidth * -1;
653              nextFirstLeft = containerWidth;
654            } // First load set the container width
655
656
657            if (this.current_index == null) {
658              this.container.height(selPage.outerHeight());
659            }
660
661            var css_pos, css_left;
662
663            if (curPage) {
664              css_pos = curPage.css("position");
665              css_left = curPage.css("left");
666              curPage.css("position", 'absolute').css("left", 0).animate({
667                left: curLastLeft
668              }, this.options.transition.speed, this.options.transition.easing, function () {
669                $(this).hide();
670                curPage.css("position", css_pos).css("left", css_left);
671              });
672            }
673
674            css_pos = selPage.css("position");
675            css_left = selPage.css("left");
676            selPage.css("position", 'absolute').css("left", nextFirstLeft).outerWidth(containerWidth).show().animate({
677              left: 0
678            }, this.options.transition.speed, this.options.transition.easing, function () {
679              selPage.css("position", css_pos).css("left", css_left);
680              callback();
681            });
682            break;
683
684          case 'slide-vertical':
685          case 'slide-v':
686            // vertical slide
687            var containerHeight = this.container.height();
688            var curLastTop = containerHeight;
689            var nextFirstTop = containerHeight * -2; // Forward direction
690
691            if (idx > this.current_index) {
692              curLastTop = containerHeight * -1;
693              nextFirstTop = containerHeight;
694            }
695
696            var css_vpos, css_vtop;
697
698            if (curPage) {
699              css_vpos = curPage.css("position");
700              css_vtop = curPage.css("top");
701              curPage.css("position", 'absolute').css("top", 0).animate({
702                top: curLastTop
703              }, this.options.transition.speed, this.options.transition.easing, function () {
704                $(this).hide();
705                curPage.css("position", css_vpos).css("top", css_vtop);
706              });
707            }
708
709            css_vpos = selPage.css("position");
710            css_vtop = selPage.css("top");
711            selPage.css("position", 'absolute').css("top", nextFirstTop).show().animate({
712              top: 0
713            }, this.options.transition.speed, this.options.transition.easing, function () {
714              selPage.css("position", css_vpos).css("top", css_vtop);
715              callback();
716            });
717            break;
718
719          case 'slide-swing':
720          case 'slide-s':
721            // normal slide
722            if (curPage) {
723              curPage.slideUp('fast', this.options.transition.easing, function () {
724                selPage.slideDown(_this6.options.transition.speed, _this6.options.transition.easing, function () {
725                  callback();
726                });
727              });
728            } else {
729              selPage.slideDown(this.options.transition.speed, this.options.transition.easing, function () {
730                callback();
731              });
732            }
733
734            break;
735
736          case 'fade':
737            // normal fade
738            if (curPage) {
739              curPage.fadeOut('fast', this.options.transition.easing, function () {
740                selPage.fadeIn('fast', _this6.options.transition.easing, function () {
741                  callback();
742                });
743              });
744            } else {
745              selPage.fadeIn(this.options.transition.speed, this.options.transition.easing, function () {
746                callback();
747              });
748            }
749
750            break;
751
752          default:
753            if (curPage) {
754              curPage.hide();
755            }
756
757            selPage.show();
758            callback();
759            break;
760        }
761      }
762    }, {
763      key: "_stopAnimations",
764      value: function _stopAnimations() {
765        this.pages.finish();
766        this.container.finish();
767      }
768    }, {
769      key: "_setAnchor",
770      value: function _setAnchor(idx) {
771        // Current step anchor > Remove other classes and add done class
772        this._resetCSSClass(this.current_index, "active");
773
774        if (this.options.anchorSettings.markDoneStep !== false && this.current_index !== null) {
775          this._setCSSClass(this.current_index, "done");
776
777          if (this.options.anchorSettings.removeDoneStepOnNavigateBack !== false && this._getStepDirection(idx) === 'backward') {
778            this._resetCSSClass(this.current_index, "done");
779          }
780        } // Next step anchor > Remove other classes and add active class
781
782
783        this._resetCSSClass(idx, "done");
784
785        this._setCSSClass(idx, "active");
786      }
787    }, {
788      key: "_setButtons",
789      value: function _setButtons(idx) {
790        // Previous/Next Button enable/disable based on step
791        if (!this.options.cycleSteps) {
792          this.main.find('.sw-btn-prev').removeClass("disabled");
793          this.main.find('.sw-btn-next').removeClass("disabled");
794
795          switch (this._getStepPosition(idx)) {
796            case 'first':
797              this.main.find('.sw-btn-prev').addClass("disabled");
798              break;
799
800            case 'last':
801              this.main.find('.sw-btn-next').addClass("disabled");
802              break;
803
804            default:
805              if (this._getNextShowable(idx) === false) {
806                this.main.find('.sw-btn-next').addClass("disabled");
807              }
808
809              if (this._getPreviousShowable(idx) === false) {
810                this.main.find('.sw-btn-prev').addClass("disabled");
811              }
812
813              break;
814          }
815        }
816      }
817    }, {
818      key: "_getStepIndex",
819      value: function _getStepIndex() {
820        // Get selected step from the url
821        var idx = this._getURLHashIndex();
822
823        return idx === false ? this.options.selected : idx;
824      }
825    }, {
826      key: "_setTheme",
827      value: function _setTheme(theme) {
828        this.main.removeClass(function (index, className) {
829          return (className.match(/(^|\s)sw-theme-\S+/g) || []).join(' ');
830        }).addClass('sw-theme-' + theme);
831      }
832    }, {
833      key: "_setJustify",
834      value: function _setJustify(justified) {
835        if (justified === true) {
836          this.main.addClass('sw-justified');
837        } else {
838          this.main.removeClass('sw-justified');
839        }
840      }
841    }, {
842      key: "_setDarkMode",
843      value: function _setDarkMode(darkMode) {
844        if (darkMode === true) {
845          this.main.addClass('sw-dark');
846        } else {
847          this.main.removeClass('sw-dark');
848        }
849      } // HELPER FUNCTIONS
850
851    }, {
852      key: "_keyNav",
853      value: function _keyNav(e) {
854        // Keyboard navigation
855        if ($.inArray(e.which, this.options.keyboardSettings.keyLeft) > -1) {
856          // left
857          this._showPrevious();
858
859          e.preventDefault();
860        } else if ($.inArray(e.which, this.options.keyboardSettings.keyRight) > -1) {
861          // right
862          this._showNext();
863
864          e.preventDefault();
865        } else {
866          return; // exit this handler for other keys
867        }
868      }
869    }, {
870      key: "_fixHeight",
871      value: function _fixHeight(idx) {
872        // Auto adjust height of the container
873        if (this.options.autoAdjustHeight) {
874          var selPage = this._getStepPage(idx);
875
876          this.container.finish().animate({
877            height: selPage.outerHeight()
878          }, this.options.transition.speed);
879        }
880      }
881    }, {
882      key: "_triggerEvent",
883      value: function _triggerEvent(name, params) {
884        // Trigger an event
885        var e = $.Event(name);
886        this.main.trigger(e, params);
887
888        if (e.isDefaultPrevented()) {
889          return false;
890        }
891
892        return e.result;
893      }
894    }, {
895      key: "_setURLHash",
896      value: function _setURLHash(hash) {
897        if (this.options.enableURLhash && window.location.hash !== hash) {
898          history.pushState(null, null, hash);
899        }
900      }
901    }, {
902      key: "_getURLHashIndex",
903      value: function _getURLHashIndex() {
904        if (this.options.enableURLhash) {
905          // Get step number from url hash if available
906          var hash = window.location.hash;
907
908          if (hash.length > 0) {
909            var elm = this.nav.find("a[href*='" + hash + "']");
910
911            if (elm.length > 0) {
912              return this.steps.index(elm);
913            }
914          }
915        }
916
917        return false;
918      }
919    }, {
920      key: "_loader",
921      value: function _loader(action) {
922        switch (action) {
923          case 'show':
924            this.main.addClass('sw-loading');
925            break;
926
927          case 'hide':
928            this.main.removeClass('sw-loading');
929            break;
930
931          default:
932            this.main.toggleClass('sw-loading');
933        }
934      }
935    }, {
936      key: "_showError",
937      value: function _showError(msg) {
938        console.error(msg);
939      } // PUBLIC FUNCTIONS
940
941    }, {
942      key: "goToStep",
943      value: function goToStep(stepIndex) {
944        this._showStep(stepIndex);
945      }
946    }, {
947      key: "next",
948      value: function next() {
949        this._showNext();
950      }
951    }, {
952      key: "prev",
953      value: function prev() {
954        this._showPrevious();
955      }
956    }, {
957      key: "reset",
958      value: function reset() {
959        // Reset all
960        this._setURLHash('#');
961
962        this._initOptions();
963
964        this._initLoad();
965      }
966    }, {
967      key: "stepState",
968      value: function stepState(stepArray, state) {
969        if (!stepArray) {
970          return false;
971        }
972
973        switch (state) {
974          case 'disable':
975            this._setCSSClass(stepArray, 'disabled');
976
977            break;
978
979          case 'enable':
980            this._resetCSSClass(stepArray, 'disabled');
981
982            break;
983
984          case 'hide':
985            this._setCSSClass(stepArray, 'hidden');
986
987            break;
988
989          case 'show':
990            this._resetCSSClass(stepArray, 'hidden');
991
992            break;
993
994          case 'error-on':
995            this._setCSSClass(stepArray, 'danger');
996
997            break;
998
999          case 'error-off':
1000            this._resetCSSClass(stepArray, 'danger');
1001
1002            break;
1003        }
1004      }
1005    }, {
1006      key: "setOptions",
1007      value: function setOptions(options) {
1008        this.options = $.extend(true, {}, this.options, options);
1009
1010        this._initOptions();
1011      }
1012    }, {
1013      key: "getStepIndex",
1014      value: function getStepIndex() {
1015        return this.current_index;
1016      }
1017    }, {
1018      key: "loader",
1019      value: function loader(state) {
1020        if (state === "show") {
1021          this.main.addClass('sw-loading');
1022        } else {
1023          this.main.removeClass('sw-loading');
1024        }
1025      }
1026    }]);
1027
1028    return SmartWizard;
1029  }(); // Wrapper for the plugin
1030
1031
1032  $.fn.smartWizard = function (options) {
1033    if (options === undefined || _typeof(options) === 'object') {
1034      return this.each(function () {
vendor: 622 bytes, lines 1035-1053
1035        if (!$.data(this, "smartWizard")) {
1036          $.data(this, "smartWizard", new SmartWizard(this, options));
1037        }
1038      });
1039    } else if (typeof options === 'string' && options[0] !== '_' && options !== 'init') {
1040      var instance = $.data(this[0], 'smartWizard');
1041
1042      if (options === 'destroy') {
1043        $.data(this, 'smartWizard', null);
1044      }
1045
1046      if (instance instanceof SmartWizard && typeof instance[options] === 'function') {
1047        return instance[options].apply(instance, Array.prototype.slice.call(arguments, 1));
1048      } else {
1049        return this;
1050      }
1051    }
1052  };
1053});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.