Skip to content
Snippets Groups Projects
Commit 870bc33e authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

add winbox functions

parent 3d8c3264
No related branches found
No related tags found
1 merge request!62V2.0
// ----------------------------------------------------------------------
// VARS
// ----------------------------------------------------------------------
var aWinBoxes = {};
var WINBOX_background = "#456";
// ----------------------------------------------------------------------
// FUNCTIONS
// ----------------------------------------------------------------------
/** /**
* initialize soft scrolling for links with css class "scroll-link" * initialize soft scrolling for links with css class "scroll-link"
...@@ -22,28 +32,45 @@ function initSoftscroll(){ ...@@ -22,28 +32,45 @@ function initSoftscroll(){
}); });
} }
/**
* Shows a modal message by setting the inner HTML of div#divmodalmessage
* to the given message, and showing div#divmodal.
*
* @param {string} sMessage - The message to display in the modal
*/
function showModalMessage(sMessage) { function showModalMessage(sMessage) {
$('#divmodalmessage').html(sMessage); $('#divmodalmessage').html(sMessage);
$('#divmodal').show(); $('#divmodal').show();
} }
function showIdAsModalMessage(sId, sTitle){ /**
* Hide modal message box
*/
function hideModalMessage() {
$('#divmodal').hide();
return false;
}
var o=$('#'+sId);
var sHtml='<a href="#" onclick="return hideModalMessage()" class="btn btn-danger" style="float:right"> X </a>'
+ o.html()
+ '<hr><a href="#" onclick="return hideModalMessage()" class="btn btn-primary"><i class="fa fa-check"></i> OK </a>'
;
$('#divmodalmessage').html(sHtml);
$('#divmodal').show();
/* /**
* show a window displaying the content of a given dom id using Winbox
*
* @param {string} sId dom id of a div to show
* @param {string} sTitle title for the winbox window
* @returns
*/
function showIdAsModalMessage(sId, sTitle) {
if (aWinBoxes[sId]) {
return true;
}
var oWrapper = document.getElementById(sId); var oWrapper = document.getElementById(sId);
new WinBox({ aWinBoxes[sId] = WinBox({
title: sTitle, title: sTitle,
id: 'winbox-' + sId, id: 'winbox-' + sId,
border: 5, border: 5,
background: "#628", background: WINBOX_background,
class: ["no-min", "no-max", "no-full", "ciwinboxinfos"], class: ["no-min", "no-max", "no-full", "ciwinboxinfos"],
// modal: true, // collides with bootsrap3 .modal.less // modal: true, // collides with bootsrap3 .modal.less
...@@ -60,23 +87,19 @@ function showIdAsModalMessage(sId, sTitle){ ...@@ -60,23 +87,19 @@ function showIdAsModalMessage(sId, sTitle){
bottom: 20, bottom: 20,
left: 20, left: 20,
// take content from existing div // take content from existing div
// mount: oWrapper // mount: oWrapper
html: oWrapper.innerHTML // mount: document.getElementById(sId).cloneNode(true),
// html: 'hello' html: oWrapper.innerHTML,
});
*/ onclose: function () {
return false; delete aWinBoxes[sId];
} }
});
function hideModalMessage(){
$('#divmodal').hide();
return false; return false;
} }
var aWinBoxes={};
/** /**
* shellcmd plugin ... toggle output window * shellcmd plugin ... toggle output window
* @param {string} isPluginOutputDiv id of the wrapper * @param {string} isPluginOutputDiv id of the wrapper
...@@ -92,7 +115,7 @@ function toggleShellWindow(isPluginOutputDiv, oLink){ ...@@ -92,7 +115,7 @@ function toggleShellWindow(isPluginOutputDiv, oLink){
id: 'winbox-' + isPluginOutputDiv, id: 'winbox-' + isPluginOutputDiv,
border: 5, border: 5,
/*background: "#628",*/ /*background: "#628",*/
background: "#478", background: WINBOX_background,
class: ["no-min", "no-max", /* "no-full", "no-resize", "no-move"*/ "ciwinbox"], class: ["no-min", "no-max", /* "no-full", "no-resize", "no-move"*/ "ciwinbox"],
// position + size // position + size
...@@ -378,3 +401,5 @@ function generateSecret(length){ ...@@ -378,3 +401,5 @@ function generateSecret(length){
} }
return result; return result;
} }
// ----------------------------------------------------------------------
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment