pull/64/merge
贤心 2021-01-15 22:10:31 +08:00
parent 0018e1a54f
commit 6adc9f6533
9 changed files with 30 additions and 26 deletions

View File

@ -1,4 +1,12 @@
 
# v3.2.0
* 优化 prompt 层初始赋值 value 时的光标会出现在最后(之前版本会在最前)
* 各项细节优化
---
# v3.1.1 2017.12.05 # v3.1.1 2017.12.05
* 优化自动获取路径代码,以解决部分浏览器下的某些场景无法自动加载样式问题 * 优化自动获取路径代码,以解决部分浏览器下的某些场景无法自动加载样式问题

View File

@ -1,7 +1,7 @@
{ {
"name": "layer", "name": "layer",
"main": "src/layer.js", "main": "src/layer.js",
"version": "3.1.0", "version": "3.2.0",
"homepage": "https://github.com/sentsin/layer", "homepage": "https://github.com/sentsin/layer",
"authors": [ "authors": [
"sentsin <xu@sentsin.com>" "sentsin <xu@sentsin.com>"

4
dist/layer.js vendored

File diff suppressed because one or more lines are too long

View File

@ -1,2 +1,2 @@
/*! layer mobile-v2.0.0 Web弹层组件 MIT License http://layer.layui.com/mobile By 贤心 */ /*! layer mobile-v2.0.0 Web 弹层组件 MIT License */
;!function(e){"use strict";var t=document,n="querySelectorAll",i="getElementsByClassName",a=function(e){return t[n](e)},s={type:0,shade:!0,shadeClose:!0,fixed:!0,anim:"scale"},l={extend:function(e){var t=JSON.parse(JSON.stringify(s));for(var n in e)t[n]=e[n];return t},timer:{},end:{}};l.touch=function(e,t){e.addEventListener("click",function(e){t.call(this,e)},!1)};var r=0,o=["layui-m-layer"],c=function(e){var t=this;t.config=l.extend(e),t.view()};c.prototype.view=function(){var e=this,n=e.config,s=t.createElement("div");e.id=s.id=o[0]+r,s.setAttribute("class",o[0]+" "+o[0]+(n.type||0)),s.setAttribute("index",r);var l=function(){var e="object"==typeof n.title;return n.title?'<h3 style="'+(e?n.title[1]:"")+'">'+(e?n.title[0]:n.title)+"</h3>":""}(),c=function(){"string"==typeof n.btn&&(n.btn=[n.btn]);var e,t=(n.btn||[]).length;return 0!==t&&n.btn?(e='<span yes type="1">'+n.btn[0]+"</span>",2===t&&(e='<span no type="0">'+n.btn[1]+"</span>"+e),'<div class="layui-m-layerbtn">'+e+"</div>"):""}();if(n.fixed||(n.top=n.hasOwnProperty("top")?n.top:100,n.style=n.style||"",n.style+=" top:"+(t.body.scrollTop+n.top)+"px"),2===n.type&&(n.content='<i></i><i class="layui-m-layerload"></i><i></i><p>'+(n.content||"")+"</p>"),n.skin&&(n.anim="up"),"msg"===n.skin&&(n.shade=!1),s.innerHTML=(n.shade?"<div "+("string"==typeof n.shade?'style="'+n.shade+'"':"")+' class="layui-m-layershade"></div>':"")+'<div class="layui-m-layermain" '+(n.fixed?"":'style="position:static;"')+'><div class="layui-m-layersection"><div class="layui-m-layerchild '+(n.skin?"layui-m-layer-"+n.skin+" ":"")+(n.className?n.className:"")+" "+(n.anim?"layui-m-anim-"+n.anim:"")+'" '+(n.style?'style="'+n.style+'"':"")+">"+l+'<div class="layui-m-layercont">'+n.content+"</div>"+c+"</div></div></div>",!n.type||2===n.type){var d=t[i](o[0]+n.type),y=d.length;y>=1&&layer.close(d[0].getAttribute("index"))}document.body.appendChild(s);var u=e.elem=a("#"+e.id)[0];n.success&&n.success(u),e.index=r++,e.action(n,u)},c.prototype.action=function(e,t){var n=this;e.time&&(l.timer[n.index]=setTimeout(function(){layer.close(n.index)},1e3*e.time));var a=function(){var t=this.getAttribute("type");0==t?(e.no&&e.no(),layer.close(n.index)):e.yes?e.yes(n.index):layer.close(n.index)};if(e.btn)for(var s=t[i]("layui-m-layerbtn")[0].children,r=s.length,o=0;o<r;o++)l.touch(s[o],a);if(e.shade&&e.shadeClose){var c=t[i]("layui-m-layershade")[0];l.touch(c,function(){layer.close(n.index,e.end)})}e.end&&(l.end[n.index]=e.end)},e.layer={v:"2.0",index:r,open:function(e){var t=new c(e||{});return t.index},close:function(e){var n=a("#"+o[0]+e)[0];n&&(n.innerHTML="",t.body.removeChild(n),clearTimeout(l.timer[e]),delete l.timer[e],"function"==typeof l.end[e]&&l.end[e](),delete l.end[e])},closeAll:function(){for(var e=t[i](o[0]),n=0,a=e.length;n<a;n++)layer.close(0|e[0].getAttribute("index"))}},"function"==typeof define?define(function(){return layer}):function(){var e=document.scripts,n=e[e.length-1],i=n.src,a=i.substring(0,i.lastIndexOf("/")+1);n.getAttribute("merge")||document.head.appendChild(function(){var e=t.createElement("link");return e.href=a+"need/layer.css?2.0",e.type="text/css",e.rel="styleSheet",e.id="layermcss",e}())}()}(window); ;!function(e){"use strict";var t=document,n="querySelectorAll",i="getElementsByClassName",a=function(e){return t[n](e)},s={type:0,shade:!0,shadeClose:!0,fixed:!0,anim:"scale"},l={extend:function(e){var t=JSON.parse(JSON.stringify(s));for(var n in e)t[n]=e[n];return t},timer:{},end:{}};l.touch=function(e,t){e.addEventListener("click",function(e){t.call(this,e)},!1)};var r=0,o=["layui-m-layer"],c=function(e){var t=this;t.config=l.extend(e),t.view()};c.prototype.view=function(){var e=this,n=e.config,s=t.createElement("div");e.id=s.id=o[0]+r,s.setAttribute("class",o[0]+" "+o[0]+(n.type||0)),s.setAttribute("index",r);var l=function(){var e="object"==typeof n.title;return n.title?'<h3 style="'+(e?n.title[1]:"")+'">'+(e?n.title[0]:n.title)+"</h3>":""}(),c=function(){"string"==typeof n.btn&&(n.btn=[n.btn]);var e,t=(n.btn||[]).length;return 0!==t&&n.btn?(e='<span yes type="1">'+n.btn[0]+"</span>",2===t&&(e='<span no type="0">'+n.btn[1]+"</span>"+e),'<div class="layui-m-layerbtn">'+e+"</div>"):""}();if(n.fixed||(n.top=n.hasOwnProperty("top")?n.top:100,n.style=n.style||"",n.style+=" top:"+(t.body.scrollTop+n.top)+"px"),2===n.type&&(n.content='<i></i><i class="layui-m-layerload"></i><i></i><p>'+(n.content||"")+"</p>"),n.skin&&(n.anim="up"),"msg"===n.skin&&(n.shade=!1),s.innerHTML=(n.shade?"<div "+("string"==typeof n.shade?'style="'+n.shade+'"':"")+' class="layui-m-layershade"></div>':"")+'<div class="layui-m-layermain" '+(n.fixed?"":'style="position:static;"')+'><div class="layui-m-layersection"><div class="layui-m-layerchild '+(n.skin?"layui-m-layer-"+n.skin+" ":"")+(n.className?n.className:"")+" "+(n.anim?"layui-m-anim-"+n.anim:"")+'" '+(n.style?'style="'+n.style+'"':"")+">"+l+'<div class="layui-m-layercont">'+n.content+"</div>"+c+"</div></div></div>",!n.type||2===n.type){var d=t[i](o[0]+n.type),y=d.length;y>=1&&layer.close(d[0].getAttribute("index"))}document.body.appendChild(s);var u=e.elem=a("#"+e.id)[0];n.success&&n.success(u),e.index=r++,e.action(n,u)},c.prototype.action=function(e,t){var n=this;e.time&&(l.timer[n.index]=setTimeout(function(){layer.close(n.index)},1e3*e.time));var a=function(){var t=this.getAttribute("type");0==t?(e.no&&e.no(),layer.close(n.index)):e.yes?e.yes(n.index):layer.close(n.index)};if(e.btn)for(var s=t[i]("layui-m-layerbtn")[0].children,r=s.length,o=0;o<r;o++)l.touch(s[o],a);if(e.shade&&e.shadeClose){var c=t[i]("layui-m-layershade")[0];l.touch(c,function(){layer.close(n.index,e.end)})}e.end&&(l.end[n.index]=e.end)},e.layer={v:"2.0",index:r,open:function(e){var t=new c(e||{});return t.index},close:function(e){var n=a("#"+o[0]+e)[0];n&&(n.innerHTML="",t.body.removeChild(n),clearTimeout(l.timer[e]),delete l.timer[e],"function"==typeof l.end[e]&&l.end[e](),delete l.end[e])},closeAll:function(){for(var e=t[i](o[0]),n=0,a=e.length;n<a;n++)layer.close(0|e[0].getAttribute("index"))}},"function"==typeof define?define(function(){return layer}):function(){var e=document.scripts,n=e[e.length-1],i=n.src,a=i.substring(0,i.lastIndexOf("/")+1);n.getAttribute("merge")||document.head.appendChild(function(){var e=t.createElement("link");return e.href=a+"need/layer.css?2.0",e.type="text/css",e.rel="styleSheet",e.id="layermcss",e}())}()}(window);

View File

@ -1,5 +1,5 @@
/** /**
layer构建 layer 构建
*/ */
var pkg = require('./package.json'); var pkg = require('./package.json');
@ -20,13 +20,13 @@ var task = {
.pipe(gulp.dest('./dist')); .pipe(gulp.dest('./dist'));
return gulp.src('./src/layer.js').pipe(uglify()) return gulp.src('./src/layer.js').pipe(uglify())
.pipe(header('/*! <%= pkg.realname %>-v<%= pkg.version %> <%= pkg.description %> <%= pkg.license %> License <%= pkg.homepage %> By <%= pkg.author %> */\n ;', {pkg: pkg})) .pipe(header('/** <%= pkg.realname %>-v<%= pkg.version %> <%= pkg.description %> <%= pkg.license %> License */\n ;', {pkg: pkg}))
.pipe(gulp.dest('./dist')); .pipe(gulp.dest('./dist'));
} }
,mobile: function() { ,mobile: function() {
return gulp.src('./src/mobile/layer.js').pipe(uglify()) return gulp.src('./src/mobile/layer.js').pipe(uglify())
.pipe(header('/*! <%= pkg.realname %> mobile-v<%= pkg.mobile %> <%= pkg.description %> <%= pkg.license %> License <%= pkg.homepage %>mobile By <%= pkg.author %> */\n ;', {pkg: pkg})) .pipe(header('/*! <%= pkg.realname %> mobile-v<%= pkg.mobile %> <%= pkg.description %> <%= pkg.license %> License */\n ;', {pkg: pkg}))
.pipe(gulp.dest('./dist/mobile')); .pipe(gulp.dest('./dist/mobile'));
} }
,other: function(){ ,other: function(){

View File

@ -1,9 +1,9 @@
{ {
"name": "layui-layer", "name": "layui-layer",
"realname": "layer", "realname": "layer",
"version": "3.1.1", "version": "3.2.0",
"mobile": "2.0.0", "mobile": "2.0.0",
"description": "Web弹层组件", "description": "Web 弹层组件",
"main": "src/layer.js", "main": "src/layer.js",
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
@ -14,7 +14,6 @@
"url": "git+https://github.com/sentsin/layer.git" "url": "git+https://github.com/sentsin/layer.git"
}, },
"author": "贤心", "author": "贤心",
"homepage": "http://layer.layui.com/",
"devDependencies": { "devDependencies": {
"gulp": "^3.9.0", "gulp": "^3.9.0",
"gulp-minify-css": "^1.2.4", "gulp-minify-css": "^1.2.4",

View File

@ -1,8 +1,7 @@
/** /**
@Namelayer v3.1.1 Web弹层组件 @Namelayer-v3.2.0 Web 弹层组件
@Author贤心 @Author贤心
@Sitehttp://layer.layui.com
@LicenseMIT @LicenseMIT
*/ */
@ -72,7 +71,7 @@ var isLayui = window.layui && layui.define, $, win, ready = {
//默认内置方法。 //默认内置方法。
var layer = { var layer = {
v: '3.1.1', v: '3.2.0',
ie: function(){ //ie版本 ie: function(){ //ie版本
var agent = navigator.userAgent.toLowerCase(); var agent = navigator.userAgent.toLowerCase();
return (!!window.ActiveXObject || "ActiveXObject" in window) ? ( return (!!window.ActiveXObject || "ActiveXObject" in window) ? (

View File

@ -2,8 +2,7 @@
@Namelayer mobile v2.0 弹层组件移动版 @Namelayer mobile v2.0 弹层组件移动版
@Author贤心 @Author贤心
@Sitehttp://layer.layui.com/mobie/ @LicenseMIT
@LicenseLGPL
*/ */

View File

@ -26,25 +26,24 @@
<body> <body>
<div class="box"> <div class="box">
<pre> <pre>
@Namelayer-v<script>document.write(layer.v)</script> 弹层组件说明 @Namelayer
@Author贤心 @Versionv<script>document.write(layer.v)</script>
@Site<a href="http://layer.layui.com/" target="_blank">http://layer.layui.com/</a> @Description通用 Web 弹层组件
<strong>【注意事项】</strong> <strong>【注意事项】</strong>
一、使用时请把文件夹layer整个放置在您站点的任何一个目录只需引入layer.js即可除jQuery外其它文件无需再引入。 一、使用时,请把文件夹 layer 整个放置在您站点的任何一个目录,只需引入 layer.js 即可,除 jQuery 外,其它文件无需再引入。
二、如果您的js引入是通过合并处理或者您不想采用layer自动获取的绝对路径您可以通过layer.config()来配置详见官网API页 二、如果您的 js 引入是通过合并处理或者您不想采用layer自动获取的绝对路径您可以通过 layer.config() 来配置(详见官网 API 页)
三、jquery需1.8+ 三、jQuery 需 1.8+
四、更多使用说明与演示请参见layer官网。 四、更多使用说明与演示,请参见 layer 官网。
五、使用时请务必保留来源,请勿用于违反我国法律法规的web平台。 五、使用时请务必保留来源,请勿用于违反我国法律法规的 Web 平台。
六、layer遵循MIT开源协议,将永久性提供无偿服务 六、layer 是一款无偿的公益性项目,遵循 MIT 开源协议。
</pre> </pre>
</div> </div>
<div class="box" style="text-align:center"> <div class="box" style="text-align:center">
<a href="http://layer.layui.com/" target="_blank">更多示例</a> <a href="http://layer.layui.com/" target="_blank">更多示例</a>
<a href="http://www.layui.com/doc/modules/layer.html" target="_blank">使用文档</a> <a href="http://www.layui.com/doc/modules/layer.html" target="_blank">使用文档</a>
<a href="http://fly.layui.com/" id="suggest">交流反馈</a>
<a href="javascript:;" id="about">关于</a> <a href="javascript:;" id="about">关于</a>
</div> </div>
@ -68,7 +67,7 @@ layer.ready(function(){
//关于 //关于
$('#about').on('click', function(){ $('#about').on('click', function(){
layer.alert(layer.v + ' - 贤心出品 sentsin.com'); layer.alert('layui 出品');
}); });
}(); }();