*/
WCF.Date = {};
-/**
- * Provides a date picker for date input fields.
- *
- * @deprecated 3.0 - no longer required
- */
-WCF.Date.Picker = { init: function() {} };
-
-/**
- * Provides utility functions for date operations.
- *
- * @deprecated 3.0 - use `DateUtil` instead
- */
-WCF.Date.Util = {
- /**
- * Returns UTC timestamp, if date is not given, current time will be used.
- *
- * @param Date date
- * @return integer
- *
- * @deprecated 3.0 - use `DateUtil::gmdate()` instead
- */
- gmdate: function(date) {
- var $date = (date) ? date : new Date();
-
- return Math.round(Date.UTC(
- $date.getUTCFullYear(),
- $date.getUTCMonth(),
- $date.getUTCDay(),
- $date.getUTCHours(),
- $date.getUTCMinutes(),
- $date.getUTCSeconds()
- ) / 1000);
- },
-
- /**
- * Returns a Date object with precise offset (including timezone and local timezone).
- * Parameters timestamp and offset must be in milliseconds!
- *
- * @param integer timestamp
- * @param integer offset
- * @return Date
- *
- * @deprecated 3.0 - use `DateUtil::getTimezoneDate()` instead
- */
- getTimezoneDate: function(timestamp, offset) {
- var $date = new Date(timestamp);
- var $localOffset = $date.getTimezoneOffset() * 60000;
-
- return new Date((timestamp + $localOffset + offset));
- }
-};
-
/**
* Hash-like dictionary. Based upon idead from Prototype's hash
*
*/
WCF.Template.callbacks = [ ];
-/**
- * Toggles options.
- *
- * @param string element
- * @param array showItems
- * @param array hideItems
- * @param function callback
- */
-WCF.ToggleOptions = Class.extend({
- /**
- * target item
- *
- * @var jQuery
- */
- _element: null,
-
- /**
- * list of items to be shown
- *
- * @var array
- */
- _showItems: [],
-
- /**
- * list of items to be hidden
- *
- * @var array
- */
- _hideItems: [],
-
- /**
- * callback after options were toggled
- *
- * @var function
- */
- _callback: null,
-
- /**
- * Initializes option toggle.
- *
- * @param string element
- * @param array showItems
- * @param array hideItems
- * @param function callback
- */
- init: function(element, showItems, hideItems, callback) {
- this._element = $('#' + element);
- this._showItems = showItems;
- this._hideItems = hideItems;
- if (callback !== undefined) {
- this._callback = callback;
- }
-
- // bind event
- this._element.click($.proxy(this._toggle, this));
-
- // execute toggle on init
- this._toggle();
- },
-
- /**
- * Toggles items.
- */
- _toggle: function() {
- if (!this._element.prop('checked')) return;
-
- for (var $i = 0, $length = this._showItems.length; $i < $length; $i++) {
- var $item = this._showItems[$i];
-
- $('#' + $item).show();
- }
-
- for (var $i = 0, $length = this._hideItems.length; $i < $length; $i++) {
- var $item = this._hideItems[$i];
-
- $('#' + $item).hide();
- }
-
- if (this._callback !== null) {
- this._callback();
- }
- }
-});
-
/**
* Namespace for all kind of collapsible containers.
*/
}
};
-/**
- * Provides flexible dropdowns for tab-based menus.
- * @deprecated 5.5 This module is unused and will be removed.
- */
-WCF.System.FlexibleMenu = {
- /**
- * Initializes the WCF.System.FlexibleMenu class.
- */
- init: function() { /* does nothing */ },
-
- /**
- * Registers a tab-based menu by id.
- *
- * Required DOM:
- * <container>
- * <ul style="white-space: nowrap">
- * <li>tab 1</li>
- * <li>tab 2</li>
- * ...
- * <li>tab n</li>
- * </ul>
- * </container>
- *
- * @param string containerID
- */
- registerMenu: function(containerID) {
- require(['WoltLabSuite/Core/Ui/FlexibleMenu'], function(UiFlexibleMenu) {
- UiFlexibleMenu.register(containerID);
- });
- },
-
- /**
- * Rebuilds a container, will be automatically invoked on window resize and registering.
- *
- * @param string containerID
- */
- rebuild: function(containerID) {
- require(['WoltLabSuite/Core/Ui/FlexibleMenu'], function(UiFlexibleMenu) {
- UiFlexibleMenu.rebuild(containerID);
- });
- }
-};
-
-/**
- * Namespace for mobile device-related classes.
- */
-WCF.System.Mobile = { };
-
/**
* Stores object references for global access.
*/
}
};
-/**
- * Puts an element into HTML 5 fullscreen mode.
- */
-WCF.System.Fullscreen = {
- /**
- * Puts the given element into full screen mode.
- * Note: This must be a raw HTMLElement, not a jQuery wrapped one.
- * Note: This must be called from a user triggered event listener for
- * security reasons.
- *
- * @param object Element to show full screen.
- */
- enterFullscreen: function (element) {
- if (element.requestFullscreen) {
- element.requestFullscreen();
- }
- else if (element.msRequestFullscreen) {
- element.msRequestFullscreen();
- }
- else if (element.mozRequestFullScreen) {
- element.mozRequestFullScreen();
- }
- else if (element.webkitRequestFullscreen) {
- element.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);
- }
- },
- /**
- * Toggles full screen mode. Either calls `enterFullscreen` with the given
- * element, if full screen mode is not active. Calls `exitFullscreen`
- * otherwise.
- */
- toggleFullscreen: function (element) {
- if (this.getFullscreenElement() === null) {
- this.enterFullscreen(element);
- }
- else {
- this.exitFullscreen();
- }
- },
- /**
- * Retrieves the element that is shown in full screen mode.
- * Returns null if either full screen mode is not supported or
- * if full screen mode is not active.
- *
- * @return object
- */
- getFullscreenElement: function () {
- if (document.fullscreenElement) {
- return document.fullscreenElement;
- }
- else if (document.mozFullScreenElement) {
- return document.mozFullScreenElement;
- }
- else if (document.webkitFullscreenElement) {
- return document.webkitFullscreenElement;
- }
- else if (document.msFullscreenElement) {
- return document.msFullscreenElement;
- }
-
- return null;
- },
- /**
- * Exits full screen mode.
- */
- exitFullscreen: function () {
- if (document.exitFullscreen) {
- document.exitFullscreen();
- }
- else if (document.msExitFullscreen) {
- document.msExitFullscreen();
- }
- else if (document.mozCancelFullScreen) {
- document.mozCancelFullScreen();
- }
- else if (document.webkitExitFullscreen) {
- document.webkitExitFullscreen();
- }
- },
- /**
- * Returns whether the full screen API is supported in this browser.
- *
- * @return boolean
- */
- isSupported: function () {
- if (document.documentElement.requestFullscreen || document.documentElement.msRequestFullscreen || document.documentElement.mozRequestFullScreen || document.documentElement.webkitRequestFullscreen) {
- return true;
- }
-
- return false;
- }
-};
-
-/**
- * Provides the 'jump to page' overlay.
- *
- * @deprecated 3.0 - use `WoltLabSuite/Core/Ui/Page/JumpTo` instead
- */
-WCF.System.PageNavigation = {
- init: function(selector, callback) {
- require(['WoltLabSuite/Core/Ui/Page/JumpTo'], function(UiPageJumpTo) {
- var elements = elBySelAll(selector);
- for (var i = 0, length = elements.length; i < length; i++) {
- UiPageJumpTo.init(elements[i], callback);
- }
- });
- }
-};
-
/**
* System-wide handler for push notifications.
*/