mirror of https://github.com/1099438829/macUI.git
This commit is contained in:
parent
2c0ce4f62a
commit
cac02a78bc
243
js/mac.js
243
js/mac.js
|
|
@ -28,7 +28,9 @@ window.Win10 = {
|
|||
this.iframes.push(new this.Iframe(element, cb));
|
||||
if (!this.interval) {
|
||||
var _this = this;
|
||||
this.interval = setInterval(function() { _this.checkClick(); }, this.resolution);
|
||||
this.interval = setInterval(function() {
|
||||
_this.checkClick();
|
||||
}, this.resolution);
|
||||
}
|
||||
},
|
||||
checkClick: function() {
|
||||
|
|
@ -55,7 +57,9 @@ window.Win10 = {
|
|||
_iframe_click_lock_children: {},
|
||||
_renderBar: function() {
|
||||
//调整任务栏项目的宽度
|
||||
if(this._countTask<=0){return;} //防止除以0
|
||||
if (this._countTask <= 0) {
|
||||
return;
|
||||
} //防止除以0
|
||||
var btns = $("#win10_btn_group_middle>.btn");
|
||||
btns.css('width', ('calc(' + (1 / this._countTask * 100) + '% - 1px )'))
|
||||
},
|
||||
|
|
@ -121,7 +125,9 @@ window.Win10 = {
|
|||
setInterval(function() {
|
||||
var classes_lenth = Win10._animated_classes.length;
|
||||
var animated_liveness = Win10._animated_liveness;
|
||||
if(animated_liveness===0 || classes_lenth===0 || !$("#win10-menu").hasClass('opened')){return;}
|
||||
if (animated_liveness === 0 || classes_lenth === 0 || !$("#win10-menu").hasClass('opened')) {
|
||||
return;
|
||||
}
|
||||
$('#win10-menu>.blocks>.menu_group>.block').each(function() {
|
||||
if (!$(this).hasClass('onAnimate') && Math.random() <= animated_liveness) {
|
||||
var that = $(this);
|
||||
|
|
@ -139,7 +145,9 @@ window.Win10 = {
|
|||
}, 1000);
|
||||
},
|
||||
_onImgComplete: function(img, callback) {
|
||||
if(!img){return;}
|
||||
if (!img) {
|
||||
return;
|
||||
}
|
||||
var timer = setInterval(function() {
|
||||
if (img.complete) {
|
||||
callback(img);
|
||||
|
|
@ -159,12 +167,16 @@ window.Win10 = {
|
|||
$(".win10-open-iframe").each(function() {
|
||||
z = parseInt($(this).css('z-index'));
|
||||
$(this).css('z-index', z - 1);
|
||||
if(z>max_zindex){max_zindex=z;}
|
||||
if (z > max_zindex) {
|
||||
max_zindex = z;
|
||||
}
|
||||
});
|
||||
layero.css('z-index', max_zindex + 1);
|
||||
},
|
||||
_checkTop: function() {
|
||||
var max_index=0,max_z=0,btn=null;
|
||||
var max_index = 0,
|
||||
max_z = 0,
|
||||
btn = null;
|
||||
$("#win10_btn_group_middle .btn.show").each(function() {
|
||||
var index = $(this).attr('index');
|
||||
var layero = Win10.getLayeroByIndex(index);
|
||||
|
|
@ -184,7 +196,9 @@ window.Win10 = {
|
|||
//渲染右键
|
||||
_renderContextMenu: function(x, y, menu, trigger) {
|
||||
this._removeContextMenu();
|
||||
if(menu===true){return;}
|
||||
if (menu === true) {
|
||||
return;
|
||||
}
|
||||
var dom = $("<div class='win10-context-menu'><ul></ul></div>");
|
||||
$('#win10').append(dom);
|
||||
var ul = dom.find('ul');
|
||||
|
|
@ -202,12 +216,16 @@ window.Win10 = {
|
|||
var sub = $('<li>' + item[0] + '</li>');
|
||||
ul.append(sub);
|
||||
sub.click(trigger, item[1]);
|
||||
continue;
|
||||
|
||||
}
|
||||
}
|
||||
//修正坐标
|
||||
if(x+150>document.body.clientWidth){x-=150}
|
||||
if(y+dom.height()>document.body.clientHeight){y-=dom.height()}
|
||||
if (x + 150 > document.body.clientWidth) {
|
||||
x -= 150
|
||||
}
|
||||
if (y + dom.height() > document.body.clientHeight) {
|
||||
y -= dom.height()
|
||||
}
|
||||
dom.css({
|
||||
top: y,
|
||||
left: x,
|
||||
|
|
@ -336,7 +354,9 @@ window.Win10 = {
|
|||
Win10.hideWins();
|
||||
});
|
||||
$("#win10-menu-switcher").click(function() {
|
||||
if(Win10._switchMenuTooHurry){return;}
|
||||
if (Win10._switchMenuTooHurry) {
|
||||
return;
|
||||
}
|
||||
Win10._switchMenuTooHurry = true;
|
||||
var class_name = 'win10-menu-hidden';
|
||||
var list = $("#win10-menu>.list");
|
||||
|
|
@ -421,7 +441,9 @@ window.Win10 = {
|
|||
|
||||
//打广告
|
||||
setTimeout(function() {
|
||||
console.log(Win10.lang('本页由Win10-UI强力驱动\n更多信息:http://win10ui.yuri2.cn \nWin10-UI,轻松打造别具一格的后台界面 ','The page is strongly driven by Win10-UI.\nFor more info: http://win10ui.yuri2.cn.\n Win10-UI, easy to create a unique background interface.'))
|
||||
console.log(Win10.lang('本页由Win10-UI强力驱动\n更多信息:http://win10ui.yuri2.cn \nWin10-UI,轻松打造别具一格的后台界面 ',
|
||||
'The page is strongly driven by Win10-UI.\nFor more info: http://win10ui.yuri2.cn.\n Win10-UI, easy to create a unique background interface.'
|
||||
))
|
||||
}, 2000);
|
||||
//点击清空右键菜单
|
||||
$(document).click(function(event) {
|
||||
|
|
@ -441,34 +463,45 @@ window.Win10 = {
|
|||
var title = document.title;
|
||||
var ua = navigator.userAgent.toLowerCase();
|
||||
if (ua.indexOf("360se") > -1) {
|
||||
layer.alert(Win10.lang('您的浏览器不支持,请按 Ctrl+D 手动收藏!','Your browser does not support, please press Ctrl+D to manual collection!'));
|
||||
}
|
||||
else if (ua.indexOf("msie 8") > -1) {
|
||||
layer.alert(Win10.lang('您的浏览器不支持,请按 Ctrl+D 手动收藏!',
|
||||
'Your browser does not support, please press Ctrl+D to manual collection!'));
|
||||
} else if (ua.indexOf("msie 8") > -1) {
|
||||
window.external.AddToFavoritesBar(url, title); //IE8
|
||||
}
|
||||
else if (document.all) {
|
||||
} else if (document.all) {
|
||||
try {
|
||||
window.external.addFavorite(url, title);
|
||||
} catch (e) {
|
||||
layer.alert(Win10.lang('您的浏览器不支持,请按 Ctrl+D 手动收藏!','Your browser does not support, please press Ctrl+D to manual collection!'));
|
||||
layer.alert(Win10.lang('您的浏览器不支持,请按 Ctrl+D 手动收藏!',
|
||||
'Your browser does not support, please press Ctrl+D to manual collection!'));
|
||||
}
|
||||
}
|
||||
else if (window.sidebar) {
|
||||
} else if (window.sidebar) {
|
||||
window.sidebar.addPanel(title, url, "");
|
||||
}
|
||||
else {
|
||||
layer.alert(Win10.lang('您的浏览器不支持,请按 Ctrl+D 手动收藏!','Your browser does not support, please press Ctrl+D to manual collection!'));
|
||||
} else {
|
||||
layer.alert(Win10.lang('您的浏览器不支持,请按 Ctrl+D 手动收藏!',
|
||||
'Your browser does not support, please press Ctrl+D to manual collection!'));
|
||||
}
|
||||
}],
|
||||
['<i class="fa fa-fw fa-window-maximize"></i> '+Win10.lang('进入全屏','Enable Full Screen'),function () {Win10.enableFullScreen()}],
|
||||
['<i class="fa fa-fw fa-window-restore"></i> '+Win10.lang('退出全屏','Disable Full Screen'),function () {Win10.disableFullScreen()}],
|
||||
['<i class="fa fa-fw fa-window-maximize"></i> ' + Win10.lang('进入全屏', 'Enable Full Screen'), function() {
|
||||
Win10.enableFullScreen()
|
||||
}],
|
||||
['<i class="fa fa-fw fa-window-restore"></i> ' + Win10.lang('退出全屏', 'Disable Full Screen'), function() {
|
||||
Win10.disableFullScreen()
|
||||
}],
|
||||
'|',
|
||||
['<i class="fa fa-fw fa-info-circle"></i> '+Win10.lang('关于','About Us'),function () {Win10.aboutUs()}],
|
||||
['<i class="fa fa-fw fa-info-circle"></i> ' + Win10.lang('关于', 'About Us'), function() {
|
||||
Win10.aboutUs()
|
||||
}],
|
||||
]);
|
||||
Win10.setContextMenu('#win10_btn_group_middle', [
|
||||
['<i class="fa fa-fw fa-window-maximize"></i> '+Win10.lang('全部显示','Show All Windows'),function () {Win10.showWins()}],
|
||||
['<i class="fa fa-fw fa-window-minimize"></i> '+Win10.lang('全部隐藏','Hide All Windows'),function () {Win10.hideWins()}],
|
||||
['<i class="fa fa-fw fa-window-close"></i> '+Win10.lang('全部关闭','Close All Windows'),function () {Win10.closeAll()}],
|
||||
['<i class="fa fa-fw fa-window-maximize"></i> ' + Win10.lang('全部显示', 'Show All Windows'), function() {
|
||||
Win10.showWins()
|
||||
}],
|
||||
['<i class="fa fa-fw fa-window-minimize"></i> ' + Win10.lang('全部隐藏', 'Hide All Windows'), function() {
|
||||
Win10.hideWins()
|
||||
}],
|
||||
['<i class="fa fa-fw fa-window-close"></i> ' + Win10.lang('全部关闭', 'Close All Windows'), function() {
|
||||
Win10.closeAll()
|
||||
}],
|
||||
]);
|
||||
|
||||
//处理消息图标闪烁
|
||||
|
|
@ -481,8 +514,7 @@ window.Win10 = {
|
|||
|
||||
//绑定快捷键
|
||||
$("body").keyup(function(e) {
|
||||
if (e.ctrlKey)
|
||||
{
|
||||
if (e.ctrlKey) {
|
||||
switch (e.keyCode) {
|
||||
case 37: //left
|
||||
$("#win10_btn_win").click();
|
||||
|
|
@ -512,7 +544,9 @@ window.Win10 = {
|
|||
top: 30,
|
||||
'z-index': 100,
|
||||
});
|
||||
$("#win10 .desktop").append("<div id='win10-desktop-scene' style='width: 100%;height: 100%;position: absolute;left: 0;top: 0; z-index: 0;background-color: transparent;'></div>")
|
||||
$("#win10 .desktop").append(
|
||||
"<div id='win10-desktop-scene' style='width: 100%;height: 100%;position: absolute;left: 0;top: 0; z-index: 0;background-color: transparent;'></div>"
|
||||
)
|
||||
}
|
||||
//属性绑定
|
||||
Win10._bind_open_windows();
|
||||
|
|
@ -533,8 +567,7 @@ window.Win10 = {
|
|||
},
|
||||
getLunarObj: function() {
|
||||
//农历年信息
|
||||
var lunarInfo = new Array(
|
||||
0x04bd8,0x04ae0,0x0a570,0x054d5,0x0d260,0x0d950,0x16554,0x056a0,0x09ad0,0x055d2,
|
||||
var lunarInfo = [0x04bd8, 0x04ae0, 0x0a570, 0x054d5, 0x0d260, 0x0d950, 0x16554, 0x056a0, 0x09ad0, 0x055d2,
|
||||
0x04ae0, 0x0a5b6, 0x0a4d0, 0x0d250, 0x1d255, 0x0b540, 0x0d6a0, 0x0ada2, 0x095b0, 0x14977,
|
||||
0x04970, 0x0a4b0, 0x0b4b5, 0x06a50, 0x06d40, 0x1ab54, 0x02b60, 0x09570, 0x052f2, 0x04970,
|
||||
0x06566, 0x0d4a0, 0x0ea50, 0x06e95, 0x05ad0, 0x02b60, 0x186e3, 0x092e0, 0x1c8d7, 0x0c950,
|
||||
|
|
@ -548,10 +581,11 @@ window.Win10 = {
|
|||
0x0a950, 0x0b4a0, 0x0baa4, 0x0ad50, 0x055d9, 0x04ba0, 0x0a5b0, 0x15176, 0x052b0, 0x0a930,
|
||||
0x07954, 0x06aa0, 0x0ad50, 0x05b52, 0x04b60, 0x0a6e6, 0x0a4e0, 0x0d260, 0x0ea65, 0x0d530,
|
||||
0x05aa0, 0x076a3, 0x096d0, 0x04bd7, 0x04ad0, 0x0a4d0, 0x1d0b6, 0x0d250, 0x0d520, 0x0dd45,
|
||||
0x0b5a0,0x056d0,0x055b2,0x049b0,0x0a577,0x0a4b0,0x0aa50,0x1b255,0x06d20,0x0ada0);
|
||||
var Animals=new Array("鼠","牛","虎","兔","龙","蛇","马","羊","猴","鸡","狗","猪");
|
||||
var Gan=new Array("甲","乙","丙","丁","戊","己","庚","辛","壬","癸");
|
||||
var Zhi=new Array("子","丑","寅","卯","辰","巳","午","未","申","酉","戌","亥");
|
||||
0x0b5a0, 0x056d0, 0x055b2, 0x049b0, 0x0a577, 0x0a4b0, 0x0aa50, 0x1b255, 0x06d20, 0x0ada0
|
||||
];
|
||||
var Animals = ["鼠", "牛", "虎", "兔", "龙", "蛇", "马", "羊", "猴", "鸡", "狗", "猪"];
|
||||
var Gan = ["甲", "乙", "丙", "丁", "戊", "己", "庚", "辛", "壬", "癸"];
|
||||
var Zhi = ["子", "丑", "寅", "卯", "辰", "巳", "午", "未", "申", "酉", "戌", "亥"];
|
||||
|
||||
//==== 传回农历 y年的总天数
|
||||
function lYearDays(y) {
|
||||
|
|
@ -559,6 +593,7 @@ window.Win10 = {
|
|||
for (i = 0x8000; i > 0x8; i >>= 1) sum += (lunarInfo[y - 1900] & i) ? 1 : 0
|
||||
return (sum + leapDays(y))
|
||||
}
|
||||
|
||||
//==== 传回农历 y年闰月的天数
|
||||
function leapDays(y) {
|
||||
if (leapMonth(y))
|
||||
|
|
@ -566,18 +601,22 @@ window.Win10 = {
|
|||
else
|
||||
return (0)
|
||||
}
|
||||
|
||||
//==== 传回农历 y年闰哪个月 1-12 , 没闰传回 0
|
||||
function leapMonth(y) {
|
||||
return (lunarInfo[y - 1900] & 0xf);
|
||||
}
|
||||
|
||||
//==== 传回农历 y年m月的总天数
|
||||
function monthDays(y, m) {
|
||||
return ((lunarInfo[y - 1900] & (0x10000 >> m)) ? 30 : 29);
|
||||
}
|
||||
|
||||
//==== 算出农历, 传入日期物件, 传回农历日期物件
|
||||
// 该物件属性有 .year .month .day .isLeap .yearCyl .dayCyl .monCyl
|
||||
function lunar(objDate) {
|
||||
var i, leap=0, temp=0
|
||||
var i, leap = 0,
|
||||
temp = 0
|
||||
var baseDate = new Date(1900, 0, 31)
|
||||
var offset = (objDate - baseDate) / 86400000
|
||||
|
||||
|
|
@ -603,10 +642,13 @@ window.Win10 = {
|
|||
|
||||
for (i = 1; i < 13 && offset > 0; i++) {
|
||||
//闰月
|
||||
if(leap>0 && i==(leap+1) && false === this.isLeap)
|
||||
{ --i; this.isLeap = true; temp = leapDays(this.year); }
|
||||
else
|
||||
{ temp = monthDays(this.year, i); }
|
||||
if (leap > 0 && i == (leap + 1) && false === this.isLeap) {
|
||||
--i;
|
||||
this.isLeap = true;
|
||||
temp = leapDays(this.year);
|
||||
} else {
|
||||
temp = monthDays(this.year, i);
|
||||
}
|
||||
|
||||
//解除闰月
|
||||
if (true === this.isLeap && i == (leap + 1)) this.isLeap = false
|
||||
|
|
@ -616,37 +658,42 @@ window.Win10 = {
|
|||
}
|
||||
|
||||
if (offset == 0 && leap > 0 && i == leap + 1)
|
||||
if(this.isLeap)
|
||||
{ this.isLeap = false; }
|
||||
else
|
||||
{ this.isLeap = true; --i; --this.monCyl;}
|
||||
if (this.isLeap) {
|
||||
this.isLeap = false;
|
||||
} else {
|
||||
this.isLeap = true;
|
||||
--i;
|
||||
--this.monCyl;
|
||||
}
|
||||
|
||||
if(offset<0){ offset += temp; --i; --this.monCyl; }
|
||||
if (offset < 0) {
|
||||
offset += temp;
|
||||
--i;
|
||||
--this.monCyl;
|
||||
}
|
||||
|
||||
this.month = i
|
||||
this.day = offset + 1
|
||||
}
|
||||
|
||||
//获取农历(月)中文格式
|
||||
function get_lunarmonth(month) {
|
||||
var fm = ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "腊月"];
|
||||
return fm[month - 1];
|
||||
}
|
||||
|
||||
//获取农历(日)中文格式
|
||||
function get_lunarday(day) {
|
||||
var fd = ["十", "一", "二", "三", "四", "五", "六", "七", "八", "九", "十"];
|
||||
if (day <= 10) {
|
||||
return "初" + fd[day];
|
||||
}
|
||||
else if(day < 20){
|
||||
} else if (day < 20) {
|
||||
return "十" + fd[day - 10];
|
||||
}
|
||||
else if(day==20){
|
||||
} else if (day == 20) {
|
||||
return "二十";
|
||||
}
|
||||
else if(day < 30){
|
||||
} else if (day < 30) {
|
||||
return "廿" + fd[day - 20];
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
return "三" + fd[day - 30];
|
||||
}
|
||||
}
|
||||
|
|
@ -656,10 +703,12 @@ window.Win10 = {
|
|||
var num = year - 1900 + 36;
|
||||
return (Gan[num % 10] + Zhi[num % 12]);
|
||||
}
|
||||
|
||||
//获取生肖
|
||||
function get_animal(year) {
|
||||
return Animals[(year - 4) % 12];
|
||||
}
|
||||
|
||||
//获取周
|
||||
function get_weekday(date) {
|
||||
var values = ["周日", "周一", "周二", "周三", "周四", "周五", "周六"];
|
||||
|
|
@ -684,21 +733,31 @@ window.Win10 = {
|
|||
//获取小时
|
||||
function get_hour(date) {
|
||||
var hour = date.getHours();
|
||||
if(hour < 6){hours='凌晨'+hour;}
|
||||
else if (hour < 9){hours='早上'+hour;}
|
||||
else if (hour < 12){hours='上午'+hour;}
|
||||
else if (hour < 14){hours='中午'+(hour-12);}
|
||||
else if (hour < 17){hours='下午'+(hour-12);}
|
||||
else if (hour < 19){hours='傍晚'+(hour-12);}
|
||||
else if (hour < 22){hours='晚上'+(hour-12);}
|
||||
else {hours='深夜'+(hour-12)}
|
||||
if (hour < 6) {
|
||||
hours = '凌晨' + hour;
|
||||
} else if (hour < 9) {
|
||||
hours = '早上' + hour;
|
||||
} else if (hour < 12) {
|
||||
hours = '上午' + hour;
|
||||
} else if (hour < 14) {
|
||||
hours = '中午' + (hour - 12);
|
||||
} else if (hour < 17) {
|
||||
hours = '下午' + (hour - 12);
|
||||
} else if (hour < 19) {
|
||||
hours = '傍晚' + (hour - 12);
|
||||
} else if (hour < 22) {
|
||||
hours = '晚上' + (hour - 12);
|
||||
} else {
|
||||
hours = '深夜' + (hour - 12)
|
||||
}
|
||||
return hours;
|
||||
}
|
||||
|
||||
var viewdate = {};
|
||||
var date = new Date();
|
||||
//秒
|
||||
viewdate.second = date.getSeconds();;
|
||||
viewdate.second = date.getSeconds();
|
||||
|
||||
//分钟
|
||||
viewdate.minute = get_min(date);
|
||||
//小时
|
||||
|
|
@ -738,8 +797,10 @@ window.Win10 = {
|
|||
if (!today) {
|
||||
var lunarDate = Win10.getLunarObj();
|
||||
var today = '<div class="command-body-calendar">' +
|
||||
'<div class="command-body-calendar-date normal-date">'+lunarDate.month+'月'+lunarDate.day+'日 '+lunarDate.week+'</div>' +
|
||||
'<div class="command-body-calendar-date lunar-date">'+lunarDate.ganzhi+'年'+lunarDate.lunarmonth+lunarDate.lunarday+'</div>' +
|
||||
'<div class="command-body-calendar-date normal-date">' + lunarDate.month + '月' + lunarDate.day + '日 ' +
|
||||
lunarDate.week + '</div>' +
|
||||
'<div class="command-body-calendar-date lunar-date">' + lunarDate.ganzhi + '年' + lunarDate.lunarmonth +
|
||||
lunarDate.lunarday + '</div>' +
|
||||
'</div>';
|
||||
today += '<div class="notice">' +
|
||||
'<div class="notice-header">' +
|
||||
|
|
@ -783,11 +844,12 @@ window.Win10 = {
|
|||
var h = parseInt(($("#win10 #win10-shortcuts")[0].offsetHeight - 90) / 100);
|
||||
var w = 0;
|
||||
//计算一列最大几个图标,公式是(桌面图标界面的大小 - 顶部状态栏和底部dock栏的尺寸)/单个图标高度所占的尺寸
|
||||
var x=0,y=0;
|
||||
var x = 0,
|
||||
y = 0;
|
||||
$("#win10 #win10-shortcuts .shortcut").each(function() {
|
||||
$(this).css({
|
||||
right:x*82+10,
|
||||
left:0,
|
||||
left: x * 82 + 10,
|
||||
// left:0,
|
||||
top: y * 100 + 10,
|
||||
});
|
||||
y++;
|
||||
|
|
@ -799,7 +861,8 @@ window.Win10 = {
|
|||
} else {
|
||||
//小屏幕执行横屏
|
||||
var w = parseInt(($("#win10 #win10-shortcuts")[0].offsetWidth - 10) / 82);
|
||||
var x=0,y=0;
|
||||
var x = 0,
|
||||
y = 0;
|
||||
$("#win10 #win10-shortcuts .shortcut").each(function() {
|
||||
$(this).css({
|
||||
left: x * 82 + 10,
|
||||
|
|
@ -849,7 +912,8 @@ window.Win10 = {
|
|||
this.commandCenterClose();
|
||||
}
|
||||
},
|
||||
newMsg: function (title,content,handle_click,app_name='提示消息',app_icon='<img src="./img/icon/weather.png" class="notice-header-icon-img" />',is_del=true) {
|
||||
newMsg: function(title, content, handle_click, app_name = '提示消息', app_icon =
|
||||
'<img src="./img/icon/weather.png" class="notice-header-icon-img" />', is_del = true) {
|
||||
var msg = '<div class="notice">' +
|
||||
'<div class="notice-header">' +
|
||||
'<span class="notice-header-icon">' + app_icon + '</span>' +
|
||||
|
|
@ -910,14 +974,11 @@ window.Win10 = {
|
|||
disableFullScreen: function() {
|
||||
if (document.exitFullscreen) {
|
||||
document.exitFullscreen();
|
||||
}
|
||||
else if (document.mozCancelFullScreen) {
|
||||
} else if (document.mozCancelFullScreen) {
|
||||
document.mozCancelFullScreen();
|
||||
}
|
||||
else if (document.webkitCancelFullScreen) {
|
||||
} else if (document.webkitCancelFullScreen) {
|
||||
document.webkitCancelFullScreen();
|
||||
}
|
||||
else if (document.msExitFullscreen) {
|
||||
} else if (document.msExitFullscreen) {
|
||||
document.msExitFullscreen();
|
||||
}
|
||||
},
|
||||
|
|
@ -948,7 +1009,9 @@ window.Win10 = {
|
|||
} else {
|
||||
this._countTask++;
|
||||
}
|
||||
if(!url){url='404'}
|
||||
if (!url) {
|
||||
url = '404'
|
||||
}
|
||||
url = url.replace(/(^\s*)|(\s*$)/g, "");
|
||||
var preg = /^(https?:\/\/|\.\.?\/|\/\/?)/;
|
||||
if (!preg.test(url)) {
|
||||
|
|
@ -974,7 +1037,8 @@ window.Win10 = {
|
|||
topset = (topset - (topset * 0.8)) / 2 - 31;
|
||||
leftset = parseInt($(window).width());
|
||||
leftset = (leftset - (leftset * 0.8)) / 2 - 120;
|
||||
offset = [Math.round((this._countTask % 10 * 20) + topset) + 'px', Math.round((this._countTask % 10 * 20 + 100) + leftset) + 'px'];
|
||||
offset = [Math.round((this._countTask % 10 * 20) + topset) + 'px', Math.round((this._countTask % 10 * 20 + 100) +
|
||||
leftset) + 'px'];
|
||||
}
|
||||
var index = layer.open({
|
||||
type: 2,
|
||||
|
|
@ -1004,12 +1068,14 @@ window.Win10 = {
|
|||
},
|
||||
});
|
||||
$('#win10_btn_group_middle .btn.active').removeClass('active');
|
||||
var btn = $('<div id="win10_' + index + '" index="' + index + '" class="btn show active"><div class="btn_title">'+icon+'</div></div>');
|
||||
var btn = $('<div id="win10_' + index + '" index="' + index + '" class="btn show active"><div class="btn_title">' +
|
||||
icon + '</div></div>');
|
||||
var layero_opened = Win10.getLayeroByIndex(index);
|
||||
layero_opened.css('z-index', Win10._countTask + 813);
|
||||
Win10._settop(layero_opened);
|
||||
//重新定义菜单布局
|
||||
layero_opened.find('.layui-layer-setwin').prepend('<a class="win10-btn-refresh" index="' + index + '" href="#"></a>');
|
||||
layero_opened.find('.layui-layer-setwin').prepend('<a class="win10-btn-refresh" index="' + index +
|
||||
'" href="#"></a>');
|
||||
//菜单排列倒序
|
||||
layero_opened.find(".layui-layer-setwin>a").each(function() {
|
||||
$(this).prependTo(layero_opened.find(".layui-layer-setwin"));
|
||||
|
|
@ -1036,7 +1102,9 @@ window.Win10 = {
|
|||
$(".win10-open-iframe").each(function() {
|
||||
z = parseInt($(this).css('z-index'));
|
||||
$(this).css('z-index', z - 1);
|
||||
if(z>max_zindex){max_zindex=z;}
|
||||
if (z > max_zindex) {
|
||||
max_zindex = z;
|
||||
}
|
||||
});
|
||||
layero.css('z-index', max_zindex + 1);
|
||||
};
|
||||
|
|
@ -1084,14 +1152,17 @@ window.Win10 = {
|
|||
this._animated_liveness = animated_liveness;
|
||||
},
|
||||
exit: function() {
|
||||
layer.confirm(Win10.lang('确认要关闭本页吗?','Are you sure you want to close this page?'), {icon: 3, title:Win10.lang('提示','Prompt')}, function(index){
|
||||
layer.confirm(Win10.lang('确认要关闭本页吗?', 'Are you sure you want to close this page?'), {
|
||||
icon: 3,
|
||||
title: Win10.lang('提示', 'Prompt')
|
||||
}, function(index) {
|
||||
document.body.onbeforeunload = function() {};
|
||||
window.location.href = "about:blank";
|
||||
window.close();
|
||||
layer.close(index);
|
||||
layer.alert(Win10.lang('哎呀,好像失败了呢。', 'Ops...There seems to be a little problem.'), {
|
||||
skin: 'layui-layer-lan'
|
||||
,closeBtn: 0
|
||||
skin: 'layui-layer-lan',
|
||||
closeBtn: 0
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue