PageSourceSearch

https://www.gwrymca.org/modules/contrib/openy_custom/openy_tour/js/openy_tour.js?v=1.x

js gwrymca.org collected 2026-09-24 19:32:55 UTC 2,897 bytes, 88 lines download raw bytes

1(function ($) {
2  "use strict";
3  Drupal.openy_tour = Drupal.openy_tour || {};
4
5  $(document).ajaxSuccess(function() {
6    var queryString = decodeURI(window.location.search);
7    if (/tour=?/i.test(queryString) || window.location.hash == '#tour=1') {
8      var processed = true;
9      $('.joyride-tip-guide').each(function() {
10        if ($(this).css('display') == 'block' && processed) {
11          $(this).find('.joyride-next-tip').trigger('click');
12          processed = false;
13        }
14      });
15    }
16  });
17
18  Drupal.behaviors.openy_tour = {
19    attach: function (context, settings) {
20      $('body').on('tourStart', function () {
21        window.location.hash = 'tour=1';
22        Drupal.openy_tour.click_button();
23      });
24      $('body').on('tourStop', function () {
25        window.location.hash = '';
26      });
27      Drupal.openy_tour.focus_on_button();
28    }
29  };
30
31  Drupal.openy_tour.click_button = function () {
32    $('.joyride-tip-guide').each(function() {
33      // Hide original next button if custom is appear.
34      if ($(this).find('.openy-click-button').length > 0) {
35        $(this).find('.joyride-next-tip').hide();
36      }
37    });
38    $('.openy-click-button').on('click', function (e) {
39      e.preventDefault();
40      var selector = $(this).data('tour-selector'),
41          element = {};
42      // Click on link if class/id is provided.
43      if ($(selector).length > 0) {
44        element = $(selector);
45      }
46      // Click on input if data selector is provided.
47      if ($('[data-drupal-selector="' + selector + '"]').length > 0) {
48        element = $('[data-drupal-selector="' + selector + '"]');
49        element.parents('details').attr('open', true);
50        element.trigger('mousedown');
51      }
52      else {
53        element.parents('details').attr('open', true);
54        element.trigger('click');
55        $(this)
56          .hide()
57          .parent()
58          .parent()
59          .find('.joyride-next-tip')
60          .trigger('click');
61      }
62    });
63  };
64
65  Drupal.openy_tour.focus_on_button = function () {
66    $(document).click(function(e) {
67      if ($('.joyride-next-tip').on('clicked')) {
68        if (this.activeElement.classList.contains('joyride-next-tip')) {
69          let parentEl = this.activeElement.parentElement.parentElement.classList;
70          let activeTip = parentEl[parentEl.length - 1];
71          let precessedEl = '';
72          if (!$('#tour li.' +  activeTip).next().data('class')) {
73            precessedEl = $('#tour li.' +  activeTip).next().data('id');
74          }
75          else {
76            precessedEl = $('#tour li.' +  activeTip).next().data('class');
77          }
78          if ($('#' + precessedEl).length > 0) {
79            $('#' + precessedEl ).attr('open', true);
80            $('#' + precessedEl + ' summary').mousedown();
81          }
82        }
83        $('.openy-click-button:visible').focus();
84      }
85    });
86  };
87
88})(jQuery);

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.