├── 2.4 基于require.js重写代码 ├── js │ ├── animate.js │ ├── treeview.js │ ├── tabview.js │ └── main.js └── index.html ├── 11.1 拖动 ├── js │ ├── jquery-ui-1.11.2.custom │ │ ├── images │ │ │ ├── ui-icons_222222_256x240.png │ │ │ ├── ui-icons_228ef1_256x240.png │ │ │ ├── ui-icons_ef8c08_256x240.png │ │ │ ├── ui-icons_ffd27a_256x240.png │ │ │ ├── ui-icons_ffffff_256x240.png │ │ │ ├── ui-bg_flat_10_000000_40x100.png │ │ │ ├── ui-bg_glass_65_ffffff_1x400.png │ │ │ ├── ui-bg_glass_100_f6f6f6_1x400.png │ │ │ ├── ui-bg_glass_100_fdf5ce_1x400.png │ │ │ ├── ui-bg_gloss-wave_35_f6a828_500x100.png │ │ │ ├── ui-bg_diagonals-thick_18_b81900_40x40.png │ │ │ ├── ui-bg_diagonals-thick_20_666666_40x40.png │ │ │ ├── ui-bg_highlight-soft_100_eeeeee_1x100.png │ │ │ └── ui-bg_highlight-soft_75_ffe45c_1x100.png │ │ ├── jquery-ui.theme.min.css │ │ └── jquery-ui.structure.min.css │ ├── main.js │ ├── window.js │ └── require.js ├── index.html └── css │ ├── base.css │ └── window.css ├── 12.2 自定义事件实现(一) ├── js │ ├── jquery-ui-1.11.2.custom │ │ ├── images │ │ │ ├── ui-icons_222222_256x240.png │ │ │ ├── ui-icons_228ef1_256x240.png │ │ │ ├── ui-icons_ef8c08_256x240.png │ │ │ ├── ui-icons_ffd27a_256x240.png │ │ │ ├── ui-icons_ffffff_256x240.png │ │ │ ├── ui-bg_flat_10_000000_40x100.png │ │ │ ├── ui-bg_glass_65_ffffff_1x400.png │ │ │ ├── ui-bg_glass_100_f6f6f6_1x400.png │ │ │ ├── ui-bg_glass_100_fdf5ce_1x400.png │ │ │ ├── ui-bg_gloss-wave_35_f6a828_500x100.png │ │ │ ├── ui-bg_diagonals-thick_18_b81900_40x40.png │ │ │ ├── ui-bg_diagonals-thick_20_666666_40x40.png │ │ │ ├── ui-bg_highlight-soft_100_eeeeee_1x100.png │ │ │ └── ui-bg_highlight-soft_75_ffe45c_1x100.png │ │ ├── jquery-ui.theme.min.css │ │ └── jquery-ui.structure.min.css │ ├── main.js │ └── window.js ├── index.html └── css │ ├── base.css │ └── window.css ├── 3.1 制作简单的弹窗组件 ├── js │ ├── main.js │ └── window.js ├── css │ ├── window.css │ └── base.css └── index.html ├── 3.2 带关闭按钮的弹窗组件 ├── js │ ├── main.js │ └── window.js ├── index.html └── css │ ├── window.css │ └── base.css ├── 4.1 定制长宽和位置 ├── js │ ├── main.js │ └── window.js ├── index.html └── css │ ├── window.css │ └── base.css ├── 5.1 调整接口格式 ├── js │ ├── main.js │ └── window.js ├── index.html └── css │ ├── window.css │ └── base.css ├── 10.1 模态 ├── index.html ├── js │ ├── main.js │ ├── window.js │ └── require.js └── css │ ├── base.css │ └── window.css ├── 13.1 连缀语法 ├── index.html ├── css │ ├── base.css │ └── window.css └── js │ ├── main.js │ └── window.js ├── 6.1 定制标题 ├── index.html ├── js │ ├── main.js │ └── window.js └── css │ ├── base.css │ └── window.css ├── 7.1 定制关闭按钮 ├── index.html ├── js │ ├── main.js │ └── window.js └── css │ ├── base.css │ └── window.css ├── 8.1 定制皮肤 ├── index.html ├── css │ ├── base.css │ └── window.css └── js │ ├── main.js │ └── window.js ├── 9.1 定制按钮文案 ├── index.html ├── css │ ├── base.css │ └── window.css └── js │ ├── main.js │ └── window.js ├── 14.1 widget抽象类 ├── index.html ├── js │ ├── widget.js │ ├── main.js │ └── window.js └── css │ ├── base.css │ └── window.css ├── 15.1 widget类 设计统一生命周期(一) ├── index.html ├── css │ ├── base.css │ └── window.css └── js │ ├── main.js │ ├── widget.js │ └── window.js ├── 15.2 widget类 设计统一生命周期(二) ├── index.html ├── css │ ├── base.css │ └── window.css └── js │ ├── main.js │ ├── widget.js │ └── window.js ├── 16.1 实现confirm方法(一) ├── index.html ├── css │ ├── base.css │ └── window.css └── js │ ├── widget.js │ ├── main.js │ └── window.js ├── README.md ├── 17.1 实现prompt方法(一) ├── index.html ├── css │ ├── base.css │ └── window.css └── js │ ├── widget.js │ ├── main.js │ └── window.js └── 18.1 实现common方法 ├── index.html ├── css ├── base.css └── window.css └── js ├── widget.js ├── main.js └── window.js /2.4 基于require.js重写代码/js/animate.js: -------------------------------------------------------------------------------- 1 | define(function(){ 2 | function Animate(){ 3 | this.name = "Animate"; 4 | } 5 | 6 | return{ 7 | Animate : Animate 8 | } 9 | }) -------------------------------------------------------------------------------- /2.4 基于require.js重写代码/js/treeview.js: -------------------------------------------------------------------------------- 1 | define(function(){ 2 | function TreeView(){ 3 | this.name = 'TreeView'; 4 | } 5 | 6 | return{ 7 | TreeView : TreeView 8 | } 9 | }); -------------------------------------------------------------------------------- /11.1 拖动/js/jquery-ui-1.11.2.custom/images/ui-icons_222222_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevYan/WebComponents/HEAD/11.1 拖动/js/jquery-ui-1.11.2.custom/images/ui-icons_222222_256x240.png -------------------------------------------------------------------------------- /11.1 拖动/js/jquery-ui-1.11.2.custom/images/ui-icons_228ef1_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevYan/WebComponents/HEAD/11.1 拖动/js/jquery-ui-1.11.2.custom/images/ui-icons_228ef1_256x240.png -------------------------------------------------------------------------------- /11.1 拖动/js/jquery-ui-1.11.2.custom/images/ui-icons_ef8c08_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevYan/WebComponents/HEAD/11.1 拖动/js/jquery-ui-1.11.2.custom/images/ui-icons_ef8c08_256x240.png -------------------------------------------------------------------------------- /11.1 拖动/js/jquery-ui-1.11.2.custom/images/ui-icons_ffd27a_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevYan/WebComponents/HEAD/11.1 拖动/js/jquery-ui-1.11.2.custom/images/ui-icons_ffd27a_256x240.png -------------------------------------------------------------------------------- /11.1 拖动/js/jquery-ui-1.11.2.custom/images/ui-icons_ffffff_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevYan/WebComponents/HEAD/11.1 拖动/js/jquery-ui-1.11.2.custom/images/ui-icons_ffffff_256x240.png -------------------------------------------------------------------------------- /11.1 拖动/js/jquery-ui-1.11.2.custom/images/ui-bg_flat_10_000000_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevYan/WebComponents/HEAD/11.1 拖动/js/jquery-ui-1.11.2.custom/images/ui-bg_flat_10_000000_40x100.png -------------------------------------------------------------------------------- /11.1 拖动/js/jquery-ui-1.11.2.custom/images/ui-bg_glass_65_ffffff_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevYan/WebComponents/HEAD/11.1 拖动/js/jquery-ui-1.11.2.custom/images/ui-bg_glass_65_ffffff_1x400.png -------------------------------------------------------------------------------- /11.1 拖动/js/jquery-ui-1.11.2.custom/images/ui-bg_glass_100_f6f6f6_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevYan/WebComponents/HEAD/11.1 拖动/js/jquery-ui-1.11.2.custom/images/ui-bg_glass_100_f6f6f6_1x400.png -------------------------------------------------------------------------------- /11.1 拖动/js/jquery-ui-1.11.2.custom/images/ui-bg_glass_100_fdf5ce_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevYan/WebComponents/HEAD/11.1 拖动/js/jquery-ui-1.11.2.custom/images/ui-bg_glass_100_fdf5ce_1x400.png -------------------------------------------------------------------------------- /12.2 自定义事件实现(一)/js/jquery-ui-1.11.2.custom/images/ui-icons_222222_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevYan/WebComponents/HEAD/12.2 自定义事件实现(一)/js/jquery-ui-1.11.2.custom/images/ui-icons_222222_256x240.png -------------------------------------------------------------------------------- /12.2 自定义事件实现(一)/js/jquery-ui-1.11.2.custom/images/ui-icons_228ef1_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevYan/WebComponents/HEAD/12.2 自定义事件实现(一)/js/jquery-ui-1.11.2.custom/images/ui-icons_228ef1_256x240.png -------------------------------------------------------------------------------- /12.2 自定义事件实现(一)/js/jquery-ui-1.11.2.custom/images/ui-icons_ef8c08_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevYan/WebComponents/HEAD/12.2 自定义事件实现(一)/js/jquery-ui-1.11.2.custom/images/ui-icons_ef8c08_256x240.png -------------------------------------------------------------------------------- /12.2 自定义事件实现(一)/js/jquery-ui-1.11.2.custom/images/ui-icons_ffd27a_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevYan/WebComponents/HEAD/12.2 自定义事件实现(一)/js/jquery-ui-1.11.2.custom/images/ui-icons_ffd27a_256x240.png -------------------------------------------------------------------------------- /12.2 自定义事件实现(一)/js/jquery-ui-1.11.2.custom/images/ui-icons_ffffff_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevYan/WebComponents/HEAD/12.2 自定义事件实现(一)/js/jquery-ui-1.11.2.custom/images/ui-icons_ffffff_256x240.png -------------------------------------------------------------------------------- /11.1 拖动/js/jquery-ui-1.11.2.custom/images/ui-bg_gloss-wave_35_f6a828_500x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevYan/WebComponents/HEAD/11.1 拖动/js/jquery-ui-1.11.2.custom/images/ui-bg_gloss-wave_35_f6a828_500x100.png -------------------------------------------------------------------------------- /12.2 自定义事件实现(一)/js/jquery-ui-1.11.2.custom/images/ui-bg_flat_10_000000_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevYan/WebComponents/HEAD/12.2 自定义事件实现(一)/js/jquery-ui-1.11.2.custom/images/ui-bg_flat_10_000000_40x100.png -------------------------------------------------------------------------------- /12.2 自定义事件实现(一)/js/jquery-ui-1.11.2.custom/images/ui-bg_glass_65_ffffff_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevYan/WebComponents/HEAD/12.2 自定义事件实现(一)/js/jquery-ui-1.11.2.custom/images/ui-bg_glass_65_ffffff_1x400.png -------------------------------------------------------------------------------- /11.1 拖动/js/jquery-ui-1.11.2.custom/images/ui-bg_diagonals-thick_18_b81900_40x40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevYan/WebComponents/HEAD/11.1 拖动/js/jquery-ui-1.11.2.custom/images/ui-bg_diagonals-thick_18_b81900_40x40.png -------------------------------------------------------------------------------- /11.1 拖动/js/jquery-ui-1.11.2.custom/images/ui-bg_diagonals-thick_20_666666_40x40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevYan/WebComponents/HEAD/11.1 拖动/js/jquery-ui-1.11.2.custom/images/ui-bg_diagonals-thick_20_666666_40x40.png -------------------------------------------------------------------------------- /11.1 拖动/js/jquery-ui-1.11.2.custom/images/ui-bg_highlight-soft_100_eeeeee_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevYan/WebComponents/HEAD/11.1 拖动/js/jquery-ui-1.11.2.custom/images/ui-bg_highlight-soft_100_eeeeee_1x100.png -------------------------------------------------------------------------------- /11.1 拖动/js/jquery-ui-1.11.2.custom/images/ui-bg_highlight-soft_75_ffe45c_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevYan/WebComponents/HEAD/11.1 拖动/js/jquery-ui-1.11.2.custom/images/ui-bg_highlight-soft_75_ffe45c_1x100.png -------------------------------------------------------------------------------- /12.2 自定义事件实现(一)/js/jquery-ui-1.11.2.custom/images/ui-bg_glass_100_f6f6f6_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevYan/WebComponents/HEAD/12.2 自定义事件实现(一)/js/jquery-ui-1.11.2.custom/images/ui-bg_glass_100_f6f6f6_1x400.png -------------------------------------------------------------------------------- /12.2 自定义事件实现(一)/js/jquery-ui-1.11.2.custom/images/ui-bg_glass_100_fdf5ce_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevYan/WebComponents/HEAD/12.2 自定义事件实现(一)/js/jquery-ui-1.11.2.custom/images/ui-bg_glass_100_fdf5ce_1x400.png -------------------------------------------------------------------------------- /12.2 自定义事件实现(一)/js/jquery-ui-1.11.2.custom/images/ui-bg_gloss-wave_35_f6a828_500x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevYan/WebComponents/HEAD/12.2 自定义事件实现(一)/js/jquery-ui-1.11.2.custom/images/ui-bg_gloss-wave_35_f6a828_500x100.png -------------------------------------------------------------------------------- /2.4 基于require.js重写代码/js/tabview.js: -------------------------------------------------------------------------------- 1 | define(['animate'],function(a){ 2 | function TabView(){ 3 | this.name = 'TabView'; 4 | this.animate = new a.Animate(); 5 | } 6 | 7 | return{ 8 | TabView : TabView 9 | } 10 | }); -------------------------------------------------------------------------------- /12.2 自定义事件实现(一)/js/jquery-ui-1.11.2.custom/images/ui-bg_diagonals-thick_18_b81900_40x40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevYan/WebComponents/HEAD/12.2 自定义事件实现(一)/js/jquery-ui-1.11.2.custom/images/ui-bg_diagonals-thick_18_b81900_40x40.png -------------------------------------------------------------------------------- /12.2 自定义事件实现(一)/js/jquery-ui-1.11.2.custom/images/ui-bg_diagonals-thick_20_666666_40x40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevYan/WebComponents/HEAD/12.2 自定义事件实现(一)/js/jquery-ui-1.11.2.custom/images/ui-bg_diagonals-thick_20_666666_40x40.png -------------------------------------------------------------------------------- /12.2 自定义事件实现(一)/js/jquery-ui-1.11.2.custom/images/ui-bg_highlight-soft_100_eeeeee_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevYan/WebComponents/HEAD/12.2 自定义事件实现(一)/js/jquery-ui-1.11.2.custom/images/ui-bg_highlight-soft_100_eeeeee_1x100.png -------------------------------------------------------------------------------- /12.2 自定义事件实现(一)/js/jquery-ui-1.11.2.custom/images/ui-bg_highlight-soft_75_ffe45c_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DevYan/WebComponents/HEAD/12.2 自定义事件实现(一)/js/jquery-ui-1.11.2.custom/images/ui-bg_highlight-soft_75_ffe45c_1x100.png -------------------------------------------------------------------------------- /2.4 基于require.js重写代码/js/main.js: -------------------------------------------------------------------------------- 1 | require(['tabview','treeview'],function(tab,tree){ 2 | var tabView = new tab.TabView(), 3 | treeView = new tree.TreeView(); 4 | alert(tabView.name); 5 | alert(treeView.name); 6 | alert(tabView.animate.name); 7 | }); -------------------------------------------------------------------------------- /3.1 制作简单的弹窗组件/js/main.js: -------------------------------------------------------------------------------- 1 | require.config({ 2 | paths:{ 3 | jquery:'jquery-2.1.1.min' 4 | } 5 | }); 6 | 7 | require(['jquery','window'],function($,w){ 8 | $('.btn').click(function(){ 9 | new w.Window().alert('welcome!'); 10 | }); 11 | }); -------------------------------------------------------------------------------- /2.4 基于require.js重写代码/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 基于require.js重写代码 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /3.2 带关闭按钮的弹窗组件/js/main.js: -------------------------------------------------------------------------------- 1 | require.config({ 2 | paths:{ 3 | jquery:'jquery-2.1.1.min' 4 | } 5 | }); 6 | 7 | require(['jquery','window'],function($,w){ 8 | $('.btn').click(function(){ 9 | new w.Window().alert('welcome!',function(){ 10 | alert('you click the button'); 11 | }); 12 | }); 13 | }); -------------------------------------------------------------------------------- /4.1 定制长宽和位置/js/main.js: -------------------------------------------------------------------------------- 1 | require.config({ 2 | paths:{ 3 | jquery:'jquery-2.1.1.min' 4 | } 5 | }); 6 | 7 | require(['jquery','window'],function($,w){ 8 | $('.btn').click(function(){ 9 | new w.Window().alert('welcome!',function(){ 10 | alert('you click the button'); 11 | },{ 12 | width:300, 13 | height:150, 14 | y:550 15 | }); 16 | }); 17 | }); -------------------------------------------------------------------------------- /5.1 调整接口格式/js/main.js: -------------------------------------------------------------------------------- 1 | require.config({ 2 | paths:{ 3 | jquery:'jquery-2.1.1.min' 4 | } 5 | }); 6 | 7 | require(['jquery','window'],function($,w){ 8 | $('.btn').click(function(){ 9 | new w.Window().alert({ 10 | content:'Welcome!!!', 11 | handler:function(){ 12 | alert('you click the button'); 13 | }, 14 | width:300, 15 | height:150, 16 | y:550 17 | }); 18 | }); 19 | }); -------------------------------------------------------------------------------- /3.1 制作简单的弹窗组件/js/window.js: -------------------------------------------------------------------------------- 1 | define(['jquery'],function($){ 2 | function Window(){} 3 | 4 | Window.prototype = { 5 | alert:function(content){ 6 | var boudingBox = $('
'); 7 | boudingBox.appendTo('body'); 8 | boudingBox.html(content); 9 | }, 10 | confirm:function(){}, 11 | prompt:function(){} 12 | } 13 | 14 | return{ 15 | Window : Window 16 | } 17 | }) -------------------------------------------------------------------------------- /3.1 制作简单的弹窗组件/css/window.css: -------------------------------------------------------------------------------- 1 | .btn{ 2 | text-decoration: none; 3 | padding:5px 10px; 4 | width: 50px; 5 | text-align: center; 6 | display: block; 7 | margin: 100px; 8 | background: #ddd; 9 | } 10 | 11 | .window_boundingBox{ 12 | position: fixed; 13 | border: 1px solid #ddd; 14 | width: 500px; 15 | height: 300px; 16 | left: 50%; 17 | margin-left: -250px; 18 | top:100px; 19 | box-shadow: 0 0 12px #888; 20 | } -------------------------------------------------------------------------------- /10.1 模态/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 模态窗口 6 | 7 | 8 | 9 | 10 | 11 | 弹窗 12 | 13 | 14 | -------------------------------------------------------------------------------- /11.1 拖动/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 拖动 6 | 7 | 8 | 9 | 10 | 11 | 弹窗 12 | 13 | 14 | -------------------------------------------------------------------------------- /13.1 连缀语法/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 自定义事件 6 | 7 | 8 | 9 | 10 | 11 | 弹窗 12 | 13 | 14 | -------------------------------------------------------------------------------- /5.1 调整接口格式/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 调整接口格式 6 | 7 | 8 | 9 | 10 | 11 | 弹窗 12 | 13 | 14 | -------------------------------------------------------------------------------- /6.1 定制标题/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 定制标题 6 | 7 | 8 | 9 | 10 | 11 | 弹窗 12 | 13 | 14 | -------------------------------------------------------------------------------- /7.1 定制关闭按钮/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 定制关闭按钮 6 | 7 | 8 | 9 | 10 | 11 | 弹窗 12 | 13 | 14 | -------------------------------------------------------------------------------- /8.1 定制皮肤/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 定制皮肤 6 | 7 | 8 | 9 | 10 | 11 | 弹窗 12 | 13 | 14 | -------------------------------------------------------------------------------- /9.1 定制按钮文案/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 定制按钮文案 6 | 7 | 8 | 9 | 10 | 11 | 弹窗 12 | 13 | 14 | -------------------------------------------------------------------------------- /12.2 自定义事件实现(一)/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 自定义事件 6 | 7 | 8 | 9 | 10 | 11 | 弹窗 12 | 13 | 14 | -------------------------------------------------------------------------------- /4.1 定制长宽和位置/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 定制长宽和位置 6 | 7 | 8 | 9 | 10 | 11 | 弹窗 12 | 13 | 14 | -------------------------------------------------------------------------------- /6.1 定制标题/js/main.js: -------------------------------------------------------------------------------- 1 | require.config({ 2 | paths:{ 3 | jquery:'jquery-2.1.1.min' 4 | } 5 | }); 6 | 7 | require(['jquery','window'],function($,w){ 8 | $('.btn').click(function(){ 9 | new w.Window().alert({ 10 | title:'提示', 11 | content:'Welcome!!!', 12 | handler:function(){ 13 | alert('you click the button'); 14 | }, 15 | width:300, 16 | height:150, 17 | y:250, 18 | x:600 19 | }); 20 | }); 21 | }); -------------------------------------------------------------------------------- /14.1 widget抽象类/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Widget抽象类 6 | 7 | 8 | 9 | 10 | 11 | 弹窗 12 | 13 | 14 | -------------------------------------------------------------------------------- /3.1 制作简单的弹窗组件/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 制作简单的弹窗组件 6 | 7 | 8 | 9 | 10 | 11 | 弹窗 12 | 13 | 14 | -------------------------------------------------------------------------------- /3.2 带关闭按钮的弹窗组件/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 带关闭按钮的弹窗 6 | 7 | 8 | 9 | 10 | 11 | 弹窗 12 | 13 | 14 | -------------------------------------------------------------------------------- /15.1 widget类 设计统一生命周期(一)/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Widget抽象类 6 | 7 | 8 | 9 | 10 | 11 | 弹窗 12 | 13 | 14 | -------------------------------------------------------------------------------- /15.2 widget类 设计统一生命周期(二)/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Widget抽象类(二) 6 | 7 | 8 | 9 | 10 | 11 | 弹窗 12 | 13 | 14 | -------------------------------------------------------------------------------- /16.1 实现confirm方法(一)/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 实现confirm方法(一) 6 | 7 | 8 | 9 | 10 | 11 | alert弹窗 12 | confirm弹窗 13 | 14 | 15 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ##阿当大话西游之WEB组件,示例源码 2 | 3 | 4 | ###对应原始课程中的章节[http://www.imooc.com/learn/99] 5 | * 2.4 基于require.js重写代码 6 | * 3.1 制作简单的弹窗组件 7 | * 3.2 带关闭按钮的弹窗组件 8 | * 4.1 定制长宽和位置 9 | * 5.1 调整接口格式 10 | * 6.1 定制标题 11 | * 7.1 定制关闭按钮 12 | * 8.1 定制皮肤 13 | * 9.1 定制按钮文案 14 | * 10.1 模态 15 | * 11.1 拖动 16 | * 12.2 自定义事件实现(一)(已包含12章所有示例代码) 17 | * 13.1 连缀语法 18 | * 14.1 Widget抽象类 19 | * 15.1 widget类 设计统一生命周期(一) 20 | * 15.2 widget类 设计统一生命周期(二) 21 | * 16.1 实现confirm方法(一)(已包含16章所有示例代码) 22 | * 17.1 实现prompt方法(一)(已包含17章所有示例代码) 23 | * 18.1 实现common方法 -------------------------------------------------------------------------------- /17.1 实现prompt方法(一)/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 实现Prompt方法(一) 6 | 7 | 8 | 9 | 10 | 11 | alert弹窗 12 | confirm弹窗 13 | prompt弹窗 14 | 15 | 16 | -------------------------------------------------------------------------------- /3.2 带关闭按钮的弹窗组件/css/window.css: -------------------------------------------------------------------------------- 1 | .btn{ 2 | text-decoration: none; 3 | padding:5px 10px; 4 | width: 50px; 5 | text-align: center; 6 | display: block; 7 | margin: 100px; 8 | background: #ddd; 9 | } 10 | 11 | .window_boundingBox{ 12 | position: fixed; 13 | border: 1px solid #ddd; 14 | width: 500px; 15 | height: 300px; 16 | left: 50%; 17 | margin-left: -250px; 18 | top:100px; 19 | box-shadow: 0 0 12px #888; 20 | } 21 | 22 | .window_boundingBox input{ 23 | width: 100px; 24 | position: absolute; 25 | bottom: 10px; 26 | left: 50%; 27 | margin-left: -50px; 28 | } -------------------------------------------------------------------------------- /4.1 定制长宽和位置/css/window.css: -------------------------------------------------------------------------------- 1 | .btn{ 2 | text-decoration: none; 3 | padding:5px 10px; 4 | width: 50px; 5 | text-align: center; 6 | display: block; 7 | margin: 100px; 8 | background: #ddd; 9 | } 10 | 11 | .window_boundingBox{ 12 | position: fixed; 13 | border: 1px solid #ddd; 14 | width: 500px; 15 | height: 300px; 16 | left: 50%; 17 | margin-left: -250px; 18 | top:100px; 19 | box-shadow: 0 0 12px #888; 20 | } 21 | 22 | .window_boundingBox input{ 23 | width: 100px; 24 | position: absolute; 25 | bottom: 10px; 26 | left: 50%; 27 | margin-left: -50px; 28 | } -------------------------------------------------------------------------------- /5.1 调整接口格式/css/window.css: -------------------------------------------------------------------------------- 1 | .btn{ 2 | text-decoration: none; 3 | padding:5px 10px; 4 | width: 50px; 5 | text-align: center; 6 | display: block; 7 | margin: 100px; 8 | background: #ddd; 9 | } 10 | 11 | .window_boundingBox{ 12 | position: fixed; 13 | border: 1px solid #ddd; 14 | width: 500px; 15 | height: 300px; 16 | left: 50%; 17 | margin-left: -250px; 18 | top:100px; 19 | box-shadow: 0 0 12px #888; 20 | } 21 | 22 | .window_boundingBox input{ 23 | width: 100px; 24 | position: absolute; 25 | bottom: 10px; 26 | left: 50%; 27 | margin-left: -50px; 28 | } -------------------------------------------------------------------------------- /14.1 widget抽象类/js/widget.js: -------------------------------------------------------------------------------- 1 | define(function(){ 2 | function Widget(){this.handlers={};} 3 | Widget.prototype={ 4 | on:function(type,handler){ 5 | if (typeof this.handlers[type]=='undefined') { 6 | this.handlers[type]=[]; 7 | } 8 | this.handlers[type].push(handler); 9 | return this; 10 | }, 11 | fire:function(type,data){ 12 | if (this.handlers[type] instanceof Array) { 13 | var handlers = this.handlers[type]; 14 | for(var i=0,len=handlers.length;i 2 | 3 | 4 | 5 | 实现Common方法 6 | 7 | 8 | 9 | 10 | 11 | alert弹窗 12 | confirm弹窗 13 | prompt弹窗 14 | common弹窗 15 | 16 | 17 | -------------------------------------------------------------------------------- /3.2 带关闭按钮的弹窗组件/js/window.js: -------------------------------------------------------------------------------- 1 | define(['jquery'],function($){ 2 | function Window(){} 3 | 4 | Window.prototype = { 5 | alert:function(content,handler){ 6 | var boudingBox = $('
'); 7 | boudingBox.appendTo('body'); 8 | boudingBox.html(content); 9 | var btn = $(''); 10 | btn.appendTo(boudingBox); 11 | btn.click(function(){ 12 | handler && handler(); //判断是否传入执行操作的函数,如果传入就执行 13 | boudingBox.remove(); 14 | }) 15 | }, 16 | confirm:function(){}, 17 | prompt:function(){} 18 | } 19 | 20 | return{ 21 | Window : Window 22 | } 23 | }) -------------------------------------------------------------------------------- /4.1 定制长宽和位置/css/base.css: -------------------------------------------------------------------------------- 1 | body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre, 2 | form,fieldset,input,textarea,p,blockquote,th,td { 3 | padding: 0; 4 | margin: 0; 5 | } 6 | table { 7 | border-collapse: collapse; 8 | border-spacing: 0; 9 | } 10 | fieldset,img { 11 | border: 0; 12 | } 13 | address,caption,cite,code,dfn,em,strong,th,var { 14 | font-weight: normal; 15 | font-style: normal; 16 | } 17 | ol,ul { 18 | list-style: none; 19 | } 20 | caption,th { 21 | text-align: left; 22 | } 23 | h1,h2,h3,h4,h5,h6 { 24 | font-weight: normal; 25 | font-size: 100%; 26 | } 27 | q:before,q:after { 28 | content:''; 29 | } 30 | abbr,acronym { border: 0; 31 | } -------------------------------------------------------------------------------- /5.1 调整接口格式/css/base.css: -------------------------------------------------------------------------------- 1 | body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre, 2 | form,fieldset,input,textarea,p,blockquote,th,td { 3 | padding: 0; 4 | margin: 0; 5 | } 6 | table { 7 | border-collapse: collapse; 8 | border-spacing: 0; 9 | } 10 | fieldset,img { 11 | border: 0; 12 | } 13 | address,caption,cite,code,dfn,em,strong,th,var { 14 | font-weight: normal; 15 | font-style: normal; 16 | } 17 | ol,ul { 18 | list-style: none; 19 | } 20 | caption,th { 21 | text-align: left; 22 | } 23 | h1,h2,h3,h4,h5,h6 { 24 | font-weight: normal; 25 | font-size: 100%; 26 | } 27 | q:before,q:after { 28 | content:''; 29 | } 30 | abbr,acronym { border: 0; 31 | } -------------------------------------------------------------------------------- /6.1 定制标题/css/base.css: -------------------------------------------------------------------------------- 1 | body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre, 2 | form,fieldset,input,textarea,p,blockquote,th,td { 3 | padding: 0; 4 | margin: 0; 5 | } 6 | table { 7 | border-collapse: collapse; 8 | border-spacing: 0; 9 | } 10 | fieldset,img { 11 | border: 0; 12 | } 13 | address,caption,cite,code,dfn,em,strong,th,var { 14 | font-weight: normal; 15 | font-style: normal; 16 | } 17 | ol,ul { 18 | list-style: none; 19 | } 20 | caption,th { 21 | text-align: left; 22 | } 23 | h1,h2,h3,h4,h5,h6 { 24 | font-weight: normal; 25 | font-size: 100%; 26 | } 27 | q:before,q:after { 28 | content:''; 29 | } 30 | abbr,acronym { border: 0; 31 | } -------------------------------------------------------------------------------- /7.1 定制关闭按钮/css/base.css: -------------------------------------------------------------------------------- 1 | body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre, 2 | form,fieldset,input,textarea,p,blockquote,th,td { 3 | padding: 0; 4 | margin: 0; 5 | } 6 | table { 7 | border-collapse: collapse; 8 | border-spacing: 0; 9 | } 10 | fieldset,img { 11 | border: 0; 12 | } 13 | address,caption,cite,code,dfn,em,strong,th,var { 14 | font-weight: normal; 15 | font-style: normal; 16 | } 17 | ol,ul { 18 | list-style: none; 19 | } 20 | caption,th { 21 | text-align: left; 22 | } 23 | h1,h2,h3,h4,h5,h6 { 24 | font-weight: normal; 25 | font-size: 100%; 26 | } 27 | q:before,q:after { 28 | content:''; 29 | } 30 | abbr,acronym { border: 0; 31 | } -------------------------------------------------------------------------------- /8.1 定制皮肤/css/base.css: -------------------------------------------------------------------------------- 1 | body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre, 2 | form,fieldset,input,textarea,p,blockquote,th,td { 3 | padding: 0; 4 | margin: 0; 5 | } 6 | table { 7 | border-collapse: collapse; 8 | border-spacing: 0; 9 | } 10 | fieldset,img { 11 | border: 0; 12 | } 13 | address,caption,cite,code,dfn,em,strong,th,var { 14 | font-weight: normal; 15 | font-style: normal; 16 | } 17 | ol,ul { 18 | list-style: none; 19 | } 20 | caption,th { 21 | text-align: left; 22 | } 23 | h1,h2,h3,h4,h5,h6 { 24 | font-weight: normal; 25 | font-size: 100%; 26 | } 27 | q:before,q:after { 28 | content:''; 29 | } 30 | abbr,acronym { border: 0; 31 | } -------------------------------------------------------------------------------- /9.1 定制按钮文案/css/base.css: -------------------------------------------------------------------------------- 1 | body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre, 2 | form,fieldset,input,textarea,p,blockquote,th,td { 3 | padding: 0; 4 | margin: 0; 5 | } 6 | table { 7 | border-collapse: collapse; 8 | border-spacing: 0; 9 | } 10 | fieldset,img { 11 | border: 0; 12 | } 13 | address,caption,cite,code,dfn,em,strong,th,var { 14 | font-weight: normal; 15 | font-style: normal; 16 | } 17 | ol,ul { 18 | list-style: none; 19 | } 20 | caption,th { 21 | text-align: left; 22 | } 23 | h1,h2,h3,h4,h5,h6 { 24 | font-weight: normal; 25 | font-size: 100%; 26 | } 27 | q:before,q:after { 28 | content:''; 29 | } 30 | abbr,acronym { border: 0; 31 | } -------------------------------------------------------------------------------- /3.1 制作简单的弹窗组件/css/base.css: -------------------------------------------------------------------------------- 1 | body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre, 2 | form,fieldset,input,textarea,p,blockquote,th,td { 3 | padding: 0; 4 | margin: 0; 5 | } 6 | table { 7 | border-collapse: collapse; 8 | border-spacing: 0; 9 | } 10 | fieldset,img { 11 | border: 0; 12 | } 13 | address,caption,cite,code,dfn,em,strong,th,var { 14 | font-weight: normal; 15 | font-style: normal; 16 | } 17 | ol,ul { 18 | list-style: none; 19 | } 20 | caption,th { 21 | text-align: left; 22 | } 23 | h1,h2,h3,h4,h5,h6 { 24 | font-weight: normal; 25 | font-size: 100%; 26 | } 27 | q:before,q:after { 28 | content:''; 29 | } 30 | abbr,acronym { border: 0; 31 | } -------------------------------------------------------------------------------- /3.2 带关闭按钮的弹窗组件/css/base.css: -------------------------------------------------------------------------------- 1 | body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre, 2 | form,fieldset,input,textarea,p,blockquote,th,td { 3 | padding: 0; 4 | margin: 0; 5 | } 6 | table { 7 | border-collapse: collapse; 8 | border-spacing: 0; 9 | } 10 | fieldset,img { 11 | border: 0; 12 | } 13 | address,caption,cite,code,dfn,em,strong,th,var { 14 | font-weight: normal; 15 | font-style: normal; 16 | } 17 | ol,ul { 18 | list-style: none; 19 | } 20 | caption,th { 21 | text-align: left; 22 | } 23 | h1,h2,h3,h4,h5,h6 { 24 | font-weight: normal; 25 | font-size: 100%; 26 | } 27 | q:before,q:after { 28 | content:''; 29 | } 30 | abbr,acronym { border: 0; 31 | } -------------------------------------------------------------------------------- /8.1 定制皮肤/js/main.js: -------------------------------------------------------------------------------- 1 | require.config({ 2 | paths:{ 3 | jquery:'jquery-2.1.1.min' 4 | } 5 | }); 6 | 7 | require(['jquery','window'],function($,w){ 8 | $('.btn').click(function(){ 9 | new w.Window().alert({ 10 | title:'提示', 11 | content:'Welcome!!!', 12 | handler:function(){ 13 | alert('you click the button'); 14 | }, 15 | width:300, 16 | height:150, 17 | y:250, 18 | x:600, 19 | hasCloseBtn:true, 20 | skinClassName:'window_skin_a', 21 | handler4AlertBtn:function(){ 22 | alert('你点击了确定按钮'); 23 | }, 24 | handler4CloseBtn:function(){ 25 | alert('你点击了关闭按钮'); 26 | } 27 | }); 28 | }); 29 | }); -------------------------------------------------------------------------------- /10.1 模态/js/main.js: -------------------------------------------------------------------------------- 1 | require.config({ 2 | paths:{ 3 | jquery:'jquery-2.1.1.min' 4 | } 5 | }); 6 | 7 | require(['jquery','window'],function($,w){ 8 | $('.btn').click(function(){ 9 | new w.Window().alert({ 10 | title:'提示', 11 | content:'Welcome!!!', 12 | handler:function(){ 13 | alert('you click the button'); 14 | }, 15 | width:300, 16 | height:150, 17 | y:250, 18 | x:600, 19 | hasCloseBtn:true, 20 | text4AlertBtn:'OK', 21 | skinClassName:'window_skin_a', 22 | handler4AlertBtn:function(){ 23 | alert('你点击了确定按钮'); 24 | }, 25 | handler4CloseBtn:function(){ 26 | alert('你点击了关闭按钮'); 27 | } 28 | }); 29 | }); 30 | }); -------------------------------------------------------------------------------- /9.1 定制按钮文案/js/main.js: -------------------------------------------------------------------------------- 1 | require.config({ 2 | paths:{ 3 | jquery:'jquery-2.1.1.min' 4 | } 5 | }); 6 | 7 | require(['jquery','window'],function($,w){ 8 | $('.btn').click(function(){ 9 | new w.Window().alert({ 10 | title:'提示', 11 | content:'Welcome!!!', 12 | handler:function(){ 13 | alert('you click the button'); 14 | }, 15 | width:300, 16 | height:150, 17 | y:250, 18 | x:600, 19 | hasCloseBtn:true, 20 | text4AlertBtn:'OK', 21 | skinClassName:'window_skin_a', 22 | handler4AlertBtn:function(){ 23 | alert('你点击了确定按钮'); 24 | }, 25 | handler4CloseBtn:function(){ 26 | alert('你点击了关闭按钮'); 27 | } 28 | }); 29 | }); 30 | }); -------------------------------------------------------------------------------- /10.1 模态/css/base.css: -------------------------------------------------------------------------------- 1 | body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre, 2 | form,fieldset,input,textarea,p,blockquote,th,td { 3 | padding: 0; 4 | margin: 0; 5 | } 6 | table { 7 | border-collapse: collapse; 8 | border-spacing: 0; 9 | } 10 | fieldset,img { 11 | border: 0; 12 | } 13 | address,caption,cite,code,dfn,em,strong,th,var { 14 | font-weight: normal; 15 | font-style: normal; 16 | } 17 | ol,ul { 18 | list-style: none; 19 | } 20 | caption,th { 21 | text-align: left; 22 | } 23 | h1,h2,h3,h4,h5,h6 { 24 | font-weight: normal; 25 | font-size: 100%; 26 | } 27 | q:before,q:after { 28 | content:''; 29 | } 30 | abbr,acronym { border: 0; 31 | } 32 | html body{ 33 | height: 100%; 34 | } -------------------------------------------------------------------------------- /11.1 拖动/css/base.css: -------------------------------------------------------------------------------- 1 | body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre, 2 | form,fieldset,input,textarea,p,blockquote,th,td { 3 | padding: 0; 4 | margin: 0; 5 | } 6 | table { 7 | border-collapse: collapse; 8 | border-spacing: 0; 9 | } 10 | fieldset,img { 11 | border: 0; 12 | } 13 | address,caption,cite,code,dfn,em,strong,th,var { 14 | font-weight: normal; 15 | font-style: normal; 16 | } 17 | ol,ul { 18 | list-style: none; 19 | } 20 | caption,th { 21 | text-align: left; 22 | } 23 | h1,h2,h3,h4,h5,h6 { 24 | font-weight: normal; 25 | font-size: 100%; 26 | } 27 | q:before,q:after { 28 | content:''; 29 | } 30 | abbr,acronym { border: 0; 31 | } 32 | html body{ 33 | height: 100%; 34 | } -------------------------------------------------------------------------------- /13.1 连缀语法/css/base.css: -------------------------------------------------------------------------------- 1 | body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre, 2 | form,fieldset,input,textarea,p,blockquote,th,td { 3 | padding: 0; 4 | margin: 0; 5 | } 6 | table { 7 | border-collapse: collapse; 8 | border-spacing: 0; 9 | } 10 | fieldset,img { 11 | border: 0; 12 | } 13 | address,caption,cite,code,dfn,em,strong,th,var { 14 | font-weight: normal; 15 | font-style: normal; 16 | } 17 | ol,ul { 18 | list-style: none; 19 | } 20 | caption,th { 21 | text-align: left; 22 | } 23 | h1,h2,h3,h4,h5,h6 { 24 | font-weight: normal; 25 | font-size: 100%; 26 | } 27 | q:before,q:after { 28 | content:''; 29 | } 30 | abbr,acronym { border: 0; 31 | } 32 | html body{ 33 | height: 100%; 34 | } -------------------------------------------------------------------------------- /14.1 widget抽象类/css/base.css: -------------------------------------------------------------------------------- 1 | body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre, 2 | form,fieldset,input,textarea,p,blockquote,th,td { 3 | padding: 0; 4 | margin: 0; 5 | } 6 | table { 7 | border-collapse: collapse; 8 | border-spacing: 0; 9 | } 10 | fieldset,img { 11 | border: 0; 12 | } 13 | address,caption,cite,code,dfn,em,strong,th,var { 14 | font-weight: normal; 15 | font-style: normal; 16 | } 17 | ol,ul { 18 | list-style: none; 19 | } 20 | caption,th { 21 | text-align: left; 22 | } 23 | h1,h2,h3,h4,h5,h6 { 24 | font-weight: normal; 25 | font-size: 100%; 26 | } 27 | q:before,q:after { 28 | content:''; 29 | } 30 | abbr,acronym { border: 0; 31 | } 32 | html body{ 33 | height: 100%; 34 | } -------------------------------------------------------------------------------- /12.2 自定义事件实现(一)/css/base.css: -------------------------------------------------------------------------------- 1 | body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre, 2 | form,fieldset,input,textarea,p,blockquote,th,td { 3 | padding: 0; 4 | margin: 0; 5 | } 6 | table { 7 | border-collapse: collapse; 8 | border-spacing: 0; 9 | } 10 | fieldset,img { 11 | border: 0; 12 | } 13 | address,caption,cite,code,dfn,em,strong,th,var { 14 | font-weight: normal; 15 | font-style: normal; 16 | } 17 | ol,ul { 18 | list-style: none; 19 | } 20 | caption,th { 21 | text-align: left; 22 | } 23 | h1,h2,h3,h4,h5,h6 { 24 | font-weight: normal; 25 | font-size: 100%; 26 | } 27 | q:before,q:after { 28 | content:''; 29 | } 30 | abbr,acronym { border: 0; 31 | } 32 | html body{ 33 | height: 100%; 34 | } -------------------------------------------------------------------------------- /16.1 实现confirm方法(一)/css/base.css: -------------------------------------------------------------------------------- 1 | body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre, 2 | form,fieldset,input,textarea,p,blockquote,th,td { 3 | padding: 0; 4 | margin: 0; 5 | } 6 | table { 7 | border-collapse: collapse; 8 | border-spacing: 0; 9 | } 10 | fieldset,img { 11 | border: 0; 12 | } 13 | address,caption,cite,code,dfn,em,strong,th,var { 14 | font-weight: normal; 15 | font-style: normal; 16 | } 17 | ol,ul { 18 | list-style: none; 19 | } 20 | caption,th { 21 | text-align: left; 22 | } 23 | h1,h2,h3,h4,h5,h6 { 24 | font-weight: normal; 25 | font-size: 100%; 26 | } 27 | q:before,q:after { 28 | content:''; 29 | } 30 | abbr,acronym { border: 0; 31 | } 32 | html body{ 33 | height: 100%; 34 | } -------------------------------------------------------------------------------- /17.1 实现prompt方法(一)/css/base.css: -------------------------------------------------------------------------------- 1 | body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre, 2 | form,fieldset,input,textarea,p,blockquote,th,td { 3 | padding: 0; 4 | margin: 0; 5 | } 6 | table { 7 | border-collapse: collapse; 8 | border-spacing: 0; 9 | } 10 | fieldset,img { 11 | border: 0; 12 | } 13 | address,caption,cite,code,dfn,em,strong,th,var { 14 | font-weight: normal; 15 | font-style: normal; 16 | } 17 | ol,ul { 18 | list-style: none; 19 | } 20 | caption,th { 21 | text-align: left; 22 | } 23 | h1,h2,h3,h4,h5,h6 { 24 | font-weight: normal; 25 | font-size: 100%; 26 | } 27 | q:before,q:after { 28 | content:''; 29 | } 30 | abbr,acronym { border: 0; 31 | } 32 | html body{ 33 | height: 100%; 34 | } -------------------------------------------------------------------------------- /18.1 实现common方法/css/base.css: -------------------------------------------------------------------------------- 1 | body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre, 2 | form,fieldset,input,textarea,p,blockquote,th,td { 3 | padding: 0; 4 | margin: 0; 5 | } 6 | table { 7 | border-collapse: collapse; 8 | border-spacing: 0; 9 | } 10 | fieldset,img { 11 | border: 0; 12 | } 13 | address,caption,cite,code,dfn,em,strong,th,var { 14 | font-weight: normal; 15 | font-style: normal; 16 | } 17 | ol,ul { 18 | list-style: none; 19 | } 20 | caption,th { 21 | text-align: left; 22 | } 23 | h1,h2,h3,h4,h5,h6 { 24 | font-weight: normal; 25 | font-size: 100%; 26 | } 27 | q:before,q:after { 28 | content:''; 29 | } 30 | abbr,acronym { border: 0; 31 | } 32 | html body{ 33 | height: 100%; 34 | } -------------------------------------------------------------------------------- /15.1 widget类 设计统一生命周期(一)/css/base.css: -------------------------------------------------------------------------------- 1 | body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre, 2 | form,fieldset,input,textarea,p,blockquote,th,td { 3 | padding: 0; 4 | margin: 0; 5 | } 6 | table { 7 | border-collapse: collapse; 8 | border-spacing: 0; 9 | } 10 | fieldset,img { 11 | border: 0; 12 | } 13 | address,caption,cite,code,dfn,em,strong,th,var { 14 | font-weight: normal; 15 | font-style: normal; 16 | } 17 | ol,ul { 18 | list-style: none; 19 | } 20 | caption,th { 21 | text-align: left; 22 | } 23 | h1,h2,h3,h4,h5,h6 { 24 | font-weight: normal; 25 | font-size: 100%; 26 | } 27 | q:before,q:after { 28 | content:''; 29 | } 30 | abbr,acronym { border: 0; 31 | } 32 | html body{ 33 | height: 100%; 34 | } -------------------------------------------------------------------------------- /15.2 widget类 设计统一生命周期(二)/css/base.css: -------------------------------------------------------------------------------- 1 | body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre, 2 | form,fieldset,input,textarea,p,blockquote,th,td { 3 | padding: 0; 4 | margin: 0; 5 | } 6 | table { 7 | border-collapse: collapse; 8 | border-spacing: 0; 9 | } 10 | fieldset,img { 11 | border: 0; 12 | } 13 | address,caption,cite,code,dfn,em,strong,th,var { 14 | font-weight: normal; 15 | font-style: normal; 16 | } 17 | ol,ul { 18 | list-style: none; 19 | } 20 | caption,th { 21 | text-align: left; 22 | } 23 | h1,h2,h3,h4,h5,h6 { 24 | font-weight: normal; 25 | font-size: 100%; 26 | } 27 | q:before,q:after { 28 | content:''; 29 | } 30 | abbr,acronym { border: 0; 31 | } 32 | html body{ 33 | height: 100%; 34 | } -------------------------------------------------------------------------------- /11.1 拖动/js/main.js: -------------------------------------------------------------------------------- 1 | require.config({ 2 | paths:{ 3 | jquery:'jquery-2.1.1.min', 4 | jqueryUI:'jquery-ui.min' 5 | } 6 | }); 7 | 8 | require(['jquery','window'],function($,w){ 9 | $('.btn').click(function(){ 10 | new w.Window().alert({ 11 | title:'提示', 12 | content:'Welcome!!!', 13 | handler:function(){ 14 | alert('you click the button'); 15 | }, 16 | width:300, 17 | height:150, 18 | y:250, 19 | x:600, 20 | hasCloseBtn:true, 21 | text4AlertBtn:'OK', 22 | dragHandle:'.window_header', 23 | skinClassName:'window_skin_a', 24 | handler4AlertBtn:function(){ 25 | alert('你点击了确定按钮'); 26 | }, 27 | handler4CloseBtn:function(){ 28 | alert('你点击了关闭按钮'); 29 | } 30 | }); 31 | }); 32 | }); -------------------------------------------------------------------------------- /6.1 定制标题/css/window.css: -------------------------------------------------------------------------------- 1 | .btn{ 2 | text-decoration: none; 3 | padding:5px 10px; 4 | width: 50px; 5 | text-align: center; 6 | display: block; 7 | margin: 100px; 8 | background: #ddd; 9 | } 10 | 11 | .window_boundingBox{ 12 | position: fixed; 13 | border: 1px solid #ddd; 14 | width: 500px; 15 | height: 300px; 16 | left: 50%; 17 | margin-left: -250px; 18 | top:100px; 19 | box-shadow: 0 0 12px #888; 20 | } 21 | 22 | .window_boundingBox input{ 23 | width: 100px; 24 | position: absolute; 25 | bottom: 10px; 26 | left: 50%; 27 | margin-left: -50px; 28 | } 29 | 30 | .window_header{ 31 | background: #999; 32 | color: #fff; 33 | text-align: center; 34 | padding: 5px; 35 | font-size: 20px; 36 | } 37 | 38 | .window_body{ 39 | padding: 10px; 40 | } -------------------------------------------------------------------------------- /7.1 定制关闭按钮/css/window.css: -------------------------------------------------------------------------------- 1 | .btn{ 2 | text-decoration: none; 3 | padding:5px 10px; 4 | width: 50px; 5 | text-align: center; 6 | display: block; 7 | margin: 100px; 8 | background: #ddd; 9 | } 10 | 11 | .window_boundingBox{ 12 | position: fixed; 13 | border: 1px solid #ddd; 14 | width: 500px; 15 | height: 300px; 16 | left: 50%; 17 | margin-left: -250px; 18 | top:100px; 19 | box-shadow: 0 0 12px #888; 20 | } 21 | 22 | .window_alertBtn{ 23 | width: 100px; 24 | position: absolute; 25 | bottom: 10px; 26 | left: 50%; 27 | margin-left: -50px; 28 | } 29 | 30 | .window_header{ 31 | background: #999; 32 | color: #fff; 33 | text-align: center; 34 | padding: 5px; 35 | font-size: 20px; 36 | } 37 | 38 | .window_body{ 39 | padding: 10px; 40 | } 41 | 42 | .window_closeBtn{ 43 | position: absolute; 44 | right: 0; 45 | top: 0; 46 | font-size: 20px; 47 | color: #fff; 48 | background: red; 49 | cursor: pointer; 50 | padding: 5px; 51 | } -------------------------------------------------------------------------------- /4.1 定制长宽和位置/js/window.js: -------------------------------------------------------------------------------- 1 | define(['jquery'],function($){ 2 | function Window(){ 3 | this.cfg = { 4 | width:500, 5 | height:300 6 | }; 7 | } 8 | 9 | Window.prototype = { 10 | alert:function(content,handler,cfg){ 11 | var boudingBox = $('
'); 12 | boudingBox.appendTo('body'); 13 | boudingBox.html(content); 14 | var btn = $(''); 15 | btn.appendTo(boudingBox); 16 | btn.click(function(){ 17 | handler && handler(); //判断是否传入执行操作的函数,如果传入就执行 18 | boudingBox.remove(); 19 | }); 20 | $.extend(this.cfg,cfg); 21 | boudingBox.css({ 22 | width:this.cfg.width+'px', 23 | height:this.cfg.height+'px', 24 | left:(this.cfg.x||(window.innerWidth-this.cfg.width)/2)+'px', 25 | top:(this.cfg.y||(window.innerHeight-this.cfg.height)/2)+'px' 26 | }); 27 | }, 28 | confirm:function(){}, 29 | prompt:function(){} 30 | } 31 | 32 | return{ 33 | Window : Window 34 | } 35 | }) -------------------------------------------------------------------------------- /15.2 widget类 设计统一生命周期(二)/js/main.js: -------------------------------------------------------------------------------- 1 | require.config({ 2 | paths:{ 3 | jquery:'jquery-2.1.1.min', 4 | jqueryUI:'jquery-ui.min' 5 | } 6 | }); 7 | 8 | require(['jquery','window'],function($,w){ 9 | $('.btn').click(function(){ 10 | var win = new w.Window().alert({ 11 | title:'提示', 12 | content:'Welcome!!!', 13 | width:300, 14 | height:150, 15 | y:250, 16 | x:600, 17 | hasCloseBtn:true, 18 | text4AlertBtn:'OK', 19 | dragHandle:'.window_header', 20 | skinClassName:'window_skin_a', 21 | // handler4AlertBtn:function(){ 22 | // alert('你点击了确定按钮'); 23 | // }, 24 | // handler4CloseBtn:function(){ 25 | // alert('你点击了关闭按钮'); 26 | // } 27 | }).on('alert',function(){ 28 | alert('你点击了确定按钮') 29 | }).on('alert',function(){ 30 | alert('确定按钮第二次回调') 31 | }).on('alert',function(){ 32 | alert('确定按钮第三次回调') 33 | }).on('close',function(){ 34 | alert('第一次点击了关闭按钮') 35 | }).on('close',function(){ 36 | alert('关闭按钮第二次回调') 37 | }); 38 | }); 39 | }); -------------------------------------------------------------------------------- /5.1 调整接口格式/js/window.js: -------------------------------------------------------------------------------- 1 | define(['jquery'],function($){ 2 | function Window(){ 3 | this.cfg = { 4 | width:500, 5 | height:300, 6 | content:"", 7 | handler:null 8 | }; 9 | } 10 | 11 | Window.prototype = { 12 | alert:function(cfg){ 13 | var CFG = $.extend(this.cfg,cfg); 14 | var boudingBox = $('
'); 15 | boudingBox.appendTo('body'); 16 | boudingBox.html(CFG.content); 17 | var btn = $(''); 18 | btn.appendTo(boudingBox); 19 | btn.click(function(){ 20 | CFG.handler && CFG.handler(); //判断是否传入执行操作的函数,如果传入就执行 21 | boudingBox.remove(); 22 | }); 23 | $.extend(this.cfg,cfg); 24 | boudingBox.css({ 25 | width:CFG.width+'px', 26 | height:CFG.height+'px', 27 | left:(CFG.x||(window.innerWidth-CFG.width)/2)+'px', 28 | top:(CFG.y||(window.innerHeight-CFG.height)/2)+'px' 29 | }); 30 | }, 31 | confirm:function(){}, 32 | prompt:function(){} 33 | } 34 | 35 | return{ 36 | Window : Window 37 | } 38 | }) -------------------------------------------------------------------------------- /12.2 自定义事件实现(一)/js/main.js: -------------------------------------------------------------------------------- 1 | require.config({ 2 | paths:{ 3 | jquery:'jquery-2.1.1.min', 4 | jqueryUI:'jquery-ui.min' 5 | } 6 | }); 7 | 8 | require(['jquery','window'],function($,w){ 9 | $('.btn').click(function(){ 10 | var win = new w.Window(); 11 | win.alert({ 12 | title:'提示', 13 | content:'Welcome!!!', 14 | handler:function(){ 15 | alert('you click the button'); 16 | }, 17 | width:300, 18 | height:150, 19 | y:250, 20 | x:600, 21 | hasCloseBtn:true, 22 | text4AlertBtn:'OK', 23 | dragHandle:'.window_header', 24 | skinClassName:'window_skin_a', 25 | // handler4AlertBtn:function(){ 26 | // alert('你点击了确定按钮'); 27 | // }, 28 | // handler4CloseBtn:function(){ 29 | // alert('你点击了关闭按钮'); 30 | // } 31 | }); 32 | win.on('alert',function(){alert('你点击了确定按钮')}); 33 | win.on('alert',function(){alert('确定按钮第二次回调')}); 34 | win.on('alert',function(){alert('确定按钮第三次回调')}); 35 | win.on('close',function(){alert('第一次点击了关闭按钮')}); 36 | win.on('close',function(){alert('关闭按钮第二次回调')}); 37 | }); 38 | }); -------------------------------------------------------------------------------- /13.1 连缀语法/js/main.js: -------------------------------------------------------------------------------- 1 | require.config({ 2 | paths:{ 3 | jquery:'jquery-2.1.1.min', 4 | jqueryUI:'jquery-ui.min' 5 | } 6 | }); 7 | 8 | require(['jquery','window'],function($,w){ 9 | $('.btn').click(function(){ 10 | var win = new w.Window(); 11 | win.alert({ 12 | title:'提示', 13 | content:'Welcome!!!', 14 | handler:function(){ 15 | alert('you click the button'); 16 | }, 17 | width:300, 18 | height:150, 19 | y:250, 20 | x:600, 21 | hasCloseBtn:true, 22 | text4AlertBtn:'OK', 23 | dragHandle:'.window_header', 24 | skinClassName:'window_skin_a', 25 | // handler4AlertBtn:function(){ 26 | // alert('你点击了确定按钮'); 27 | // }, 28 | // handler4CloseBtn:function(){ 29 | // alert('你点击了关闭按钮'); 30 | // } 31 | }).on('alert',function(){ 32 | alert('你点击了确定按钮') 33 | }).on('alert',function(){ 34 | alert('确定按钮第二次回调') 35 | }).on('alert',function(){ 36 | alert('确定按钮第三次回调') 37 | }).on('close',function(){ 38 | alert('第一次点击了关闭按钮') 39 | }).on('close',function(){ 40 | alert('关闭按钮第二次回调') 41 | }); 42 | }); 43 | }); -------------------------------------------------------------------------------- /14.1 widget抽象类/js/main.js: -------------------------------------------------------------------------------- 1 | require.config({ 2 | paths:{ 3 | jquery:'jquery-2.1.1.min', 4 | jqueryUI:'jquery-ui.min' 5 | } 6 | }); 7 | 8 | require(['jquery','window'],function($,w){ 9 | $('.btn').click(function(){ 10 | var win = new w.Window(); 11 | win.alert({ 12 | title:'提示', 13 | content:'Welcome!!!', 14 | handler:function(){ 15 | alert('you click the button'); 16 | }, 17 | width:300, 18 | height:150, 19 | y:250, 20 | x:600, 21 | hasCloseBtn:true, 22 | text4AlertBtn:'OK', 23 | dragHandle:'.window_header', 24 | skinClassName:'window_skin_a', 25 | // handler4AlertBtn:function(){ 26 | // alert('你点击了确定按钮'); 27 | // }, 28 | // handler4CloseBtn:function(){ 29 | // alert('你点击了关闭按钮'); 30 | // } 31 | }).on('alert',function(){ 32 | alert('你点击了确定按钮') 33 | }).on('alert',function(){ 34 | alert('确定按钮第二次回调') 35 | }).on('alert',function(){ 36 | alert('确定按钮第三次回调') 37 | }).on('close',function(){ 38 | alert('第一次点击了关闭按钮') 39 | }).on('close',function(){ 40 | alert('关闭按钮第二次回调') 41 | }); 42 | }); 43 | }); -------------------------------------------------------------------------------- /15.1 widget类 设计统一生命周期(一)/js/main.js: -------------------------------------------------------------------------------- 1 | require.config({ 2 | paths:{ 3 | jquery:'jquery-2.1.1.min', 4 | jqueryUI:'jquery-ui.min' 5 | } 6 | }); 7 | 8 | require(['jquery','window'],function($,w){ 9 | $('.btn').click(function(){ 10 | var win = new w.Window(); 11 | win.alert({ 12 | title:'提示', 13 | content:'Welcome!!!', 14 | handler:function(){ 15 | alert('you click the button'); 16 | }, 17 | width:300, 18 | height:150, 19 | y:250, 20 | x:600, 21 | hasCloseBtn:true, 22 | text4AlertBtn:'OK', 23 | dragHandle:'.window_header', 24 | skinClassName:'window_skin_a', 25 | // handler4AlertBtn:function(){ 26 | // alert('你点击了确定按钮'); 27 | // }, 28 | // handler4CloseBtn:function(){ 29 | // alert('你点击了关闭按钮'); 30 | // } 31 | }).on('alert',function(){ 32 | alert('你点击了确定按钮') 33 | }).on('alert',function(){ 34 | alert('确定按钮第二次回调') 35 | }).on('alert',function(){ 36 | alert('确定按钮第三次回调') 37 | }).on('close',function(){ 38 | alert('第一次点击了关闭按钮') 39 | }).on('close',function(){ 40 | alert('关闭按钮第二次回调') 41 | }); 42 | }); 43 | }); -------------------------------------------------------------------------------- /15.1 widget类 设计统一生命周期(一)/js/widget.js: -------------------------------------------------------------------------------- 1 | define(['jquery'],function($){ 2 | function Widget(){ 3 | this.boudingBox = null; //属性:最外层容器 4 | } 5 | Widget.prototype={ 6 | on:function(type,handler){ 7 | if (typeof this.handlers[type]=='undefined') { 8 | this.handlers[type]=[]; 9 | } 10 | this.handlers[type].push(handler); 11 | return this; 12 | }, 13 | fire:function(type,data){ 14 | if (this.handlers[type] instanceof Array) { 15 | var handlers = this.handlers[type]; 16 | for(var i=0,len=handlers.length;i'+ 17 | '
'+CFG.title+'
'+ 18 | '
'+CFG.content+'
'+ 19 | ''+ 20 | '' 21 | ), 22 | btn = boudingBox.find('.window_footer input') 23 | boudingBox.appendTo('body'); 24 | btn.click(function(){ 25 | CFG.handler && CFG.handler(); //判断是否传入执行操作的函数,如果传入就执行 26 | boudingBox.remove(); 27 | }); 28 | $.extend(this.cfg,cfg); 29 | boudingBox.css({ 30 | width:CFG.width+'px', 31 | height:CFG.height+'px', 32 | left:(CFG.x||(window.innerWidth-CFG.width)/2)+'px', 33 | top:(CFG.y||(window.innerHeight-CFG.height)/2)+'px' 34 | }); 35 | }, 36 | confirm:function(){}, 37 | prompt:function(){} 38 | } 39 | 40 | return{ 41 | Window : Window 42 | } 43 | }) -------------------------------------------------------------------------------- /16.1 实现confirm方法(一)/js/main.js: -------------------------------------------------------------------------------- 1 | require.config({ 2 | paths:{ 3 | jquery:'jquery-2.1.1.min', 4 | jqueryUI:'jquery-ui.min' 5 | } 6 | }); 7 | 8 | require(['jquery','window'],function($,w){ 9 | $('.btn_alert').click(function(){ 10 | var win = new w.Window().alert({ 11 | title:'提示', 12 | content:'Welcome!!!', 13 | width:300, 14 | height:150, 15 | y:250, 16 | x:600, 17 | hasCloseBtn:true, 18 | text4AlertBtn:'OK', 19 | dragHandle:'.window_header', 20 | skinClassName:'window_skin_a', 21 | // handler4AlertBtn:function(){ 22 | // alert('你点击了确定按钮'); 23 | // }, 24 | // handler4CloseBtn:function(){ 25 | // alert('你点击了关闭按钮'); 26 | // } 27 | }).on('alert',function(){ 28 | alert('你点击了确定按钮') 29 | }).on('alert',function(){ 30 | alert('确定按钮第二次回调') 31 | }).on('alert',function(){ 32 | alert('确定按钮第三次回调') 33 | }).on('close',function(){ 34 | alert('第一次点击了关闭按钮') 35 | }).on('close',function(){ 36 | alert('关闭按钮第二次回调') 37 | }); 38 | }); 39 | 40 | $('.btn_confirm').click(function(){ 41 | var win = new w.Window().confirm({ 42 | title:'系统消息', 43 | content:'您确定要删除这个文件吗', 44 | width:300, 45 | height:150, 46 | y:50, 47 | x:600, 48 | text4ConfirmBtn:'是', 49 | text4CancelBtn:'否', 50 | dragHandle:'.window_header' 51 | }).on('confirm',function(){ 52 | alert('确定'); 53 | }).on('cancel',function(){ 54 | alert('取消'); 55 | }); 56 | }); 57 | 58 | }); -------------------------------------------------------------------------------- /7.1 定制关闭按钮/js/window.js: -------------------------------------------------------------------------------- 1 | define(['jquery'],function($){ 2 | function Window(){ 3 | this.cfg = { 4 | width:500, 5 | height:300, 6 | title:'系统消息', 7 | content:"", 8 | hasCloseBtn:false, 9 | handler4AlertBtn:null, 10 | handler4CloseBtn:null 11 | }; 12 | } 13 | 14 | Window.prototype = { 15 | alert:function(cfg){ 16 | var CFG = $.extend(this.cfg,cfg), 17 | boudingBox = $( 18 | '
'+ 19 | '
'+CFG.title+'
'+ 20 | '
'+CFG.content+'
'+ 21 | ''+ 22 | '
' 23 | ), 24 | btn = boudingBox.find('.window_alertBtn'); 25 | boudingBox.appendTo('body'); 26 | btn.click(function(){ 27 | CFG.handler4AlertBtn && CFG.handler4AlertBtn(); //弹出窗口的确定按钮处理函数 28 | boudingBox.remove(); 29 | }); 30 | $.extend(this.cfg,cfg); 31 | boudingBox.css({ 32 | width:CFG.width+'px', 33 | height:CFG.height+'px', 34 | left:(CFG.x||(window.innerWidth-CFG.width)/2)+'px', 35 | top:(CFG.y||(window.innerHeight-CFG.height)/2)+'px' 36 | }); 37 | if(CFG.hasCloseBtn){ 38 | var closeBtn = $('X'); 39 | closeBtn.appendTo(boudingBox); 40 | closeBtn.click(function(){ 41 | CFG.handler4CloseBtn&&CFG.handler4CloseBtn(); //弹出窗口的关闭按钮处理函数 42 | boudingBox.remove(); 43 | }); 44 | } 45 | }, 46 | confirm:function(){}, 47 | prompt:function(){} 48 | } 49 | 50 | return{ 51 | Window : Window 52 | } 53 | }) -------------------------------------------------------------------------------- /8.1 定制皮肤/css/window.css: -------------------------------------------------------------------------------- 1 | .btn{ 2 | text-decoration: none; 3 | padding:5px 10px; 4 | width: 50px; 5 | text-align: center; 6 | display: block; 7 | margin: 100px; 8 | background: #ddd; 9 | } 10 | 11 | .window_boundingBox{ 12 | position: fixed; 13 | border: 1px solid #ddd; 14 | width: 500px; 15 | height: 300px; 16 | left: 50%; 17 | margin-left: -250px; 18 | top:100px; 19 | box-shadow: 0 0 12px #888; 20 | } 21 | 22 | .window_alertBtn{ 23 | width: 100px; 24 | position: absolute; 25 | bottom: 10px; 26 | left: 50%; 27 | margin-left: -50px; 28 | } 29 | 30 | .window_header{ 31 | background: #999; 32 | color: #fff; 33 | text-align: center; 34 | padding: 5px; 35 | font-size: 20px; 36 | } 37 | 38 | .window_body{ 39 | padding: 10px; 40 | } 41 | 42 | .window_closeBtn{ 43 | position: absolute; 44 | right: 0; 45 | top: 0; 46 | font-size: 20px; 47 | color: #fff; 48 | background: red; 49 | cursor: pointer; 50 | padding: 5px; 51 | } 52 | 53 | /*skin for window_skin_a*/ 54 | .window_skin_a.window_boudingBox{ 55 | box-shadow: none; 56 | border: 5px solid #ddc; 57 | border-radius: 5px; 58 | } 59 | 60 | .window_skin_a .window_alertBtn{ 61 | width: 50px; 62 | left: auto; 63 | right: 20px; 64 | margin-left: 0; 65 | background:red; 66 | border: none; 67 | color: #fff; 68 | padding: 10px; 69 | } 70 | 71 | .window_skin_a .window_header{ 72 | background: red; 73 | text-align: left; 74 | padding: 10px; 75 | font-weight: bold; 76 | } 77 | 78 | .window_skin_a .window_closeBtn{ 79 | width: 45px; 80 | height: 45px; 81 | border-radius: 45px; 82 | line-height: 45px; 83 | padding: 0; 84 | text-align: center; 85 | background: blue; 86 | font-size: 24px; 87 | font-weight: bold; 88 | right: -15px; 89 | top: -15px; 90 | } -------------------------------------------------------------------------------- /8.1 定制皮肤/js/window.js: -------------------------------------------------------------------------------- 1 | define(['jquery'],function($){ 2 | function Window(){ 3 | this.cfg = { 4 | width:500, 5 | height:300, 6 | title:'系统消息', 7 | content:"", 8 | hasCloseBtn:false, 9 | skinClassName:null, 10 | handler4AlertBtn:null, 11 | handler4CloseBtn:null 12 | }; 13 | } 14 | 15 | Window.prototype = { 16 | alert:function(cfg){ 17 | var CFG = $.extend(this.cfg,cfg), 18 | boudingBox = $( 19 | '
'+ 20 | '
'+CFG.title+'
'+ 21 | '
'+CFG.content+'
'+ 22 | ''+ 23 | '
' 24 | ), 25 | btn = boudingBox.find('.window_alertBtn'); 26 | boudingBox.appendTo('body'); 27 | btn.click(function(){ 28 | CFG.handler4AlertBtn && CFG.handler4AlertBtn(); //弹出窗口的确定按钮处理函数 29 | boudingBox.remove(); 30 | }); 31 | $.extend(this.cfg,cfg); 32 | boudingBox.css({ 33 | width:CFG.width+'px', 34 | height:CFG.height+'px', 35 | left:(CFG.x||(window.innerWidth-CFG.width)/2)+'px', 36 | top:(CFG.y||(window.innerHeight-CFG.height)/2)+'px' 37 | }); 38 | if(CFG.hasCloseBtn){ 39 | var closeBtn = $('X'); 40 | closeBtn.appendTo(boudingBox); 41 | closeBtn.click(function(){ 42 | CFG.handler4CloseBtn&&CFG.handler4CloseBtn(); //弹出窗口的关闭按钮处理函数 43 | boudingBox.remove(); 44 | }); 45 | } 46 | if (CFG.skinClassName) { 47 | boudingBox.addClass(CFG.skinClassName); 48 | }; 49 | 50 | }, 51 | confirm:function(){}, 52 | prompt:function(){} 53 | } 54 | 55 | return{ 56 | Window : Window 57 | } 58 | }) -------------------------------------------------------------------------------- /9.1 定制按钮文案/css/window.css: -------------------------------------------------------------------------------- 1 | .btn{ 2 | text-decoration: none; 3 | padding:5px 10px; 4 | width: 50px; 5 | text-align: center; 6 | display: block; 7 | margin: 100px; 8 | background: #ddd; 9 | } 10 | 11 | .window_boundingBox{ 12 | position: fixed; 13 | border: 1px solid #ddd; 14 | width: 500px; 15 | height: 300px; 16 | left: 50%; 17 | margin-left: -250px; 18 | top:100px; 19 | box-shadow: 0 0 12px #888; 20 | } 21 | 22 | .window_alertBtn{ 23 | width: 100px; 24 | position: absolute; 25 | bottom: 10px; 26 | left: 50%; 27 | margin-left: -50px; 28 | } 29 | 30 | .window_header{ 31 | background: #999; 32 | color: #fff; 33 | text-align: center; 34 | padding: 5px; 35 | font-size: 20px; 36 | } 37 | 38 | .window_body{ 39 | padding: 10px; 40 | } 41 | 42 | .window_closeBtn{ 43 | position: absolute; 44 | right: 0; 45 | top: 0; 46 | font-size: 20px; 47 | color: #fff; 48 | background: red; 49 | cursor: pointer; 50 | padding: 5px; 51 | } 52 | 53 | /*skin for window_skin_a*/ 54 | .window_skin_a.window_boudingBox{ 55 | box-shadow: none; 56 | border: 5px solid #ddc; 57 | border-radius: 5px; 58 | } 59 | 60 | .window_skin_a .window_alertBtn{ 61 | width: 50px; 62 | left: auto; 63 | right: 20px; 64 | margin-left: 0; 65 | background:red; 66 | border: none; 67 | color: #fff; 68 | padding: 10px; 69 | } 70 | 71 | .window_skin_a .window_header{ 72 | background: red; 73 | text-align: left; 74 | padding: 10px; 75 | font-weight: bold; 76 | } 77 | 78 | .window_skin_a .window_closeBtn{ 79 | width: 45px; 80 | height: 45px; 81 | border-radius: 45px; 82 | line-height: 45px; 83 | padding: 0; 84 | text-align: center; 85 | background: blue; 86 | font-size: 24px; 87 | font-weight: bold; 88 | right: -15px; 89 | top: -15px; 90 | } -------------------------------------------------------------------------------- /9.1 定制按钮文案/js/window.js: -------------------------------------------------------------------------------- 1 | define(['jquery'],function($){ 2 | function Window(){ 3 | this.cfg = { 4 | width:500, 5 | height:300, 6 | title:'系统消息', 7 | content:"", 8 | hasCloseBtn:false, 9 | skinClassName:null, 10 | text4AlertBtn:'确定', 11 | handler4AlertBtn:null, 12 | handler4CloseBtn:null 13 | }; 14 | } 15 | 16 | Window.prototype = { 17 | alert:function(cfg){ 18 | var CFG = $.extend(this.cfg,cfg), 19 | boudingBox = $( 20 | '
'+ 21 | '
'+CFG.title+'
'+ 22 | '
'+CFG.content+'
'+ 23 | ''+ 24 | '
' 25 | ), 26 | btn = boudingBox.find('.window_alertBtn'); 27 | boudingBox.appendTo('body'); 28 | btn.click(function(){ 29 | CFG.handler4AlertBtn && CFG.handler4AlertBtn(); //弹出窗口的确定按钮处理函数 30 | boudingBox.remove(); 31 | }); 32 | $.extend(this.cfg,cfg); 33 | boudingBox.css({ 34 | width:CFG.width+'px', 35 | height:CFG.height+'px', 36 | left:(CFG.x||(window.innerWidth-CFG.width)/2)+'px', 37 | top:(CFG.y||(window.innerHeight-CFG.height)/2)+'px' 38 | }); 39 | if(CFG.hasCloseBtn){ 40 | var closeBtn = $('X'); 41 | closeBtn.appendTo(boudingBox); 42 | closeBtn.click(function(){ 43 | CFG.handler4CloseBtn&&CFG.handler4CloseBtn(); //弹出窗口的关闭按钮处理函数 44 | boudingBox.remove(); 45 | }); 46 | } 47 | if (CFG.skinClassName) { 48 | boudingBox.addClass(CFG.skinClassName); 49 | }; 50 | 51 | }, 52 | confirm:function(){}, 53 | prompt:function(){} 54 | } 55 | 56 | return{ 57 | Window : Window 58 | } 59 | }) -------------------------------------------------------------------------------- /17.1 实现prompt方法(一)/js/main.js: -------------------------------------------------------------------------------- 1 | require.config({ 2 | paths:{ 3 | jquery:'jquery-2.1.1.min', 4 | jqueryUI:'jquery-ui.min' 5 | } 6 | }); 7 | 8 | require(['jquery','window'],function($,w){ 9 | $('.btn_alert').click(function(){ 10 | var win = new w.Window().alert({ 11 | title:'提示', 12 | content:'Welcome!!!', 13 | width:300, 14 | height:150, 15 | y:250, 16 | x:600, 17 | hasCloseBtn:true, 18 | text4AlertBtn:'OK', 19 | dragHandle:'.window_header', 20 | skinClassName:'window_skin_a', 21 | // handler4AlertBtn:function(){ 22 | // alert('你点击了确定按钮'); 23 | // }, 24 | // handler4CloseBtn:function(){ 25 | // alert('你点击了关闭按钮'); 26 | // } 27 | }).on('alert',function(){ 28 | alert('你点击了确定按钮') 29 | }).on('alert',function(){ 30 | alert('确定按钮第二次回调') 31 | }).on('alert',function(){ 32 | alert('确定按钮第三次回调') 33 | }).on('close',function(){ 34 | alert('第一次点击了关闭按钮') 35 | }).on('close',function(){ 36 | alert('关闭按钮第二次回调') 37 | }); 38 | }); 39 | 40 | $('.btn_confirm').click(function(){ 41 | var win = new w.Window().confirm({ 42 | title:'系统消息', 43 | content:'您确定要删除这个文件吗', 44 | width:300, 45 | height:150, 46 | y:50, 47 | x:600, 48 | text4ConfirmBtn:'是', 49 | text4CancelBtn:'否', 50 | dragHandle:'.window_header' 51 | }).on('confirm',function(){ 52 | alert('确定'); 53 | }).on('cancel',function(){ 54 | alert('取消'); 55 | }); 56 | }); 57 | 58 | $('.btn_prompt').click(function(){ 59 | var win = new w.Window().prompt({ 60 | title:'请输入您的名字', 61 | content:'我们将会为您保密您输入的信息', 62 | width:300, 63 | height:150, 64 | y:50, 65 | text4PromptBtn:'输入', 66 | text4CancelBtn:'取消', 67 | defaultValue4PromptInput:'张三', 68 | dragHandle:'.window_header', 69 | handler4PromptBtn:function(inputVlaue){ 70 | alert('您输入的内容是:'+inputVlaue); 71 | }, 72 | handler4CancelBtn:function(){ 73 | alert('取消'); 74 | } 75 | }); 76 | }); 77 | }); -------------------------------------------------------------------------------- /10.1 模态/css/window.css: -------------------------------------------------------------------------------- 1 | .btn{ 2 | text-decoration: none; 3 | padding:5px 10px; 4 | width: 50px; 5 | text-align: center; 6 | display: block; 7 | margin: 100px; 8 | background: #ddd; 9 | } 10 | 11 | .window_boundingBox{ 12 | position: fixed; 13 | border: 1px solid #ddd; 14 | width: 500px; 15 | height: 300px; 16 | left: 50%; 17 | margin-left: -250px; 18 | top:100px; 19 | box-shadow: 0 0 12px #888; 20 | background: #fff; 21 | } 22 | 23 | .window_mask{ 24 | width: 100%; 25 | height: 100%; 26 | background: #000; 27 | opacity: .3; 28 | position: absolute; 29 | left: 0; 30 | top: 0; 31 | } 32 | 33 | .window_alertBtn{ 34 | width: 100px; 35 | position: absolute; 36 | bottom: 10px; 37 | left: 50%; 38 | margin-left: -50px; 39 | } 40 | 41 | .window_header{ 42 | background: #999; 43 | color: #fff; 44 | text-align: center; 45 | padding: 5px; 46 | font-size: 20px; 47 | } 48 | 49 | .window_body{ 50 | padding: 10px; 51 | } 52 | 53 | .window_closeBtn{ 54 | position: absolute; 55 | right: 0; 56 | top: 0; 57 | font-size: 20px; 58 | color: #fff; 59 | background: red; 60 | cursor: pointer; 61 | padding: 5px; 62 | } 63 | 64 | /*skin for window_skin_a*/ 65 | .window_skin_a.window_boudingBox{ 66 | box-shadow: none; 67 | border: 5px solid #ddc; 68 | border-radius: 5px; 69 | } 70 | 71 | .window_skin_a .window_alertBtn{ 72 | width: 50px; 73 | left: auto; 74 | right: 20px; 75 | margin-left: 0; 76 | background:red; 77 | border: none; 78 | color: #fff; 79 | padding: 10px; 80 | } 81 | 82 | .window_skin_a .window_header{ 83 | background: red; 84 | text-align: left; 85 | padding: 10px; 86 | font-weight: bold; 87 | } 88 | 89 | .window_skin_a .window_closeBtn{ 90 | width: 45px; 91 | height: 45px; 92 | border-radius: 45px; 93 | line-height: 45px; 94 | padding: 0; 95 | text-align: center; 96 | background: blue; 97 | font-size: 24px; 98 | font-weight: bold; 99 | right: -15px; 100 | top: -15px; 101 | } -------------------------------------------------------------------------------- /11.1 拖动/css/window.css: -------------------------------------------------------------------------------- 1 | .btn{ 2 | text-decoration: none; 3 | padding:5px 10px; 4 | width: 50px; 5 | text-align: center; 6 | display: block; 7 | margin: 100px; 8 | background: #ddd; 9 | } 10 | 11 | .window_boundingBox{ 12 | position: fixed; 13 | border: 1px solid #ddd; 14 | width: 500px; 15 | height: 300px; 16 | left: 50%; 17 | margin-left: -250px; 18 | top:100px; 19 | box-shadow: 0 0 12px #888; 20 | background: #fff; 21 | } 22 | 23 | .window_mask{ 24 | width: 100%; 25 | height: 100%; 26 | background: #000; 27 | opacity: .3; 28 | position: absolute; 29 | left: 0; 30 | top: 0; 31 | } 32 | 33 | .window_alertBtn{ 34 | width: 100px; 35 | position: absolute; 36 | bottom: 10px; 37 | left: 50%; 38 | margin-left: -50px; 39 | } 40 | 41 | .window_header{ 42 | background: #999; 43 | color: #fff; 44 | text-align: center; 45 | padding: 5px; 46 | font-size: 20px; 47 | } 48 | 49 | .window_body{ 50 | padding: 10px; 51 | } 52 | 53 | .window_closeBtn{ 54 | position: absolute; 55 | right: 0; 56 | top: 0; 57 | font-size: 20px; 58 | color: #fff; 59 | background: red; 60 | cursor: pointer; 61 | padding: 5px; 62 | } 63 | 64 | /*skin for window_skin_a*/ 65 | .window_skin_a.window_boudingBox{ 66 | box-shadow: none; 67 | border: 5px solid #ddc; 68 | border-radius: 5px; 69 | } 70 | 71 | .window_skin_a .window_alertBtn{ 72 | width: 50px; 73 | left: auto; 74 | right: 20px; 75 | margin-left: 0; 76 | background:red; 77 | border: none; 78 | color: #fff; 79 | padding: 10px; 80 | } 81 | 82 | .window_skin_a .window_header{ 83 | background: red; 84 | text-align: left; 85 | padding: 10px; 86 | font-weight: bold; 87 | } 88 | 89 | .window_skin_a .window_closeBtn{ 90 | width: 45px; 91 | height: 45px; 92 | border-radius: 45px; 93 | line-height: 45px; 94 | padding: 0; 95 | text-align: center; 96 | background: blue; 97 | font-size: 24px; 98 | font-weight: bold; 99 | right: -15px; 100 | top: -15px; 101 | } -------------------------------------------------------------------------------- /13.1 连缀语法/css/window.css: -------------------------------------------------------------------------------- 1 | .btn{ 2 | text-decoration: none; 3 | padding:5px 10px; 4 | width: 50px; 5 | text-align: center; 6 | display: block; 7 | margin: 100px; 8 | background: #ddd; 9 | } 10 | 11 | .window_boundingBox{ 12 | position: fixed; 13 | border: 1px solid #ddd; 14 | width: 500px; 15 | height: 300px; 16 | left: 50%; 17 | margin-left: -250px; 18 | top:100px; 19 | box-shadow: 0 0 12px #888; 20 | background: #fff; 21 | } 22 | 23 | .window_mask{ 24 | width: 100%; 25 | height: 100%; 26 | background: #000; 27 | opacity: .3; 28 | position: absolute; 29 | left: 0; 30 | top: 0; 31 | } 32 | 33 | .window_alertBtn{ 34 | width: 100px; 35 | position: absolute; 36 | bottom: 10px; 37 | left: 50%; 38 | margin-left: -50px; 39 | } 40 | 41 | .window_header{ 42 | background: #999; 43 | color: #fff; 44 | text-align: center; 45 | padding: 5px; 46 | font-size: 20px; 47 | } 48 | 49 | .window_body{ 50 | padding: 10px; 51 | } 52 | 53 | .window_closeBtn{ 54 | position: absolute; 55 | right: 0; 56 | top: 0; 57 | font-size: 20px; 58 | color: #fff; 59 | background: red; 60 | cursor: pointer; 61 | padding: 5px; 62 | } 63 | 64 | /*skin for window_skin_a*/ 65 | .window_skin_a.window_boudingBox{ 66 | box-shadow: none; 67 | border: 5px solid #ddc; 68 | border-radius: 5px; 69 | } 70 | 71 | .window_skin_a .window_alertBtn{ 72 | width: 50px; 73 | left: auto; 74 | right: 20px; 75 | margin-left: 0; 76 | background:red; 77 | border: none; 78 | color: #fff; 79 | padding: 10px; 80 | } 81 | 82 | .window_skin_a .window_header{ 83 | background: red; 84 | text-align: left; 85 | padding: 10px; 86 | font-weight: bold; 87 | } 88 | 89 | .window_skin_a .window_closeBtn{ 90 | width: 45px; 91 | height: 45px; 92 | border-radius: 45px; 93 | line-height: 45px; 94 | padding: 0; 95 | text-align: center; 96 | background: blue; 97 | font-size: 24px; 98 | font-weight: bold; 99 | right: -15px; 100 | top: -15px; 101 | } -------------------------------------------------------------------------------- /12.2 自定义事件实现(一)/css/window.css: -------------------------------------------------------------------------------- 1 | .btn{ 2 | text-decoration: none; 3 | padding:5px 10px; 4 | width: 50px; 5 | text-align: center; 6 | display: block; 7 | margin: 100px; 8 | background: #ddd; 9 | } 10 | 11 | .window_boundingBox{ 12 | position: fixed; 13 | border: 1px solid #ddd; 14 | width: 500px; 15 | height: 300px; 16 | left: 50%; 17 | margin-left: -250px; 18 | top:100px; 19 | box-shadow: 0 0 12px #888; 20 | background: #fff; 21 | } 22 | 23 | .window_mask{ 24 | width: 100%; 25 | height: 100%; 26 | background: #000; 27 | opacity: .3; 28 | position: absolute; 29 | left: 0; 30 | top: 0; 31 | } 32 | 33 | .window_alertBtn{ 34 | width: 100px; 35 | position: absolute; 36 | bottom: 10px; 37 | left: 50%; 38 | margin-left: -50px; 39 | } 40 | 41 | .window_header{ 42 | background: #999; 43 | color: #fff; 44 | text-align: center; 45 | padding: 5px; 46 | font-size: 20px; 47 | } 48 | 49 | .window_body{ 50 | padding: 10px; 51 | } 52 | 53 | .window_closeBtn{ 54 | position: absolute; 55 | right: 0; 56 | top: 0; 57 | font-size: 20px; 58 | color: #fff; 59 | background: red; 60 | cursor: pointer; 61 | padding: 5px; 62 | } 63 | 64 | /*skin for window_skin_a*/ 65 | .window_skin_a.window_boudingBox{ 66 | box-shadow: none; 67 | border: 5px solid #ddc; 68 | border-radius: 5px; 69 | } 70 | 71 | .window_skin_a .window_alertBtn{ 72 | width: 50px; 73 | left: auto; 74 | right: 20px; 75 | margin-left: 0; 76 | background:red; 77 | border: none; 78 | color: #fff; 79 | padding: 10px; 80 | } 81 | 82 | .window_skin_a .window_header{ 83 | background: red; 84 | text-align: left; 85 | padding: 10px; 86 | font-weight: bold; 87 | } 88 | 89 | .window_skin_a .window_closeBtn{ 90 | width: 45px; 91 | height: 45px; 92 | border-radius: 45px; 93 | line-height: 45px; 94 | padding: 0; 95 | text-align: center; 96 | background: blue; 97 | font-size: 24px; 98 | font-weight: bold; 99 | right: -15px; 100 | top: -15px; 101 | } -------------------------------------------------------------------------------- /14.1 widget抽象类/css/window.css: -------------------------------------------------------------------------------- 1 | .btn{ 2 | text-decoration: none; 3 | padding:5px 10px; 4 | width: 50px; 5 | text-align: center; 6 | display: block; 7 | margin: 100px; 8 | background: #ddd; 9 | } 10 | 11 | .window_boundingBox{ 12 | position: fixed; 13 | border: 1px solid #ddd; 14 | width: 500px; 15 | height: 300px; 16 | left: 50%; 17 | margin-left: -250px; 18 | top:100px; 19 | box-shadow: 0 0 12px #888; 20 | background: #fff; 21 | } 22 | 23 | .window_mask{ 24 | width: 100%; 25 | height: 100%; 26 | background: #000; 27 | opacity: .3; 28 | position: absolute; 29 | left: 0; 30 | top: 0; 31 | } 32 | 33 | .window_alertBtn{ 34 | width: 100px; 35 | position: absolute; 36 | bottom: 10px; 37 | left: 50%; 38 | margin-left: -50px; 39 | } 40 | 41 | .window_header{ 42 | background: #999; 43 | color: #fff; 44 | text-align: center; 45 | padding: 5px; 46 | font-size: 20px; 47 | } 48 | 49 | .window_body{ 50 | padding: 10px; 51 | } 52 | 53 | .window_closeBtn{ 54 | position: absolute; 55 | right: 0; 56 | top: 0; 57 | font-size: 20px; 58 | color: #fff; 59 | background: red; 60 | cursor: pointer; 61 | padding: 5px; 62 | } 63 | 64 | /*skin for window_skin_a*/ 65 | .window_skin_a.window_boudingBox{ 66 | box-shadow: none; 67 | border: 5px solid #ddc; 68 | border-radius: 5px; 69 | } 70 | 71 | .window_skin_a .window_alertBtn{ 72 | width: 50px; 73 | left: auto; 74 | right: 20px; 75 | margin-left: 0; 76 | background:red; 77 | border: none; 78 | color: #fff; 79 | padding: 10px; 80 | } 81 | 82 | .window_skin_a .window_header{ 83 | background: red; 84 | text-align: left; 85 | padding: 10px; 86 | font-weight: bold; 87 | } 88 | 89 | .window_skin_a .window_closeBtn{ 90 | width: 45px; 91 | height: 45px; 92 | border-radius: 45px; 93 | line-height: 45px; 94 | padding: 0; 95 | text-align: center; 96 | background: blue; 97 | font-size: 24px; 98 | font-weight: bold; 99 | right: -15px; 100 | top: -15px; 101 | } -------------------------------------------------------------------------------- /10.1 模态/js/window.js: -------------------------------------------------------------------------------- 1 | define(['jquery'],function($){ 2 | function Window(){ 3 | this.cfg = { 4 | width:500, 5 | height:300, 6 | title:'系统消息', 7 | content:"", 8 | hasCloseBtn:false, 9 | hanMask:true, 10 | skinClassName:null, 11 | text4AlertBtn:'确定', 12 | handler4AlertBtn:null, 13 | handler4CloseBtn:null 14 | }; 15 | } 16 | 17 | Window.prototype = { 18 | alert:function(cfg){ 19 | var CFG = $.extend(this.cfg,cfg), 20 | boudingBox = $( 21 | '
'+ 22 | '
'+CFG.title+'
'+ 23 | '
'+CFG.content+'
'+ 24 | ''+ 25 | '
' 26 | ), 27 | btn = boudingBox.find('.window_alertBtn'), 28 | mask = null; 29 | /*处理模态*/ 30 | if (CFG.hanMask) { 31 | mask = $('
'); 32 | mask.appendTo("body"); 33 | }; 34 | 35 | boudingBox.appendTo('body'); 36 | btn.click(function(){ 37 | CFG.handler4AlertBtn && CFG.handler4AlertBtn(); //弹出窗口的确定按钮处理函数 38 | boudingBox.remove(); 39 | mask&&mask.remove(); 40 | }); 41 | $.extend(this.cfg,cfg); 42 | boudingBox.css({ 43 | width:CFG.width+'px', 44 | height:CFG.height+'px', 45 | left:(CFG.x||(window.innerWidth-CFG.width)/2)+'px', 46 | top:(CFG.y||(window.innerHeight-CFG.height)/2)+'px' 47 | }); 48 | if(CFG.hasCloseBtn){ 49 | var closeBtn = $('X'); 50 | closeBtn.appendTo(boudingBox); 51 | closeBtn.click(function(){ 52 | CFG.handler4CloseBtn&&CFG.handler4CloseBtn(); //弹出窗口的关闭按钮处理函数 53 | boudingBox.remove(); 54 | mask&&mask.remove(); 55 | }); 56 | } 57 | if (CFG.skinClassName) { 58 | boudingBox.addClass(CFG.skinClassName); 59 | }; 60 | 61 | }, 62 | confirm:function(){}, 63 | prompt:function(){} 64 | } 65 | 66 | return{ 67 | Window : Window 68 | } 69 | }) -------------------------------------------------------------------------------- /15.1 widget类 设计统一生命周期(一)/css/window.css: -------------------------------------------------------------------------------- 1 | .btn{ 2 | text-decoration: none; 3 | padding:5px 10px; 4 | width: 50px; 5 | text-align: center; 6 | display: block; 7 | margin: 100px; 8 | background: #ddd; 9 | } 10 | 11 | .window_boundingBox{ 12 | position: fixed; 13 | border: 1px solid #ddd; 14 | width: 500px; 15 | height: 300px; 16 | left: 50%; 17 | margin-left: -250px; 18 | top:100px; 19 | box-shadow: 0 0 12px #888; 20 | background: #fff; 21 | } 22 | 23 | .window_mask{ 24 | width: 100%; 25 | height: 100%; 26 | background: #000; 27 | opacity: .3; 28 | position: absolute; 29 | left: 0; 30 | top: 0; 31 | } 32 | 33 | .window_alertBtn{ 34 | width: 100px; 35 | position: absolute; 36 | bottom: 10px; 37 | left: 50%; 38 | margin-left: -50px; 39 | } 40 | 41 | .window_header{ 42 | background: #999; 43 | color: #fff; 44 | text-align: center; 45 | padding: 5px; 46 | font-size: 20px; 47 | } 48 | 49 | .window_body{ 50 | padding: 10px; 51 | } 52 | 53 | .window_closeBtn{ 54 | position: absolute; 55 | right: 0; 56 | top: 0; 57 | font-size: 20px; 58 | color: #fff; 59 | background: red; 60 | cursor: pointer; 61 | padding: 5px; 62 | } 63 | 64 | /*skin for window_skin_a*/ 65 | .window_skin_a.window_boudingBox{ 66 | box-shadow: none; 67 | border: 5px solid #ddc; 68 | border-radius: 5px; 69 | } 70 | 71 | .window_skin_a .window_alertBtn{ 72 | width: 50px; 73 | left: auto; 74 | right: 20px; 75 | margin-left: 0; 76 | background:red; 77 | border: none; 78 | color: #fff; 79 | padding: 10px; 80 | } 81 | 82 | .window_skin_a .window_header{ 83 | background: red; 84 | text-align: left; 85 | padding: 10px; 86 | font-weight: bold; 87 | } 88 | 89 | .window_skin_a .window_closeBtn{ 90 | width: 45px; 91 | height: 45px; 92 | border-radius: 45px; 93 | line-height: 45px; 94 | padding: 0; 95 | text-align: center; 96 | background: blue; 97 | font-size: 24px; 98 | font-weight: bold; 99 | right: -15px; 100 | top: -15px; 101 | } -------------------------------------------------------------------------------- /15.2 widget类 设计统一生命周期(二)/css/window.css: -------------------------------------------------------------------------------- 1 | .btn{ 2 | text-decoration: none; 3 | padding:5px 10px; 4 | width: 50px; 5 | text-align: center; 6 | display: block; 7 | margin: 100px; 8 | background: #ddd; 9 | } 10 | 11 | .window_boundingBox{ 12 | position: fixed; 13 | border: 1px solid #ddd; 14 | width: 500px; 15 | height: 300px; 16 | left: 50%; 17 | margin-left: -250px; 18 | top:100px; 19 | box-shadow: 0 0 12px #888; 20 | background: #fff; 21 | } 22 | 23 | .window_mask{ 24 | width: 100%; 25 | height: 100%; 26 | background: #000; 27 | opacity: .3; 28 | position: absolute; 29 | left: 0; 30 | top: 0; 31 | } 32 | 33 | .window_alertBtn{ 34 | width: 100px; 35 | position: absolute; 36 | bottom: 10px; 37 | left: 50%; 38 | margin-left: -50px; 39 | } 40 | 41 | .window_header{ 42 | background: #999; 43 | color: #fff; 44 | text-align: center; 45 | padding: 5px; 46 | font-size: 20px; 47 | } 48 | 49 | .window_body{ 50 | padding: 10px; 51 | } 52 | 53 | .window_closeBtn{ 54 | position: absolute; 55 | right: 0; 56 | top: 0; 57 | font-size: 20px; 58 | color: #fff; 59 | background: red; 60 | cursor: pointer; 61 | padding: 5px; 62 | } 63 | 64 | /*skin for window_skin_a*/ 65 | .window_skin_a.window_boudingBox{ 66 | box-shadow: none; 67 | border: 5px solid #ddc; 68 | border-radius: 5px; 69 | } 70 | 71 | .window_skin_a .window_alertBtn{ 72 | width: 50px; 73 | left: auto; 74 | right: 20px; 75 | margin-left: 0; 76 | background:red; 77 | border: none; 78 | color: #fff; 79 | padding: 10px; 80 | } 81 | 82 | .window_skin_a .window_header{ 83 | background: red; 84 | text-align: left; 85 | padding: 10px; 86 | font-weight: bold; 87 | } 88 | 89 | .window_skin_a .window_closeBtn{ 90 | width: 45px; 91 | height: 45px; 92 | border-radius: 45px; 93 | line-height: 45px; 94 | padding: 0; 95 | text-align: center; 96 | background: blue; 97 | font-size: 24px; 98 | font-weight: bold; 99 | right: -15px; 100 | top: -15px; 101 | } -------------------------------------------------------------------------------- /18.1 实现common方法/js/main.js: -------------------------------------------------------------------------------- 1 | require.config({ 2 | paths:{ 3 | jquery:'jquery-2.1.1.min', 4 | jqueryUI:'jquery-ui.min' 5 | } 6 | }); 7 | 8 | require(['jquery','window'],function($,w){ 9 | $('.btn_alert').click(function(){ 10 | var win = new w.Window().alert({ 11 | title:'提示', 12 | content:'Welcome!!!', 13 | width:300, 14 | height:150, 15 | y:250, 16 | x:600, 17 | hasCloseBtn:true, 18 | text4AlertBtn:'OK', 19 | dragHandle:'.window_header', 20 | skinClassName:'window_skin_a', 21 | // handler4AlertBtn:function(){ 22 | // alert('你点击了确定按钮'); 23 | // }, 24 | // handler4CloseBtn:function(){ 25 | // alert('你点击了关闭按钮'); 26 | // } 27 | }).on('alert',function(){ 28 | alert('你点击了确定按钮') 29 | }).on('alert',function(){ 30 | alert('确定按钮第二次回调') 31 | }).on('alert',function(){ 32 | alert('确定按钮第三次回调') 33 | }).on('close',function(){ 34 | alert('第一次点击了关闭按钮') 35 | }).on('close',function(){ 36 | alert('关闭按钮第二次回调') 37 | }); 38 | }); 39 | 40 | $('.btn_confirm').click(function(){ 41 | var win = new w.Window().confirm({ 42 | title:'系统消息', 43 | content:'您确定要删除这个文件吗', 44 | width:300, 45 | height:150, 46 | y:50, 47 | x:600, 48 | text4ConfirmBtn:'是', 49 | text4CancelBtn:'否', 50 | dragHandle:'.window_header' 51 | }).on('confirm',function(){ 52 | alert('确定'); 53 | }).on('cancel',function(){ 54 | alert('取消'); 55 | }); 56 | }); 57 | 58 | $('.btn_prompt').click(function(){ 59 | var win = new w.Window().prompt({ 60 | title:'请输入您的名字', 61 | content:'我们将会为您保密您输入的信息', 62 | width:300, 63 | height:150, 64 | y:50, 65 | text4PromptBtn:'输入', 66 | text4CancelBtn:'取消', 67 | defaultValue4PromptInput:'张三', 68 | dragHandle:'.window_header', 69 | handler4PromptBtn:function(inputVlaue){ 70 | alert('您输入的内容是:'+inputVlaue); 71 | }, 72 | handler4CancelBtn:function(){ 73 | alert('取消'); 74 | } 75 | }); 76 | }); 77 | 78 | $('.btn_common').click(function(){ 79 | var win = new w.Window().common({ 80 | content:'这是一个通用弹窗', 81 | width:300, 82 | height:150, 83 | hasCloseBtn:true 84 | }); 85 | }); 86 | }); -------------------------------------------------------------------------------- /18.1 实现common方法/css/window.css: -------------------------------------------------------------------------------- 1 | .btn{ 2 | text-decoration: none; 3 | padding:5px 10px; 4 | width: 50px; 5 | text-align: center; 6 | display: block; 7 | margin: 100px; 8 | background: #ddd; 9 | } 10 | 11 | 12 | .window_boundingBox{ 13 | position: fixed; 14 | border: 1px solid #ddd; 15 | width: 500px; 16 | height: 300px; 17 | left: 50%; 18 | margin-left: -250px; 19 | top:100px; 20 | box-shadow: 0 0 12px #888; 21 | background: #fff; 22 | } 23 | 24 | .window_mask{ 25 | width: 100%; 26 | height: 100%; 27 | background: #000; 28 | opacity: .3; 29 | position: absolute; 30 | left: 0; 31 | top: 0; 32 | } 33 | 34 | .window_alertBtn{ 35 | width: 100px; 36 | position: absolute; 37 | bottom: 10px; 38 | left: 50%; 39 | margin-left: -50px; 40 | } 41 | 42 | .window_header{ 43 | background: #999; 44 | color: #fff; 45 | text-align: center; 46 | padding: 5px; 47 | font-size: 20px; 48 | } 49 | 50 | .window_body{ 51 | padding: 10px; 52 | } 53 | 54 | .window_footer{ 55 | position: absolute; 56 | bottom: 0; 57 | padding-bottom: 10px; 58 | text-align: center; 59 | width: 100%; 60 | } 61 | 62 | .window_cancelBtn{ 63 | margin-left: 20px; 64 | } 65 | 66 | .window_closeBtn{ 67 | position: absolute; 68 | right: 0; 69 | top: 0; 70 | font-size: 20px; 71 | color: #fff; 72 | background: red; 73 | cursor: pointer; 74 | padding: 5px; 75 | } 76 | 77 | /*skin for window_skin_a*/ 78 | .window_skin_a.window_boudingBox{ 79 | box-shadow: none; 80 | border: 5px solid #ddc; 81 | border-radius: 5px; 82 | } 83 | 84 | .window_skin_a .window_alertBtn{ 85 | width: 50px; 86 | left: auto; 87 | right: 20px; 88 | margin-left: 0; 89 | background:red; 90 | border: none; 91 | color: #fff; 92 | padding: 10px; 93 | } 94 | 95 | .window_skin_a .window_header{ 96 | background: red; 97 | text-align: left; 98 | padding: 10px; 99 | font-weight: bold; 100 | } 101 | 102 | .window_skin_a .window_closeBtn{ 103 | width: 45px; 104 | height: 45px; 105 | border-radius: 45px; 106 | line-height: 45px; 107 | padding: 0; 108 | text-align: center; 109 | background: blue; 110 | font-size: 24px; 111 | font-weight: bold; 112 | right: -15px; 113 | top: -15px; 114 | } -------------------------------------------------------------------------------- /16.1 实现confirm方法(一)/css/window.css: -------------------------------------------------------------------------------- 1 | .btn{ 2 | text-decoration: none; 3 | padding:5px 10px; 4 | width: 50px; 5 | text-align: center; 6 | display: block; 7 | margin: 100px; 8 | background: #ddd; 9 | } 10 | 11 | 12 | .window_boundingBox{ 13 | position: fixed; 14 | border: 1px solid #ddd; 15 | width: 500px; 16 | height: 300px; 17 | left: 50%; 18 | margin-left: -250px; 19 | top:100px; 20 | box-shadow: 0 0 12px #888; 21 | background: #fff; 22 | } 23 | 24 | .window_mask{ 25 | width: 100%; 26 | height: 100%; 27 | background: #000; 28 | opacity: .3; 29 | position: absolute; 30 | left: 0; 31 | top: 0; 32 | } 33 | 34 | .window_alertBtn{ 35 | width: 100px; 36 | position: absolute; 37 | bottom: 10px; 38 | left: 50%; 39 | margin-left: -50px; 40 | } 41 | 42 | .window_header{ 43 | background: #999; 44 | color: #fff; 45 | text-align: center; 46 | padding: 5px; 47 | font-size: 20px; 48 | } 49 | 50 | .window_body{ 51 | padding: 10px; 52 | } 53 | 54 | .window_footer{ 55 | position: absolute; 56 | bottom: 0; 57 | padding-bottom: 10px; 58 | text-align: center; 59 | width: 100%; 60 | } 61 | 62 | .window_cancelBtn{ 63 | margin-left: 20px; 64 | } 65 | 66 | .window_closeBtn{ 67 | position: absolute; 68 | right: 0; 69 | top: 0; 70 | font-size: 20px; 71 | color: #fff; 72 | background: red; 73 | cursor: pointer; 74 | padding: 5px; 75 | } 76 | 77 | /*skin for window_skin_a*/ 78 | .window_skin_a.window_boudingBox{ 79 | box-shadow: none; 80 | border: 5px solid #ddc; 81 | border-radius: 5px; 82 | } 83 | 84 | .window_skin_a .window_alertBtn{ 85 | width: 50px; 86 | left: auto; 87 | right: 20px; 88 | margin-left: 0; 89 | background:red; 90 | border: none; 91 | color: #fff; 92 | padding: 10px; 93 | } 94 | 95 | .window_skin_a .window_header{ 96 | background: red; 97 | text-align: left; 98 | padding: 10px; 99 | font-weight: bold; 100 | } 101 | 102 | .window_skin_a .window_closeBtn{ 103 | width: 45px; 104 | height: 45px; 105 | border-radius: 45px; 106 | line-height: 45px; 107 | padding: 0; 108 | text-align: center; 109 | background: blue; 110 | font-size: 24px; 111 | font-weight: bold; 112 | right: -15px; 113 | top: -15px; 114 | } -------------------------------------------------------------------------------- /17.1 实现prompt方法(一)/css/window.css: -------------------------------------------------------------------------------- 1 | .btn{ 2 | text-decoration: none; 3 | padding:5px 10px; 4 | width: 50px; 5 | text-align: center; 6 | display: block; 7 | margin: 100px; 8 | background: #ddd; 9 | } 10 | 11 | 12 | .window_boundingBox{ 13 | position: fixed; 14 | border: 1px solid #ddd; 15 | width: 500px; 16 | height: 300px; 17 | left: 50%; 18 | margin-left: -250px; 19 | top:100px; 20 | box-shadow: 0 0 12px #888; 21 | background: #fff; 22 | } 23 | 24 | .window_mask{ 25 | width: 100%; 26 | height: 100%; 27 | background: #000; 28 | opacity: .3; 29 | position: absolute; 30 | left: 0; 31 | top: 0; 32 | } 33 | 34 | .window_alertBtn{ 35 | width: 100px; 36 | position: absolute; 37 | bottom: 10px; 38 | left: 50%; 39 | margin-left: -50px; 40 | } 41 | 42 | .window_header{ 43 | background: #999; 44 | color: #fff; 45 | text-align: center; 46 | padding: 5px; 47 | font-size: 20px; 48 | } 49 | 50 | .window_body{ 51 | padding: 10px; 52 | } 53 | 54 | .window_footer{ 55 | position: absolute; 56 | bottom: 0; 57 | padding-bottom: 10px; 58 | text-align: center; 59 | width: 100%; 60 | } 61 | 62 | .window_cancelBtn{ 63 | margin-left: 20px; 64 | } 65 | 66 | .window_closeBtn{ 67 | position: absolute; 68 | right: 0; 69 | top: 0; 70 | font-size: 20px; 71 | color: #fff; 72 | background: red; 73 | cursor: pointer; 74 | padding: 5px; 75 | } 76 | 77 | /*skin for window_skin_a*/ 78 | .window_skin_a.window_boudingBox{ 79 | box-shadow: none; 80 | border: 5px solid #ddc; 81 | border-radius: 5px; 82 | } 83 | 84 | .window_skin_a .window_alertBtn{ 85 | width: 50px; 86 | left: auto; 87 | right: 20px; 88 | margin-left: 0; 89 | background:red; 90 | border: none; 91 | color: #fff; 92 | padding: 10px; 93 | } 94 | 95 | .window_skin_a .window_header{ 96 | background: red; 97 | text-align: left; 98 | padding: 10px; 99 | font-weight: bold; 100 | } 101 | 102 | .window_skin_a .window_closeBtn{ 103 | width: 45px; 104 | height: 45px; 105 | border-radius: 45px; 106 | line-height: 45px; 107 | padding: 0; 108 | text-align: center; 109 | background: blue; 110 | font-size: 24px; 111 | font-weight: bold; 112 | right: -15px; 113 | top: -15px; 114 | } -------------------------------------------------------------------------------- /11.1 拖动/js/window.js: -------------------------------------------------------------------------------- 1 | define(['jquery','jqueryUI'],function($,$UI){ 2 | function Window(){ 3 | this.cfg = { 4 | width:500, 5 | height:300, 6 | title:'系统消息', 7 | content:"", 8 | hasCloseBtn:false, 9 | hanMask:true, 10 | isDraggable:true, 11 | dragHandle:null, 12 | skinClassName:null, 13 | text4AlertBtn:'确定', 14 | handler4AlertBtn:null, 15 | handler4CloseBtn:null 16 | }; 17 | } 18 | 19 | Window.prototype = { 20 | alert:function(cfg){ 21 | var CFG = $.extend(this.cfg,cfg), 22 | boudingBox = $( 23 | '
'+ 24 | '
'+CFG.title+'
'+ 25 | '
'+CFG.content+'
'+ 26 | ''+ 27 | '
' 28 | ), 29 | btn = boudingBox.find('.window_alertBtn'), 30 | mask = null; 31 | /*处理模态*/ 32 | if (CFG.hanMask) { 33 | mask = $('
'); 34 | mask.appendTo("body"); 35 | }; 36 | 37 | boudingBox.appendTo('body'); 38 | btn.click(function(){ 39 | CFG.handler4AlertBtn && CFG.handler4AlertBtn(); //弹出窗口的确定按钮处理函数 40 | boudingBox.remove(); 41 | mask&&mask.remove(); 42 | }); 43 | $.extend(this.cfg,cfg); 44 | boudingBox.css({ 45 | width:CFG.width+'px', 46 | height:CFG.height+'px', 47 | left:(CFG.x||(window.innerWidth-CFG.width)/2)+'px', 48 | top:(CFG.y||(window.innerHeight-CFG.height)/2)+'px' 49 | }); 50 | if(CFG.hasCloseBtn){ 51 | var closeBtn = $('X'); 52 | closeBtn.appendTo(boudingBox); 53 | closeBtn.click(function(){ 54 | CFG.handler4CloseBtn&&CFG.handler4CloseBtn(); //弹出窗口的关闭按钮处理函数 55 | boudingBox.remove(); 56 | mask&&mask.remove(); 57 | }); 58 | } 59 | if (CFG.skinClassName) { 60 | boudingBox.addClass(CFG.skinClassName); 61 | }; 62 | if(CFG.isDraggable){ 63 | if (CFG.dragHandle) { 64 | boudingBox.draggable({handle:CFG.dragHandle}); 65 | }else{ 66 | boudingBox.draggable(); 67 | } 68 | } 69 | }, 70 | confirm:function(){}, 71 | prompt:function(){} 72 | } 73 | 74 | return{ 75 | Window : Window 76 | } 77 | }) -------------------------------------------------------------------------------- /14.1 widget抽象类/js/window.js: -------------------------------------------------------------------------------- 1 | define(['widget','jquery','jqueryUI'],function(widget,$,$UI){ 2 | function Window(){ 3 | this.cfg = { 4 | width:500, 5 | height:300, 6 | title:'系统消息', 7 | content:"", 8 | hasCloseBtn:false, 9 | hanMask:true, 10 | isDraggable:true, 11 | dragHandle:null, 12 | skinClassName:null, 13 | text4AlertBtn:'确定', 14 | handler4AlertBtn:null, 15 | handler4CloseBtn:null 16 | }; 17 | this.handlers={ 18 | 19 | }; 20 | } 21 | 22 | Window.prototype = $.extend({},new widget.Widget(),{ 23 | alert:function(cfg){ 24 | var CFG = $.extend(this.cfg,cfg), 25 | boudingBox = $( 26 | '
'+ 27 | '
'+CFG.title+'
'+ 28 | '
'+CFG.content+'
'+ 29 | ''+ 30 | '
' 31 | ), 32 | btn = boudingBox.find('.window_alertBtn'), 33 | mask = null, 34 | that=this; 35 | /*处理模态*/ 36 | if (CFG.hanMask) { 37 | mask = $('
'); 38 | mask.appendTo("body"); 39 | }; 40 | 41 | boudingBox.appendTo('body'); 42 | btn.click(function(){ 43 | boudingBox.remove(); 44 | mask&&mask.remove(); 45 | that.fire("alert"); 46 | }); 47 | $.extend(this.cfg,cfg); 48 | boudingBox.css({ 49 | width:CFG.width+'px', 50 | height:CFG.height+'px', 51 | left:(CFG.x||(window.innerWidth-CFG.width)/2)+'px', 52 | top:(CFG.y||(window.innerHeight-CFG.height)/2)+'px' 53 | }); 54 | if(CFG.hasCloseBtn){ 55 | var closeBtn = $('X'); 56 | closeBtn.appendTo(boudingBox); 57 | closeBtn.click(function(){ 58 | boudingBox.remove(); 59 | mask&&mask.remove(); 60 | that.fire("close"); 61 | }); 62 | } 63 | if (CFG.skinClassName) { 64 | boudingBox.addClass(CFG.skinClassName); 65 | }; 66 | if(CFG.isDraggable){ 67 | if (CFG.dragHandle) { 68 | boudingBox.draggable({handle:CFG.dragHandle}); 69 | }else{ 70 | boudingBox.draggable(); 71 | } 72 | }; 73 | if (CFG.handler4AlertBtn) { 74 | this.on('alert',CFG.handler4AlertBtn); 75 | }; 76 | if (CFG.handler4CloseBtn) { 77 | this.on('close',CFG.handler4CloseBtn); 78 | }; 79 | return this; 80 | }, 81 | confirm:function(){}, 82 | prompt:function(){} 83 | }); 84 | 85 | return{ 86 | Window : Window 87 | } 88 | }) -------------------------------------------------------------------------------- /15.1 widget类 设计统一生命周期(一)/js/window.js: -------------------------------------------------------------------------------- 1 | define(['widget','jquery','jqueryUI'],function(widget,$,$UI){ 2 | function Window(){ 3 | this.cfg = { 4 | width:500, 5 | height:300, 6 | title:'系统消息', 7 | content:"", 8 | hasCloseBtn:false, 9 | hanMask:true, 10 | isDraggable:true, 11 | dragHandle:null, 12 | skinClassName:null, 13 | text4AlertBtn:'确定', 14 | handler4AlertBtn:null, 15 | handler4CloseBtn:null 16 | }; 17 | this.handlers={ 18 | 19 | }; 20 | } 21 | 22 | Window.prototype = $.extend({},new widget.Widget(),{ 23 | alert:function(cfg){ 24 | var CFG = $.extend(this.cfg,cfg), 25 | boudingBox = $( 26 | '
'+ 27 | '
'+CFG.title+'
'+ 28 | '
'+CFG.content+'
'+ 29 | ''+ 30 | '
' 31 | ), 32 | btn = boudingBox.find('.window_alertBtn'), 33 | mask = null, 34 | that=this; 35 | /*处理模态*/ 36 | if (CFG.hanMask) { 37 | mask = $('
'); 38 | mask.appendTo("body"); 39 | }; 40 | 41 | boudingBox.appendTo('body'); 42 | btn.click(function(){ 43 | boudingBox.remove(); 44 | mask&&mask.remove(); 45 | that.fire("alert"); 46 | }); 47 | $.extend(this.cfg,cfg); 48 | boudingBox.css({ 49 | width:CFG.width+'px', 50 | height:CFG.height+'px', 51 | left:(CFG.x||(window.innerWidth-CFG.width)/2)+'px', 52 | top:(CFG.y||(window.innerHeight-CFG.height)/2)+'px' 53 | }); 54 | if(CFG.hasCloseBtn){ 55 | var closeBtn = $('X'); 56 | closeBtn.appendTo(boudingBox); 57 | closeBtn.click(function(){ 58 | boudingBox.remove(); 59 | mask&&mask.remove(); 60 | that.fire("close"); 61 | }); 62 | } 63 | if (CFG.skinClassName) { 64 | boudingBox.addClass(CFG.skinClassName); 65 | }; 66 | if(CFG.isDraggable){ 67 | if (CFG.dragHandle) { 68 | boudingBox.draggable({handle:CFG.dragHandle}); 69 | }else{ 70 | boudingBox.draggable(); 71 | } 72 | }; 73 | if (CFG.handler4AlertBtn) { 74 | this.on('alert',CFG.handler4AlertBtn); 75 | }; 76 | if (CFG.handler4CloseBtn) { 77 | this.on('close',CFG.handler4CloseBtn); 78 | }; 79 | return this; 80 | }, 81 | confirm:function(){}, 82 | prompt:function(){} 83 | }); 84 | 85 | return{ 86 | Window : Window 87 | } 88 | }) -------------------------------------------------------------------------------- /15.2 widget类 设计统一生命周期(二)/js/window.js: -------------------------------------------------------------------------------- 1 | define(['widget','jquery','jqueryUI'],function(widget,$,$UI){ 2 | function Window(){ 3 | this.cfg = { 4 | width:500, 5 | height:300, 6 | title:'系统消息', 7 | content:"", 8 | hasCloseBtn:false, 9 | hanMask:true, 10 | isDraggable:true, 11 | dragHandle:null, 12 | skinClassName:null, 13 | text4AlertBtn:'确定', 14 | handler4AlertBtn:null, 15 | handler4CloseBtn:null 16 | }; 17 | } 18 | 19 | Window.prototype = $.extend({},new widget.Widget(),{ 20 | renderUI:function(){ 21 | this.boudingBox = $( 22 | '
'+ 23 | '
'+this.cfg.title+'
'+ 24 | '
'+this.cfg.content+'
'+ 25 | ''+ 26 | '
' 27 | ); 28 | /*处理模态*/ 29 | if (this.cfg.hanMask) { 30 | this._mask = $('
'); 31 | this._mask.appendTo("body"); 32 | } 33 | 34 | if(this.cfg.hasCloseBtn){ 35 | this.boudingBox.append('X'); 36 | } 37 | this.boudingBox.appendTo(document.body); 38 | }, 39 | bindUI:function(){ 40 | var that = this; 41 | this.boudingBox.delegate(".window_alertBtn","click",function(){ 42 | that.fire('alert'); 43 | that.destroy(); 44 | }).delegate(".window_closeBtn","click",function(){ 45 | that.fire('close'); 46 | that.destroy(); 47 | }); 48 | if (this.cfg.handler4AlertBtn) { 49 | this.on('alert',this.cfg.handler4AlertBtn); 50 | }; 51 | if (this.cfg.handler4CloseBtn) { 52 | this.on('close',this.cfg.handler4CloseBtn); 53 | }; 54 | }, 55 | syncUI:function(){ 56 | this.boudingBox.css({ 57 | width:this.cfg.width + 'px', 58 | height:this.cfg.height + 'px', 59 | left:(this.cfg.x||(window.innerWidth-this.cfg.width)/2) + 'px', 60 | top:(this.cfg.y||(window.innerHeight-this.cfg.height)/2) + 'px' 61 | }); 62 | if (this.cfg.skinClassName) { 63 | this.boudingBox.addClass(this.cfg.skinClassName); 64 | }; 65 | if (this.cfg.isDraggable) { 66 | if (this.cfg.dragHandle) { 67 | this.boudingBox.draggable({handle:this.cfg.dragHandle}); 68 | }else{ 69 | this.boudingBox.draggable(); 70 | } 71 | }; 72 | }, 73 | destructor:function(){ 74 | this._mask && this._mask.remove(); 75 | }, 76 | alert:function(cfg){ 77 | $.extend(this.cfg,cfg); 78 | this.render(); 79 | return this; 80 | }, 81 | confirm:function(){}, 82 | prompt:function(){} 83 | }); 84 | 85 | return{ 86 | Window : Window 87 | } 88 | }) -------------------------------------------------------------------------------- /12.2 自定义事件实现(一)/js/window.js: -------------------------------------------------------------------------------- 1 | define(['jquery','jqueryUI'],function($,$UI){ 2 | function Window(){ 3 | this.cfg = { 4 | width:500, 5 | height:300, 6 | title:'系统消息', 7 | content:"", 8 | hasCloseBtn:false, 9 | hanMask:true, 10 | isDraggable:true, 11 | dragHandle:null, 12 | skinClassName:null, 13 | text4AlertBtn:'确定', 14 | handler4AlertBtn:null, 15 | handler4CloseBtn:null 16 | }; 17 | this.handlers={ 18 | 19 | }; 20 | } 21 | 22 | Window.prototype = { 23 | on : function(type,handler){ 24 | if (typeof this.handlers[type]=='undefined') { 25 | this.handlers[type]=[]; 26 | } 27 | this.handlers[type].push(handler); 28 | }, 29 | fire : function(type,data){ 30 | if (this.handlers[type] instanceof Array) { 31 | var handlers = this.handlers[type]; 32 | for(var i=0,len=handlers.length;i'+ 41 | '
'+CFG.title+'
'+ 42 | '
'+CFG.content+'
'+ 43 | ''+ 44 | '' 45 | ), 46 | btn = boudingBox.find('.window_alertBtn'), 47 | mask = null, 48 | that=this; 49 | /*处理模态*/ 50 | if (CFG.hanMask) { 51 | mask = $('
'); 52 | mask.appendTo("body"); 53 | }; 54 | 55 | boudingBox.appendTo('body'); 56 | btn.click(function(){ 57 | boudingBox.remove(); 58 | mask&&mask.remove(); 59 | that.fire("alert"); 60 | }); 61 | $.extend(this.cfg,cfg); 62 | boudingBox.css({ 63 | width:CFG.width+'px', 64 | height:CFG.height+'px', 65 | left:(CFG.x||(window.innerWidth-CFG.width)/2)+'px', 66 | top:(CFG.y||(window.innerHeight-CFG.height)/2)+'px' 67 | }); 68 | if(CFG.hasCloseBtn){ 69 | var closeBtn = $('X'); 70 | closeBtn.appendTo(boudingBox); 71 | closeBtn.click(function(){ 72 | boudingBox.remove(); 73 | mask&&mask.remove(); 74 | that.fire("close"); 75 | }); 76 | } 77 | if (CFG.skinClassName) { 78 | boudingBox.addClass(CFG.skinClassName); 79 | }; 80 | if(CFG.isDraggable){ 81 | if (CFG.dragHandle) { 82 | boudingBox.draggable({handle:CFG.dragHandle}); 83 | }else{ 84 | boudingBox.draggable(); 85 | } 86 | }; 87 | if (CFG.handler4AlertBtn) { 88 | this.on('alert',CFG.handler4AlertBtn); 89 | }; 90 | if (CFG.handler4CloseBtn) { 91 | this.on('close',CFG.handler4CloseBtn); 92 | }; 93 | }, 94 | confirm:function(){}, 95 | prompt:function(){} 96 | } 97 | 98 | return{ 99 | Window : Window 100 | } 101 | }) -------------------------------------------------------------------------------- /13.1 连缀语法/js/window.js: -------------------------------------------------------------------------------- 1 | define(['jquery','jqueryUI'],function($,$UI){ 2 | function Window(){ 3 | this.cfg = { 4 | width:500, 5 | height:300, 6 | title:'系统消息', 7 | content:"", 8 | hasCloseBtn:false, 9 | hanMask:true, 10 | isDraggable:true, 11 | dragHandle:null, 12 | skinClassName:null, 13 | text4AlertBtn:'确定', 14 | handler4AlertBtn:null, 15 | handler4CloseBtn:null 16 | }; 17 | this.handlers={ 18 | 19 | }; 20 | } 21 | 22 | Window.prototype = { 23 | on : function(type,handler){ 24 | if (typeof this.handlers[type]=='undefined') { 25 | this.handlers[type]=[]; 26 | } 27 | this.handlers[type].push(handler); 28 | return this; 29 | }, 30 | fire : function(type,data){ 31 | if (this.handlers[type] instanceof Array) { 32 | var handlers = this.handlers[type]; 33 | for(var i=0,len=handlers.length;i'+ 42 | '
'+CFG.title+'
'+ 43 | '
'+CFG.content+'
'+ 44 | ''+ 45 | '' 46 | ), 47 | btn = boudingBox.find('.window_alertBtn'), 48 | mask = null, 49 | that=this; 50 | /*处理模态*/ 51 | if (CFG.hanMask) { 52 | mask = $('
'); 53 | mask.appendTo("body"); 54 | }; 55 | 56 | boudingBox.appendTo('body'); 57 | btn.click(function(){ 58 | boudingBox.remove(); 59 | mask&&mask.remove(); 60 | that.fire("alert"); 61 | }); 62 | $.extend(this.cfg,cfg); 63 | boudingBox.css({ 64 | width:CFG.width+'px', 65 | height:CFG.height+'px', 66 | left:(CFG.x||(window.innerWidth-CFG.width)/2)+'px', 67 | top:(CFG.y||(window.innerHeight-CFG.height)/2)+'px' 68 | }); 69 | if(CFG.hasCloseBtn){ 70 | var closeBtn = $('X'); 71 | closeBtn.appendTo(boudingBox); 72 | closeBtn.click(function(){ 73 | boudingBox.remove(); 74 | mask&&mask.remove(); 75 | that.fire("close"); 76 | }); 77 | } 78 | if (CFG.skinClassName) { 79 | boudingBox.addClass(CFG.skinClassName); 80 | }; 81 | if(CFG.isDraggable){ 82 | if (CFG.dragHandle) { 83 | boudingBox.draggable({handle:CFG.dragHandle}); 84 | }else{ 85 | boudingBox.draggable(); 86 | } 87 | }; 88 | if (CFG.handler4AlertBtn) { 89 | this.on('alert',CFG.handler4AlertBtn); 90 | }; 91 | if (CFG.handler4CloseBtn) { 92 | this.on('close',CFG.handler4CloseBtn); 93 | }; 94 | return this; 95 | }, 96 | confirm:function(){}, 97 | prompt:function(){} 98 | } 99 | 100 | return{ 101 | Window : Window 102 | } 103 | }) -------------------------------------------------------------------------------- /16.1 实现confirm方法(一)/js/window.js: -------------------------------------------------------------------------------- 1 | define(['widget','jquery','jqueryUI'],function(widget,$,$UI){ 2 | function Window(){ 3 | this.cfg = { 4 | width:500, 5 | height:300, 6 | title:'系统消息', 7 | content:"", 8 | hasCloseBtn:false, 9 | hanMask:true, 10 | isDraggable:true, 11 | dragHandle:null, 12 | skinClassName:null, 13 | text4AlertBtn:'确定', 14 | text4CancleBtn:'取消', 15 | handler4AlertBtn:null, 16 | handler4CloseBtn:null, 17 | handler4ConfirmBtn:null, 18 | handler4CancelBtn:null 19 | }; 20 | } 21 | 22 | Window.prototype = $.extend({},new widget.Widget(),{ 23 | renderUI:function(){ 24 | var footerContent=''; 25 | switch(this.cfg.winType){ 26 | case "alert":footerContent=''; 27 | break; 28 | case "confirm":footerContent=''; 31 | break; 32 | } 33 | this.boudingBox = $( 34 | '
'+ 35 | '
'+this.cfg.title+'
'+ 36 | '
'+this.cfg.content+'
'+ 37 | ''+ 38 | '
' 39 | ); 40 | /*处理模态*/ 41 | if (this.cfg.hanMask) { 42 | this._mask = $('
'); 43 | this._mask.appendTo("body"); 44 | } 45 | 46 | if(this.cfg.hasCloseBtn){ 47 | this.boudingBox.append('X'); 48 | } 49 | this.boudingBox.appendTo(document.body); 50 | }, 51 | bindUI:function(){ 52 | var that = this; 53 | this.boudingBox.delegate(".window_alertBtn","click",function(){ 54 | that.fire('alert'); 55 | that.destroy(); 56 | }).delegate(".window_closeBtn","click",function(){ 57 | that.fire('close'); 58 | that.destroy(); 59 | }).delegate(".window_confirmBtn","click",function(){ 60 | that.fire('confirm'); 61 | that.destroy(); 62 | }).delegate(".window_cancelBtn","click",function(){ 63 | that.fire('cancel'); 64 | that.destroy(); 65 | }); 66 | if (this.cfg.handler4AlertBtn) { 67 | this.on('alert',this.cfg.handler4AlertBtn); 68 | }; 69 | if (this.cfg.handler4CloseBtn) { 70 | this.on('close',this.cfg.handler4CloseBtn); 71 | }; 72 | }, 73 | syncUI:function(){ 74 | this.boudingBox.css({ 75 | width:this.cfg.width + 'px', 76 | height:this.cfg.height + 'px', 77 | left:(this.cfg.x||(window.innerWidth-this.cfg.width)/2) + 'px', 78 | top:(this.cfg.y||(window.innerHeight-this.cfg.height)/2) + 'px' 79 | }); 80 | if (this.cfg.skinClassName) { 81 | this.boudingBox.addClass(this.cfg.skinClassName); 82 | }; 83 | if (this.cfg.isDraggable) { 84 | if (this.cfg.dragHandle) { 85 | this.boudingBox.draggable({handle:this.cfg.dragHandle}); 86 | }else{ 87 | this.boudingBox.draggable(); 88 | } 89 | }; 90 | }, 91 | destructor:function(){ 92 | this._mask && this._mask.remove(); 93 | }, 94 | alert:function(cfg){ 95 | $.extend(this.cfg,cfg,{winType:'alert'}); 96 | this.render(); 97 | return this; 98 | }, 99 | confirm:function(cfg){ 100 | $.extend(this.cfg,cfg,{winType:'confirm'}); 101 | this.render(); 102 | return this; 103 | }, 104 | prompt:function(){} 105 | }); 106 | 107 | return{ 108 | Window : Window 109 | } 110 | }) -------------------------------------------------------------------------------- /17.1 实现prompt方法(一)/js/window.js: -------------------------------------------------------------------------------- 1 | define(['widget','jquery','jqueryUI'],function(widget,$,$UI){ 2 | function Window(){ 3 | this.cfg = { 4 | width:500, 5 | height:300, 6 | title:'系统消息', 7 | content:"", 8 | hasCloseBtn:false, 9 | hanMask:true, 10 | isDraggable:true, 11 | dragHandle:null, 12 | skinClassName:null, 13 | text4AlertBtn:'确定', 14 | text4CancelBtn:'取消', 15 | handler4AlertBtn:null, 16 | handler4CloseBtn:null, 17 | handler4ConfirmBtn:null, 18 | handler4CancelBtn:null, 19 | text4PromptBtn:'确定', 20 | isPromptInputPassword:false, 21 | defaultValue4PromptInput:false, 22 | maxlength4PromptInput:10, 23 | handler4PromptBtn:null 24 | }; 25 | } 26 | 27 | Window.prototype = $.extend({},new widget.Widget(),{ 28 | renderUI:function(){ 29 | var footerContent=''; 30 | switch(this.cfg.winType){ 31 | case "alert": 32 | footerContent=''; 33 | break; 34 | case "confirm": 35 | footerContent=''; 38 | break; 39 | case "prompt": 40 | this.cfg.content+='

'; 45 | footerContent=''; 48 | break; 49 | } 50 | this.boudingBox = $( 51 | '
'+ 52 | '
'+this.cfg.title+'
'+ 53 | '
'+this.cfg.content+'
'+ 54 | ''+ 55 | '
' 56 | ); 57 | /*处理模态*/ 58 | if (this.cfg.hanMask) { 59 | this._mask = $('
'); 60 | this._mask.appendTo("body"); 61 | } 62 | 63 | if(this.cfg.hasCloseBtn){ 64 | this.boudingBox.append('X'); 65 | } 66 | this.boudingBox.appendTo(document.body); 67 | this._promptInput = this.boudingBox.find('.window_promptInput'); 68 | }, 69 | bindUI:function(){ 70 | var that = this; 71 | this.boudingBox.delegate(".window_alertBtn","click",function(){ 72 | that.fire('alert'); 73 | that.destroy(); 74 | }).delegate(".window_closeBtn","click",function(){ 75 | that.fire('close'); 76 | that.destroy(); 77 | }).delegate(".window_confirmBtn","click",function(){ 78 | that.fire('confirm'); 79 | that.destroy(); 80 | }).delegate(".window_cancelBtn","click",function(){ 81 | that.fire('cancel'); 82 | that.destroy(); 83 | }).delegate(".window_promptBtn","click",function(){ 84 | that.fire('prompt',that._promptInput.val()); 85 | that.destroy(); 86 | }); 87 | if (this.cfg.handler4AlertBtn) { 88 | this.on('alert',this.cfg.handler4AlertBtn); 89 | }; 90 | if (this.cfg.handler4CloseBtn) { 91 | this.on('close',this.cfg.handler4CloseBtn); 92 | }; 93 | if (this.cfg.handler4PromptBtn) { 94 | this.on("prompt",this.cfg.handler4PromptBtn); 95 | }; 96 | }, 97 | syncUI:function(){ 98 | this.boudingBox.css({ 99 | width:this.cfg.width + 'px', 100 | height:this.cfg.height + 'px', 101 | left:(this.cfg.x||(window.innerWidth-this.cfg.width)/2) + 'px', 102 | top:(this.cfg.y||(window.innerHeight-this.cfg.height)/2) + 'px' 103 | }); 104 | if (this.cfg.skinClassName) { 105 | this.boudingBox.addClass(this.cfg.skinClassName); 106 | }; 107 | if (this.cfg.isDraggable) { 108 | if (this.cfg.dragHandle) { 109 | this.boudingBox.draggable({handle:this.cfg.dragHandle}); 110 | }else{ 111 | this.boudingBox.draggable(); 112 | } 113 | }; 114 | }, 115 | destructor:function(){ 116 | this._mask && this._mask.remove(); 117 | }, 118 | alert:function(cfg){ 119 | $.extend(this.cfg,cfg,{winType:'alert'}); 120 | this.render(); 121 | return this; 122 | }, 123 | confirm:function(cfg){ 124 | $.extend(this.cfg,cfg,{winType:'confirm'}); 125 | this.render(); 126 | return this; 127 | }, 128 | prompt:function(cfg){ 129 | $.extend(this.cfg,cfg,{winType:'prompt'}); 130 | this.render(); 131 | this._promptInput.focus(); 132 | return this; 133 | } 134 | }); 135 | 136 | return{ 137 | Window : Window 138 | } 139 | }) -------------------------------------------------------------------------------- /18.1 实现common方法/js/window.js: -------------------------------------------------------------------------------- 1 | define(['widget','jquery','jqueryUI'],function(widget,$,$UI){ 2 | function Window(){ 3 | this.cfg = { 4 | width:500, 5 | height:300, 6 | title:'系统消息', 7 | content:"", 8 | hasCloseBtn:false, 9 | hanMask:true, 10 | isDraggable:true, 11 | dragHandle:null, 12 | skinClassName:null, 13 | text4AlertBtn:'确定', 14 | text4CancelBtn:'取消', 15 | handler4AlertBtn:null, 16 | handler4CloseBtn:null, 17 | handler4ConfirmBtn:null, 18 | handler4CancelBtn:null, 19 | text4PromptBtn:'确定', 20 | isPromptInputPassword:false, 21 | defaultValue4PromptInput:false, 22 | maxlength4PromptInput:10, 23 | handler4PromptBtn:null 24 | }; 25 | } 26 | 27 | Window.prototype = $.extend({},new widget.Widget(),{ 28 | renderUI:function(){ 29 | var footerContent=''; 30 | switch(this.cfg.winType){ 31 | case "alert": 32 | footerContent=''; 33 | break; 34 | case "confirm": 35 | footerContent=''; 38 | break; 39 | case "prompt": 40 | this.cfg.content+='

'; 45 | footerContent=''; 48 | break; 49 | } 50 | this.boudingBox = $( 51 | '
'+ 52 | '
'+this.cfg.content+'
'+ 53 | '
' 54 | ); 55 | if (this.cfg.winType!="common") { 56 | this.boudingBox.prepend('
'+this.cfg.title+'
'); 57 | this.boudingBox.append(''); 58 | }; 59 | /*处理模态*/ 60 | if (this.cfg.hanMask) { 61 | this._mask = $('
'); 62 | this._mask.appendTo("body"); 63 | } 64 | 65 | if(this.cfg.hasCloseBtn){ 66 | this.boudingBox.append('X'); 67 | } 68 | this.boudingBox.appendTo(document.body); 69 | this._promptInput = this.boudingBox.find('.window_promptInput'); 70 | }, 71 | bindUI:function(){ 72 | var that = this; 73 | this.boudingBox.delegate(".window_alertBtn","click",function(){ 74 | that.fire('alert'); 75 | that.destroy(); 76 | }).delegate(".window_closeBtn","click",function(){ 77 | that.fire('close'); 78 | that.destroy(); 79 | }).delegate(".window_confirmBtn","click",function(){ 80 | that.fire('confirm'); 81 | that.destroy(); 82 | }).delegate(".window_cancelBtn","click",function(){ 83 | that.fire('cancel'); 84 | that.destroy(); 85 | }).delegate(".window_promptBtn","click",function(){ 86 | that.fire('prompt',that._promptInput.val()); 87 | that.destroy(); 88 | }); 89 | if (this.cfg.handler4AlertBtn) { 90 | this.on('alert',this.cfg.handler4AlertBtn); 91 | }; 92 | if (this.cfg.handler4CloseBtn) { 93 | this.on('close',this.cfg.handler4CloseBtn); 94 | }; 95 | if (this.cfg.handler4PromptBtn) { 96 | this.on("prompt",this.cfg.handler4PromptBtn); 97 | }; 98 | }, 99 | syncUI:function(){ 100 | this.boudingBox.css({ 101 | width:this.cfg.width + 'px', 102 | height:this.cfg.height + 'px', 103 | left:(this.cfg.x||(window.innerWidth-this.cfg.width)/2) + 'px', 104 | top:(this.cfg.y||(window.innerHeight-this.cfg.height)/2) + 'px' 105 | }); 106 | if (this.cfg.skinClassName) { 107 | this.boudingBox.addClass(this.cfg.skinClassName); 108 | }; 109 | if (this.cfg.isDraggable) { 110 | if (this.cfg.dragHandle) { 111 | this.boudingBox.draggable({handle:this.cfg.dragHandle}); 112 | }else{ 113 | this.boudingBox.draggable(); 114 | } 115 | }; 116 | }, 117 | destructor:function(){ 118 | this._mask && this._mask.remove(); 119 | }, 120 | alert:function(cfg){ 121 | $.extend(this.cfg,cfg,{winType:'alert'}); 122 | this.render(); 123 | return this; 124 | }, 125 | confirm:function(cfg){ 126 | $.extend(this.cfg,cfg,{winType:'confirm'}); 127 | this.render(); 128 | return this; 129 | }, 130 | prompt:function(cfg){ 131 | $.extend(this.cfg,cfg,{winType:'prompt'}); 132 | this.render(); 133 | this._promptInput.focus(); 134 | return this; 135 | }, 136 | common:function(cfg){ 137 | $.extend(this.cfg,cfg,{winType:'common'}); 138 | this.render(); 139 | return this; 140 | } 141 | }); 142 | 143 | return{ 144 | Window : Window 145 | } 146 | }) -------------------------------------------------------------------------------- /11.1 拖动/js/jquery-ui-1.11.2.custom/jquery-ui.theme.min.css: -------------------------------------------------------------------------------- 1 | /*! jQuery UI - v1.11.2 - 2014-10-23 2 | * http://jqueryui.com 3 | * Copyright 2014 jQuery Foundation and other contributors; Licensed MIT */ 4 | 5 | .ui-widget{font-family:Trebuchet MS,Tahoma,Verdana,Arial,sans-serif;font-size:1.1em}.ui-widget .ui-widget{font-size:1em}.ui-widget input,.ui-widget select,.ui-widget textarea,.ui-widget button{font-family:Trebuchet MS,Tahoma,Verdana,Arial,sans-serif;font-size:1em}.ui-widget-content{border:1px solid #ddd;background:#eee url("images/ui-bg_highlight-soft_100_eeeeee_1x100.png") 50% top repeat-x;color:#333}.ui-widget-content a{color:#333}.ui-widget-header{border:1px solid #e78f08;background:#f6a828 url("images/ui-bg_gloss-wave_35_f6a828_500x100.png") 50% 50% repeat-x;color:#fff;font-weight:bold}.ui-widget-header a{color:#fff}.ui-state-default,.ui-widget-content .ui-state-default,.ui-widget-header .ui-state-default{border:1px solid #ccc;background:#f6f6f6 url("images/ui-bg_glass_100_f6f6f6_1x400.png") 50% 50% repeat-x;font-weight:bold;color:#1c94c4}.ui-state-default a,.ui-state-default a:link,.ui-state-default a:visited{color:#1c94c4;text-decoration:none}.ui-state-hover,.ui-widget-content .ui-state-hover,.ui-widget-header .ui-state-hover,.ui-state-focus,.ui-widget-content .ui-state-focus,.ui-widget-header .ui-state-focus{border:1px solid #fbcb09;background:#fdf5ce url("images/ui-bg_glass_100_fdf5ce_1x400.png") 50% 50% repeat-x;font-weight:bold;color:#c77405}.ui-state-hover a,.ui-state-hover a:hover,.ui-state-hover a:link,.ui-state-hover a:visited,.ui-state-focus a,.ui-state-focus a:hover,.ui-state-focus a:link,.ui-state-focus a:visited{color:#c77405;text-decoration:none}.ui-state-active,.ui-widget-content .ui-state-active,.ui-widget-header .ui-state-active{border:1px solid #fbd850;background:#fff url("images/ui-bg_glass_65_ffffff_1x400.png") 50% 50% repeat-x;font-weight:bold;color:#eb8f00}.ui-state-active a,.ui-state-active a:link,.ui-state-active a:visited{color:#eb8f00;text-decoration:none}.ui-state-highlight,.ui-widget-content .ui-state-highlight,.ui-widget-header .ui-state-highlight{border:1px solid #fed22f;background:#ffe45c url("images/ui-bg_highlight-soft_75_ffe45c_1x100.png") 50% top repeat-x;color:#363636}.ui-state-highlight a,.ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a{color:#363636}.ui-state-error,.ui-widget-content .ui-state-error,.ui-widget-header .ui-state-error{border:1px solid #cd0a0a;background:#b81900 url("images/ui-bg_diagonals-thick_18_b81900_40x40.png") 50% 50% repeat;color:#fff}.ui-state-error a,.ui-widget-content .ui-state-error a,.ui-widget-header .ui-state-error a{color:#fff}.ui-state-error-text,.ui-widget-content .ui-state-error-text,.ui-widget-header .ui-state-error-text{color:#fff}.ui-priority-primary,.ui-widget-content .ui-priority-primary,.ui-widget-header .ui-priority-primary{font-weight:bold}.ui-priority-secondary,.ui-widget-content .ui-priority-secondary,.ui-widget-header .ui-priority-secondary{opacity:.7;filter:Alpha(Opacity=70);font-weight:normal}.ui-state-disabled,.ui-widget-content .ui-state-disabled,.ui-widget-header .ui-state-disabled{opacity:.35;filter:Alpha(Opacity=35);background-image:none}.ui-state-disabled .ui-icon{filter:Alpha(Opacity=35)}.ui-icon{width:16px;height:16px}.ui-icon,.ui-widget-content .ui-icon{background-image:url("images/ui-icons_222222_256x240.png")}.ui-widget-header .ui-icon{background-image:url("images/ui-icons_ffffff_256x240.png")}.ui-state-default .ui-icon{background-image:url("images/ui-icons_ef8c08_256x240.png")}.ui-state-hover .ui-icon,.ui-state-focus .ui-icon{background-image:url("images/ui-icons_ef8c08_256x240.png")}.ui-state-active .ui-icon{background-image:url("images/ui-icons_ef8c08_256x240.png")}.ui-state-highlight .ui-icon{background-image:url("images/ui-icons_228ef1_256x240.png")}.ui-state-error .ui-icon,.ui-state-error-text .ui-icon{background-image:url("images/ui-icons_ffd27a_256x240.png")}.ui-icon-blank{background-position:16px 16px}.ui-icon-carat-1-n{background-position:0 0}.ui-icon-carat-1-ne{background-position:-16px 0}.ui-icon-carat-1-e{background-position:-32px 0}.ui-icon-carat-1-se{background-position:-48px 0}.ui-icon-carat-1-s{background-position:-64px 0}.ui-icon-carat-1-sw{background-position:-80px 0}.ui-icon-carat-1-w{background-position:-96px 0}.ui-icon-carat-1-nw{background-position:-112px 0}.ui-icon-carat-2-n-s{background-position:-128px 0}.ui-icon-carat-2-e-w{background-position:-144px 0}.ui-icon-triangle-1-n{background-position:0 -16px}.ui-icon-triangle-1-ne{background-position:-16px -16px}.ui-icon-triangle-1-e{background-position:-32px -16px}.ui-icon-triangle-1-se{background-position:-48px -16px}.ui-icon-triangle-1-s{background-position:-64px -16px}.ui-icon-triangle-1-sw{background-position:-80px -16px}.ui-icon-triangle-1-w{background-position:-96px -16px}.ui-icon-triangle-1-nw{background-position:-112px -16px}.ui-icon-triangle-2-n-s{background-position:-128px -16px}.ui-icon-triangle-2-e-w{background-position:-144px -16px}.ui-icon-arrow-1-n{background-position:0 -32px}.ui-icon-arrow-1-ne{background-position:-16px -32px}.ui-icon-arrow-1-e{background-position:-32px -32px}.ui-icon-arrow-1-se{background-position:-48px -32px}.ui-icon-arrow-1-s{background-position:-64px -32px}.ui-icon-arrow-1-sw{background-position:-80px -32px}.ui-icon-arrow-1-w{background-position:-96px -32px}.ui-icon-arrow-1-nw{background-position:-112px -32px}.ui-icon-arrow-2-n-s{background-position:-128px -32px}.ui-icon-arrow-2-ne-sw{background-position:-144px -32px}.ui-icon-arrow-2-e-w{background-position:-160px -32px}.ui-icon-arrow-2-se-nw{background-position:-176px -32px}.ui-icon-arrowstop-1-n{background-position:-192px -32px}.ui-icon-arrowstop-1-e{background-position:-208px -32px}.ui-icon-arrowstop-1-s{background-position:-224px -32px}.ui-icon-arrowstop-1-w{background-position:-240px -32px}.ui-icon-arrowthick-1-n{background-position:0 -48px}.ui-icon-arrowthick-1-ne{background-position:-16px -48px}.ui-icon-arrowthick-1-e{background-position:-32px -48px}.ui-icon-arrowthick-1-se{background-position:-48px -48px}.ui-icon-arrowthick-1-s{background-position:-64px -48px}.ui-icon-arrowthick-1-sw{background-position:-80px -48px}.ui-icon-arrowthick-1-w{background-position:-96px -48px}.ui-icon-arrowthick-1-nw{background-position:-112px -48px}.ui-icon-arrowthick-2-n-s{background-position:-128px -48px}.ui-icon-arrowthick-2-ne-sw{background-position:-144px -48px}.ui-icon-arrowthick-2-e-w{background-position:-160px -48px}.ui-icon-arrowthick-2-se-nw{background-position:-176px -48px}.ui-icon-arrowthickstop-1-n{background-position:-192px -48px}.ui-icon-arrowthickstop-1-e{background-position:-208px -48px}.ui-icon-arrowthickstop-1-s{background-position:-224px -48px}.ui-icon-arrowthickstop-1-w{background-position:-240px -48px}.ui-icon-arrowreturnthick-1-w{background-position:0 -64px}.ui-icon-arrowreturnthick-1-n{background-position:-16px -64px}.ui-icon-arrowreturnthick-1-e{background-position:-32px -64px}.ui-icon-arrowreturnthick-1-s{background-position:-48px -64px}.ui-icon-arrowreturn-1-w{background-position:-64px -64px}.ui-icon-arrowreturn-1-n{background-position:-80px -64px}.ui-icon-arrowreturn-1-e{background-position:-96px -64px}.ui-icon-arrowreturn-1-s{background-position:-112px -64px}.ui-icon-arrowrefresh-1-w{background-position:-128px -64px}.ui-icon-arrowrefresh-1-n{background-position:-144px -64px}.ui-icon-arrowrefresh-1-e{background-position:-160px -64px}.ui-icon-arrowrefresh-1-s{background-position:-176px -64px}.ui-icon-arrow-4{background-position:0 -80px}.ui-icon-arrow-4-diag{background-position:-16px -80px}.ui-icon-extlink{background-position:-32px -80px}.ui-icon-newwin{background-position:-48px -80px}.ui-icon-refresh{background-position:-64px -80px}.ui-icon-shuffle{background-position:-80px -80px}.ui-icon-transfer-e-w{background-position:-96px -80px}.ui-icon-transferthick-e-w{background-position:-112px -80px}.ui-icon-folder-collapsed{background-position:0 -96px}.ui-icon-folder-open{background-position:-16px -96px}.ui-icon-document{background-position:-32px -96px}.ui-icon-document-b{background-position:-48px -96px}.ui-icon-note{background-position:-64px -96px}.ui-icon-mail-closed{background-position:-80px -96px}.ui-icon-mail-open{background-position:-96px -96px}.ui-icon-suitcase{background-position:-112px -96px}.ui-icon-comment{background-position:-128px -96px}.ui-icon-person{background-position:-144px -96px}.ui-icon-print{background-position:-160px -96px}.ui-icon-trash{background-position:-176px -96px}.ui-icon-locked{background-position:-192px -96px}.ui-icon-unlocked{background-position:-208px -96px}.ui-icon-bookmark{background-position:-224px -96px}.ui-icon-tag{background-position:-240px -96px}.ui-icon-home{background-position:0 -112px}.ui-icon-flag{background-position:-16px -112px}.ui-icon-calendar{background-position:-32px -112px}.ui-icon-cart{background-position:-48px -112px}.ui-icon-pencil{background-position:-64px -112px}.ui-icon-clock{background-position:-80px -112px}.ui-icon-disk{background-position:-96px -112px}.ui-icon-calculator{background-position:-112px -112px}.ui-icon-zoomin{background-position:-128px -112px}.ui-icon-zoomout{background-position:-144px -112px}.ui-icon-search{background-position:-160px -112px}.ui-icon-wrench{background-position:-176px -112px}.ui-icon-gear{background-position:-192px -112px}.ui-icon-heart{background-position:-208px -112px}.ui-icon-star{background-position:-224px -112px}.ui-icon-link{background-position:-240px -112px}.ui-icon-cancel{background-position:0 -128px}.ui-icon-plus{background-position:-16px -128px}.ui-icon-plusthick{background-position:-32px -128px}.ui-icon-minus{background-position:-48px -128px}.ui-icon-minusthick{background-position:-64px -128px}.ui-icon-close{background-position:-80px -128px}.ui-icon-closethick{background-position:-96px -128px}.ui-icon-key{background-position:-112px -128px}.ui-icon-lightbulb{background-position:-128px -128px}.ui-icon-scissors{background-position:-144px -128px}.ui-icon-clipboard{background-position:-160px -128px}.ui-icon-copy{background-position:-176px -128px}.ui-icon-contact{background-position:-192px -128px}.ui-icon-image{background-position:-208px -128px}.ui-icon-video{background-position:-224px -128px}.ui-icon-script{background-position:-240px -128px}.ui-icon-alert{background-position:0 -144px}.ui-icon-info{background-position:-16px -144px}.ui-icon-notice{background-position:-32px -144px}.ui-icon-help{background-position:-48px -144px}.ui-icon-check{background-position:-64px -144px}.ui-icon-bullet{background-position:-80px -144px}.ui-icon-radio-on{background-position:-96px -144px}.ui-icon-radio-off{background-position:-112px -144px}.ui-icon-pin-w{background-position:-128px -144px}.ui-icon-pin-s{background-position:-144px -144px}.ui-icon-play{background-position:0 -160px}.ui-icon-pause{background-position:-16px -160px}.ui-icon-seek-next{background-position:-32px -160px}.ui-icon-seek-prev{background-position:-48px -160px}.ui-icon-seek-end{background-position:-64px -160px}.ui-icon-seek-start{background-position:-80px -160px}.ui-icon-seek-first{background-position:-80px -160px}.ui-icon-stop{background-position:-96px -160px}.ui-icon-eject{background-position:-112px -160px}.ui-icon-volume-off{background-position:-128px -160px}.ui-icon-volume-on{background-position:-144px -160px}.ui-icon-power{background-position:0 -176px}.ui-icon-signal-diag{background-position:-16px -176px}.ui-icon-signal{background-position:-32px -176px}.ui-icon-battery-0{background-position:-48px -176px}.ui-icon-battery-1{background-position:-64px -176px}.ui-icon-battery-2{background-position:-80px -176px}.ui-icon-battery-3{background-position:-96px -176px}.ui-icon-circle-plus{background-position:0 -192px}.ui-icon-circle-minus{background-position:-16px -192px}.ui-icon-circle-close{background-position:-32px -192px}.ui-icon-circle-triangle-e{background-position:-48px -192px}.ui-icon-circle-triangle-s{background-position:-64px -192px}.ui-icon-circle-triangle-w{background-position:-80px -192px}.ui-icon-circle-triangle-n{background-position:-96px -192px}.ui-icon-circle-arrow-e{background-position:-112px -192px}.ui-icon-circle-arrow-s{background-position:-128px -192px}.ui-icon-circle-arrow-w{background-position:-144px -192px}.ui-icon-circle-arrow-n{background-position:-160px -192px}.ui-icon-circle-zoomin{background-position:-176px -192px}.ui-icon-circle-zoomout{background-position:-192px -192px}.ui-icon-circle-check{background-position:-208px -192px}.ui-icon-circlesmall-plus{background-position:0 -208px}.ui-icon-circlesmall-minus{background-position:-16px -208px}.ui-icon-circlesmall-close{background-position:-32px -208px}.ui-icon-squaresmall-plus{background-position:-48px -208px}.ui-icon-squaresmall-minus{background-position:-64px -208px}.ui-icon-squaresmall-close{background-position:-80px -208px}.ui-icon-grip-dotted-vertical{background-position:0 -224px}.ui-icon-grip-dotted-horizontal{background-position:-16px -224px}.ui-icon-grip-solid-vertical{background-position:-32px -224px}.ui-icon-grip-solid-horizontal{background-position:-48px -224px}.ui-icon-gripsmall-diagonal-se{background-position:-64px -224px}.ui-icon-grip-diagonal-se{background-position:-80px -224px}.ui-corner-all,.ui-corner-top,.ui-corner-left,.ui-corner-tl{border-top-left-radius:4px}.ui-corner-all,.ui-corner-top,.ui-corner-right,.ui-corner-tr{border-top-right-radius:4px}.ui-corner-all,.ui-corner-bottom,.ui-corner-left,.ui-corner-bl{border-bottom-left-radius:4px}.ui-corner-all,.ui-corner-bottom,.ui-corner-right,.ui-corner-br{border-bottom-right-radius:4px}.ui-widget-overlay{background:#666 url("images/ui-bg_diagonals-thick_20_666666_40x40.png") 50% 50% repeat;opacity:.5;filter:Alpha(Opacity=50)}.ui-widget-shadow{margin:-5px 0 0 -5px;padding:5px;background:#000 url("images/ui-bg_flat_10_000000_40x100.png") 50% 50% repeat-x;opacity:.2;filter:Alpha(Opacity=20);border-radius:5px} -------------------------------------------------------------------------------- /12.2 自定义事件实现(一)/js/jquery-ui-1.11.2.custom/jquery-ui.theme.min.css: -------------------------------------------------------------------------------- 1 | /*! jQuery UI - v1.11.2 - 2014-10-23 2 | * http://jqueryui.com 3 | * Copyright 2014 jQuery Foundation and other contributors; Licensed MIT */ 4 | 5 | .ui-widget{font-family:Trebuchet MS,Tahoma,Verdana,Arial,sans-serif;font-size:1.1em}.ui-widget .ui-widget{font-size:1em}.ui-widget input,.ui-widget select,.ui-widget textarea,.ui-widget button{font-family:Trebuchet MS,Tahoma,Verdana,Arial,sans-serif;font-size:1em}.ui-widget-content{border:1px solid #ddd;background:#eee url("images/ui-bg_highlight-soft_100_eeeeee_1x100.png") 50% top repeat-x;color:#333}.ui-widget-content a{color:#333}.ui-widget-header{border:1px solid #e78f08;background:#f6a828 url("images/ui-bg_gloss-wave_35_f6a828_500x100.png") 50% 50% repeat-x;color:#fff;font-weight:bold}.ui-widget-header a{color:#fff}.ui-state-default,.ui-widget-content .ui-state-default,.ui-widget-header .ui-state-default{border:1px solid #ccc;background:#f6f6f6 url("images/ui-bg_glass_100_f6f6f6_1x400.png") 50% 50% repeat-x;font-weight:bold;color:#1c94c4}.ui-state-default a,.ui-state-default a:link,.ui-state-default a:visited{color:#1c94c4;text-decoration:none}.ui-state-hover,.ui-widget-content .ui-state-hover,.ui-widget-header .ui-state-hover,.ui-state-focus,.ui-widget-content .ui-state-focus,.ui-widget-header .ui-state-focus{border:1px solid #fbcb09;background:#fdf5ce url("images/ui-bg_glass_100_fdf5ce_1x400.png") 50% 50% repeat-x;font-weight:bold;color:#c77405}.ui-state-hover a,.ui-state-hover a:hover,.ui-state-hover a:link,.ui-state-hover a:visited,.ui-state-focus a,.ui-state-focus a:hover,.ui-state-focus a:link,.ui-state-focus a:visited{color:#c77405;text-decoration:none}.ui-state-active,.ui-widget-content .ui-state-active,.ui-widget-header .ui-state-active{border:1px solid #fbd850;background:#fff url("images/ui-bg_glass_65_ffffff_1x400.png") 50% 50% repeat-x;font-weight:bold;color:#eb8f00}.ui-state-active a,.ui-state-active a:link,.ui-state-active a:visited{color:#eb8f00;text-decoration:none}.ui-state-highlight,.ui-widget-content .ui-state-highlight,.ui-widget-header .ui-state-highlight{border:1px solid #fed22f;background:#ffe45c url("images/ui-bg_highlight-soft_75_ffe45c_1x100.png") 50% top repeat-x;color:#363636}.ui-state-highlight a,.ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a{color:#363636}.ui-state-error,.ui-widget-content .ui-state-error,.ui-widget-header .ui-state-error{border:1px solid #cd0a0a;background:#b81900 url("images/ui-bg_diagonals-thick_18_b81900_40x40.png") 50% 50% repeat;color:#fff}.ui-state-error a,.ui-widget-content .ui-state-error a,.ui-widget-header .ui-state-error a{color:#fff}.ui-state-error-text,.ui-widget-content .ui-state-error-text,.ui-widget-header .ui-state-error-text{color:#fff}.ui-priority-primary,.ui-widget-content .ui-priority-primary,.ui-widget-header .ui-priority-primary{font-weight:bold}.ui-priority-secondary,.ui-widget-content .ui-priority-secondary,.ui-widget-header .ui-priority-secondary{opacity:.7;filter:Alpha(Opacity=70);font-weight:normal}.ui-state-disabled,.ui-widget-content .ui-state-disabled,.ui-widget-header .ui-state-disabled{opacity:.35;filter:Alpha(Opacity=35);background-image:none}.ui-state-disabled .ui-icon{filter:Alpha(Opacity=35)}.ui-icon{width:16px;height:16px}.ui-icon,.ui-widget-content .ui-icon{background-image:url("images/ui-icons_222222_256x240.png")}.ui-widget-header .ui-icon{background-image:url("images/ui-icons_ffffff_256x240.png")}.ui-state-default .ui-icon{background-image:url("images/ui-icons_ef8c08_256x240.png")}.ui-state-hover .ui-icon,.ui-state-focus .ui-icon{background-image:url("images/ui-icons_ef8c08_256x240.png")}.ui-state-active .ui-icon{background-image:url("images/ui-icons_ef8c08_256x240.png")}.ui-state-highlight .ui-icon{background-image:url("images/ui-icons_228ef1_256x240.png")}.ui-state-error .ui-icon,.ui-state-error-text .ui-icon{background-image:url("images/ui-icons_ffd27a_256x240.png")}.ui-icon-blank{background-position:16px 16px}.ui-icon-carat-1-n{background-position:0 0}.ui-icon-carat-1-ne{background-position:-16px 0}.ui-icon-carat-1-e{background-position:-32px 0}.ui-icon-carat-1-se{background-position:-48px 0}.ui-icon-carat-1-s{background-position:-64px 0}.ui-icon-carat-1-sw{background-position:-80px 0}.ui-icon-carat-1-w{background-position:-96px 0}.ui-icon-carat-1-nw{background-position:-112px 0}.ui-icon-carat-2-n-s{background-position:-128px 0}.ui-icon-carat-2-e-w{background-position:-144px 0}.ui-icon-triangle-1-n{background-position:0 -16px}.ui-icon-triangle-1-ne{background-position:-16px -16px}.ui-icon-triangle-1-e{background-position:-32px -16px}.ui-icon-triangle-1-se{background-position:-48px -16px}.ui-icon-triangle-1-s{background-position:-64px -16px}.ui-icon-triangle-1-sw{background-position:-80px -16px}.ui-icon-triangle-1-w{background-position:-96px -16px}.ui-icon-triangle-1-nw{background-position:-112px -16px}.ui-icon-triangle-2-n-s{background-position:-128px -16px}.ui-icon-triangle-2-e-w{background-position:-144px -16px}.ui-icon-arrow-1-n{background-position:0 -32px}.ui-icon-arrow-1-ne{background-position:-16px -32px}.ui-icon-arrow-1-e{background-position:-32px -32px}.ui-icon-arrow-1-se{background-position:-48px -32px}.ui-icon-arrow-1-s{background-position:-64px -32px}.ui-icon-arrow-1-sw{background-position:-80px -32px}.ui-icon-arrow-1-w{background-position:-96px -32px}.ui-icon-arrow-1-nw{background-position:-112px -32px}.ui-icon-arrow-2-n-s{background-position:-128px -32px}.ui-icon-arrow-2-ne-sw{background-position:-144px -32px}.ui-icon-arrow-2-e-w{background-position:-160px -32px}.ui-icon-arrow-2-se-nw{background-position:-176px -32px}.ui-icon-arrowstop-1-n{background-position:-192px -32px}.ui-icon-arrowstop-1-e{background-position:-208px -32px}.ui-icon-arrowstop-1-s{background-position:-224px -32px}.ui-icon-arrowstop-1-w{background-position:-240px -32px}.ui-icon-arrowthick-1-n{background-position:0 -48px}.ui-icon-arrowthick-1-ne{background-position:-16px -48px}.ui-icon-arrowthick-1-e{background-position:-32px -48px}.ui-icon-arrowthick-1-se{background-position:-48px -48px}.ui-icon-arrowthick-1-s{background-position:-64px -48px}.ui-icon-arrowthick-1-sw{background-position:-80px -48px}.ui-icon-arrowthick-1-w{background-position:-96px -48px}.ui-icon-arrowthick-1-nw{background-position:-112px -48px}.ui-icon-arrowthick-2-n-s{background-position:-128px -48px}.ui-icon-arrowthick-2-ne-sw{background-position:-144px -48px}.ui-icon-arrowthick-2-e-w{background-position:-160px -48px}.ui-icon-arrowthick-2-se-nw{background-position:-176px -48px}.ui-icon-arrowthickstop-1-n{background-position:-192px -48px}.ui-icon-arrowthickstop-1-e{background-position:-208px -48px}.ui-icon-arrowthickstop-1-s{background-position:-224px -48px}.ui-icon-arrowthickstop-1-w{background-position:-240px -48px}.ui-icon-arrowreturnthick-1-w{background-position:0 -64px}.ui-icon-arrowreturnthick-1-n{background-position:-16px -64px}.ui-icon-arrowreturnthick-1-e{background-position:-32px -64px}.ui-icon-arrowreturnthick-1-s{background-position:-48px -64px}.ui-icon-arrowreturn-1-w{background-position:-64px -64px}.ui-icon-arrowreturn-1-n{background-position:-80px -64px}.ui-icon-arrowreturn-1-e{background-position:-96px -64px}.ui-icon-arrowreturn-1-s{background-position:-112px -64px}.ui-icon-arrowrefresh-1-w{background-position:-128px -64px}.ui-icon-arrowrefresh-1-n{background-position:-144px -64px}.ui-icon-arrowrefresh-1-e{background-position:-160px -64px}.ui-icon-arrowrefresh-1-s{background-position:-176px -64px}.ui-icon-arrow-4{background-position:0 -80px}.ui-icon-arrow-4-diag{background-position:-16px -80px}.ui-icon-extlink{background-position:-32px -80px}.ui-icon-newwin{background-position:-48px -80px}.ui-icon-refresh{background-position:-64px -80px}.ui-icon-shuffle{background-position:-80px -80px}.ui-icon-transfer-e-w{background-position:-96px -80px}.ui-icon-transferthick-e-w{background-position:-112px -80px}.ui-icon-folder-collapsed{background-position:0 -96px}.ui-icon-folder-open{background-position:-16px -96px}.ui-icon-document{background-position:-32px -96px}.ui-icon-document-b{background-position:-48px -96px}.ui-icon-note{background-position:-64px -96px}.ui-icon-mail-closed{background-position:-80px -96px}.ui-icon-mail-open{background-position:-96px -96px}.ui-icon-suitcase{background-position:-112px -96px}.ui-icon-comment{background-position:-128px -96px}.ui-icon-person{background-position:-144px -96px}.ui-icon-print{background-position:-160px -96px}.ui-icon-trash{background-position:-176px -96px}.ui-icon-locked{background-position:-192px -96px}.ui-icon-unlocked{background-position:-208px -96px}.ui-icon-bookmark{background-position:-224px -96px}.ui-icon-tag{background-position:-240px -96px}.ui-icon-home{background-position:0 -112px}.ui-icon-flag{background-position:-16px -112px}.ui-icon-calendar{background-position:-32px -112px}.ui-icon-cart{background-position:-48px -112px}.ui-icon-pencil{background-position:-64px -112px}.ui-icon-clock{background-position:-80px -112px}.ui-icon-disk{background-position:-96px -112px}.ui-icon-calculator{background-position:-112px -112px}.ui-icon-zoomin{background-position:-128px -112px}.ui-icon-zoomout{background-position:-144px -112px}.ui-icon-search{background-position:-160px -112px}.ui-icon-wrench{background-position:-176px -112px}.ui-icon-gear{background-position:-192px -112px}.ui-icon-heart{background-position:-208px -112px}.ui-icon-star{background-position:-224px -112px}.ui-icon-link{background-position:-240px -112px}.ui-icon-cancel{background-position:0 -128px}.ui-icon-plus{background-position:-16px -128px}.ui-icon-plusthick{background-position:-32px -128px}.ui-icon-minus{background-position:-48px -128px}.ui-icon-minusthick{background-position:-64px -128px}.ui-icon-close{background-position:-80px -128px}.ui-icon-closethick{background-position:-96px -128px}.ui-icon-key{background-position:-112px -128px}.ui-icon-lightbulb{background-position:-128px -128px}.ui-icon-scissors{background-position:-144px -128px}.ui-icon-clipboard{background-position:-160px -128px}.ui-icon-copy{background-position:-176px -128px}.ui-icon-contact{background-position:-192px -128px}.ui-icon-image{background-position:-208px -128px}.ui-icon-video{background-position:-224px -128px}.ui-icon-script{background-position:-240px -128px}.ui-icon-alert{background-position:0 -144px}.ui-icon-info{background-position:-16px -144px}.ui-icon-notice{background-position:-32px -144px}.ui-icon-help{background-position:-48px -144px}.ui-icon-check{background-position:-64px -144px}.ui-icon-bullet{background-position:-80px -144px}.ui-icon-radio-on{background-position:-96px -144px}.ui-icon-radio-off{background-position:-112px -144px}.ui-icon-pin-w{background-position:-128px -144px}.ui-icon-pin-s{background-position:-144px -144px}.ui-icon-play{background-position:0 -160px}.ui-icon-pause{background-position:-16px -160px}.ui-icon-seek-next{background-position:-32px -160px}.ui-icon-seek-prev{background-position:-48px -160px}.ui-icon-seek-end{background-position:-64px -160px}.ui-icon-seek-start{background-position:-80px -160px}.ui-icon-seek-first{background-position:-80px -160px}.ui-icon-stop{background-position:-96px -160px}.ui-icon-eject{background-position:-112px -160px}.ui-icon-volume-off{background-position:-128px -160px}.ui-icon-volume-on{background-position:-144px -160px}.ui-icon-power{background-position:0 -176px}.ui-icon-signal-diag{background-position:-16px -176px}.ui-icon-signal{background-position:-32px -176px}.ui-icon-battery-0{background-position:-48px -176px}.ui-icon-battery-1{background-position:-64px -176px}.ui-icon-battery-2{background-position:-80px -176px}.ui-icon-battery-3{background-position:-96px -176px}.ui-icon-circle-plus{background-position:0 -192px}.ui-icon-circle-minus{background-position:-16px -192px}.ui-icon-circle-close{background-position:-32px -192px}.ui-icon-circle-triangle-e{background-position:-48px -192px}.ui-icon-circle-triangle-s{background-position:-64px -192px}.ui-icon-circle-triangle-w{background-position:-80px -192px}.ui-icon-circle-triangle-n{background-position:-96px -192px}.ui-icon-circle-arrow-e{background-position:-112px -192px}.ui-icon-circle-arrow-s{background-position:-128px -192px}.ui-icon-circle-arrow-w{background-position:-144px -192px}.ui-icon-circle-arrow-n{background-position:-160px -192px}.ui-icon-circle-zoomin{background-position:-176px -192px}.ui-icon-circle-zoomout{background-position:-192px -192px}.ui-icon-circle-check{background-position:-208px -192px}.ui-icon-circlesmall-plus{background-position:0 -208px}.ui-icon-circlesmall-minus{background-position:-16px -208px}.ui-icon-circlesmall-close{background-position:-32px -208px}.ui-icon-squaresmall-plus{background-position:-48px -208px}.ui-icon-squaresmall-minus{background-position:-64px -208px}.ui-icon-squaresmall-close{background-position:-80px -208px}.ui-icon-grip-dotted-vertical{background-position:0 -224px}.ui-icon-grip-dotted-horizontal{background-position:-16px -224px}.ui-icon-grip-solid-vertical{background-position:-32px -224px}.ui-icon-grip-solid-horizontal{background-position:-48px -224px}.ui-icon-gripsmall-diagonal-se{background-position:-64px -224px}.ui-icon-grip-diagonal-se{background-position:-80px -224px}.ui-corner-all,.ui-corner-top,.ui-corner-left,.ui-corner-tl{border-top-left-radius:4px}.ui-corner-all,.ui-corner-top,.ui-corner-right,.ui-corner-tr{border-top-right-radius:4px}.ui-corner-all,.ui-corner-bottom,.ui-corner-left,.ui-corner-bl{border-bottom-left-radius:4px}.ui-corner-all,.ui-corner-bottom,.ui-corner-right,.ui-corner-br{border-bottom-right-radius:4px}.ui-widget-overlay{background:#666 url("images/ui-bg_diagonals-thick_20_666666_40x40.png") 50% 50% repeat;opacity:.5;filter:Alpha(Opacity=50)}.ui-widget-shadow{margin:-5px 0 0 -5px;padding:5px;background:#000 url("images/ui-bg_flat_10_000000_40x100.png") 50% 50% repeat-x;opacity:.2;filter:Alpha(Opacity=20);border-radius:5px} -------------------------------------------------------------------------------- /11.1 拖动/js/jquery-ui-1.11.2.custom/jquery-ui.structure.min.css: -------------------------------------------------------------------------------- 1 | /*! jQuery UI - v1.11.2 - 2014-10-19 2 | * http://jqueryui.com 3 | * Copyright 2014 jQuery Foundation and other contributors; Licensed MIT */ 4 | 5 | .ui-helper-hidden{display:none}.ui-helper-hidden-accessible{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.ui-helper-reset{margin:0;padding:0;border:0;outline:0;line-height:1.3;text-decoration:none;font-size:100%;list-style:none}.ui-helper-clearfix:before,.ui-helper-clearfix:after{content:"";display:table;border-collapse:collapse}.ui-helper-clearfix:after{clear:both}.ui-helper-clearfix{min-height:0}.ui-helper-zfix{width:100%;height:100%;top:0;left:0;position:absolute;opacity:0;filter:Alpha(Opacity=0)}.ui-front{z-index:100}.ui-state-disabled{cursor:default!important}.ui-icon{display:block;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat}.ui-widget-overlay{position:fixed;top:0;left:0;width:100%;height:100%}.ui-draggable-handle{-ms-touch-action:none;touch-action:none}.ui-resizable{position:relative}.ui-resizable-handle{position:absolute;font-size:0.1px;display:block;-ms-touch-action:none;touch-action:none}.ui-resizable-disabled .ui-resizable-handle,.ui-resizable-autohide .ui-resizable-handle{display:none}.ui-resizable-n{cursor:n-resize;height:7px;width:100%;top:-5px;left:0}.ui-resizable-s{cursor:s-resize;height:7px;width:100%;bottom:-5px;left:0}.ui-resizable-e{cursor:e-resize;width:7px;right:-5px;top:0;height:100%}.ui-resizable-w{cursor:w-resize;width:7px;left:-5px;top:0;height:100%}.ui-resizable-se{cursor:se-resize;width:12px;height:12px;right:1px;bottom:1px}.ui-resizable-sw{cursor:sw-resize;width:9px;height:9px;left:-5px;bottom:-5px}.ui-resizable-nw{cursor:nw-resize;width:9px;height:9px;left:-5px;top:-5px}.ui-resizable-ne{cursor:ne-resize;width:9px;height:9px;right:-5px;top:-5px}.ui-selectable{-ms-touch-action:none;touch-action:none}.ui-selectable-helper{position:absolute;z-index:100;border:1px dotted black}.ui-sortable-handle{-ms-touch-action:none;touch-action:none}.ui-accordion .ui-accordion-header{display:block;cursor:pointer;position:relative;margin:2px 0 0 0;padding:.5em .5em .5em .7em;min-height:0;font-size:100%}.ui-accordion .ui-accordion-icons{padding-left:2.2em}.ui-accordion .ui-accordion-icons .ui-accordion-icons{padding-left:2.2em}.ui-accordion .ui-accordion-header .ui-accordion-header-icon{position:absolute;left:.5em;top:50%;margin-top:-8px}.ui-accordion .ui-accordion-content{padding:1em 2.2em;border-top:0;overflow:auto}.ui-autocomplete{position:absolute;top:0;left:0;cursor:default}.ui-button{display:inline-block;position:relative;padding:0;line-height:normal;margin-right:.1em;cursor:pointer;vertical-align:middle;text-align:center;overflow:visible}.ui-button,.ui-button:link,.ui-button:visited,.ui-button:hover,.ui-button:active{text-decoration:none}.ui-button-icon-only{width:2.2em}button.ui-button-icon-only{width:2.4em}.ui-button-icons-only{width:3.4em}button.ui-button-icons-only{width:3.7em}.ui-button .ui-button-text{display:block;line-height:normal}.ui-button-text-only .ui-button-text{padding:.4em 1em}.ui-button-icon-only .ui-button-text,.ui-button-icons-only .ui-button-text{padding:.4em;text-indent:-9999999px}.ui-button-text-icon-primary .ui-button-text,.ui-button-text-icons .ui-button-text{padding:.4em 1em .4em 2.1em}.ui-button-text-icon-secondary .ui-button-text,.ui-button-text-icons .ui-button-text{padding:.4em 2.1em .4em 1em}.ui-button-text-icons .ui-button-text{padding-left:2.1em;padding-right:2.1em}input.ui-button{padding:.4em 1em}.ui-button-icon-only .ui-icon,.ui-button-text-icon-primary .ui-icon,.ui-button-text-icon-secondary .ui-icon,.ui-button-text-icons .ui-icon,.ui-button-icons-only .ui-icon{position:absolute;top:50%;margin-top:-8px}.ui-button-icon-only .ui-icon{left:50%;margin-left:-8px}.ui-button-text-icon-primary .ui-button-icon-primary,.ui-button-text-icons .ui-button-icon-primary,.ui-button-icons-only .ui-button-icon-primary{left:.5em}.ui-button-text-icon-secondary .ui-button-icon-secondary,.ui-button-text-icons .ui-button-icon-secondary,.ui-button-icons-only .ui-button-icon-secondary{right:.5em}.ui-buttonset{margin-right:7px}.ui-buttonset .ui-button{margin-left:0;margin-right:-.3em}input.ui-button::-moz-focus-inner,button.ui-button::-moz-focus-inner{border:0;padding:0}.ui-datepicker{width:17em;padding:.2em .2em 0;display:none}.ui-datepicker .ui-datepicker-header{position:relative;padding:.2em 0}.ui-datepicker .ui-datepicker-prev,.ui-datepicker .ui-datepicker-next{position:absolute;top:2px;width:1.8em;height:1.8em}.ui-datepicker .ui-datepicker-prev-hover,.ui-datepicker .ui-datepicker-next-hover{top:1px}.ui-datepicker .ui-datepicker-prev{left:2px}.ui-datepicker .ui-datepicker-next{right:2px}.ui-datepicker .ui-datepicker-prev-hover{left:1px}.ui-datepicker .ui-datepicker-next-hover{right:1px}.ui-datepicker .ui-datepicker-prev span,.ui-datepicker .ui-datepicker-next span{display:block;position:absolute;left:50%;margin-left:-8px;top:50%;margin-top:-8px}.ui-datepicker .ui-datepicker-title{margin:0 2.3em;line-height:1.8em;text-align:center}.ui-datepicker .ui-datepicker-title select{font-size:1em;margin:1px 0}.ui-datepicker select.ui-datepicker-month,.ui-datepicker select.ui-datepicker-year{width:45%}.ui-datepicker table{width:100%;font-size:.9em;border-collapse:collapse;margin:0 0 .4em}.ui-datepicker th{padding:.7em .3em;text-align:center;font-weight:bold;border:0}.ui-datepicker td{border:0;padding:1px}.ui-datepicker td span,.ui-datepicker td a{display:block;padding:.2em;text-align:right;text-decoration:none}.ui-datepicker .ui-datepicker-buttonpane{background-image:none;margin:.7em 0 0 0;padding:0 .2em;border-left:0;border-right:0;border-bottom:0}.ui-datepicker .ui-datepicker-buttonpane button{float:right;margin:.5em .2em .4em;cursor:pointer;padding:.2em .6em .3em .6em;width:auto;overflow:visible}.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current{float:left}.ui-datepicker.ui-datepicker-multi{width:auto}.ui-datepicker-multi .ui-datepicker-group{float:left}.ui-datepicker-multi .ui-datepicker-group table{width:95%;margin:0 auto .4em}.ui-datepicker-multi-2 .ui-datepicker-group{width:50%}.ui-datepicker-multi-3 .ui-datepicker-group{width:33.3%}.ui-datepicker-multi-4 .ui-datepicker-group{width:25%}.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header,.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header{border-left-width:0}.ui-datepicker-multi .ui-datepicker-buttonpane{clear:left}.ui-datepicker-row-break{clear:both;width:100%;font-size:0}.ui-datepicker-rtl{direction:rtl}.ui-datepicker-rtl .ui-datepicker-prev{right:2px;left:auto}.ui-datepicker-rtl .ui-datepicker-next{left:2px;right:auto}.ui-datepicker-rtl .ui-datepicker-prev:hover{right:1px;left:auto}.ui-datepicker-rtl .ui-datepicker-next:hover{left:1px;right:auto}.ui-datepicker-rtl .ui-datepicker-buttonpane{clear:right}.ui-datepicker-rtl .ui-datepicker-buttonpane button{float:left}.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current,.ui-datepicker-rtl .ui-datepicker-group{float:right}.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header,.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header{border-right-width:0;border-left-width:1px}.ui-dialog{overflow:hidden;position:absolute;top:0;left:0;padding:.2em;outline:0}.ui-dialog .ui-dialog-titlebar{padding:.4em 1em;position:relative}.ui-dialog .ui-dialog-title{float:left;margin:.1em 0;white-space:nowrap;width:90%;overflow:hidden;text-overflow:ellipsis}.ui-dialog .ui-dialog-titlebar-close{position:absolute;right:.3em;top:50%;width:20px;margin:-10px 0 0 0;padding:1px;height:20px}.ui-dialog .ui-dialog-content{position:relative;border:0;padding:.5em 1em;background:none;overflow:auto}.ui-dialog .ui-dialog-buttonpane{text-align:left;border-width:1px 0 0 0;background-image:none;margin-top:.5em;padding:.3em 1em .5em .4em}.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset{float:right}.ui-dialog .ui-dialog-buttonpane button{margin:.5em .4em .5em 0;cursor:pointer}.ui-dialog .ui-resizable-se{width:12px;height:12px;right:-5px;bottom:-5px;background-position:16px 16px}.ui-draggable .ui-dialog-titlebar{cursor:move}.ui-menu{list-style:none;padding:0;margin:0;display:block;outline:none}.ui-menu .ui-menu{position:absolute}.ui-menu .ui-menu-item{position:relative;margin:0;padding:3px 1em 3px .4em;cursor:pointer;min-height:0;list-style-image:url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7")}.ui-menu .ui-menu-divider{margin:5px 0;height:0;font-size:0;line-height:0;border-width:1px 0 0 0}.ui-menu .ui-state-focus,.ui-menu .ui-state-active{margin:-1px}.ui-menu-icons{position:relative}.ui-menu-icons .ui-menu-item{padding-left:2em}.ui-menu .ui-icon{position:absolute;top:0;bottom:0;left:.2em;margin:auto 0}.ui-menu .ui-menu-icon{left:auto;right:0}.ui-progressbar{height:2em;text-align:left;overflow:hidden}.ui-progressbar .ui-progressbar-value{margin:-1px;height:100%}.ui-progressbar .ui-progressbar-overlay{background:url("data:image/gif;base64,R0lGODlhKAAoAIABAAAAAP///yH/C05FVFNDQVBFMi4wAwEAAAAh+QQJAQABACwAAAAAKAAoAAACkYwNqXrdC52DS06a7MFZI+4FHBCKoDeWKXqymPqGqxvJrXZbMx7Ttc+w9XgU2FB3lOyQRWET2IFGiU9m1frDVpxZZc6bfHwv4c1YXP6k1Vdy292Fb6UkuvFtXpvWSzA+HycXJHUXiGYIiMg2R6W459gnWGfHNdjIqDWVqemH2ekpObkpOlppWUqZiqr6edqqWQAAIfkECQEAAQAsAAAAACgAKAAAApSMgZnGfaqcg1E2uuzDmmHUBR8Qil95hiPKqWn3aqtLsS18y7G1SzNeowWBENtQd+T1JktP05nzPTdJZlR6vUxNWWjV+vUWhWNkWFwxl9VpZRedYcflIOLafaa28XdsH/ynlcc1uPVDZxQIR0K25+cICCmoqCe5mGhZOfeYSUh5yJcJyrkZWWpaR8doJ2o4NYq62lAAACH5BAkBAAEALAAAAAAoACgAAAKVDI4Yy22ZnINRNqosw0Bv7i1gyHUkFj7oSaWlu3ovC8GxNso5fluz3qLVhBVeT/Lz7ZTHyxL5dDalQWPVOsQWtRnuwXaFTj9jVVh8pma9JjZ4zYSj5ZOyma7uuolffh+IR5aW97cHuBUXKGKXlKjn+DiHWMcYJah4N0lYCMlJOXipGRr5qdgoSTrqWSq6WFl2ypoaUAAAIfkECQEAAQAsAAAAACgAKAAAApaEb6HLgd/iO7FNWtcFWe+ufODGjRfoiJ2akShbueb0wtI50zm02pbvwfWEMWBQ1zKGlLIhskiEPm9R6vRXxV4ZzWT2yHOGpWMyorblKlNp8HmHEb/lCXjcW7bmtXP8Xt229OVWR1fod2eWqNfHuMjXCPkIGNileOiImVmCOEmoSfn3yXlJWmoHGhqp6ilYuWYpmTqKUgAAIfkECQEAAQAsAAAAACgAKAAAApiEH6kb58biQ3FNWtMFWW3eNVcojuFGfqnZqSebuS06w5V80/X02pKe8zFwP6EFWOT1lDFk8rGERh1TTNOocQ61Hm4Xm2VexUHpzjymViHrFbiELsefVrn6XKfnt2Q9G/+Xdie499XHd2g4h7ioOGhXGJboGAnXSBnoBwKYyfioubZJ2Hn0RuRZaflZOil56Zp6iioKSXpUAAAh+QQJAQABACwAAAAAKAAoAAACkoQRqRvnxuI7kU1a1UU5bd5tnSeOZXhmn5lWK3qNTWvRdQxP8qvaC+/yaYQzXO7BMvaUEmJRd3TsiMAgswmNYrSgZdYrTX6tSHGZO73ezuAw2uxuQ+BbeZfMxsexY35+/Qe4J1inV0g4x3WHuMhIl2jXOKT2Q+VU5fgoSUI52VfZyfkJGkha6jmY+aaYdirq+lQAACH5BAkBAAEALAAAAAAoACgAAAKWBIKpYe0L3YNKToqswUlvznigd4wiR4KhZrKt9Upqip61i9E3vMvxRdHlbEFiEXfk9YARYxOZZD6VQ2pUunBmtRXo1Lf8hMVVcNl8JafV38aM2/Fu5V16Bn63r6xt97j09+MXSFi4BniGFae3hzbH9+hYBzkpuUh5aZmHuanZOZgIuvbGiNeomCnaxxap2upaCZsq+1kAACH5BAkBAAEALAAAAAAoACgAAAKXjI8By5zf4kOxTVrXNVlv1X0d8IGZGKLnNpYtm8Lr9cqVeuOSvfOW79D9aDHizNhDJidFZhNydEahOaDH6nomtJjp1tutKoNWkvA6JqfRVLHU/QUfau9l2x7G54d1fl995xcIGAdXqMfBNadoYrhH+Mg2KBlpVpbluCiXmMnZ2Sh4GBqJ+ckIOqqJ6LmKSllZmsoq6wpQAAAh+QQJAQABACwAAAAAKAAoAAAClYx/oLvoxuJDkU1a1YUZbJ59nSd2ZXhWqbRa2/gF8Gu2DY3iqs7yrq+xBYEkYvFSM8aSSObE+ZgRl1BHFZNr7pRCavZ5BW2142hY3AN/zWtsmf12p9XxxFl2lpLn1rseztfXZjdIWIf2s5dItwjYKBgo9yg5pHgzJXTEeGlZuenpyPmpGQoKOWkYmSpaSnqKileI2FAAACH5BAkBAAEALAAAAAAoACgAAAKVjB+gu+jG4kORTVrVhRlsnn2dJ3ZleFaptFrb+CXmO9OozeL5VfP99HvAWhpiUdcwkpBH3825AwYdU8xTqlLGhtCosArKMpvfa1mMRae9VvWZfeB2XfPkeLmm18lUcBj+p5dnN8jXZ3YIGEhYuOUn45aoCDkp16hl5IjYJvjWKcnoGQpqyPlpOhr3aElaqrq56Bq7VAAAOw==");height:100%;filter:alpha(opacity=25);opacity:0.25}.ui-progressbar-indeterminate .ui-progressbar-value{background-image:none}.ui-selectmenu-menu{padding:0;margin:0;position:absolute;top:0;left:0;display:none}.ui-selectmenu-menu .ui-menu{overflow:auto;overflow-x:hidden;padding-bottom:1px}.ui-selectmenu-menu .ui-menu .ui-selectmenu-optgroup{font-size:1em;font-weight:bold;line-height:1.5;padding:2px 0.4em;margin:0.5em 0 0 0;height:auto;border:0}.ui-selectmenu-open{display:block}.ui-selectmenu-button{display:inline-block;overflow:hidden;position:relative;text-decoration:none;cursor:pointer}.ui-selectmenu-button span.ui-icon{right:0.5em;left:auto;margin-top:-8px;position:absolute;top:50%}.ui-selectmenu-button span.ui-selectmenu-text{text-align:left;padding:0.4em 2.1em 0.4em 1em;display:block;line-height:1.4;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ui-slider{position:relative;text-align:left}.ui-slider .ui-slider-handle{position:absolute;z-index:2;width:1.2em;height:1.2em;cursor:default;-ms-touch-action:none;touch-action:none}.ui-slider .ui-slider-range{position:absolute;z-index:1;font-size:.7em;display:block;border:0;background-position:0 0}.ui-slider.ui-state-disabled .ui-slider-handle,.ui-slider.ui-state-disabled .ui-slider-range{filter:inherit}.ui-slider-horizontal{height:.8em}.ui-slider-horizontal .ui-slider-handle{top:-.3em;margin-left:-.6em}.ui-slider-horizontal .ui-slider-range{top:0;height:100%}.ui-slider-horizontal .ui-slider-range-min{left:0}.ui-slider-horizontal .ui-slider-range-max{right:0}.ui-slider-vertical{width:.8em;height:100px}.ui-slider-vertical .ui-slider-handle{left:-.3em;margin-left:0;margin-bottom:-.6em}.ui-slider-vertical .ui-slider-range{left:0;width:100%}.ui-slider-vertical .ui-slider-range-min{bottom:0}.ui-slider-vertical .ui-slider-range-max{top:0}.ui-spinner{position:relative;display:inline-block;overflow:hidden;padding:0;vertical-align:middle}.ui-spinner-input{border:none;background:none;color:inherit;padding:0;margin:.2em 0;vertical-align:middle;margin-left:.4em;margin-right:22px}.ui-spinner-button{width:16px;height:50%;font-size:.5em;padding:0;margin:0;text-align:center;position:absolute;cursor:default;display:block;overflow:hidden;right:0}.ui-spinner a.ui-spinner-button{border-top:none;border-bottom:none;border-right:none}.ui-spinner .ui-icon{position:absolute;margin-top:-8px;top:50%;left:0}.ui-spinner-up{top:0}.ui-spinner-down{bottom:0}.ui-spinner .ui-icon-triangle-1-s{background-position:-65px -16px}.ui-tabs{position:relative;padding:.2em}.ui-tabs .ui-tabs-nav{margin:0;padding:.2em .2em 0}.ui-tabs .ui-tabs-nav li{list-style:none;float:left;position:relative;top:0;margin:1px .2em 0 0;border-bottom-width:0;padding:0;white-space:nowrap}.ui-tabs .ui-tabs-nav .ui-tabs-anchor{float:left;padding:.5em 1em;text-decoration:none}.ui-tabs .ui-tabs-nav li.ui-tabs-active{margin-bottom:-1px;padding-bottom:1px}.ui-tabs .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor,.ui-tabs .ui-tabs-nav li.ui-state-disabled .ui-tabs-anchor,.ui-tabs .ui-tabs-nav li.ui-tabs-loading .ui-tabs-anchor{cursor:text}.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor{cursor:pointer}.ui-tabs .ui-tabs-panel{display:block;border-width:0;padding:1em 1.4em;background:none}.ui-tooltip{padding:8px;position:absolute;z-index:9999;max-width:300px;-webkit-box-shadow:0 0 5px #aaa;box-shadow:0 0 5px #aaa}body .ui-tooltip{border-width:2px} -------------------------------------------------------------------------------- /12.2 自定义事件实现(一)/js/jquery-ui-1.11.2.custom/jquery-ui.structure.min.css: -------------------------------------------------------------------------------- 1 | /*! jQuery UI - v1.11.2 - 2014-10-19 2 | * http://jqueryui.com 3 | * Copyright 2014 jQuery Foundation and other contributors; Licensed MIT */ 4 | 5 | .ui-helper-hidden{display:none}.ui-helper-hidden-accessible{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.ui-helper-reset{margin:0;padding:0;border:0;outline:0;line-height:1.3;text-decoration:none;font-size:100%;list-style:none}.ui-helper-clearfix:before,.ui-helper-clearfix:after{content:"";display:table;border-collapse:collapse}.ui-helper-clearfix:after{clear:both}.ui-helper-clearfix{min-height:0}.ui-helper-zfix{width:100%;height:100%;top:0;left:0;position:absolute;opacity:0;filter:Alpha(Opacity=0)}.ui-front{z-index:100}.ui-state-disabled{cursor:default!important}.ui-icon{display:block;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat}.ui-widget-overlay{position:fixed;top:0;left:0;width:100%;height:100%}.ui-draggable-handle{-ms-touch-action:none;touch-action:none}.ui-resizable{position:relative}.ui-resizable-handle{position:absolute;font-size:0.1px;display:block;-ms-touch-action:none;touch-action:none}.ui-resizable-disabled .ui-resizable-handle,.ui-resizable-autohide .ui-resizable-handle{display:none}.ui-resizable-n{cursor:n-resize;height:7px;width:100%;top:-5px;left:0}.ui-resizable-s{cursor:s-resize;height:7px;width:100%;bottom:-5px;left:0}.ui-resizable-e{cursor:e-resize;width:7px;right:-5px;top:0;height:100%}.ui-resizable-w{cursor:w-resize;width:7px;left:-5px;top:0;height:100%}.ui-resizable-se{cursor:se-resize;width:12px;height:12px;right:1px;bottom:1px}.ui-resizable-sw{cursor:sw-resize;width:9px;height:9px;left:-5px;bottom:-5px}.ui-resizable-nw{cursor:nw-resize;width:9px;height:9px;left:-5px;top:-5px}.ui-resizable-ne{cursor:ne-resize;width:9px;height:9px;right:-5px;top:-5px}.ui-selectable{-ms-touch-action:none;touch-action:none}.ui-selectable-helper{position:absolute;z-index:100;border:1px dotted black}.ui-sortable-handle{-ms-touch-action:none;touch-action:none}.ui-accordion .ui-accordion-header{display:block;cursor:pointer;position:relative;margin:2px 0 0 0;padding:.5em .5em .5em .7em;min-height:0;font-size:100%}.ui-accordion .ui-accordion-icons{padding-left:2.2em}.ui-accordion .ui-accordion-icons .ui-accordion-icons{padding-left:2.2em}.ui-accordion .ui-accordion-header .ui-accordion-header-icon{position:absolute;left:.5em;top:50%;margin-top:-8px}.ui-accordion .ui-accordion-content{padding:1em 2.2em;border-top:0;overflow:auto}.ui-autocomplete{position:absolute;top:0;left:0;cursor:default}.ui-button{display:inline-block;position:relative;padding:0;line-height:normal;margin-right:.1em;cursor:pointer;vertical-align:middle;text-align:center;overflow:visible}.ui-button,.ui-button:link,.ui-button:visited,.ui-button:hover,.ui-button:active{text-decoration:none}.ui-button-icon-only{width:2.2em}button.ui-button-icon-only{width:2.4em}.ui-button-icons-only{width:3.4em}button.ui-button-icons-only{width:3.7em}.ui-button .ui-button-text{display:block;line-height:normal}.ui-button-text-only .ui-button-text{padding:.4em 1em}.ui-button-icon-only .ui-button-text,.ui-button-icons-only .ui-button-text{padding:.4em;text-indent:-9999999px}.ui-button-text-icon-primary .ui-button-text,.ui-button-text-icons .ui-button-text{padding:.4em 1em .4em 2.1em}.ui-button-text-icon-secondary .ui-button-text,.ui-button-text-icons .ui-button-text{padding:.4em 2.1em .4em 1em}.ui-button-text-icons .ui-button-text{padding-left:2.1em;padding-right:2.1em}input.ui-button{padding:.4em 1em}.ui-button-icon-only .ui-icon,.ui-button-text-icon-primary .ui-icon,.ui-button-text-icon-secondary .ui-icon,.ui-button-text-icons .ui-icon,.ui-button-icons-only .ui-icon{position:absolute;top:50%;margin-top:-8px}.ui-button-icon-only .ui-icon{left:50%;margin-left:-8px}.ui-button-text-icon-primary .ui-button-icon-primary,.ui-button-text-icons .ui-button-icon-primary,.ui-button-icons-only .ui-button-icon-primary{left:.5em}.ui-button-text-icon-secondary .ui-button-icon-secondary,.ui-button-text-icons .ui-button-icon-secondary,.ui-button-icons-only .ui-button-icon-secondary{right:.5em}.ui-buttonset{margin-right:7px}.ui-buttonset .ui-button{margin-left:0;margin-right:-.3em}input.ui-button::-moz-focus-inner,button.ui-button::-moz-focus-inner{border:0;padding:0}.ui-datepicker{width:17em;padding:.2em .2em 0;display:none}.ui-datepicker .ui-datepicker-header{position:relative;padding:.2em 0}.ui-datepicker .ui-datepicker-prev,.ui-datepicker .ui-datepicker-next{position:absolute;top:2px;width:1.8em;height:1.8em}.ui-datepicker .ui-datepicker-prev-hover,.ui-datepicker .ui-datepicker-next-hover{top:1px}.ui-datepicker .ui-datepicker-prev{left:2px}.ui-datepicker .ui-datepicker-next{right:2px}.ui-datepicker .ui-datepicker-prev-hover{left:1px}.ui-datepicker .ui-datepicker-next-hover{right:1px}.ui-datepicker .ui-datepicker-prev span,.ui-datepicker .ui-datepicker-next span{display:block;position:absolute;left:50%;margin-left:-8px;top:50%;margin-top:-8px}.ui-datepicker .ui-datepicker-title{margin:0 2.3em;line-height:1.8em;text-align:center}.ui-datepicker .ui-datepicker-title select{font-size:1em;margin:1px 0}.ui-datepicker select.ui-datepicker-month,.ui-datepicker select.ui-datepicker-year{width:45%}.ui-datepicker table{width:100%;font-size:.9em;border-collapse:collapse;margin:0 0 .4em}.ui-datepicker th{padding:.7em .3em;text-align:center;font-weight:bold;border:0}.ui-datepicker td{border:0;padding:1px}.ui-datepicker td span,.ui-datepicker td a{display:block;padding:.2em;text-align:right;text-decoration:none}.ui-datepicker .ui-datepicker-buttonpane{background-image:none;margin:.7em 0 0 0;padding:0 .2em;border-left:0;border-right:0;border-bottom:0}.ui-datepicker .ui-datepicker-buttonpane button{float:right;margin:.5em .2em .4em;cursor:pointer;padding:.2em .6em .3em .6em;width:auto;overflow:visible}.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current{float:left}.ui-datepicker.ui-datepicker-multi{width:auto}.ui-datepicker-multi .ui-datepicker-group{float:left}.ui-datepicker-multi .ui-datepicker-group table{width:95%;margin:0 auto .4em}.ui-datepicker-multi-2 .ui-datepicker-group{width:50%}.ui-datepicker-multi-3 .ui-datepicker-group{width:33.3%}.ui-datepicker-multi-4 .ui-datepicker-group{width:25%}.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header,.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header{border-left-width:0}.ui-datepicker-multi .ui-datepicker-buttonpane{clear:left}.ui-datepicker-row-break{clear:both;width:100%;font-size:0}.ui-datepicker-rtl{direction:rtl}.ui-datepicker-rtl .ui-datepicker-prev{right:2px;left:auto}.ui-datepicker-rtl .ui-datepicker-next{left:2px;right:auto}.ui-datepicker-rtl .ui-datepicker-prev:hover{right:1px;left:auto}.ui-datepicker-rtl .ui-datepicker-next:hover{left:1px;right:auto}.ui-datepicker-rtl .ui-datepicker-buttonpane{clear:right}.ui-datepicker-rtl .ui-datepicker-buttonpane button{float:left}.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current,.ui-datepicker-rtl .ui-datepicker-group{float:right}.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header,.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header{border-right-width:0;border-left-width:1px}.ui-dialog{overflow:hidden;position:absolute;top:0;left:0;padding:.2em;outline:0}.ui-dialog .ui-dialog-titlebar{padding:.4em 1em;position:relative}.ui-dialog .ui-dialog-title{float:left;margin:.1em 0;white-space:nowrap;width:90%;overflow:hidden;text-overflow:ellipsis}.ui-dialog .ui-dialog-titlebar-close{position:absolute;right:.3em;top:50%;width:20px;margin:-10px 0 0 0;padding:1px;height:20px}.ui-dialog .ui-dialog-content{position:relative;border:0;padding:.5em 1em;background:none;overflow:auto}.ui-dialog .ui-dialog-buttonpane{text-align:left;border-width:1px 0 0 0;background-image:none;margin-top:.5em;padding:.3em 1em .5em .4em}.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset{float:right}.ui-dialog .ui-dialog-buttonpane button{margin:.5em .4em .5em 0;cursor:pointer}.ui-dialog .ui-resizable-se{width:12px;height:12px;right:-5px;bottom:-5px;background-position:16px 16px}.ui-draggable .ui-dialog-titlebar{cursor:move}.ui-menu{list-style:none;padding:0;margin:0;display:block;outline:none}.ui-menu .ui-menu{position:absolute}.ui-menu .ui-menu-item{position:relative;margin:0;padding:3px 1em 3px .4em;cursor:pointer;min-height:0;list-style-image:url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7")}.ui-menu .ui-menu-divider{margin:5px 0;height:0;font-size:0;line-height:0;border-width:1px 0 0 0}.ui-menu .ui-state-focus,.ui-menu .ui-state-active{margin:-1px}.ui-menu-icons{position:relative}.ui-menu-icons .ui-menu-item{padding-left:2em}.ui-menu .ui-icon{position:absolute;top:0;bottom:0;left:.2em;margin:auto 0}.ui-menu .ui-menu-icon{left:auto;right:0}.ui-progressbar{height:2em;text-align:left;overflow:hidden}.ui-progressbar .ui-progressbar-value{margin:-1px;height:100%}.ui-progressbar .ui-progressbar-overlay{background:url("data:image/gif;base64,R0lGODlhKAAoAIABAAAAAP///yH/C05FVFNDQVBFMi4wAwEAAAAh+QQJAQABACwAAAAAKAAoAAACkYwNqXrdC52DS06a7MFZI+4FHBCKoDeWKXqymPqGqxvJrXZbMx7Ttc+w9XgU2FB3lOyQRWET2IFGiU9m1frDVpxZZc6bfHwv4c1YXP6k1Vdy292Fb6UkuvFtXpvWSzA+HycXJHUXiGYIiMg2R6W459gnWGfHNdjIqDWVqemH2ekpObkpOlppWUqZiqr6edqqWQAAIfkECQEAAQAsAAAAACgAKAAAApSMgZnGfaqcg1E2uuzDmmHUBR8Qil95hiPKqWn3aqtLsS18y7G1SzNeowWBENtQd+T1JktP05nzPTdJZlR6vUxNWWjV+vUWhWNkWFwxl9VpZRedYcflIOLafaa28XdsH/ynlcc1uPVDZxQIR0K25+cICCmoqCe5mGhZOfeYSUh5yJcJyrkZWWpaR8doJ2o4NYq62lAAACH5BAkBAAEALAAAAAAoACgAAAKVDI4Yy22ZnINRNqosw0Bv7i1gyHUkFj7oSaWlu3ovC8GxNso5fluz3qLVhBVeT/Lz7ZTHyxL5dDalQWPVOsQWtRnuwXaFTj9jVVh8pma9JjZ4zYSj5ZOyma7uuolffh+IR5aW97cHuBUXKGKXlKjn+DiHWMcYJah4N0lYCMlJOXipGRr5qdgoSTrqWSq6WFl2ypoaUAAAIfkECQEAAQAsAAAAACgAKAAAApaEb6HLgd/iO7FNWtcFWe+ufODGjRfoiJ2akShbueb0wtI50zm02pbvwfWEMWBQ1zKGlLIhskiEPm9R6vRXxV4ZzWT2yHOGpWMyorblKlNp8HmHEb/lCXjcW7bmtXP8Xt229OVWR1fod2eWqNfHuMjXCPkIGNileOiImVmCOEmoSfn3yXlJWmoHGhqp6ilYuWYpmTqKUgAAIfkECQEAAQAsAAAAACgAKAAAApiEH6kb58biQ3FNWtMFWW3eNVcojuFGfqnZqSebuS06w5V80/X02pKe8zFwP6EFWOT1lDFk8rGERh1TTNOocQ61Hm4Xm2VexUHpzjymViHrFbiELsefVrn6XKfnt2Q9G/+Xdie499XHd2g4h7ioOGhXGJboGAnXSBnoBwKYyfioubZJ2Hn0RuRZaflZOil56Zp6iioKSXpUAAAh+QQJAQABACwAAAAAKAAoAAACkoQRqRvnxuI7kU1a1UU5bd5tnSeOZXhmn5lWK3qNTWvRdQxP8qvaC+/yaYQzXO7BMvaUEmJRd3TsiMAgswmNYrSgZdYrTX6tSHGZO73ezuAw2uxuQ+BbeZfMxsexY35+/Qe4J1inV0g4x3WHuMhIl2jXOKT2Q+VU5fgoSUI52VfZyfkJGkha6jmY+aaYdirq+lQAACH5BAkBAAEALAAAAAAoACgAAAKWBIKpYe0L3YNKToqswUlvznigd4wiR4KhZrKt9Upqip61i9E3vMvxRdHlbEFiEXfk9YARYxOZZD6VQ2pUunBmtRXo1Lf8hMVVcNl8JafV38aM2/Fu5V16Bn63r6xt97j09+MXSFi4BniGFae3hzbH9+hYBzkpuUh5aZmHuanZOZgIuvbGiNeomCnaxxap2upaCZsq+1kAACH5BAkBAAEALAAAAAAoACgAAAKXjI8By5zf4kOxTVrXNVlv1X0d8IGZGKLnNpYtm8Lr9cqVeuOSvfOW79D9aDHizNhDJidFZhNydEahOaDH6nomtJjp1tutKoNWkvA6JqfRVLHU/QUfau9l2x7G54d1fl995xcIGAdXqMfBNadoYrhH+Mg2KBlpVpbluCiXmMnZ2Sh4GBqJ+ckIOqqJ6LmKSllZmsoq6wpQAAAh+QQJAQABACwAAAAAKAAoAAAClYx/oLvoxuJDkU1a1YUZbJ59nSd2ZXhWqbRa2/gF8Gu2DY3iqs7yrq+xBYEkYvFSM8aSSObE+ZgRl1BHFZNr7pRCavZ5BW2142hY3AN/zWtsmf12p9XxxFl2lpLn1rseztfXZjdIWIf2s5dItwjYKBgo9yg5pHgzJXTEeGlZuenpyPmpGQoKOWkYmSpaSnqKileI2FAAACH5BAkBAAEALAAAAAAoACgAAAKVjB+gu+jG4kORTVrVhRlsnn2dJ3ZleFaptFrb+CXmO9OozeL5VfP99HvAWhpiUdcwkpBH3825AwYdU8xTqlLGhtCosArKMpvfa1mMRae9VvWZfeB2XfPkeLmm18lUcBj+p5dnN8jXZ3YIGEhYuOUn45aoCDkp16hl5IjYJvjWKcnoGQpqyPlpOhr3aElaqrq56Bq7VAAAOw==");height:100%;filter:alpha(opacity=25);opacity:0.25}.ui-progressbar-indeterminate .ui-progressbar-value{background-image:none}.ui-selectmenu-menu{padding:0;margin:0;position:absolute;top:0;left:0;display:none}.ui-selectmenu-menu .ui-menu{overflow:auto;overflow-x:hidden;padding-bottom:1px}.ui-selectmenu-menu .ui-menu .ui-selectmenu-optgroup{font-size:1em;font-weight:bold;line-height:1.5;padding:2px 0.4em;margin:0.5em 0 0 0;height:auto;border:0}.ui-selectmenu-open{display:block}.ui-selectmenu-button{display:inline-block;overflow:hidden;position:relative;text-decoration:none;cursor:pointer}.ui-selectmenu-button span.ui-icon{right:0.5em;left:auto;margin-top:-8px;position:absolute;top:50%}.ui-selectmenu-button span.ui-selectmenu-text{text-align:left;padding:0.4em 2.1em 0.4em 1em;display:block;line-height:1.4;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ui-slider{position:relative;text-align:left}.ui-slider .ui-slider-handle{position:absolute;z-index:2;width:1.2em;height:1.2em;cursor:default;-ms-touch-action:none;touch-action:none}.ui-slider .ui-slider-range{position:absolute;z-index:1;font-size:.7em;display:block;border:0;background-position:0 0}.ui-slider.ui-state-disabled .ui-slider-handle,.ui-slider.ui-state-disabled .ui-slider-range{filter:inherit}.ui-slider-horizontal{height:.8em}.ui-slider-horizontal .ui-slider-handle{top:-.3em;margin-left:-.6em}.ui-slider-horizontal .ui-slider-range{top:0;height:100%}.ui-slider-horizontal .ui-slider-range-min{left:0}.ui-slider-horizontal .ui-slider-range-max{right:0}.ui-slider-vertical{width:.8em;height:100px}.ui-slider-vertical .ui-slider-handle{left:-.3em;margin-left:0;margin-bottom:-.6em}.ui-slider-vertical .ui-slider-range{left:0;width:100%}.ui-slider-vertical .ui-slider-range-min{bottom:0}.ui-slider-vertical .ui-slider-range-max{top:0}.ui-spinner{position:relative;display:inline-block;overflow:hidden;padding:0;vertical-align:middle}.ui-spinner-input{border:none;background:none;color:inherit;padding:0;margin:.2em 0;vertical-align:middle;margin-left:.4em;margin-right:22px}.ui-spinner-button{width:16px;height:50%;font-size:.5em;padding:0;margin:0;text-align:center;position:absolute;cursor:default;display:block;overflow:hidden;right:0}.ui-spinner a.ui-spinner-button{border-top:none;border-bottom:none;border-right:none}.ui-spinner .ui-icon{position:absolute;margin-top:-8px;top:50%;left:0}.ui-spinner-up{top:0}.ui-spinner-down{bottom:0}.ui-spinner .ui-icon-triangle-1-s{background-position:-65px -16px}.ui-tabs{position:relative;padding:.2em}.ui-tabs .ui-tabs-nav{margin:0;padding:.2em .2em 0}.ui-tabs .ui-tabs-nav li{list-style:none;float:left;position:relative;top:0;margin:1px .2em 0 0;border-bottom-width:0;padding:0;white-space:nowrap}.ui-tabs .ui-tabs-nav .ui-tabs-anchor{float:left;padding:.5em 1em;text-decoration:none}.ui-tabs .ui-tabs-nav li.ui-tabs-active{margin-bottom:-1px;padding-bottom:1px}.ui-tabs .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor,.ui-tabs .ui-tabs-nav li.ui-state-disabled .ui-tabs-anchor,.ui-tabs .ui-tabs-nav li.ui-tabs-loading .ui-tabs-anchor{cursor:text}.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor{cursor:pointer}.ui-tabs .ui-tabs-panel{display:block;border-width:0;padding:1em 1.4em;background:none}.ui-tooltip{padding:8px;position:absolute;z-index:9999;max-width:300px;-webkit-box-shadow:0 0 5px #aaa;box-shadow:0 0 5px #aaa}body .ui-tooltip{border-width:2px} -------------------------------------------------------------------------------- /10.1 模态/js/require.js: -------------------------------------------------------------------------------- 1 | /* 2 | RequireJS 2.1.15 Copyright (c) 2010-2014, The Dojo Foundation All Rights Reserved. 3 | Available via the MIT or new BSD license. 4 | see: http://github.com/jrburke/requirejs for details 5 | */ 6 | var requirejs,require,define; 7 | (function(ba){function G(b){return"[object Function]"===K.call(b)}function H(b){return"[object Array]"===K.call(b)}function v(b,c){if(b){var d;for(d=0;dthis.depCount&&!this.defined){if(G(l)){if(this.events.error&&this.map.isDefine||g.onError!==ca)try{f=i.execCb(c,l,b,f)}catch(d){a=d}else f=i.execCb(c,l,b,f);this.map.isDefine&&void 0===f&&((b=this.module)?f=b.exports:this.usingExports&& 19 | (f=this.exports));if(a)return a.requireMap=this.map,a.requireModules=this.map.isDefine?[this.map.id]:null,a.requireType=this.map.isDefine?"define":"require",w(this.error=a)}else f=l;this.exports=f;if(this.map.isDefine&&!this.ignore&&(r[c]=f,g.onResourceLoad))g.onResourceLoad(i,this.map,this.depMaps);y(c);this.defined=!0}this.defining=!1;this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}}else this.fetch()}},callPlugin:function(){var a= 20 | this.map,b=a.id,d=p(a.prefix);this.depMaps.push(d);q(d,"defined",u(this,function(f){var l,d;d=m(aa,this.map.id);var e=this.map.name,P=this.map.parentMap?this.map.parentMap.name:null,n=i.makeRequire(a.parentMap,{enableBuildCallback:!0});if(this.map.unnormalized){if(f.normalize&&(e=f.normalize(e,function(a){return c(a,P,!0)})||""),f=p(a.prefix+"!"+e,this.map.parentMap),q(f,"defined",u(this,function(a){this.init([],function(){return a},null,{enabled:!0,ignore:!0})})),d=m(h,f.id)){this.depMaps.push(f); 21 | if(this.events.error)d.on("error",u(this,function(a){this.emit("error",a)}));d.enable()}}else d?(this.map.url=i.nameToUrl(d),this.load()):(l=u(this,function(a){this.init([],function(){return a},null,{enabled:!0})}),l.error=u(this,function(a){this.inited=!0;this.error=a;a.requireModules=[b];B(h,function(a){0===a.map.id.indexOf(b+"_unnormalized")&&y(a.map.id)});w(a)}),l.fromText=u(this,function(f,c){var d=a.name,e=p(d),P=M;c&&(f=c);P&&(M=!1);s(e);t(j.config,b)&&(j.config[d]=j.config[b]);try{g.exec(f)}catch(h){return w(C("fromtexteval", 22 | "fromText eval for "+b+" failed: "+h,h,[b]))}P&&(M=!0);this.depMaps.push(e);i.completeLoad(d);n([d],l)}),f.load(a.name,n,l,j))}));i.enable(d,this);this.pluginMaps[d.id]=d},enable:function(){V[this.map.id]=this;this.enabling=this.enabled=!0;v(this.depMaps,u(this,function(a,b){var c,f;if("string"===typeof a){a=p(a,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap);this.depMaps[b]=a;if(c=m(L,a.id)){this.depExports[b]=c(this);return}this.depCount+=1;q(a,"defined",u(this,function(a){this.defineDep(b, 23 | a);this.check()}));this.errback&&q(a,"error",u(this,this.errback))}c=a.id;f=h[c];!t(L,c)&&(f&&!f.enabled)&&i.enable(a,this)}));B(this.pluginMaps,u(this,function(a){var b=m(h,a.id);b&&!b.enabled&&i.enable(a,this)}));this.enabling=!1;this.check()},on:function(a,b){var c=this.events[a];c||(c=this.events[a]=[]);c.push(b)},emit:function(a,b){v(this.events[a],function(a){a(b)});"error"===a&&delete this.events[a]}};i={config:j,contextName:b,registry:h,defined:r,urlFetched:S,defQueue:A,Module:Z,makeModuleMap:p, 24 | nextTick:g.nextTick,onError:w,configure:function(a){a.baseUrl&&"/"!==a.baseUrl.charAt(a.baseUrl.length-1)&&(a.baseUrl+="/");var b=j.shim,c={paths:!0,bundles:!0,config:!0,map:!0};B(a,function(a,b){c[b]?(j[b]||(j[b]={}),U(j[b],a,!0,!0)):j[b]=a});a.bundles&&B(a.bundles,function(a,b){v(a,function(a){a!==b&&(aa[a]=b)})});a.shim&&(B(a.shim,function(a,c){H(a)&&(a={deps:a});if((a.exports||a.init)&&!a.exportsFn)a.exportsFn=i.makeShimExports(a);b[c]=a}),j.shim=b);a.packages&&v(a.packages,function(a){var b, 25 | a="string"===typeof a?{name:a}:a;b=a.name;a.location&&(j.paths[b]=a.location);j.pkgs[b]=a.name+"/"+(a.main||"main").replace(ia,"").replace(Q,"")});B(h,function(a,b){!a.inited&&!a.map.unnormalized&&(a.map=p(b))});if(a.deps||a.callback)i.require(a.deps||[],a.callback)},makeShimExports:function(a){return function(){var b;a.init&&(b=a.init.apply(ba,arguments));return b||a.exports&&da(a.exports)}},makeRequire:function(a,e){function j(c,d,m){var n,q;e.enableBuildCallback&&(d&&G(d))&&(d.__requireJsBuild= 26 | !0);if("string"===typeof c){if(G(d))return w(C("requireargs","Invalid require call"),m);if(a&&t(L,c))return L[c](h[a.id]);if(g.get)return g.get(i,c,a,j);n=p(c,a,!1,!0);n=n.id;return!t(r,n)?w(C("notloaded",'Module name "'+n+'" has not been loaded yet for context: '+b+(a?"":". Use require([])"))):r[n]}J();i.nextTick(function(){J();q=s(p(null,a));q.skipMap=e.skipMap;q.init(c,d,m,{enabled:!0});D()});return j}e=e||{};U(j,{isBrowser:z,toUrl:function(b){var d,e=b.lastIndexOf("."),k=b.split("/")[0];if(-1!== 27 | e&&(!("."===k||".."===k)||1e.attachEvent.toString().indexOf("[native code"))&&!Y?(M=!0,e.attachEvent("onreadystatechange",b.onScriptLoad)): 34 | (e.addEventListener("load",b.onScriptLoad,!1),e.addEventListener("error",b.onScriptError,!1)),e.src=d,J=e,D?y.insertBefore(e,D):y.appendChild(e),J=null,e;if(ea)try{importScripts(d),b.completeLoad(c)}catch(m){b.onError(C("importscripts","importScripts failed for "+c+" at "+d,m,[c]))}};z&&!q.skipDataMain&&T(document.getElementsByTagName("script"),function(b){y||(y=b.parentNode);if(I=b.getAttribute("data-main"))return s=I,q.baseUrl||(E=s.split("/"),s=E.pop(),O=E.length?E.join("/")+"/":"./",q.baseUrl= 35 | O),s=s.replace(Q,""),g.jsExtRegExp.test(s)&&(s=I),q.deps=q.deps?q.deps.concat(s):[s],!0});define=function(b,c,d){var e,g;"string"!==typeof b&&(d=c,c=b,b=null);H(c)||(d=c,c=null);!c&&G(d)&&(c=[],d.length&&(d.toString().replace(ka,"").replace(la,function(b,d){c.push(d)}),c=(1===d.length?["require"]:["require","exports","module"]).concat(c)));if(M){if(!(e=J))N&&"interactive"===N.readyState||T(document.getElementsByTagName("script"),function(b){if("interactive"===b.readyState)return N=b}),e=N;e&&(b|| 36 | (b=e.getAttribute("data-requiremodule")),g=F[e.getAttribute("data-requirecontext")])}(g?g.defQueue:R).push([b,c,d])};define.amd={jQuery:!0};g.exec=function(b){return eval(b)};g(q)}})(this); 37 | -------------------------------------------------------------------------------- /11.1 拖动/js/require.js: -------------------------------------------------------------------------------- 1 | /* 2 | RequireJS 2.1.15 Copyright (c) 2010-2014, The Dojo Foundation All Rights Reserved. 3 | Available via the MIT or new BSD license. 4 | see: http://github.com/jrburke/requirejs for details 5 | */ 6 | var requirejs,require,define; 7 | (function(ba){function G(b){return"[object Function]"===K.call(b)}function H(b){return"[object Array]"===K.call(b)}function v(b,c){if(b){var d;for(d=0;dthis.depCount&&!this.defined){if(G(l)){if(this.events.error&&this.map.isDefine||g.onError!==ca)try{f=i.execCb(c,l,b,f)}catch(d){a=d}else f=i.execCb(c,l,b,f);this.map.isDefine&&void 0===f&&((b=this.module)?f=b.exports:this.usingExports&& 19 | (f=this.exports));if(a)return a.requireMap=this.map,a.requireModules=this.map.isDefine?[this.map.id]:null,a.requireType=this.map.isDefine?"define":"require",w(this.error=a)}else f=l;this.exports=f;if(this.map.isDefine&&!this.ignore&&(r[c]=f,g.onResourceLoad))g.onResourceLoad(i,this.map,this.depMaps);y(c);this.defined=!0}this.defining=!1;this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}}else this.fetch()}},callPlugin:function(){var a= 20 | this.map,b=a.id,d=p(a.prefix);this.depMaps.push(d);q(d,"defined",u(this,function(f){var l,d;d=m(aa,this.map.id);var e=this.map.name,P=this.map.parentMap?this.map.parentMap.name:null,n=i.makeRequire(a.parentMap,{enableBuildCallback:!0});if(this.map.unnormalized){if(f.normalize&&(e=f.normalize(e,function(a){return c(a,P,!0)})||""),f=p(a.prefix+"!"+e,this.map.parentMap),q(f,"defined",u(this,function(a){this.init([],function(){return a},null,{enabled:!0,ignore:!0})})),d=m(h,f.id)){this.depMaps.push(f); 21 | if(this.events.error)d.on("error",u(this,function(a){this.emit("error",a)}));d.enable()}}else d?(this.map.url=i.nameToUrl(d),this.load()):(l=u(this,function(a){this.init([],function(){return a},null,{enabled:!0})}),l.error=u(this,function(a){this.inited=!0;this.error=a;a.requireModules=[b];B(h,function(a){0===a.map.id.indexOf(b+"_unnormalized")&&y(a.map.id)});w(a)}),l.fromText=u(this,function(f,c){var d=a.name,e=p(d),P=M;c&&(f=c);P&&(M=!1);s(e);t(j.config,b)&&(j.config[d]=j.config[b]);try{g.exec(f)}catch(h){return w(C("fromtexteval", 22 | "fromText eval for "+b+" failed: "+h,h,[b]))}P&&(M=!0);this.depMaps.push(e);i.completeLoad(d);n([d],l)}),f.load(a.name,n,l,j))}));i.enable(d,this);this.pluginMaps[d.id]=d},enable:function(){V[this.map.id]=this;this.enabling=this.enabled=!0;v(this.depMaps,u(this,function(a,b){var c,f;if("string"===typeof a){a=p(a,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap);this.depMaps[b]=a;if(c=m(L,a.id)){this.depExports[b]=c(this);return}this.depCount+=1;q(a,"defined",u(this,function(a){this.defineDep(b, 23 | a);this.check()}));this.errback&&q(a,"error",u(this,this.errback))}c=a.id;f=h[c];!t(L,c)&&(f&&!f.enabled)&&i.enable(a,this)}));B(this.pluginMaps,u(this,function(a){var b=m(h,a.id);b&&!b.enabled&&i.enable(a,this)}));this.enabling=!1;this.check()},on:function(a,b){var c=this.events[a];c||(c=this.events[a]=[]);c.push(b)},emit:function(a,b){v(this.events[a],function(a){a(b)});"error"===a&&delete this.events[a]}};i={config:j,contextName:b,registry:h,defined:r,urlFetched:S,defQueue:A,Module:Z,makeModuleMap:p, 24 | nextTick:g.nextTick,onError:w,configure:function(a){a.baseUrl&&"/"!==a.baseUrl.charAt(a.baseUrl.length-1)&&(a.baseUrl+="/");var b=j.shim,c={paths:!0,bundles:!0,config:!0,map:!0};B(a,function(a,b){c[b]?(j[b]||(j[b]={}),U(j[b],a,!0,!0)):j[b]=a});a.bundles&&B(a.bundles,function(a,b){v(a,function(a){a!==b&&(aa[a]=b)})});a.shim&&(B(a.shim,function(a,c){H(a)&&(a={deps:a});if((a.exports||a.init)&&!a.exportsFn)a.exportsFn=i.makeShimExports(a);b[c]=a}),j.shim=b);a.packages&&v(a.packages,function(a){var b, 25 | a="string"===typeof a?{name:a}:a;b=a.name;a.location&&(j.paths[b]=a.location);j.pkgs[b]=a.name+"/"+(a.main||"main").replace(ia,"").replace(Q,"")});B(h,function(a,b){!a.inited&&!a.map.unnormalized&&(a.map=p(b))});if(a.deps||a.callback)i.require(a.deps||[],a.callback)},makeShimExports:function(a){return function(){var b;a.init&&(b=a.init.apply(ba,arguments));return b||a.exports&&da(a.exports)}},makeRequire:function(a,e){function j(c,d,m){var n,q;e.enableBuildCallback&&(d&&G(d))&&(d.__requireJsBuild= 26 | !0);if("string"===typeof c){if(G(d))return w(C("requireargs","Invalid require call"),m);if(a&&t(L,c))return L[c](h[a.id]);if(g.get)return g.get(i,c,a,j);n=p(c,a,!1,!0);n=n.id;return!t(r,n)?w(C("notloaded",'Module name "'+n+'" has not been loaded yet for context: '+b+(a?"":". Use require([])"))):r[n]}J();i.nextTick(function(){J();q=s(p(null,a));q.skipMap=e.skipMap;q.init(c,d,m,{enabled:!0});D()});return j}e=e||{};U(j,{isBrowser:z,toUrl:function(b){var d,e=b.lastIndexOf("."),k=b.split("/")[0];if(-1!== 27 | e&&(!("."===k||".."===k)||1e.attachEvent.toString().indexOf("[native code"))&&!Y?(M=!0,e.attachEvent("onreadystatechange",b.onScriptLoad)): 34 | (e.addEventListener("load",b.onScriptLoad,!1),e.addEventListener("error",b.onScriptError,!1)),e.src=d,J=e,D?y.insertBefore(e,D):y.appendChild(e),J=null,e;if(ea)try{importScripts(d),b.completeLoad(c)}catch(m){b.onError(C("importscripts","importScripts failed for "+c+" at "+d,m,[c]))}};z&&!q.skipDataMain&&T(document.getElementsByTagName("script"),function(b){y||(y=b.parentNode);if(I=b.getAttribute("data-main"))return s=I,q.baseUrl||(E=s.split("/"),s=E.pop(),O=E.length?E.join("/")+"/":"./",q.baseUrl= 35 | O),s=s.replace(Q,""),g.jsExtRegExp.test(s)&&(s=I),q.deps=q.deps?q.deps.concat(s):[s],!0});define=function(b,c,d){var e,g;"string"!==typeof b&&(d=c,c=b,b=null);H(c)||(d=c,c=null);!c&&G(d)&&(c=[],d.length&&(d.toString().replace(ka,"").replace(la,function(b,d){c.push(d)}),c=(1===d.length?["require"]:["require","exports","module"]).concat(c)));if(M){if(!(e=J))N&&"interactive"===N.readyState||T(document.getElementsByTagName("script"),function(b){if("interactive"===b.readyState)return N=b}),e=N;e&&(b|| 36 | (b=e.getAttribute("data-requiremodule")),g=F[e.getAttribute("data-requirecontext")])}(g?g.defQueue:R).push([b,c,d])};define.amd={jQuery:!0};g.exec=function(b){return eval(b)};g(q)}})(this); 37 | --------------------------------------------------------------------------------