Merge branch 'g4s'
This commit is contained in:
91
js/common.js
91
js/common.js
@ -293,12 +293,6 @@ function doc_write(cont)
|
||||
document.write(cont);
|
||||
}
|
||||
|
||||
// php chr() 대응
|
||||
function chr(code)
|
||||
{
|
||||
return String.fromCharCode(code);
|
||||
}
|
||||
|
||||
var win_password_lost = function(href) {
|
||||
window.open(href, "win_password_lost", "left=50, top=50, width=617, height=330, scrollbars=1");
|
||||
}
|
||||
@ -400,23 +394,29 @@ $(function() {
|
||||
* 텍스트 리사이즈
|
||||
**/
|
||||
var default_font_size_saved = false;
|
||||
var default_line_height_saved = false;
|
||||
function font_resize(id, act)
|
||||
{
|
||||
var $elements = $("#"+id+" *").not("select").not("option");
|
||||
$elements.removeClass("applied");
|
||||
var count = parseInt(get_cookie("ck_font_resize_count"));
|
||||
if(isNaN(count))
|
||||
count = 0;
|
||||
|
||||
// container의 기본 line-height 저장
|
||||
if(!default_line_height_saved) {
|
||||
$("#"+id+" *").data("lh", $("#"+id+" *").css("line-height"));
|
||||
default_line_height_saved = true;
|
||||
}
|
||||
|
||||
// 폰트 크기 변경에 따른 line-height 적용
|
||||
var lh = 1.5;
|
||||
if(act == "default")
|
||||
lh = $("#"+id+" *").data("lh");
|
||||
$("#"+id+" *").css("line-height", lh);
|
||||
|
||||
// 엘리먼트의 기본 폰트사이즈 저장
|
||||
if(!default_font_size_saved) {
|
||||
save_default_font_size($elements);
|
||||
}
|
||||
|
||||
// 크롬의 최소 폰트사이즈 버그로 작게는 한단계만 가능
|
||||
if(act == "decrease" && count == -1)
|
||||
return;
|
||||
|
||||
$elements.each(function() {
|
||||
if($(this).hasClass("no_text_resize"))
|
||||
return true;
|
||||
@ -426,54 +426,7 @@ function font_resize(id, act)
|
||||
}
|
||||
});
|
||||
|
||||
// 텍스트 리사이즈 회수 쿠키에 기록
|
||||
if(act == "increase")
|
||||
count++;
|
||||
else
|
||||
count--;
|
||||
|
||||
set_cookie("ck_font_resize_count", count, 1, g4_cookie_domain);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 텍스트 기본사이즈
|
||||
**/
|
||||
function font_default(id)
|
||||
{
|
||||
var act;
|
||||
var count = parseInt(get_cookie("ck_font_resize_count"));
|
||||
if(isNaN(count))
|
||||
count = 0;
|
||||
|
||||
if(count > 0) {
|
||||
act = "decrease";
|
||||
} else {
|
||||
act = "increase";
|
||||
// 작게 후 기본 크기가 되지 않는 문제해결을 위해 추가
|
||||
set_cookie("ck_font_resize_count", 0, 1, g4_cookie_domain);
|
||||
}
|
||||
|
||||
for(i=0; i<Math.abs(count); i++) {
|
||||
font_resize(id, act);
|
||||
}
|
||||
|
||||
// font resize 카운트 초기화
|
||||
set_cookie("ck_font_resize_count", 0, 1, g4_cookie_domain);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* font_resize 함수를 반복 할 때 사용
|
||||
**/
|
||||
function font_resize2(id, act, loop)
|
||||
{
|
||||
// font resize 카운트 초기화
|
||||
set_cookie("ck_font_resize_count", 0, 1, g4_cookie_domain);
|
||||
|
||||
for(i=0; i<loop; i++) {
|
||||
font_resize(id, act);
|
||||
}
|
||||
set_cookie("ck_font_resize_act", act, 1, g4_cookie_domain);
|
||||
}
|
||||
|
||||
|
||||
@ -497,16 +450,22 @@ function set_font_size($el, act)
|
||||
if(unit == "em")
|
||||
x = 1;
|
||||
|
||||
if(act == "increase") {
|
||||
nfsize = (fsize * 1.2);
|
||||
} else {
|
||||
nfsize = (fsize / 1.2);
|
||||
switch(act) {
|
||||
case "large":
|
||||
nfsize = fsize * 1.5;
|
||||
break;
|
||||
case "larger":
|
||||
nfsize = fsize * 2;
|
||||
break;
|
||||
default:
|
||||
nfsize = fsize;
|
||||
lh = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
nfsize = nfsize.toFixed(x);
|
||||
|
||||
$el.css("font-size", nfsize+unit).addClass("applied");
|
||||
$el.data("fs", nfsize+unit);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -69,24 +69,17 @@ $(function(){
|
||||
}
|
||||
});
|
||||
|
||||
function submenu_hide() {
|
||||
$(".gnb_1dli").removeClass("gnb_1dli_over gnb_1dli_over2 gnb_1dli_on");
|
||||
}
|
||||
|
||||
// 텍스트 리사이즈 카운트 쿠키있으면 실행
|
||||
var resize_act;
|
||||
var text_resize_count = parseInt(get_cookie("ck_font_resize_count"));
|
||||
if(!isNaN(text_resize_count)) {
|
||||
if(text_resize_count > 0)
|
||||
resize_act = "increase";
|
||||
else if(text_resize_count < 0)
|
||||
resize_act = "decrease";
|
||||
|
||||
if(Math.abs(text_resize_count) > 0)
|
||||
font_resize2("container", resize_act, Math.abs(text_resize_count));
|
||||
// 폰트 리사이즈 쿠키있으면 실행
|
||||
var font_resize_act = get_cookie("ck_font_resize_act");
|
||||
if(font_resize_act != "") {
|
||||
font_resize("container", font_resize_act);
|
||||
}
|
||||
});
|
||||
|
||||
function submenu_hide() {
|
||||
$(".gnb_1dli").removeClass("gnb_1dli_over gnb_1dli_over2 gnb_1dli_on");
|
||||
}
|
||||
|
||||
function menu_rearrange(el)
|
||||
{
|
||||
var width = $("#gnb_1dul").width();
|
||||
|
||||
Reference in New Issue
Block a user