Apijs 6.9.6 / vanilla-js

Dialogs boxes

Contents

  1. Presentation
  2. Additional information

Edit options

  • apijs.config
  • apijs.config.dialog

Presentation

Management of 10 dialog boxes.
Source code of demo functions (myFuncX) is available in demo.js file.

01) Information dialog
apijs.dialog.dialogInformation(string title, string text, string icon) : boolean

02) Confirmation dialog
apijs.dialog.dialogConfirmation(string title, string text, function callback, mixed args, string icon) : boolean

03) Options dialog
apijs.dialog.dialogFormOptions(string title, string text, string action, function callback, mixed args, string icon) : boolean

04) Upload dialog
apijs.dialog.dialogFormUpload(string title, string text, string action, string input, boolean multiple, string icon) : boolean

05) Progress dialog
apijs.dialog.dialogProgress(string title, string text, string icon) : boolean

06) Waiting dialog
apijs.dialog.dialogWaiting(string title, string text, string icon) : boolean

07) Photo dialog
apijs.dialog.dialogPhoto(string url, string name, string date, string legend) : boolean

08) Video dialog
apijs.dialog.dialogVideo(string url, string name, string date, string legend) : boolean

09) Iframe dialog
apijs.dialog.dialogIframe(string url, boolean close, string icon) : boolean

10) Ajax dialog
apijs.dialog.dialogAjax(string url, boolean close, function callback, mixed args, string icon) : boolean

Additional information

The name parameter of the photo and video dialogs can take the following values:
- false to not display the file name,
- auto to display the original file name,
- or every other string to display a personalized file name.

The date parameter of the photo and video dialogs can take the following values:
- false to not display the file date,
- or every other character string to display the file date.

For the icon parameter the following CSS classes:
- can be used: download print error warning notransition lock
- can not be used: information confirmation options upload progress waiting photo video iframe ajax start ready end reduce mobile tiny fullscreen slideshow loading

API

jsapijs.i18n.translate("word");              // return string
apijs.i18n.translateNode("word");          // return domelement
apijs.i18n.changeLang("fr");               // return boolean

apijs.dialog.dialogInformation(...);       // return boolean
apijs.dialog.dialogConfirmation(...);      // return boolean
apijs.dialog.dialogFormOptions(...);       // return boolean
apijs.dialog.dialogFormUpload(...);        // return boolean
apijs.dialog.dialogProgress(...);          // return boolean
apijs.dialog.dialogWaiting(...);           // return boolean
apijs.dialog.dialogPhoto(...);             // return boolean
apijs.dialog.dialogVideo(...);             // return boolean
apijs.dialog.dialogIframe(...);            // return boolean
apijs.dialog.dialogAjax(...);              // return boolean
apijs.dialog.actionClose();                // return void
apijs.dialog.add("string1", "string2");    // return dialog object
apijs.dialog.remove("string1", "string2"); // return dialog object
apijs.dialog.toggle("string1", "string2"); // return dialog object
apijs.dialog.has("string1", "string2");    // return boolean (true if one found)

apijs.upload.sendFile(...);                // return boolean
apijs.upload.sendFiles(...);               // return boolean

apijs.slideshow.show("slideshow.2.1");     // return boolean
apijs.slideshow.actionFirst();             // return boolean
apijs.slideshow.actionPrev();              // return boolean
apijs.slideshow.actionNext();              // return boolean
apijs.slideshow.actionLast();              // return boolean

// default config //////////////////////////////////////////
apijs.config.lang = "auto";
apijs.config.debug = false;

apijs.config.dialog.closeOnClick = false;
apijs.config.dialog.restrictNavigation = true;
apijs.config.dialog.player = true; // true|false|userFunction(videoTag, url)

apijs.config.slideshow.ids = "slideshow";
apijs.config.slideshow.anchor = true;

apijs.config.upload.tokenName = "X-CSRF-Token";
apijs.config.upload.tokenValue = null;

// events //////////////////////////////////////////////////
self.addEventListener("apijsbeforeload", function () {

	apijs.dialog.htmlContentOrig = apijs.dialog.htmlContent;
	apijs.dialog.htmlContent = function (title, text) {
		alert(title);
		this.htmlContentOrig(title, text);
	};

	if (!apijs.i18n.data.hasOwnProperty("xy")) apijs.i18n.data.xy = {};
	apijs.i18n.data.xy["xyz"] = "Test";

	apijs.config.debug = true;
});

self.addEventListener("apijsload", function () {
	console.log("ready");
});

self.addEventListener("apijsajaxresponse", function (ev) {
	console.log(ev.detail);
});