From 6b76b773b9abecfea2dcab7251ecb76595c5d86c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=94=90=E6=96=8C?= <1987.tangbin@gmail.com>
Date: Sun, 8 Dec 2013 19:41:14 +0800
Subject: [PATCH 01/68] new artDialog!
---
.gitignore | 3 +
LICENSE.md | 28 +
README.md | 72 +-
artDialog.min.js | 9 -
artDialog.plugins.min.js | 1 -
css/ui-dialog.css | 440 ++++++++++
doc/css/doc.css | 49 ++
doc/index.html | 1395 ++++++++++++++++++++++++++++++
doc/index.md | 1038 +++++++++++++++++++++++
doc/js/doc.js | 134 +++
doc/js/sh_languages.js | 9 +
index.html | 1312 -----------------------------
jquery.artDialog.min.js | 9 -
lib/jquery-1.10.2.js | 6 +
lib/require.js | 36 +
lib/sea.js | 15 +
license.txt | 165 ----
skins/aero.css | 60 --
skins/aero/aero_s.png | Bin 2381 -> 0 bytes
skins/aero/aero_s2.png | Bin 188 -> 0 bytes
skins/black.css | 78 --
skins/black/bg.png | Bin 2971 -> 0 bytes
skins/black/bg2.png | Bin 186 -> 0 bytes
skins/black/bg_css3.png | Bin 2163 -> 0 bytes
skins/black/bg_css3_2.png | Bin 119 -> 0 bytes
skins/blue.css | 78 --
skins/blue/bg.png | Bin 2924 -> 0 bytes
skins/blue/bg2.png | Bin 209 -> 0 bytes
skins/blue/bg_css3.png | Bin 2237 -> 0 bytes
skins/blue/bg_css3_2.png | Bin 133 -> 0 bytes
skins/chrome.css | 59 --
skins/chrome/border.png | Bin 260 -> 0 bytes
skins/chrome/chrome_s.png | Bin 1202 -> 0 bytes
skins/default.css | 70 --
skins/green.css | 78 --
skins/green/bg.png | Bin 3062 -> 0 bytes
skins/green/bg2.png | Bin 201 -> 0 bytes
skins/green/bg_css3.png | Bin 2358 -> 0 bytes
skins/green/bg_css3_2.png | Bin 119 -> 0 bytes
skins/green/color_bg.png | Bin 3062 -> 0 bytes
skins/idialog.css | 72 --
skins/idialog/idialog_s.png | Bin 3811 -> 0 bytes
skins/idialog/idialog_s2.png | Bin 184 -> 0 bytes
skins/loading.gif | Bin 381 -> 0 bytes
skins/opera.css | 61 --
skins/opera/s1.png | Bin 2818 -> 0 bytes
skins/opera/s2.png | Bin 177 -> 0 bytes
skins/simple.css | 54 --
skins/twitter.css | 58 --
source/artDialog.js | 1536 ----------------------------------
source/artDialog.plugins.js | 322 -------
source/jquery.artDialog.js | 979 ----------------------
src/dialog-drag.js | 27 +
src/dialog-iframe.js | 71 ++
src/dialog.js | 527 ++++++++++++
src/drag.js | 216 +++++
src/popup.js | 665 +++++++++++++++
test/align-overflow.html | 46 +
test/align.html | 138 +++
test/button.html | 56 ++
test/close.html | 45 +
test/content.html | 49 ++
test/fixed.html | 34 +
test/iframe-content.html | 73 ++
test/iframe-input.html | 35 +
test/iframe.html | 44 +
test/openDialog.html | 88 ++
test/show-element.html | 92 ++
test/show-event.html | 34 +
test/show.html | 44 +
test/showModal.html | 44 +
test/title.html | 52 ++
72 files changed, 5555 insertions(+), 5051 deletions(-)
create mode 100644 .gitignore
create mode 100644 LICENSE.md
delete mode 100644 artDialog.min.js
delete mode 100644 artDialog.plugins.min.js
create mode 100644 css/ui-dialog.css
create mode 100644 doc/css/doc.css
create mode 100644 doc/index.html
create mode 100755 doc/index.md
create mode 100644 doc/js/doc.js
create mode 100644 doc/js/sh_languages.js
delete mode 100644 index.html
delete mode 100644 jquery.artDialog.min.js
create mode 100644 lib/jquery-1.10.2.js
create mode 100644 lib/require.js
create mode 100755 lib/sea.js
delete mode 100644 license.txt
delete mode 100644 skins/aero.css
delete mode 100644 skins/aero/aero_s.png
delete mode 100644 skins/aero/aero_s2.png
delete mode 100644 skins/black.css
delete mode 100644 skins/black/bg.png
delete mode 100644 skins/black/bg2.png
delete mode 100644 skins/black/bg_css3.png
delete mode 100644 skins/black/bg_css3_2.png
delete mode 100644 skins/blue.css
delete mode 100644 skins/blue/bg.png
delete mode 100644 skins/blue/bg2.png
delete mode 100644 skins/blue/bg_css3.png
delete mode 100644 skins/blue/bg_css3_2.png
delete mode 100644 skins/chrome.css
delete mode 100644 skins/chrome/border.png
delete mode 100644 skins/chrome/chrome_s.png
delete mode 100644 skins/default.css
delete mode 100644 skins/green.css
delete mode 100644 skins/green/bg.png
delete mode 100644 skins/green/bg2.png
delete mode 100644 skins/green/bg_css3.png
delete mode 100644 skins/green/bg_css3_2.png
delete mode 100644 skins/green/color_bg.png
delete mode 100644 skins/idialog.css
delete mode 100644 skins/idialog/idialog_s.png
delete mode 100644 skins/idialog/idialog_s2.png
delete mode 100644 skins/loading.gif
delete mode 100644 skins/opera.css
delete mode 100644 skins/opera/s1.png
delete mode 100644 skins/opera/s2.png
delete mode 100644 skins/simple.css
delete mode 100644 skins/twitter.css
delete mode 100644 source/artDialog.js
delete mode 100644 source/artDialog.plugins.js
delete mode 100644 source/jquery.artDialog.js
create mode 100644 src/dialog-drag.js
create mode 100644 src/dialog-iframe.js
create mode 100644 src/dialog.js
create mode 100755 src/drag.js
create mode 100644 src/popup.js
create mode 100644 test/align-overflow.html
create mode 100644 test/align.html
create mode 100755 test/button.html
create mode 100755 test/close.html
create mode 100755 test/content.html
create mode 100755 test/fixed.html
create mode 100644 test/iframe-content.html
create mode 100644 test/iframe-input.html
create mode 100755 test/iframe.html
create mode 100644 test/openDialog.html
create mode 100644 test/show-element.html
create mode 100644 test/show-event.html
create mode 100755 test/show.html
create mode 100755 test/showModal.html
create mode 100755 test/title.html
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..07c7af2
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+.DS_Store
+dist/*.js
+*selectbox*
\ No newline at end of file
diff --git a/LICENSE.md b/LICENSE.md
new file mode 100644
index 0000000..da08777
--- /dev/null
+++ b/LICENSE.md
@@ -0,0 +1,28 @@
+# 授权
+
+## LGPL
+
+artDialog 采用 [LGPL](http://www.gnu.org/licenses/lgpl-2.1.html) 开源协议:
+
+* 基于 GPL 的软件允许商业化销售,但不允许封闭源代码。
+* 如果您对遵循 GPL 的软件进行任何改动和/或再次开发并予以发布,则您的产品必须继承 GPL 协议,不允许封闭源代码。
+* 基于 LGPL 的软件也允许商业化销售,但不允许封闭源代码。
+* 如果您对遵循 LGPL 的软件进行任何改动和/或再次开发并予以发布,则您的产品必须继承 LGPL 协议,不允许封闭源代码。但是如果您的程序对遵循 LGPL 的软件进行任何连接、调用而不是包含,则允许封闭源代码。
+
+## 商业授权
+
+### 权利
+
+* 您可以将 artDialog 程序直接使用在自己的商业或者非商业网站或者软件产品中。
+* 您可以对 artDialog 进行修改和美化,可以去除 artDialog 版权注释或改变程序名称,无需公开您修改或美化过的 artDialog 程序与界面。
+* 商业授权每个公司只需要购买一次,而不限制产品域名。适用于 artDialog 现有版本和所有后续版本,永久有效。
+* 您享有反映和提出意见的优先权,相关意见将被作为首要考虑。
+
+### 费用
+
+artDialog v6 商业授权费用:¥999
+
+### 联系
+
+
+
diff --git a/README.md b/README.md
index 1d0cd85..eb090cd 100644
--- a/README.md
+++ b/README.md
@@ -1,50 +1,22 @@
-artDialog
-=========
-
-优雅的web对话框控件
-
-artDialog 是一个精心设计的对话框控件,它拥有精致的界面与易用的编程接口。
-
-## 概述
-
-artDialog 是一个精心设计的 web 对话框控件,它继承与延伸了桌面对话框的特性,拥有细致的用户体验与精致的界面。artDialog 基于 LGPL 协议开源,无论是个人还是商业项目都可免费使用。
-
-## 特点
-
-#### 自适应内容尺寸
-
-对话框采用特殊UI结构,无论使用AJAX异步填充内容还是类似tabs等控件导致内容变化,对话框均可自动自适应内容尺寸。
-
-#### 智能文本对齐
-
-如果设置了对话框宽度(包括用户通过调节把柄改变了尺寸),对话框中的文本会自动居中或者居左对齐,这些都是使用用CSS实现的。
-
-#### 黄金比例垂直居中
-
-对话框默认会采用黄金比例垂直居中弹出,正如网页中重要的内容会被安排在垂直黄金区域一样,这样更舒适。
-
-#### 可吸附式弹出
-
-宽屏笔记本用户已经逐渐成为主流,很多时候大幅度的移动鼠标操作也是一个麻烦的事情(尤其是使用触控板),artDialog支持设置在onclick事件触发源弹出,以让用户操作更加便捷。
-
-#### 支持快捷键与默认焦点
-
-* ESC快捷键默认触发对话框关闭(除非在输入状态)。
-
-* 若有确定按钮,焦点默认停留在确定按钮上,否则停留在右上角关闭按钮上,这样用户可以通过回车键进行操作。
-
-### 友好的API
-
-在保持小巧的程序体积之外,artDialog提供了丰富的可选配置与方法。它的API风格统一,简单易用,稍微阅读文档一个示例即可举一反三。
-
-## 用户
-
-* 腾讯
-* 盛大
-* 中国移动
-* 中国电信
-* ...
-
-## 演示
-
-http://aui.github.com/artDialog/
\ No newline at end of file
+# artDialog``v6``
+==========================
+
+artDialog v6 —— 经典的网页对话框组件,内外皆用心雕琢。
+
+## 用户
+
+四年来,有超过 40 万网站在使用 artDialog,其中包括:
+
+* [QQ空间 v8(腾讯)](http://qzone.qq.com)
+* [QQ旋风(腾讯)](http://xf.qq.com)
+* [Phpcms(盛大)](http://www.phpcms.cn)
+* [极路由](http://www.hiwifi.com)
+* [中国电信客服系统](http://www.189.cn)
+
+## 文档与示例
+
+
+
+## 授权协议
+
+免费,且开源。基于[LGPL 协议或商业协议](./LICENSE.md)。
\ No newline at end of file
diff --git a/artDialog.min.js b/artDialog.min.js
deleted file mode 100644
index 3eb4296..0000000
--- a/artDialog.min.js
+++ /dev/null
@@ -1,9 +0,0 @@
-/*!
-* artDialog 5.0.2
-* Date: 2012-11-11
-* https://github.com/aui/artDialog
-* (c) 2009-2012 TangBin, http://www.planeArt.cn
-*
-* This is licensed under the GNU LGPL, version 2.1 or later.
-* For details, see: http://creativecommons.org/licenses/LGPL/2.1/
-*/(function(e,t){function s(e,t,n){t=t||document,n=n||"*";var r=0,i=0,s=[],o=t.getElementsByTagName(n),u=o.length,a=new RegExp("(^|\\s)"+e+"(\\s|$)");for(;r)[^>]*$|#([\w\-]+)$)/,i=/[\n\t]/g;return e.$===t&&(e.$=n),n.fn=n.prototype={constructor:function(e,t){var n,i;t=t||document;if(!e)return this;if(e.nodeType)return this[0]=e,this;if(typeof e=="string"){n=r.exec(e);if(n&&n[2])return i=t.getElementById(n[2]),i&&i.parentNode&&(this[0]=i),this}return this[0]=e,this},hasClass:function(e){var t=" "+e+" ";return(" "+this[0].className+" ").replace(i," ").indexOf(t)>-1?!0:!1},addClass:function(e){return this.hasClass(e)||(this[0].className+=" "+e),this},removeClass:function(e){var t=this[0];return e?this.hasClass(e)&&(t.className=t.className.replace(e," ")):t.className="",this},css:function(e,r){var i,s=this[0],o=arguments[0];if(typeof e=="string"){if(r===t)return n.css(s,e);s.style[e]=r}else for(i in o)s.style[i]=o[i];return this},show:function(){return this.css("display","block")},hide:function(){return this.css("display","none")},offset:function(){var e=this[0],t=e.getBoundingClientRect(),n=e.ownerDocument,r=n.body,i=n.documentElement,s=i.clientTop||r.clientTop||0,o=i.clientLeft||r.clientLeft||0,u=t.top+(self.pageYOffset||i.scrollTop)-s,a=t.left+(self.pageXOffset||i.scrollLeft)-o;return{left:a,top:u}},html:function(e){var r=this[0];return e===t?r.innerHTML:(n.cleanData(r.getElementsByTagName("*")),r.innerHTML=e,this)},remove:function(){var e=this[0];return n.cleanData(e.getElementsByTagName("*")),n.cleanData([e]),e.parentNode.removeChild(e),this},bind:function(e,t){return n.event.add(this[0],e,t),this},unbind:function(e,t){return n.event.remove(this[0],e,t),this}},n.fn.constructor.prototype=n.fn,n.isWindow=function(e){return e&&typeof e=="object"&&"setInterval"in e},n.fn.find=function(e){var t,r=this[0],i=e.split(".")[1];return i?document.getElementsByClassName?t=r.getElementsByClassName(i):t=s(i,r):t=r.getElementsByTagName(e),n(t[0])},n.each=function(e,n){var r,i=0,s=e.length,o=s===t;if(o){for(r in e)if(n.call(e[r],r,e[r])===!1)break}else for(var u=e[0];il&&g-E>N?g-E+v:x,T=T+S>c+C&&y-S>C?y-S:T,w.left=parseInt(x)+"px",w.top=parseInt(T)+"px",this._follow&&this._follow.removeAttribute(s),this._follow=t,t[s]=r.id,this},button:function(){var t=this.dom,n=t.buttons,r=n[0],i="d-state-highlight",s=this._listeners=this._listeners||{},u=[].slice.call(arguments),a=0,f,l,c,h,p;for(;a' ,l.defaults="{content:'loading..
',title:"message",button:null,ok:null,cancel:null,initialize:null,beforeunload:null,okValue:"ok",cancelValue:"cancel",width:"auto",height:"auto",padding:"20px 25px",skin:null,time:null,esc:!0,focus:!0,visible:!0,follow:null,lock:!1,fixed:!1,zIndex:1987},this.artDialog=e.dialog=e.artDialog=l}(this.art||this.jQuery,this)
\ No newline at end of file
diff --git a/artDialog.plugins.min.js b/artDialog.plugins.min.js
deleted file mode 100644
index fe1e2e8..0000000
--- a/artDialog.plugins.min.js
+++ /dev/null
@@ -1 +0,0 @@
-(function(c){c.alert=c.dialog.alert=function(b,a){return c.dialog({id:"Alert",fixed:!0,lock:!0,content:b,ok:!0,beforeunload:a})};c.confirm=c.dialog.confirm=function(b,a,m){return c.dialog({id:"Confirm",fixed:!0,lock:!0,content:b,ok:a,cancel:m})};c.prompt=c.dialog.prompt=function(b,a,m){var d;return c.dialog({id:"Prompt",fixed:!0,lock:!0,content:['',b,'
'].join(""),initialize:function(){d=this.dom.content.find(".d-input-text")[0];d.select();d.focus()},ok:function(){return a&&a.call(this,d.value)},cancel:function(){}})};c.dialog.prototype.shake=function(){var b=function(a,b,c){var h=+new Date,e=setInterval(function(){var f=(+new Date-h)/c;1<=f?(clearInterval(e),b(f)):a(f)},13)},a=function(c,d,g,h){var e=h;void 0===e&&(e=6,g/=e);var f=parseInt(c.style.marginLeft)||0;b(function(a){c.style.marginLeft=f+(d-f)*a+"px"},function(){0!==e&&a(c,1===e?0:1.3*(d/e-d),g,--e)},g)};return function(){a(this.dom.wrap[0],40,600);return this}}();var o=function(){var b=this,a=function(a){var c=b[a];b[a]=function(){return c.apply(b,arguments)}};a("start");a("over");a("end")};o.prototype={start:function(b){c(document).bind("mousemove",this.over).bind("mouseup",this.end);this._sClientX=b.clientX;this._sClientY=b.clientY;this.onstart(b.clientX,b.clientY);return!1},over:function(b){this._mClientX=b.clientX;this._mClientY=b.clientY;this.onover(b.clientX-this._sClientX,b.clientY-this._sClientY);return!1},end:function(b){c(document).unbind("mousemove",this.over).unbind("mouseup",this.end);this.onend(b.clientX,b.clientY);return!1}};var j=c(window),k=c(document),i=document.documentElement,p=!!("minWidth"in i.style)&&"onlosecapture"in i,q="setCapture"in i,r=function(){return!1},n=function(b){var a=new o,c=artDialog.focus,d=c.dom,g=d.wrap,h=d.title,e=g[0],f=h[0],i=d.main[0],l=e.style,s=i.style,t=b.target===d.se[0]?!0:!1,u=(d="fixed"===e.style.position)?0:k.scrollLeft(),v=d?0:k.scrollTop(),n=j.width()-e.offsetWidth+u,A=j.height()-e.offsetHeight+v,w,x,y,z;a.onstart=function(){t?(w=i.offsetWidth,x=i.offsetHeight):(y=e.offsetLeft,z=e.offsetTop);k.bind("dblclick",a.end).bind("dragstart",r);p?h.bind("losecapture",a.end):j.bind("blur",a.end);q&&f.setCapture();g.addClass("d-state-drag");c.focus()};a.onover=function(a,b){if(t){var c=a+w,d=b+x;l.width="auto";s.width=Math.max(0,c)+"px";l.width=e.offsetWidth+"px";s.height=Math.max(0,d)+"px"}else c=Math.max(u,Math.min(n,a+y)),d=Math.max(v,Math.min(A,b+z)),l.left=c+"px",l.top=d+"px"};a.onend=function(){k.unbind("dblclick",a.end).unbind("dragstart",r);p?h.unbind("losecapture",a.end):j.unbind("blur",a.end);q&&f.releaseCapture();g.removeClass("d-state-drag")};a.start(b)};c(document).bind("mousedown",function(b){var a=artDialog.focus;if(a){var c=b.target,d=a.config,a=a.dom;if(!1!==d.drag&&c===a.title[0]||!1!==d.resize&&c===a.se[0])return n(b),!1}})})(this.art||this.jQuery);
\ No newline at end of file
diff --git a/css/ui-dialog.css b/css/ui-dialog.css
new file mode 100644
index 0000000..2fd7835
--- /dev/null
+++ b/css/ui-dialog.css
@@ -0,0 +1,440 @@
+/*!
+* artDialog v6.0.0
+* Date: 2013-12-06
+* https://github.com/aui/artDialog6
+* (c) 2009-2013 TangBin, http://www.planeArt.cn
+*
+* This is licensed under the GNU LGPL, version 2.1 or later.
+* For details, see: http://www.gnu.org/licenses/lgpl-2.1.html
+*/
+.ui-dialog {
+ *zoom:1;
+ _float: left;
+ position: relative;
+ background-color: #FFF;
+ border: 1px solid #999;
+ border-radius: 6px;
+ outline: 0;
+ background-clip: padding-box;
+ font-family: Helvetica, arial, sans-serif;
+ font-size: 14px;
+ line-height: 1.428571429;
+ color: #333;
+ opacity: 0;
+ -webkit-transform: scale(0);
+ transform: scale(0);
+ -webkit-transition: -webkit-transform .15s ease-in-out, opacity .15s ease-in-out;
+ transition: transform .15s ease-in-out, opacity .15s ease-in-out;
+}
+.ui-popup-show .ui-dialog {
+ opacity: 1;
+ -webkit-transform: scale(1);
+ transform: scale(1);
+}
+.ui-dialog-grid {
+ width: auto;
+ margin: 0;
+ border: 0 none;
+ border-collapse:collapse;
+ border-spacing: 0;
+ background: transparent;
+}
+.ui-popup-focus .ui-dialog {
+ box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
+}
+.ui-dialog-header,
+.ui-dialog-body,
+.ui-dialog-footer {
+ padding: 0;
+ border: 0 none;
+ text-align: left;
+ background: transparent;
+}
+.ui-dialog-header {
+ border-bottom: 1px solid #E5E5E5;
+}
+.ui-dialog-close {
+ position: relative;
+ float: right;
+ top: 13px;
+ right: 13px;
+ _height: 26px;
+ padding: 0 4px;
+ font-size: 21px;
+ font-weight: bold;
+ line-height: 1;
+ color: #000;
+ text-shadow: 0 1px 0 #FFF;
+ opacity: .2;
+ filter: alpha(opacity=20);
+ cursor: pointer;
+ background: transparent;
+ border: 0;
+ -webkit-appearance: none;
+}
+.ui-dialog-close:hover,
+.ui-dialog-close:focus {
+ color: #000000;
+ text-decoration: none;
+ cursor: pointer;
+ outline: 0;
+ opacity: 0.5;
+ filter: alpha(opacity=50);
+}
+.ui-dialog-title {
+ margin: 0;
+ line-height: 1.428571429;
+ min-height: 16.428571429px;
+ padding: 15px;
+ overflow:hidden;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ font-weight: bold;
+ cursor: default;
+}
+.ui-dialog-body {
+ padding: 20px;
+ text-align: center;
+}
+.ui-dialog-content {
+ display: inline-block;
+ position: relative;
+ *zoom: 1;
+ *display: inline;
+ text-align: left;
+}
+.ui-dialog-footer {
+ padding: 0 20px 20px 20px;
+}
+.ui-dialog-statusbar {
+ float: left;
+ margin-right: 20px;
+ padding: 6px 0;
+ line-height: 1.428571429;
+ font-size: 14px;
+ color: #888;
+ white-space: nowrap;
+}
+.ui-dialog-statusbar label:hover {
+ color: #333;
+}
+.ui-dialog-statusbar input,
+.ui-dialog-statusbar .label {
+ vertical-align: middle;
+}
+.ui-dialog-button {
+ float: right;
+ white-space: nowrap;
+}
+.ui-dialog-footer button+button {
+ margin-bottom: 0;
+ margin-left: 5px;
+}
+.ui-dialog-footer button {
+ width:auto;
+ overflow:visible;
+ display: inline-block;
+ padding: 6px 12px;
+ _margin-left: 5px;
+ margin-bottom: 0;
+ font-size: 14px;
+ font-weight: normal;
+ line-height: 1.428571429;
+ text-align: center;
+ white-space: nowrap;
+ vertical-align: middle;
+ cursor: pointer;
+ background-image: none;
+ border: 1px solid transparent;
+ border-radius: 4px;
+ -webkit-user-select: none;
+ -moz-user-select: none;
+ -ms-user-select: none;
+ -o-user-select: none;
+ user-select: none;
+}
+
+.ui-dialog-footer button:focus {
+ outline: thin dotted #333;
+ outline: 5px auto -webkit-focus-ring-color;
+ outline-offset: -2px;
+}
+
+.ui-dialog-footer button:hover,
+.ui-dialog-footer button:focus {
+ color: #333333;
+ text-decoration: none;
+}
+
+.ui-dialog-footer button:active {
+ background-image: none;
+ outline: 0;
+ -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
+ box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
+}
+.ui-dialog-footer button[disabled] {
+ pointer-events: none;
+ cursor: not-allowed;
+ opacity: 0.65;
+ filter: alpha(opacity=65);
+ -webkit-box-shadow: none;
+ box-shadow: none;
+}
+
+.ui-dialog-footer button {
+ color: #333333;
+ background-color: #ffffff;
+ border-color: #cccccc;
+}
+
+.ui-dialog-footer button:hover,
+.ui-dialog-footer button:focus,
+.ui-dialog-footer button:active {
+ color: #333333;
+ background-color: #ebebeb;
+ border-color: #adadad;
+}
+
+.ui-dialog-footer button:active{
+ background-image: none;
+}
+
+.ui-dialog-footer button[disabled],
+.ui-dialog-footer button[disabled]:hover,
+.ui-dialog-footer button[disabled]:focus,
+.ui-dialog-footer button[disabled]:active {
+ background-color: #ffffff;
+ border-color: #cccccc;
+}
+
+.ui-dialog-footer button.ui-dialog-autofocus {
+ color: #ffffff;
+ background-color: #428bca;
+ border-color: #357ebd;
+}
+
+.ui-dialog-footer button.ui-dialog-autofocus:hover,
+.ui-dialog-footer button.ui-dialog-autofocus:focus,
+.ui-dialog-footer button.ui-dialog-autofocus:active {
+ color: #ffffff;
+ background-color: #3276b1;
+ border-color: #285e8e;
+}
+
+.ui-dialog-footer button.ui-dialog-autofocus:active {
+ background-image: none;
+}
+.ui-popup-nw .ui-dialog,
+.ui-popup-n .ui-dialog,
+.ui-popup-ne .ui-dialog {
+ top: 8px;
+}
+.ui-popup-sw .ui-dialog,
+.ui-popup-s .ui-dialog,
+.ui-popup-se .ui-dialog {
+ top: -8px;
+}
+.ui-popup-wn .ui-dialog,
+.ui-popup-w .ui-dialog,
+.ui-popup-ws .ui-dialog {
+ left: 8px;
+}
+.ui-popup-en .ui-dialog,
+.ui-popup-e .ui-dialog,
+.ui-popup-es .ui-dialog {
+ left: -8px;
+}
+.ui-dialog-arrow-a,
+.ui-dialog-arrow-b {
+ position: absolute;
+ display: block;
+ width: 0;
+ height: 0;
+ overflow:hidden;
+ line-height:0;
+ font-size: 0;
+ _color:#FF3FFF;
+ _filter:chroma(color=#FF3FFF);
+}
+.ui-popup-nw .ui-dialog-arrow-a,
+.ui-popup-n .ui-dialog-arrow-a,
+.ui-popup-ne .ui-dialog-arrow-a {
+ top: -8px;
+ border-bottom:8px solid #999;
+ border-top:0 none;
+ border-left:8px solid transparent;
+ border-right:8px solid transparent;
+}
+.ui-popup-nw .ui-dialog-arrow-b,
+.ui-popup-n .ui-dialog-arrow-b,
+.ui-popup-ne .ui-dialog-arrow-b {
+ top: -7px;
+ border-bottom:8px solid #fff;
+ border-top:0 none;
+ border-left:8px solid transparent;
+ border-right:8px solid transparent;
+}
+.ui-popup-nw .ui-dialog-arrow-a,
+.ui-popup-nw .ui-dialog-arrow-b {
+ left: 15px;
+}
+.ui-popup-n .ui-dialog-arrow-a,
+.ui-popup-n .ui-dialog-arrow-b {
+ left: 50%;
+ margin-left: -8px;
+}
+.ui-popup-ne .ui-dialog-arrow-a,
+.ui-popup-ne .ui-dialog-arrow-b {
+ right: 15px;
+}
+
+.ui-popup-sw .ui-dialog-arrow-a,
+.ui-popup-s .ui-dialog-arrow-a,
+.ui-popup-se .ui-dialog-arrow-a {
+ bottom: -8px;
+ border-top:8px solid #999;
+ border-bottom:0 none;
+ border-left:8px solid transparent;
+ border-right:8px solid transparent;
+}
+.ui-popup-sw .ui-dialog-arrow-b,
+.ui-popup-s .ui-dialog-arrow-b,
+.ui-popup-se .ui-dialog-arrow-b {
+ bottom: -7px;
+ border-top:8px solid #fff;
+ border-bottom:0 none;
+ border-left:8px solid transparent;
+ border-right:8px solid transparent;
+}
+.ui-popup-sw .ui-dialog-arrow-a,
+.ui-popup-sw .ui-dialog-arrow-b {
+ left: 15px;
+}
+.ui-popup-s .ui-dialog-arrow-a,
+.ui-popup-s .ui-dialog-arrow-b {
+ margin-left: -8px;
+ left: 50%;
+}
+.ui-popup-se .ui-dialog-arrow-a,
+.ui-popup-se .ui-dialog-arrow-b {
+ right: 15px;
+}
+.ui-popup-wn .ui-dialog-arrow-a,
+.ui-popup-w .ui-dialog-arrow-a,
+.ui-popup-ws .ui-dialog-arrow-a {
+ left: -8px;
+ border-right:8px solid #999;
+ border-left:0 none;
+ border-top:8px solid transparent;
+ border-bottom:8px solid transparent;
+}
+.ui-popup-wn .ui-dialog-arrow-b,
+.ui-popup-w .ui-dialog-arrow-b,
+.ui-popup-ws .ui-dialog-arrow-b {
+ left: -7px;
+ border-right:8px solid #fff;
+ border-left:0 none;
+ border-top:8px solid transparent;
+ border-bottom:8px solid transparent;
+}
+.ui-popup-wn .ui-dialog-arrow-a,
+.ui-popup-wn .ui-dialog-arrow-b {
+ top: 15px;
+}
+.ui-popup-w .ui-dialog-arrow-a,
+.ui-popup-w .ui-dialog-arrow-b {
+ margin-top: -8px;
+ top: 50%;
+}
+.ui-popup-ws .ui-dialog-arrow-a,
+.ui-popup-ws .ui-dialog-arrow-b {
+ bottom: 15px;
+}
+.ui-popup-en .ui-dialog-arrow-a,
+.ui-popup-e .ui-dialog-arrow-a,
+.ui-popup-es .ui-dialog-arrow-a {
+ right: -8px;
+ border-left:8px solid #999;
+ border-right:0 none;
+ border-top:8px solid transparent;
+ border-bottom:8px solid transparent;
+}
+.ui-popup-en .ui-dialog-arrow-b,
+.ui-popup-e .ui-dialog-arrow-b,
+.ui-popup-es .ui-dialog-arrow-b {
+ right: -7px;
+ border-left:8px solid #fff;
+ border-right:0 none;
+ border-top:8px solid transparent;
+ border-bottom:8px solid transparent;
+}
+.ui-popup-en .ui-dialog-arrow-a,
+.ui-popup-right .ui-dialog-arrow-a,
+.ui-popup-en .ui-dialog-arrow-b {
+ top: 15px;
+}
+.ui-popup-e .ui-dialog-arrow-a,
+.ui-popup-e .ui-dialog-arrow-b {
+ margin-top: -8px;
+ top: 50%;
+}
+.ui-popup-es .ui-dialog-arrow-a,
+.ui-popup-es .ui-dialog-arrow-b {
+ bottom: 15px;
+}
+
+
+@-webkit-keyframes ui-dialog-loading {
+ 0% {
+ -webkit-transform: rotate(0deg);
+ }
+ 100% {
+ -webkit-transform: rotate(360deg);
+ }
+}
+@keyframes ui-dialog-loading {
+ 0% {
+ transform: rotate(0deg);
+ }
+ 100% {
+ transform: rotate(360deg);
+ }
+}
+
+.ui-dialog-loading {
+ position: relative;
+ display: inline-block;
+ *zoom: 1;
+ *display: inline;
+ overflow: hidden;
+ width: 32px;
+ height: 32px;
+ left: 50%;
+ top: 50%;
+ margin-left: -16px;
+ margin-top: -16px;
+ font-size: 0;
+ text-align: left;;
+ text-indent: -999em;
+ color: #666;
+ position: inherit\9;
+ margin: auto\9;
+ width: auto\9;
+ height: auto\9;
+ text-indent: 0\9;
+ font-size: 12px\9;
+}
+
+.ui-dialog-loading::after {
+ content: '';
+ width: 3px;
+ height: 3px;
+ margin: 14.5px 0 0 14.5px;
+ border-radius: 100%;
+ box-shadow: 0 -10px 0 1px #ccc, 10px 0px #ccc, 0 10px #ccc, -10px 0 #ccc, -7px -7px 0 0.5px #ccc, 7px -7px 0 1.5px #ccc, 7px 7px #ccc, -7px 7px #ccc;
+ position: absolute;
+ -webkit-transform: rotate(360deg);
+ -webkit-animation: ui-dialog-loading 1s infinite linear;
+ transform: rotate(360deg);
+ animation: ui-dialog-loading 1s infinite linear;
+}
diff --git a/doc/css/doc.css b/doc/css/doc.css
new file mode 100644
index 0000000..a079626
--- /dev/null
+++ b/doc/css/doc.css
@@ -0,0 +1,49 @@
+.doc-line {
+ height: 3px;
+}
+.doc-gotop {
+ position: fixed;
+ bottom: 5px;
+ right: 5px;
+ z-index: 9;
+}
+
+/*避免对话框样式被工具生成的全局样式污染*/
+.ui-dialog table,
+.ui-dialog table tr,
+.ui-dialog tr td,
+.ui-dialog tr:nth-child(2n) {
+ border: 0 none;
+ background: transparent;
+}
+.ui-dialog td.ui-dialog-header {
+ border-bottom: 1px solid #E5E5E5;
+}
+
+code.sh_sourceCode { color: #000000; font-weight: normal; font-style: normal; }
+code.sh_sourceCode .sh_keyword { color: #009; font-weight: bold; font-style: normal; }
+code.sh_sourceCode .sh_type { color: #0000ff; font-weight: normal; font-style: normal; }
+code.sh_sourceCode .sh_string { color: #00F; font-weight: normal; font-style: normal; }
+code.sh_sourceCode .sh_regexp { color: #060; font-weight: normal; font-style: normal; }
+code.sh_sourceCode .sh_specialchar { color: #C42DA8; font-weight: normal; font-style: normal; }
+code.sh_sourceCode .sh_comment { color: #999; font-weight: normal; font-style: italic; }
+code.sh_sourceCode .sh_number { color: #F00; font-weight: normal; font-style: normal; }
+code.sh_sourceCode .sh_codeproc { color: #00b800; font-weight: normal; font-style: normal; }
+code.sh_sourceCode .sh_symbol { color: #009; font-weight: bold; font-style: normal; }
+code.sh_sourceCode .sh_function { color: #000; font-weight: normal; font-style: normal; }
+code.sh_sourceCode .sh_cbracket { color: #009; font-weight: bold; font-style: normal; }
+code.sh_sourceCode .sh_url { color: #ff0000; font-weight: normal; font-style: normal; }
+code.sh_sourceCode .sh_date { color: #0000ff; font-weight: bold; font-style: normal; }
+code.sh_sourceCode .sh_time { color: #0000ff; font-weight: bold; font-style: normal; }
+code.sh_sourceCode .sh_file { color: #0000ff; font-weight: bold; font-style: normal; }
+code.sh_sourceCode .sh_ip { color: #ff0000; font-weight: normal; font-style: normal; }
+code.sh_sourceCode .sh_name { color: #ff0000; font-weight: normal; font-style: normal; }
+code.sh_sourceCode .sh_variable { color: #ec7f15; font-weight: normal; font-style: normal; }
+code.sh_sourceCode .sh_oldfile { color: #C42DA8; font-weight: normal; font-style: normal; }
+code.sh_sourceCode .sh_newfile { color: #ff0000; font-weight: normal; font-style: normal; }
+code.sh_sourceCode .sh_difflines { color: #0000ff; font-weight: bold; font-style: normal; }
+code.sh_sourceCode .sh_selector { color: #ec7f15; font-weight: normal; font-style: normal; }
+code.sh_sourceCode .sh_property { color: #0000ff; font-weight: bold; font-style: normal; }
+code.sh_sourceCode .sh_value { color: #ff0000; font-weight: normal; font-style: normal; }
+code.sh_sourceCode .sh_codedef_var { color: #909; font-weight: normal; font-style: normal; }
+code.sh_sourceCode .sh_codedef_func { color: #099; font-weight: normal; font-style: normal; }
\ No newline at end of file
diff --git a/doc/index.html b/doc/index.html
new file mode 100644
index 0000000..5daba17
--- /dev/null
+++ b/doc/index.html
@@ -0,0 +1,1395 @@
+
+
+
+
+
+
+artDialog``v6``
+
+
+
+artDialogv6
+
+
+
+artDialog —— 经典的网页对话框组件,内外皆用心雕琢。
+
+
+- 支持普通与气泡形式的对话框
+- 信息无障碍支持:焦点管理;支持 ARIA 标准
+- 面向未来:基于 HTML5 Dialog 的 API
+- 支持标准与模态对话框
+- 丰富的展示状态与友好的编程接口
+- 自适应内容尺寸
+
+
+
+文档导航
+
+
+- 引入 artDialog
+- 快速参考
+
+
+
+- 方法
+
+
+
+- 选项
+
+
+- 内容
+
+
+
+- 按钮
+
+
+
+- 外观
+
+
+
+- 交互
+
+
+
+- 事件
+
+
+
+- 高级
+
+
+
+
+
+- 属性
+
+
+
+
+
+
+引入 artDialog
+
+在模块中引入 artDialog(支持 RequireJS 与 SeaJS):
+
+var dialog = require('./artDialog/src/dialog');
+//..
+
+
+seajs加载示例
+
+全局依赖模块
+
+jquery
+
+快速参考
+
+普通对话框
+
+var d = dialog({
+ title: '欢迎',
+ content: '欢迎使用 artDialog 对话框组件!'
+});
+d.show();
+
+
+模态对话框
+
+var d = dialog({
+ title: 'message',
+ content: '<input autofocus />'
+});
+d.showModal();
+
+
+气泡浮层
+
+var d = dialog({
+ content: 'Hello World!',
+ quickClose: true// 点击空白处快速关闭
+});
+d.show(document.getElementById('quickref-bubble'));
+
+
+添加按钮
+
+1.确定与取消按钮:
+
+var d = dialog({
+ title: '提示',
+ content: '按钮回调函数返回 false 则不许关闭',
+ okValue: '确定',
+ ok: function () {
+ this.title('提交中…');
+ return false;
+ },
+ cancelValue: '取消',
+ cancel: function () {}
+});
+d.show();
+
+
+2.指定更多按钮:
+
+请参考 button 方法或参数。
+
+控制对话框关闭
+
+var d = dialog({
+ content: '对话框将在两秒内关闭'
+});
+d.show();
+setTimeout(function () {
+ d.close().remove();
+}, 2000);
+
+
+给对话框左下脚添加复选框
+
+var d = dialog({
+ title: '欢迎',
+ content: '欢迎使用 artDialog 对话框组件!',
+ ok: function () {},
+ statusbar: '<label><input type="checkbox">不再提醒</label>'
+});
+d.show();
+
+
+阻止对话框关闭
+
+按钮事件返回 false 则不会触发关闭。
+
+var d = dialog({
+ title: '欢迎',
+ content: '欢迎使用 artDialog 对话框组件!',
+ skin: 'ui-dialog-s',
+ padding: '25px 15px',
+ ok: function () {
+ var that = this;
+ this.title('正在提交..');
+ setTimeout(function () {
+ that.close().remove();
+ }, 2000);
+ return false;
+ },
+ cancel: function () {
+ alert('不许关闭');
+ return false;
+ }
+});
+d.show();
+
+
+不显示关闭按钮
+
+var d = dialog({
+ title: '欢迎',
+ content: '欢迎使用 artDialog 对话框组件!',
+ cancel: false,
+ ok: function () {}
+});
+d.show();
+
+
+创建 iframe 内容
+
+为了便于 iframe 内容能够控制对话框,建议在顶层页面创建一个可供 iframe 访问的对话框创建方法,例如:
+
+//..
+window.openDialog = function (options) {
+ // 页面地址
+ var url = options.url;
+ // 是否为模态,默认 true
+ var modal = options.modal;
+ // 是否使用气泡样式跟随到元素
+ var follow = options.follow;
+ // 页面加载完毕的事件
+ var oniframeload = options.oniframeload;
+ (window.require ? require : seajs.use)([
+ '../dialog',
+ '../dialog-iframe'
+ ], function (dialog, openIframe) {
+ var api = url ? openIframe(options) : dialog(options);
+ api[modal === false ? 'show' : 'showModal'](follow);
+ window.__dialog__ = dialog;
+ });
+};
+
+
+ 小提示:比普通对话框的选项多了url、modal、follow、oniframeload这几个字段。
+
+然后在顶层页面创建一个获取对话框 api 的方法,例如:
+
+//..
+window.getDialog = function (win) {
+ var dialog = window.__dialog__;
+ if (!dialog) {
+ return;
+ }
+ // 从 iframe 传入 window 对象
+ if (win && win.frameElement) {
+ var iframe = win.frameElement;
+ var list = dialog.get();
+ var api;
+ for (var i in list) {
+ api = list[i];
+ if (api.node.getElementsByTagName('iframe')[0] === iframe) {
+ return api;
+ }
+ }
+ // 直接传入 id 的情况
+ } else if (win) {
+ return dialog.get(win);
+ }
+};
+
+
+创建 iframe 对话框方式:
+
+top.openDialog({
+ title: 'loading..',
+ url: '../test/iframe-content.html',
+ onshow: function () {
+ console.log('onshow');
+ },
+ oniframeload: function () {
+ console.log('oniframeload');
+ },
+ onclose: function () {
+ console.log('onclose');
+ },
+ onremove: function () {
+ console.log('onremove');
+ }
+});
+
+
+对话框 iframe 内可以如下获取当前对话框接口:
+
+//..
+var dialog = top.getDialog(window);
+// 设置高度
+dialog.height(400);
+// 关闭对话框
+dialog.close().remove();
+
+
+方法
+
+若无特别说明,方法均支持链式调用。
+
+show([anchor])
+
+显示对话框。
+
+默认居中显示,支持传入元素节点或者事件对象。
+
+
+- 参数类型为
HTMLElement:可吸附到元素上,同时对话框将呈现气泡样式。
+- 参数类型为
Event Object:根据event.pageX与event.pageY定位。
+
+
+
+示例
+
+var d = dialog();
+d.content('hello world');
+d.show(document.getElementById('api-show'));
+
+
+var d = dialog({
+ id: 'api-show-dialog',
+ content: '右键菜单'
+});
+$(document).on('contextmenu', function (event) {
+ d.show(event);
+ return d.destroyed;
+});
+
+
+showModal([anchor])
+
+显示一个模态对话框。
+
+其余特性与参数可参见show([anchor])方法。
+
+示例
+
+var d = dialog({
+ title: 'message',
+ content: '<input autofocus />'
+});
+d.showModal();
+
+
+close([result])
+
+关闭(隐藏)对话框。
+
+可接收一个返回值,可以参见 returnValue。
+
+注意:close()方法只隐藏对话框,不会在 DOM 中删除,删除请使用remove()方法。
+
+remove()
+
+销毁对话框。
+
+注意:不同于close([result])方法,remove()方法会从 DOM 中移出对话框相关节点,销毁后的对话框无法再次使用。
+
+对话框按钮点击后默认会依次触发 close()、remove() 方法。如果想手动控制对话框关闭可以如下操作:
+
+var d = dialog();
+// [..]
+d.close().remove();
+
+
+content(html)
+
+写入对话框内容。
+
+html参数支持String、HTMLElement类型。
+
+示例
+
+var d = dialog();
+d.content('hello world');
+d.show();
+
+
+title(text)
+
+写入对话框标题。
+
+示例
+
+var d = dialog();
+d.title('hello world');
+d.show();
+
+
+width([value])
+
+设置对话框宽度。
+
+示例
+
+dialog({
+ content: 'hello world'
+})
+.width(320)
+.show();
+
+
+height([value])
+
+设置对话框高度。
+
+示例
+
+dialog({
+ content: 'hello world'
+})
+.height(320)
+.show();
+
+
+reset()
+
+手动刷新对话框位置。
+
+通常动态改变了内容尺寸后需要刷新对话框位置。
+
+button(args)
+
+自定义按钮。
+
+参数请参考 选项button;同时支持传入 HTML 字符串填充按钮区域。
+
+focus()
+
+聚焦对话框(置顶)。
+
+blur()
+
+让对话框失去焦点。
+
+addEventListener(type, callback)
+
+添加事件。
+
+支持的事件有:show、close、beforeremove、remove、reset、focus、blur
+
+removeEventListener(type, callback)
+
+删除事件。
+
+dialog.get(id)
+
+根据获取打开的对话框实例。
+
+注意:这是一个静态方法。
+
+dialog.getCurrent()
+
+获取当前(置顶)对话框实例。
+
+注意:这是一个静态方法。
+
+配置参数
+
+content
+
+设置消息内容。
+
+类型
+
+String, HTMLElement
+
+示例
+
+传入字符串:
+
+dialog({
+ content: 'hello world!'
+}).show();
+
+
+传入元素节点:
+
+//..
+dialog({
+ content: document.getElementById('test'),
+ id: 'EF893L'
+}).show();
+
+
+title
+
+标题内容。
+
+类型
+
+String
+
+示例
+
+dialog({
+ title: 'hello world!'
+}).show();
+
+
+statusbar
+
+状态栏区域 HTML 代码。
+
+可以实现类似“不再提示”的复选框。注意:必须有按钮才会显示。
+
+类型
+
+String
+
+示例
+
+var d = dialog({
+ title: '欢迎',
+ content: '欢迎使用 artDialog 对话框组件!',
+ ok: function () {},
+ statusbar: '<label><input type="checkbox">不再提醒</label>'
+});
+d.show();
+
+
+ok
+
+确定按钮。
+
+回调函数this指向dialog对象,执行完毕默认关闭对话框,若返回 false 则阻止关闭。
+
+类型
+
+Function
+
+示例
+
+dialog({
+ ok: function () {
+ this
+ .title('消息')
+ .content('hello world!')
+ .width(130);
+ return false;
+ }
+}).show();
+
+
+okValue
+
+(默认值: "ok") 确定按钮文本。
+
+类型
+
+String
+
+示例
+
+dialog({
+ okValue: '猛击我',
+ ok: function () {
+ this.content('hello world!');
+ return false;
+ }
+}).show();
+
+
+cancel
+
+取消按钮。
+
+取消按钮也等同于标题栏的关闭按钮,若值为false则不显示关闭按钮。回调函数this指向dialog对象,执行完毕默认关闭对话框,若返回false则阻止关闭。
+
+类型
+
+Function, Boolean
+
+示例
+
+dialog({
+ title: '消息',
+ ok: function () {},
+ cancel: function () {
+ alert('取消');
+ }
+}).show();
+
+
+dialog({
+ title: '消息',
+ content: '不显示关闭按钮',
+ ok: function () {},
+ cancel: false
+}).show();
+
+
+cancelValue
+
+(默认值: cancel) 取消按钮文本。
+
+类型
+
+String
+
+示例
+
+dialog({
+ cancelValue: '取消我',
+ cancel: function () {
+ alert('关闭');
+ }
+}).show();
+
+
+button
+
+自定义按钮组。
+
+类型
+
+Array
+
+选项
+
+
+
+
+| 名称 |
+ 类型 |
+ 描述 |
+
+
+
+
+| value |
+ String |
+ 按钮显示文本 |
+
+
+| callback |
+ Function |
+ (可选) 回调函数this指向dialog对象,执行完毕默认关闭与销毁对话框(依次执行close()与remove()),若返回false则阻止关闭与销毁 |
+
+
+| autofocus |
+ Boolean |
+ (默认值:false) 是否自动聚焦 |
+
+
+| width |
+ String |
+ (可选) 设置按钮 CSS width 值 |
+
+
+| disabled |
+ Boolean |
+ (默认值: false) 是否禁用 |
+
+
+| id |
+ String, Number |
+ (可选) 按钮唯一标识 |
+
+
+
+
+
+示例
+
+dialog({
+ button: [
+ {
+ value: '同意',
+ callback: function () {
+ this
+ .content('你同意了');
+ return false;
+ },
+ autofocus: true
+ },
+ {
+ value: '不同意',
+ callback: function () {
+ alert('你不同意')
+ }
+ },
+ {
+ id: 'button-disabled',
+ value: '无效按钮',
+ disabled: true
+ },
+ {
+ value: '关闭我'
+ }
+ ]
+}).show();
+
+
+width
+
+设置对话框 内容 宽度。
+
+类型
+
+String, Number
+
+示例
+
+dialog({
+ width: 460
+}).show();
+
+
+dialog({
+ width: '20em'
+}).show();
+
+
+height
+
+(默认值: "auto") 设置对话框 内容 高度。
+
+类型
+
+String, Number
+
+示例
+
+dialog({
+ height: 460
+}).show();
+
+
+dialog({
+ height: '20em'
+}).show();
+
+
+skin
+
+设置对话框额外的className参数。
+
+多个className请使用空格隔开。
+
+类型
+
+String
+
+示例
+
+//..
+dialog({
+ skin: 'min-dialog tips'
+}).show();
+
+
+padding
+
+(默认值: 继承 css 文件设置) 设置消息内容与消息容器的填充边距,即 style padding属性
+
+类型
+
+String
+
+示例
+
+dialog({
+ content: 'hello world',
+ padding: 0
+}).show();
+
+
+align
+
+(默认值: "nw") 设置对话框与其他元素的对齐方式。
+
+只针对show(elem)与showModal(elem)有效。可选的值:n nw ne s sw se w wn ws e en es。
+
+类型
+
+String
+
+示例
+
+var d = dialog({
+ align: 'w',
+ content: 'Hello World!',
+ quickClose: true
+});
+d.show(document.getElementById('option-align'));
+
+
+在线示例
+
+fixed
+
+(默认值: false) 开启固定定位。
+
+固定定位是 css2.1 position的一个属性,它能固定在浏览器某个地方,也不受滚动条拖动影响。IE6 与部分移动浏览器对其支持不好,内部会转成绝对定位。
+
+类型
+
+Boolean
+
+示例
+
+dialog({
+ fixed: true,
+ content: '请拖动滚动条查看'
+}).show();
+
+
+autofocus
+
+(默认值: true) 是否支持自动聚焦。
+
+类型
+
+Boolean
+
+quickClose
+
+(默认值: false) 是否点击空白出快速关闭。
+
+类型
+
+Boolean
+
+示例
+
+var d = dialog({
+ content: '点击空白处快速关闭',
+ quickClose: true
+});
+d.show(document.getElementById('option-quickClose'));
+
+
+zIndex
+
+(默认值: 1024) 重置全局zIndex初始值,用来改变对话框叠加高度。
+
+比如有时候配合外部浮动层 UI 组件,但是它们可能默认zIndex没有对话框高,导致无法浮动到对话框之上,这个时候你就可以给对话框指定一个较小的zIndex值。
+
+请注意这是一个会影响到全局的配置,后续出现的对话框叠加高度将重新按此累加。
+
+类型
+
+Number
+
+示例
+
+dialog({
+ zIndex: 87
+}).show();
+
+
+onshow
+
+对话框打开的事件。
+
+回调函数this指向dialog对象。
+
+类型
+
+Function
+
+示例
+
+var d = dialog({
+ content: 'loading..',
+ onshow: function () {
+ this.content('dialog ready');
+ }
+});
+d.show();
+
+
+onclose
+
+对话框关闭后执行的事件。
+
+回调函数this指向dialog对象。
+
+类型
+
+Function
+
+示例
+
+var d = dialog({
+ onclose: function () {
+ alert('对话框已经关闭');
+ },
+ ok: function () {}
+});
+d.show();
+
+
+onbeforeremove
+
+对话框销毁之前事件。
+
+回调函数this指向dialog对象。
+
+类型
+
+Function
+
+onremove
+
+对话框销毁事件。
+
+回调函数this指向dialog对象。
+
+类型
+
+Function
+
+示例
+
+var d = dialog({
+ onclose: function () {
+ alert('对话框已经关闭');
+ },
+ onremove: function () {
+ alert('对话框已经销毁');
+ },
+ ok: function () {}
+});
+d.show();
+
+
+onfocus
+
+对话框获取焦点事件。
+
+回调函数this指向dialog对象。
+
+类型
+
+Function
+
+onblur
+
+对话框失去焦点事件。
+
+回调函数this指向dialog对象。
+
+类型
+
+Function
+
+onreset
+
+对话框位置重置事件。
+
+回调函数this指向dialog对象。
+
+类型
+
+Function
+
+id
+
+设定对话框唯一标识。
+
+
+- 可防止重复 ID 对话框弹出。
+- 支持使用
dialog.get(id)获取某个对话框的接口。
+
+
+
+类型
+
+String
+
+示例
+
+dialog({
+ id: 'id-demo',
+ content: '再次点击运行看看'
+}).show();
+dialog.get('id-demo').title('8888888888');
+
+
+属性
+
+open
+
+判断对话框是否被打开。
+
+这是一个只读方法。
+
+returnValue
+
+对话框返回值。
+
+示例
+
+var d = dialog({
+ title: '消息',
+ content: '<input id="property-returnValue-demo" value="1" />',
+ ok: function () {
+ var value = $('#property-returnValue-demo').val();
+ this.close(value);
+ this.remove();
+ }
+});
+d.addEventListener('close', function () {
+ alert(this.returnValue);
+});
+d.show();
+
+
+
+
+2013-12-07 | 文档使用 Mou 生成
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/doc/index.md b/doc/index.md
new file mode 100755
index 0000000..b996866
--- /dev/null
+++ b/doc/index.md
@@ -0,0 +1,1038 @@
+# artDialog``v6``
+============================
+
+artDialog —— 经典的网页对话框组件,内外皆用心雕琢。
+
+1. 支持普通与气泡形式的对话框
+2. 信息无障碍支持:焦点管理;支持 ARIA 标准
+3. 面向未来:基于 HTML5 Dialog 的 API
+4. 支持标准与模态对话框
+5. 丰富的展示状态与友好的编程接口
+6. 自适应内容尺寸
+
+## 文档导航
+
+* [引入 artDialog](#module)
+* [快速参考](#quickref)
+ * [普通对话框](#quickref-basic)
+ * [模态对话框](#quickref-modal)
+ * [气泡浮层](#quickref-bubble)
+ * [添加按钮](#quickref-button)
+ * [控制对话框关闭](#quickref-close)
+ * [给对话框左下脚添加复选框](#quickref-statusbar)
+ * [阻止对话框关闭](#quickref-callback)
+ * [不显示关闭按钮](#quickref-cancel)
+ * [创建 iframe 内容](#quickref-iframe)
+* [方法](#api)
+ * [show([anchor])](#api-show)
+ * [showModal([anchor])](#api-showModal)
+ * [close([result])](#api-close)
+ * [remove()](#api-remove)
+ * [content(html)](#api-content)
+ * [title(text)](#api-title)
+ * [width([value])](#api-width)
+ * [height([value])](#api-height)
+ * [reset()](#api-reset)
+ * [button(args)](#api-button)
+ * [focus()](#api-focus)
+ * [blur()](#api-blur)
+ * [addEventListener(type, callback)](#api-addEventListener)
+ * [removeEventListener(type, callback)](#api-removeEventListener)
+ * [dialog.get(id)](#api-dialog-get)
+ * [dialog.getCurrent()](#api-dialog-getCurrent)
+* [选项](#option)
+ * 内容
+ * [title](#option-title)
+ * [content](#option-content)
+ * [statusbar](#option-statusbar)
+ * 按钮
+ * [ok](#option-ok)
+ * [okValue](#option-okValue)
+ * [cancel](#option-cancel)
+ * [cancelValue](#option-cancelValue)
+ * [button](#option-button)
+ * 外观
+ * [width](#option-width)
+ * [height](#option-height)
+ * [skin](#option-skin)
+ * [padding](#option-padding)
+ * [align](#option-align)
+ * 交互
+ * [fixed](#option-fixed)
+ * [quickClose](#option-quickClose)
+ * [autofocus](#option-autofocus)
+ * [zIndex](#option-zIndex)
+ * 事件
+ * [onshow](#option-onshow)
+ * [onbeforeremove](#option-onbeforeremove)
+ * [onremove](#option-onremove)
+ * [onclose](#option-onclose)
+ * [onfocus](#option-onfocus)
+ * [onblur](#option-onblur)
+ * [onreset](#option-onreset)
+ * 高级
+ * [id](#option-id)
+* [属性](#property)
+ * [open](#property-open)
+ * [returnValue](#property-returnValue)
+
+## [引入 artDialog](id:module)
+
+在模块中引入 artDialog(支持 RequireJS 与 SeaJS):
+
+```
+var dialog = require('./artDialog/src/dialog');
+//..
+```
+[seajs加载示例](../test/show.html)
+
+### 全局依赖模块
+
+jquery
+
+## [快速参考](id:quickref)
+
+### [普通对话框](id:quickref-basic)
+
+```
+var d = dialog({
+ title: '欢迎',
+ content: '欢迎使用 artDialog 对话框组件!'
+});
+d.show();
+```
+
+### [模态对话框](id:quickref-modal)
+
+```
+var d = dialog({
+ title: 'message',
+ content: ''
+});
+d.showModal();
+```
+
+### [气泡浮层](id:quickref-bubble)
+
+```
+var d = dialog({
+ content: 'Hello World!',
+ quickClose: true// 点击空白处快速关闭
+});
+d.show(document.getElementById('quickref-bubble'));
+```
+
+### [添加按钮](id:quickref-button)
+
+1.确定与取消按钮:
+
+```
+var d = dialog({
+ title: '提示',
+ content: '按钮回调函数返回 false 则不许关闭',
+ okValue: '确定',
+ ok: function () {
+ this.title('提交中…');
+ return false;
+ },
+ cancelValue: '取消',
+ cancel: function () {}
+});
+d.show();
+```
+
+2.指定更多按钮:
+
+请参考 [``button``](#option-button) 方法或参数。
+
+### [控制对话框关闭](id:quickref-close)
+
+```
+var d = dialog({
+ content: '对话框将在两秒内关闭'
+});
+d.show();
+setTimeout(function () {
+ d.close().remove();
+}, 2000);
+```
+
+### [给对话框左下脚添加复选框](id:quickref-statusbar)
+
+```
+var d = dialog({
+ title: '欢迎',
+ content: '欢迎使用 artDialog 对话框组件!',
+ ok: function () {},
+ statusbar: ''
+});
+d.show();
+```
+
+### [阻止对话框关闭](id:quickref-callback)
+
+按钮事件返回 false 则不会触发关闭。
+
+```
+var d = dialog({
+ title: '欢迎',
+ content: '欢迎使用 artDialog 对话框组件!',
+ skin: 'ui-dialog-s',
+ padding: '25px 15px',
+ ok: function () {
+ var that = this;
+ this.title('正在提交..');
+ setTimeout(function () {
+ that.close().remove();
+ }, 2000);
+ return false;
+ },
+ cancel: function () {
+ alert('不许关闭');
+ return false;
+ }
+});
+d.show();
+```
+
+### [不显示关闭按钮](id:quickref-cancel)
+
+```
+var d = dialog({
+ title: '欢迎',
+ content: '欢迎使用 artDialog 对话框组件!',
+ cancel: false,
+ ok: function () {}
+});
+d.show();
+```
+
+### [创建 iframe 内容](id:quickref-iframe)
+
+为了便于 iframe 内容能够控制对话框,建议在顶层页面创建一个可供 iframe 访问的对话框创建方法,例如:
+
+```
+//..
+window.openDialog = function (options) {
+ // 页面地址
+ var url = options.url;
+ // 是否为模态,默认 true
+ var modal = options.modal;
+ // 是否使用气泡样式跟随到元素
+ var follow = options.follow;
+ // 页面加载完毕的事件
+ var oniframeload = options.oniframeload;
+ (window.require ? require : seajs.use)([
+ '../dialog',
+ '../dialog-iframe'
+ ], function (dialog, openIframe) {
+ var api = url ? openIframe(options) : dialog(options);
+ api[modal === false ? 'show' : 'showModal'](follow);
+ window.__dialog__ = dialog;
+ });
+};
+```
+
+> 小提示:比普通对话框的[选项](#option)多了``url``、``modal``、``follow``、``oniframeload``这几个字段。
+
+然后在顶层页面创建一个获取对话框 api 的方法,例如:
+
+```
+//..
+window.getDialog = function (win) {
+ var dialog = window.__dialog__;
+ if (!dialog) {
+ return;
+ }
+ // 从 iframe 传入 window 对象
+ if (win && win.frameElement) {
+ var iframe = win.frameElement;
+ var list = dialog.get();
+ var api;
+ for (var i in list) {
+ api = list[i];
+ if (api.node.getElementsByTagName('iframe')[0] === iframe) {
+ return api;
+ }
+ }
+ // 直接传入 id 的情况
+ } else if (win) {
+ return dialog.get(win);
+ }
+};
+```
+
+创建 iframe 对话框方式:
+
+```
+top.openDialog({
+ title: 'loading..',
+ url: '../test/iframe-content.html',
+ onshow: function () {
+ console.log('onshow');
+ },
+ oniframeload: function () {
+ console.log('oniframeload');
+ },
+ onclose: function () {
+ console.log('onclose');
+ },
+ onremove: function () {
+ console.log('onremove');
+ }
+});
+```
+
+对话框 iframe 内可以如下获取当前对话框接口:
+
+```
+//..
+var dialog = top.getDialog(window);
+// 设置高度
+dialog.height(400);
+// 关闭对话框
+dialog.close().remove();
+```
+
+## 方法
+
+若无特别说明,方法均支持链式调用。
+
+### [show([anchor])](id:api-show)
+
+显示对话框。
+
+默认居中显示,支持传入元素节点或者事件对象。
+
+* 参数类型为``HTMLElement``:可吸附到元素上,同时对话框将呈现气泡样式。
+* 参数类型为``Event Object``:根据``event.pageX``与``event.pageY``定位。
+
+#### 示例
+
+```
+var d = dialog();
+d.content('hello world');
+d.show(document.getElementById('api-show'));
+```
+
+```
+var d = dialog({
+ id: 'api-show-dialog',
+ content: '右键菜单'
+});
+$(document).on('contextmenu', function (event) {
+ d.show(event);
+ return d.destroyed;
+});
+```
+
+### [showModal([anchor])](id:api-showModal)
+
+显示一个模态对话框。
+
+其余特性与参数可参见``show([anchor])``方法。
+
+#### 示例
+
+```
+var d = dialog({
+ title: 'message',
+ content: ''
+});
+d.showModal();
+```
+
+### [close([result])](id:api-close)
+
+关闭(隐藏)对话框。
+
+可接收一个返回值,可以参见 [returnValue](#property-returnValue)。
+
+**注意**:``close()``方法只隐藏对话框,不会在 DOM 中删除,删除请使用``remove()``方法。
+
+### [remove()](id:api-remove)
+
+销毁对话框。
+
+**注意**:不同于``close([result])``方法,``remove()``方法会从 DOM 中移出对话框相关节点,销毁后的对话框无法再次使用。
+
+对话框按钮点击后默认会依次触发 ``close()``、``remove()`` 方法。如果想手动控制对话框关闭可以如下操作:
+
+```
+var d = dialog();
+// [..]
+d.close().remove();
+```
+
+### [content(html)](id:api-content)
+
+写入对话框内容。
+
+``html``参数支持``String``、``HTMLElement``类型。
+
+
+#### 示例
+
+```
+var d = dialog();
+d.content('hello world');
+d.show();
+```
+
+### [title(text)](id:api-title)
+
+写入对话框标题。
+
+#### 示例
+
+```
+var d = dialog();
+d.title('hello world');
+d.show();
+```
+
+### [width([value])](id:api-width)
+
+设置对话框宽度。
+
+### 示例
+
+```
+dialog({
+ content: 'hello world'
+})
+.width(320)
+.show();
+```
+
+### [height([value])](id:api-height)
+
+设置对话框高度。
+
+### 示例
+
+```
+dialog({
+ content: 'hello world'
+})
+.height(320)
+.show();
+```
+
+### [reset()](id:api-reset)
+
+手动刷新对话框位置。
+
+通常动态改变了内容尺寸后需要刷新对话框位置。
+
+### [button(args)](id:api-button)
+
+自定义按钮。
+
+参数请参考 [选项``button``](#option-button);同时支持传入 HTML 字符串填充按钮区域。
+
+### [focus()](id:api-focus)
+
+聚焦对话框(置顶)。
+
+### [blur()](id:api-blur)
+
+让对话框失去焦点。
+
+### [addEventListener(type, callback)](id:api-addEventListener)
+
+添加事件。
+
+支持的事件有:``show``、``close``、``beforeremove``、``remove``、``reset``、``focus``、``blur``
+
+### [removeEventListener(type, callback)](id:api-removeEventListener)
+
+删除事件。
+
+### [dialog.get(id)](id:api-dialog-get)
+
+根据获取打开的对话框实例。
+
+**注意**:这是一个静态方法。
+
+### [dialog.getCurrent()](id:api-dialog-getCurrent)
+
+获取当前(置顶)对话框实例。
+
+**注意**:这是一个静态方法。
+
+## 配置参数
+
+### [content](id:option-content)
+
+设置消息内容。
+
+#### 类型
+
+String, HTMLElement
+
+#### 示例
+
+传入字符串:
+
+```
+dialog({
+ content: 'hello world!'
+}).show();
+```
+传入元素节点:
+
+```
+//..
+dialog({
+ content: document.getElementById('test'),
+ id: 'EF893L'
+}).show();
+```
+
+### [title](id:option-title)
+
+标题内容。
+
+#### 类型
+
+String
+
+#### 示例
+
+```
+dialog({
+ title: 'hello world!'
+}).show();
+```
+
+### [statusbar](id:option-statusbar)
+
+状态栏区域 HTML 代码。
+
+可以实现类似“不再提示”的复选框。**注意**:必须有按钮才会显示。
+
+#### 类型
+
+String
+
+#### 示例
+
+```
+var d = dialog({
+ title: '欢迎',
+ content: '欢迎使用 artDialog 对话框组件!',
+ ok: function () {},
+ statusbar: ''
+});
+d.show();
+```
+
+### [ok](id:option-ok)
+
+确定按钮。
+
+回调函数``this``指向``dialog``对象,执行完毕默认关闭对话框,若返回 false 则阻止关闭。
+
+#### 类型
+
+Function
+
+#### 示例
+
+```
+dialog({
+ ok: function () {
+ this
+ .title('消息')
+ .content('hello world!')
+ .width(130);
+ return false;
+ }
+}).show();
+```
+
+### [okValue](id:option-okValue)
+
+(默认值: "ok") 确定按钮文本。
+
+#### 类型
+
+String
+
+#### 示例
+
+```
+dialog({
+ okValue: '猛击我',
+ ok: function () {
+ this.content('hello world!');
+ return false;
+ }
+}).show();
+```
+
+### [cancel](id:option-cancel)
+
+取消按钮。
+
+取消按钮也等同于标题栏的关闭按钮,若值为``false``则不显示关闭按钮。回调函数``this``指向``dialog``对象,执行完毕默认关闭对话框,若返回``false``则阻止关闭。
+
+#### 类型
+
+Function, Boolean
+
+#### 示例
+
+```
+dialog({
+ title: '消息',
+ ok: function () {},
+ cancel: function () {
+ alert('取消');
+ }
+}).show();
+```
+
+```
+dialog({
+ title: '消息',
+ content: '不显示关闭按钮',
+ ok: function () {},
+ cancel: false
+}).show();
+```
+
+### [cancelValue](id:option-cancelValue)
+
+(默认值: cancel) 取消按钮文本。
+
+#### 类型
+
+String
+
+#### 示例
+
+```
+dialog({
+ cancelValue: '取消我',
+ cancel: function () {
+ alert('关闭');
+ }
+}).show();
+```
+
+### [button](id:option-button)
+
+自定义按钮组。
+
+#### 类型
+
+Array
+
+#### 选项
+
+名称 | 类型 | 描述
+------------ | ------------- | ------------
+value | String | 按钮显示文本
+callback | Function | (可选) 回调函数``this``指向``dialog``对象,执行完毕默认关闭与销毁对话框(依次执行``close()``与``remove()``),若返回``false``则阻止关闭与销毁
+autofocus | Boolean | (默认值:``false``) 是否自动聚焦
+width | String | (可选) 设置按钮 CSS width 值
+disabled | Boolean | (默认值: ``false``) 是否禁用
+id | String, Number | (可选) 按钮唯一标识
+
+#### 示例
+
+```
+dialog({
+ button: [
+ {
+ value: '同意',
+ callback: function () {
+ this
+ .content('你同意了');
+ return false;
+ },
+ autofocus: true
+ },
+ {
+ value: '不同意',
+ callback: function () {
+ alert('你不同意')
+ }
+ },
+ {
+ id: 'button-disabled',
+ value: '无效按钮',
+ disabled: true
+ },
+ {
+ value: '关闭我'
+ }
+ ]
+}).show();
+```
+
+### [width](id:option-width)
+
+设置对话框 **内容** 宽度。
+
+#### 类型
+
+String, Number
+
+#### 示例
+
+```
+dialog({
+ width: 460
+}).show();
+```
+
+```
+dialog({
+ width: '20em'
+}).show();
+```
+
+### [height](id:option-height)
+
+(默认值: "auto") 设置对话框 **内容** 高度。
+
+#### 类型
+
+String, Number
+
+#### 示例
+
+```
+dialog({
+ height: 460
+}).show();
+```
+
+```
+dialog({
+ height: '20em'
+}).show();
+```
+
+### [skin](id:option-skin)
+
+设置对话框额外的``className``参数。
+
+多个``className``请使用空格隔开。
+
+#### 类型
+
+String
+
+#### 示例
+
+```
+//..
+dialog({
+ skin: 'min-dialog tips'
+}).show();
+```
+
+### [padding](id:option-padding)
+
+(默认值: **继承 css 文件设置**) 设置消息内容与消息容器的填充边距,即 style ``padding``属性
+
+#### 类型
+
+String
+
+#### 示例
+
+```
+dialog({
+ content: 'hello world',
+ padding: 0
+}).show();
+```
+
+### [align](id:option-align)
+
+(默认值: "nw") 设置对话框与其他元素的对齐方式。
+
+只针对``show(elem)``与``showModal(elem)``有效。可选的值:``n nw ne s sw se w wn ws e en es``。
+
+### 类型
+
+String
+
+### 示例
+
+```
+var d = dialog({
+ align: 'w',
+ content: 'Hello World!',
+ quickClose: true
+});
+d.show(document.getElementById('option-align'));
+```
+
+[在线示例](../test/align.html)
+
+### [fixed](id:option-fixed)
+
+(默认值: false) 开启固定定位。
+
+固定定位是 css2.1 ``position``的一个属性,它能固定在浏览器某个地方,也不受滚动条拖动影响。IE6 与部分移动浏览器对其支持不好,内部会转成绝对定位。
+
+#### 类型
+
+Boolean
+
+#### 示例
+
+```
+dialog({
+ fixed: true,
+ content: '请拖动滚动条查看'
+}).show();
+```
+
+### [autofocus](id:option-autofocus)
+
+(默认值: true) 是否支持自动聚焦。
+
+#### 类型
+
+Boolean
+
+### [quickClose](id:option-quickClose)
+
+(默认值: false) 是否点击空白出快速关闭。
+
+#### 类型
+
+Boolean
+
+### 示例
+
+```
+var d = dialog({
+ content: '点击空白处快速关闭',
+ quickClose: true
+});
+d.show(document.getElementById('option-quickClose'));
+```
+
+### [zIndex](id:option-zIndex)
+
+(默认值: 1024) 重置全局``zIndex``初始值,用来改变对话框叠加高度。
+
+比如有时候配合外部浮动层 UI 组件,但是它们可能默认``zIndex``没有对话框高,导致无法浮动到对话框之上,这个时候你就可以给对话框指定一个较小的``zIndex``值。
+
+请注意这是一个会影响到全局的配置,后续出现的对话框叠加高度将重新按此累加。
+
+#### 类型
+
+Number
+
+#### 示例
+
+```
+dialog({
+ zIndex: 87
+}).show();
+```
+
+### [onshow](id:option-onshow)
+
+对话框打开的事件。
+
+回调函数``this``指向``dialog``对象。
+
+#### 类型
+
+Function
+
+#### 示例
+
+```
+var d = dialog({
+ content: 'loading..',
+ onshow: function () {
+ this.content('dialog ready');
+ }
+});
+d.show();
+```
+
+### [onclose](id:option-onclose)
+
+对话框关闭后执行的事件。
+
+回调函数``this``指向``dialog``对象。
+
+#### 类型
+
+Function
+
+#### 示例
+
+```
+var d = dialog({
+ onclose: function () {
+ alert('对话框已经关闭');
+ },
+ ok: function () {}
+});
+d.show();
+```
+
+### [onbeforeremove](id:option-onbeforeremove)
+
+对话框销毁之前事件。
+
+回调函数``this``指向``dialog``对象。
+
+#### 类型
+
+Function
+
+### [onremove](id:option-onremove)
+
+对话框销毁事件。
+
+回调函数``this``指向``dialog``对象。
+
+#### 类型
+
+Function
+
+#### 示例
+
+```
+var d = dialog({
+ onclose: function () {
+ alert('对话框已经关闭');
+ },
+ onremove: function () {
+ alert('对话框已经销毁');
+ },
+ ok: function () {}
+});
+d.show();
+```
+
+### [onfocus](id:option-onfocus)
+
+对话框获取焦点事件。
+
+回调函数``this``指向``dialog``对象。
+
+#### 类型
+
+Function
+
+### [onblur](id:option-onblur)
+
+对话框失去焦点事件。
+
+回调函数``this``指向``dialog``对象。
+
+#### 类型
+
+Function
+
+### [onreset](id:option-onreset)
+
+对话框位置重置事件。
+
+回调函数``this``指向``dialog``对象。
+
+#### 类型
+
+Function
+
+### [id](id:option-id)
+
+设定对话框唯一标识。
+
+1. 可防止重复 ID 对话框弹出。
+2. 支持使用``dialog.get(id)``获取某个对话框的接口。
+
+#### 类型
+
+String
+
+#### 示例
+
+```
+dialog({
+ id: 'id-demo',
+ content: '再次点击运行看看'
+}).show();
+dialog.get('id-demo').title('8888888888');
+```
+
+## [属性](id:property)
+
+### [open](id:property-open)
+
+判断对话框是否被打开。
+
+这是一个只读方法。
+
+### [returnValue](id:property-returnValue)
+
+对话框返回值。
+
+#### 示例
+
+```
+var d = dialog({
+ title: '消息',
+ content: '',
+ ok: function () {
+ var value = $('#property-returnValue-demo').val();
+ this.close(value);
+ this.remove();
+ }
+});
+d.addEventListener('close', function () {
+ alert(this.returnValue);
+});
+d.show();
+```
+
+=======================
+2013-12-07 | 文档使用 [Mou](http://mouapp.com) 生成
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/doc/js/doc.js b/doc/js/doc.js
new file mode 100644
index 0000000..69b8125
--- /dev/null
+++ b/doc/js/doc.js
@@ -0,0 +1,134 @@
+define(function (require) {
+
+var $ = require('jquery');
+var dialog = require('../../src/dialog');
+var sh_languages = require('./sh_languages');
+var css = '../css/doc.css';
+
+
+// css loader: RequireJS & SeaJS
+css = require[require.toUrl ? 'toUrl' : 'resolve'](css);
+css = '';
+$('base')[0] ? $('base').before(css) : $('head').append(css);
+
+window.dialog = dialog;
+window.$ = window.jQuery = $;
+window.console = window.console || {
+ log: $.noop
+};
+
+window.openDialog = function (options) {
+ // 页面地址
+ var url = options.url;
+ // 是否为模态,默认 true
+ var modal = options.modal;
+ // 是否使用气泡样式跟随到元素
+ var follow = options.follow;
+ // 页面加载完毕的事件
+ var oniframeload = options.oniframeload;
+
+ (window.seajs ? seajs.use : window.require)([
+ '../src/dialog',
+ '../src/dialog-iframe'
+ ], function (dialog, openIframe) {
+ var api = url ? openIframe(options) : dialog(options);
+ api[modal === false ? 'show' : 'showModal'](follow);
+ window.__dialog__ = dialog;
+ });
+};
+
+window.getDialog = function (win) {
+ var dialog = window.__dialog__;
+ if (!dialog) {
+ return;
+ }
+ // 从 iframe 传入 window 对象
+ if (win && win.frameElement) {
+ var iframe = win.frameElement;
+ var list = dialog.get();
+ var api;
+ for (var i in list) {
+ api = list[i];
+ if (api.node.getElementsByTagName('iframe')[0] === iframe) {
+ return api;
+ }
+ }
+ // 直接传入 id 的情况
+ } else if (win) {
+ return dialog.get(win);
+ }
+};
+
+
+var codes = {};
+var debug = location.href.indexOf('Users/tangbin') !== -1;
+
+$(function () {
+
+ console.log('你可以在调试器中粘贴本页示例代码运行');
+
+ var RE = /[\n\s\t]*?\/\/\.\.[\r\n]/;
+ $('pre code').each(function (index) {
+ var $this = $(this);
+ var code = $this.text();
+
+
+ $this.addClass('sh_javascript')
+
+ // 忽略不完整的代码片段
+ // 开头使用"//.."表示
+ if (RE.test(code)) {
+ $this.text(code.replace(RE, ''));
+ return;
+ }
+
+ try {
+ codes[index] = new Function(code);
+ } catch (e) {
+ return;
+ }
+
+ $this
+ //.addClass('sh_javascript')
+ .after(''
+ +'');
+ });
+
+ // 代码高亮
+ setTimeout(sh_languages, 150);
+
+ // 回到顶部
+ var $top = $('TOP')
+ .on('click', function () {
+ $(window).scrollTop(0);
+ return false;
+ });
+ $('body').append($top);
+
+ // 加载拖拽插件
+ $('h1 code').one('click', function () {
+ if (require.async) {
+ require.async('../../dialog-drag');
+ }
+ });
+});
+
+
+var runCode = function (id) {
+ codes[id]();
+
+ var api = dialog.getCurrent();
+ if (debug && api) {
+ console.log(api);
+ }
+};
+
+
+$(document).on('click', 'button[data-code]', function () {
+ var id = $(this).data('code');
+ runCode(id);
+ return false;
+});
+
+
+});
\ No newline at end of file
diff --git a/doc/js/sh_languages.js b/doc/js/sh_languages.js
new file mode 100644
index 0000000..80365b1
--- /dev/null
+++ b/doc/js/sh_languages.js
@@ -0,0 +1,9 @@
+/*
+SHJS - Syntax Highlighting in JavaScript
+Copyright (C) 2007, 2008 gnombat@users.sourceforge.net
+License: http://shjs.sourceforge.net/doc/gplv3.html
+*/
+define(function () {
+ var sh_languages = {};function sh_isEmailAddress(a){return/^mailto:/.test(a)?!1:a.indexOf("@")!==-1}function sh_setHref(a,b,c){var d=c.substring(a[b-2].pos,a[b-1].pos);d.length>=2&&d.charAt(0)==="<"&&d.charAt(d.length-1)===">"&&(d=d.substr(1,d.length-2)),sh_isEmailAddress(d)&&(d="mailto:"+d),a[b-2].node.href=d}function sh_konquerorExec(a){var b=[""];return b.index=a.length,b.input=a,b}function sh_highlightString(a,b){if(/Konqueror/.test(navigator.userAgent)&&!b.konquered){for(var c=0;c<=A[D].index))E=A[D];else{var F=y[D][0];F.lastIndex=v,E=F.exec(t),A[D]=E}if(E!==null&&(B===null||E.indexv&&m(t.substring(v,B.index),null);var G=y[C],H=G[1],I;if(H instanceof Array)for(var J=0;J0){var d=c.split(" ");for(var e=0;e0&&b.push(d[e])}return b}function sh_addClass(a,b){var c=sh_getClasses(a);for(var d=0;d<=g){if(j.node){var l=j.node;i.appendChild(l),i=l}else i=i.parentNode;e++}else i.appendChild(c.createTextNode(b.substring(g,k))),g=k}return d}function sh_highlightElement(a,b){sh_addClass(a,"sh_sourceCode");var c=[],d=sh_extractTags(a,c),e=sh_highlightString(d,b),f=sh_mergeTags(c,e),g=sh_insertTags(f,d);while(a.hasChildNodes())a.removeChild(a.firstChild);a.appendChild(g)}function sh_getXMLHttpRequest(){if(window.ActiveXObject)return new ActiveXObject("Msxml2.XMLHTTP");if(window.XMLHttpRequest)return new XMLHttpRequest;throw"No XMLHttpRequest implementation available"}function sh_load(language,element,prefix,suffix){if(language in sh_requests){sh_requests[language].push(element);return}sh_requests[language]=[element];var request=sh_getXMLHttpRequest(),url=prefix+"sh_"+language+suffix;request.open("GET",url,!0),request.onreadystatechange=function(){if(request.readyState===4)try{if(!!request.status&&request.status!==200)throw"HTTP error: status "+request.status;eval(request.responseText);var elements=sh_requests[language];for(var i=0;i element with class="'+h+'", but no such language exists';break}}}}var sh_requests={};sh_languages.javascript=[[[/\/\/\//g,"sh_comment",1],[/\/\//g,"sh_comment",7],[/\/\*\*/g,"sh_comment",8],[/\/\*/g,"sh_comment",9],[/\b(?:abstract|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|false|final|finally|for|function|goto|if|implements|in|instanceof|interface|native|new|null|private|protected|prototype|public|return|static|super|switch|synchronized|throw|throws|this|transient|true|try|typeof|var|volatile|while|with)\b/g,"sh_keyword",-1],[/(\+\+|--|\)|\])(\s*)(\/=?(?![*\/]))/g,["sh_symbol","sh_normal","sh_symbol"],-1],[/(0x[A-Fa-f0-9]+|(?:[\d]*\.)?[\d]+(?:[eE][+-]?[\d]+)?)(\s*)(\/(?![*\/]))/g,["sh_number","sh_normal","sh_symbol"],-1],[/([A-Za-z$_][A-Za-z0-9$_]*\s*)(\/=?(?![*\/]))/g,["sh_normal","sh_symbol"],-1],[/\/(?:\\.|[^*\\\/])(?:\\.|[^\\\/])*\/[gim]*/g,"sh_regexp",-1],[/\b[+-]?(?:(?:0x[A-Fa-f0-9]+)|(?:(?:[\d]*\.)?[\d]+(?:[eE][+-]?[\d]+)?))u?(?:(?:int(?:8|16|32|64))|L)?\b/g,"sh_number",-1],[/"/g,"sh_string",10],[/'/g,"sh_string",11],[/~|!|%|\^|\*|\(|\)|-|\+|=|\[|\]|\\|:|;|,|\.|\/|\?|&|<|>|\|/g,"sh_symbol",-1],[/\{|\}/g,"sh_cbracket",-1],[/\b(?:Math|Infinity|NaN|undefined|arguments)\b/g,"sh_predef_var",-1],[/\b(?:Array|Boolean|Date|Error|EvalError|Function|Number|Object|RangeError|ReferenceError|RegExp|String|SyntaxError|TypeError|URIError|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|isNaN|parseFloat|parseInt)\b/g,"sh_predef_func",-1],[/\b(?:applicationCache|closed|Components|content|controllers|crypto|defaultStatus|dialogArguments|directories|document|frameElement|frames|fullScreen|globalStorage|history|innerHeight|innerWidth|length|location|locationbar|menubar|name|navigator|opener|outerHeight|outerWidth|pageXOffset|pageYOffset|parent|personalbar|pkcs11|returnValue|screen|availTop|availLeft|availHeight|availWidth|colorDepth|height|left|pixelDepth|top|width|screenX|screenY|scrollbars|scrollMaxX|scrollMaxY|scrollX|scrollY|self|sessionStorage|sidebar|status|statusbar|toolbar|top|window)\b/g,"sh_predef_var",-1],[/\b(?:alert|addEventListener|atob|back|blur|btoa|captureEvents|clearInterval|clearTimeout|close|confirm|dump|escape|find|focus|forward|getAttention|getComputedStyle|getSelection|home|moveBy|moveTo|open|openDialog|postMessage|print|prompt|releaseEvents|removeEventListener|resizeBy|resizeTo|scroll|scrollBy|scrollByLines|scrollByPages|scrollTo|setInterval|setTimeout|showModalDialog|sizeToContent|stop|unescape|updateCommands|onabort|onbeforeunload|onblur|onchange|onclick|onclose|oncontextmenu|ondragdrop|onerror|onfocus|onkeydown|onkeypress|onkeyup|onload|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|onpaint|onreset|onresize|onscroll|onselect|onsubmit|onunload)\b/g,"sh_predef_func",-1],[/(?:[A-Za-z]|_)[A-Za-z0-9_]*(?=[ \t]*\()/g,"sh_function",-1]],[[/$/g,null,-2],[/(?:)[A-Za-z0-9_\.\/\-_~]+@[A-Za-z0-9_\.\/\-_~]+(?:>?)|(?:)[A-Za-z0-9_]+:\/\/[A-Za-z0-9_\.\/\-_~]+(?:>?)/g,"sh_url",-1],[/<\?xml/g,"sh_preproc",2,1],[//g,"sh_keyword",-1],[/<(?:\/)?[A-Za-z](?:[A-Za-z0-9_:.-]*)/g,"sh_keyword",6,1],[/&(?:[A-Za-z0-9]+);/g,"sh_preproc",-1],[/<(?:\/)?[A-Za-z][A-Za-z0-9]*(?:\/)?>/g,"sh_keyword",-1],[/<(?:\/)?[A-Za-z][A-Za-z0-9]*/g,"sh_keyword",6,1],[/@[A-Za-z]+/g,"sh_type",-1],[/(?:TODO|FIXME|BUG)(?:[:]?)/g,"sh_todo",-1]],[[/\?>/g,"sh_preproc",-2],[/([^=" \t>]+)([ \t]*)(=?)/g,["sh_type","sh_normal","sh_symbol"],-1],[/"/g,"sh_string",3]],[[/\\(?:\\|")/g,null,-1],[/"/g,"sh_string",-2]],[[/>/g,"sh_preproc",-2],[/([^=" \t>]+)([ \t]*)(=?)/g,["sh_type","sh_normal","sh_symbol"],-1],[/"/g,"sh_string",3]],[[/-->/g,"sh_comment",-2],[/
-
-
-
-
-
-
-
-
文档索引
-
- -
-
-
- -
-
-
- -
-
内容
-
-
- -
-
按钮
-
-
- -
-
尺寸
-
-
- -
-
位置
-
-
- -
-
视觉
-
-
- -
-
高级
-
-
-
-
- -
-
-
-
- -
-
-
-
-
-
-
快速上手
-
artDialog api 风格统一,有一定前端开发经验的同学通过阅读文档5分钟即可上手。
-
-
-
引入文件
-
在页面 head 引入 artDialog 样式与脚本文件:
-
<link href="./skins/default.css" rel="stylesheet" />
-<script src="./artDialog.min.js"></script>
-
调用方式
-
- -
-
art.dialog(content, [ok], [cancel])
- art.dialog('artDialog: I Love You!', function () {alert('Thank you!')});
-
- 运行
- -
-
art.dialog(options)
- art.dialog({
- title: '欢迎',
- content: '欢迎使用artDialog对话框组件!',
- ok: function () {
- this
- .title('警告')
- .content('请注意artDialog两秒后将关闭!')
- .lock()
- .time(2000);
- return false;
- }
-});
-
- 运行
-
-
artDialog 有两种调用方式,第一种是最简单的直接传入参数方式;第二种拥有更多的可选项,参见 配置参数。
-
[使用jQuery?]
-
扩展接口
-
除了上述两种调用方式之外,artDialog 还提供一些接口方便异步操作,比如实现外部程序更新对话框内容、关闭窗口等。这是属于高级操作,详情参见 接口。
-
若无特别说明,扩展方法均支持链式调用。
-
-
-
配置参数
-
- -
-
title
-
- - 概述
- - (默认值: "message") 标题内容
- - 类型
- - String
- - 示例
- -
-
art.dialog({
- title: 'hello world!'
-});
- 运行
-
-
- -
-
content
-
- - 概述
- - (默认值: "<div class="d-loading"><span>loading..</span></div>") 设置消息内容。
-
- 如果传入的是 HTMLElement 类型,如果是隐藏元素会给其设置display:block以显示该元素,其他属性与绑定的事件都会完整保留,对话框关闭后此元素又将恢复原来的display属性,并且重新插入原文档所在位置
- - 类型
- - String, HTMLElement
- - 示例
- -
-
art.dialog({
- content: 'hello world!'
-});
- 运行
- -
-
art.dialog({
- content: document.getElementById('options-content-demo-element'),
- id: 'EF893L'
-});
- 运行
-
-
- -
-
ok
-
- - 概述
- - 确定按钮。
-
- 回调函数 this 指向 art.dialog 对象,执行完毕默认关闭对话框,若返回 false 则阻止关闭
- - 类型
- - Function
- - 示例
- -
-
art.dialog({
- ok: function () {
- this.content('hello world!');
- return false;
- }
-});
- 运行
-
-
- -
-
cancel
-
- - 概述
- - 取消按钮。
-
- 取消按钮也等同于标题栏的关闭按钮。回调函数 this 指向 art.dialog 对象,执行完毕默认关闭对话框,若返回 false 则阻止关闭
- - 类型
- - Function
- - 示例
- -
-
art.dialog({
- cancel: function () {
- alert('关闭');
- }
-});
- 运行
-
-
- -
-
okValue
-
- - 概述
- - (默认值: "ok") 确定按钮文本
- - 类型
- - String
- - 示例
- -
-
art.dialog({
- okValue: '猛击我',
- ok: function () {
- this.content('hello world!');
- return false;
- }
-});
- 运行
-
-
- -
-
cancelValue
-
- - 概述
- - (默认值: cancel) 取消按钮文本
- - 类型
- - String
- - 示例
- -
-
art.dialog({
- cancelValue: '取消我',
- cancel: function () {
- alert('关闭');
- }
-});
- 运行
-
-
- -
-
-
- - 概述
- -
-
自定义按钮组。
-
- 回调函数 this 指向 art.dialog 对象,执行完毕默认关闭对话框,若返回 false 则阻止关闭
-
- - 类型
- - Array
- - 选项
- -
-
- - value
- - 按钮显示文本
- - callback
- - (可选) 按钮点击后的回调函数。回调函数 this 指向 art.dialog 对象,执行完毕默认关闭对话框,若返回 false 则阻止关闭
- - focus
- - (默认值: true) 是否聚焦
- - width
- - (可选) 设置按钮 CSS width 值
- - disabled
- - (默认值: false) 是否禁用
- - id
- - (默认值: 与 value 一致) 唯一标识
-
-
- - 示例
- -
-
art.dialog({
- button: [
- {
- value: '同意',
- callback: function () {
- this
- .content('你同意了')
- .button({
- id: 'button-disabled',
- value: '我变成有效按钮了',
- disabled: false
- });
- return false;
- },
- focus: true
- },
- {
- value: '不同意',
- callback: function () {
- alert('你不同意')
- }
- },
- {
- id: 'button-disabled',
- value: '无效按钮',
- disabled: true
- },
- {
- value: '关闭我'
- }
- ]
-});
- 运行
-
-
- -
-
width
-
- - 概述
- - (默认值: "auto") 设置对话框 内容 宽度。
-
- 一般情况下无需设置此值,对话框会自适应内容宽度
- - 类型
- - Number, String
- - 示例
- -
-
art.dialog({
- width: 460
-});
- 运行
- -
-
art.dialog({
- width: '20em'
-});
- 运行
-
-
- -
-
height
-
- - 概述
- - (默认值: "auto") 设置对话框 内容 高度。
-
- 一般情况下无需设置此值,对话框会自适应内容宽度
- - 类型
- - Number, String
- - 示例
- -
-
art.dialog({
- height: 460
-});
- 运行
- -
-
art.dialog({
- height: '20em'
-});
- 运行
-
-
- -
-
fixed
-
- - 概述
- - (默认值: false) 开启固定定位。
-
- 固定定位是 css2.1 position 的一个属性,它能固定在浏览器某个地方,也不受滚动条拖动影响。IE6 与 部分移动浏览器对其支持不好,内部会转成绝对定位
- - 类型
- - Boolean
- - 示例
- -
-
art.dialog({
- fixed: true,
- content: '请拖动滚动条查看'
-});
- 运行
-
-
- -
-
follow
-
- - 概述
- - 让对话框依附在指定元素附近
- - 类型
- - HTMLElement
- - 示例
- -
-
art.dialog({
- follow: document.getElementById('options-follow-demo-runCode'),
- content: '让对话框跟着某个元素,一个元素同时只能出现一个对话框'
-});
- 运行
-
-
- -
-
lock
-
- - 概述
- - (默认值: false) 开启锁屏遮罩。
-
- 中断用户对话框之外的交互,用于显示非常重要的操作/消息。建议只在适合的时候使用它。遮罩的颜色与透明度可在皮肤CSS中设置。
- - 类型
- - Boolean
- - 示例
- -
-
art.dialog({
- lock: true
-});
- 运行
-
-
- -
-
padding
-
- - 概述
- - (默认值: "20px 25px") 设置消息内容与消息容器的填充边距,即 style padding 属性
- - 类型
- - String
- - 示例
- -
-
art.dialog({
- content: 'hello world',
- padding: 0
-})
- 运行
-
-
- -
-
id
-
- - 概述
- - 设定对话框唯一标识。
-
- 作用:
-
- - 可防止重复 ID 对话框弹出
- - 可后续使用 art.dialog.get(id) 获取某个对话框的接口
-
-
- - 类型
- - String
- - 示例
- -
-
art.dialog({
- id: 'id-demo',
- content: '再次点击运行看看'
-});
-art.dialog.get('id-demo').title('8888888888');
- 运行
-
-
- -
-
zIndex
-
- - 概述
- - (默认值: 1987) 重置全局 zIndex 初始值,用来改变对话框叠加高度。
-
- 比如有时候配合外部浮动层UI组件,但是它们可能默认 zIndex 没有 artDialog 高,导致无法浮动到 artDialog 之上,这个时候你就可以给对话框指定一个较小的 zIndex 值。
- 请注意这是一个会影响到全局的配置,后续出现的对话框叠加高度将重新按此累加。
- - 类型
- - Number
- - 示例
- -
-
art.dialog({
- zIndex: 87
-});
- 运行
-
-
- -
-
initialize
-
- - 概述
- - 对话框初始化完成后执行的函数。
-
- 回调函数 this 指向 art.dialog 对象
- - 类型
- - Function
- - 示例
- -
-
art.dialog({
- initialize: function () {
- this.content('对话框初始化完成');
- }
-});
- 运行
-
-
- -
-
beforeunload
-
- - 概述
- - 对话框关闭前执行的函数。
-
- 回调函数 this 指向 art.dialog 对象,执行完毕默认关闭对话框,若返回 false 则阻止关闭
- - 类型
- - Function
- - 示例
- -
-
art.dialog({
- beforeunload: function () {
- return confirm('确定关闭对话框吗');
- }
-});
- 运行
-
-
- -
-
visible
-
- - 概述
- - (默认值: true) 是否显示对话框
- - 类型
- - Boolean
- - 示例
- -
-
var dialog = art.dialog({
- visible: false,
- id: 'visible-demo'
-});
-
-confirm('显示对话框吗') ? dialog.visible() : dialog.hidden();
- 运行
-
-
- -
-
time
-
- - 概述
- - 设置对话框显示时间,超过时间自动关闭 (单位:毫秒)
- - 类型
- - Number
- - 示例
- -
-
art.dialog({
- time: 2000
-});
- 运行
-
-
- -
-
esc
-
- - 概述
- - (默认值: false) 是否允许用户按 Esc 键关闭对话框
- - 类型
- - Boolean
- - 示例
- -
-
art.dialog({
- esc: false,
- content: '按 Esc 不能关闭我'
-});
- 运行
-
-
- -
-
focus
-
- - 概述
- - (默认值: true) 是否支持对话框按钮自动聚焦
- - 类型
- - Boolean
- - 示例
- -
-
art.dialog({
- focus: false,
- ok: function () {}
-});
- 运行
-
-
-
-
-
-
接口
-
- -
-
art.dialog.get(id)
-
- - 概述
- - 根据 id 获取 art.dialog 对象。注意:这是一个静态方法
- - 参数
- -
-
- - id
- - 对话框 id
-
-
- - 返回值
- - 如果存在 id 参数则返回 art.dialog 对象,否则返回页面所有 art.dialog 对象数组
- - 示例
- -
-
art.dialog({
- id: 'demo-get'
-});
-
-var dialog = art.dialog.get('demo-get');
-dialog.title('hello').content('I Love You!');
-
- 运行
-
-
- -
-
closed
-
- - 概述
- - 对话框是否已经关闭。注意:这是一个属性,对话框若关闭其值为 true
- - 示例
- -
-
var dialog = art.dialog();
-
-dialog.close();
-
-alert(dialog.closed);
-
- 运行
-
-
- -
-
close()
-
- - 概述
- - 关闭对话框
- - 示例
- -
-
var dialog = art.dialog({
- content: 'hello world!'
-});
-
-if (confirm('关闭对话框吗')) {
- dialog.close();
-};
-
- 运行
-
-
- -
-
visible()
-
- - 概述
- - 把隐藏的对话框显示
- - 示例
- -
-
var dialog = art.dialog({
- visible: false
-});
-
-dialog.visible();
- 运行
-
-
- -
-
hidden()
-
- - 概述
- - 隐藏对话框
- - 示例
- -
-
var dialog = art.dialog();
-
-dialog.hidden();
- 运行
-
-
- -
-
title(value)
-
- - 概述
- - 设置对话框标题
- - 参数
- -
-
- - value
- - 标题内容
-
-
- - 示例
- -
-
var dialog = art.dialog({
- title: '请等待..'
-});
-
-dialog.title('欢迎使用');
- 运行
-
-
- -
-
content(value)
-
- - 概述
- - 设置消息内容
- - 参数
- -
-
- - value
- - 消息内容
-
-
- - 示例
- -
-
var dialog = art.dialog();
-
-dialog.content('加载完成!');
- 运行
-
-
- -
-
-
- - 概述
- - 添加或者修改一个或者多个按钮
- - 参数
- -
-
- - button
- - 按钮配置
-
-
- - 选项
- -
-
- - value
- - 按钮显示文本
- - callback
- - (可选) 按钮点击后的回调函数。回调函数 this 指向 art.dialog 对象,执行完毕默认关闭对话框,若返回 false 则阻止关闭
- - focus
- - (默认值: true) 是否聚焦
- - width
- - (可选) 设置按钮 CSS width 值
- - disabled
- - (默认值: false) 是否禁用
- - id
- - (默认值: 与 value 一致) 唯一标识
-
-
- - 示例
- -
-
修改按钮与新增按钮:
- var dialog = art.dialog({
- button: [{
- value: '增加一个按钮',
- focus: true,
- callback: function () {
- this.button({
- value: '关闭我'
- });
- return false;
- }
- }, {
- id: 'button',
- value: '提交 (5)',
- width: '8em',
- callback: function () {
- alert(0);
- return false;
- },
- disabled: true
- }]
-});
-
-var i = 5;
-var timer = setInterval(function () {
- i--;
-
- dialog.button({
- id: 'button',
- value: '提交 (' + i + ')',
- disabled: true
- });
-
- if (i === 0) {
- clearInterval(timer);
- dialog.button({
- id: 'button',
- value: '提交',
- disabled: false
- });
- };
-}, 1000);
- 运行
-
-
- -
-
follow(element)
-
- - 概述
- - 让对话框依附在指定元素附近
- - 参数
- -
-
- - element
- - 元素
-
-
- - 示例
- -
-
var dialog = art.dialog();
-
-dialog.follow(document.getElementById('api-follow-demo-runCode'));
- 运行
-
-
- -
-
size(width, height)
-
- - 概述
- - 指定对话框内容尺寸
- - 参数
- -
-
- - width
- - 内容宽度
- - height
- - 内容高度
-
-
- - 示例
- -
-
var dialog = art.dialog();
-
-dialog.size('20em', 60);
- 运行
-
-
- -
-
lock()
-
- - 概述
- - 开启锁屏遮罩
- - 示例
- -
-
var dialog = art.dialog();
-
-dialog.lock();
- 运行
-
-
- -
-
unlock()
-
- - 概述
- - 关闭锁屏遮罩
- - 示例
- -
-
var dialog = art.dialog({
- lock: true
-});
-
-dialog.unlock();
- 运行
-
-
- -
-
time(value)
-
- - 概述
- - 设置对话框显示时间,超过时间自动关闭 (单位:毫秒)
- - 参数
- -
-
- - value
- - 毫秒
-
-
- - 示例
- -
-
var dialog = art.dialog();
-
-dialog.time(2000);
- 运行
-
-
-
-
-
-
插件
-
artDialog 可以通过插件支持拖动、抖动效果, alert、confirm、prompt 方法。只需在 artDialog 之后引用如下文件即可:
-
-<script src="./artDialog.plugins.min.js"></script>
-
-
-
-
-
演示插件
-
- -
-
art.alert(content, [callback])
- art.alert('那些年,我们一起追的女孩');
-
- 运行
- -
-
art.confirm(content, ok, [cancel])
- art.confirm('你再也不相信爱情了么?', function () {
- alert(0);
-}, function () {
- alert(1);
-});
-
- 运行
- -
-
art.prompt(content, ok, [defaultValue])
- art.prompt('你的名字是什么?', function (value) {
- alert(value);
-}, '糖饼');
-
- 运行
- -
-
shake()
- art.dialog({
- id: 'shake-demo',
- title: '登录',
- content: '帐号:<input type="text" value="guest" /><br />'
- + '密码:<input id="login-pw" type="text" value="****" />',
- lock: true,
- fixed: true,
- ok: function () {
- var pw = document.getElementById('login-pw');
- pw.select();
- pw.focus();
- this.shake();
- return false;
- },
- okValue: '登录',
- cancel: function () {}
-});
- 运行
-
-
-
-
-
-
-
-
-
-
-
备注:带阴影的效果的皮肤不被IE6支持。可使用渐进增强方式 解决[+]
-
<!--[if gte IE 7]><!-->
- <link href="./skins/aero.css" rel="stylesheet" />
-<!--<![endif]-->
-<!--[if lt IE 7]>
- <link href="./skins/default.css" rel="stylesheet" />
-<![endif]-->
-
-
-
-
-
-