初始化webSite
1819
Examples/website/FreeSql.Site.UI/wwwroot/css/site.css
Normal file
1
Examples/website/FreeSql.Site.UI/wwwroot/css/site.min.css
vendored
Normal file
@ -0,0 +1 @@
|
||||
body{padding-top:50px;padding-bottom:20px}.body-content{padding-left:15px;padding-right:15px}.carousel-caption p{font-size:20px;line-height:1.4}.carousel-inner .item img[src$=".svg"]{width:100%}#qrCode{margin:15px}@media screen and (max-width:767px){.carousel-caption{display:none}}
|
BIN
Examples/website/FreeSql.Site.UI/wwwroot/favicon.ico
Normal file
After Width: | Height: | Size: 31 KiB |
After Width: | Height: | Size: 9.5 KiB |
After Width: | Height: | Size: 8.2 KiB |
After Width: | Height: | Size: 12 KiB |
483
Examples/website/FreeSql.Site.UI/wwwroot/js/site.js
Normal file
@ -0,0 +1,483 @@
|
||||
/**
|
||||
|
||||
layui官网
|
||||
|
||||
*/
|
||||
|
||||
layui.define(['code', 'element', 'table', 'util'], function (exports) {
|
||||
var $ = layui.jquery
|
||||
, element = layui.element
|
||||
, layer = layui.layer
|
||||
, form = layui.form
|
||||
, util = layui.util
|
||||
, device = layui.device()
|
||||
|
||||
, $win = $(window), $body = $('body');
|
||||
|
||||
|
||||
//阻止IE7以下访问
|
||||
if (device.ie && device.ie < 8) {
|
||||
layer.alert('Layui最低支持ie8,您当前使用的是古老的 IE' + device.ie + ',你丫的肯定不是程序猿!');
|
||||
}
|
||||
|
||||
var home = $('#LAY_home');
|
||||
|
||||
|
||||
layer.ready(function () {
|
||||
var local = layui.data('layui');
|
||||
|
||||
//升级提示
|
||||
if (local.version && local.version !== layui.v) {
|
||||
layer.open({
|
||||
type: 1
|
||||
, title: '更新提示' //不显示标题栏
|
||||
, closeBtn: false
|
||||
, area: '300px;'
|
||||
, shade: false
|
||||
, offset: 'b'
|
||||
, id: 'LAY_updateNotice' //设定一个id,防止重复弹出
|
||||
, btn: ['更新日志', '朕不想升']
|
||||
, btnAlign: 'c'
|
||||
, moveType: 1 //拖拽模式,0或者1
|
||||
, content: ['<div class="layui-text">'
|
||||
, 'layui 已更新到:<strong style="padding-right: 10px; color: #fff;">v' + layui.v + '</strong> <br>请注意升级!'
|
||||
, '</div>'].join('')
|
||||
, skin: 'layui-layer-notice'
|
||||
, yes: function (index) {
|
||||
layer.close(index);
|
||||
setTimeout(function () {
|
||||
location.href = '/doc/base/changelog.html';
|
||||
}, 500);
|
||||
}
|
||||
, end: function () {
|
||||
layui.data('layui', {
|
||||
key: 'version'
|
||||
, value: layui.v
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
layui.data('layui', {
|
||||
key: 'version'
|
||||
, value: layui.v
|
||||
});
|
||||
|
||||
|
||||
//公告
|
||||
; !function () {
|
||||
return layui.data('layui', {
|
||||
key: 'notice_20180530'
|
||||
, remove: true
|
||||
});
|
||||
|
||||
if (local.notice_20180530 && new Date().getTime() - local.notice_20180530 < 1000 * 60 * 60 * 24 * 5) {
|
||||
return;
|
||||
};
|
||||
|
||||
layer.open({
|
||||
type: 1
|
||||
, title: 'layui 官方通用后台管理模板'
|
||||
, closeBtn: false
|
||||
, area: ['300px', '280px']
|
||||
, shade: false
|
||||
//,offset: 'c'
|
||||
, id: 'LAY_Notice' //设定一个id,防止重复弹出
|
||||
, btn: ['前往围观', '朕不想看']
|
||||
, btnAlign: 'b'
|
||||
, moveType: 1 //拖拽模式,0或者1
|
||||
, resize: false
|
||||
, content: ['<div style="padding: 15px; text-align: center; background-color: #e2e2e2;">'
|
||||
, '<a href="/admin/std/dist/views/" target="_blank"><img src="//cdn.layui.com/upload/2018_5/168_1527691799254_76462.jpg" alt="layuiAdmin" style="width: 100%; height:149.78px;"></a>'
|
||||
, '</div>'].join('')
|
||||
, success: function (layero, index) {
|
||||
var btn = layero.find('.layui-layer-btn');
|
||||
btn.find('.layui-layer-btn0').attr({
|
||||
href: '/admin/std/dist/views/'
|
||||
, target: '_blank'
|
||||
});
|
||||
|
||||
layero.find('a').on('click', function () {
|
||||
layer.close(index);
|
||||
});
|
||||
}
|
||||
, end: function () {
|
||||
layui.data('layui', {
|
||||
key: 'notice_20180530'
|
||||
, value: new Date().getTime()
|
||||
});
|
||||
}
|
||||
});
|
||||
}();
|
||||
|
||||
});
|
||||
|
||||
; !function () {
|
||||
var elemComponentSelect = $(['<select lay-search lay-filter="component">'
|
||||
, '<option value="">搜索组件或模块</option>'
|
||||
, '<option value="element/layout.html">grid 栅格布局</option>'
|
||||
, '<option value="element/layout.html#admin">admin 后台布局</option>'
|
||||
, '<option value="element/color.html">color 颜色</option>'
|
||||
, '<option value="element/icon.html">iconfont 字体图标</option>'
|
||||
, '<option value="element/anim.html">animation 动画</option>'
|
||||
, '<option value="element/button.html">button 按钮</option>'
|
||||
, '<option value="element/form.html">form 表单组</option>'
|
||||
, '<option value="element/form.html#input">input 输入框</option>'
|
||||
, '<option value="element/form.html#select">select 下拉选择框</option>'
|
||||
, '<option value="element/form.html#checkbox">checkbox 复选框</option>'
|
||||
, '<option value="element/form.html#switch">switch 开关</option>'
|
||||
, '<option value="element/form.html#radio">radio 单选框</option>'
|
||||
, '<option value="element/form.html#textarea">textarea 文本域</option>'
|
||||
, '<option value="element/nav.html">nav 导航菜单</option>'
|
||||
, '<option value="element/nav.html#breadcrumb">breadcrumb 面包屑</option>'
|
||||
, '<option value="element/tab.html">tabs 选项卡</option>'
|
||||
, '<option value="element/progress.html">progress 进度条</option>'
|
||||
, '<option value="element/collapse.html">collapse 折叠面板/手风琴</option>'
|
||||
, '<option value="element/table.html">table 表格元素</option>'
|
||||
, '<option value="element/badge.html">badge 徽章</option>'
|
||||
, '<option value="element/timeline.html">timeline 时间线</option>'
|
||||
, '<option value="element/auxiliar.html#blockquote">blockquote 引用块</option>'
|
||||
, '<option value="element/auxiliar.html#fieldset">fieldset 字段集</option>'
|
||||
, '<option value="element/auxiliar.html#hr">hr 分割线</option>'
|
||||
|
||||
, '<option value="modules/layer.html">layer 弹出层/弹窗综合</option>'
|
||||
, '<option value="modules/laydate.html">laydate 日期时间选择器</option>'
|
||||
, '<option value="modules/layim.html">layim 即时通讯/聊天</option>'
|
||||
, '<option value="modules/laypage.html">laypage 分页</option>'
|
||||
, '<option value="modules/laytpl.html">laytpl 模板引擎</option>'
|
||||
, '<option value="modules/form.html">form 表单模块</option>'
|
||||
, '<option value="modules/table.html">table 数据表格</option>'
|
||||
, '<option value="modules/upload.html">upload 文件/图片上传</option>'
|
||||
, '<option value="modules/element.html">element 常用元素操作</option>'
|
||||
, '<option value="modules/rate.html">rate 评分</option>'
|
||||
, '<option value="modules/colorpicker.html">colorpicker 颜色选择器</option>'
|
||||
, '<option value="modules/slider.html">slider 滑块</option>'
|
||||
, '<option value="modules/carousel.html">carousel 轮播/跑马灯</option>'
|
||||
, '<option value="modules/layedit.html">layedit 富文本编辑器</option>'
|
||||
, '<option value="modules/tree.html">tree 树形菜单</option>'
|
||||
, '<option value="modules/flow.html">flow 信息流/图片懒加载</option>'
|
||||
, '<option value="modules/util.html">util 工具集</option>'
|
||||
, '<option value="modules/code.html">code 代码修饰</option>'
|
||||
, '</select>'].join(''));
|
||||
|
||||
$('.component').append(elemComponentSelect);
|
||||
form.render('select', 'LAY-site-header-component');
|
||||
|
||||
//搜索组件
|
||||
form.on('select(component)', function (data) {
|
||||
var value = data.value;
|
||||
location.href = '/doc/' + value;
|
||||
});
|
||||
}();
|
||||
|
||||
|
||||
//点击事件
|
||||
var events = {
|
||||
//联系方式
|
||||
contactInfo: function () {
|
||||
layer.alert('<div class="layui-text">如有合作意向,可联系:<br>邮箱:xianxin@layui-inc.com</div>', {
|
||||
title: '联系'
|
||||
, btn: false
|
||||
, shadeClose: true
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$body.on('click', '*[site-event]', function () {
|
||||
var othis = $(this)
|
||||
, attrEvent = othis.attr('site-event');
|
||||
events[attrEvent] && events[attrEvent].call(this, othis);
|
||||
});
|
||||
|
||||
//切换版本
|
||||
form.on('select(tabVersion)', function (data) {
|
||||
var value = data.value;
|
||||
location.href = value === 'new' ? '/' : ('/' + value + '/doc/');
|
||||
});
|
||||
|
||||
|
||||
//首页banner
|
||||
setTimeout(function () {
|
||||
$('.site-zfj').addClass('site-zfj-anim');
|
||||
setTimeout(function () {
|
||||
$('.site-desc').addClass('site-desc-anim')
|
||||
}, 5000)
|
||||
}, 100);
|
||||
|
||||
|
||||
//数字前置补零
|
||||
var digit = function (num, length, end) {
|
||||
var str = '';
|
||||
num = String(num);
|
||||
length = length || 2;
|
||||
for (var i = num.length; i < length; i++) {
|
||||
str += '0';
|
||||
}
|
||||
return num < Math.pow(10, length) ? str + (num | 0) : num;
|
||||
};
|
||||
|
||||
|
||||
//下载倒计时
|
||||
var setCountdown = $('#setCountdown');
|
||||
if ($('#setCountdown')[0]) {
|
||||
$.get('/api/getTime', function (res) {
|
||||
util.countdown(new Date(2017, 7, 21, 8, 30, 0), new Date(res.time), function (date, serverTime, timer) {
|
||||
var str = digit(date[1]) + ':' + digit(date[2]) + ':' + digit(date[3]);
|
||||
setCountdown.children('span').html(str);
|
||||
});
|
||||
}, 'jsonp');
|
||||
}
|
||||
|
||||
|
||||
|
||||
for (var i = 0; i < $('.adsbygoogle').length; i++) {
|
||||
(adsbygoogle = window.adsbygoogle || []).push({});
|
||||
}
|
||||
|
||||
|
||||
//展示当前版本
|
||||
$('.site-showv').html(layui.v);
|
||||
|
||||
////获取下载数
|
||||
//$.get('//fly.layui.com/api/handle?id=10&type=find', function (res) {
|
||||
// $('.site-showdowns').html(res.number);
|
||||
//}, 'jsonp');
|
||||
|
||||
////记录下载
|
||||
//$('.site-down').on('click', function () {
|
||||
// $.get('//fly.layui.com/api/handle?id=10', function () { }, 'jsonp');
|
||||
//});
|
||||
|
||||
//获取Github数据
|
||||
var getStars = $('#getStars');
|
||||
if (getStars[0]) {
|
||||
$.get('https://api.github.com/repos/2881099/FreeSql', function (res) {
|
||||
getStars.html(res.stargazers_count);
|
||||
}, 'json');
|
||||
}
|
||||
|
||||
//固定Bar
|
||||
if (global.pageType !== 'demo') {
|
||||
util.fixbar({
|
||||
bar1: true
|
||||
, click: function (type) {
|
||||
if (type === 'bar1') {
|
||||
location.href = '//fly.layui.com/';
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//窗口scroll
|
||||
; !function () {
|
||||
var main = $('.site-tree').parent(), scroll = function () {
|
||||
var stop = $(window).scrollTop();
|
||||
|
||||
if ($(window).width() <= 750) return;
|
||||
var bottom = $('.footer').offset().top - $(window).height();
|
||||
if (stop > 211 && stop < bottom) {
|
||||
if (!main.hasClass('site-fix')) {
|
||||
main.addClass('site-fix');
|
||||
}
|
||||
if (main.hasClass('site-fix-footer')) {
|
||||
main.removeClass('site-fix-footer');
|
||||
}
|
||||
} else if (stop >= bottom) {
|
||||
if (!main.hasClass('site-fix-footer')) {
|
||||
main.addClass('site-fix site-fix-footer');
|
||||
}
|
||||
} else {
|
||||
if (main.hasClass('site-fix')) {
|
||||
main.removeClass('site-fix').removeClass('site-fix-footer');
|
||||
}
|
||||
}
|
||||
stop = null;
|
||||
};
|
||||
scroll();
|
||||
$(window).on('scroll', scroll);
|
||||
}();
|
||||
|
||||
//示例页面滚动
|
||||
$('.site-demo-body').on('scroll', function () {
|
||||
var elemDate = $('.layui-laydate,.layui-colorpicker-main')
|
||||
, elemTips = $('.layui-table-tips');
|
||||
if (elemDate[0]) {
|
||||
elemDate.each(function () {
|
||||
var othis = $(this);
|
||||
if (!othis.hasClass('layui-laydate-static')) {
|
||||
othis.remove();
|
||||
}
|
||||
});
|
||||
$('input').blur();
|
||||
}
|
||||
if (elemTips[0]) elemTips.remove();
|
||||
|
||||
if ($('.layui-layer')[0]) {
|
||||
layer.closeAll('tips');
|
||||
}
|
||||
});
|
||||
|
||||
//代码修饰
|
||||
layui.code({
|
||||
elem: 'pre'
|
||||
});
|
||||
|
||||
//目录
|
||||
var siteDir = $('.site-dir');
|
||||
if (siteDir[0] && $(window).width() > 750) {
|
||||
layer.ready(function () {
|
||||
layer.open({
|
||||
type: 1
|
||||
, content: siteDir
|
||||
, skin: 'layui-layer-dir'
|
||||
, area: 'auto'
|
||||
, maxHeight: $(window).height() - 300
|
||||
, title: '目录'
|
||||
//,closeBtn: false
|
||||
, offset: 'r'
|
||||
, shade: false
|
||||
, success: function (layero, index) {
|
||||
layer.style(index, {
|
||||
marginLeft: -15
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
siteDir.find('li').on('click', function () {
|
||||
var othis = $(this);
|
||||
othis.find('a').addClass('layui-this');
|
||||
othis.siblings().find('a').removeClass('layui-this');
|
||||
});
|
||||
}
|
||||
|
||||
//在textarea焦点处插入字符
|
||||
var focusInsert = function (str) {
|
||||
var start = this.selectionStart
|
||||
, end = this.selectionEnd
|
||||
, offset = start + str.length
|
||||
|
||||
this.value = this.value.substring(0, start) + str + this.value.substring(end);
|
||||
this.setSelectionRange(offset, offset);
|
||||
};
|
||||
|
||||
//演示页面
|
||||
$('body').on('keydown', '#LAY_editor, .site-demo-text', function (e) {
|
||||
var key = e.keyCode;
|
||||
if (key === 9 && window.getSelection) {
|
||||
e.preventDefault();
|
||||
focusInsert.call(this, ' ');
|
||||
}
|
||||
});
|
||||
|
||||
var editor = $('#LAY_editor')
|
||||
, iframeElem = $('#LAY_demo')
|
||||
, demoForm = $('#LAY_demoForm')[0]
|
||||
, demoCodes = $('#LAY_demoCodes')[0]
|
||||
, runCodes = function () {
|
||||
if (!iframeElem[0]) return;
|
||||
var html = editor.val();
|
||||
|
||||
html = html.replace(/=/gi, "layequalsign");
|
||||
html = html.replace(/script/gi, "layscrlayipttag");
|
||||
demoCodes.value = html.length > 100 * 1000 ? '<h1>卧槽,你的代码过长</h1>' : html;
|
||||
|
||||
demoForm.action = '/api/runHtml/';
|
||||
demoForm.submit();
|
||||
|
||||
};
|
||||
$('#LAY_demo_run').on('click', runCodes), runCodes();
|
||||
|
||||
//让导航在最佳位置
|
||||
var setScrollTop = function (thisItem, elemScroll) {
|
||||
if (thisItem[0]) {
|
||||
var itemTop = thisItem.offset().top
|
||||
, winHeight = $(window).height();
|
||||
if (itemTop > winHeight - 120) {
|
||||
elemScroll.animate({ 'scrollTop': itemTop / 2 }, 200)
|
||||
}
|
||||
}
|
||||
}
|
||||
setScrollTop($('.site-demo-nav').find('dd.layui-this'), $('.layui-side-scroll').eq(0));
|
||||
setScrollTop($('.site-demo-table-nav').find('li.layui-this'), $('.layui-side-scroll').eq(1));
|
||||
|
||||
|
||||
|
||||
//查看代码
|
||||
$(function () {
|
||||
var DemoCode = $('#LAY_democode');
|
||||
DemoCode.val([
|
||||
DemoCode.val()
|
||||
, '<body>'
|
||||
, global.preview
|
||||
, '\n<script src="//res.layui.com/layui/dist/layui.js" charset="utf-8"></script>'
|
||||
, '\n<!-- 注意:如果你直接复制所有代码到本地,上述js路径需要改成你本地的 -->'
|
||||
, $('#LAY_democodejs').html()
|
||||
, '\n</body>\n</html>'
|
||||
].join(''));
|
||||
});
|
||||
|
||||
//点击查看代码选项
|
||||
element.on('tab(demoTitle)', function (obj) {
|
||||
if (obj.index === 1) {
|
||||
if (device.ie && device.ie < 9) {
|
||||
layer.alert('强烈不推荐你通过ie8/9 查看代码!因为,所有的标签都会被格式成大写,且没有换行符,影响阅读');
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
//手机设备的简单适配
|
||||
var treeMobile = $('.site-tree-mobile')
|
||||
, shadeMobile = $('.site-mobile-shade')
|
||||
|
||||
treeMobile.on('click', function () {
|
||||
$('body').addClass('site-mobile');
|
||||
});
|
||||
|
||||
shadeMobile.on('click', function () {
|
||||
$('body').removeClass('site-mobile');
|
||||
});
|
||||
|
||||
|
||||
|
||||
//愚人节
|
||||
; !function () {
|
||||
if (home.data('date') === '4-1') {
|
||||
|
||||
if (local['20180401']) return;
|
||||
|
||||
home.addClass('site-out-up');
|
||||
setTimeout(function () {
|
||||
layer.photos({
|
||||
photos: {
|
||||
"data": [{
|
||||
"src": "//cdn.layui.com/upload/2018_4/168_1522515820513_397.png",
|
||||
}]
|
||||
}
|
||||
, anim: 2
|
||||
, shade: 1
|
||||
, move: false
|
||||
, end: function () {
|
||||
layer.msg('愚公,快醒醒!', {
|
||||
shade: 1
|
||||
}, function () {
|
||||
layui.data('layui', {
|
||||
key: '20180401'
|
||||
, value: true
|
||||
});
|
||||
});
|
||||
}
|
||||
, success: function (layero, index) {
|
||||
home.removeClass('site-out-up');
|
||||
|
||||
layero.find('#layui-layer-photos').on('click', function () {
|
||||
layer.close(layero.attr('times'));
|
||||
}).find('.layui-layer-imgsee').remove();
|
||||
}
|
||||
});
|
||||
}, 1000 * 3);
|
||||
}
|
||||
}();
|
||||
|
||||
|
||||
exports('global', {});
|
||||
});
|
0
Examples/website/FreeSql.Site.UI/wwwroot/js/site.min.js
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
/** layui-v2.2.3 MIT License By http://www.layui.com */
|
||||
html #layuicss-skincodecss{display:none;position:absolute;width:1989px}.layui-code-h3,.layui-code-view{position:relative;font-size:12px}.layui-code-view{display:block;margin:10px 0;padding:0;border:1px solid #e2e2e2;border-left-width:6px;background-color:#F2F2F2;color:#333;font-family:Courier New}.layui-code-h3{padding:0 10px;height:32px;line-height:32px;border-bottom:1px solid #e2e2e2}.layui-code-h3 a{position:absolute;right:10px;top:0;color:#999}.layui-code-view .layui-code-ol{position:relative;overflow:auto}.layui-code-view .layui-code-ol li{position:relative;margin-left:45px;line-height:20px;padding:0 5px;border-left:1px solid #e2e2e2;list-style-type:decimal-leading-zero;*list-style-type:decimal;background-color:#fff}.layui-code-view pre{margin:0}.layui-code-notepad{border:1px solid #0C0C0C;border-left-color:#3F3F3F;background-color:#0C0C0C;color:#C2BE9E}.layui-code-notepad .layui-code-h3{border-bottom:none}.layui-code-notepad .layui-code-ol li{background-color:#3F3F3F;border-left:none}
|
After Width: | Height: | Size: 5.8 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 5.7 KiB |
After Width: | Height: | Size: 701 B |
After Width: | Height: | Size: 1.7 KiB |
BIN
Examples/website/FreeSql.Site.UI/wwwroot/layui/font/iconfont.eot
Normal file
447
Examples/website/FreeSql.Site.UI/wwwroot/layui/font/iconfont.svg
Normal file
After Width: | Height: | Size: 222 KiB |
BIN
Examples/website/FreeSql.Site.UI/wwwroot/layui/font/iconfont.ttf
Normal file
BIN
Examples/website/FreeSql.Site.UI/wwwroot/layui/images/face/0.gif
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
Examples/website/FreeSql.Site.UI/wwwroot/layui/images/face/1.gif
Normal file
After Width: | Height: | Size: 5.4 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 7.3 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 6.6 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 3.0 KiB |
BIN
Examples/website/FreeSql.Site.UI/wwwroot/layui/images/face/2.gif
Normal file
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 5.1 KiB |
After Width: | Height: | Size: 9.6 KiB |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 7.9 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 4.7 KiB |
BIN
Examples/website/FreeSql.Site.UI/wwwroot/layui/images/face/3.gif
Normal file
After Width: | Height: | Size: 3.9 KiB |
After Width: | Height: | Size: 2.5 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 6.3 KiB |
BIN
Examples/website/FreeSql.Site.UI/wwwroot/layui/images/face/4.gif
Normal file
After Width: | Height: | Size: 5.6 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 5.2 KiB |
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 2.3 KiB |
BIN
Examples/website/FreeSql.Site.UI/wwwroot/layui/images/face/5.gif
Normal file
After Width: | Height: | Size: 4.5 KiB |
After Width: | Height: | Size: 5.7 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 777 B |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 10 KiB |
BIN
Examples/website/FreeSql.Site.UI/wwwroot/layui/images/face/6.gif
Normal file
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 5.7 KiB |
After Width: | Height: | Size: 6.3 KiB |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 2.4 KiB |
BIN
Examples/website/FreeSql.Site.UI/wwwroot/layui/images/face/7.gif
Normal file
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 4.5 KiB |
After Width: | Height: | Size: 5.2 KiB |
BIN
Examples/website/FreeSql.Site.UI/wwwroot/layui/images/face/8.gif
Normal file
After Width: | Height: | Size: 4.0 KiB |
BIN
Examples/website/FreeSql.Site.UI/wwwroot/layui/images/face/9.gif
Normal file
After Width: | Height: | Size: 4.1 KiB |
@ -0,0 +1,2 @@
|
||||
/** layui-v2.2.3 MIT License By http://www.layui.com */
|
||||
;layui.define("jquery",function(e){"use strict";var i=layui.$,n=(layui.hint(),layui.device(),{config:{},set:function(e){var n=this;return n.config=i.extend({},n.config,e),n},on:function(e,i){return layui.onevent.call(this,t,e,i)}}),t="carousel",a="layui-this",l=">*[carousel-item]>*",o="layui-carousel-left",r="layui-carousel-right",d="layui-carousel-prev",s="layui-carousel-next",u="layui-carousel-arrow",c="layui-carousel-ind",m=function(e){var t=this;t.config=i.extend({},t.config,n.config,e),t.render()};m.prototype.config={width:"600px",height:"280px",full:!1,arrow:"hover",indicator:"inside",autoplay:!0,interval:3e3,anim:"",trigger:"click",index:0},m.prototype.render=function(){var e=this,n=e.config;n.elem=i(n.elem),n.elem[0]&&(e.elemItem=n.elem.find(l),n.index<0&&(n.index=0),n.index>=e.elemItem.length&&(n.index=e.elemItem.length-1),n.interval<800&&(n.interval=800),n.full?n.elem.css({position:"fixed",width:"100%",height:"100%",zIndex:9999}):n.elem.css({width:n.width,height:n.height}),n.elem.attr("lay-anim",n.anim),e.elemItem.eq(n.index).addClass(a),e.elemItem.length<=1||(e.indicator(),e.arrow(),e.autoplay(),e.events()))},m.prototype.reload=function(e){var n=this;clearInterval(n.timer),n.config=i.extend({},n.config,e),n.render()},m.prototype.prevIndex=function(){var e=this,i=e.config,n=i.index-1;return n<0&&(n=e.elemItem.length-1),n},m.prototype.nextIndex=function(){var e=this,i=e.config,n=i.index+1;return n>=e.elemItem.length&&(n=0),n},m.prototype.addIndex=function(e){var i=this,n=i.config;e=e||1,n.index=n.index+e,n.index>=i.elemItem.length&&(n.index=0)},m.prototype.subIndex=function(e){var i=this,n=i.config;e=e||1,n.index=n.index-e,n.index<0&&(n.index=i.elemItem.length-1)},m.prototype.autoplay=function(){var e=this,i=e.config;i.autoplay&&(e.timer=setInterval(function(){e.slide()},i.interval))},m.prototype.arrow=function(){var e=this,n=e.config,t=i(['<button class="layui-icon '+u+'" lay-type="sub">'+("updown"===n.anim?"":"")+"</button>",'<button class="layui-icon '+u+'" lay-type="add">'+("updown"===n.anim?"":"")+"</button>"].join(""));n.elem.attr("lay-arrow",n.arrow),n.elem.find("."+u)[0]&&n.elem.find("."+u).remove(),n.elem.append(t),t.on("click",function(){var n=i(this),t=n.attr("lay-type");e.slide(t)})},m.prototype.indicator=function(){var e=this,n=e.config,t=e.elemInd=i(['<div class="'+c+'"><ul>',function(){var i=[];return layui.each(e.elemItem,function(e){i.push("<li"+(n.index===e?' class="layui-this"':"")+"></li>")}),i.join("")}(),"</ul></div>"].join(""));n.elem.attr("lay-indicator",n.indicator),n.elem.find("."+c)[0]&&n.elem.find("."+c).remove(),n.elem.append(t),"updown"===n.anim&&t.css("margin-top",-(t.height()/2)),t.find("li").on("hover"===n.trigger?"mouseover":n.trigger,function(){var t=i(this),a=t.index();a>n.index?e.slide("add",a-n.index):a<n.index&&e.slide("sub",n.index-a)})},m.prototype.slide=function(e,i){var n=this,l=n.elemItem,u=n.config,c=u.index,m=u.elem.attr("lay-filter");n.haveSlide||("sub"===e?(n.subIndex(i),l.eq(u.index).addClass(d),setTimeout(function(){l.eq(c).addClass(r),l.eq(u.index).addClass(r)},50)):(n.addIndex(i),l.eq(u.index).addClass(s),setTimeout(function(){l.eq(c).addClass(o),l.eq(u.index).addClass(o)},50)),setTimeout(function(){l.removeClass(a+" "+d+" "+s+" "+o+" "+r),l.eq(u.index).addClass(a),n.haveSlide=!1},300),n.elemInd.find("li").eq(u.index).addClass(a).siblings().removeClass(a),n.haveSlide=!0,layui.event.call(this,t,"change("+m+")",{index:u.index,prevIndex:c,item:l.eq(u.index)}))},m.prototype.events=function(){var e=this,i=e.config;i.elem.data("haveEvents")||(i.elem.on("mouseenter",function(){clearInterval(e.timer)}).on("mouseleave",function(){e.autoplay()}),i.elem.data("haveEvents",!0))},n.render=function(e){var i=new m(e);return i},e(t,n)});
|
@ -0,0 +1,2 @@
|
||||
/** layui-v2.2.3 MIT License By http://www.layui.com */
|
||||
;layui.define("jquery",function(e){"use strict";var a=layui.$,l="http://www.layui.com/doc/modules/code.html";e("code",function(e){var t=[];e=e||{},e.elem=a(e.elem||".layui-code"),e.about=!("about"in e)||e.about,e.elem.each(function(){t.push(this)}),layui.each(t.reverse(),function(t,i){var c=a(i),o=c.html();(c.attr("lay-encode")||e.encode)&&(o=o.replace(/&(?!#?[a-zA-Z0-9]+;)/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,""")),c.html('<ol class="layui-code-ol"><li>'+o.replace(/[\r\t\n]+/g,"</li><li>")+"</li></ol>"),c.find(">.layui-code-h3")[0]||c.prepend('<h3 class="layui-code-h3">'+(c.attr("lay-title")||e.title||"code")+(e.about?'<a href="'+l+'" target="_blank">layui.code</a>':"")+"</h3>");var d=c.find(">.layui-code-ol");c.addClass("layui-box layui-code-view"),(c.attr("lay-skin")||e.skin)&&c.addClass("layui-code-"+(c.attr("lay-skin")||e.skin)),(d.find("li").length/100|0)>0&&d.css("margin-left",(d.find("li").length/100|0)+"px"),(c.attr("lay-height")||e.height)&&d.css("max-height",c.attr("lay-height")||e.height)})})}).addcss("modules/code.css","skincodecss");
|
@ -0,0 +1,2 @@
|
||||
/** layui-v2.2.3 MIT License By http://www.layui.com */
|
||||
;layui.define("jquery",function(e){"use strict";var l=layui.$,o=function(e){},t='<i class="layui-anim layui-anim-rotate layui-anim-loop layui-icon "></i>';o.prototype.load=function(e){var o,i,n,r,a=this,c=0;e=e||{};var f=l(e.elem);if(f[0]){var m=l(e.scrollElem||document),u=e.mb||50,s=!("isAuto"in e)||e.isAuto,v=e.end||"没有更多了",y=e.scrollElem&&e.scrollElem!==document,d="<cite>加载更多</cite>",h=l('<div class="layui-flow-more"><a href="javascript:;">'+d+"</a></div>");f.find(".layui-flow-more")[0]||f.append(h);var p=function(e,t){e=l(e),h.before(e),t=0==t||null,t?h.html(v):h.find("a").html(d),i=t,o=null,n&&n()},g=function(){o=!0,h.find("a").html(t),"function"==typeof e.done&&e.done(++c,p)};if(g(),h.find("a").on("click",function(){l(this);i||o||g()}),e.isLazyimg)var n=a.lazyimg({elem:e.elem+" img",scrollElem:e.scrollElem});return s?(m.on("scroll",function(){var e=l(this),t=e.scrollTop();r&&clearTimeout(r),i||(r=setTimeout(function(){var i=y?e.height():l(window).height(),n=y?e.prop("scrollHeight"):document.documentElement.scrollHeight;n-t-i<=u&&(o||g())},100))}),a):a}},o.prototype.lazyimg=function(e){var o,t=this,i=0;e=e||{};var n=l(e.scrollElem||document),r=e.elem||"img",a=e.scrollElem&&e.scrollElem!==document,c=function(e,l){var o=n.scrollTop(),r=o+l,c=a?function(){return e.offset().top-n.offset().top+o}():e.offset().top;if(c>=o&&c<=r&&!e.attr("src")){var m=e.attr("lay-src");layui.img(m,function(){var l=t.lazyimg.elem.eq(i);e.attr("src",m).removeAttr("lay-src"),l[0]&&f(l),i++})}},f=function(e,o){var f=a?(o||n).height():l(window).height(),m=n.scrollTop(),u=m+f;if(t.lazyimg.elem=l(r),e)c(e,f);else for(var s=0;s<t.lazyimg.elem.length;s++){var v=t.lazyimg.elem.eq(s),y=a?function(){return v.offset().top-n.offset().top+m}():v.offset().top;if(c(v,f),i=s,y>u)break}};if(f(),!o){var m;n.on("scroll",function(){var e=l(this);m&&clearTimeout(m),m=setTimeout(function(){f(null,e)},50)}),o=!0}return f},e("flow",new o)});
|
@ -0,0 +1,483 @@
|
||||
/**
|
||||
|
||||
layui官网
|
||||
|
||||
*/
|
||||
|
||||
layui.define(['code', 'element', 'table', 'util'], function (exports) {
|
||||
var $ = layui.jquery
|
||||
, element = layui.element
|
||||
, layer = layui.layer
|
||||
, form = layui.form
|
||||
, util = layui.util
|
||||
, device = layui.device()
|
||||
|
||||
, $win = $(window), $body = $('body');
|
||||
|
||||
|
||||
//阻止IE7以下访问
|
||||
if (device.ie && device.ie < 8) {
|
||||
layer.alert('Layui最低支持ie8,您当前使用的是古老的 IE' + device.ie + ',你丫的肯定不是程序猿!');
|
||||
}
|
||||
|
||||
var home = $('#LAY_home');
|
||||
|
||||
|
||||
layer.ready(function () {
|
||||
var local = layui.data('layui');
|
||||
|
||||
//升级提示
|
||||
if (local.version && local.version !== layui.v) {
|
||||
layer.open({
|
||||
type: 1
|
||||
, title: '更新提示' //不显示标题栏
|
||||
, closeBtn: false
|
||||
, area: '300px;'
|
||||
, shade: false
|
||||
, offset: 'b'
|
||||
, id: 'LAY_updateNotice' //设定一个id,防止重复弹出
|
||||
, btn: ['更新日志', '朕不想升']
|
||||
, btnAlign: 'c'
|
||||
, moveType: 1 //拖拽模式,0或者1
|
||||
, content: ['<div class="layui-text">'
|
||||
, 'layui 已更新到:<strong style="padding-right: 10px; color: #fff;">v' + layui.v + '</strong> <br>请注意升级!'
|
||||
, '</div>'].join('')
|
||||
, skin: 'layui-layer-notice'
|
||||
, yes: function (index) {
|
||||
layer.close(index);
|
||||
setTimeout(function () {
|
||||
location.href = '/doc/base/changelog.html';
|
||||
}, 500);
|
||||
}
|
||||
, end: function () {
|
||||
layui.data('layui', {
|
||||
key: 'version'
|
||||
, value: layui.v
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
layui.data('layui', {
|
||||
key: 'version'
|
||||
, value: layui.v
|
||||
});
|
||||
|
||||
|
||||
//公告
|
||||
; !function () {
|
||||
return layui.data('layui', {
|
||||
key: 'notice_20180530'
|
||||
, remove: true
|
||||
});
|
||||
|
||||
if (local.notice_20180530 && new Date().getTime() - local.notice_20180530 < 1000 * 60 * 60 * 24 * 5) {
|
||||
return;
|
||||
};
|
||||
|
||||
layer.open({
|
||||
type: 1
|
||||
, title: 'layui 官方通用后台管理模板'
|
||||
, closeBtn: false
|
||||
, area: ['300px', '280px']
|
||||
, shade: false
|
||||
//,offset: 'c'
|
||||
, id: 'LAY_Notice' //设定一个id,防止重复弹出
|
||||
, btn: ['前往围观', '朕不想看']
|
||||
, btnAlign: 'b'
|
||||
, moveType: 1 //拖拽模式,0或者1
|
||||
, resize: false
|
||||
, content: ['<div style="padding: 15px; text-align: center; background-color: #e2e2e2;">'
|
||||
, '<a href="/admin/std/dist/views/" target="_blank"><img src="//cdn.layui.com/upload/2018_5/168_1527691799254_76462.jpg" alt="layuiAdmin" style="width: 100%; height:149.78px;"></a>'
|
||||
, '</div>'].join('')
|
||||
, success: function (layero, index) {
|
||||
var btn = layero.find('.layui-layer-btn');
|
||||
btn.find('.layui-layer-btn0').attr({
|
||||
href: '/admin/std/dist/views/'
|
||||
, target: '_blank'
|
||||
});
|
||||
|
||||
layero.find('a').on('click', function () {
|
||||
layer.close(index);
|
||||
});
|
||||
}
|
||||
, end: function () {
|
||||
layui.data('layui', {
|
||||
key: 'notice_20180530'
|
||||
, value: new Date().getTime()
|
||||
});
|
||||
}
|
||||
});
|
||||
}();
|
||||
|
||||
});
|
||||
|
||||
; !function () {
|
||||
var elemComponentSelect = $(['<select lay-search lay-filter="component">'
|
||||
, '<option value="">搜索组件或模块</option>'
|
||||
, '<option value="element/layout.html">grid 栅格布局</option>'
|
||||
, '<option value="element/layout.html#admin">admin 后台布局</option>'
|
||||
, '<option value="element/color.html">color 颜色</option>'
|
||||
, '<option value="element/icon.html">iconfont 字体图标</option>'
|
||||
, '<option value="element/anim.html">animation 动画</option>'
|
||||
, '<option value="element/button.html">button 按钮</option>'
|
||||
, '<option value="element/form.html">form 表单组</option>'
|
||||
, '<option value="element/form.html#input">input 输入框</option>'
|
||||
, '<option value="element/form.html#select">select 下拉选择框</option>'
|
||||
, '<option value="element/form.html#checkbox">checkbox 复选框</option>'
|
||||
, '<option value="element/form.html#switch">switch 开关</option>'
|
||||
, '<option value="element/form.html#radio">radio 单选框</option>'
|
||||
, '<option value="element/form.html#textarea">textarea 文本域</option>'
|
||||
, '<option value="element/nav.html">nav 导航菜单</option>'
|
||||
, '<option value="element/nav.html#breadcrumb">breadcrumb 面包屑</option>'
|
||||
, '<option value="element/tab.html">tabs 选项卡</option>'
|
||||
, '<option value="element/progress.html">progress 进度条</option>'
|
||||
, '<option value="element/collapse.html">collapse 折叠面板/手风琴</option>'
|
||||
, '<option value="element/table.html">table 表格元素</option>'
|
||||
, '<option value="element/badge.html">badge 徽章</option>'
|
||||
, '<option value="element/timeline.html">timeline 时间线</option>'
|
||||
, '<option value="element/auxiliar.html#blockquote">blockquote 引用块</option>'
|
||||
, '<option value="element/auxiliar.html#fieldset">fieldset 字段集</option>'
|
||||
, '<option value="element/auxiliar.html#hr">hr 分割线</option>'
|
||||
|
||||
, '<option value="modules/layer.html">layer 弹出层/弹窗综合</option>'
|
||||
, '<option value="modules/laydate.html">laydate 日期时间选择器</option>'
|
||||
, '<option value="modules/layim.html">layim 即时通讯/聊天</option>'
|
||||
, '<option value="modules/laypage.html">laypage 分页</option>'
|
||||
, '<option value="modules/laytpl.html">laytpl 模板引擎</option>'
|
||||
, '<option value="modules/form.html">form 表单模块</option>'
|
||||
, '<option value="modules/table.html">table 数据表格</option>'
|
||||
, '<option value="modules/upload.html">upload 文件/图片上传</option>'
|
||||
, '<option value="modules/element.html">element 常用元素操作</option>'
|
||||
, '<option value="modules/rate.html">rate 评分</option>'
|
||||
, '<option value="modules/colorpicker.html">colorpicker 颜色选择器</option>'
|
||||
, '<option value="modules/slider.html">slider 滑块</option>'
|
||||
, '<option value="modules/carousel.html">carousel 轮播/跑马灯</option>'
|
||||
, '<option value="modules/layedit.html">layedit 富文本编辑器</option>'
|
||||
, '<option value="modules/tree.html">tree 树形菜单</option>'
|
||||
, '<option value="modules/flow.html">flow 信息流/图片懒加载</option>'
|
||||
, '<option value="modules/util.html">util 工具集</option>'
|
||||
, '<option value="modules/code.html">code 代码修饰</option>'
|
||||
, '</select>'].join(''));
|
||||
|
||||
$('.component').append(elemComponentSelect);
|
||||
form.render('select', 'LAY-site-header-component');
|
||||
|
||||
//搜索组件
|
||||
form.on('select(component)', function (data) {
|
||||
var value = data.value;
|
||||
location.href = '/doc/' + value;
|
||||
});
|
||||
}();
|
||||
|
||||
|
||||
//点击事件
|
||||
var events = {
|
||||
//联系方式
|
||||
contactInfo: function () {
|
||||
layer.alert('<div class="layui-text">如有合作意向,可联系:<br>邮箱:xianxin@layui-inc.com</div>', {
|
||||
title: '联系'
|
||||
, btn: false
|
||||
, shadeClose: true
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$body.on('click', '*[site-event]', function () {
|
||||
var othis = $(this)
|
||||
, attrEvent = othis.attr('site-event');
|
||||
events[attrEvent] && events[attrEvent].call(this, othis);
|
||||
});
|
||||
|
||||
//切换版本
|
||||
form.on('select(tabVersion)', function (data) {
|
||||
var value = data.value;
|
||||
location.href = value === 'new' ? '/' : ('/' + value + '/doc/');
|
||||
});
|
||||
|
||||
|
||||
//首页banner
|
||||
setTimeout(function () {
|
||||
$('.site-zfj').addClass('site-zfj-anim');
|
||||
setTimeout(function () {
|
||||
$('.site-desc').addClass('site-desc-anim')
|
||||
}, 5000)
|
||||
}, 100);
|
||||
|
||||
|
||||
//数字前置补零
|
||||
var digit = function (num, length, end) {
|
||||
var str = '';
|
||||
num = String(num);
|
||||
length = length || 2;
|
||||
for (var i = num.length; i < length; i++) {
|
||||
str += '0';
|
||||
}
|
||||
return num < Math.pow(10, length) ? str + (num | 0) : num;
|
||||
};
|
||||
|
||||
|
||||
//下载倒计时
|
||||
var setCountdown = $('#setCountdown');
|
||||
if ($('#setCountdown')[0]) {
|
||||
$.get('/api/getTime', function (res) {
|
||||
util.countdown(new Date(2017, 7, 21, 8, 30, 0), new Date(res.time), function (date, serverTime, timer) {
|
||||
var str = digit(date[1]) + ':' + digit(date[2]) + ':' + digit(date[3]);
|
||||
setCountdown.children('span').html(str);
|
||||
});
|
||||
}, 'jsonp');
|
||||
}
|
||||
|
||||
|
||||
|
||||
for (var i = 0; i < $('.adsbygoogle').length; i++) {
|
||||
(adsbygoogle = window.adsbygoogle || []).push({});
|
||||
}
|
||||
|
||||
|
||||
//展示当前版本
|
||||
$('.site-showv').html(layui.v);
|
||||
|
||||
//获取下载数
|
||||
$.get('//fly.layui.com/api/handle?id=10&type=find', function (res) {
|
||||
$('.site-showdowns').html(res.number);
|
||||
}, 'jsonp');
|
||||
|
||||
//记录下载
|
||||
$('.site-down').on('click', function () {
|
||||
$.get('//fly.layui.com/api/handle?id=10', function () { }, 'jsonp');
|
||||
});
|
||||
|
||||
//获取Github数据
|
||||
var getStars = $('#getStars');
|
||||
if (getStars[0]) {
|
||||
$.get('https://api.github.com/repos/sentsin/layui', function (res) {
|
||||
getStars.html(res.stargazers_count);
|
||||
}, 'json');
|
||||
}
|
||||
|
||||
//固定Bar
|
||||
if (global.pageType !== 'demo') {
|
||||
util.fixbar({
|
||||
bar1: true
|
||||
, click: function (type) {
|
||||
if (type === 'bar1') {
|
||||
location.href = '//fly.layui.com/';
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//窗口scroll
|
||||
; !function () {
|
||||
var main = $('.site-tree').parent(), scroll = function () {
|
||||
var stop = $(window).scrollTop();
|
||||
|
||||
if ($(window).width() <= 750) return;
|
||||
var bottom = $('.footer').offset().top - $(window).height();
|
||||
if (stop > 211 && stop < bottom) {
|
||||
if (!main.hasClass('site-fix')) {
|
||||
main.addClass('site-fix');
|
||||
}
|
||||
if (main.hasClass('site-fix-footer')) {
|
||||
main.removeClass('site-fix-footer');
|
||||
}
|
||||
} else if (stop >= bottom) {
|
||||
if (!main.hasClass('site-fix-footer')) {
|
||||
main.addClass('site-fix site-fix-footer');
|
||||
}
|
||||
} else {
|
||||
if (main.hasClass('site-fix')) {
|
||||
main.removeClass('site-fix').removeClass('site-fix-footer');
|
||||
}
|
||||
}
|
||||
stop = null;
|
||||
};
|
||||
scroll();
|
||||
$(window).on('scroll', scroll);
|
||||
}();
|
||||
|
||||
//示例页面滚动
|
||||
$('.site-demo-body').on('scroll', function () {
|
||||
var elemDate = $('.layui-laydate,.layui-colorpicker-main')
|
||||
, elemTips = $('.layui-table-tips');
|
||||
if (elemDate[0]) {
|
||||
elemDate.each(function () {
|
||||
var othis = $(this);
|
||||
if (!othis.hasClass('layui-laydate-static')) {
|
||||
othis.remove();
|
||||
}
|
||||
});
|
||||
$('input').blur();
|
||||
}
|
||||
if (elemTips[0]) elemTips.remove();
|
||||
|
||||
if ($('.layui-layer')[0]) {
|
||||
layer.closeAll('tips');
|
||||
}
|
||||
});
|
||||
|
||||
//代码修饰
|
||||
layui.code({
|
||||
elem: 'pre'
|
||||
});
|
||||
|
||||
//目录
|
||||
var siteDir = $('.site-dir');
|
||||
if (siteDir[0] && $(window).width() > 750) {
|
||||
layer.ready(function () {
|
||||
layer.open({
|
||||
type: 1
|
||||
, content: siteDir
|
||||
, skin: 'layui-layer-dir'
|
||||
, area: 'auto'
|
||||
, maxHeight: $(window).height() - 300
|
||||
, title: '目录'
|
||||
//,closeBtn: false
|
||||
, offset: 'r'
|
||||
, shade: false
|
||||
, success: function (layero, index) {
|
||||
layer.style(index, {
|
||||
marginLeft: -15
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
siteDir.find('li').on('click', function () {
|
||||
var othis = $(this);
|
||||
othis.find('a').addClass('layui-this');
|
||||
othis.siblings().find('a').removeClass('layui-this');
|
||||
});
|
||||
}
|
||||
|
||||
//在textarea焦点处插入字符
|
||||
var focusInsert = function (str) {
|
||||
var start = this.selectionStart
|
||||
, end = this.selectionEnd
|
||||
, offset = start + str.length
|
||||
|
||||
this.value = this.value.substring(0, start) + str + this.value.substring(end);
|
||||
this.setSelectionRange(offset, offset);
|
||||
};
|
||||
|
||||
//演示页面
|
||||
$('body').on('keydown', '#LAY_editor, .site-demo-text', function (e) {
|
||||
var key = e.keyCode;
|
||||
if (key === 9 && window.getSelection) {
|
||||
e.preventDefault();
|
||||
focusInsert.call(this, ' ');
|
||||
}
|
||||
});
|
||||
|
||||
var editor = $('#LAY_editor')
|
||||
, iframeElem = $('#LAY_demo')
|
||||
, demoForm = $('#LAY_demoForm')[0]
|
||||
, demoCodes = $('#LAY_demoCodes')[0]
|
||||
, runCodes = function () {
|
||||
if (!iframeElem[0]) return;
|
||||
var html = editor.val();
|
||||
|
||||
html = html.replace(/=/gi, "layequalsign");
|
||||
html = html.replace(/script/gi, "layscrlayipttag");
|
||||
demoCodes.value = html.length > 100 * 1000 ? '<h1>卧槽,你的代码过长</h1>' : html;
|
||||
|
||||
demoForm.action = '/api/runHtml/';
|
||||
demoForm.submit();
|
||||
|
||||
};
|
||||
$('#LAY_demo_run').on('click', runCodes), runCodes();
|
||||
|
||||
//让导航在最佳位置
|
||||
var setScrollTop = function (thisItem, elemScroll) {
|
||||
if (thisItem[0]) {
|
||||
var itemTop = thisItem.offset().top
|
||||
, winHeight = $(window).height();
|
||||
if (itemTop > winHeight - 120) {
|
||||
elemScroll.animate({ 'scrollTop': itemTop / 2 }, 200)
|
||||
}
|
||||
}
|
||||
}
|
||||
setScrollTop($('.site-demo-nav').find('dd.layui-this'), $('.layui-side-scroll').eq(0));
|
||||
setScrollTop($('.site-demo-table-nav').find('li.layui-this'), $('.layui-side-scroll').eq(1));
|
||||
|
||||
|
||||
|
||||
//查看代码
|
||||
$(function () {
|
||||
var DemoCode = $('#LAY_democode');
|
||||
DemoCode.val([
|
||||
DemoCode.val()
|
||||
, '<body>'
|
||||
, global.preview
|
||||
, '\n<script src="//res.layui.com/layui/dist/layui.js" charset="utf-8"></script>'
|
||||
, '\n<!-- 注意:如果你直接复制所有代码到本地,上述js路径需要改成你本地的 -->'
|
||||
, $('#LAY_democodejs').html()
|
||||
, '\n</body>\n</html>'
|
||||
].join(''));
|
||||
});
|
||||
|
||||
//点击查看代码选项
|
||||
element.on('tab(demoTitle)', function (obj) {
|
||||
if (obj.index === 1) {
|
||||
if (device.ie && device.ie < 9) {
|
||||
layer.alert('强烈不推荐你通过ie8/9 查看代码!因为,所有的标签都会被格式成大写,且没有换行符,影响阅读');
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
//手机设备的简单适配
|
||||
var treeMobile = $('.site-tree-mobile')
|
||||
, shadeMobile = $('.site-mobile-shade')
|
||||
|
||||
treeMobile.on('click', function () {
|
||||
$('body').addClass('site-mobile');
|
||||
});
|
||||
|
||||
shadeMobile.on('click', function () {
|
||||
$('body').removeClass('site-mobile');
|
||||
});
|
||||
|
||||
|
||||
|
||||
//愚人节
|
||||
; !function () {
|
||||
if (home.data('date') === '4-1') {
|
||||
|
||||
if (local['20180401']) return;
|
||||
|
||||
home.addClass('site-out-up');
|
||||
setTimeout(function () {
|
||||
layer.photos({
|
||||
photos: {
|
||||
"data": [{
|
||||
"src": "//cdn.layui.com/upload/2018_4/168_1522515820513_397.png",
|
||||
}]
|
||||
}
|
||||
, anim: 2
|
||||
, shade: 1
|
||||
, move: false
|
||||
, end: function () {
|
||||
layer.msg('愚公,快醒醒!', {
|
||||
shade: 1
|
||||
}, function () {
|
||||
layui.data('layui', {
|
||||
key: '20180401'
|
||||
, value: true
|
||||
});
|
||||
});
|
||||
}
|
||||
, success: function (layero, index) {
|
||||
home.removeClass('site-out-up');
|
||||
|
||||
layero.find('#layui-layer-photos').on('click', function () {
|
||||
layer.close(layero.attr('times'));
|
||||
}).find('.layui-layer-imgsee').remove();
|
||||
}
|
||||
});
|
||||
}, 1000 * 3);
|
||||
}
|
||||
}();
|
||||
|
||||
|
||||
exports('global', {});
|
||||
});
|