Verzeichnisstruktur phpBB-3.3.15


Veröffentlicht
28.08.2024

So funktioniert es


Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück

Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

(Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

tooltip.js

Zuletzt modifiziert: 02.04.2025, 15:01 - Dateigröße: 5.20 KiB


001  /*
002  javascript for Bubble Tooltips by Alessandro Fulciniti
003  - http://pro.html.it - http://web-graphics.com
004  obtained from: http://web-graphics.com/mtarchive/001717.php
005   
006  phpBB Development Team:
007      - modified to adhere to our coding guidelines
008      - integration into our design
009      - added ability to perform tooltips on select elements
010      - further adjustements
011  */
012   
013  (function($) { // Avoid conflicts with other libraries
014   
015  'use strict';
016   
017  var tooltips = [];
018   
019  /**
020   * Enable tooltip replacements for selects
021   * @param {string} id ID tag of select
022   * @param {string} headline Text that should appear on top of tooltip
023   * @param {string} [subId] Sub ID that should only be using tooltips (optional)
024  */
025  phpbb.enableTooltipsSelect = function (id, headline, subId) {
026      var $links, hold;
027   
028      hold = $('<span />', {
029          id:        '_tooltip_container',
030          css: {
031              position: 'absolute'
032          }
033      });
034   
035      $('body').append(hold);
036   
037      if (!id) {
038          $links = $('.roles-options li');
039      } else {
040          $links = $('.roles-options li', '#' + id);
041      }
042   
043      $links.each(function () {
044          var $this = $(this);
045   
046          if (subId) {
047              if ($this.parent().attr('id').substr(0, subId.length) === subId) {
048                  phpbb.prepareTooltips($this, headline);
049              }
050          } else {
051              phpbb.prepareTooltips($this, headline);
052          }
053      });
054  };
055   
056  /**
057   * Prepare elements to replace
058   *
059   * @param {jQuery} $element Element to prepare for tooltips
060   * @param {string} headText Text heading to display
061  */
062  phpbb.prepareTooltips = function ($element, headText) {
063      var $tooltip, text, $desc, $title;
064   
065      text = $element.attr('data-title');
066   
067      if (text === null || text.length === 0) {
068          return;
069      }
070   
071      $title = $('<span />', {
072          class: 'top',
073          css: {
074              display:    'block'
075          }
076      })
077          .append(document.createTextNode(headText));
078   
079      $desc = $('<span />', {
080          class: 'bottom',
081          html: text,
082          css: {
083              display: 'block'
084          }
085      });
086   
087      $tooltip = $('<span />', {
088          class: 'tooltip',
089          css: {
090              display: 'block'
091          }
092      })
093          .append($title)
094          .append($desc);
095   
096      tooltips[$element.attr('data-id')] = $tooltip;
097      $element.on('mouseover', phpbb.showTooltip);
098      $element.on('mouseout', phpbb.hideTooltip);
099  };
100   
101  /**
102   * Show tooltip
103   *
104   * @param {object} $element Element passed by .on()
105  */
106  phpbb.showTooltip = function ($element) {
107      var $this = $($element.target);
108      $('#_tooltip_container').append(tooltips[$this.attr('data-id')]);
109      phpbb.positionTooltip($this);
110  };
111   
112  /**
113   * Hide tooltip
114  */
115  phpbb.hideTooltip = function () {
116      var d = document.getElementById('_tooltip_container');
117      if (d.childNodes.length > 0) {
118          d.removeChild(d.firstChild);
119      }
120  };
121   
122  /**
123   * Correct positioning of tooltip container
124   *
125   * @param {jQuery} $element Tooltip element that should be positioned
126  */
127  phpbb.positionTooltip = function ($element) {
128      var offset;
129   
130      $element = $element.parent();
131      offset = $element.offset();
132   
133      if ($('body').hasClass('rtl')) {
134          $('#_tooltip_container').css({
135              top: offset.top + 30,
136              left: offset.left + 255
137          });
138      } else {
139          $('#_tooltip_container').css({
140              top: offset.top + 30,
141              left: offset.left - 205
142          });
143      }
144  };
145   
146  /**
147   * Prepare roles drop down select
148   */
149  phpbb.prepareRolesDropdown = function () {
150      var $options = $('.roles-options li');
151   
152      // Display span and hide select
153      $('.roles-options > span').css('display', 'block');
154      $('.roles-options > select').hide();
155      $('.roles-options > input[type=hidden]').each(function () {
156          var $this = $(this);
157   
158          if ($this.attr('data-name') && !$this.attr('name')) {
159              $this.attr('name', $this.attr('data-name'));
160          }
161      });
162   
163      // Prepare highlighting of select options and settings update
164      $options.each(function () {
165          var $this = $(this);
166          var $rolesOptions = $this.closest('.roles-options');
167          var $span = $rolesOptions.children('span');
168   
169          // Correctly show selected option
170          if (typeof $this.attr('data-selected') !== 'undefined') {
171              $rolesOptions
172                  .children('span')
173                  .text($this.text())
174                  .attr('data-default', $this.text())
175                  .attr('data-default-val', $this.attr('data-id'));
176   
177              // Save default text of drop down if there is no default set yet
178              if (typeof $span.attr('data-default') === 'undefined') {
179                  $span.attr('data-default', $span.text());
180              }
181   
182              // Prepare resetting drop down on form reset
183              $this.closest('form').on('reset', function () {
184                  $span.text($span.attr('data-default'));
185                  $rolesOptions.children('input[type=hidden]')
186                      .val($span.attr('data-default-val'));
187              });
188          }
189   
190          $this.on('mouseover', function () {
191              var $this = $(this);
192              $options.removeClass('roles-highlight');
193              $this.addClass('roles-highlight');
194          }).on('click', function () {
195              var $this = $(this);
196              var $rolesOptions = $this.closest('.roles-options');
197   
198              // Update settings
199              set_role_settings($this.attr('data-id'), $this.attr('data-target-id'));
200              init_colours($this.attr('data-target-id').replace('advanced', ''));
201   
202              // Set selected setting
203              $rolesOptions.children('span')
204                  .text($this.text());
205              $rolesOptions.children('input[type=hidden]')
206                  .val($this.attr('data-id'));
207   
208              // Trigger hiding of selection options
209              $('body').trigger('click');
210          });
211      });
212  };
213   
214  // Run onload functions for RolesDropdown and tooltips
215  $(function() {
216      // Enable tooltips
217      phpbb.enableTooltipsSelect('set-permissions', $('#set-permissions').attr('data-role-description'), 'role');
218   
219      // Prepare dropdown
220      phpbb.prepareRolesDropdown();
221  });
222   
223  })(jQuery); // Avoid conflicts with other libraries
224