« Widget:ExternalDialog » : différence entre les versions
De Encyclopédie-de-L'AFN_1830-1962
Page créée avec « <!--{$title|escape:html}--> <script> // Création du gestionnaire de fenêtres OOUI (une seule fois) if (!window.externalWindowManager) { window.externalWindowManager = new OO.ui.WindowManager(); $(document.body).append(window.externalWindowManager.$element); } // Classe du Dialog personnalisé function ExternalIframeDialog(config) { ExternalIframeDialog.super.call(this, config); } OO.inheritClass(ExternalIframeDialog, OO.ui.Dialog); ExternalIframe... » |
mAucun résumé des modifications |
||
| Ligne 2 : | Ligne 2 : | ||
<script> | <script> | ||
// Création du | // Création du WindowManager une seule fois | ||
if ( | if (typeof window.externalWM === 'undefined') { | ||
window. | window.externalWM = new OO.ui.WindowManager(); | ||
$(document.body).append(window. | $(document.body).append(window.externalWM.$element); | ||
} | } | ||
function ExternalIframeDialog(config) { | function ExternalIframeDialog(config) { | ||
ExternalIframeDialog.super.call(this, config); | ExternalIframeDialog.super.call(this, config); | ||
| Ligne 14 : | Ligne 13 : | ||
OO.inheritClass(ExternalIframeDialog, OO.ui.Dialog); | OO.inheritClass(ExternalIframeDialog, OO.ui.Dialog); | ||
ExternalIframeDialog.static.name = ' | ExternalIframeDialog.static.name = 'externalIframe'; | ||
ExternalIframeDialog.prototype.initialize = function () { | ExternalIframeDialog.prototype.initialize = function () { | ||
ExternalIframeDialog.super.prototype.initialize.call(this); | ExternalIframeDialog.super.prototype.initialize.call(this); | ||
this.iframe = $('<iframe>') | this.iframe = $('<iframe>') | ||
.attr( | .attr({ | ||
frameborder: 0, | |||
.css({ | allowfullscreen: true | ||
}) | |||
.css({ width: '100%', height: '100%', border: 'none' }); | |||
this | this.$body.append(this.iframe); | ||
}; | }; | ||
ExternalIframeDialog.prototype.getBodyHeight = function () { | ExternalIframeDialog.prototype.getBodyHeight = function () { | ||
return this.height || | return this.config.height || 700; | ||
}; | }; | ||
// Fonction globale | // Fonction globale d'ouverture (plus fiable) | ||
window. | window.openExternalOOUIDialog = function (url, title = 'Page externe', width = 1100, height = 750) { | ||
const dialog = new ExternalIframeDialog({ | const dialog = new ExternalIframeDialog({ | ||
size: 'large' | size: 'large' | ||
}); | }); | ||
dialog. | dialog.iframe.attr('src', url); | ||
dialog.setTitle(title); | dialog.setTitle(title); | ||
window.externalWM.addWindows([dialog]); | |||
window.externalWM.openWindow(dialog, { | |||
width: width, | width: width, | ||
height: height | height: height | ||
}); | }); | ||
// Rendre | // Rendre la fenêtre déplaçable | ||
setTimeout(() => { | setTimeout(() => { | ||
dialog.$element.draggable({ | dialog.$element.draggable({ | ||
handle: '.oo-ui-window-head', | handle: '.oo-ui-window-head', | ||
containment: 'window' | containment: 'window' | ||
}); | }); | ||
}, | }, 300); | ||
}; | }; | ||
</script> | </script> | ||
<style> | <style> | ||
.oo-ui-windowManager-modal .oo-ui-window-frame { | |||
. | background-color: rgba(255, 255, 255, 0.96) !important; | ||
background-color: rgba(255, 255, 255, 0. | |||
border-radius: 8px; | border-radius: 8px; | ||
box-shadow: 0 | box-shadow: 0 8px 25px rgba(0,0,0,0.5); | ||
} | } | ||
.oo-ui-windowManager-overlay { | |||
background-color: rgba(0, 0, 0, 0.65) !important; | background-color: rgba(0, 0, 0, 0.65) !important; | ||
} | } | ||
</style> | </style> | ||
Version du 1 mai 2026 à 11:36
<script>
// Création du WindowManager une seule fois
if (typeof window.externalWM === 'undefined') {
window.externalWM = new OO.ui.WindowManager(); $(document.body).append(window.externalWM.$element);
}
function ExternalIframeDialog(config) {
ExternalIframeDialog.super.call(this, config);
} OO.inheritClass(ExternalIframeDialog, OO.ui.Dialog);
ExternalIframeDialog.static.name = 'externalIframe'; ExternalIframeDialog.prototype.initialize = function () {
ExternalIframeDialog.super.prototype.initialize.call(this);
this.iframe = $('<iframe>')
.attr({
frameborder: 0,
allowfullscreen: true
})
.css({ width: '100%', height: '100%', border: 'none' });
this.$body.append(this.iframe);
};
ExternalIframeDialog.prototype.getBodyHeight = function () {
return this.config.height || 700;
};
// Fonction globale d'ouverture (plus fiable) window.openExternalOOUIDialog = function (url, title = 'Page externe', width = 1100, height = 750) {
const dialog = new ExternalIframeDialog({
size: 'large'
});
dialog.iframe.attr('src', url);
dialog.setTitle(title);
window.externalWM.addWindows([dialog]);
window.externalWM.openWindow(dialog, {
width: width,
height: height
});
// Rendre la fenêtre déplaçable
setTimeout(() => {
dialog.$element.draggable({
handle: '.oo-ui-window-head',
containment: 'window'
});
}, 300);
}; </script>
<style> .oo-ui-windowManager-modal .oo-ui-window-frame {
background-color: rgba(255, 255, 255, 0.96) !important; border-radius: 8px; box-shadow: 0 8px 25px rgba(0,0,0,0.5);
} .oo-ui-windowManager-overlay {
background-color: rgba(0, 0, 0, 0.65) !important;
} </style>