From d2ac632ce40164668e1f0040806865688018ffb8 Mon Sep 17 00:00:00 2001
From: composite
Date: Mon, 16 Jul 2012 17:55:01 +0900
Subject: [PATCH 01/27] new in 0.3.6 : keyboard event added. such as tab, arrow
keys.
---
demo.html | 2 +-
jquery.msgbox.js | 70 +++++++++++++++++++++++++++++++++++-------------
2 files changed, 53 insertions(+), 19 deletions(-)
diff --git a/demo.html b/demo.html
index 7e842f8..51b685b 100644
--- a/demo.html
+++ b/demo.html
@@ -13,7 +13,7 @@
긴 입력창
일반 입력창
-
+
-
-```
-
-alert("i'm alert");
--> $.alert("i'm alert");
-
-confirm("Are you sure?");
--> $.confirm("Are you sure?");
-
-prompt("please text me.");
--> $.prompt("please text me.");
-
-Wait! YOU MUST SEE BEFORE USE THIS PLUGIN,
-------------------------------------------
-this plugin is can't replace as javascript standard function (alert, etc.)
-because, this plugin cannot wait user action while showing dialog.
-If you want get user's action, put a callback function in next of message param.
-when user clicked in a dialog button, such as OK or cancel, msgbox will call your defined function.
-
-OK. so, How to use with callback function?
-------------------------------------------
-
-jQuery.MsgBox can add your callback function for provide next action after user clicked.
-It's Very simple.
-
-```js
-$.alert("click me.",function(){
- $.alert('you clicked');
-});
-```
-```js
-$.confirm("press OK or Cancel.",function(bool){
- $.alert('you clicked'+(bool?'OK':'cancel'));
-});
-```
-```js
-$.prompt("what's your name?",function(string){
- $.alert('your name is '+string);
-});
-```
-
-I want view live example.
--------------------------
-
-OK. [here an example](http://jsfiddle.net/preFy/ "live example").
-
-What browser can run with this plugin?
---------------------------------------
-first, jQuery 1.4 or later needed.
-and, You can run with most popular major browser,
-Internet Explorer 8 or above, Firefox 3 or above, Safari 4 or above, Chrome 10 or above, Opera 9 or above.
-NOTE : Old school browser, such as IE 7 or lower is have a problem with CSS issue.
-that's all. this plugin have NO images or other resources.
-
-Wow! It's simple and cool! can I join with you for make better this plugin?
----------------------------------------------------------------------------
-
-Sure. contributes are welcome! just fork this plugin and get involved to make a better place for you and for me.
-
-
-License
--------
-
-(The MIT License)
-
-Copyright (c) 2011-2012 Ukjin 'composite' Yang
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
+jQuery MsgBox
+=============
+
+0.3.7 BETA
+
+What is it?
+-----------
+
+Firefox style simplist dialog form.
+
+
+How to use this?
+----------------
+
+It's quiet simple.
+
+```html
+
+
+```
+
+alert("i'm alert");
+-> $.alert("i'm alert");
+
+confirm("Are you sure?");
+-> $.confirm("Are you sure?");
+
+prompt("please text me.");
+-> $.prompt("please text me.");
+
+Wait! YOU MUST SEE BEFORE USE THIS PLUGIN,
+------------------------------------------
+this plugin is can't replace as javascript standard function (alert, etc.)
+because, this plugin cannot wait user action while showing dialog.
+If you want get user's action, put a callback function in next of message param.
+when user clicked in a dialog button, such as OK or cancel, msgbox will call your defined function.
+
+OK. so, How to use with callback function?
+------------------------------------------
+
+jQuery.MsgBox can add your callback function for provide next action after user clicked.
+It's Very simple.
+
+```js
+$.alert("click me.",function(){
+ $.alert('you clicked');
+});
+```
+```js
+$.confirm("press OK or Cancel.",function(bool){
+ $.alert('you clicked'+(bool?'OK':'cancel'));
+});
+```
+```js
+$.prompt("what's your name?",function(string){
+ $.alert('your name is '+string);
+});
+```
+
+I want view live example.
+-------------------------
+
+OK. [here's an example](http://jsfiddle.net/preFy/ "live example").
+
+What browser can run with this plugin?
+--------------------------------------
+first, jQuery 1.4 or later needed.
+and, You can run with most popular major browser,
+Internet Explorer 8 or above, Firefox 3 or above, Safari 4 or above, Chrome 10 or above, Opera 9 or above.
+NOTE : Old school browser, such as IE 7 or lower is have a problem with CSS issue.
+that's all. this plugin have NO images or other resources.
+
+Wow! It's simple and cool! can I join with you for make better this plugin?
+---------------------------------------------------------------------------
+
+Sure. contributes are welcome! just fork this plugin and get involved to make a better place for you and for me.
+
+
+License
+-------
+
+(The MIT License)
+
+Copyright (c) 2011-2012 Ukjin 'composite' Yang
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file
diff --git a/jquery.msgbox.js b/jquery.msgbox.js
index 0b6b78f..61f7c5c 100644
--- a/jquery.msgbox.js
+++ b/jquery.msgbox.js
@@ -1,217 +1,226 @@
-/**************************************************************************************
- * jQuery MsgBox 0.3.6
- * by composite (ukjinplant@msn.com)
- * http://blog.hazard.kr
- * This project licensed under a MIT License.
- **************************************************************************************/;
-(function ($) {
- var nofix = $.browser.msie && ~~$.browser.version < 8,
- fixed = nofix ? 'absolute' : 'fixed';
- $.msgbox = function (msg, options) {
- //옵션 가공
- options = $.extend({}, $.msgbox.options, options);
- //변수 및 요소 정의
- var io = {},
- mb = 'msgbox-',
- cok = mb + 'ok',
- cno = mb + 'no',
- pw = 'password',
- styles = options.css || {},
- t = !0,
- f = !1,
- p = ('input' in options),
- q = !! options.confirm,
- iae = function(e) { //포커스된 요소가 메시지박스 아니면 메시지박스로 강제 포커스 이동
- setTimeout(function(){
- var act=$(document.activeElement),ms=['.'+mb+'input','.'+mb+'button'];
- if(act.length&&(act.is(ms[0])||act.is(ms[1]))){console.log('good.');}
- else $C.find(ms+'').eq(0).focus();
- },0);
- },
- $C = $("
").addClass(mb + 'ui').css(styles.ui || {}),
- //경고창
- $M = $("
").addClass(mb + 'modal').css(styles.modal || {}),
- //경고창 배경
- $T = $(" ").addClass(mb + 'msg').css(styles.msg || {}).html(msg).appendTo($C),
- //경고 내용
- $I = p ?
- $("
").addClass(mb + 'inbox').css(styles.indiv || {}).children()
- .addClass(mb + 'input').css(styles.input || {}).bind('keydown',function(e){//탭의 역순 시 마지막 버튼 포커스
- if((window.event ? window.event.keyCode : e.which)==9&&e.shiftKey){
- e.preventDefault();
- $C.find('.'+mb+'button').filter(':last').focus();
- }
- }).bind('blur',iae).end().appendTo($C)
- : null,
- //입력 모드시 입력창
- $B = $("
").addClass(mb + 'buttons').css(styles.buttons || {}).appendTo($C),
- //경고 버튼 나열
- $BT = $(" ").addClass(mb + 'button').css(styles.button || {}).bind('keydown',function(e){
- if(this!=document.activeElement) return;
- e.stopPropagation();
- var code = window.event ? window.event.keyCode : e.which,that=$(this),target,shift=e.shiftKey;
- switch (code) {
- case 9://탭키 누르면 다음 버튼 및 입력창 포커스
- case 39://오른쪽키 누르면 다음 버튼으로만 포커스
- e.preventDefault();
- if(target=that[code==9&&shift?'prev':'next']('button'),target.length) target.focus();
- else if(code==9){
- if(target=$C.find('.'+mb+'input'),target.length) target.select();
- else if(target=that[shift?'next':'prev']('button'),target.length) target.focus();
- }
- break;
- case 37://왼쪽키는 이전 버튼으로만 포커스
- e.preventDefault();
- if(target=that.prev('button'),target.length) target.focus();
- break;
- case 27://ESC는 무조건 취소처리
- e.preventDefault();
- $C.find('button.' + (p || q ? cno : cok)).trigger('click');
- break;
- }
- }).bind('blur',iae),
- //버튼 원형
- $BS = [
- $BT.clone(t).addClass(cok).text(q ? options.yes : options.ok).appendTo($B), p || q ? $BT.clone(t).addClass(cno).text(options.no).appendTo($B) : null]; //경고 버튼들
- $C.add($M).bind('keydown',function(){});
- //입력 모드시 조치사항
- if (p) {
- options.confirm = t; //확인 모드 맞음.
- if (typeof (options.input) == 'string') $I.children().val(options.input);
- }
- //경고창 비활성화 전
- io.before = function (e) {
- var code = window.event ? window.event.keyCode : e.which;
- switch (code) {
- case 27:
- $C.find('button.' + (p || q ? cno : cok)).trigger('click');
- return f;
- }
- };
- //body에 삽입 후 레이아웃 잡기
- var kp = 'keypress',
- kt = '.' + mb + 'ui,.' + mb + 'modal',
- $D = $(document.documentElement ? document.documentElement : document.body).append($M).append($C).bind(kp, io.before);
- //경고창 비활성화 후
- io.after = function (b, v) {
- for (var i = 0, cn = b.className.split(' '); i < cn.length; i++)
- switch (cn[i]) {
- case cok:
- switch (t) {
- case p:
- options.submit.call($C[0], v);
- break;
- case q:
- options.submit.call($C[0], !! t);
- break;
- default:
- options.submit.call($C[0]);
- break;
- }
- break;
- case cno:
- if (p || !(p && q)) {
- options.submit.call($C[0]);
- } else {
- options.submit.call($C[0], f);
- }
- break;
- }
- $D.unbind(kp, io.before);
- };
- //공통 경고 클릭 시 조치
- $C.delegate('button', 'click', function (e) {
- $C.add($M).remove();
- io.after(this, p ? $I.children().val() : null);
- }).delegate('input', 'keypress', io.before);
- //레이아웃 자동정렬
- if (styles.ui) $C.css({
- 'margin-left': ~~ (-$C.outerWidth() * 0.5) + 'px',
- 'margin-top': ~~ (-$C.outerHeight() * 0.32) + 'px'
- });
- //경고창 포커스
- if (p) $C.find('input:text').select();
- else $C.find('button:eq(0)').focus();
- return $C;
- };
- $.extend($.msgbox, {
- strings: {
- ok: 'OK',
- yes: 'OK',
- no: 'Cancel'
- },
- css: {
- ui: {
- 'border': '1px solid black',
- 'font': '9pt verdana,gulim,sans-serif',
- 'background-color': 'white',
- 'position': fixed,
- 'left': '50%',
- 'top': '32%',
- 'overflow': 'hidden'
- },
- modal: {
- 'position': fixed,
- 'left': '0',
- 'top': '0',
- 'right': '0',
- 'bottom': '0',
- 'background-color': 'black',
- 'opacity': '.4'
- },
- msg: {
- 'padding': '2em 4em',
- 'overflow': 'hidden',
- 'font-family': 'verdana,gulim,sans-serif' //,'max-width':(screen.availWidth*0.9)+'px'
- },
- buttons: {
- 'padding': '1em',
- 'background-color': '#eee',
- 'text-align': 'right',
- 'overflow': 'hidden'
- },
- button: {
- 'width': '72px',
- 'margin': 'auto .25em'
- },
- indiv: {
- 'width': '90%',
- 'margin': '-2em auto 2em',
- 'border': '1px inset #3D7BAD'
- },
- input: {
- 'width': '99%',
- 'display': 'block',
- 'border': '0'
- }
- }
- });
- $.msgbox.options = {
- submit: function () {},
- confirm: false,
- //input:false,
- css: $.msgbox.css,
- ok: $.msgbox.strings.ok,
- yes: $.msgbox.strings.yes,
- no: $.msgbox.strings.no
- };
- $.alert = function (msg, callback) {
- return $.msgbox(msg, {
- submit: callback
- });
- };
- $.confirm = function (msg, callback) {
- return $.msgbox(msg, {
- confirm: true,
- submit: callback
- });
- };
- $.prompt = function (msg, val, callback, pw) {
- var shift = $.isFunction(val);
- return $.msgbox(msg, {
- input: shift ? true : val,
- submit: shift ? val : callback,
- password: shift ? callback : pw
- });
- };
+/**************************************************************************************
+ * jQuery MsgBox 0.3.7
+ * by composite (ukjinplant@msn.com)
+ * http://blog.hazard.kr
+ * This project licensed under a MIT License.
+ **************************************************************************************/;
+(function ($) {
+ var nofix = $.browser.msie && ~~$.browser.version < 8,
+ fixed = nofix ? 'absolute' : 'fixed';
+ $.msgbox = function (msg, options) {
+ //옵션 가공
+ options = $.extend({}, $.msgbox.options, options);
+ //변수 및 요소 정의
+ var io = {},
+ mb = 'msgbox-',
+ cok = mb + 'ok',
+ cno = mb + 'no',
+ pw = 'password',
+ styles = options.css || {},
+ t = !0,
+ f = !1,
+ p = ('input' in options),
+ q = !! options.confirm,
+ iae = function(e) { //포커스된 요소가 메시지박스 아니면 메시지박스로 강제 포커스 이동
+ setTimeout(function(){
+ var act=$(document.activeElement),ms=['.'+mb+'input','.'+mb+'button'];
+ if(act.length&&(act.is(ms[0])||act.is(ms[1]))){console.log('good.');}
+ else $C.find(ms+'').eq(0).focus();
+ },0);
+ },
+ $C = $("
").addClass(mb + 'ui').css(styles.ui || {}),
+ //경고창
+ $M = $("
").addClass(mb + 'modal').css(styles.modal || {}),
+ //경고창 배경
+ $T = $(" ").addClass(mb + 'msg').css(styles.msg || {}).html(msg).appendTo($C),
+ //경고 내용
+ $I = p ?
+ $("
").addClass(mb + 'inbox').css(styles.indiv || {}).children()
+ .addClass(mb + 'input').css(styles.input || {}).bind('keydown',function(e){//탭의 역순 시 마지막 버튼 포커스
+ if((window.event ? window.event.keyCode : e.which)==9&&e.shiftKey){
+ e.preventDefault();
+ $C.find('.'+mb+'button').filter(':last').focus();
+ }
+ }).bind('blur',iae).end().appendTo($C)
+ : null,
+ //입력 모드시 입력창
+ $B = $("
").addClass(mb + 'buttons').css(styles.buttons || {}).appendTo($C),
+ //경고 버튼 나열
+ $BT = $(" ").addClass(mb + 'button').css(styles.button || {}).bind('keydown',function(e){
+ if(this!=document.activeElement) return;
+ e.stopPropagation();
+ var code = window.event ? window.event.keyCode : e.which,that=$(this),target,shift=e.shiftKey;
+ switch (code) {
+ case 9://탭키 누르면 다음 버튼 및 입력창 포커스
+ case 39://오른쪽키 누르면 다음 버튼으로만 포커스
+ e.preventDefault();
+ if(target=that[code==9&&shift?'prev':'next']('button'),target.length) target.focus();
+ else if(code==9){
+ if(target=$C.find('.'+mb+'input'),target.length) target.select();
+ else if(target=that[shift?'next':'prev']('button'),target.length) target.focus();
+ }
+ break;
+ case 37://왼쪽키는 이전 버튼으로만 포커스
+ e.preventDefault();
+ if(target=that.prev('button'),target.length) target.focus();
+ break;
+ case 27://ESC는 무조건 취소처리
+ e.preventDefault();
+ $C.find('button.' + (p || q ? cno : cok)).trigger('click');
+ break;
+ }
+ }).bind('blur',iae),
+ //버튼 원형
+ $BS = [
+ $BT.clone(t).addClass(cok).text(q ? options.yes : options.ok).appendTo($B), p || q ? $BT.clone(t).addClass(cno).text(options.no).appendTo($B) : null]; //경고 버튼들
+ $C.add($M).bind('keydown',function(){});
+ //입력 모드시 조치사항
+ if (p) {
+ options.confirm = t; //확인 모드 맞음.
+ if (typeof (options.input) == 'string') $I.children().val(options.input);
+ }
+ //경고창 비활성화 전
+ io.before = function (e) {
+ e.stopPropagation();
+ var code = window.event ? window.event.keyCode : e.which;
+ //전역 메시지박스에도 before가 붙으므로 격리.
+ if(e.target.type=='text'&&!code){
+ $C.find('button.' + (p || q ? cno : cok)).trigger('click');
+ return f;
+ }
+ switch (code) {
+ case 13:
+ $C.find('button.' + cok).trigger('click');
+ return f;
+ case 27:
+ $C.find('button.' + (p || q ? cno : cok)).trigger('click');
+ return f;
+ }
+ };
+ //body에 삽입 후 레이아웃 잡기
+ var kp = 'keypress',
+ kt = '.' + mb + 'ui,.' + mb + 'modal',
+ $D = $(document.documentElement ? document.documentElement : document.body).append($M).append($C).bind(kp, io.before);
+ //경고창 비활성화 후
+ io.after = function (b, v) {
+ for (var i = 0, cn = b.className.split(' '); i < cn.length; i++)
+ switch (cn[i]) {
+ case cok:
+ switch (t) {
+ case p:
+ options.submit.call($C[0], v);
+ break;
+ case q:
+ options.submit.call($C[0], !! t);
+ break;
+ default:
+ options.submit.call($C[0]);
+ break;
+ }
+ break;
+ case cno:
+ if (p || !(p && q)) {
+ options.submit.call($C[0]);
+ } else {
+ options.submit.call($C[0], f);
+ }
+ break;
+ }
+ $D.unbind(kp, io.before);
+ };
+ //공통 경고 클릭 시 조치
+ $C.delegate('button', 'click', function (e) {
+ $C.add($M).remove();
+ io.after(this, p ? $I.children().val() : null);
+ });
+ //레이아웃 자동정렬
+ if (styles.ui) $C.css({
+ 'margin-left': ~~ (-$C.outerWidth() * 0.5) + 'px',
+ 'margin-top': ~~ (-$C.outerHeight() * 0.32) + 'px'
+ });
+ //경고창 포커스
+ if (p) $C.find('input:text').select();
+ else $C.find('button:eq(0)').focus();
+ return $C;
+ };
+ $.extend($.msgbox, {
+ strings: {
+ ok: 'OK',
+ yes: 'OK',
+ no: 'Cancel'
+ },
+ css: {
+ ui: {
+ 'border': '1px solid black',
+ 'font': '9pt verdana,gulim,sans-serif',
+ 'background-color': 'white',
+ 'position': fixed,
+ 'left': '50%',
+ 'top': '32%',
+ 'overflow': 'hidden'
+ },
+ modal: {
+ 'position': fixed,
+ 'left': '0',
+ 'top': '0',
+ 'right': '0',
+ 'bottom': '0',
+ 'background-color': 'black',
+ 'opacity': '.4'
+ },
+ msg: {
+ 'padding': '2em 4em',
+ 'overflow': 'hidden',
+ 'font-family': 'verdana,gulim,sans-serif' //,'max-width':(screen.availWidth*0.9)+'px'
+ },
+ buttons: {
+ 'padding': '1em',
+ 'background-color': '#eee',
+ 'text-align': 'right',
+ 'overflow': 'hidden'
+ },
+ button: {
+ 'width': '72px',
+ 'margin': 'auto .25em'
+ },
+ indiv: {
+ 'width': '90%',
+ 'margin': '-2em auto 2em',
+ 'border': '1px inset #3D7BAD'
+ },
+ input: {
+ 'width': '99%',
+ 'display': 'block',
+ 'border': '0'
+ }
+ }
+ });
+ $.msgbox.options = {
+ submit: function () {},
+ confirm: false,
+ //input:false,
+ css: $.msgbox.css,
+ ok: $.msgbox.strings.ok,
+ yes: $.msgbox.strings.yes,
+ no: $.msgbox.strings.no
+ };
+ $.alert = function (msg, callback) {
+ return $.msgbox(msg, {
+ submit: callback
+ });
+ };
+ $.confirm = function (msg, callback) {
+ return $.msgbox(msg, {
+ confirm: true,
+ submit: callback
+ });
+ };
+ $.prompt = function (msg, val, callback, pw) {
+ var shift = $.isFunction(val);
+ return $.msgbox(msg, {
+ input: shift ? true : val,
+ submit: shift ? val : callback,
+ password: shift ? callback : pw
+ });
+ };
})(jQuery);
\ No newline at end of file
diff --git a/jquery.msgbox.min.js b/jquery.msgbox.min.js
index 54869fa..accbb31 100644
--- a/jquery.msgbox.min.js
+++ b/jquery.msgbox.min.js
@@ -1,7 +1,7 @@
-/***************************************************************
- * jQuery MsgBox 0.2.6
- * by composite (ukjinplant@msn.com)
- * http://blog.hazard.kr
- * Licensed under MIT License.
- ***************************************************************/
- (function(b){var c=b.browser.msie&&~~b.browser.version<8,a=c?"absolute":"fixed";b.msgbox=function(h,g){g=b.extend({},b.msgbox.options,g);var j={},d="msgbox-",i=d+"-ok",B=d+"-no",o="password",k=g.css||{},m=!0,y=!1,u=("input" in g),r=!!g.confirm,z=b("
").addClass(d+"ui").css(k.ui||{}),v=b("
").addClass(d+"modal").css(k.modal||{}),l=b(" ").addClass(d+"msg").css(k.msg||{}).html(h).appendTo(z),w=u?b("
").addClass(d+"inbox").css(k.indiv||{}).children().addClass(d+"input").css(k.input||{}).end().appendTo(z):null,A=b("
").addClass(d+"buttons").css(k.buttons||{}).appendTo(z),n=b(" ").addClass(d+"button").css(k.button||{}),s=[n.clone(m).addClass(i).text(r?g.yes:g.ok).appendTo(A),u||r?n.clone(m).addClass(B).text(g.no).appendTo(A):null];if(u){g.confirm=m;if(typeof(g.input)=="string"){w.children().val(g.input)}}j.before=function(p){var f=window.event?window.event.keyCode:p.which;switch(f){case 13:z.find("button."+i).trigger("click");return y;case 0:case 27:z.find("button."+(u||r?B:i)).trigger("click");return y}};var e="keypress",C="."+d+"ui,."+d+"modal",x=b(document.documentElement?document.documentElement:document.body).append(v).append(z).bind(e,j.before);j.after=function(f,p){for(var q=0,t=f.className.split(" ");q").addClass(d+"ui").css(k.ui||{}),v=b("
").addClass(d+"modal").css(k.modal||{}),l=b(" ").addClass(d+"msg").css(k.msg||{}).html(h).appendTo(z),w=u?b("
").addClass(d+"inbox").css(k.indiv||{}).children().addClass(d+"input").css(k.input||{}).bind("keydown",function(f){if((window.event?window.event.keyCode:f.which)==9&&f.shiftKey){f.preventDefault();z.find("."+d+"button").filter(":last").focus()}}).bind("blur",D).end().appendTo(z):null,A=b("
").addClass(d+"buttons").css(k.buttons||{}).appendTo(z),n=b(" ").addClass(d+"button").css(k.button||{}).bind("keydown",function(E){if(this!=document.activeElement){return}E.stopPropagation();var q=window.event?window.event.keyCode:E.which,p=b(this),t,f=E.shiftKey;switch(q){case 9:case 39:E.preventDefault();if(t=p[q==9&&f?"prev":"next"]("button"),t.length){t.focus()}else{if(q==9){if(t=z.find("."+d+"input"),t.length){t.select()}else{if(t=p[f?"next":"prev"]("button"),t.length){t.focus()}}}}break;case 37:E.preventDefault();if(t=p.prev("button"),t.length){t.focus()}break;case 27:E.preventDefault();z.find("button."+(u||r?B:i)).trigger("click");break}}).bind("blur",D),s=[n.clone(m).addClass(i).text(r?g.yes:g.ok).appendTo(A),u||r?n.clone(m).addClass(B).text(g.no).appendTo(A):null];z.add(v).bind("keydown",function(){});if(u){g.confirm=m;if(typeof(g.input)=="string"){w.children().val(g.input)}}j.before=function(p){p.stopPropagation();var f=window.event?window.event.keyCode:p.which;if(p.target.type=="text"&&!f){z.find("button."+(u||r?B:i)).trigger("click");return y}switch(f){case 13:z.find("button."+i).trigger("click");return y;case 27:z.find("button."+(u||r?B:i)).trigger("click");return y}};var e="keypress",C="."+d+"ui,."+d+"modal",x=b(document.documentElement?document.documentElement:document.body).append(v).append(z).bind(e,j.before);j.after=function(f,p){for(var q=0,t=f.className.split(" ");q
Date: Tue, 11 Sep 2012 10:54:03 +0900
Subject: [PATCH 03/27] Caution of use this plugin with examples.
---
README.md | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/README.md b/README.md
index 5469d79..53141d0 100644
--- a/README.md
+++ b/README.md
@@ -35,6 +35,30 @@ because, this plugin cannot wait user action while showing dialog.
If you want get user's action, put a callback function in next of message param.
when user clicked in a dialog button, such as OK or cancel, msgbox will call your defined function.
+Please don't..
+```js
+form.submit=function(){
+ //All MsgBox function returns MsgBox Container Object. so it'll return always true.
+ if($.confirm('Are you sure to save it?')){
+ return true;//Page will changed without your confirm.
+ }
+ return false;
+}
+```
+**So, what can I do?**
+```js
+form.submit=function(){
+ if(!form.confirm){//Use variables or DOM objects or whatever you want.
+ $.confirm('Are you sure to save it?',function(answer){
+ form.confirm=answer;
+ if(answer) form.submit();//submit again to verify confirm value.
+ });
+ return false;//You should use this line to prevent page changes.
+ }else return true;
+}
+```
+* You can use another solution to solve this.
+
OK. so, How to use with callback function?
------------------------------------------
@@ -75,6 +99,13 @@ Wow! It's simple and cool! can I join with you for make better this plugin?
Sure. contributes are welcome! just fork this plugin and get involved to make a better place for you and for me.
+Goals
+-----
+
+ - More Simplify and Optimization.
+ - Less Size and Unresolved Issues.
+ - **Deferred Object Intergration**
+
License
-------
From 97f85e50f04e4e74fff98600a9409642de291f9f Mon Sep 17 00:00:00 2001
From: composite
Date: Tue, 11 Sep 2012 13:08:14 +0900
Subject: [PATCH 04/27] I won't to intergration with this.
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 53141d0..cbdae1f 100644
--- a/README.md
+++ b/README.md
@@ -104,7 +104,7 @@ Goals
- More Simplify and Optimization.
- Less Size and Unresolved Issues.
- - **Deferred Object Intergration**
+ - **All Methods will returns Deferred Object instead of DOM Container**
License
From 42d242ffa51c3526d1694c2f99f734537013426c Mon Sep 17 00:00:00 2001
From: Ukjin Yang
Date: Wed, 11 Dec 2013 11:58:15 +0900
Subject: [PATCH 05/27] Applied more compatibility.
Use <div> with white-space: pre; instead of <pre> for more
better view of MsgBox with CSS Framework such as Bootstrap.
Remove Browser compatibility for position:fixed is buggy under IE 7, so
this will support jQuery over 1.8! I'll never test freaking old
browsers.
---
README.md | 22 +++++++++++++++++-----
demo.html | 4 ++--
jquery-1.7.2.min.js | 4 ----
jquery.msgbox.js | 19 +++++++++++--------
jquery.msgbox.min.js | 8 ++++----
readme.txt | 7 ++++---
6 files changed, 38 insertions(+), 26 deletions(-)
delete mode 100644 jquery-1.7.2.min.js
diff --git a/README.md b/README.md
index cbdae1f..243a633 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
jQuery MsgBox
=============
-0.3.7 BETA
+0.5.0 BETA
What is it?
-----------
@@ -67,12 +67,12 @@ It's Very simple.
```js
$.alert("click me.",function(){
- $.alert('you clicked');
+ $.alert('you are clicked!');
});
```
```js
$.confirm("press OK or Cancel.",function(bool){
- $.alert('you clicked'+(bool?'OK':'cancel'));
+ $.alert('you are clicked '+(bool?'OK':'cancel'));
});
```
```js
@@ -84,7 +84,7 @@ $.prompt("what's your name?",function(string){
I want view live example.
-------------------------
-OK. [here's an example](http://jsfiddle.net/preFy/ "live example").
+Sure. [here's an example](http://jsfiddle.net/preFy/ "live example").
What browser can run with this plugin?
--------------------------------------
@@ -99,12 +99,24 @@ Wow! It's simple and cool! can I join with you for make better this plugin?
Sure. contributes are welcome! just fork this plugin and get involved to make a better place for you and for me.
+Hey, I'm using IE version under 9, Msgbox flicking when showing MsgBox. What's happening?
+------------------------------------------------------------------------------------------
+
+Sorry. that is prevent changing width dynamically after center align on IE. I don't know it is bug, but I'll figure out it.
+
Goals
-----
- More Simplify and Optimization.
- Less Size and Unresolved Issues.
- - **All Methods will returns Deferred Object instead of DOM Container**
+ - **All Methods will returns Deferred Object instead of DOM Container** ??? Well, I'll think about it.
+
+What's new?
+-----
+
+ - Use <div> with white-space: pre; instead of <pre> for more better view of MsgBox with CSS Framework such as Bootstrap.
+ - Remove Browser compatibility for position:fixed is buggy under IE 7, so this will support jQuery over 1.8! I'll never test freaking old browsers.
+ - Remove jQuery in my repository, Use any available jQuery CDN in demo instead.
License
diff --git a/demo.html b/demo.html
index 51b685b..5d004bc 100644
--- a/demo.html
+++ b/demo.html
@@ -7,12 +7,12 @@
일반 경고창
경고창
- 긴 경고창
+ 긴 경고창
질문창
입력창
긴 입력창
일반 입력창
-
+ ');
```
-alert("i'm alert");
--> $.alert("i'm alert");
+ alert("i'm alert");
+ -> $.alert("i'm alert");
-confirm("Are you sure?");
--> $.confirm("Are you sure?");
+ confirm("Are you sure?");
+ -> $.confirm("Are you sure?");
-prompt("please text me.");
--> $.prompt("please text me.");
+ prompt("please text me.");
+ -> $.prompt("please text me.");
-Wait! YOU MUST SEE BEFORE USE THIS PLUGIN,
-------------------------------------------
+## Wait! YOU MUST SEE BEFORE USE THIS PLUGIN,
this plugin is can't replace as javascript standard function (alert, etc.)
because, this plugin cannot wait user action while showing dialog.
If you want get user's action, put a callback function in next of message param.
@@ -46,6 +42,7 @@ form.submit=function(){
}
```
**So, what can I do?**
+
```js
form.submit=function(){
if(!form.confirm){//Use variables or DOM objects or whatever you want.
@@ -59,8 +56,7 @@ form.submit=function(){
```
* You can use another solution to solve this.
-OK. so, How to use with callback function?
-------------------------------------------
+## OK. so, How to use with callback function?
jQuery.MsgBox can add your callback function for provide next action after user clicked.
It's Very simple.
@@ -81,59 +77,51 @@ $.prompt("what's your name?",function(string){
});
```
-I want view live example.
--------------------------
+## I want view live example.
Sure. [here's an example](http://jsfiddle.net/preFy/ "live example").
-What browser can run with this plugin?
---------------------------------------
+## What browser can run with this plugin?
+
first, jQuery 1.4 or later needed.
and, You can run with most popular major browser,
Internet Explorer 8 or above, Firefox 3 or above, Safari 4 or above, Chrome 10 or above, Opera 9 or above.
NOTE : Old school browser, such as IE 7 or lower is have a problem with CSS issue.
that's all. this plugin have NO images or other resources.
-I want use as own style, is it possible?
-----------------------------------------
+## I want use as own style, is it possible?
Yes. check out [Wiki](https://github.com/composite/jQuery.MsgBox/wiki) for detailed usage.
-Wow! It's simple and cool! can I join with you for make better this plugin?
----------------------------------------------------------------------------
+## Wow! It's simple and cool! can I join with you for make better this plugin?
Sure. contributes are welcome! just fork this plugin and get involved to make a better place for you and for me.
-Hey, I'm using IE version under 9, Msgbox flicking when showing MsgBox. What's happening?
-------------------------------------------------------------------------------------------
+## Hey, I'm using IE version under 9, Msgbox flicking when showing MsgBox. What's happening?
Sorry. that is prevent changing width dynamically after center align on IE. I don't know it is bug, but I'll figure out it.
-Goals
------
+## Goals
- More Simplify and Optimization.
- Less Size and Unresolved Issues.
- **Use CSS instead of inline style!!!**
- **All Methods will returns Deferred Object instead of DOM Container** ??? Well, I'll think about it.
-What's new?
------
+## What's new?
-0.5.0
-=====
+### 0.5.0
- Use <div> with white-space: pre; instead of <pre> for more better view of MsgBox with CSS Framework such as Bootstrap.
- Remove Browser compatibility for position:fixed is buggy under IE 7, so this will support jQuery over 1.8! I'll never test freaking old browsers.
- Remove jQuery in my repository, Use any available jQuery CDN in demo instead.
-0.6.0
-=====
+### 0.6.0
+
- Auto resizing added. Msgbox will show full size when window size less than alert size, If not, revert original size.
-License
--------
+## License
(The MIT License)
From 4b97e0e7c431ab1bb44abedc4bd240235c38033c Mon Sep 17 00:00:00 2001
From: Ukjin Yang
Date: Thu, 12 Dec 2013 13:43:05 +0900
Subject: [PATCH 12/27] spelling
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 53966c1..c375ed6 100644
--- a/README.md
+++ b/README.md
@@ -118,7 +118,7 @@ Sorry. that is prevent changing width dynamically after center align on IE. I do
### 0.6.0
- - Auto resizing added. Msgbox will show full size when window size less than alert size, If not, revert original size.
+ - Auto resizing added. Msgbox will show full size when window size less than alert size, If not, revert to original size.
## License
From ec3ccfbfe9faf49b3c43c1d1aebb7ad4390443ba Mon Sep 17 00:00:00 2001
From: Ukjin Yang
Date: Thu, 12 Dec 2013 14:12:36 +0900
Subject: [PATCH 13/27] Fixed enter key event
Fixed forced true callback after press ENTER key. focused button will
fired event if you press ENTER key.
---
README.md | 11 +++++++----
jquery.msgbox.js | 13 +++++++------
jquery.msgbox.min.js | 4 ++--
3 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/README.md b/README.md
index c375ed6..edb71e7 100644
--- a/README.md
+++ b/README.md
@@ -110,16 +110,19 @@ Sorry. that is prevent changing width dynamically after center align on IE. I do
## What's new?
-### 0.5.0
+### 0.6.1
- - Use <div> with white-space: pre; instead of <pre> for more better view of MsgBox with CSS Framework such as Bootstrap.
- - Remove Browser compatibility for position:fixed is buggy under IE 7, so this will support jQuery over 1.8! I'll never test freaking old browsers.
- - Remove jQuery in my repository, Use any available jQuery CDN in demo instead.
+ - Fixed forced true callback after press ENTER key. focused button will fired event if you press ENTER key.
### 0.6.0
- Auto resizing added. Msgbox will show full size when window size less than alert size, If not, revert to original size.
+### 0.5.0
+
+ - Use <div> with white-space: pre; instead of <pre> for more better view of MsgBox with CSS Framework such as Bootstrap.
+ - Remove Browser compatibility for position:fixed is buggy under IE 7, so this will support jQuery over 1.8! I'll never test freaking old browsers.
+ - Remove jQuery in my repository, Use any available jQuery CDN in demo instead.
## License
diff --git a/jquery.msgbox.js b/jquery.msgbox.js
index dd7fd3f..164aa6c 100644
--- a/jquery.msgbox.js
+++ b/jquery.msgbox.js
@@ -1,5 +1,5 @@
/**************************************************************************************
- * jQuery MsgBox 0.6.0
+ * jQuery MsgBox 0.6.1
* by composite (ukjinplant@msn.com)
* http://blog.hazard.kr
* This project licensed under a MIT License.
@@ -55,12 +55,13 @@
//경고 버튼 나열
$BT = $(" ").addClass(mb + 'button').css(styles.button || {}).bind('keydown',function(e){
if(this!=document.activeElement) return;
- e.stopPropagation();
+
+ e.stopPropagation();
var code = window.event ? window.event.keyCode : e.which,that=$(this),target,shift=e.shiftKey;
switch (code) {
case 9://탭키 누르면 다음 버튼 및 입력창 포커스
case 39://오른쪽키 누르면 다음 버튼으로만 포커스
- e.preventDefault();
+ e.preventDefault();
if(target=that[code==9&&shift?'prev':'next']('button'),target.length) target.focus();
else if(code==9){
if(target=$C.find('.'+mb+'input'),target.length) target.select();
@@ -68,11 +69,11 @@
}
break;
case 37://왼쪽키는 이전 버튼으로만 포커스
- e.preventDefault();
+ e.preventDefault();
if(target=that.prev('button'),target.length) target.focus();
break;
case 27://ESC는 무조건 취소처리
- e.preventDefault();
+ e.preventDefault();
$C.find('button.' + (p || q ? cno : cok)).trigger('click');
break;
}
@@ -130,7 +131,7 @@
}
switch (code) {
case 13:
- $C.find('button.' + cok).trigger('click');
+ $C.find('button:focus').trigger('click');
return f;
case 27:
$C.find('button.' + (p || q ? cno : cok)).trigger('click');
diff --git a/jquery.msgbox.min.js b/jquery.msgbox.min.js
index 2dfb8fe..c5a279e 100644
--- a/jquery.msgbox.min.js
+++ b/jquery.msgbox.min.js
@@ -1,7 +1,7 @@
/**************************************************************************************
- * jQuery MsgBox 0.6.0
+ * jQuery MsgBox 0.6.1
* by composite (ukjinplant@msn.com)
* http://blog.hazard.kr
* This project licensed under a MIT License.
**************************************************************************************/;
-(function(e){if(!window.console){window.console={};window.console.log=e.noop}var d="fixed",b="keypress",a="resize",c=function(f){return !f||f=="auto"};e.msgbox=function(i,h){h=e.extend({},e.msgbox.options,h);var k={},g="msgbox-",j=g+"ok",D=g+"no",s="password",l=h.css||{},o=!0,A=!1,w=("input" in h),u=!!h.confirm,F=function(f){setTimeout(function(){var p=e(document.activeElement),q=["."+g+"input","."+g+"button"];if(p.length&&(p.is(q[0])||p.is(q[1]))){console.log("good.")}else{B.find(q+"").eq(0).focus()}},0)},m=e(window),B=e("
").addClass(g+"ui").addClass(g+(w?"prompt":(u?"confirm":"alert"))).css(l.ui||{}),x=e("
").addClass(g+"modal").css(l.modal||{}),n=e("
").addClass(g+"msg").css(l.msg||{}).html(i).appendTo(B),y=w?e("
").addClass(g+"inbox").css(l.inbox||{}).children().addClass(g+"input").css(l.input||{}).bind("keydown",function(f){if((window.event?window.event.keyCode:f.which)==9&&f.shiftKey){f.preventDefault();B.find("."+g+"button").filter(":last").focus()}}).bind("blur",F).end().appendTo(B):null,C=e("
").addClass(g+"buttons").css(l.buttons||{}).appendTo(B),r=e(" ").addClass(g+"button").css(l.button||{}).bind("keydown",function(G){if(this!=document.activeElement){return}G.stopPropagation();var q=window.event?window.event.keyCode:G.which,p=e(this),t,f=G.shiftKey;switch(q){case 9:case 39:G.preventDefault();if(t=p[q==9&&f?"prev":"next"]("button"),t.length){t.focus()}else{if(q==9){if(t=B.find("."+g+"input"),t.length){t.select()}else{if(t=p[f?"next":"prev"]("button"),t.length){t.focus()}}}}break;case 37:G.preventDefault();if(t=p.prev("button"),t.length){t.focus()}break;case 27:G.preventDefault();B.find("button."+(w||u?D:j)).trigger("click");break}}).bind("blur",F),v=[r.clone(o).addClass(j).text(u?h.yes:h.ok).appendTo(C),w||u?r.clone(o).addClass(D).text(h.no).appendTo(C):null];B.add(x).bind("keydown",function(){});if(w){h.confirm=o;if(typeof(h.input)=="string"){y.children().val(h.input)}}m.bind(a,k[a]=function(){if(!k.firstWidth){k.firstUnder=true;k.firstWidth=B.outerWidth();console.log(k.firstWidth)}var f=m.width()-20<=k.firstWidth;if(l.ui){if(f&&!k.isOver){console.log("OVER");k.isOver=true;B.css({width:"auto",left:"10px",right:"10px","margin-left":"0","margin-top":~~(-B.outerHeight()*0.32)+"px"})}else{if((!f&&k.isOver)||k.firstUnder){console.log("UNDER");k.firstUnder=false;k.isOver=false;B.css({width:k.firstWidth+"px",left:l.ui.left||"auto",right:l.ui.right||"auto","margin-left":~~(-k.firstWidth*0.5)+"px","margin-top":~~(-B.outerHeight()*0.32)+"px"})}}}});k.before=function(p){p.stopPropagation();var f=window.event?window.event.keyCode:p.which;if(p.target.type=="text"&&!f){B.find("button."+(w||u?D:j)).trigger("click");return A}switch(f){case 13:B.find("button."+j).trigger("click");return A;case 27:B.find("button."+(w||u?D:j)).trigger("click");return A}};var E="."+g+"ui,."+g+"modal",z=e(document.documentElement?document.documentElement:document.body).append(x).append(B).bind(b,k.before);k.after=function(f,p){for(var q=0,t=f.className.split(" ");q").addClass(g+"ui").addClass(g+(w?"prompt":(u?"confirm":"alert"))).css(l.ui||{}),x=e("
").addClass(g+"modal").css(l.modal||{}),n=e("
").addClass(g+"msg").css(l.msg||{}).html(i).appendTo(B),y=w?e("
").addClass(g+"inbox").css(l.inbox||{}).children().addClass(g+"input").css(l.input||{}).bind("keydown",function(f){if((window.event?window.event.keyCode:f.which)==9&&f.shiftKey){f.preventDefault();B.find("."+g+"button").filter(":last").focus()}}).bind("blur",F).end().appendTo(B):null,C=e("
").addClass(g+"buttons").css(l.buttons||{}).appendTo(B),r=e(" ").addClass(g+"button").css(l.button||{}).bind("keydown",function(G){if(this!=document.activeElement){return}G.stopPropagation();var q=window.event?window.event.keyCode:G.which,p=e(this),t,f=G.shiftKey;switch(q){case 9:case 39:G.preventDefault();if(t=p[q==9&&f?"prev":"next"]("button"),t.length){t.focus()}else{if(q==9){if(t=B.find("."+g+"input"),t.length){t.select()}else{if(t=p[f?"next":"prev"]("button"),t.length){t.focus()}}}}break;case 37:G.preventDefault();if(t=p.prev("button"),t.length){t.focus()}break;case 27:G.preventDefault();B.find("button."+(w||u?D:j)).trigger("click");break}}).bind("blur",F),v=[r.clone(o).addClass(j).text(u?h.yes:h.ok).appendTo(C),w||u?r.clone(o).addClass(D).text(h.no).appendTo(C):null];B.add(x).bind("keydown",function(){});if(w){h.confirm=o;if(typeof(h.input)=="string"){y.children().val(h.input)}}m.bind(a,k[a]=function(){if(!k.firstWidth){k.firstUnder=true;k.firstWidth=B.outerWidth();console.log(k.firstWidth)}var f=m.width()-20<=k.firstWidth;if(l.ui){if(f&&!k.isOver){console.log("OVER");k.isOver=true;B.css({width:"auto",left:"10px",right:"10px","margin-left":"0","margin-top":~~(-B.outerHeight()*0.32)+"px"})}else{if((!f&&k.isOver)||k.firstUnder){console.log("UNDER");k.firstUnder=false;k.isOver=false;B.css({width:k.firstWidth+"px",left:l.ui.left||"auto",right:l.ui.right||"auto","margin-left":~~(-k.firstWidth*0.5)+"px","margin-top":~~(-B.outerHeight()*0.32)+"px"})}}}});k.before=function(p){p.stopPropagation();var f=window.event?window.event.keyCode:p.which;if(p.target.type=="text"&&!f){B.find("button."+(w||u?D:j)).trigger("click");return A}switch(f){case 13:B.find("button:focus").trigger("click");return A;case 27:B.find("button."+(w||u?D:j)).trigger("click");return A}};var E="."+g+"ui,."+g+"modal",z=e(document.documentElement?document.documentElement:document.body).append(x).append(B).bind(b,k.before);k.after=function(f,p){for(var q=0,t=f.className.split(" ");q
Date: Thu, 12 Dec 2013 14:13:18 +0900
Subject: [PATCH 14/27] version changed
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index edb71e7..087abfd 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# jQuery MsgBox
-0.6.0 BETA
+0.6.1 BETA
## What is it?
From 92d9bba9ac41e32e1ce93817bfb1b2e20a32a536 Mon Sep 17 00:00:00 2001
From: Ukjin Yang
Date: Thu, 12 Dec 2013 17:04:25 +0900
Subject: [PATCH 15/27] 0.7.4 update
---
README.md | 31 +++++++-
jquery.msgbox.js | 181 +++++++++++++++++++++++++++++++------------
jquery.msgbox.min.js | 4 +-
3 files changed, 161 insertions(+), 55 deletions(-)
diff --git a/README.md b/README.md
index 087abfd..7e6b662 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# jQuery MsgBox
-0.6.1 BETA
+0.7.4 BETA
## What is it?
@@ -105,11 +105,38 @@ Sorry. that is prevent changing width dynamically after center align on IE. I do
- More Simplify and Optimization.
- Less Size and Unresolved Issues.
- - **Use CSS instead of inline style!!!**
- **All Methods will returns Deferred Object instead of DOM Container** ??? Well, I'll think about it.
## What's new?
+### 0.7.4
+
+ - Container add for prompt bug fixed.
+ - fixed prompt UI.
+
+### 0.7.3 (internal)
+
+ - onresize event callback changed; this keyword will point to msgbox container. plain DOM, not jQuery.
+
+### 0.7.2 (internal)
+
+ - remove static property **customStyle**. just add style ``` ``` or ```
``` instead.
+ - Fixed minor UI bugs.
+
+### 0.7.1 (Internal)
+
+ - Fixed some bug.
+ - console.log() for test is will not fired in production mode.
+
+### 0.7.0 (Internal)
+
+ - Replaced inline style to inline CSS for more performance.
+ - Removed css property in $.msgbox() use $.msgbox.css or own standard CSS instead.
+ - input property of $.msgbox changed. You can set any human-view type (string, number, etc). if not want prompt, just set false or undefined or null.
+ - Fixed ENTER or ESC press event bug in input box
+ - new property: onresize; available on $.msgbox() or $.msgbox.onresize static property. You can prepare when window size changes. see wiki for details.
+ - new static property: customStyle; You want set own style instead of default style, just add your code : ```$.msgbox.customStyle = true;```
+
### 0.6.1
- Fixed forced true callback after press ENTER key. focused button will fired event if you press ENTER key.
diff --git a/jquery.msgbox.js b/jquery.msgbox.js
index 164aa6c..525cba6 100644
--- a/jquery.msgbox.js
+++ b/jquery.msgbox.js
@@ -1,5 +1,5 @@
/**************************************************************************************
- * jQuery MsgBox 0.6.1
+ * jQuery MsgBox 0.7.4
* by composite (ukjinplant@msn.com)
* http://blog.hazard.kr
* This project licensed under a MIT License.
@@ -9,13 +9,57 @@
window.console = {};
window.console.log = $.noop;
}
- var fixed = 'fixed', kp = 'keypress', rs = 'resize'
+ var fixed = 'fixed', div = 'div', kp = 'keypress', rs = 'resize', legacy = 'v' == '\v' //IE 8 대응.
,isCssDef = function(css){
return !css || css == 'auto';
- };
+ },$$ = function(tag){return $(document.createElement(tag));};
+
+ //첫 메시지박스 실행시 스타일시트 삽입
+ var styleGen = function(style, repl){
+ if(styleGen.once && !repl) return;
+ style = style || {};
+ var css = styleGen.style ? styleGen.style : (styleGen.style = $$('style').addClass('msgbox-style').attr('type','text/css')), builder = [];
+
+ for(var part in style){
+ if(!style[part]){continue;}
+ var cs = style[part];
+
+ builder.push('.msgbox-' + part);
+ builder.push('{');
+
+ for(var name in cs){
+ if(legacy){
+ switch(name){
+ case 'opacity':builder.push('filter:alpha(opacity=' + (+(cs[name].substring(0,1) == '.' ? ('0'+cs[name]) : cs[name]) * 100 || 100) + ');');break;
+ default:builder.push(name + ':' + cs[name] + ';');break;
+ }
+ }else{
+ builder.push(name + ':' + cs[name] + ';');
+ }
+ }
+
+ builder.push('}');
+ }
+
+ css.each(function(){ // IE 8 때문에 별도의 방법 사용
+ var cont = builder.join('');
+ if(legacy){ // IE 문제 해결
+ this.styleSheet.cssText = cont;
+ }else{ // 나머지는 표준대로
+ this.innerHTML = cont;
+ }
+ }).appendTo('head');
+ styleGen.once = true;
+ }
+
+ //함수 실행부
$.msgbox = function (msg, options) {
//옵션 가공
options = $.extend({}, $.msgbox.options, options);
+
+ //스타일 생성
+ if(!$('.msgbox-style').length){styleGen($.msgbox.css);}
+
//변수 및 요소 정의
var io = {},
mb = 'msgbox-',
@@ -25,39 +69,54 @@
styles = options.css || {},
t = !0,
f = !1,
- p = ('input' in options),
- q = !! options.confirm,
+ p = options.input !== false && options.input != undefined && options.input != null,
+ q = !!options.confirm,
iae = function(e) { //포커스된 요소가 메시지박스 아니면 메시지박스로 강제 포커스 이동
setTimeout(function(){
var act=$(document.activeElement),ms=['.'+mb+'input','.'+mb+'button'];
- if(act.length&&(act.is(ms[0])||act.is(ms[1]))){console.log('good.');}
+ if(act.length&&(act.is(ms[0])||act.is(ms[1]))){
+ //console.log('good.');
+ }
else $C.find(ms+'').eq(0).focus();
},0);
},
$W = $(window),
- $C = $("
").addClass(mb + 'ui').addClass(mb + (p ? 'prompt' : (q ? 'confirm' : 'alert'))).css(styles.ui || {}),
//경고창
- $M = $("
").addClass(mb + 'modal').css(styles.modal || {}),
+ $C = $$(div).addClass(mb + 'ui').addClass(mb + (p ? 'prompt' : (q ? 'confirm' : 'alert'))),
//경고창 배경
- $T = $("
").addClass(mb + 'msg').css(styles.msg || {}).html(msg).appendTo($C),
+ $M = $$(div).addClass(mb + 'modal'),
//경고 내용
+ $T = $$(div).addClass(mb + 'msg').html(msg).appendTo($C),
+ //입력 모드시 입력창
$I = p ?
- $("
").addClass(mb + 'inbox').css(styles.inbox || {}).children()
- .addClass(mb + 'input').css(styles.input || {}).bind('keydown',function(e){//탭의 역순 시 마지막 버튼 포커스
- if((window.event ? window.event.keyCode : e.which)==9&&e.shiftKey){
+ $("
").addClass(mb + 'inbox').children()
+ .addClass(mb + 'input').bind('keydown',function(e){//탭의 역순 시 마지막 버튼 포커스
+ var code = e.which;
+ if(code == 9 && e.shiftKey){
e.preventDefault();
$C.find('.'+mb+'button').filter(':last').focus();
- }
+ }else{
+ switch(code){
+ case 13://엔터는 확인
+ e.preventDefault();
+ $C.find('button.' + cok).trigger('click');
+ return false;
+ case 27://ESC는 취소
+ e.preventDefault();
+ $C.find('button.' + (p || q ? cno : cok)).trigger('click');
+ break;
+ }
+ }
}).bind('blur',iae).end().appendTo($C)
: null,
- //입력 모드시 입력창
- $B = $("
").addClass(mb + 'buttons').css(styles.buttons || {}).appendTo($C),
//경고 버튼 나열
- $BT = $(" ").addClass(mb + 'button').css(styles.button || {}).bind('keydown',function(e){
+ $B = $$(div).addClass(mb + 'buttons').appendTo($C),
+ //기본 버튼
+ $BT = $$("button").addClass(mb + 'button').bind('keydown',function(e){
if(this!=document.activeElement) return;
e.stopPropagation();
- var code = window.event ? window.event.keyCode : e.which,that=$(this),target,shift=e.shiftKey;
+ var code = e.which,that=$(this),target,shift=e.shiftKey;
switch (code) {
case 9://탭키 누르면 다음 버튼 및 입력창 포커스
case 39://오른쪽키 누르면 다음 버튼으로만 포커스
@@ -82,43 +141,27 @@
$BS = [
$BT.clone(t).addClass(cok).text(q ? options.yes : options.ok).appendTo($B), p || q ? $BT.clone(t).addClass(cno).text(options.no).appendTo($B) : null]; //경고 버튼들
$C.add($M).bind('keydown',function(){});
+ $.extend($C[0], {modal: $M[0], msg: $T[0], inbox: $I ? $I[0] : null, buttons: $B[0]});
//입력 모드시 조치사항
if (p) {
options.confirm = t; //확인 모드 맞음.
- if (typeof (options.input) == 'string') $I.children().val(options.input);
+ if (options.input !== true) $I.children().val(options.input);
}
//윈도우 리사이징에 대한 메시지박스 반응
$W.bind(rs,io[rs] = function() {
if(!io.firstWidth){
io.firstUnder = true;
io.firstWidth = $C.outerWidth();
- console.log(io.firstWidth);
+ //console.log(io.firstWidth);
}
var isOver = $W.width() - 20 <= io.firstWidth;
- if (styles.ui){
- if(isOver && !io.isOver){
- console.log('OVER');
- io.isOver = true;
- $C.css({
- 'width': 'auto',
- 'left': '10px',
- 'right': '10px',
- 'margin-left': '0',
- 'margin-top': ~~ (-$C.outerHeight() * 0.32) + 'px'
- });
- }else if((!isOver && io.isOver) || io.firstUnder){
- console.log('UNDER');
- io.firstUnder = false;
- io.isOver = false;
- $C.css({
- 'width': io.firstWidth + 'px',
- 'left': styles.ui.left || 'auto',
- 'right': styles.ui.right || 'auto',
- 'margin-left': ~~ (-io.firstWidth * 0.5) + 'px',
- 'margin-top': ~~ (-$C.outerHeight() * 0.32) + 'px'
- });
+ if (!$.isFunction(options.onresize)){
+ if($.isFunction($.msgbox.onresize)){
+ $.msgbox.onresize.call($C[0], io);
}
- }
+ }else{
+ options.onresize.call($C[0], io);
+ }
});
//경고창 비활성화 전
io.before = function (e) {
@@ -140,7 +183,7 @@
};
//body에 삽입 후 레이아웃 잡기
var kt = '.' + mb + 'ui,.' + mb + 'modal',
- $D = $(document.documentElement ? document.documentElement : document.body).append($M).append($C).bind(kp, io.before);
+ $D = $(document.documentElement || document.body).append($M).append($C).bind(kp, io.before);
//경고창 비활성화 후
io.after = function (b, v) {
for (var i = 0, cn = b.className.split(' '); i < cn.length; i++)
@@ -174,13 +217,18 @@
$C.add($M).remove();
io.after(this, p ? $I.children().val() : null);
});
- //레이아웃 자동정렬
- setTimeout(function(){ //setTimeout 으로 pre 속성으로 인한 IE 중앙정렬 문제 수정
+
+ var prepare = function(){
+ //레이아웃 자동정렬
$W.trigger(rs);
- },0);
- //경고창 포커스
- if (p) $C.find('input:text').select();
- else $C.find('button:eq(0)').focus();
+ //경고창 포커스
+ if (p) $C.find('input:text').select();
+ else $C.find('button:eq(0)').focus();
+ };
+
+ if(legacy){setTimeout(prepare,0);}
+ else{prepare();}
+
return $C;
};
$.extend($.msgbox, {
@@ -228,7 +276,7 @@
},
inbox: {
'width': '90%',
- 'margin': '-2em auto 2em',
+ 'margin': '-1em auto 1em',
'border': '1px inset #3D7BAD'
},
input: {
@@ -236,13 +284,44 @@
'display': 'block',
'border': '0'
}
+ },
+ onresize: function(io){
+ var $C = $(this);
+ if(!io.firstWidth){
+ io.firstUnder = true;
+ io.firstWidth = $C.outerWidth();
+ console.log(io.firstWidth);
+ }
+ var isOver = $(window).width() - 20 <= io.firstWidth;
+ if(isOver && !io.isOver){
+ //console.debug('OVER');
+ io.isOver = true;
+ $C.css({
+ 'width': 'auto',
+ 'left': '10px',
+ 'right': '10px',
+ 'margin-left': '0',
+ 'margin-top': ~~ (-$C.outerHeight() * 0.32) + 'px'
+ });
+ }else if((!isOver && io.isOver) || io.firstUnder){
+ //console.log('UNDER');
+ io.firstUnder = false;
+ io.isOver = false;
+ $C.css({
+ 'width': io.firstWidth + 'px',
+ 'left': '',
+ 'right': '',
+ 'margin-left': ~~ (-io.firstWidth * 0.5) + 'px',
+ 'margin-top': ~~ (-$C.outerHeight() * 0.32) + 'px'
+ });
+ }
}
});
$.msgbox.options = {
submit: function () {},
confirm: false,
//input:false,
- css: $.msgbox.css,
+ //onresize: function(){},
ok: $.msgbox.strings.ok,
yes: $.msgbox.strings.yes,
no: $.msgbox.strings.no
diff --git a/jquery.msgbox.min.js b/jquery.msgbox.min.js
index c5a279e..cdddb30 100644
--- a/jquery.msgbox.min.js
+++ b/jquery.msgbox.min.js
@@ -1,7 +1,7 @@
/**************************************************************************************
- * jQuery MsgBox 0.6.1
+ * jQuery MsgBox 0.7.4
* by composite (ukjinplant@msn.com)
* http://blog.hazard.kr
* This project licensed under a MIT License.
**************************************************************************************/;
-(function(e){if(!window.console){window.console={};window.console.log=e.noop}var d="fixed",b="keypress",a="resize",c=function(f){return !f||f=="auto"};e.msgbox=function(i,h){h=e.extend({},e.msgbox.options,h);var k={},g="msgbox-",j=g+"ok",D=g+"no",s="password",l=h.css||{},o=!0,A=!1,w=("input" in h),u=!!h.confirm,F=function(f){setTimeout(function(){var p=e(document.activeElement),q=["."+g+"input","."+g+"button"];if(p.length&&(p.is(q[0])||p.is(q[1]))){console.log("good.")}else{B.find(q+"").eq(0).focus()}},0)},m=e(window),B=e("
").addClass(g+"ui").addClass(g+(w?"prompt":(u?"confirm":"alert"))).css(l.ui||{}),x=e("
").addClass(g+"modal").css(l.modal||{}),n=e("
").addClass(g+"msg").css(l.msg||{}).html(i).appendTo(B),y=w?e("
").addClass(g+"inbox").css(l.inbox||{}).children().addClass(g+"input").css(l.input||{}).bind("keydown",function(f){if((window.event?window.event.keyCode:f.which)==9&&f.shiftKey){f.preventDefault();B.find("."+g+"button").filter(":last").focus()}}).bind("blur",F).end().appendTo(B):null,C=e("
").addClass(g+"buttons").css(l.buttons||{}).appendTo(B),r=e(" ").addClass(g+"button").css(l.button||{}).bind("keydown",function(G){if(this!=document.activeElement){return}G.stopPropagation();var q=window.event?window.event.keyCode:G.which,p=e(this),t,f=G.shiftKey;switch(q){case 9:case 39:G.preventDefault();if(t=p[q==9&&f?"prev":"next"]("button"),t.length){t.focus()}else{if(q==9){if(t=B.find("."+g+"input"),t.length){t.select()}else{if(t=p[f?"next":"prev"]("button"),t.length){t.focus()}}}}break;case 37:G.preventDefault();if(t=p.prev("button"),t.length){t.focus()}break;case 27:G.preventDefault();B.find("button."+(w||u?D:j)).trigger("click");break}}).bind("blur",F),v=[r.clone(o).addClass(j).text(u?h.yes:h.ok).appendTo(C),w||u?r.clone(o).addClass(D).text(h.no).appendTo(C):null];B.add(x).bind("keydown",function(){});if(w){h.confirm=o;if(typeof(h.input)=="string"){y.children().val(h.input)}}m.bind(a,k[a]=function(){if(!k.firstWidth){k.firstUnder=true;k.firstWidth=B.outerWidth();console.log(k.firstWidth)}var f=m.width()-20<=k.firstWidth;if(l.ui){if(f&&!k.isOver){console.log("OVER");k.isOver=true;B.css({width:"auto",left:"10px",right:"10px","margin-left":"0","margin-top":~~(-B.outerHeight()*0.32)+"px"})}else{if((!f&&k.isOver)||k.firstUnder){console.log("UNDER");k.firstUnder=false;k.isOver=false;B.css({width:k.firstWidth+"px",left:l.ui.left||"auto",right:l.ui.right||"auto","margin-left":~~(-k.firstWidth*0.5)+"px","margin-top":~~(-B.outerHeight()*0.32)+"px"})}}}});k.before=function(p){p.stopPropagation();var f=window.event?window.event.keyCode:p.which;if(p.target.type=="text"&&!f){B.find("button."+(w||u?D:j)).trigger("click");return A}switch(f){case 13:B.find("button:focus").trigger("click");return A;case 27:B.find("button."+(w||u?D:j)).trigger("click");return A}};var E="."+g+"ui,."+g+"modal",z=e(document.documentElement?document.documentElement:document.body).append(x).append(B).bind(b,k.before);k.after=function(f,p){for(var q=0,t=f.className.split(" ");q ").addClass(j+"inbox").children().addClass(j+"input").bind("keydown",function(q){var p=q.which;if(p==9&&q.shiftKey){q.preventDefault();F.find("."+j+"button").filter(":last").focus()}else{switch(p){case 13:q.preventDefault();F.find("button."+n).trigger("click");return false;case 27:q.preventDefault();F.find("button."+(A||y?H:n)).trigger("click");break}}}).bind("blur",J).end().appendTo(F):null,G=i(b).addClass(j+"buttons").appendTo(F),w=i("button").addClass(j+"button").bind("keydown",function(L){if(this!=document.activeElement){return}L.stopPropagation();var t=L.which,q=f(this),K,p=L.shiftKey;switch(t){case 9:case 39:L.preventDefault();if(K=q[t==9&&p?"prev":"next"]("button"),K.length){K.focus()}else{if(t==9){if(K=F.find("."+j+"input"),K.length){K.select()}else{if(K=q[p?"next":"prev"]("button"),K.length){K.focus()}}}}break;case 37:L.preventDefault();if(K=q.prev("button"),K.length){K.focus()}break;case 27:L.preventDefault();F.find("button."+(A||y?H:n)).trigger("click");break}}).bind("blur",J),z=[w.clone(v).addClass(n).text(y?l.yes:l.ok).appendTo(G),A||y?w.clone(v).addClass(H).text(l.no).appendTo(G):null];F.add(B).bind("keydown",function(){});f.extend(F[0],{modal:B[0],msg:u[0],inbox:C?C[0]:null,buttons:G[0]});if(A){l.confirm=v;if(l.input!==true){C.children().val(l.input)}}s.bind(e,o[e]=function(){if(!o.firstWidth){o.firstUnder=true;o.firstWidth=F.outerWidth()}var p=s.width()-20<=o.firstWidth;if(!f.isFunction(l.onresize)){if(f.isFunction(f.msgbox.onresize)){f.msgbox.onresize.call(F[0],o)}}else{l.onresize.call(F[0],o)}});o.before=function(q){q.stopPropagation();var p=window.event?window.event.keyCode:q.which;if(q.target.type=="text"&&!p){F.find("button."+(A||y?H:n)).trigger("click");return E}switch(p){case 13:F.find("button:focus").trigger("click");return E;case 27:F.find("button."+(A||y?H:n)).trigger("click");return E}};var I="."+j+"ui,."+j+"modal",D=f(document.documentElement||document.body).append(B).append(F).bind(h,o.before);o.after=function(p,q){for(var t=0,K=p.className.split(" ");t
Date: Thu, 12 Dec 2013 18:10:12 +0900
Subject: [PATCH 16/27] jQuery plugin and bower
---
bower.json | 13 +++++++++++++
msgbox.jqeury.json | 31 +++++++++++++++++++++++++++++++
2 files changed, 44 insertions(+)
create mode 100644 bower.json
create mode 100644 msgbox.jqeury.json
diff --git a/bower.json b/bower.json
new file mode 100644
index 0000000..f298f04
--- /dev/null
+++ b/bower.json
@@ -0,0 +1,13 @@
+{
+ "name": "MsgBox",
+ "version": "0.7.4",
+ "description": "The Message box for web, Firefox style, User notification made simple.",
+ "keywords": ["alert","confirm","prompt","msgbox","dialog","notification","ui","simple"],
+ "authors": ["Composite"],
+ "license": "MIT",
+ "homepage": "https://github.com/composite/jQuery.MsgBox",
+ "main": ["jquery.msgbox.min.js"],
+ "ignore": ["*.json"],
+ "dependencies": {"jquery": ">= 1.4.0"},
+ "devDependencies": {}
+}
\ No newline at end of file
diff --git a/msgbox.jqeury.json b/msgbox.jqeury.json
new file mode 100644
index 0000000..b23539a
--- /dev/null
+++ b/msgbox.jqeury.json
@@ -0,0 +1,31 @@
+{
+ "name": "msgbox",
+ "title": "jQuery MsgBox",
+ "description": "The Message box for web, Firefox style, User notification made simple.",
+ "keywords": ["alert","confirm","prompt","msgbox","dialog","notification","ui","simple"],
+ "version": "0.7.4",
+ "author": {
+ "name": "Composite",
+ "url": "http://hazard.kr/"
+ },
+ "maintainers": [
+ {
+ "name": "Ukjin Yang",
+ "email": "ukjinplant@msn.com",
+ "url": "http://hazard.kr/"
+ }
+ ],
+ "licenses": [
+ {
+ "type": "MIT",
+ "url": "http://opensource.org/licenses/MIT"
+ }
+ ],
+ "bugs": "https://github.com/composite/jQuery.MsgBox/issues",
+ "homepage": "https://github.com/composite/jQuery.MsgBox",
+ "docs": "https://github.com/composite/jQuery.MsgBox/wiki",
+ "download": "https://raw.github.com/composite/jQuery.MsgBox/master/jquery.msgbox.min.js",
+ "dependencies": {
+ "jquery": ">=1.4"
+ }
+}
\ No newline at end of file
From ba8ef876a5141c8a4907c1eb00d68bd52be84fc6 Mon Sep 17 00:00:00 2001
From: Ukjin Yang
Date: Thu, 12 Dec 2013 18:26:56 +0900
Subject: [PATCH 17/27] Update bower.json
---
bower.json | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/bower.json b/bower.json
index f298f04..ae191f4 100644
--- a/bower.json
+++ b/bower.json
@@ -1,5 +1,5 @@
{
- "name": "MsgBox",
+ "name": "msgbox",
"version": "0.7.4",
"description": "The Message box for web, Firefox style, User notification made simple.",
"keywords": ["alert","confirm","prompt","msgbox","dialog","notification","ui","simple"],
@@ -10,4 +10,4 @@
"ignore": ["*.json"],
"dependencies": {"jquery": ">= 1.4.0"},
"devDependencies": {}
-}
\ No newline at end of file
+}
From 5891f5124994f17e7c4bcb65725297e8a19849f4 Mon Sep 17 00:00:00 2001
From: Ukjin Yang
Date: Fri, 13 Dec 2013 09:07:19 +0900
Subject: [PATCH 18/27] bower howto
---
README.md | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/README.md b/README.md
index 7e6b662..6e94ba6 100644
--- a/README.md
+++ b/README.md
@@ -7,6 +7,21 @@
Firefox style simplist dialog form.
+## How to install?
+
+That's very simple. just download below,
+
+ - [Minified (for production)](https://raw.github.com/composite/jQuery.MsgBox/master/jquery.msgbox.min.js)
+ - [Unminified (for development)](https://raw.github.com/composite/jQuery.MsgBox/master/jquery.msgbox.js)
+
+If you have bower? just type in your console.
+
+```
+bower install msgbox
+```
+
+Still not easy? OH PLZ...
+
## How to use this?
It's quiet simple.
From b8ff361213919f58b08c015d9d5aa3909345e35a Mon Sep 17 00:00:00 2001
From: Ukjin Yang
Date: Fri, 13 Dec 2013 09:10:54 +0900
Subject: [PATCH 19/27] jquery required.
---
README.md | 2 ++
1 file changed, 2 insertions(+)
diff --git a/README.md b/README.md
index 6e94ba6..955d2f7 100644
--- a/README.md
+++ b/README.md
@@ -9,6 +9,8 @@ Firefox style simplist dialog form.
## How to install?
+before install, you must have [jQuery](http://jquery.com/download/) >= 1.4.0, I strongly recommand you have a lastest version.
+
That's very simple. just download below,
- [Minified (for production)](https://raw.github.com/composite/jQuery.MsgBox/master/jquery.msgbox.min.js)
From c3f3fffb8d086889928e78ab4b923faa07d8aa94 Mon Sep 17 00:00:00 2001
From: Ukjin Yang
Date: Fri, 13 Dec 2013 09:22:02 +0900
Subject: [PATCH 20/27] I want to register in jquery plugin
---
.gitignore | 215 +++++++++++++++++++++++++++++++++++++++++++++
msgbox.jqeury.json | 2 +-
2 files changed, 216 insertions(+), 1 deletion(-)
create mode 100644 .gitignore
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..b9d6bd9
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,215 @@
+#################
+## Eclipse
+#################
+
+*.pydevproject
+.project
+.metadata
+bin/
+tmp/
+*.tmp
+*.bak
+*.swp
+*~.nib
+local.properties
+.classpath
+.settings/
+.loadpath
+
+# External tool builders
+.externalToolBuilders/
+
+# Locally stored "Eclipse launch configurations"
+*.launch
+
+# CDT-specific
+.cproject
+
+# PDT-specific
+.buildpath
+
+
+#################
+## Visual Studio
+#################
+
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+
+# User-specific files
+*.suo
+*.user
+*.sln.docstates
+
+# Build results
+
+[Dd]ebug/
+[Rr]elease/
+x64/
+build/
+[Bb]in/
+[Oo]bj/
+
+# MSTest test Results
+[Tt]est[Rr]esult*/
+[Bb]uild[Ll]og.*
+
+*_i.c
+*_p.c
+*.ilk
+*.meta
+*.obj
+*.pch
+*.pdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.tmp_proj
+*.log
+*.vspscc
+*.vssscc
+.builds
+*.pidb
+*.log
+*.scc
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opensdf
+*.sdf
+*.cachefile
+
+# Visual Studio profiler
+*.psess
+*.vsp
+*.vspx
+
+# Guidance Automation Toolkit
+*.gpState
+
+# ReSharper is a .NET coding add-in
+_ReSharper*/
+*.[Rr]e[Ss]harper
+
+# TeamCity is a build add-in
+_TeamCity*
+
+# DotCover is a Code Coverage Tool
+*.dotCover
+
+# NCrunch
+*.ncrunch*
+.*crunch*.local.xml
+
+# Installshield output folder
+[Ee]xpress/
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish/
+
+# Publish Web Output
+*.Publish.xml
+*.pubxml
+
+# NuGet Packages Directory
+## TODO: If you have NuGet Package Restore enabled, uncomment the next line
+#packages/
+
+# Windows Azure Build Output
+csx
+*.build.csdef
+
+# Windows Store app package directory
+AppPackages/
+
+# Others
+sql/
+*.Cache
+ClientBin/
+[Ss]tyle[Cc]op.*
+~$*
+*~
+*.dbmdl
+*.[Pp]ublish.xml
+*.pfx
+*.publishsettings
+
+# RIA/Silverlight projects
+Generated_Code/
+
+# Backup & report files from converting an old project file to a newer
+# Visual Studio version. Backup files are not needed, because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+UpgradeLog*.htm
+
+# SQL Server files
+App_Data/*.mdf
+App_Data/*.ldf
+
+#############
+## Windows detritus
+#############
+
+# Windows image file caches
+Thumbs.db
+ehthumbs.db
+
+# Folder config file
+Desktop.ini
+
+# Recycle Bin used on file shares
+$RECYCLE.BIN/
+
+# Mac crap
+.DS_Store
+
+
+#############
+## Python
+#############
+
+*.py[co]
+
+# Packages
+*.egg
+*.egg-info
+dist/
+build/
+eggs/
+parts/
+var/
+sdist/
+develop-eggs/
+.installed.cfg
+
+# Installer logs
+pip-log.txt
+
+# Unit test / coverage reports
+.coverage
+.tox
+
+#Translations
+*.mo
+
+#Mr Developer
+.mr.developer.cfg
diff --git a/msgbox.jqeury.json b/msgbox.jqeury.json
index b23539a..e57c81b 100644
--- a/msgbox.jqeury.json
+++ b/msgbox.jqeury.json
@@ -3,7 +3,7 @@
"title": "jQuery MsgBox",
"description": "The Message box for web, Firefox style, User notification made simple.",
"keywords": ["alert","confirm","prompt","msgbox","dialog","notification","ui","simple"],
- "version": "0.7.4",
+ "version": "0.7.4-beta",
"author": {
"name": "Composite",
"url": "http://hazard.kr/"
From 5eb66d1641d9b828346c0918872d1c6e46b784c4 Mon Sep 17 00:00:00 2001
From: Ukjin Yang
Date: Fri, 13 Dec 2013 09:23:50 +0900
Subject: [PATCH 21/27] ...
---
msgbox.jqeury.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/msgbox.jqeury.json b/msgbox.jqeury.json
index e57c81b..9920697 100644
--- a/msgbox.jqeury.json
+++ b/msgbox.jqeury.json
@@ -3,7 +3,7 @@
"title": "jQuery MsgBox",
"description": "The Message box for web, Firefox style, User notification made simple.",
"keywords": ["alert","confirm","prompt","msgbox","dialog","notification","ui","simple"],
- "version": "0.7.4-beta",
+ "version": "0.7.4-b",
"author": {
"name": "Composite",
"url": "http://hazard.kr/"
From f51437ff220b435bfa867079c07d908699997afe Mon Sep 17 00:00:00 2001
From: Ukjin Yang
Date: Fri, 13 Dec 2013 09:27:52 +0900
Subject: [PATCH 22/27] version changed
---
bower.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bower.json b/bower.json
index ae191f4..5115cbe 100644
--- a/bower.json
+++ b/bower.json
@@ -1,6 +1,6 @@
{
"name": "msgbox",
- "version": "0.7.4",
+ "version": "0.7.4-b",
"description": "The Message box for web, Firefox style, User notification made simple.",
"keywords": ["alert","confirm","prompt","msgbox","dialog","notification","ui","simple"],
"authors": ["Composite"],
From b6353a0be9e1a2e1be846ec8fc985e1907b4701c Mon Sep 17 00:00:00 2001
From: Ukjin Yang
Date: Fri, 13 Dec 2013 09:32:54 +0900
Subject: [PATCH 23/27] file name!!!
---
msgbox.jqeury.json => msgbox.jquery.json | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename msgbox.jqeury.json => msgbox.jquery.json (100%)
diff --git a/msgbox.jqeury.json b/msgbox.jquery.json
similarity index 100%
rename from msgbox.jqeury.json
rename to msgbox.jquery.json
From 27444f6e980bfe45514a3c332803301276abd055 Mon Sep 17 00:00:00 2001
From: Ukjin Yang
Date: Fri, 13 Dec 2013 09:34:33 +0900
Subject: [PATCH 24/27] retry
---
msgbox.jquery.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/msgbox.jquery.json b/msgbox.jquery.json
index 9920697..b23539a 100644
--- a/msgbox.jquery.json
+++ b/msgbox.jquery.json
@@ -3,7 +3,7 @@
"title": "jQuery MsgBox",
"description": "The Message box for web, Firefox style, User notification made simple.",
"keywords": ["alert","confirm","prompt","msgbox","dialog","notification","ui","simple"],
- "version": "0.7.4-b",
+ "version": "0.7.4",
"author": {
"name": "Composite",
"url": "http://hazard.kr/"
From ae5b6e4892929cb6f7c709b8624bd82998ec1b59 Mon Sep 17 00:00:00 2001
From: Ukjin Yang
Date: Fri, 13 Dec 2013 09:41:29 +0900
Subject: [PATCH 25/27] 0.7.5 update
---
README.md | 6 +++++-
bower.json | 2 +-
jquery.msgbox.js | 4 ++--
jquery.msgbox.min.js | 4 ++--
msgbox.jquery.json | 2 +-
5 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/README.md b/README.md
index 955d2f7..2aa5c1b 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# jQuery MsgBox
-0.7.4 BETA
+0.7.5 BETA
## What is it?
@@ -126,6 +126,10 @@ Sorry. that is prevent changing width dynamically after center align on IE. I do
## What's new?
+### 0.7.5
+
+ - console.log() for test will not fired in production mode.
+
### 0.7.4
- Container add for prompt bug fixed.
diff --git a/bower.json b/bower.json
index 5115cbe..fc0ba45 100644
--- a/bower.json
+++ b/bower.json
@@ -1,6 +1,6 @@
{
"name": "msgbox",
- "version": "0.7.4-b",
+ "version": "0.7.5",
"description": "The Message box for web, Firefox style, User notification made simple.",
"keywords": ["alert","confirm","prompt","msgbox","dialog","notification","ui","simple"],
"authors": ["Composite"],
diff --git a/jquery.msgbox.js b/jquery.msgbox.js
index 525cba6..1fa42c9 100644
--- a/jquery.msgbox.js
+++ b/jquery.msgbox.js
@@ -1,5 +1,5 @@
/**************************************************************************************
- * jQuery MsgBox 0.7.4
+ * jQuery MsgBox 0.7.5
* by composite (ukjinplant@msn.com)
* http://blog.hazard.kr
* This project licensed under a MIT License.
@@ -290,7 +290,7 @@
if(!io.firstWidth){
io.firstUnder = true;
io.firstWidth = $C.outerWidth();
- console.log(io.firstWidth);
+ //console.log(io.firstWidth);
}
var isOver = $(window).width() - 20 <= io.firstWidth;
if(isOver && !io.isOver){
diff --git a/jquery.msgbox.min.js b/jquery.msgbox.min.js
index cdddb30..6de3f41 100644
--- a/jquery.msgbox.min.js
+++ b/jquery.msgbox.min.js
@@ -1,7 +1,7 @@
/**************************************************************************************
- * jQuery MsgBox 0.7.4
+ * jQuery MsgBox 0.7.5
* by composite (ukjinplant@msn.com)
* http://blog.hazard.kr
* This project licensed under a MIT License.
**************************************************************************************/;
-(function(f){if(!window.console){window.console={};window.console.log=f.noop}var d="fixed",b="div",h="keypress",e="resize",g="v"=="\v",c=function(j){return !j||j=="auto"},i=function(j){return f(document.createElement(j))};var a=function(o,p){if(a.once&&!p){return}o=o||{};var m=a.style?a.style:(a.style=i("style").addClass("msgbox-style").attr("type","text/css")),j=[];for(var l in o){if(!o[l]){continue}var n=o[l];j.push(".msgbox-"+l);j.push("{");for(var k in n){if(g){switch(k){case"opacity":j.push("filter:alpha(opacity="+(+(n[k].substring(0,1)=="."?("0"+n[k]):n[k])*100||100)+");");break;default:j.push(k+":"+n[k]+";");break}}else{j.push(k+":"+n[k]+";")}}j.push("}")}m.each(function(){var q=j.join("");if(g){this.styleSheet.cssText=q}else{this.innerHTML=q}}).appendTo("head");a.once=true};f.msgbox=function(m,l){l=f.extend({},f.msgbox.options,l);if(!f(".msgbox-style").length){a(f.msgbox.css)}var o={},j="msgbox-",n=j+"ok",H=j+"no",x="password",r=l.css||{},v=!0,E=!1,A=l.input!==false&&l.input!=undefined&&l.input!=null,y=!!l.confirm,J=function(p){setTimeout(function(){var q=f(document.activeElement),t=["."+j+"input","."+j+"button"];if(q.length&&(q.is(t[0])||q.is(t[1]))){}else{F.find(t+"").eq(0).focus()}},0)},s=f(window),F=i(b).addClass(j+"ui").addClass(j+(A?"prompt":(y?"confirm":"alert"))),B=i(b).addClass(j+"modal"),u=i(b).addClass(j+"msg").html(m).appendTo(F),C=A?f("
").addClass(j+"inbox").children().addClass(j+"input").bind("keydown",function(q){var p=q.which;if(p==9&&q.shiftKey){q.preventDefault();F.find("."+j+"button").filter(":last").focus()}else{switch(p){case 13:q.preventDefault();F.find("button."+n).trigger("click");return false;case 27:q.preventDefault();F.find("button."+(A||y?H:n)).trigger("click");break}}}).bind("blur",J).end().appendTo(F):null,G=i(b).addClass(j+"buttons").appendTo(F),w=i("button").addClass(j+"button").bind("keydown",function(L){if(this!=document.activeElement){return}L.stopPropagation();var t=L.which,q=f(this),K,p=L.shiftKey;switch(t){case 9:case 39:L.preventDefault();if(K=q[t==9&&p?"prev":"next"]("button"),K.length){K.focus()}else{if(t==9){if(K=F.find("."+j+"input"),K.length){K.select()}else{if(K=q[p?"next":"prev"]("button"),K.length){K.focus()}}}}break;case 37:L.preventDefault();if(K=q.prev("button"),K.length){K.focus()}break;case 27:L.preventDefault();F.find("button."+(A||y?H:n)).trigger("click");break}}).bind("blur",J),z=[w.clone(v).addClass(n).text(y?l.yes:l.ok).appendTo(G),A||y?w.clone(v).addClass(H).text(l.no).appendTo(G):null];F.add(B).bind("keydown",function(){});f.extend(F[0],{modal:B[0],msg:u[0],inbox:C?C[0]:null,buttons:G[0]});if(A){l.confirm=v;if(l.input!==true){C.children().val(l.input)}}s.bind(e,o[e]=function(){if(!o.firstWidth){o.firstUnder=true;o.firstWidth=F.outerWidth()}var p=s.width()-20<=o.firstWidth;if(!f.isFunction(l.onresize)){if(f.isFunction(f.msgbox.onresize)){f.msgbox.onresize.call(F[0],o)}}else{l.onresize.call(F[0],o)}});o.before=function(q){q.stopPropagation();var p=window.event?window.event.keyCode:q.which;if(q.target.type=="text"&&!p){F.find("button."+(A||y?H:n)).trigger("click");return E}switch(p){case 13:F.find("button:focus").trigger("click");return E;case 27:F.find("button."+(A||y?H:n)).trigger("click");return E}};var I="."+j+"ui,."+j+"modal",D=f(document.documentElement||document.body).append(B).append(F).bind(h,o.before);o.after=function(p,q){for(var t=0,K=p.className.split(" ");t ").addClass(j+"inbox").children().addClass(j+"input").bind("keydown",function(q){var p=q.which;if(p==9&&q.shiftKey){q.preventDefault();F.find("."+j+"button").filter(":last").focus()}else{switch(p){case 13:q.preventDefault();F.find("button."+n).trigger("click");return false;case 27:q.preventDefault();F.find("button."+(A||y?H:n)).trigger("click");break}}}).bind("blur",J).end().appendTo(F):null,G=i(b).addClass(j+"buttons").appendTo(F),w=i("button").addClass(j+"button").bind("keydown",function(L){if(this!=document.activeElement){return}L.stopPropagation();var t=L.which,q=f(this),K,p=L.shiftKey;switch(t){case 9:case 39:L.preventDefault();if(K=q[t==9&&p?"prev":"next"]("button"),K.length){K.focus()}else{if(t==9){if(K=F.find("."+j+"input"),K.length){K.select()}else{if(K=q[p?"next":"prev"]("button"),K.length){K.focus()}}}}break;case 37:L.preventDefault();if(K=q.prev("button"),K.length){K.focus()}break;case 27:L.preventDefault();F.find("button."+(A||y?H:n)).trigger("click");break}}).bind("blur",J),z=[w.clone(v).addClass(n).text(y?l.yes:l.ok).appendTo(G),A||y?w.clone(v).addClass(H).text(l.no).appendTo(G):null];F.add(B).bind("keydown",function(){});f.extend(F[0],{modal:B[0],msg:u[0],inbox:C?C[0]:null,buttons:G[0]});if(A){l.confirm=v;if(l.input!==true){C.children().val(l.input)}}s.bind(e,o[e]=function(){if(!o.firstWidth){o.firstUnder=true;o.firstWidth=F.outerWidth()}var p=s.width()-20<=o.firstWidth;if(!f.isFunction(l.onresize)){if(f.isFunction(f.msgbox.onresize)){f.msgbox.onresize.call(F[0],o)}}else{l.onresize.call(F[0],o)}});o.before=function(q){q.stopPropagation();var p=window.event?window.event.keyCode:q.which;if(q.target.type=="text"&&!p){F.find("button."+(A||y?H:n)).trigger("click");return E}switch(p){case 13:F.find("button:focus").trigger("click");return E;case 27:F.find("button."+(A||y?H:n)).trigger("click");return E}};var I="."+j+"ui,."+j+"modal",D=f(document.documentElement||document.body).append(B).append(F).bind(h,o.before);o.after=function(p,q){for(var t=0,K=p.className.split(" ");t
Date: Fri, 13 Dec 2013 14:21:38 +0900
Subject: [PATCH 26/27] 0.8.0 update
---
README.md | 13 +++++--
bower.json | 4 +-
jquery.msgbox.js | 90 ++++++++++++++++++++++++--------------------
jquery.msgbox.min.js | 2 +-
msgbox.jquery.json | 6 +--
readme.txt | 68 ---------------------------------
6 files changed, 65 insertions(+), 118 deletions(-)
delete mode 100644 readme.txt
diff --git a/README.md b/README.md
index 2aa5c1b..2621e51 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# jQuery MsgBox
-0.7.5 BETA
+0.8.0 BETA
## What is it?
@@ -9,7 +9,7 @@ Firefox style simplist dialog form.
## How to install?
-before install, you must have [jQuery](http://jquery.com/download/) >= 1.4.0, I strongly recommand you have a lastest version.
+before install, you must have [jQuery](http://jquery.com/download/) >= 1.5.0, I strongly recommand you have a lastest version.
That's very simple. just download below,
@@ -100,7 +100,7 @@ Sure. [here's an example](http://jsfiddle.net/preFy/ "live example").
## What browser can run with this plugin?
-first, jQuery 1.4 or later needed.
+first, jQuery 1.5 or later needed.
and, You can run with most popular major browser,
Internet Explorer 8 or above, Firefox 3 or above, Safari 4 or above, Chrome 10 or above, Opera 9 or above.
NOTE : Old school browser, such as IE 7 or lower is have a problem with CSS issue.
@@ -126,6 +126,13 @@ Sorry. that is prevent changing width dynamically after center align on IE. I do
## What's new?
+### 0.8.0
+
+ - Major UI changes: more compatibility to view, Wrapped more a div to centering layer using only CSS (but still vertical centering using JS).
+ - NEW property: onopen event property and $.msgbox.onopen static property; Fires after msgbox opened.
+ - NEW property: onclose event property and $.msgbox.onclose static property; Fires before msgbox closing.
+ - 2 new property for your own CSS or JS animation effect. onclose event also support jQuery Deferred Object. See [Wiki](https://github.com/composite/jQuery.MsgBox/wiki) for details.
+
### 0.7.5
- console.log() for test will not fired in production mode.
diff --git a/bower.json b/bower.json
index fc0ba45..09bc587 100644
--- a/bower.json
+++ b/bower.json
@@ -1,6 +1,6 @@
{
"name": "msgbox",
- "version": "0.7.5",
+ "version": "0.8.0",
"description": "The Message box for web, Firefox style, User notification made simple.",
"keywords": ["alert","confirm","prompt","msgbox","dialog","notification","ui","simple"],
"authors": ["Composite"],
@@ -8,6 +8,6 @@
"homepage": "https://github.com/composite/jQuery.MsgBox",
"main": ["jquery.msgbox.min.js"],
"ignore": ["*.json"],
- "dependencies": {"jquery": ">= 1.4.0"},
+ "dependencies": {"jquery": ">= 1.5.0"},
"devDependencies": {}
}
diff --git a/jquery.msgbox.js b/jquery.msgbox.js
index 1fa42c9..3917bfc 100644
--- a/jquery.msgbox.js
+++ b/jquery.msgbox.js
@@ -1,5 +1,5 @@
/**************************************************************************************
- * jQuery MsgBox 0.7.5
+ * jQuery MsgBox 0.8.0
* by composite (ukjinplant@msn.com)
* http://blog.hazard.kr
* This project licensed under a MIT License.
@@ -82,7 +82,7 @@
},
$W = $(window),
//경고창
- $C = $$(div).addClass(mb + 'ui').addClass(mb + (p ? 'prompt' : (q ? 'confirm' : 'alert'))),
+ $C = $$('div').addClass(mb + 'container').append($$(div).addClass(mb + 'ui').addClass(mb + (p ? 'prompt' : (q ? 'confirm' : 'alert')))).children(),
//경고창 배경
$M = $$(div).addClass(mb + 'modal'),
//경고 내용
@@ -141,7 +141,7 @@
$BS = [
$BT.clone(t).addClass(cok).text(q ? options.yes : options.ok).appendTo($B), p || q ? $BT.clone(t).addClass(cno).text(options.no).appendTo($B) : null]; //경고 버튼들
$C.add($M).bind('keydown',function(){});
- $.extend($C[0], {modal: $M[0], msg: $T[0], inbox: $I ? $I[0] : null, buttons: $B[0]});
+ $.extend($C[0], {container: $C.parent()[0],modal: $M[0], msg: $T[0], inbox: $I ? $I[0] : null, buttons: $B[0]});
//입력 모드시 조치사항
if (p) {
options.confirm = t; //확인 모드 맞음.
@@ -183,30 +183,19 @@
};
//body에 삽입 후 레이아웃 잡기
var kt = '.' + mb + 'ui,.' + mb + 'modal',
- $D = $(document.documentElement || document.body).append($M).append($C).bind(kp, io.before);
+ $D = $(document.documentElement || document.body).append($M).append($C.parent()).bind(kp, io.before);
//경고창 비활성화 후
io.after = function (b, v) {
- for (var i = 0, cn = b.className.split(' '); i < cn.length; i++)
- switch (cn[i]) {
- case cok:
- switch (t) {
- case p:
- options.submit.call($C[0], v);
- break;
- case q:
- options.submit.call($C[0], !! t);
- break;
- default:
- options.submit.call($C[0]);
- break;
- }
+ var isok = $(b).hasClass(cok);
+ switch (t) {
+ case p:
+ options.submit.call($C[0], isok ? v : null);
break;
- case cno:
- if (p || !(p && q)) {
- options.submit.call($C[0]);
- } else {
- options.submit.call($C[0], f);
- }
+ case q:
+ options.submit.call($C[0], isok);
+ break;
+ default:
+ options.submit.call($C[0]);
break;
}
$D.unbind(kp, io.before);
@@ -214,8 +203,14 @@
};
//공통 경고 클릭 시 조치
$C.delegate('button', 'click', function (e) {
- $C.add($M).remove();
+ var cleanup = function(){
+ $C.parent().add($M).remove();
+ },onclose = options.onclose || $.msgbox.onclose;
+
io.after(this, p ? $I.children().val() : null);
+
+ if($.isFunction(onclose)) $.when(onclose.call($C[0], p ? I.children().val() : $(this).hasClass(cok))).always(cleanup);
+ else cleanup();
});
var prepare = function(){
@@ -224,6 +219,9 @@
//경고창 포커스
if (p) $C.find('input:text').select();
else $C.find('button:eq(0)').focus();
+ //onopen 이벤트 발생
+ var onopen = options.onopen || $.msgbox.onopen;
+ if($.isFunction(onopen)) onopen.call($C[0], options);
};
if(legacy){setTimeout(prepare,0);}
@@ -238,14 +236,21 @@
no: 'Cancel'
},
css: {
+ container: {
+ 'position': fixed,
+ 'left': '50%',
+ 'top': '32%',
+ 'z-index': '9001'
+ },
ui: {
'border': '1px solid black',
'font': '9pt verdana,gulim,sans-serif',
'background-color': 'white',
- 'position': fixed,
- 'left': '50%',
+ 'position': 'relative',
+ 'left': '-50%',
'top': '32%',
- 'overflow': 'hidden'
+ 'overflow': 'hidden',
+ 'float': 'right'
},
modal: {
'position': fixed,
@@ -254,7 +259,8 @@
'right': '0',
'bottom': '0',
'background-color': 'black',
- 'opacity': '.4'
+ 'opacity': '.4',
+ 'z-index': '9000'
},
msg: {
'padding': '2em 4em',
@@ -286,7 +292,7 @@
}
},
onresize: function(io){
- var $C = $(this);
+ var $C = $(this), $P = $C.parent();
if(!io.firstWidth){
io.firstUnder = true;
io.firstWidth = $C.outerWidth();
@@ -294,26 +300,26 @@
}
var isOver = $(window).width() - 20 <= io.firstWidth;
if(isOver && !io.isOver){
- //console.debug('OVER');
+ //console.log('OVER');
io.isOver = true;
- $C.css({
- 'width': 'auto',
+ $P.css({
'left': '10px',
'right': '10px',
- 'margin-left': '0',
- 'margin-top': ~~ (-$C.outerHeight() * 0.32) + 'px'
- });
+ 'margin-top': ~~ (-$C.outerHeight() * 0.32) + 'px',
+ 'min-width': ''
+ });
+ $C.css({position:'static'});
}else if((!isOver && io.isOver) || io.firstUnder){
//console.log('UNDER');
io.firstUnder = false;
io.isOver = false;
- $C.css({
- 'width': io.firstWidth + 'px',
+ $P.css({
'left': '',
'right': '',
- 'margin-left': ~~ (-io.firstWidth * 0.5) + 'px',
- 'margin-top': ~~ (-$C.outerHeight() * 0.32) + 'px'
- });
+ 'margin-top': ~~ (-$C.outerHeight() * 0.32) + 'px',
+ 'min-width': io.firstWidth + 'px'
+ });
+ $C.css({position:''});
}
}
});
@@ -322,6 +328,8 @@
confirm: false,
//input:false,
//onresize: function(){},
+ //onopen: function(){},
+ //onclose: function(){},
ok: $.msgbox.strings.ok,
yes: $.msgbox.strings.yes,
no: $.msgbox.strings.no
diff --git a/jquery.msgbox.min.js b/jquery.msgbox.min.js
index 6de3f41..ff90ec6 100644
--- a/jquery.msgbox.min.js
+++ b/jquery.msgbox.min.js
@@ -4,4 +4,4 @@
* http://blog.hazard.kr
* This project licensed under a MIT License.
**************************************************************************************/;
-(function(f){if(!window.console){window.console={};window.console.log=f.noop}var d="fixed",b="div",h="keypress",e="resize",g="v"=="\v",c=function(j){return !j||j=="auto"},i=function(j){return f(document.createElement(j))};var a=function(o,p){if(a.once&&!p){return}o=o||{};var m=a.style?a.style:(a.style=i("style").addClass("msgbox-style").attr("type","text/css")),j=[];for(var l in o){if(!o[l]){continue}var n=o[l];j.push(".msgbox-"+l);j.push("{");for(var k in n){if(g){switch(k){case"opacity":j.push("filter:alpha(opacity="+(+(n[k].substring(0,1)=="."?("0"+n[k]):n[k])*100||100)+");");break;default:j.push(k+":"+n[k]+";");break}}else{j.push(k+":"+n[k]+";")}}j.push("}")}m.each(function(){var q=j.join("");if(g){this.styleSheet.cssText=q}else{this.innerHTML=q}}).appendTo("head");a.once=true};f.msgbox=function(m,l){l=f.extend({},f.msgbox.options,l);if(!f(".msgbox-style").length){a(f.msgbox.css)}var o={},j="msgbox-",n=j+"ok",H=j+"no",x="password",r=l.css||{},v=!0,E=!1,A=l.input!==false&&l.input!=undefined&&l.input!=null,y=!!l.confirm,J=function(p){setTimeout(function(){var q=f(document.activeElement),t=["."+j+"input","."+j+"button"];if(q.length&&(q.is(t[0])||q.is(t[1]))){}else{F.find(t+"").eq(0).focus()}},0)},s=f(window),F=i(b).addClass(j+"ui").addClass(j+(A?"prompt":(y?"confirm":"alert"))),B=i(b).addClass(j+"modal"),u=i(b).addClass(j+"msg").html(m).appendTo(F),C=A?f("
").addClass(j+"inbox").children().addClass(j+"input").bind("keydown",function(q){var p=q.which;if(p==9&&q.shiftKey){q.preventDefault();F.find("."+j+"button").filter(":last").focus()}else{switch(p){case 13:q.preventDefault();F.find("button."+n).trigger("click");return false;case 27:q.preventDefault();F.find("button."+(A||y?H:n)).trigger("click");break}}}).bind("blur",J).end().appendTo(F):null,G=i(b).addClass(j+"buttons").appendTo(F),w=i("button").addClass(j+"button").bind("keydown",function(L){if(this!=document.activeElement){return}L.stopPropagation();var t=L.which,q=f(this),K,p=L.shiftKey;switch(t){case 9:case 39:L.preventDefault();if(K=q[t==9&&p?"prev":"next"]("button"),K.length){K.focus()}else{if(t==9){if(K=F.find("."+j+"input"),K.length){K.select()}else{if(K=q[p?"next":"prev"]("button"),K.length){K.focus()}}}}break;case 37:L.preventDefault();if(K=q.prev("button"),K.length){K.focus()}break;case 27:L.preventDefault();F.find("button."+(A||y?H:n)).trigger("click");break}}).bind("blur",J),z=[w.clone(v).addClass(n).text(y?l.yes:l.ok).appendTo(G),A||y?w.clone(v).addClass(H).text(l.no).appendTo(G):null];F.add(B).bind("keydown",function(){});f.extend(F[0],{modal:B[0],msg:u[0],inbox:C?C[0]:null,buttons:G[0]});if(A){l.confirm=v;if(l.input!==true){C.children().val(l.input)}}s.bind(e,o[e]=function(){if(!o.firstWidth){o.firstUnder=true;o.firstWidth=F.outerWidth()}var p=s.width()-20<=o.firstWidth;if(!f.isFunction(l.onresize)){if(f.isFunction(f.msgbox.onresize)){f.msgbox.onresize.call(F[0],o)}}else{l.onresize.call(F[0],o)}});o.before=function(q){q.stopPropagation();var p=window.event?window.event.keyCode:q.which;if(q.target.type=="text"&&!p){F.find("button."+(A||y?H:n)).trigger("click");return E}switch(p){case 13:F.find("button:focus").trigger("click");return E;case 27:F.find("button."+(A||y?H:n)).trigger("click");return E}};var I="."+j+"ui,."+j+"modal",D=f(document.documentElement||document.body).append(B).append(F).bind(h,o.before);o.after=function(p,q){for(var t=0,K=p.className.split(" ");t ").addClass(j+"inbox").children().addClass(j+"input").bind("keydown",function(q){var p=q.which;if(p==9&&q.shiftKey){q.preventDefault();F.find("."+j+"button").filter(":last").focus()}else{switch(p){case 13:q.preventDefault();F.find("button."+n).trigger("click");return false;case 27:q.preventDefault();F.find("button."+(A||y?H:n)).trigger("click");break}}}).bind("blur",K).end().appendTo(F):null,G=i(b).addClass(j+"buttons").appendTo(F),w=i("button").addClass(j+"button").bind("keydown",function(M){if(this!=document.activeElement){return}M.stopPropagation();var t=M.which,q=f(this),L,p=M.shiftKey;switch(t){case 9:case 39:M.preventDefault();if(L=q[t==9&&p?"prev":"next"]("button"),L.length){L.focus()}else{if(t==9){if(L=F.find("."+j+"input"),L.length){L.select()}else{if(L=q[p?"next":"prev"]("button"),L.length){L.focus()}}}}break;case 37:M.preventDefault();if(L=q.prev("button"),L.length){L.focus()}break;case 27:M.preventDefault();F.find("button."+(A||y?H:n)).trigger("click");break}}).bind("blur",K),z=[w.clone(v).addClass(n).text(y?l.yes:l.ok).appendTo(G),A||y?w.clone(v).addClass(H).text(l.no).appendTo(G):null];F.add(B).bind("keydown",function(){});f.extend(F[0],{container:F.parent()[0],modal:B[0],msg:u[0],inbox:C?C[0]:null,buttons:G[0]});if(A){l.confirm=v;if(l.input!==true){C.children().val(l.input)}}s.bind(e,o[e]=function(){if(!o.firstWidth){o.firstUnder=true;o.firstWidth=F.outerWidth()}var p=s.width()-20<=o.firstWidth;if(!f.isFunction(l.onresize)){if(f.isFunction(f.msgbox.onresize)){f.msgbox.onresize.call(F[0],o)}}else{l.onresize.call(F[0],o)}});o.before=function(q){q.stopPropagation();var p=window.event?window.event.keyCode:q.which;if(q.target.type=="text"&&!p){F.find("button."+(A||y?H:n)).trigger("click");return E}switch(p){case 13:F.find("button:focus").trigger("click");return E;case 27:F.find("button."+(A||y?H:n)).trigger("click");return E}};var J="."+j+"ui,."+j+"modal",D=f(document.documentElement||document.body).append(B).append(F.parent()).bind(h,o.before);o.after=function(p,q){var t=f(p).hasClass(n);switch(v){case A:l.submit.call(F[0],t?q:null);break;case y:l.submit.call(F[0],t);break;default:l.submit.call(F[0]);break}D.unbind(h,o.before);s.unbind(e,o[e])};F.delegate("button","click",function(t){var p=function(){F.parent().add(B).remove()},q=l.onclose||f.msgbox.onclose;o.after(this,A?C.children().val():null);if(f.isFunction(q)){f.when(q.call(F[0],A?I.children().val():f(this).hasClass(n))).always(p)}else{p()}});var k=function(){s.trigger(e);if(A){F.find("input:text").select()}else{F.find("button:eq(0)").focus()}var p=l.onopen||f.msgbox.onopen;if(f.isFunction(p)){p.call(F[0],l)}};if(g){setTimeout(k,0)}else{k()}return F};f.extend(f.msgbox,{strings:{ok:"OK",yes:"OK",no:"Cancel"},css:{container:{position:d,left:"50%",top:"32%","z-index":"9001"},ui:{border:"1px solid black",font:"9pt verdana,gulim,sans-serif","background-color":"white",position:"relative",left:"-50%",top:"32%",overflow:"hidden","float":"right"},modal:{position:d,left:"0",top:"0",right:"0",bottom:"0","background-color":"black",opacity:".4","z-index":"9000"},msg:{padding:"2em 4em",overflow:"hidden","font-family":"verdana,gulim,sans-serif","white-space":"pre-wrap","word-wrap":"break-word"},buttons:{padding:"1em","background-color":"#eee","text-align":"right",overflow:"hidden"},button:{width:"72px",margin:"auto .25em"},inbox:{width:"90%",margin:"-1em auto 1em",border:"1px inset #3D7BAD"},input:{width:"99%",display:"block",border:"0"}},onresize:function(m){var k=f(this),j=k.parent();if(!m.firstWidth){m.firstUnder=true;m.firstWidth=k.outerWidth()}var l=f(window).width()-20<=m.firstWidth;if(l&&!m.isOver){m.isOver=true;j.css({left:"10px",right:"10px","margin-top":~~(-k.outerHeight()*0.32)+"px","min-width":""});k.css({position:"static"})}else{if((!l&&m.isOver)||m.firstUnder){m.firstUnder=false;m.isOver=false;j.css({left:"",right:"","margin-top":~~(-k.outerHeight()*0.32)+"px","min-width":m.firstWidth+"px"});k.css({position:""})}}}});f.msgbox.options={submit:function(){},confirm:false,ok:f.msgbox.strings.ok,yes:f.msgbox.strings.yes,no:f.msgbox.strings.no};f.alert=function(j,k){return f.msgbox(j,{submit:k})};f.confirm=function(j,k){return f.msgbox(j,{confirm:true,submit:k})};f.prompt=function(m,l,n,k){var j=f.isFunction(l);return f.msgbox(m,{input:j?true:l,submit:j?l:n,password:j?n:k})}})(jQuery);
\ No newline at end of file
diff --git a/msgbox.jquery.json b/msgbox.jquery.json
index f165935..1aa5ec6 100644
--- a/msgbox.jquery.json
+++ b/msgbox.jquery.json
@@ -3,14 +3,14 @@
"title": "jQuery MsgBox",
"description": "The Message box for web, Firefox style, User notification made simple.",
"keywords": ["alert","confirm","prompt","msgbox","dialog","notification","ui","simple"],
- "version": "0.7.5",
+ "version": "0.8.0",
"author": {
"name": "Composite",
"url": "http://hazard.kr/"
},
"maintainers": [
{
- "name": "Ukjin Yang",
+ "name": "Composite",
"email": "ukjinplant@msn.com",
"url": "http://hazard.kr/"
}
@@ -26,6 +26,6 @@
"docs": "https://github.com/composite/jQuery.MsgBox/wiki",
"download": "https://raw.github.com/composite/jQuery.MsgBox/master/jquery.msgbox.min.js",
"dependencies": {
- "jquery": ">=1.4"
+ "jquery": ">=1.5"
}
}
\ No newline at end of file
diff --git a/readme.txt b/readme.txt
deleted file mode 100644
index af0b180..0000000
--- a/readme.txt
+++ /dev/null
@@ -1,68 +0,0 @@
-jQuery MsgBox 0.5.0 Beta
-
-MIT License
-
-Basic Usage :
-
-$.alert(message,callback) : normal alert
- message : alert message
- callback : a function that call after user clicked ok button.
- function(){
- //'this' keyword scopes alert container.
- }
-
-$.confirm(message,callback) : normal confirm
- message : confirm message
- callback : a function that call after user click ok or cancel button
- function(bool){
- //bool is a boolean value that true if user click ok, false if user click cancel.
- //'this' keyword scopes alert container.
- }
-
-$.prompt(message,value,callback,ispassword) : normal prompt alert
- message : prompt message
- value : a string value that default prompt value.
- callback : a function that call after user click ok or cacel button
- function(value){
- //value will provide user prompt value to your callback function.
- //when user clicked ok, value arg will provide user defined value.
- //but when user clicked cacel, value arg will provide 'undefined' value. NOT NULL. UNDEFINED.
- //when user input no word in prompt value and clicked ok, value arg will provide empty string.
- //'this' keyword scopes alert container.
- }
-
-Advenced Usage :
-
-$.msgbox(message,options) : A prototype of jQuery msgbox function.
- message : A message of msgbox.
- options : A options.
- submit : callback function. default is null.
- confirm : the msgbox will user confirm box, true. otherwise, false. default is false.
- input : the msgbox will prompt, give true or value string for default input value. If you want not this, you shouldn't define this option.
- css : a jQuery style css json value. default is firefox style defined css. If you want not default styles, set to null or {}.
- ui : msgbox container style
- modal : modal background style
- msg : message area style
- buttons : common button style
- indiv : text input container style
- input : test input style
- ok : a string defined alert ok button. default is $.msgbox.strings.ok
- yes : a string defined confirm or prompt ok button. $.msgbox.strings.yes
- no : a string defined confirm or prompt cancel button. $.msgbox.strings.no
-
-$.msgbox.strings : static member, A default msgbox strings. you can change this globally.
- .ok : a string defined alert ok button. default is 'OK'.
- .yes : a string defined confirm or prompt ok button. default is 'OK'.
- .no : a string defined confirm or prompt cancel button. default is 'Cancel'.
-
-$.msgbox.css : static member, A default msgbox style. If you want manual setting a msgbox style, set to null or {}. same as css property of $.msgbox function.
-
-Tested Browser :
-Internet Explorer 8 or above, Firefox 3 or above, Chrome 9 or above, Safari 3 or above.
- NOT Supported Browser : Internet Explorer 7 or lower due to CSS issue. I'll never see these browsers.
-jQuery 1.4 or above. (delegate method used, remove Browser compatibility for support jQuery over 1.8)
-
-Known Issues :
-
-jQuery MsgBox is NOT awaiting user confirmation while script running. you should give callback function to provide next process.
-in IE under 8, will flick Msgbox when showing. It's a known issue but I can't figure out it. but I'll fix it.
\ No newline at end of file
From 5b472f0b05a0b170cbe4674b74f991e47494c730 Mon Sep 17 00:00:00 2001
From: Ukjin Yang
Date: Fri, 13 Dec 2013 16:26:34 +0900
Subject: [PATCH 27/27] 0.8.1 update
---
README.md | 9 +++++++--
bower.json | 2 +-
demo.min.html | 23 ++++++++++++++++++++++
jquery.msgbox.js | 45 ++++++++++++++++++++++----------------------
jquery.msgbox.min.js | 4 ++--
msgbox.jquery.json | 2 +-
6 files changed, 56 insertions(+), 29 deletions(-)
create mode 100644 demo.min.html
diff --git a/README.md b/README.md
index 2621e51..a3f01f5 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# jQuery MsgBox
-0.8.0 BETA
+0.8.1 BETA
## What is it?
@@ -11,7 +11,7 @@ Firefox style simplist dialog form.
before install, you must have [jQuery](http://jquery.com/download/) >= 1.5.0, I strongly recommand you have a lastest version.
-That's very simple. just download below,
+That's very simple. just download below lastest version,
- [Minified (for production)](https://raw.github.com/composite/jQuery.MsgBox/master/jquery.msgbox.min.js)
- [Unminified (for development)](https://raw.github.com/composite/jQuery.MsgBox/master/jquery.msgbox.js)
@@ -126,6 +126,11 @@ Sorry. that is prevent changing width dynamically after center align on IE. I do
## What's new?
+### 0.8.1
+
+ - Some code optimization.
+ - Use UglifyJS for minification, instead of YUI compressor.
+
### 0.8.0
- Major UI changes: more compatibility to view, Wrapped more a div to centering layer using only CSS (but still vertical centering using JS).
diff --git a/bower.json b/bower.json
index 09bc587..a2797da 100644
--- a/bower.json
+++ b/bower.json
@@ -1,6 +1,6 @@
{
"name": "msgbox",
- "version": "0.8.0",
+ "version": "0.8.1",
"description": "The Message box for web, Firefox style, User notification made simple.",
"keywords": ["alert","confirm","prompt","msgbox","dialog","notification","ui","simple"],
"authors": ["Composite"],
diff --git a/demo.min.html b/demo.min.html
new file mode 100644
index 0000000..74abbbf
--- /dev/null
+++ b/demo.min.html
@@ -0,0 +1,23 @@
+
+
+
+
+ MsgBox 데모
+
+
+ 일반 경고창
+ 경고창
+ 긴 경고창
+ 질문창
+ 입력창
+ 긴 입력창
+ 일반 입력창
+ ');
+
+
+
+
\ No newline at end of file
diff --git a/jquery.msgbox.js b/jquery.msgbox.js
index 3917bfc..607a007 100644
--- a/jquery.msgbox.js
+++ b/jquery.msgbox.js
@@ -1,5 +1,5 @@
/**************************************************************************************
- * jQuery MsgBox 0.8.0
+ * jQuery MsgBox 0.8.1
* by composite (ukjinplant@msn.com)
* http://blog.hazard.kr
* This project licensed under a MIT License.
@@ -9,7 +9,7 @@
window.console = {};
window.console.log = $.noop;
}
- var fixed = 'fixed', div = 'div', kp = 'keypress', rs = 'resize', legacy = 'v' == '\v' //IE 8 대응.
+ var fixed = 'fixed', div = 'div', kp = 'keypress', rs = 'resize', mb = 'msgbox-', dmb = '.' + mb, cst = mb + '-style', btn = 'button', clk = 'click', legacy = 'v' == '\v' //IE 8 대응.
,isCssDef = function(css){
return !css || css == 'auto';
},$$ = function(tag){return $(document.createElement(tag));};
@@ -18,13 +18,13 @@
var styleGen = function(style, repl){
if(styleGen.once && !repl) return;
style = style || {};
- var css = styleGen.style ? styleGen.style : (styleGen.style = $$('style').addClass('msgbox-style').attr('type','text/css')), builder = [];
+ var css = styleGen.style ? styleGen.style : (styleGen.style = $$('style').addClass(cst).attr('type','text/css')), builder = [];
for(var part in style){
if(!style[part]){continue;}
var cs = style[part];
- builder.push('.msgbox-' + part);
+ builder.push(dmb + part);
builder.push('{');
for(var name in cs){
@@ -58,11 +58,10 @@
options = $.extend({}, $.msgbox.options, options);
//스타일 생성
- if(!$('.msgbox-style').length){styleGen($.msgbox.css);}
+ if(!$(cst).length){styleGen($.msgbox.css);}
//변수 및 요소 정의
var io = {},
- mb = 'msgbox-',
cok = mb + 'ok',
cno = mb + 'no',
pw = 'password',
@@ -73,7 +72,7 @@
q = !!options.confirm,
iae = function(e) { //포커스된 요소가 메시지박스 아니면 메시지박스로 강제 포커스 이동
setTimeout(function(){
- var act=$(document.activeElement),ms=['.'+mb+'input','.'+mb+'button'];
+ var act=$(document.activeElement),ms=[dmb+'input',dmb+btn];
if(act.length&&(act.is(ms[0])||act.is(ms[1]))){
//console.log('good.');
}
@@ -82,7 +81,7 @@
},
$W = $(window),
//경고창
- $C = $$('div').addClass(mb + 'container').append($$(div).addClass(mb + 'ui').addClass(mb + (p ? 'prompt' : (q ? 'confirm' : 'alert')))).children(),
+ $C = $$(div).addClass(mb + 'container').append($$(div).addClass(mb + 'ui').addClass(mb + (p ? 'prompt' : (q ? 'confirm' : 'alert')))).children(),
//경고창 배경
$M = $$(div).addClass(mb + 'modal'),
//경고 내용
@@ -94,16 +93,16 @@
var code = e.which;
if(code == 9 && e.shiftKey){
e.preventDefault();
- $C.find('.'+mb+'button').filter(':last').focus();
+ $C.find(dmb+btn).filter(':last').focus();
}else{
switch(code){
case 13://엔터는 확인
e.preventDefault();
- $C.find('button.' + cok).trigger('click');
+ $C.find(btn + '.' + cok).trigger(clk);
return false;
case 27://ESC는 취소
e.preventDefault();
- $C.find('button.' + (p || q ? cno : cok)).trigger('click');
+ $C.find(btn + '.' + (p || q ? cno : cok)).trigger(clk);
break;
}
}
@@ -112,7 +111,7 @@
//경고 버튼 나열
$B = $$(div).addClass(mb + 'buttons').appendTo($C),
//기본 버튼
- $BT = $$("button").addClass(mb + 'button').bind('keydown',function(e){
+ $BT = $$(btn).addClass(mb + btn).bind('keydown',function(e){
if(this!=document.activeElement) return;
e.stopPropagation();
@@ -121,19 +120,19 @@
case 9://탭키 누르면 다음 버튼 및 입력창 포커스
case 39://오른쪽키 누르면 다음 버튼으로만 포커스
e.preventDefault();
- if(target=that[code==9&&shift?'prev':'next']('button'),target.length) target.focus();
+ if(target=that[code==9&&shift?'prev':'next'](btn),target.length) target.focus();
else if(code==9){
- if(target=$C.find('.'+mb+'input'),target.length) target.select();
- else if(target=that[shift?'next':'prev']('button'),target.length) target.focus();
+ if(target=$C.find(dmb+'input'),target.length) target.select();
+ else if(target=that[shift?'next':'prev'](btn),target.length) target.focus();
}
break;
case 37://왼쪽키는 이전 버튼으로만 포커스
e.preventDefault();
- if(target=that.prev('button'),target.length) target.focus();
+ if(target=that.prev(btn),target.length) target.focus();
break;
case 27://ESC는 무조건 취소처리
e.preventDefault();
- $C.find('button.' + (p || q ? cno : cok)).trigger('click');
+ $C.find(btn + '.' + (p || q ? cno : cok)).trigger(clk);
break;
}
}).bind('blur',iae),
@@ -169,20 +168,20 @@
var code = window.event ? window.event.keyCode : e.which;
//전역 메시지박스에도 before가 붙으므로 격리.
if(e.target.type=='text'&&!code){
- $C.find('button.' + (p || q ? cno : cok)).trigger('click');
+ $C.find(btn + '.' + (p || q ? cno : cok)).trigger(clk);
return f;
}
switch (code) {
case 13:
- $C.find('button:focus').trigger('click');
+ $C.find(btn + ':focus').trigger('click');
return f;
case 27:
- $C.find('button.' + (p || q ? cno : cok)).trigger('click');
+ $C.find(btn + '.' + (p || q ? cno : cok)).trigger(clk);
return f;
}
};
//body에 삽입 후 레이아웃 잡기
- var kt = '.' + mb + 'ui,.' + mb + 'modal',
+ var kt = dmb + 'ui,' + dmb + 'modal',
$D = $(document.documentElement || document.body).append($M).append($C.parent()).bind(kp, io.before);
//경고창 비활성화 후
io.after = function (b, v) {
@@ -202,7 +201,7 @@
$W.unbind(rs, io[rs]);
};
//공통 경고 클릭 시 조치
- $C.delegate('button', 'click', function (e) {
+ $C.delegate(btn, clk, function (e) {
var cleanup = function(){
$C.parent().add($M).remove();
},onclose = options.onclose || $.msgbox.onclose;
@@ -218,7 +217,7 @@
$W.trigger(rs);
//경고창 포커스
if (p) $C.find('input:text').select();
- else $C.find('button:eq(0)').focus();
+ else $C.find(btn + ':eq(0)').focus();
//onopen 이벤트 발생
var onopen = options.onopen || $.msgbox.onopen;
if($.isFunction(onopen)) onopen.call($C[0], options);
diff --git a/jquery.msgbox.min.js b/jquery.msgbox.min.js
index ff90ec6..0ac1a94 100644
--- a/jquery.msgbox.min.js
+++ b/jquery.msgbox.min.js
@@ -1,7 +1,7 @@
/**************************************************************************************
- * jQuery MsgBox 0.7.5
+ * jQuery MsgBox 0.8.1
* by composite (ukjinplant@msn.com)
* http://blog.hazard.kr
* This project licensed under a MIT License.
**************************************************************************************/;
-(function(f){if(!window.console){window.console={};window.console.log=f.noop}var d="fixed",b="div",h="keypress",e="resize",g="v"=="\v",c=function(j){return !j||j=="auto"},i=function(j){return f(document.createElement(j))};var a=function(o,p){if(a.once&&!p){return}o=o||{};var m=a.style?a.style:(a.style=i("style").addClass("msgbox-style").attr("type","text/css")),j=[];for(var l in o){if(!o[l]){continue}var n=o[l];j.push(".msgbox-"+l);j.push("{");for(var k in n){if(g){switch(k){case"opacity":j.push("filter:alpha(opacity="+(+(n[k].substring(0,1)=="."?("0"+n[k]):n[k])*100||100)+");");break;default:j.push(k+":"+n[k]+";");break}}else{j.push(k+":"+n[k]+";")}}j.push("}")}m.each(function(){var q=j.join("");if(g){this.styleSheet.cssText=q}else{this.innerHTML=q}}).appendTo("head");a.once=true};f.msgbox=function(m,l){l=f.extend({},f.msgbox.options,l);if(!f(".msgbox-style").length){a(f.msgbox.css)}var o={},j="msgbox-",n=j+"ok",H=j+"no",x="password",r=l.css||{},v=!0,E=!1,A=l.input!==false&&l.input!=undefined&&l.input!=null,y=!!l.confirm,K=function(p){setTimeout(function(){var q=f(document.activeElement),t=["."+j+"input","."+j+"button"];if(q.length&&(q.is(t[0])||q.is(t[1]))){}else{F.find(t+"").eq(0).focus()}},0)},s=f(window),F=i("div").addClass(j+"container").append(i(b).addClass(j+"ui").addClass(j+(A?"prompt":(y?"confirm":"alert")))).children(),B=i(b).addClass(j+"modal"),u=i(b).addClass(j+"msg").html(m).appendTo(F),C=A?f("
").addClass(j+"inbox").children().addClass(j+"input").bind("keydown",function(q){var p=q.which;if(p==9&&q.shiftKey){q.preventDefault();F.find("."+j+"button").filter(":last").focus()}else{switch(p){case 13:q.preventDefault();F.find("button."+n).trigger("click");return false;case 27:q.preventDefault();F.find("button."+(A||y?H:n)).trigger("click");break}}}).bind("blur",K).end().appendTo(F):null,G=i(b).addClass(j+"buttons").appendTo(F),w=i("button").addClass(j+"button").bind("keydown",function(M){if(this!=document.activeElement){return}M.stopPropagation();var t=M.which,q=f(this),L,p=M.shiftKey;switch(t){case 9:case 39:M.preventDefault();if(L=q[t==9&&p?"prev":"next"]("button"),L.length){L.focus()}else{if(t==9){if(L=F.find("."+j+"input"),L.length){L.select()}else{if(L=q[p?"next":"prev"]("button"),L.length){L.focus()}}}}break;case 37:M.preventDefault();if(L=q.prev("button"),L.length){L.focus()}break;case 27:M.preventDefault();F.find("button."+(A||y?H:n)).trigger("click");break}}).bind("blur",K),z=[w.clone(v).addClass(n).text(y?l.yes:l.ok).appendTo(G),A||y?w.clone(v).addClass(H).text(l.no).appendTo(G):null];F.add(B).bind("keydown",function(){});f.extend(F[0],{container:F.parent()[0],modal:B[0],msg:u[0],inbox:C?C[0]:null,buttons:G[0]});if(A){l.confirm=v;if(l.input!==true){C.children().val(l.input)}}s.bind(e,o[e]=function(){if(!o.firstWidth){o.firstUnder=true;o.firstWidth=F.outerWidth()}var p=s.width()-20<=o.firstWidth;if(!f.isFunction(l.onresize)){if(f.isFunction(f.msgbox.onresize)){f.msgbox.onresize.call(F[0],o)}}else{l.onresize.call(F[0],o)}});o.before=function(q){q.stopPropagation();var p=window.event?window.event.keyCode:q.which;if(q.target.type=="text"&&!p){F.find("button."+(A||y?H:n)).trigger("click");return E}switch(p){case 13:F.find("button:focus").trigger("click");return E;case 27:F.find("button."+(A||y?H:n)).trigger("click");return E}};var J="."+j+"ui,."+j+"modal",D=f(document.documentElement||document.body).append(B).append(F.parent()).bind(h,o.before);o.after=function(p,q){var t=f(p).hasClass(n);switch(v){case A:l.submit.call(F[0],t?q:null);break;case y:l.submit.call(F[0],t);break;default:l.submit.call(F[0]);break}D.unbind(h,o.before);s.unbind(e,o[e])};F.delegate("button","click",function(t){var p=function(){F.parent().add(B).remove()},q=l.onclose||f.msgbox.onclose;o.after(this,A?C.children().val():null);if(f.isFunction(q)){f.when(q.call(F[0],A?I.children().val():f(this).hasClass(n))).always(p)}else{p()}});var k=function(){s.trigger(e);if(A){F.find("input:text").select()}else{F.find("button:eq(0)").focus()}var p=l.onopen||f.msgbox.onopen;if(f.isFunction(p)){p.call(F[0],l)}};if(g){setTimeout(k,0)}else{k()}return F};f.extend(f.msgbox,{strings:{ok:"OK",yes:"OK",no:"Cancel"},css:{container:{position:d,left:"50%",top:"32%","z-index":"9001"},ui:{border:"1px solid black",font:"9pt verdana,gulim,sans-serif","background-color":"white",position:"relative",left:"-50%",top:"32%",overflow:"hidden","float":"right"},modal:{position:d,left:"0",top:"0",right:"0",bottom:"0","background-color":"black",opacity:".4","z-index":"9000"},msg:{padding:"2em 4em",overflow:"hidden","font-family":"verdana,gulim,sans-serif","white-space":"pre-wrap","word-wrap":"break-word"},buttons:{padding:"1em","background-color":"#eee","text-align":"right",overflow:"hidden"},button:{width:"72px",margin:"auto .25em"},inbox:{width:"90%",margin:"-1em auto 1em",border:"1px inset #3D7BAD"},input:{width:"99%",display:"block",border:"0"}},onresize:function(m){var k=f(this),j=k.parent();if(!m.firstWidth){m.firstUnder=true;m.firstWidth=k.outerWidth()}var l=f(window).width()-20<=m.firstWidth;if(l&&!m.isOver){m.isOver=true;j.css({left:"10px",right:"10px","margin-top":~~(-k.outerHeight()*0.32)+"px","min-width":""});k.css({position:"static"})}else{if((!l&&m.isOver)||m.firstUnder){m.firstUnder=false;m.isOver=false;j.css({left:"",right:"","margin-top":~~(-k.outerHeight()*0.32)+"px","min-width":m.firstWidth+"px"});k.css({position:""})}}}});f.msgbox.options={submit:function(){},confirm:false,ok:f.msgbox.strings.ok,yes:f.msgbox.strings.yes,no:f.msgbox.strings.no};f.alert=function(j,k){return f.msgbox(j,{submit:k})};f.confirm=function(j,k){return f.msgbox(j,{confirm:true,submit:k})};f.prompt=function(m,l,n,k){var j=f.isFunction(l);return f.msgbox(m,{input:j?true:l,submit:j?l:n,password:j?n:k})}})(jQuery);
\ No newline at end of file
+!function(a){window.console||(window.console={},window.console.log=a.noop);var b="fixed",c="div",d="keypress",e="resize",f="msgbox-",g="."+f,h=f+"-style",i="button",j="click",k=!1,m=function(b){return a(document.createElement(b))},n=function(a,b){if(!n.once||b){a=a||{};var c=n.style?n.style:n.style=m("style").addClass(h).attr("type","text/css"),d=[];for(var e in a)if(a[e]){var f=a[e];d.push(g+e),d.push("{");for(var i in f)if(k)switch(i){case"opacity":d.push("filter:alpha(opacity="+(100*+("."==f[i].substring(0,1)?"0"+f[i]:f[i])||100)+");");break;default:d.push(i+":"+f[i]+";")}else d.push(i+":"+f[i]+";");d.push("}")}c.each(function(){var a=d.join("");k?this.styleSheet.cssText=a:this.innerHTML=a}).appendTo("head"),n.once=!0}};a.msgbox=function(b,l){l=a.extend({},a.msgbox.options,l),a(h).length||n(a.msgbox.css);var o={},p=f+"ok",q=f+"no",r="password",t=(l.css||{},!0),u=!1,v=l.input!==!1&&void 0!=l.input&&null!=l.input,w=!!l.confirm,x=function(){setTimeout(function(){var b=a(document.activeElement),c=[g+"input",g+i];b.length&&(b.is(c[0])||b.is(c[1]))||z.find(c+"").eq(0).focus()},0)},y=a(window),z=m(c).addClass(f+"container").append(m(c).addClass(f+"ui").addClass(f+(v?"prompt":w?"confirm":"alert"))).children(),A=m(c).addClass(f+"modal"),B=m(c).addClass(f+"msg").html(b).appendTo(z),C=v?a("
").addClass(f+"inbox").children().addClass(f+"input").bind("keydown",function(a){var b=a.which;if(9==b&&a.shiftKey)a.preventDefault(),z.find(g+i).filter(":last").focus();else switch(b){case 13:return a.preventDefault(),z.find(i+"."+p).trigger(j),!1;case 27:a.preventDefault(),z.find(i+"."+(v||w?q:p)).trigger(j)}}).bind("blur",x).end().appendTo(z):null,D=m(c).addClass(f+"buttons").appendTo(z),E=m(i).addClass(f+i).bind("keydown",function(b){if(this==document.activeElement){b.stopPropagation();var e,c=b.which,d=a(this),f=b.shiftKey;switch(c){case 9:case 39:b.preventDefault(),e=d[9==c&&f?"prev":"next"](i),e.length?e.focus():9==c&&(e=z.find(g+"input"),e.length?e.select():(e=d[f?"next":"prev"](i),e.length&&e.focus()));break;case 37:b.preventDefault(),e=d.prev(i),e.length&&e.focus();break;case 27:b.preventDefault(),z.find(i+"."+(v||w?q:p)).trigger(j)}}}).bind("blur",x);[E.clone(t).addClass(p).text(w?l.yes:l.ok).appendTo(D),v||w?E.clone(t).addClass(q).text(l.no).appendTo(D):null],z.add(A).bind("keydown",function(){}),a.extend(z[0],{container:z.parent()[0],modal:A[0],msg:B[0],inbox:C?C[0]:null,buttons:D[0]}),v&&(l.confirm=t,l.input!==!0&&C.children().val(l.input)),y.bind(e,o[e]=function(){o.firstWidth||(o.firstUnder=!0,o.firstWidth=z.outerWidth()),y.width()-20<=o.firstWidth,a.isFunction(l.onresize)?l.onresize.call(z[0],o):a.isFunction(a.msgbox.onresize)&&a.msgbox.onresize.call(z[0],o)}),o.before=function(a){a.stopPropagation();var b=window.event?window.event.keyCode:a.which;if("text"==a.target.type&&!b)return z.find(i+"."+(v||w?q:p)).trigger(j),u;switch(b){case 13:return z.find(i+":focus").trigger("click"),u;case 27:return z.find(i+"."+(v||w?q:p)).trigger(j),u}};var H=a(document.documentElement||document.body).append(A).append(z.parent()).bind(d,o.before);o.after=function(b,c){var f=a(b).hasClass(p);switch(t){case v:l.submit.call(z[0],f?c:null);break;case w:l.submit.call(z[0],f);break;default:l.submit.call(z[0])}H.unbind(d,o.before),y.unbind(e,o[e])},z.delegate(i,j,function(){var c=function(){z.parent().add(A).remove()},d=l.onclose||a.msgbox.onclose;o.after(this,v?C.children().val():null),a.isFunction(d)?a.when(d.call(z[0],v?I.children().val():a(this).hasClass(p))).always(c):c()});var J=function(){y.trigger(e),v?z.find("input:text").select():z.find(i+":eq(0)").focus();var b=l.onopen||a.msgbox.onopen;a.isFunction(b)&&b.call(z[0],l)};return k?setTimeout(J,0):J(),z},a.extend(a.msgbox,{strings:{ok:"OK",yes:"OK",no:"Cancel"},css:{container:{position:b,left:"50%",top:"32%","z-index":"9001"},ui:{border:"1px solid black",font:"9pt verdana,gulim,sans-serif","background-color":"white",position:"relative",left:"-50%",top:"32%",overflow:"hidden","float":"right"},modal:{position:b,left:"0",top:"0",right:"0",bottom:"0","background-color":"black",opacity:".4","z-index":"9000"},msg:{padding:"2em 4em",overflow:"hidden","font-family":"verdana,gulim,sans-serif","white-space":"pre-wrap","word-wrap":"break-word"},buttons:{padding:"1em","background-color":"#eee","text-align":"right",overflow:"hidden"},button:{width:"72px",margin:"auto .25em"},inbox:{width:"90%",margin:"-1em auto 1em",border:"1px inset #3D7BAD"},input:{width:"99%",display:"block",border:"0"}},onresize:function(b){var c=a(this),d=c.parent();b.firstWidth||(b.firstUnder=!0,b.firstWidth=c.outerWidth());var e=a(window).width()-20<=b.firstWidth;e&&!b.isOver?(b.isOver=!0,d.css({left:"10px",right:"10px","margin-top":~~(.32*-c.outerHeight())+"px","min-width":""}),c.css({position:"static"})):(!e&&b.isOver||b.firstUnder)&&(b.firstUnder=!1,b.isOver=!1,d.css({left:"",right:"","margin-top":~~(.32*-c.outerHeight())+"px","min-width":b.firstWidth+"px"}),c.css({position:""}))}}),a.msgbox.options={submit:function(){},confirm:!1,ok:a.msgbox.strings.ok,yes:a.msgbox.strings.yes,no:a.msgbox.strings.no},a.alert=function(b,c){return a.msgbox(b,{submit:c})},a.confirm=function(b,c){return a.msgbox(b,{confirm:!0,submit:c})},a.prompt=function(b,c,d,e){var f=a.isFunction(c);return a.msgbox(b,{input:f?!0:c,submit:f?c:d,password:f?d:e})}}(jQuery);
\ No newline at end of file
diff --git a/msgbox.jquery.json b/msgbox.jquery.json
index 1aa5ec6..3c50cb4 100644
--- a/msgbox.jquery.json
+++ b/msgbox.jquery.json
@@ -3,7 +3,7 @@
"title": "jQuery MsgBox",
"description": "The Message box for web, Firefox style, User notification made simple.",
"keywords": ["alert","confirm","prompt","msgbox","dialog","notification","ui","simple"],
- "version": "0.8.0",
+ "version": "0.8.1",
"author": {
"name": "Composite",
"url": "http://hazard.kr/"