From 0e4d04543c676d6c104076793e5c6e6809652d49 Mon Sep 17 00:00:00 2001 From: chicpro Date: Tue, 5 Mar 2013 17:59:47 +0900 Subject: [PATCH] =?UTF-8?q?=ED=85=8D=EC=8A=A4=ED=8A=B8=20=EB=A6=AC?= =?UTF-8?q?=EC=82=AC=EC=9D=B4=EC=A6=88=EC=8B=9C=20=ED=85=8D=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8=20=EB=85=B8=EB=93=9C=EB=8F=84=20=EB=A6=AC=EC=82=AC?= =?UTF-8?q?=EC=9D=B4=EC=A6=88=20=EB=90=98=EB=8F=84=EB=A1=9D=20=EC=8A=A4?= =?UTF-8?q?=ED=81=AC=EB=A6=BD=ED=8A=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/common.js | 94 +++++++++++++++++++++++++++++++--------------------- 1 file changed, 56 insertions(+), 38 deletions(-) diff --git a/js/common.js b/js/common.js index 058368b65..d2320825d 100644 --- a/js/common.js +++ b/js/common.js @@ -525,31 +525,26 @@ var win_poll = function(href) { function text_increase() { var $elements = $("#container *:visible"); - var fs = tx = unit = ""; - var fsize; - var x = 0; + var mode = "increase"; + $elements.each(function() { if($(this).hasClass("no_text_resize")) return true; - fs = $(this).css("font-size"); - tx = $(this).html(); - unit = fs.replace(/[0-9]/g, ""); - fsize = parseFloat(fs.replace(/[^0-9\.]/g, "")); - - if(!fsize) + if($(this).children().length != 0) { return true; + } else { + var $parent = $(this).parent(); + var text = $parent.contents().filter(function() { + return this.nodeType == 3; + }).text().replace(/\s*/, ""); - if(tx.search("<") > -1) - return true; - - if(unit == "em") - x = 1; - - nfsize = (fsize * 1.2); - nfsize = nfsize.toFixed(x); - - $(this).css("font-size", nfsize+unit); + if(text.length) { + font_resize($parent, mode); + } else { + font_resize($(this), mode); + } + } }); } @@ -559,35 +554,58 @@ function text_increase() function text_decrease() { var $elements = $("#container *:visible"); - var fs = tx = unit = ""; - var fsize; - var x = 0; + var mode = "decrease"; + $elements.each(function() { if($(this).hasClass("no_text_resize")) return true; - fs = $(this).css("font-size"); - tx = $(this).html(); - unit = fs.replace(/[0-9]/g, ""); - fsize = parseFloat(fs.replace(/[^0-9\.]/g, "")); - - if(!fsize) + if($(this).children().length != 0) { return true; + } else { + var $parent = $(this).parent(); + var text = $parent.contents().filter(function() { + return this.nodeType == 3; + }).text().replace(/\s*/, ""); - if(tx.search("<") > -1) - return true; - - if(unit == "em") - x = 1; - - nfsize = (fsize * 0.8); - nfsize = nfsize.toFixed(x); - - $(this).css("font-size", nfsize+unit); + if(text.length) { + font_resize($parent, mode); + } else { + font_resize($(this), mode); + } + } }); } +/** + * 텍스트 resize +**/ +function font_resize(el, mode) +{ + var x = 0; + var fs = el.css("font-size"); + unit = fs.replace(/[0-9\.]/g, ""); + fsize = parseFloat(fs.replace(/[^0-9\.]/g, "")); + + if(!fsize) + return true; + + if(unit == "em") + x = 1; + + if(mode == "increase") { + nfsize = (fsize * 1.2); + } else { + nfsize = (fsize / 1.2); + } + + nfsize = nfsize.toFixed(x); + + el.css("font-size", nfsize+unit); +} + + $(function(){ $('.win_point').click(function() { win_point(this.href);