Namespace: XH

XH

The XH namespace.
Since:
  • 1.6
Author:
License:
  • GNU GPLv3 (http://www.gnu.org/licenses/gpl-3.0.en.html)
Source:

Methods

(static) adaptAdminMenu() → {undefined}

Adapts the admin menu to the viewport, so that all menu items are visible, if at least two menu items fit side by side, and there are not too many plugins. HTML's margin top is corrected to prevent menu overlap.
Since:
  • 1.6.3
Source:
Returns:
Type
undefined

(static) addInputEventListener(textarea, listener) → {undefined}

Adds an event listener to a textarea for focus and input events. If multiple listeners are attached, they are triggered in unspecified order. Inside the listeners, `this` should be treated as undefined.
Parameters:
Name Type Description
textarea HTMLTextareaElement A textarea.
listener EventListener An event listener.
Since:
  • 1.6.5
Source:
Returns:
Type
undefined
Triggers an XHR to check all links and inserts result into the DOM.
Parameters:
Name Type Description
url string XHR URL.
Since:
  • 1.6
Source:
Returns:
Type
undefined

(static) displayTextLength(textarea, indicator) → {undefined}

Displays the length of the value of a textarea in an indicator.
Parameters:
Name Type Description
textarea HTMLTextareaElement
indicator HTMLElement
Since:
  • 1.6.5
Source:
Returns:
Type
undefined

(static) findByClass(className) → {array-like}

Finds all elements with a certain class name.
Parameters:
Name Type Description
className string
Since:
  • 1.7
Source:
Returns:
Type
array-like

(static) findViewStatus() → {HTMLElement}

Returns the status element of a page data form resp. tab.
Since:
  • 1.6
Source:
Returns:
Type
HTMLElement

(static) forEach(collection, func) → {undefined}

Calls a function for each element of a collection.
Parameters:
Name Type Description
collection array-like
func function
Since:
  • 1.7
Source:
Returns:
Type
undefined

(static) initQuickSubmit() → {undefined}

Initialize the quick submit of page data forms.
Since:
  • 1.6
Source:
Returns:
Type
undefined

(static) makeAutosize(textarea) → {undefined}

Makes a focused textarea autosizing according to its content.
Parameters:
Name Type Description
textarea HTMLTextareaElement A textarea.
Since:
  • 1.6
Source:
Returns:
Type
undefined

(static) makeTextareasAutosize(node) → {undefined}

Makes all textareas which are descendends of a node autosizing according to their content, when they got the focus.
Parameters:
Name Type Description
node Node A DOM node.
Since:
  • 1.6
Source:
Returns:
Type
undefined

(static) modalDialog(contentElement, width, func) → {undefined}

Displays a modal dialog. Requires .xh_modal_dialog_overlay to overlay the whole viewport.
Parameters:
Name Type Description
contentElement HTMLElement
width string The width of the dialog as CSS width.
func function
Since:
  • 1.6
Source:
Returns:
Type
undefined

(static) on(target, event, listener) → {undefined}

Registers an event listener.
Parameters:
Name Type Description
target EventTarget
event string
listener function
Since:
  • 1.7
Source:
Returns:
Type
undefined

(static) preventDefault(event) → {undefined}

Prevents the default event handling.
Parameters:
Name Type Description
event Event
Since:
  • 1.7
Source:
Returns:
Type
undefined

(static) promptBackupName(form) → {bool}

Prompts for a valid backup suffix. Returns whether to continue.
Parameters:
Name Type Description
form HTMLFormElement
Since:
  • 1.6
Source:
Returns:
Type
bool

(static) quickSubmit(form) → {undefined}

Submits a page data form via AJAX.
Parameters:
Name Type Description
form HTMLFormElement
Since:
  • 1.6
Source:
Returns:
Type
undefined

(static) scorePassword(pass) → {number}

Scores the strength of a given password. Originally taken from .
Parameters:
Name Type Description
pass string
Source:
Returns:
Type
number

(static) serializeForm(form) → {string}

Returns the x-www-form-urlencoded data of a form.
Parameters:
Name Type Description
form HTMLFormElement
Since:
  • 1.6
Source:
Returns:
Type
string

(static) toggleAdvancedFields()

Toggles the visibility of the advanced configuration form fields.
Since:
  • 1.7
Source:
Returns:
undefined

(static) toggleTab(tabId) → {undefined}

Toggles the visibility of a page data tab.
Parameters:
Name Type Description
tabId string
Source:
Returns:
Type
undefined