
jwic.compatibility.window.DialogExtention.js Maven / Gradle / Ivy
/*******************************************************************************
* Copyright 2015 xWic group (http://www.xwic.de)
*
* Licensed under the Apache License, Version 2.0 (the "License").
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*******************************************************************************/
function addMinimizeToDialog(dialog){
if(dialog !== undefined){
dialog.bind('dialogresize',function(){
jQuery.data(dialog,'width',dialog.parent().width());
dialog.parent().css('height', 'auto');
if(!dialog.is(':visible')){
jQuery.data(dialog,'isMinimized',false);
jQuery.data(dialog,'isMaximized',false);
jQuery.data(dialog,'originalPosition',dialog.parent().offset());
dialog.parent().css('width',jQuery.data(dialog,'width'));
dialog.show();
dialog.css('width','auto');
}
});
var titlebar = dialog.parents('.ui-dialog').find('.ui-dialog-titlebar');
//minimize
jQuery(' ')
.appendTo(titlebar)
.mouseover(function(){
jQuery(this).addClass('ui-state-hover');
})
.mouseout(function(){
jQuery(this).removeClass('ui-state-hover');
})
.click(function() {
(function(){
var dialogParent = dialog.parent();
dialogParent.css('overflow','hidden');
if(jQuery.data(dialog,'isMaximized')){
jQuery.data(dialog,'isMaximized',false);
dialogParent.offset(jQuery.data(dialog,'originalPosition'));
dialogParent.css('width',jQuery.data(dialog,'width'));
dialogParent.css('height', 'auto');
}
if(!jQuery.data(dialog,'isMinimized')){
jQuery.data(dialog,'isMinimized',true);
jQuery.data(dialog,'width',dialogParent.width());
dialog.hide();
}else{
jQuery.data(dialog,'isMinimized',false);
dialogParent.css('width',jQuery.data(dialog,'width'));
dialog.show();
}
})();
dialog.trigger({type:'minimize',source:dialog});
});
}
}
function addMaximizeToDialog(dialog){
if(dialog!==undefined ){
dialog.bind('dialogresize',function(){
jQuery.data(dialog,'width',dialog.parent().width());
dialog.parent().css('height', 'auto');
if(!dialog.is(':visible')){
jQuery.data(dialog,'isMinimized',false);
jQuery.data(dialog,'isMaximized',false);
jQuery.data(dialog,'originalPosition',dialog.parent().offset());
dialog.parent().css('width',jQuery.data(dialog,'width'));
dialog.show();
dialog.css('width','auto');
}
});
var titlebar = dialog.parents('.ui-dialog').find('.ui-dialog-titlebar');
jQuery(' ')
.appendTo(titlebar)
.mouseover(function(){
jQuery(this).addClass('ui-state-hover');
})
.mouseout(function(){
jQuery(this).removeClass('ui-state-hover');
})
.click(function() {
(function(){
var dialogParent = dialog.parent();
dialogParent.css('overflow','hidden');
if(jQuery.data(dialog,'isMinimized')){
jQuery.data(dialog,'isMinimized',false);
dialogParent.css('width',jQuery.data(dialog,'width'));
dialog.show();
dialog.css('width','auto');
}
if(!jQuery.data(dialog,'isMaximized')){
jQuery.data(dialog,'isMaximized',true);
jQuery.data(dialog,'originalPosition',dialogParent.offset());
jQuery.data(dialog,'width',dialogParent.width());
dialogParent.css('width',jQuery(window).width());
dialogParent.css('height',jQuery(window).height());
dialogParent.offset({top:0,left:0});
dialog.css('width','auto');
}else{
jQuery.data(dialog,'isMaximized',false);
dialogParent.offset(jQuery.data(dialog,'originalPosition'));
dialogParent.css('width',jQuery.data(dialog,'width'));
dialogParent.css('height', 'auto');
}
})();
dialog.trigger({type:'maximize',source:dialog})
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy