Boîtes de dialogue
Sommaire
Présentation
Gestion de 10 boîtes de dialogue.
Le code source des fonctions de démo (myFuncX
) est disponible dans le fichier demo.js.
01) Dialogue d'information
apijs.dialog.dialogInformation(string title, string text, string icon) : boolean
02) Dialogue de confirmation
apijs.dialog.dialogConfirmation(string title, string text, function callback, mixed args, string icon) : boolean
03) Dialogue d'options
apijs.dialog.dialogFormOptions(string title, string text, string action, function callback, mixed args, string icon) : boolean
04) Dialogue d'upload
apijs.dialog.dialogFormUpload(string title, string text, string action, string input, boolean multiple, string icon) : boolean
05) Dialogue de progression
apijs.dialog.dialogProgress(string title, string text, string icon) : boolean
06) Dialogue d'attente
apijs.dialog.dialogWaiting(string title, string text, string icon) : boolean
07) Dialogue photo
apijs.dialog.dialogPhoto(string url, string name, string date, string legend) : boolean
08) Dialogue vidéo
apijs.dialog.dialogVideo(string url, string name, string date, string legend) : boolean
09) Dialogue iframe
apijs.dialog.dialogIframe(string url, boolean close, string icon) : boolean
10) Dialogue ajax
apijs.dialog.dialogAjax(string url, boolean close, function callback, mixed args, string icon) : boolean
Informations complémentaires
Le paramètre name
des dialogues photo et vidéo peut prendre les valeurs suivantes :
- false
pour ne pas afficher le nom du fichier,
- auto
pour afficher le nom du fichier original,
- ou toute autre chaîne de caractère pour afficher un nom de fichier personnalisé.
Le paramètre date
des dialogues photo et vidéo peut prendre les valeurs suivantes :
- false
pour ne pas afficher la date du fichier,
- ou toute autre chaîne de caractère pour afficher la date du fichier.
Pour le paramètre icon
les classes CSS suivantes :
- peuvent être utilisées : download
print
error
warning
notransition
lock
- ne peuvent pas être utilisées : 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);
});