WanaPlan

API Docs for: 2.7.0
Show:

GlobalHelper

Module: Helpers
Parent Module: Wanaplan

Summary

Various methods to handle the HTML structure modification.

Constructor

GlobalHelper

Syntax

GlobalHelper

()

Summary

Methods

__forceMobileDevice

Syntax

__forceMobileDevice

(
  • value
)

Summary

Forces the device mode (mobile or desktop).

Parameters:

  • value Boolean

    Set to true to force the mobile detection or false for desktop.

addScript

Syntax

addScript

(
  • scriptUrl
  • params
  • successCallback
  • errorCallback
)

Summary

Insert a script to the page.

Parameters:

  • scriptUrl String

    The URL of the script to load.

  • params Object

    A dictionary of parameters (ex. { "async": "true" }).

  • successCallback Function

    A function called when the script is ready.

  • errorCallback Function

    A function called if the process fail.

addScripts

Syntax

addScripts

(
  • scripts
  • options
  • successCallback
  • errorCallback
  • interval
)

Summary

Load a collection of scripts. Here are two methods to load scripts.

  1. A simple array with urls [ "script.js", "script2.js" ]
  2. An array of dictionary [ { MyObject: "myObjectScript.js" } ]. In this case the function will test if the script is already loaded by using the key of the dictionary as object name.

Parameters:

  • scripts Array

    An array that contains all url to load or an array of.

  • options Object

    (Optional) A dictionary of parameters (ex. { "async": "true" }).

  • successCallback Function

    (Optional) A function called when the script is ready.

  • errorCallback Function

    (Optional) A function called if the process fail.

  • interval Number

    (Optional) The value of check interval.

addStylesheet

Syntax

addStylesheet

(
  • stylesheet
  • params
  • successCallback
  • errorCallback
)
static

Summary

Add a CSS file to the page.

Parameters:

  • stylesheet String

    The URL of the file to load.

  • params Object

    A dictionary of parameters (ex. { "media": "print" }).

  • successCallback Function

    A function called when the file is insered.

  • errorCallback Function

    A function called if the process fail.

createScreenshot3D

Syntax

createScreenshot3D

(
  • engine
  • [quality]
  • [callback]
)
static

Summary

Creates a screenshot of the 3D scene.

Parameters:

  • engine BABYLON.Engine

    The 3D engine.

  • [quality] String optional

    The desired quality of output ("native", "Thumb", "HD", "FullHD" or "4K").

  • [callback] Function optional

    A function called on the screenshot after it is created.

generateRandomString

Syntax

generateRandomString

(
  • [length]
)

Summary

Generates a random string

Parameters:

  • [length] Number optional

    The size of the string, default is 5.

getCapabilities

Syntax

getCapabilities

() Object static

Summary

Gets the supported GPU capabilities of the browser eg. the list of GL extensions or maximum texture size.

Returns:

Object:

an object that contains GPU capabilities.

getWrappedMouseEventNames

Syntax

getWrappedMouseEventNames

() Object static

Summary

Gets an object which contains the correct event names to use (touch, mouse or pointer).

Returns:

Object:

Return a dictionary with correct event names * Result on Android: { down: "touchstart", move: "touchmove", up: "touchend", cancel: "touchcancel" } * Result on WindowsPhone: { down: "pointerdown", move: "pointermove", up: "pointerup", cancel: "pointercancel", out: "pointerout" } * Result on Desktop: { down: "mousedown", move: "mousemove", up: "mouseup", cancel: "mouseup" }

hasAzertyKeyboard

Syntax

hasAzertyKeyboard

() Boolean static

Summary

Indicates whether the user's keyboard has an AZERTY layout.

Returns:

Boolean:

Return true if the user's keyboard has an AZERTY layout, otherwise return false.

hasCanvas2D

Syntax

hasCanvas2D

() Boolean static

Summary

Indicates whether the browser has Canvas 2D support.

Returns:

Boolean:

Return true if the canvas 2D is supported, otherwise return false.

hasWebGL

Syntax

hasWebGL

() Boolean static

Summary

Indicates whether the browser has WebGL support.

Returns:

Boolean:

Return true if WebGL is supported, otherwise return false.

insertHTML

Syntax

insertHTML

(
  • htmlPath
  • domNode
  • successCallback
  • errorCallback
)

Summary

Insert an HTML file into the specified node.

Parameters:

  • htmlPath String

    The URL of the HTML file to load.

  • domNode String | HTMLElement

    The element's ID or the element itself.

  • successCallback Function

    A function called when the HTML file is insered.

  • errorCallback Function

    A function called if the process fail.

isAndroidDevice

Syntax

isAndroidDevice

() Boolean static

Summary

Indicates whether the user's device is an Android device.

Returns:

Boolean:

Return true if the user's device is an Android device, otherwise return false.

isAppleDevice

Syntax

isAppleDevice

() Boolean static

Summary

Indicates whether the user's device is an Apple device.

Returns:

Boolean:

Return true if the user's device is an Apple device, otherwise return false.

isIE

Syntax

isIE

() Number static

Summary

Indicates whether the user's browser is Internet Explorer and return its version if it is.

Returns:

Number:

Return the version of Internet Explorer if it is used, otherwise return -1.

isIE9

Syntax

isIE9

() Boolean static

Summary

Indicates if the user's browser is Internet Explorer 10.

Returns:

Boolean:

Return true if the user's browser is Internet Explorer 10, otherwise return false.

isIE9

Syntax

isIE9

() Boolean static

Summary

Indicates if the user's browser is Internet Explorer 9.

Returns:

Boolean:

Return true if the user's browser is Internet Explorer 9, otherwise return false.

isMobileDevice

Syntax

isMobileDevice

() Boolean static

Summary

Indicates whether the user's device is a mobile device.

Returns:

Boolean:

Return true if the user's device is a mobile device, otherwise return false.

isSamsungDevice

Syntax

isSamsungDevice

() Boolean static

Summary

Indicates whether the user's device is a Samsung Mobile device.

Returns:

Boolean:

Return true if the user's device is a Samsung Mobile device, otherwise return false.

isWindowsDevice

Syntax

isWindowsDevice

() Boolean static

Summary

Indicates whether the user's device is a Windows Mobile device.

Returns:

Boolean:

Return true if the user's device is a Windows Mobile device, otherwise return false.

isWindowsPhoneDevice

Syntax

isWindowsPhoneDevice

() Boolean static

Summary

Indicates whether the user's device is a Windows Phone device.

Returns:

Boolean:

Return true if the user's device is a Windows Phone device, otherwise return false.

simulateClick

Syntax

simulateClick

(
  • element
  • x
  • y
  • (optional)
  • (optional)
  • (optional)
)
static

Summary

This method simulate a mouse event. It's used for testing purpose.

Parameters:

  • element HTMLElement

    An element which will trigger the mouse event.

  • x Number

    (optional) The horizontal coordinate.

  • y Number

    (optional) The vertical coordinate.

  • (optional) String

    type The type of mouse event: down, up, move.

  • (optional) Number

    button The button index (ex. 0 for the left button).

  • (optional) Number

    wheel The wheel value.

simulateKey

Syntax

simulateKey

(
  • keyCode
  • type
  • modifiers
)
static

Summary

This method simulate a key event. It's used for testing purpose.

Parameters:

  • keyCode Number

    The Key Code of the key to simulate.

  • type String

    The type of event: down, up or press.

  • modifiers Object

    A dictionary of modifier keys (ex. { "ctrl": "true" }).

stripDomainUrl

Syntax

stripDomainUrl

(
  • url
  • racine
)

Summary

Strips the url of its domain. eg. it replaces http://v2.wanaplan.com/data/stuff.ext => /data/stuff.ext

Parameters:

  • url String

    The url to clean

  • racine String

    Check if this pattern is in the url before cleaning it