common.js 의 setFixedPopupSize 함수 개선

화면 크기를 벗어나서 리사이징 되지 않도록 수정.
This commit is contained in:
MinSoo Kim 2016-01-26 19:21:08 +09:00
parent dda216d4f6
commit 5868bc19fc
2 changed files with 16 additions and 3 deletions

View file

@ -476,23 +476,37 @@ function zbxe_folder_close(id) {
* popup_layout 에서 window.onload 자동 요청됨. * popup_layout 에서 window.onload 자동 요청됨.
**/ **/
function setFixedPopupSize() { function setFixedPopupSize() {
var $ = jQuery, $win = $(window), $pc = $('body>.popup'), w, h, dw, dh, offset; var $ = jQuery, $win = $(window), $pc = $('body>.popup'), w, h, dw, dh, offset, scbw;
var $outer = $('<div>').css({visibility: 'hidden', width: 100, overflow: 'scroll'}).appendTo('body'),
widthWithScroll = $('<div>').css({width: '100%'}).appendTo($outer).outerWidth();
$outer.remove();
scbw = 100 - widthWithScroll;
offset = $pc.css({overflow:'scroll'}).offset(); offset = $pc.css({overflow:'scroll'}).offset();
w = $pc.width(10).height(10000).get(0).scrollWidth + offset.left*2; w = $pc.width(10).height(10000).get(0).scrollWidth + offset.left*2;
h = $pc.height(10).width(10000).get(0).scrollHeight + offset.top*2; // 높이는 스크린의 높이보다 클 수 없다. 스크린의 높이와 내용의 높이를 비교해서 최소값을 이용한다.
h = Math.min($pc.height(10).width(10000).get(0).scrollHeight, screen.height-200) + offset.top*2;
if(w < 800) w = 800 + offset.left*2; if(w < 800) w = 800 + offset.left*2;
dw = $win.width(); dw = $win.width();
dh = $win.height(); dh = $win.height();
if(w != dw) window.resizeBy(w - dw, 0); if(w != dw) window.resizeBy(w - dw, 0);
// 스크린 높이에 한정된 경우 스크롤이 생기기 때문에 스크롤 높이를 고려해서 다시 조정해준다.
if(h === screen.height - 200 + offset.top*2) {
window.resizeBy(scbw, 0);
}
if(h != dh) window.resizeBy(0, h - dh); if(h != dh) window.resizeBy(0, h - dh);
$pc.width(w-offset.left*2).css({overflow:'',height:''}); $pc.width(w-offset.left*2).css({overflow:'',height:''});
} }
function getScrollBarWidth () {
};
/** /**
* @brief 추천/비추천,스크랩,신고기능등 특정 srl에 대한 특정 module/action을 호출하는 함수 * @brief 추천/비추천,스크랩,신고기능등 특정 srl에 대한 특정 module/action을 호출하는 함수

View file

@ -1 +0,0 @@
function completeInsertPoll(e){if("undefined"==typeof opener)return null;var t=get_by_id("fo_component"),o=t.skin.options[t.skin.selectedIndex].value,n=e.poll_srl;if(!n)return null;var l='<img src="../../../../common/img/blank.gif" poll_srl="'+n+'" editor_component="poll_maker" skin="'+o+'" style="display:block;width:400px;height:300px;border:2px dotted #4371B9;background:url(./modules/editor/components/poll_maker/tpl/poll_maker_component.gif) no-repeat center;" />';alert(e.message),opener.editorFocus(opener.editorPrevSrl);var i=opener.editorGetIFrame(opener.editorPrevSrl);return opener.editorReplaceHTML(i,l),opener.editorFocus(opener.editorPrevSrl),window.close(),null}jQuery(function(e){function t(){var t=e(".poll_box");$inputs=t.find("input"),poll_idx=0,$inputs.attr("name",function(e,t){return/^checkcount_/.test(t)&&poll_idx++,t.replace(/^([a-z]+_)(?:tidx|\d+)/,"$1"+poll_idx)}),t.length>1?t.find("button._del_poll").show():t.find("button._del_poll").hide()}function o(){var o=e("#poll_source");o.before(o.clone(!0).removeAttr("id").addClass("poll_box").css("display","block")),t()}var n;return n=e(opener.editorPrevNode),n.length&&"poll_maker"==n.attr("editor_component")?(alert(msg_poll_cannot_modify),window.close()):(e("#add_poll").click(function(){o(),setFixedPopupSize()}),e("button._add_item").click(function(){var t,o,n;t=e(this).prev().children("table").find(">tbody>tr:last"),o=t.clone(),match=t.find("td>input").attr("name").match(/item_(\d+)_(\d+)$/),match&&(match[2]++,(n=o.find("th")).html(n.html().replace(/ \d+/," "+match[2])),o.find("td>input").attr("name","item_"+match[1]+"_"+match[2]),t.after(o),setFixedPopupSize())}),e("button._del_item").click(function(){var t,o;t=e(this).prevAll("div").children("table").find(">tbody>tr:last"),o=t.find("td>input").attr("name").match(/item_(\d+)_(\d+)/),o&&2!=o[2]&&(t.remove(),setFixedPopupSize())}),e("button._del_poll").click(function(){e(this).parent(".poll_box").remove(),t()}),void o())}),jQuery(window).load(setFixedPopupSize);