CLASS :: Smart BrowserUtils (ES6)
The JavaScript class provides methods to simplify the interraction with the Browser, Ajax XHR Requests, Forms, Message Alerts and Message Dialogs, Growl and provide many useful methods for browser interraction.
Language: Javascript
Located at: lib/js/framework/smart-framework.pak.js; browser_utils.js
@return: {Boolean} TRUE if success, FALSE if not
@param: {String} flag The flag to set
@param: {Mixed} value The value of that flag
Set an internal flag
Available flags are:
PageUnloadConfirm {Boolean}
PageAway {Boolean}
RefreshState {0/1}
RefreshURL {String} || ''
public staticgetFlag = (
{String}flag
) => {} . {Mixed}
@return: {Mixed} The value of that flag
@param: {String} flag The flag to return
Get an internal flag
Available flags are:
PageUnloadConfirm {Boolean}
PageAway {Boolean}
RefreshState {0/1}
RefreshURL {String} || ''
public staticgetRefPopup = (
) => {} . {Mixed}
@return: {Mixed} NULL or Object (PopUp Window Reference)
Get the popUp Window Object Reference if any
public staticgetCurrentIsoDateTime = (
) => {} . {String}
@return: {String} The Current ISO Date and Time as YYYY-MM-DD HH:II:SS
Get the Current ISO Date and Time
public staticblowfishEncrypt = (
{String}str
) => {} . {String}
@return: {String} The Blowfish Encrypted string
@param: {String} str The plain string to be encoded
Blowfish (CBC) Encrypt
public staticblowfishDecrypt = (
{String}enc
) => {} . {String}
@return: {String} The plain decoded string
@param: {String} enc The Blowfish Encrypted string
Blowfish (CBC) Decrypt
public staticstripTags = (
{String}html
) => {} . {String}
@return: {String} Plain Text
@param: {String} html The html code to be processed
Strip HTML Tags and return plain text from HTML Code
public staticfunctionparseCurrentUrlGetParams (
{Boolean}semantic_sf_url
) {} . {Object}
@return: {Object} { param1:'value1', param1:'value 2', ... }
@param: {Boolean} semantic_sf_url *Optional* ; Default is TRUE ; If set to FALSE will not post-process the semantic URL parts from Smart.Framework such as: `/page/one/something/else`
@fires: A custom event set in the Js Code to execute when done
@param: {Integer} counter The countdown counter, Min value is 1
@param: {String} elID The HTML Element ID to bind to or NULL
@param: {JS-Code} evcode *Optional* the JS Code to execute on countdown complete (when countdown to zero)
@param: {Boolean} prettyFormat *Optional* if set to TRUE instead to display the left time in seconds will display as pretty format like: Days, Hours, Minutes, Seconds
Count Down handler that bind to a HTML Element
public staticwindowFocus = (
{Object}wnd
) => {} . {Void}
@fires: activate Focus on a PopUp window
@param: {Object} wnd The window (reference) object ; which ? self, window, ...
Focus a browser window by reference
public staticWindowIsiFrame = (
) => {} . {Boolean}
@return: {Boolean} TRUE if iFrame, FALSE if not
Detect if a Browser Window is an iFrame
public staticWindowIsPopup = (
) => {} . {Boolean}
@return: {Boolean} TRUE if PopUp, FALSE if not
Detect if a Browser Window is a PopUp
public staticfunctionPageAwayControl (
{String}the_question
) {} . {Void}
@fires: Ask Confirmation Dialog to confirm navigate away of the page
@listens: Browser Page Unload
@param: {String} the_question The Question to confirm for navigate away of the page
Page Away control handler. Take control over the events as onbeforeunload to prevent leaving the browser page in unattended mode
public staticRedirectToURL = (
{String}yURL
) => {} . {Void}
@fires: Browser Location Redirect or Location Reload
@param: {String} yURL The URL (relative or absolute) to redirect to ; if = '@' will just autorefresh the page
Redirect to a new URL or Reload the current browser location
public staticfunctionRedirectDelayedToURL (
{String}yURL,
{Integer}ytime
) {} . {Void}
@fires: Redirect Browser to a new URL
@listens: TimeOut counter on Set as Delay
@param: {String} yURL The URL (relative or absolute) to redirect to
@param: {Integer} ytime The time delay in milliseconds
Delayed Redirect to URL current browser window
public staticfunctionRedirectParent (
{String}yURL
) {} . {Void}
@fires: Redirect Browser to a new URL
@param: {String} yURL The URL (relative or absolute) to redirect to
Redirect to URL the browser parent window
public staticfunctionRefreshParent (
{String}yURL
) {} . {Void}
@hint: It will just trigger a lazy refresh on parent that will be executed later, after closing current child window.
@fires: Refresh Parent Window direct (instant) / or indirect (after closing modal)
@param: {String} yURL *Optional* The URL (relative or absolute) to redirect to ; if the parameter is not specified will just reload the parent window with the same URL
Lazy Refresh parent browser window or Lazy redirect parent window to another URL.
The method is different than RedirectParent() because will be executed just after the child (modal iFrame / PopUp) is closed.
public staticfunctionCloseModalPopUp (
) {} . {Void}
@hint: It is the prefered way to close a child window (modal iFrame / PopUp) using a button or just executing some js code in a child page.
@fires: Closes a Modal Box or PopUp Window
Close a Modal / PopUp child browser window.
If a parent refresh is pending will execute it after.
public staticfunctionCloseDelayedModalPopUp (
{Integer}timeout
) {} . {Void}
@hint: It is the prefered way to close a child window (modal iFrame / PopUp) using a button or just executing some js code in a child page.
@fires: Closes a Modal Box or PopUp Window
@listens: TimeOut counter on Set
@param: {Integer} timeout The time delay in milliseconds ; If is NULL or 0 (zero) will use the default timeout
Delayed Close a Modal / PopUp child browser window.
If a parent refresh is pending will execute it after.
public staticfunctiongetCurrentPointerEventXY (
{Event}evt,
{Boolean}viwePortOnly
) {} . {Object}
@return: {Object} An object with x and y coordinates as: { x: 123, y: 234, t: 'mousemove' } or { x: 123, y: 234, t: 'touchmove' } ; t (type) can be also other event type ... any of supported by browser ; if can't detect will return by default: { x: -1, y: -1 }
@param: {Event} evt The EVENT Object Reference (must be a pointer event: mouse or touch)
@param: {Boolean} viwePortOnly Default is FALSE ; if TRUE will return clientX / clientY instead of pageX / pageY
Get the Pointer Event pageX / pageY or clientX / clientY coordinates, depending how viwePortOnly is set.
It works on both: mouse or touch devices.
On touch devices will look after: event.touches[0]
On mouse devices directly to: event
The pageX/Y coordinates are relative to the top left corner of the whole rendered page (including parts hidden by scrolling), while clientX/Y coordinates are relative to the top left corner of the visible part of the page (aka ViewPort)
public staticfunctiongetHighestZIndex (
) {} . {Integer}
@return: {Integer} The highest available Z-Index from current page
Get the highest available Z-Index from a browser page taking in account all visible layers (div).
It will ignore non-visible layers for speed-up, as they have anyway no Z-Index assigned.
public staticfunctioncreateMaxContainer (
{String}id,
{Boolean}maximized
) {} . {Void}
@hint: When the selected element will be maximized the page will be protected by an overlay (all content below the element).
@param: {String} id The HTML id of the HTML element to bind to
@param: {Boolean} maximized *Optional* Default is FALSE ; If set to TRUE the element will be auto-maximized when bind to it
Create a Max Container arround a HTML Element that will add the Maximize View handler over it ; element must be a layer (div, iframe, ...).
It will add a maximize / un-maximize button and the handler for it to be able to maximize the element to match full window width and height.
@hint: The ZIndex of the overlay is: 2147400000
@return: {Object} The overlay as HTML object
@param: {String} text *Optional* a text to display in overlay as notification
@param: {String} title *Optional* a title to display for overlay as notification
@param: {String} css_class *Optional* a CSS class name for the notification (if any)
@param: {String} overlay_id *Optional* the overlay ID ; default is null and will use a hard-coded ID
@param: {Boolean} clear *Optional* clear the overlay from loading img
Display a page overlay in the current browser window
All page elements that must be visible over the overlay must have zIndex in range: 2147401000 - 214740999
public staticOverlayClear = (
{String}overlay_id
) => {} . {Void}
@param: {String} overlay_id *Optional* the overlay ID ; default is null and will use a hard-coded ID
Clear all notifications from the page overlay in the current browser window
public staticfunctionOverlayHide (
) {} . {Void}
Hide (destroy) the page overlay in the current browser window
@return: {Boolean} TRUE if Success FALSE if Fail
@param: {String} title a title for the notification (HTML) ; it can be empty string
@param: {String} text the main notification message (HTML) ; it is mandatory
@param: {String} image the URL link to a notification icon image (svg/gif/png/jpg/webp) or null
@param: {Integer} time the notification display time in milliseconds ; use 0 for sticky ; between 0 (0 sec) and 60000 (60 sec)
@param: {Boolean} sticky *Optional* FALSE by default (will auto-close after the display time expire) ; TRUE to set sticky (require manual close, will not auto-close)
@param: {Enum} css_class *Optional* a CSS class name for the notification or empty string to use default one: darknote (black), notice (white), info (blue), success (green), warning (yellow), error (red)
@param: {Array-Obj} options *Optional* Extra Growl Properties:
Create a Message Growl Notification
{ // example of extra Options
before_open: () => {},
after_open: () => {},
before_close: () => {},
after_close: () => {}
}
public staticfunctionGrowlNotificationRemove (
) {} . {Boolean}
@return: {Boolean} TRUE if Success FALSE if Fail
Remove all Growl Notifications from the current browser window (page)
@fires: open an Alert Dialog (custom or default, depends on settings)
@param: {String} y_message The message to display (HTML)
@param: {JS-Code} evcode *Optional* the JS Code to execute on closing the alert / Dialog by pressing the OK button (the alert / Dialog can be closed only if OK button is clicked)
@param: {String} y_title *Optional* a title for the alert / Dialog (HTML)
@param: {Integer} y_width *Optional* the width of the Dialog (will be used just if UIDialog / SimpleDialog are detected) ; if not set the default width will be used
@param: {Integer} y_height *Optional* the height of the Dialog (will be used just if UIDialog / SimpleDialog are detected) ; if not set the default height will be used
@param: {String} dialogType *Optional* The Dialog Type ; default is 'auto'
Create a Browser Alert Dialog that will have just the OK button.
It will detect if the UIDialog is available and will prefer to use it if set.
Otherwise will try to detect if SimpleDialog is available and will use it if UIDialog is not available - fallback.
If none of the above are available will try to use jQuery.alertable/alert else just display a simple alert() - fallback.
@fires: open a Confirmation Dialog (custom or default, depends on settings)
@param: {String} y_question The question / message to display (HTML)
@param: {JS-Code} evcode *Optional* the JS Code to execute on closing the confirm / Dialog by pressing the OK button (the confirm / Dialog can be closed by either OK button clicked or Cancel button clicked ; the code will be not executed on Cancel button click / close)
@param: {String} y_title *Optional* a title for the confirm / Dialog (HTML)
@param: {Integer} y_width *Optional* the width of the Dialog (will be used just if UIDialog / SimpleDialog are detected) ; if not set the default width will be used
@param: {Integer} y_height *Optional* the height of the Dialog (will be used just if UIDialog / SimpleDialog are detected) ; if not set the default height will be used
@param: {String} dialogType *Optional* The Dialog Type ; default is 'auto'
Create a Browser Confirm Dialog that will have 2 buttons: OK / Cancel.
It will detect if the UIDialog is available and will prefer to use it if set.
Otherwise will try to detect if SimpleDialog is available and will use it if UIDialog is not available - fallback.
If none of the above are available will try to use jQuery.alertable/confirm else display a simple confirm() - fallback.
@param: {String} ytitle The Title
@param: {String} ymessage The Message (HTML code)
@param: {String} yredirect *Optional* The URL to redirect
@param: {Yes/No} growl *Optional* If 'yes' will use the Growl notifications otherwise (default: if 'no') will use Dialog notification
@param: {Enum} class_growl *Optional* If Growl is used, a CSS class for Growl is required
@param: {Integer} timeout *Optional* If Growl is used, the Growl timeout in milliseconds
@hint: The function is using ConfirmDialog() and will detect and prefer in the specific order if UIDialog / SimpleDialog or just confirm() are available in Browser.
@fires: open a confirmation dialog
@listens: form submit event
@param: {String} y_confirm The question / message to display for confirmation (HTML)
@param: {Html-Form} y_form The HTML Form Object to bind to
@param: {String} y_target The window target to send the form to
@param: {Integer} windowWidth *Optional* the width of the new Modal/PopUp child window if new window target is used ; if not set the default width will be used
@param: {Integer} windowHeight *Optional* the height of the new Modal/PopUp child window if new window target is used ; if not set the default height will be used
@param: {Enum} forcePopUp *Optional* if a new target window is required, 0 = default, use modal/iFrame if set by smartJ$Browser.param_ModalBoxActive, 1 = force PopUp ; -1 force modal/iFrame
@param: {Enum} forceDims *Optional* if set to 1 will try force set the width/height for the new modal/iFrame or PopUp
Confirm a Form Submit by a confirm / Dialog, with OK and Cancel buttons.
The form will be submitted just if OK button is clicked.
@hint: The function if used in a button with 'return false;' will catch the form send behaviour and will trigger it just after the child modal/iFrame or PopUp child window (new) target is opened and available.
@fires: send a form in a pop-up window to avoid loose the current page
@listens: form submit event
@param: {Html-Form} objForm The HTML Form Object reference
@param: {String} strTarget The child window target to post the form to
@param: {Integer} windowWidth *Optional* the width of the new Modal/PopUp child window if new window target is used ; if not set the default width will be used
@param: {Integer} windowHeight *Optional* the height of the new Modal/PopUp child window if new window target is used ; if not set the default height will be used
@param: {Enum} forcePopUp *Optional* if a new target window is required, 0 = default, use modal/iFrame if set by smartJ$Browser.param_ModalBoxActive, 1 = force PopUp ; -1 force modal/iFrame
@param: {Enum} forceDims *Optional* if set to 1 will try force uwing the width/height set for the new modal/iFrame or PopUp
@param: {JS-Code} evcode *Optional* the JS Code to execute after submit the form
Open a Modal/iFrame or PopUp child window with a new target to post a form within.
It will get the form URL and form method GET/POST directly from the objForm.
The function must be called by a form button onClick followed by 'return false;' not by classic submit to avoid fire the form send twice 1st before (in a _blank window) and 2nd after opening the child popup/modal.
@hint: The function can be called by a button, a link or other HTML elements at onClick (if 'a' element onClick is used must be followed by 'return false;' to avoid fire page refresh.
@fires: open a Modal Box or a PopUp Window
@param: {String} strUrl The URL link to be opened in a new browser child window target or modal iframe (modalbox)
@param: {String} strTarget The child window target to post the form to ; name ; do not use _self or _blank here, and try ensure a compliant name
@param: {Integer} windowWidth *Optional* the width of the new Modal/PopUp child window if new window target is used ; if not set the default width will be used
@param: {Integer} windowHeight *Optional* the height of the new Modal/PopUp child window if new window target is used ; if not set the default height will be used
@param: {Enum} forcePopUp *Optional* if a new target window is required, 0 = default, use modal/iFrame if set by smartJ$Browser.param_ModalBoxActive, 1 = force PopUp ; -1 force modal/iFrame
@param: {Enum} forceDims *Optional* if set to 1 will try force uwing the width/height set for the new modal/iFrame or PopUp
@param: {Enum} handlerMode *Optional* If explicit set to 1 or 2 will use only a simple modal/popup without binding to the parent window ; if set to 2, the popup will not use redirect handler in addition to no binding ; if set to -1 the popup will not use redirect handler, but will use binding ; if set to -2 (default) will use same domain detection
Open a Modal/iFrame or PopUp child window with a new target to open a URL link within.
public staticfunctiongetCookie (
{String}name
) {} . {String}
@return: {String} The cookie Value
@param: {String} name The cookie Name ; must be a valid cookie name
Get a Cookie from Browser by Name and return it's Value
@return: {Boolean} TRUE on success and FALSE on failure
@param: {String} name The cookie Name
@param: {String} value The cookie Value
@param: {Numeric} expire *Optional* The cookie expire time in seconds since now ; if set to zero will expire by session ; if set to -1 will be unset (deleted) ; if set to NULL will use the value from smartJ$Browser.param_CookieLifeTime ; default is 0
@param: {String} path *Optional* The cookie path (default is /)
@param: {String} domain *Optional* The cookie domain (default is @ and will use '@' to use the smartJ$Browser.param_CookieDomain)
@param: {Enum} samesite *Optional* The SameSite cookie policy ; Can be: None, Lax, Strict ; (default is @ and will use '@' to use the smartJ$Browser.param_CookieSameSitePolicy)
@param: {Boolean} secure *Optional* Force Cookie Secure Mode (default is FALSE)
@return: {Boolean} TRUE on success and FALSE on failure
@param: {String} name The cookie Name
@param: {String} path *Optional* The cookie path (default is /)
@param: {String} domain *Optional* The cookie domain (default is @ and will use '@' to use the smartJ$Browser.param_CookieDomain)
@param: {Enum} samesite *Optional* The SameSite cookie policy ; Can be: None, Lax, Strict ; (default is @ and will use '@' to use the smartJ$Browser.param_CookieSameSitePolicy)
@param: {Boolean} secure *Optional* Force Cookie Secure Mode (default is FALSE)
Delete a Cookie from Browser by Name
public staticfunctionTextAreaAddLimit (
{String}elemID,
{Integer+}maxChars
) {} . {Void}
@fires: limits the text area for input more than max allowed characters
@listens: typing text in a text area, paste or other input methods
@param: {String} elemID The TextArea field name
@param: {Integer+} maxChars The max limit of characters to accept in the TextArea
Force a text limit on a TextArea (will also attach a CounterField)
public staticfunctioncatchKeyENTER (
{Event}evt
) {} . {Void}
@hint: Usage: onKeyDown ="smartJ$Browser.catchKeyENTER(event);"
@fires: Catch and Disable use of ENTER key in a field
@listens: ENTER Key press event
@param: {Event} evt The EVENT Object Reference
Catch ENTER Key in an Input[type=text] or other compatible input field
public staticfunctioncatchKeyTAB (
{Event}evt
) {} . {Void}
@hint: Usage: onKeyDown ="smartJ$Browser.catchKeyTAB(event);"
@fires: Insert a real TAB character in the selected input
@listens: TAB Key press event
@param: {Event} evt The EVENT Object Reference
Catch TAB Key and insert a TAB character (\t) at the cursor instead to switch to next input field as default in html
It works on TextArea or other compatible input fields ...
public staticfunctionCheckAllCheckBoxes (
{String}y_form_name,
{String}y_element_id,
{Boolean}y_element_checked
) {} . {Void}
@fires: check/uncheck all the checkboxes inside a form
@param: {String} y_form_name The form name (if empty string will operate on all checkboxes in the page otherwise just inside the form)
@param: {String} y_element_id The checkboxes element ID
@param: {Boolean} y_element_checked If TRUE will do check ; If FALSE will do uncheck ; otherwise will just inverse check
@param: {String} elID The element ID to be cloned
@param: {String} containerID The destination container ID
@param: {Enum} elType The type of the element to be cloned: text-input ; text-area ; file-input ; html-element
@param: {Integer} maxLimit The max limit number of elements includding the element itself and the cloned elements: between 1 and 255
@hint: It supports simple forms or complex forms with multipart/form-data and file attachments.
@fires: send a form by ajax
@listens: fire a form submit
@param: {String} the_form_id The form ID ; Set it to FALSE/NULL/'' (to use without a real form by emulating a form like XHR request from URL)
@param: {String} url The destination URL where form or XHR request will be sent to
@param: {Yes/No} growl *Optional* If 'yes' will use the Growl notifications otherwise (if 'no') will use Dialog notifications ; default is set to 'auto'
@param: {JS-Code} evcode *Optional* the JS Code to execute on SUCCESS answer (before anything else) ; params: the_form_id, url, msg
@param: {JS-Code} everrcode *Optional* the JS Code to execute on ERROR answer (before anything else) ; params: the_form_id, url, msg
@param: {JS-Code} evfailcode *Optional* the JS Code to execute on REQUEST FAIL answer ; params: the_form_id, url, msg
@param: {Boolean} failalertable *Optional* if set to TRUE will set the fail dialog to 'alertable' instead of 'auto' if alertable is available
Submit a Form by Ajax via POST and Handle the Answer
The function expects a json answer with the following structure: see more in framework PHP lib SmartComponents::js_ajax_replyto_html_form()
Sample code: JavaScript // Json Structure for Answer
{
'completed': 'DONE',
'status': 'OK|ERROR',
'action': 'Notification Button Text: Ok/Cancel',
'title': 'Notification Title',
'message': 'Notification Message HTML Content', // if empty, on success will not show any notification'js_evcode': 'If non-empty, the JS Code to execute on either SUCCESS or ERROR (before redirect or Div Replace) ; params: the_form_id, url, msg''redirect': 'If non-empty, a redirect URL on either SUCCESS or ERROR ; on SUCCESS if message is Empty will redirect without confirmation: Growl / Dialog',
'replace_div': 'If non-empty, an ID for a div to be replaced with content from [replace_html] on Success',
'replace_html': 'If non-empty, a HTML code to populate / replace the current Content for the [replace_div] on Success'
}
// #END Json Structure
public staticfunctionAjaxRequestByForm (
{String}the_form_id,
{String}url,
{Enum}data_type
) {} . {Object}
@return: {Object} The Ajax XHR Request Object ; The following methods must be bind to the object and redefined:
@param: {String} the_form_id The element ID of the form to be create the Ajax XHR Request for
@param: {String} url The URL to send form to via POST
@param: {Enum} data_type The type of Data served back by the Request: json | html | text
Create an Ajax XHR Request (POST) by Form
It supports simple forms or complex forms with multipart/form-data and file attachments.
@hint: It is NOT intended to be used with HTML forms that may contain multipart/form-data and file attachments or not.
@return: {Object} The Ajax XHR Request Object ; The following methods must be bind to the object and redefined:
@param: {String} y_url The URL to send the Request to
@param: {Enum} y_method The Request Method: GET / POST / PUT / DELETE / OPTIONS / HEAD
@param: {Enum} y_data_type The type of Data served back by the Request: json | jsonp | script | html | xml | text
@param: {Mixed} y_data_arr_or_serialized The Data to be sent: a serialized string via serialize() such as: '&var1=value1&var2=value2' or an associative array (Object) as: { var1: "value1", var2: "value2" }
@param: {String} y_AuthUser *Optional* The Authentication UserName (if custom Authentication need to be used)
@param: {String} y_AuthPass *Optional* The Authentication Password (if custom Authentication need to be used)
@param: {Object} y_Headers *Optional* Extra Headers to be sent with the Request ; Default is NULL (ex: { 'X-Head1': 'Test1', ... })
@param: {Boolean} y_withCredentials *Optional* Send Credentials (CORS Only) ; default is FALSE ; set to TRUE to send XHR Credentials
Create a general purpose Ajax XHR Request (GET/POST) with Optional support for Authentication and Extra Headers
For creating an Ajax XHR Request to be used with HTML Forms use:
smartJ$Browser.AjaxRequestByForm(); // basic, will detect the form type if must use multipart/form-data + attachments (if any)
or even much better use:
smartJ$Browser.SubmitFormByAjax(); // advanced, will handle the XHR form request and the answer
@hint: It is intended to simplify populating a Div (or other compatible) HTML Element(s) with content(s) by Ajax Requests.
@fires: load the div content by ajax in the background and if successful will replace the div content with what comes by ajax
@param: {String} y_elemID The ID of the Div (or other compatible) HTML Element(s) to bind to
@param: {String} y_img_loader If non-empty, a pre-loader image that will be displayed while loading ; if set to TRUE will use smartJ$Browser.param_LoaderImg;
@param: {String} y_url The URL to send the Request to
@param: {Enum} y_method The Request Method: GET / POST
@param: {Enum} y_data_type The type of Data served back by the Request: html | text | json (div_content_html)
@param: {Mixed} y_data_arr_or_serialized The Data to be sent: a serialized string via serialize() such as: '&var1=value1&var2=value2' or an associative array as: { var1: "value1", var2: "value2" }
@param: {Boolean} y_replace *Optional* Default is FALSE ; If set to TRUE will use the jQuery method .replaceWith() instead of .empty().html()
@param: {Mixed} y_notifyerr *Optional* Default is NULL ; If set to TRUE or FALSE will override the general setting for notification error ; if TRUE on Error loading the content will display a message Dialog instead of logging the errros to console
Loads the contents for a Div (or other compatible) HTML Element(s) by Ajax using a GET / POST Ajax Request
@fires: Scroll Down a Browser window
@param: {Object} wnd The window (reference) object
@param: {Integer} offset The offset in pixels to scroll down ; use -1 to scroll to the end of document
Scroll down a browser window by reference.
It will focus the referenced browser window first.
public staticfunctionWayPoint (
{String}elSelector,
{JS-Code}evcode
) {} . {Void}
@hint: It may be used to make an infinite scroll behaviour to load more content on page when page reach the bottom end
@fires: trigger the function that is set (2nd param)
@listens: the target element (1st param) to be scrolled in the visible area
@param: {String} elSelector The Element Selector ; example: '#elem-id' or '.elem-class' (interpretable by jQuery)
@param: {JS-Code} evcode the JS Code to execute on complete
Trigger a function when you scroll the page to a specific target element
@fires: emulates a file download
@param: {String} data The content of the file to be downloaded
@param: {String} fileName The file name (ex: 'file.txt')
@param: {String} mimeType The mime type (ex: 'text/plain')
@param: {String} charset *Optional* ; Default is NULL, will use the value from param_Charset or if not set will use 'UTF-8' ; set it to FALSE if binary is set to TRUE ; The character set of the file content (ex: 'UTF-8' for text OR FALSE for binary)
@param: {Boolean} binary *Optional* ; Default is FALSE ; if TRUE will use no character set, but binary ASCII
@param: {String} inputUpldFileId The HTML-Id of the input type file (#1)
@param: {String} previewPlaceholderId The HTML-Id of the preview container (#2)
@param: {Decimal} imgQuality The image quality (0.1 ... 1)
@param: {Decimal} imgMaxResizeMBSize The max resized image size in MB (0.01 ... 2) ; Default is 0.1
@param: {Integer} imgMaxResizeW The max resize width of the image (if the image width is lower will be not resized)
@param: {Integer} imgMaxResizeH The max resize height of the image (if the image height is lower will be not resized)
@param: {CallBack} fxDone A callback function(imgDataURL, w, h, isSVG, type, size, name) { ... } for done
@param: {Boolean} clearPreview If FALSE will not clear the preview container after done; Default is TRUE
@param: {Integer} widthPreview The Preview Width to set if not clearing the preview ; if not defined, full resized image width will be used (imgMaxResizeW)
@param: {Integer} heightPreview The Preview Height to set if not clearing the preview ; if not defined, full resized image height will be used (imgMaxResizeH)
@param: {Boolean} preserveGifs If TRUE will not process GIFS (which will be converted to PNG if processed via canvas) ; it may be used to avoid break animated Gifs
Create a virtual image upload handler
Requires in HTML:
(#1) an input type file (can be any of visible or hidden/triggered by a button click)
(#2) an image preview container (div)
class Properties
public staticvarparam_LanguageId = 'en' ; .{String}
Growl Notification Growl Type
Allowed Values: 'auto' | 'toastr' | 'ui' ; If Explicit set on 'ui' and UI is n/a will fallback to alert ; If Explicit set on 'toastr' ; ui = use smartJ$UI ; if any is n/a will fallback to browser:alert
public staticvarparam_NotificationTimeOK = 1000 ; .{Integer}
Use ModalBox
If set to 0 will disable the modal iframe ; If set to 1 (as default) will use ModalBox except on mobiles ; If set to 2 will use ModalBox also on mobiles
Allowed Values: 2=true (includding mobile) | 1=true (except on mobile) | 0=false
public staticvarparam_ModalBoxNoCascade = true ; .{Boolean}
Enable or Disable the ModalBox Cascading
If set to FALSE will enable the ModalBox (iframe) cascading (inefficient) ; otherwise will use PopUp every next level starting from the ModalBox iframe level, but inside PopUp can open another ModalBox ... and so on
Allowed Values: true | false
public staticvarparam_ModalBoxProtected = false ; .{Boolean}
Set ModalBox protected mode (if used)
If set to TRUE will use the protected mode for the modal iFrame (can be closed just explicit by buttons, not clicking outside of it)
Allowed Values: true | false
public staticvarparam_LoaderImg = 'lib/js/framework/img/loading.svg' ; .{String}
The JavaScript class provides methods to simplify the interraction with the Browser, Ajax XHR Requests, Forms, Message Alerts and Message Dialogs, Growl and provide many useful methods for browser interraction.