PageSourceSearch

https://britishlistedbuildings.co.uk/js/foundation/foundation.joyride.js

js britishlistedbuildings.co.uk collected 2026-09-24 08:59:30 UTC 30,626 bytes, 932 lines download raw bytes

vendor: 30,626 bytes, lines 1-932
1;(function ($, window, document, undefined) {
2  'use strict';
3
4  var Modernizr = Modernizr || false;
5
6  Foundation.libs.joyride = {
7    name : 'joyride',
8
9    version : '5.5.1',
10
11    defaults : {
12      expose                   : false,     // turn on or off the expose feature
13      modal                    : true,      // Whether to cover page with modal during the tour
14      keyboard                 : true,      // enable left, right and esc keystrokes
15      tip_location             : 'bottom',  // 'top' or 'bottom' in relation to parent
16      nub_position             : 'auto',    // override on a per tooltip bases
17      scroll_speed             : 1500,      // Page scrolling speed in milliseconds, 0 = no scroll animation
18      scroll_animation         : 'linear',  // supports 'swing' and 'linear', extend with jQuery UI.
19      timer                    : 0,         // 0 = no timer , all other numbers = timer in milliseconds
20      start_timer_on_click     : true,      // true or false - true requires clicking the first button start the timer
21      start_offset             : 0,         // the index of the tooltip you want to start on (index of the li)
22      next_button              : true,      // true or false to control whether a next button is used
23      prev_button              : true,      // true or false to control whether a prev button is used
24      tip_animation            : 'fade',    // 'pop' or 'fade' in each tip
25      pause_after              : [],        // array of indexes where to pause the tour after
26      exposed                  : [],        // array of expose elements
27      tip_animation_fade_speed : 300,       // when tipAnimation = 'fade' this is speed in milliseconds for the transition
28      cookie_monster           : false,     // true or false to control whether cookies are used
29      cookie_name              : 'joyride', // Name the cookie you'll use
30      cookie_domain            : false,     // Will this cookie be attached to a domain, ie. '.notableapp.com'
31      cookie_expires           : 365,       // set when you would like the cookie to expire.
32      tip_container            : 'body',    // Where will the tip be attached
33      abort_on_close           : true,      // When true, the close event will not fire any callback
34      tip_location_patterns    : {
35        top : ['bottom'],
36        bottom : [], // bottom should not need to be repositioned
37        left : ['right', 'top', 'bottom'],
38        right : ['left', 'top', 'bottom']
39      },
40      post_ride_callback     : function () {},    // A method to call once the tour closes (canceled or complete)
41      post_step_callback     : function () {},    // A method to call after each step
42      pre_step_callback      : function () {},    // A method to call before each step
43      pre_ride_callback      : function () {},    // A method to call before the tour starts (passed index, tip, and cloned exposed element)
44      post_expose_callback   : function () {},    // A method to call after an element has been exposed
45      template : { // HTML segments for tip layout
46        link          : '<a href="#close" class="joyride-close-tip">&times;</a>',
47        timer         : '<div class="joyride-timer-indicator-wrap"><span class="joyride-timer-indicator"></span></div>',
48        tip           : '<div class="joyride-tip-guide"><span class="joyride-nub"></span></div>',
49        wrapper       : '<div class="joyride-content-wrapper"></div>',
50        button        : '<a href="#" class="small button joyride-next-tip"></a>',
51        prev_button   : '<a href="#" class="small button joyride-prev-tip"></a>',
52        modal         : '<div class="joyride-modal-bg"></div>',
53        expose        : '<div class="joyride-expose-wrapper"></div>',
54        expose_cover  : '<div class="joyride-expose-cover"></div>'
55      },
56      expose_add_class : '' // One or more space-separated class names to be added to exposed element
57    },
58
59    init : function (scope, method, options) {
60      Foundation.inherit(this, 'throttle random_str');
61
62      this.settings = this.settings || $.extend({}, this.defaults, (options || method));
63
64      this.bindings(method, options)
65    },
66
67    go_next : function () {
68      if (this.settings.$li.next().length < 1) {
69        this.end();
70      } else if (this.settings.timer > 0) {
71        clearTimeout(this.settings.automate);
72        this.hide();
73        this.show();
74        this.startTimer();
75      } else {
76        this.hide();
77        this.show();
78      }
79    },
80
81    go_prev : function () {
82      if (this.settings.$li.prev().length < 1) {
83        // Do nothing if there are no prev element
84      } else if (this.settings.timer > 0) {
85        clearTimeout(this.settings.automate);
86        this.hide();
87        this.show(null, true);
88        this.startTimer();
89      } else {
90        this.hide();
91        this.show(null, true);
92      }
93    },
94
95    events : function () {
96      var self = this;
97
98      $(this.scope)
99        .off('.joyride')
100        .on('click.fndtn.joyride', '.joyride-next-tip, .joyride-modal-bg', function (e) {
101          e.preventDefault();
102          this.go_next()
103        }.bind(this))
104        .on('click.fndtn.joyride', '.joyride-prev-tip', function (e) {
105          e.preventDefault();
106          this.go_prev();
107        }.bind(this))
108
109        .on('click.fndtn.joyride', '.joyride-close-tip', function (e) {
110          e.preventDefault();
111          this.end(this.settings.abort_on_close);
112        }.bind(this))
113
114        .on('keyup.fndtn.joyride', function (e) {
115          // Don't do anything if keystrokes are disabled
116          // or if the joyride is not being shown
117          if (!this.settings.keyboard || !this.settings.riding) {
118            return;
119          }
120
121          switch (e.which) {
122            case 39: // right arrow
123              e.preventDefault();
124              this.go_next();
125              break;
126            case 37: // left arrow
127              e.preventDefault();
128              this.go_prev();
129              break;
130            case 27: // escape
131              e.preventDefault();
132              this.end(this.settings.abort_on_close);
133          }
134        }.bind(this));
135
136      $(window)
137        .off('.joyride')
138        .on('resize.fndtn.joyride', self.throttle(function () {
139          if ($('[' + self.attr_name() + ']').length > 0 && self.settings.$next_tip && self.settings.riding) {
140            if (self.settings.exposed.length > 0) {
141              var $els = $(self.settings.exposed);
142
143              $els.each(function () {
144                var $this = $(this);
145                self.un_expose($this);
146                self.expose($this);
147              });
148            }
149
150            if (self.is_phone()) {
151              self.pos_phone();
152            } else {
153              self.pos_default(false);
154            }
155          }
156        }, 100));
157    },
158
159    start : function () {
160      var self = this,
161          $this = $('[' + this.attr_name() + ']', this.scope),
162          integer_settings = ['timer', 'scrollSpeed', 'startOffset', 'tipAnimationFadeSpeed', 'cookieExpires'],
163          int_settings_count = integer_settings.length;
164
165      if (!$this.length > 0) {
166        return;
167      }
168
169      if (!this.settings.init) {
170        this.events();
171      }
172
173      this.settings = $this.data(this.attr_name(true) + '-init');
174
175      // non configureable settings
176      this.settings.$content_el = $this;
177      this.settings.$body = $(this.settings.tip_container);
178      this.settings.body_offset = $(this.settings.tip_container).position();
179      this.settings.$tip_content = this.settings.$content_el.find('> li');
180      this.settings.paused = false;
181      this.settings.attempts = 0;
182      this.settings.riding = true;
183
184      // can we create cookies?
185      if (typeof $.cookie !== 'function') {
186        this.settings.cookie_monster = false;
187      }
188
189      // generate the tips and insert into dom.
190      if (!this.settings.cookie_monster || this.settings.cookie_monster && !$.cookie(this.settings.cookie_name)) {
191        this.settings.$tip_content.each(function (index) {
192          var $this = $(this);
193          this.settings = $.extend({}, self.defaults, self.data_options($this));
194
195          // Make sure that settings parsed from data_options are integers where necessary
196          var i = int_settings_count;
197          while (i--) {
198            self.settings[integer_settings[i]] = parseInt(self.settings[integer_settings[i]], 10);
199          }
200          self.create({$li : $this, index : index});
201        });
202
203        // show first tip
204        if (!this.settings.start_timer_on_click && this.settings.timer > 0) {
205          this.show('init');
206          this.startTimer();
207        } else {
208          this.show('init');
209        }
210
211      }
212    },
213
214    resume : function () {
215      this.set_li();
216      this.show();
217    },
218
219    tip_template : function (opts) {
220      var $blank, content;
221
222      opts.tip_class = opts.tip_class || '';
223
224      $blank = $(this.settings.template.tip).addClass(opts.tip_class);
225      content = $.trim($(opts.li).html()) +
226        this.prev_button_text(opts.prev_button_text, opts.index) +
227        this.button_text(opts.button_text) +
228        this.settings.template.link +
229        this.timer_instance(opts.index);
230
231      $blank.append($(this.settings.template.wrapper));
232      $blank.first().attr(this.add_namespace('data-index'), opts.index);
233      $('.joyride-content-wrapper', $blank).append(content);
234
235      return $blank[0];
236    },
237
238    timer_instance : function (index) {
239      var txt;
240
241      if ((index === 0 && this.settings.start_timer_on_click && this.settings.timer > 0) || this.settings.timer === 0) {
242        txt = '';
243      } else {
244        txt = $(this.settings.template.timer)[0].outerHTML;
245      }
246      return txt;
247    },
248
249    button_text : function (txt) {
250      if (this.settings.tip_settings.next_button) {
251        txt = $.trim(txt) || 'Next';
252        txt = $(this.settings.template.button).append(txt)[0].outerHTML;
253      } else {
254        txt = '';
255      }
256      return txt;
257    },
258
259    prev_button_text : function (txt, idx) {
260      if (this.settings.tip_settings.prev_button) {
261        txt = $.trim(txt) || 'Previous';
262
263        // Add the disabled class to the button if it's the first element
264        if (idx == 0) {
265          txt = $(this.settings.template.prev_button).append(txt).addClass('disabled')[0].outerHTML;
266        } else {
267          txt = $(this.settings.template.prev_button).append(txt)[0].outerHTML;
268        }
269      } else {
270        txt = '';
271      }
272      return txt;
273    },
274
275    create : function (opts) {
276      this.settings.tip_settings = $.extend({}, this.settings, this.data_options(opts.$li));
277      var buttonText = opts.$li.attr(this.add_namespace('data-button')) || opts.$li.attr(this.add_namespace('data-text')),
278          prevButtonText = opts.$li.attr(this.add_namespace('data-button-prev')) || opts.$li.attr(this.add_namespace('data-prev-text')),
279        tipClass = opts.$li.attr('class'),
280        $tip_content = $(this.tip_template({
281          tip_class : tipClass,
282          index : opts.index,
283          button_text : buttonText,
284          prev_button_text : prevButtonText,
285          li : opts.$li
286        }));
287
288      $(this.settings.tip_container).append($tip_content);
289    },
290
291    show : function (init, is_prev) {
292      var $timer = null;
293
294      // are we paused?
295      if (this.settings.$li === undefined || ($.inArray(this.settings.$li.index(), this.settings.pause_after) === -1)) {
296
297        // don't go to the next li if the tour was paused
298        if (this.settings.paused) {
299          this.settings.paused = false;
300        } else {
301          this.set_li(init, is_prev);
302        }
303
304        this.settings.attempts = 0;
305
306        if (this.settings.$li.length && this.settings.$target.length > 0) {
307          if (init) { //run when we first start
308            this.settings.pre_ride_callback(this.settings.$li.index(), this.settings.$next_tip);
309            if (this.settings.modal) {
310              this.show_modal();
311            }
312          }
313
314          this.settings.pre_step_callback(this.settings.$li.index(), this.settings.$next_tip);
315
316          if (this.settings.modal && this.settings.expose) {
317            this.expose();
318          }
319
320          this.settings.tip_settings = $.extend({}, this.settings, this.data_options(this.settings.$li));
321
322          this.settings.timer = parseInt(this.settings.timer, 10);
323
324          this.settings.tip_settings.tip_location_pattern = this.settings.tip_location_patterns[this.settings.tip_settings.tip_location];
325
326          // scroll and hide bg if not modal
327          if (!/body/i.test(this.settings.$target.selector)) {
328            var joyridemodalbg = $('.joyride-modal-bg');
329            if (/pop/i.test(this.settings.tipAnimation)) {
330                joyridemodalbg.hide();
331            } else {
332                joyridemodalbg.fadeOut(this.settings.tipAnimationFadeSpeed);
333            }
334            this.scroll_to();
335          }
336
337          if (this.is_phone()) {
338            this.pos_phone(true);
339          } else {
340            this.pos_default(true);
341          }
342
343          $timer = this.settings.$next_tip.find('.joyride-timer-indicator');
344
345          if (/pop/i.test(this.settings.tip_animation)) {
346
347            $timer.width(0);
348
349            if (this.settings.timer > 0) {
350
351              this.settings.$next_tip.show();
352
353              setTimeout(function () {
354                $timer.animate({
355                  width : $timer.parent().width()
356                }, this.settings.timer, 'linear');
357              }.bind(this), this.settings.tip_animation_fade_speed);
358
359            } else {
360              this.settings.$next_tip.show();
361
362            }
363
364          } else if (/fade/i.test(this.settings.tip_animation)) {
365
366            $timer.width(0);
367
368            if (this.settings.timer > 0) {
369
370              this.settings.$next_tip
371                .fadeIn(this.settings.tip_animation_fade_speed)
372                .show();
373
374              setTimeout(function () {
375                $timer.animate({
376                  width : $timer.parent().width()
377                }, this.settings.timer, 'linear');
378              }.bind(this), this.settings.tip_animation_fade_speed);
379
380            } else {
381              this.settings.$next_tip.fadeIn(this.settings.tip_animation_fade_speed);
382            }
383          }
384
385          this.settings.$current_tip = this.settings.$next_tip;
386
387        // skip non-existant targets
388        } else if (this.settings.$li && this.settings.$target.length < 1) {
389
390          this.show(init, is_prev);
391
392        } else {
393
394          this.end();
395
396        }
397      } else {
398
399        this.settings.paused = true;
400
401      }
402
403    },
404
405    is_phone : function () {
406      return matchMedia(Foundation.media_queries.small).matches &&
407        !matchMedia(Foundation.media_queries.medium).matches;
408    },
409
410    hide : function () {
411      if (this.settings.modal && this.settings.expose) {
412        this.un_expose();
413      }
414
415      if (!this.settings.modal) {
416        $('.joyride-modal-bg').hide();
417      }
418
419      // Prevent scroll bouncing...wait to remove from layout
420      this.settings.$current_tip.css('visibility', 'hidden');
421      setTimeout($.proxy(function () {
422        this.hide();
423        this.css('visibility', 'visible');
424      }, this.settings.$current_tip), 0);
425      this.settings.post_step_callback(this.settings.$li.index(),
426        this.settings.$current_tip);
427    },
428
429    set_li : function (init, is_prev) {
430      if (init) {
431        this.settings.$li = this.settings.$tip_content.eq(this.settings.start_offset);
432        this.set_next_tip();
433        this.settings.$current_tip = this.settings.$next_tip;
434      } else {
435        if (is_prev) {
436          this.settings.$li = this.settings.$li.prev();
437        } else {
438          this.settings.$li = this.settings.$li.next();
439        }
440        this.set_next_tip();
441      }
442
443      this.set_target();
444    },
445
446    set_next_tip : function () {
447      this.settings.$next_tip = $('.joyride-tip-guide').eq(this.settings.$li.index());
448      this.settings.$next_tip.data('closed', '');
449    },
450
451    set_target : function () {
452      var cl = this.settings.$li.attr(this.add_namespace('data-class')),
453          id = this.settings.$li.attr(this.add_namespace('data-id')),
454          $sel = function () {
455            if (id) {
456              return $(document.getElementById(id));
457            } else if (cl) {
458              return $('.' + cl).first();
459            } else {
460              return $('body');
461            }
462          };
463
464      this.settings.$target = $sel();
465    },
466
467    scroll_to : function () {
468      var window_half, tipOffset;
469
470      window_half = $(window).height() / 2;
471      tipOffset = Math.ceil(this.settings.$target.offset().top - window_half + this.settings.$next_tip.outerHeight());
472
473      if (tipOffset != 0) {
474        $('html, body').stop().animate({
475          scrollTop : tipOffset
476        }, this.settings.scroll_speed, 'swing');
477      }
478    },
479
480    paused : function () {
481      return ($.inArray((this.settings.$li.index() + 1), this.settings.pause_after) === -1);
482    },
483
484    restart : function () {
485      this.hide();
486      this.settings.$li = undefined;
487      this.show('init');
488    },
489
490    pos_default : function (init) {
491      var $nub = this.settings.$next_tip.find('.joyride-nub'),
492          nub_width = Math.ceil($nub.outerWidth() / 2),
493          nub_height = Math.ceil($nub.outerHeight() / 2),
494          toggle = init || false;
495
496      // tip must not be "display: none" to calculate position
497      if (toggle) {
498        this.settings.$next_tip.css('visibility', 'hidden');
499        this.settings.$next_tip.show();
500      }
501
502      if (!/body/i.test(this.settings.$target.selector)) {
503          var topAdjustment = this.settings.tip_settings.tipAdjustmentY ? parseInt(this.settings.tip_settings.tipAdjustmentY) : 0,
504              leftAdjustment = this.settings.tip_settings.tipAdjustmentX ? parseInt(this.settings.tip_settings.tipAdjustmentX) : 0;
505
506          if (this.bottom()) {
507            if (this.rtl) {
508              this.settings.$next_tip.css({
509                top : (this.settings.$target.offset().top + nub_height + this.settings.$target.outerHeight() + topAdjustment),
510                left : this.settings.$target.offset().left + this.settings.$target.outerWidth() - this.settings.$next_tip.outerWidth() + leftAdjustment});
511            } else {
512              this.settings.$next_tip.css({
513                top : (this.settings.$target.offset().top + nub_height + this.settings.$target.outerHeight() + topAdjustment),
514                left : this.settings.$target.offset().left + leftAdjustment});
515            }
516
517            this.nub_position($nub, this.settings.tip_settings.nub_position, 'top');
518
519          } else if (this.top()) {
520            if (this.rtl) {
521              this.settings.$next_tip.css({
522                top : (this.settings.$target.offset().top - this.settings.$next_tip.outerHeight() - nub_height + topAdjustment),
523                left : this.settings.$target.offset().left + this.settings.$target.outerWidth() - this.settings.$next_tip.outerWidth()});
524            } else {
525              this.settings.$next_tip.css({
526                top : (this.settings.$target.offset().top - this.settings.$next_tip.outerHeight() - nub_height + topAdjustment),
527                left : this.settings.$target.offset().left + leftAdjustment});
528            }
529
530            this.nub_position($nub, this.settings.tip_settings.nub_position, 'bottom');
531
532          } else if (this.right()) {
533
534            this.settings.$next_tip.css({
535              top : this.settings.$target.offset().top + topAdjustment,
536              left : (this.settings.$target.outerWidth() + this.settings.$target.offset().left + nub_width + leftAdjustment)});
537
538            this.nub_position($nub, this.settings.tip_settings.nub_position, 'left');
539
540          } else if (this.left()) {
541
542            this.settings.$next_tip.css({
543              top : this.settings.$target.offset().top + topAdjustment,
544              left : (this.settings.$target.offset().left - this.settings.$next_tip.outerWidth() - nub_width + leftAdjustment)});
545
546            this.nub_position($nub, this.settings.tip_settings.nub_position, 'right');
547
548          }
549
550          if (!this.visible(this.corners(this.settings.$next_tip)) && this.settings.attempts < this.settings.tip_settings.tip_location_pattern.length) {
551
552            $nub.removeClass('bottom')
553              .removeClass('top')
554              .removeClass('right')
555              .removeClass('left');
556
557            this.settings.tip_settings.tip_location = this.settings.tip_settings.tip_location_pattern[this.settings.attempts];
558
559            this.settings.attempts++;
560
561            this.pos_default();
562
563          }
564
565      } else if (this.settings.$li.length) {
566
567        this.pos_modal($nub);
568
569      }
570
571      if (toggle) {
572        this.settings.$next_tip.hide();
573        this.settings.$next_tip.css('visibility', 'visible');
574      }
575
576    },
577
578    pos_phone : function (init) {
579      var tip_height = this.settings.$next_tip.outerHeight(),
580          tip_offset = this.settings.$next_tip.offset(),
581          target_height = this.settings.$target.outerHeight(),
582          $nub = $('.joyride-nub', this.settings.$next_tip),
583          nub_height = Math.ceil($nub.outerHeight() / 2),
584          toggle = init || false;
585
586      $nub.removeClass('bottom')
587        .removeClass('top')
588        .removeClass('right')
589        .removeClass('left');
590
591      if (toggle) {
592        this.settings.$next_tip.css('visibility', 'hidden');
593        this.settings.$next_tip.show();
594      }
595
596      if (!/body/i.test(this.settings.$target.selector)) {
597
598        if (this.top()) {
599
600            this.settings.$next_tip.offset({top : this.settings.$target.offset().top - tip_height - nub_height});
601            $nub.addClass('bottom');
602
603        } else {
604
605          this.settings.$next_tip.offset({top : this.settings.$target.offset().top + target_height + nub_height});
606          $nub.addClass('top');
607
608        }
609
610      } else if (this.settings.$li.length) {
611        this.pos_modal($nub);
612      }
613
614      if (toggle) {
615        this.settings.$next_tip.hide();
616        this.settings.$next_tip.css('visibility', 'visible');
617      }
618    },
619
620    pos_modal : function ($nub) {
621      this.center();
622      $nub.hide();
623
624      this.show_modal();
625    },
626
627    show_modal : function () {
628      if (!this.settings.$next_tip.data('closed')) {
629        var joyridemodalbg =  $('.joyride-modal-bg');
630        if (joyridemodalbg.length < 1) {
631          var joyridemodalbg = $(this.settings.template.modal);
632          joyridemodalbg.appendTo('body');
633        }
634
635        if (/pop/i.test(this.settings.tip_animation)) {
636            joyridemodalbg.show();
637        } else {
638            joyridemodalbg.fadeIn(this.settings.tip_animation_fade_speed);
639        }
640      }
641    },
642
643    expose : function () {
644      var expose,
645          exposeCover,
646          el,
647          origCSS,
648          origClasses,
649          randId = 'expose-' + this.random_str(6);
650
651      if (arguments.length > 0 && arguments[0] instanceof $) {
652        el = arguments[0];
653      } else if (this.settings.$target && !/body/i.test(this.settings.$target.selector)) {
654        el = this.settings.$target;
655      } else {
656        return false;
657      }
658
659      if (el.length < 1) {
660        if (window.console) {
661          console.error('element not valid', el);
662        }
663        return false;
664      }
665
666      expose = $(this.settings.template.expose);
667      this.settings.$body.append(expose);
668      expose.css({
669        top : el.offset().top,
670        left : el.offset().left,
671        width : el.outerWidth(true),
672        height : el.outerHeight(true)
673      });
674
675      exposeCover = $(this.settings.template.expose_cover);
676
677      origCSS = {
678        zIndex : el.css('z-index'),
679        position : el.css('position')
680      };
681
682      origClasses = el.attr('class') == null ? '' : el.attr('class');
683
684      el.css('z-index', parseInt(expose.css('z-index')) + 1);
685
686      if (origCSS.position == 'static') {
687        el.css('position', 'relative');
688      }
689
690      el.data('expose-css', origCSS);
691      el.data('orig-class', origClasses);
692      el.attr('class', origClasses + ' ' + this.settings.expose_add_class);
693
694      exposeCover.css({
695        top : el.offset().top,
696        left : el.offset().left,
697        width : el.outerWidth(true),
698        height : el.outerHeight(true)
699      });
700
701      if (this.settings.modal) {
702        this.show_modal();
703      }
704
705      this.settings.$body.append(exposeCover);
706      expose.addClass(randId);
707      exposeCover.addClass(randId);
708      el.data('expose', randId);
709      this.settings.post_expose_callback(this.settings.$li.index(), this.settings.$next_tip, el);
710      this.add_exposed(el);
711    },
712
713    un_expose : function () {
714      var exposeId,
715          el,
716          expose,
717          origCSS,
718          origClasses,
719          clearAll = false;
720
721      if (arguments.length > 0 && arguments[0] instanceof $) {
722        el = arguments[0];
723      } else if (this.settings.$target && !/body/i.test(this.settings.$target.selector)) {
724        el = this.settings.$target;
725      } else {
726        return false;
727      }
728
729      if (el.length < 1) {
730        if (window.console) {
731          console.error('element not valid', el);
732        }
733        return false;
734      }
735
736      exposeId = el.data('expose');
737      expose = $('.' + exposeId);
738
739      if (arguments.length > 1) {
740        clearAll = arguments[1];
741      }
742
743      if (clearAll === true) {
744        $('.joyride-expose-wrapper,.joyride-expose-cover').remove();
745      } else {
746        expose.remove();
747      }
748
749      origCSS = el.data('expose-css');
750
751      if (origCSS.zIndex == 'auto') {
752        el.css('z-index', '');
753      } else {
754        el.css('z-index', origCSS.zIndex);
755      }
756
757      if (origCSS.position != el.css('position')) {
758        if (origCSS.position == 'static') {// this is default, no need to set it.
759          el.css('position', '');
760        } else {
761          el.css('position', origCSS.position);
762        }
763      }
764
765      origClasses = el.data('orig-class');
766      el.attr('class', origClasses);
767      el.removeData('orig-classes');
768
769      el.removeData('expose');
770      el.removeData('expose-z-index');
771      this.remove_exposed(el);
772    },
773
774    add_exposed : function (el) {
775      this.settings.exposed = this.settings.exposed || [];
776      if (el instanceof $ || typeof el === 'object') {
777        this.settings.exposed.push(el[0]);
778      } else if (typeof el == 'string') {
779        this.settings.exposed.push(el);
780      }
781    },
782
783    remove_exposed : function (el) {
784      var search, i;
785      if (el instanceof $) {
786        search = el[0]
787      } else if (typeof el == 'string') {
788        search = el;
789      }
790
791      this.settings.exposed = this.settings.exposed || [];
792      i = this.settings.exposed.length;
793
794      while (i--) {
795        if (this.settings.exposed[i] == search) {
796          this.settings.exposed.splice(i, 1);
797          return;
798        }
799      }
800    },
801
802    center : function () {
803      var $w = $(window);
804
805      this.settings.$next_tip.css({
806        top : ((($w.height() - this.settings.$next_tip.outerHeight()) / 2) + $w.scrollTop()),
807        left : ((($w.width() - this.settings.$next_tip.outerWidth()) / 2) + $w.scrollLeft())
808      });
809
810      return true;
811    },
812
813    bottom : function () {
814      return /bottom/i.test(this.settings.tip_settings.tip_location);
815    },
816
817    top : function () {
818      return /top/i.test(this.settings.tip_settings.tip_location);
819    },
820
821    right : function () {
822      return /right/i.test(this.settings.tip_settings.tip_location);
823    },
824
825    left : function () {
826      return /left/i.test(this.settings.tip_settings.tip_location);
827    },
828
829    corners : function (el) {
830      var w = $(window),
831          window_half = w.height() / 2,
832          //using this to calculate since scroll may not have finished yet.
833          tipOffset = Math.ceil(this.settings.$target.offset().top - window_half + this.settings.$next_tip.outerHeight()),
834          right = w.width() + w.scrollLeft(),
835          offsetBottom =  w.height() + tipOffset,
836          bottom = w.height() + w.scrollTop(),
837          top = w.scrollTop();
838
839      if (tipOffset < top) {
840        if (tipOffset < 0) {
841          top = 0;
842        } else {
843          top = tipOffset;
844        }
845      }
846
847      if (offsetBottom > bottom) {
848        bottom = offsetBottom;
849      }
850
851      return [
852        el.offset().top < top,
853        right < el.offset().left + el.outerWidth(),
854        bottom < el.offset().top + el.outerHeight(),
855        w.scrollLeft() > el.offset().left
856      ];
857    },
858
859    visible : function (hidden_corners) {
860      var i = hidden_corners.length;
861
862      while (i--) {
863        if (hidden_corners[i]) {
864          return false;
865        }
866      }
867
868      return true;
869    },
870
871    nub_position : function (nub, pos, def) {
872      if (pos === 'auto') {
873        nub.addClass(def);
874      } else {
875        nub.addClass(pos);
876      }
877    },
878
879    startTimer : function () {
880      if (this.settings.$li.length) {
881        this.settings.automate = setTimeout(function () {
882          this.hide();
883          this.show();
884          this.startTimer();
885        }.bind(this), this.settings.timer);
886      } else {
887        clearTimeout(this.settings.automate);
888      }
889    },
890
891    end : function (abort) {
892      if (this.settings.cookie_monster) {
893        $.cookie(this.settings.cookie_name, 'ridden', {expires : this.settings.cookie_expires, domain : this.settings.cookie_domain});
894      }
895
896      if (this.settings.timer > 0) {
897        clearTimeout(this.settings.automate);
898      }
899
900      if (this.settings.modal && this.settings.expose) {
901        this.un_expose();
902      }
903
904      // Unplug keystrokes listener
905      $(this.scope).off('keyup.joyride')
906
907      this.settings.$next_tip.data('closed', true);
908      this.settings.riding = false;
909
910      $('.joyride-modal-bg').hide();
911      this.settings.$current_tip.hide();
912
913      if (typeof abort === 'undefined' || abort === false) {
914        this.settings.post_step_callback(this.settings.$li.index(), this.settings.$current_tip);
915        this.settings.post_ride_callback(this.settings.$li.index(), this.settings.$current_tip);
916      }
917
918      $('.joyride-tip-guide').remove();
919    },
920
921    off : function () {
922      $(this.scope).off('.joyride');
923      $(window).off('.joyride');
924      $('.joyride-close-tip, .joyride-next-tip, .joyride-modal-bg').off('.joyride');
925      $('.joyride-tip-guide, .joyride-modal-bg').remove();
926      clearTimeout(this.settings.automate);
927      this.settings = {};
928    },
929
930    reflow : function () {}
931  };
932}(jQuery, window, window.document));

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.