diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0bc7c71 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.DS_Store +node_modules +bower_components diff --git a/Gruntfile.js b/Gruntfile.js new file mode 100644 index 0000000..c8889fb --- /dev/null +++ b/Gruntfile.js @@ -0,0 +1,44 @@ +module.exports = function (grunt) { + + grunt.initConfig({ + pkg: grunt.file.readJSON('package.json'), + meta: { + banner: '/*! <%= pkg.name %> v<%= pkg.version %> | <%= pkg.homepage %> */\n' + }, + unwrap: { + options: { + base: './src', + globalBase: './src/global_modules', + name: 'dialog', + namespace: 'window', + banner: '<%= meta.banner %>' + }, + 'dialog.js': { + src: './src/dialog.js', + dest: './dist/dialog.js' + }, + 'dialog-plus.js': { + src: './src/dialog-plus.js', + dest: './dist/dialog-plus.js' + } + }, + uglify: { + options: { + banner: '<%= meta.banner %>' + }, + 'dialog.js': { + src: './dist/dialog.js', + dest: './dist/dialog-min.js' + }, + 'dialog-plus.js': { + src: './dist/dialog-plus.js', + dest: './dist/dialog-plus-min.js' + } + } + }); + + grunt.loadNpmTasks('grunt-unwrap'); + grunt.loadNpmTasks('grunt-contrib-uglify'); + grunt.registerTask('default', ['unwrap', 'uglify']); + +}; \ No newline at end of file diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..a9dc7ab --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,56 @@ +GNU LESSER GENERAL PUBLIC LICENSE +Version 3, 29 June 2007 + +Copyright (C) 2007 Free Software Foundation, Inc. + +Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. + +This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. + +0. Additional Definitions. +As used herein, “this License” refers to version 3 of the GNU Lesser General Public License, and the “GNU GPL” refers to version 3 of the GNU General Public License. + +“The Library” refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. + +An “Application” is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. + +A “Combined Work” is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the “Linked Version”. + +The “Minimal Corresponding Source” for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. + +The “Corresponding Application Code” for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. + +1. Exception to Section 3 of the GNU GPL. +You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. + +2. Conveying Modified Versions. +If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: + +a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or +b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. +3. Object Code Incorporating Material from Library Header Files. +The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: + +a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. +b) Accompany the object code with a copy of the GNU GPL and this license document. +4. Combined Works. +You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: + +a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. +b) Accompany the Combined Work with a copy of the GNU GPL and this license document. +c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. +d) Do one of the following: +0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. +1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. +e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) +5. Combined Libraries. +You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: + +a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. +b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. +6. Revised Versions of the GNU Lesser General Public License. +The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. + +If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. \ No newline at end of file diff --git a/README.md b/README.md index 1d0cd85..f529256 100644 --- a/README.md +++ b/README.md @@ -1,50 +1,66 @@ -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 + +[![CDNJS](https://img.shields.io/cdnjs/v/artDialog.svg)](https://cdnjs.com/libraries/artDialog) +[![NPM Version](https://img.shields.io/npm/v/art-dialog.svg)](https://npmjs.org/package/art-dialog) +[![NPM Downloads](https://img.shields.io/npm/dm/art-dialog.svg)](https://npmjs.org/package/art-dialog) + +artDialog——经典、优雅的网页对话框控件。 + +[文档与示例](http://aui.github.io/artDialog/doc/index.html) | [AngularJS 版本](https://github.com/aui/angular-popups) + +``` +npm install --save-dev art-dialog +``` + +## 成功案例 + +超过 40 万网站在使用 artDialog,其中不乏国内顶尖的产品: + +* [QQ空间 v8(腾讯)](http://qzone.qq.com) +* [Phpcms(盛大)](http://www.phpcms.cn) +* [极路由](http://www.hiwifi.com) +* ... + +## 更新历史 + +7.0.0 + +1. 支持 Webpack +2. 支持 Npm +2. 将 CSS 打包到 JS 中 + +6.0.4 + +1. ``content()``方法传入隐藏元素并显示,并且``remove()``的时候会将元素插入到``body``避免被销毁 [#103](https://github.com/aui/artDialog/issues/103) [#126](https://github.com/aui/artDialog/issues/126) +2. 修复``button``方法可能会多次绑定事件的问题 +3. 模态对话框可以避免 shift + tab 将焦点移出对话框 [#67](https://github.com/aui/artDialog/issues/67) + +6.0.3 + +1. 修复``button``方法直接传入 html 不显示的问题 +2. 修复版本管理导致[#78](https://github.com/aui/artDialog/issues/78)重现问题 + +6.0.2 + +1. 提供无依赖 seajs 与 requirejs 的版本 +2. 取消按钮增加``cancelDisplay``配置,保留``cancel``事件的同时也不会显示取消按钮 + +6.0.1 + +1. 进一步完善焦点管理,避免抢夺开发者自己设置的焦点[#67](https://github.com/aui/artDialog/issues/67) +2. 修复对话框内容使用 html5 data-id 属性冲突的问题[#78](https://github.com/aui/artDialog/issues/78) +3. 改善 Esc 快捷键与 cancel 的问题[#36](https://github.com/aui/artDialog/issues/36) + +6.0.0 + +1. 功能增强:支持定义左下角的区域 HTML、支持 12 个方向的气泡对话框、支持无标题栏与按钮区的对话框 +2. 更好的交互体验:更加先进的焦点管理,支持无障碍访问 +3. 面向未来:基于 HTML5 Dialog 的 API +4. 模块化:支持 AMD、CMD 规范 +5. 可选增强版:拖拽支持、简化框架页面调用 + +## 授权协议 + +免费,且开源,基于[LGPL-3.0](./LICENSE.md)协议。 + +[\[AD\] 前端招聘:在海边写代码](https://juejin.im/post/5a2651d06fb9a0451c3a40ad) diff --git a/_config.yml b/_config.yml new file mode 100644 index 0000000..c419263 --- /dev/null +++ b/_config.yml @@ -0,0 +1 @@ +theme: jekyll-theme-cayman \ 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