mirror of https://github.com/1099438829/macUI.git
update
This commit is contained in:
parent
f61b4b4cad
commit
5f3421c8cf
214
js/mac.js
214
js/mac.js
|
|
@ -27,7 +27,7 @@ window.Win10 = {
|
||||||
track: function(element, cb) {
|
track: function(element, cb) {
|
||||||
this.iframes.push(new this.Iframe(element, cb));
|
this.iframes.push(new this.Iframe(element, cb));
|
||||||
if (!this.interval) {
|
if (!this.interval) {
|
||||||
var _this = this;
|
let _this = this;
|
||||||
this.interval = setInterval(function() {
|
this.interval = setInterval(function() {
|
||||||
_this.checkClick();
|
_this.checkClick();
|
||||||
}, this.resolution);
|
}, this.resolution);
|
||||||
|
|
@ -35,9 +35,9 @@ window.Win10 = {
|
||||||
},
|
},
|
||||||
checkClick: function() {
|
checkClick: function() {
|
||||||
if (document.activeElement) {
|
if (document.activeElement) {
|
||||||
var activeElement = document.activeElement;
|
let activeElement = document.activeElement;
|
||||||
for (var i in this.iframes) {
|
for (let i in this.iframes) {
|
||||||
var eid = undefined;
|
let eid = undefined;
|
||||||
if ((eid = this.iframes[i].element.id) && !document.getElementById(eid)) {
|
if ((eid = this.iframes[i].element.id) && !document.getElementById(eid)) {
|
||||||
delete this.iframes[i];
|
delete this.iframes[i];
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -60,27 +60,27 @@ window.Win10 = {
|
||||||
if (this._countTask <= 0) {
|
if (this._countTask <= 0) {
|
||||||
return;
|
return;
|
||||||
} //防止除以0
|
} //防止除以0
|
||||||
var btns = $("#win10_btn_group_middle>.btn");
|
let btns = $("#win10_btn_group_middle>.btn");
|
||||||
btns.css('width', ('calc(' + (1 / this._countTask * 100) + '% - 1px )'))
|
btns.css('width', ('calc(' + (1 / this._countTask * 100) + '% - 1px )'))
|
||||||
},
|
},
|
||||||
_handleReady: [],
|
_handleReady: [],
|
||||||
_hideShortcut: function() {
|
_hideShortcut: function() {
|
||||||
var that = $("#win10 #win10-shortcuts .shortcut");
|
let that = $("#win10 #win10-shortcuts .shortcut");
|
||||||
that.removeClass('animated flipInX');
|
that.removeClass('animated flipInX');
|
||||||
that.addClass('animated flipOutX');
|
that.addClass('animated flipOutX');
|
||||||
},
|
},
|
||||||
_showShortcut: function() {
|
_showShortcut: function() {
|
||||||
var that = $("#win10 #win10-shortcuts .shortcut");
|
let that = $("#win10 #win10-shortcuts .shortcut");
|
||||||
that.removeClass('animated flipOutX');
|
that.removeClass('animated flipOutX');
|
||||||
that.addClass('animated flipInX');
|
that.addClass('animated flipInX');
|
||||||
},
|
},
|
||||||
_checkBgUrls: function() {
|
_checkBgUrls: function() {
|
||||||
var loaders = $('#win10>.img-loader');
|
let loaders = $('#win10>.img-loader');
|
||||||
var flag = false;
|
let flag = false;
|
||||||
if (Win10.isSmallScreen()) {
|
if (Win10.isSmallScreen()) {
|
||||||
if (Win10._bgs.mobile) {
|
if (Win10._bgs.mobile) {
|
||||||
loaders.each(function() {
|
loaders.each(function() {
|
||||||
var loader = $(this);
|
let loader = $(this);
|
||||||
if (loader.attr('src') === Win10._bgs.mobile && loader.hasClass('loaded')) {
|
if (loader.attr('src') === Win10._bgs.mobile && loader.hasClass('loaded')) {
|
||||||
Win10._setBackgroundImg(Win10._bgs.mobile);
|
Win10._setBackgroundImg(Win10._bgs.mobile);
|
||||||
flag = true;
|
flag = true;
|
||||||
|
|
@ -88,7 +88,7 @@ window.Win10 = {
|
||||||
});
|
});
|
||||||
if (!flag) {
|
if (!flag) {
|
||||||
//没找到加载完毕的图片
|
//没找到加载完毕的图片
|
||||||
var img = $('<img class="img-loader" src="' + Win10._bgs.mobile + '" />');
|
let img = $('<img class="img-loader" src="' + Win10._bgs.mobile + '" />');
|
||||||
$('#win10').append(img);
|
$('#win10').append(img);
|
||||||
Win10._onImgComplete(img[0], function() {
|
Win10._onImgComplete(img[0], function() {
|
||||||
img.addClass('loaded');
|
img.addClass('loaded');
|
||||||
|
|
@ -99,7 +99,7 @@ window.Win10 = {
|
||||||
} else {
|
} else {
|
||||||
if (Win10._bgs.main) {
|
if (Win10._bgs.main) {
|
||||||
loaders.each(function() {
|
loaders.each(function() {
|
||||||
var loader = $(this);
|
let loader = $(this);
|
||||||
if (loader.attr('src') === Win10._bgs.main && loader.hasClass('loaded')) {
|
if (loader.attr('src') === Win10._bgs.main && loader.hasClass('loaded')) {
|
||||||
Win10._setBackgroundImg(Win10._bgs.main);
|
Win10._setBackgroundImg(Win10._bgs.main);
|
||||||
flag = true;
|
flag = true;
|
||||||
|
|
@ -107,7 +107,7 @@ window.Win10 = {
|
||||||
});
|
});
|
||||||
if (!flag) {
|
if (!flag) {
|
||||||
//没找到加载完毕的图片
|
//没找到加载完毕的图片
|
||||||
var img = $('<img class="img-loader" src="' + Win10._bgs.main + '" />');
|
let img = $('<img class="img-loader" src="' + Win10._bgs.main + '" />');
|
||||||
$('#win10').append(img);
|
$('#win10').append(img);
|
||||||
Win10._onImgComplete(img[0], function() {
|
Win10._onImgComplete(img[0], function() {
|
||||||
img.addClass('loaded');
|
img.addClass('loaded');
|
||||||
|
|
@ -123,15 +123,15 @@ window.Win10 = {
|
||||||
},
|
},
|
||||||
_startAnimate: function() {
|
_startAnimate: function() {
|
||||||
setInterval(function() {
|
setInterval(function() {
|
||||||
var classes_lenth = Win10._animated_classes.length;
|
let classes_lenth = Win10._animated_classes.length;
|
||||||
var animated_liveness = Win10._animated_liveness;
|
let animated_liveness = Win10._animated_liveness;
|
||||||
if (animated_liveness === 0 || classes_lenth === 0 || !$("#win10-menu").hasClass('opened')) {
|
if (animated_liveness === 0 || classes_lenth === 0 || !$("#win10-menu").hasClass('opened')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$('#win10-menu>.blocks>.menu_group>.block').each(function() {
|
$('#win10-menu>.blocks>.menu_group>.block').each(function() {
|
||||||
if (!$(this).hasClass('onAnimate') && Math.random() <= animated_liveness) {
|
if (!$(this).hasClass('onAnimate') && Math.random() <= animated_liveness) {
|
||||||
var that = $(this);
|
let that = $(this);
|
||||||
var class_animate = Win10._animated_classes[Math.floor((Math.random() * classes_lenth))];
|
let class_animate = Win10._animated_classes[Math.floor((Math.random() * classes_lenth))];
|
||||||
that.addClass('onAnimate');
|
that.addClass('onAnimate');
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
that.addClass(class_animate);
|
that.addClass(class_animate);
|
||||||
|
|
@ -148,7 +148,7 @@ window.Win10 = {
|
||||||
if (!img) {
|
if (!img) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var timer = setInterval(function() {
|
let timer = setInterval(function() {
|
||||||
if (img.complete) {
|
if (img.complete) {
|
||||||
callback(img);
|
callback(img);
|
||||||
clearInterval(timer);
|
clearInterval(timer);
|
||||||
|
|
@ -163,7 +163,7 @@ window.Win10 = {
|
||||||
layero = this.getLayeroByIndex(layero);
|
layero = this.getLayeroByIndex(layero);
|
||||||
}
|
}
|
||||||
//置顶窗口
|
//置顶窗口
|
||||||
var max_zindex = 0;
|
let max_zindex = 0;
|
||||||
$(".win10-open-iframe").each(function() {
|
$(".win10-open-iframe").each(function() {
|
||||||
z = parseInt($(this).css('z-index'));
|
z = parseInt($(this).css('z-index'));
|
||||||
$(this).css('z-index', z - 1);
|
$(this).css('z-index', z - 1);
|
||||||
|
|
@ -174,13 +174,13 @@ window.Win10 = {
|
||||||
layero.css('z-index', max_zindex + 1);
|
layero.css('z-index', max_zindex + 1);
|
||||||
},
|
},
|
||||||
_checkTop: function() {
|
_checkTop: function() {
|
||||||
var max_index = 0,
|
let max_index = 0,
|
||||||
max_z = 0,
|
max_z = 0,
|
||||||
btn = null;
|
btn = null;
|
||||||
$("#win10_btn_group_middle .btn.show").each(function() {
|
$("#win10_btn_group_middle .btn.show").each(function() {
|
||||||
var index = $(this).attr('index');
|
let index = $(this).attr('index');
|
||||||
var layero = Win10.getLayeroByIndex(index);
|
let layero = Win10.getLayeroByIndex(index);
|
||||||
var z = layero.css('z-index');
|
let z = layero.css('z-index');
|
||||||
if (z > max_z) {
|
if (z > max_z) {
|
||||||
max_index = index;
|
max_index = index;
|
||||||
max_z = z;
|
max_z = z;
|
||||||
|
|
@ -199,11 +199,11 @@ window.Win10 = {
|
||||||
if (menu === true) {
|
if (menu === true) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var dom = $("<div class='win10-context-menu'><ul></ul></div>");
|
let dom = $("<div class='win10-context-menu'><ul></ul></div>");
|
||||||
$('#win10').append(dom);
|
$('#win10').append(dom);
|
||||||
var ul = dom.find('ul');
|
let ul = dom.find('ul');
|
||||||
for (var i = 0; i < menu.length; i++) {
|
for (let i = 0; i < menu.length; i++) {
|
||||||
var item = menu[i];
|
let item = menu[i];
|
||||||
if (item === '|') {
|
if (item === '|') {
|
||||||
ul.append($('<hr/>'));
|
ul.append($('<hr/>'));
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -213,7 +213,7 @@ window.Win10 = {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (typeof(item) === 'object') {
|
if (typeof(item) === 'object') {
|
||||||
var sub = $('<li>' + item[0] + '</li>');
|
let sub = $('<li>' + item[0] + '</li>');
|
||||||
ul.append(sub);
|
ul.append(sub);
|
||||||
sub.click(trigger, item[1]);
|
sub.click(trigger, item[1]);
|
||||||
|
|
||||||
|
|
@ -242,11 +242,11 @@ window.Win10 = {
|
||||||
},
|
},
|
||||||
_fixWindowsHeightAndWidth: function() {
|
_fixWindowsHeightAndWidth: function() {
|
||||||
//此处代码修正全屏切换引起的子窗体尺寸超出屏幕
|
//此处代码修正全屏切换引起的子窗体尺寸超出屏幕
|
||||||
var opens = $('.win10-open-iframe');
|
let opens = $('.win10-open-iframe');
|
||||||
var clientHeight = document.body.clientHeight;
|
let clientHeight = document.body.clientHeight;
|
||||||
opens.each(function() {
|
opens.each(function() {
|
||||||
var layero_opened = $(this);
|
let layero_opened = $(this);
|
||||||
var height = layero_opened.css('height');
|
let height = layero_opened.css('height');
|
||||||
height = parseInt(height.replace('px', ''));
|
height = parseInt(height.replace('px', ''));
|
||||||
if (height + 30 >= clientHeight) {
|
if (height + 30 >= clientHeight) {
|
||||||
layero_opened.css('height', clientHeight - 30);
|
layero_opened.css('height', clientHeight - 30);
|
||||||
|
|
@ -271,10 +271,10 @@ window.Win10 = {
|
||||||
//>> 判断url地址是否为空 如果为空 不予处理
|
//>> 判断url地址是否为空 如果为空 不予处理
|
||||||
if ($this.data('url') !== "") {
|
if ($this.data('url') !== "") {
|
||||||
//>> 获取弹窗标题
|
//>> 获取弹窗标题
|
||||||
var title = $this.data('title') || '',
|
let title = $this.data('title') || '',
|
||||||
areaAndOffset, icon;
|
areaAndOffset, icon;
|
||||||
//>> 判断是否有标题图片
|
//>> 判断是否有标题图片
|
||||||
var bg = $this.data('icon-bg') ? $this.data('icon-bg') : '';
|
let bg = $this.data('icon-bg') ? $this.data('icon-bg') : '';
|
||||||
if ($this.data('icon-image')) {
|
if ($this.data('icon-image')) {
|
||||||
//>> 加入到标题中
|
//>> 加入到标题中
|
||||||
icon = '<img class="icon ' + bg + '" src="' + $this.data('icon-image') + '"/>';
|
icon = '<img class="icon ' + bg + '" src="' + $this.data('icon-image') + '"/>';
|
||||||
|
|
@ -321,7 +321,7 @@ window.Win10 = {
|
||||||
Win10.commandCenterClose();
|
Win10.commandCenterClose();
|
||||||
});
|
});
|
||||||
$('#win10').on('click', ".notice .btn_close_msg", function() {
|
$('#win10').on('click', ".notice .btn_close_msg", function() {
|
||||||
var msg = $(this).parents('.notice');
|
let msg = $(this).parents('.notice');
|
||||||
$(msg).addClass('animated slideOutRight');
|
$(msg).addClass('animated slideOutRight');
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
msg.remove()
|
msg.remove()
|
||||||
|
|
@ -340,7 +340,7 @@ window.Win10 = {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$('#win10_btn_command_center_clean_all').click(function() {
|
$('#win10_btn_command_center_clean_all').click(function() {
|
||||||
var msgs = $('#win10_command_center .msg');
|
let msgs = $('#win10_command_center .msg');
|
||||||
msgs.addClass('animated slideOutRight');
|
msgs.addClass('animated slideOutRight');
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
msgs.remove()
|
msgs.remove()
|
||||||
|
|
@ -358,10 +358,10 @@ window.Win10 = {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Win10._switchMenuTooHurry = true;
|
Win10._switchMenuTooHurry = true;
|
||||||
var class_name = 'win10-menu-hidden';
|
let class_name = 'win10-menu-hidden';
|
||||||
var list = $("#win10-menu>.list");
|
let list = $("#win10-menu>.list");
|
||||||
var blocks = $("#win10-menu>.blocks");
|
let blocks = $("#win10-menu>.blocks");
|
||||||
var toggleSlide = function(obj) {
|
let toggleSlide = function(obj) {
|
||||||
if (obj.hasClass(class_name)) {
|
if (obj.hasClass(class_name)) {
|
||||||
obj.addClass('animated slideInLeft');
|
obj.addClass('animated slideInLeft');
|
||||||
obj.removeClass('animated slideOutLeft');
|
obj.removeClass('animated slideOutLeft');
|
||||||
|
|
@ -384,21 +384,21 @@ window.Win10 = {
|
||||||
$("#win10 .desktop").click();
|
$("#win10 .desktop").click();
|
||||||
});
|
});
|
||||||
$(document).on('click', '.win10-btn-refresh', function() {
|
$(document).on('click', '.win10-btn-refresh', function() {
|
||||||
var index = $(this).attr('index');
|
let index = $(this).attr('index');
|
||||||
var iframe = Win10.getLayeroByIndex(index).find('iframe');
|
let iframe = Win10.getLayeroByIndex(index).find('iframe');
|
||||||
iframe.attr('src', iframe.attr('src'));
|
iframe.attr('src', iframe.attr('src'));
|
||||||
});
|
});
|
||||||
$(document).on('mousedown', '.win10-open-iframe', function() {
|
$(document).on('mousedown', '.win10-open-iframe', function() {
|
||||||
var layero = $(this);
|
let layero = $(this);
|
||||||
Win10._settop(layero);
|
Win10._settop(layero);
|
||||||
Win10._checkTop();
|
Win10._checkTop();
|
||||||
});
|
});
|
||||||
$('#win10_btn_group_middle').on('click', '.btn_close', function() {
|
$('#win10_btn_group_middle').on('click', '.btn_close', function() {
|
||||||
var index = $(this).parent().attr('index');
|
let index = $(this).parent().attr('index');
|
||||||
Win10._closeWin(index);
|
Win10._closeWin(index);
|
||||||
});
|
});
|
||||||
$('#win10-menu .list').on('click', '.item', function() {
|
$('#win10-menu .list').on('click', '.item', function() {
|
||||||
var e = $(this);
|
let e = $(this);
|
||||||
if (e.hasClass('has-sub-down')) {
|
if (e.hasClass('has-sub-down')) {
|
||||||
$('#win10-menu .list .item.has-sub-up').toggleClass('has-sub-down').toggleClass('has-sub-up');
|
$('#win10-menu .list .item.has-sub-up').toggleClass('has-sub-down').toggleClass('has-sub-up');
|
||||||
$("#win10-menu .list .sub-item").slideUp();
|
$("#win10-menu .list .sub-item").slideUp();
|
||||||
|
|
@ -413,12 +413,12 @@ window.Win10 = {
|
||||||
});
|
});
|
||||||
setInterval(function() {
|
setInterval(function() {
|
||||||
//重新写mac时间
|
//重新写mac时间
|
||||||
var myDate = Win10.getLunarObj();
|
let myDate = Win10.getLunarObj();
|
||||||
$("#win10_btn_time").html(myDate.weekDay + myDate.hour + ':' + myDate.minute);
|
$("#win10_btn_time").html(myDate.weekDay + myDate.hour + ':' + myDate.minute);
|
||||||
}, 1000);
|
}, 1000);
|
||||||
//离开前警告
|
//离开前警告
|
||||||
document.body.onbeforeunload = function(event) {
|
document.body.onbeforeunload = function(event) {
|
||||||
var rel = Win10.lang('系统可能不会保存您所做的更改', 'The system may not save the changes you have made.');
|
let rel = Win10.lang('系统可能不会保存您所做的更改', 'The system may not save the changes you have made.');
|
||||||
if (!window.event) {
|
if (!window.event) {
|
||||||
event.returnValue = rel;
|
event.returnValue = rel;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -459,9 +459,9 @@ window.Win10 = {
|
||||||
Win10.setContextMenu('#win10', true);
|
Win10.setContextMenu('#win10', true);
|
||||||
Win10.setContextMenu('#win10>.desktop', [
|
Win10.setContextMenu('#win10>.desktop', [
|
||||||
['<i class="fa fa-fw fa-star"></i> 收藏本页', function() {
|
['<i class="fa fa-fw fa-star"></i> 收藏本页', function() {
|
||||||
var url = window.location;
|
let url = window.location;
|
||||||
var title = document.title;
|
let title = document.title;
|
||||||
var ua = navigator.userAgent.toLowerCase();
|
let ua = navigator.userAgent.toLowerCase();
|
||||||
if (ua.indexOf("360se") > -1) {
|
if (ua.indexOf("360se") > -1) {
|
||||||
layer.alert(Win10.lang('您的浏览器不支持,请按 Ctrl+D 手动收藏!',
|
layer.alert(Win10.lang('您的浏览器不支持,请按 Ctrl+D 手动收藏!',
|
||||||
'Your browser does not support, please press Ctrl+D to manual collection!'));
|
'Your browser does not support, please press Ctrl+D to manual collection!'));
|
||||||
|
|
@ -506,7 +506,7 @@ window.Win10 = {
|
||||||
|
|
||||||
//处理消息图标闪烁
|
//处理消息图标闪烁
|
||||||
setInterval(function() {
|
setInterval(function() {
|
||||||
var btn = $("#win10-msg-nof.on-new-msg");
|
let btn = $("#win10-msg-nof.on-new-msg");
|
||||||
if (btn.length > 0) {
|
if (btn.length > 0) {
|
||||||
btn.toggleClass('fa-commenting-o');
|
btn.toggleClass('fa-commenting-o');
|
||||||
}
|
}
|
||||||
|
|
@ -567,7 +567,7 @@ window.Win10 = {
|
||||||
},
|
},
|
||||||
getLunarObj: function() {
|
getLunarObj: function() {
|
||||||
//农历年信息
|
//农历年信息
|
||||||
var lunarInfo = [0x04bd8, 0x04ae0, 0x0a570, 0x054d5, 0x0d260, 0x0d950, 0x16554, 0x056a0, 0x09ad0, 0x055d2,
|
let lunarInfo = [0x04bd8, 0x04ae0, 0x0a570, 0x054d5, 0x0d260, 0x0d950, 0x16554, 0x056a0, 0x09ad0, 0x055d2,
|
||||||
0x04ae0, 0x0a5b6, 0x0a4d0, 0x0d250, 0x1d255, 0x0b540, 0x0d6a0, 0x0ada2, 0x095b0, 0x14977,
|
0x04ae0, 0x0a5b6, 0x0a4d0, 0x0d250, 0x1d255, 0x0b540, 0x0d6a0, 0x0ada2, 0x095b0, 0x14977,
|
||||||
0x04970, 0x0a4b0, 0x0b4b5, 0x06a50, 0x06d40, 0x1ab54, 0x02b60, 0x09570, 0x052f2, 0x04970,
|
0x04970, 0x0a4b0, 0x0b4b5, 0x06a50, 0x06d40, 0x1ab54, 0x02b60, 0x09570, 0x052f2, 0x04970,
|
||||||
0x06566, 0x0d4a0, 0x0ea50, 0x06e95, 0x05ad0, 0x02b60, 0x186e3, 0x092e0, 0x1c8d7, 0x0c950,
|
0x06566, 0x0d4a0, 0x0ea50, 0x06e95, 0x05ad0, 0x02b60, 0x186e3, 0x092e0, 0x1c8d7, 0x0c950,
|
||||||
|
|
@ -583,13 +583,13 @@ window.Win10 = {
|
||||||
0x05aa0, 0x076a3, 0x096d0, 0x04bd7, 0x04ad0, 0x0a4d0, 0x1d0b6, 0x0d250, 0x0d520, 0x0dd45,
|
0x05aa0, 0x076a3, 0x096d0, 0x04bd7, 0x04ad0, 0x0a4d0, 0x1d0b6, 0x0d250, 0x0d520, 0x0dd45,
|
||||||
0x0b5a0, 0x056d0, 0x055b2, 0x049b0, 0x0a577, 0x0a4b0, 0x0aa50, 0x1b255, 0x06d20, 0x0ada0
|
0x0b5a0, 0x056d0, 0x055b2, 0x049b0, 0x0a577, 0x0a4b0, 0x0aa50, 0x1b255, 0x06d20, 0x0ada0
|
||||||
];
|
];
|
||||||
var Animals = ["鼠", "牛", "虎", "兔", "龙", "蛇", "马", "羊", "猴", "鸡", "狗", "猪"];
|
let Animals = ["鼠", "牛", "虎", "兔", "龙", "蛇", "马", "羊", "猴", "鸡", "狗", "猪"];
|
||||||
var Gan = ["甲", "乙", "丙", "丁", "戊", "己", "庚", "辛", "壬", "癸"];
|
let Gan = ["甲", "乙", "丙", "丁", "戊", "己", "庚", "辛", "壬", "癸"];
|
||||||
var Zhi = ["子", "丑", "寅", "卯", "辰", "巳", "午", "未", "申", "酉", "戌", "亥"];
|
let Zhi = ["子", "丑", "寅", "卯", "辰", "巳", "午", "未", "申", "酉", "戌", "亥"];
|
||||||
|
|
||||||
//==== 传回农历 y年的总天数
|
//==== 传回农历 y年的总天数
|
||||||
function lYearDays(y) {
|
function lYearDays(y) {
|
||||||
var i, sum = 348
|
let i, sum = 348
|
||||||
for (i = 0x8000; i > 0x8; i >>= 1) sum += (lunarInfo[y - 1900] & i) ? 1 : 0
|
for (i = 0x8000; i > 0x8; i >>= 1) sum += (lunarInfo[y - 1900] & i) ? 1 : 0
|
||||||
return (sum + leapDays(y))
|
return (sum + leapDays(y))
|
||||||
}
|
}
|
||||||
|
|
@ -615,10 +615,10 @@ window.Win10 = {
|
||||||
//==== 算出农历, 传入日期物件, 传回农历日期物件
|
//==== 算出农历, 传入日期物件, 传回农历日期物件
|
||||||
// 该物件属性有 .year .month .day .isLeap .yearCyl .dayCyl .monCyl
|
// 该物件属性有 .year .month .day .isLeap .yearCyl .dayCyl .monCyl
|
||||||
function lunar(objDate) {
|
function lunar(objDate) {
|
||||||
var i, leap = 0,
|
let i, leap = 0,
|
||||||
temp = 0
|
temp = 0
|
||||||
var baseDate = new Date(1900, 0, 31)
|
let baseDate = new Date(1900, 0, 31)
|
||||||
var offset = (objDate - baseDate) / 86400000
|
let offset = (objDate - baseDate) / 86400000
|
||||||
|
|
||||||
this.dayCyl = offset + 40
|
this.dayCyl = offset + 40
|
||||||
this.monCyl = 14
|
this.monCyl = 14
|
||||||
|
|
@ -678,13 +678,13 @@ window.Win10 = {
|
||||||
|
|
||||||
//获取农历(月)中文格式
|
//获取农历(月)中文格式
|
||||||
function get_lunarmonth(month) {
|
function get_lunarmonth(month) {
|
||||||
var fm = ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "腊月"];
|
let fm = ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "腊月"];
|
||||||
return fm[month - 1];
|
return fm[month - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取农历(日)中文格式
|
//获取农历(日)中文格式
|
||||||
function get_lunarday(day) {
|
function get_lunarday(day) {
|
||||||
var fd = ["十", "一", "二", "三", "四", "五", "六", "七", "八", "九", "十"];
|
let fd = ["十", "一", "二", "三", "四", "五", "六", "七", "八", "九", "十"];
|
||||||
if (day <= 10) {
|
if (day <= 10) {
|
||||||
return "初" + fd[day];
|
return "初" + fd[day];
|
||||||
} else if (day < 20) {
|
} else if (day < 20) {
|
||||||
|
|
@ -700,7 +700,7 @@ window.Win10 = {
|
||||||
|
|
||||||
//获取干支
|
//获取干支
|
||||||
function get_ganzhi(year) {
|
function get_ganzhi(year) {
|
||||||
var num = year - 1900 + 36;
|
let num = year - 1900 + 36;
|
||||||
return (Gan[num % 10] + Zhi[num % 12]);
|
return (Gan[num % 10] + Zhi[num % 12]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -711,19 +711,19 @@ window.Win10 = {
|
||||||
|
|
||||||
//获取周
|
//获取周
|
||||||
function get_weekday(date) {
|
function get_weekday(date) {
|
||||||
var values = ["周日", "周一", "周二", "周三", "周四", "周五", "周六"];
|
let values = ["周日", "周一", "周二", "周三", "周四", "周五", "周六"];
|
||||||
return values[date.getDay()];
|
return values[date.getDay()];
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取星期
|
//获取星期
|
||||||
function get_week(date) {
|
function get_week(date) {
|
||||||
var values = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"];
|
let values = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"];
|
||||||
return values[date.getDay()];
|
return values[date.getDay()];
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取分钟
|
//获取分钟
|
||||||
function get_min(date) {
|
function get_min(date) {
|
||||||
var mins = date.getMinutes();
|
let mins = date.getMinutes();
|
||||||
if (mins < 10) {
|
if (mins < 10) {
|
||||||
mins = '0' + mins
|
mins = '0' + mins
|
||||||
}
|
}
|
||||||
|
|
@ -732,7 +732,7 @@ window.Win10 = {
|
||||||
|
|
||||||
//获取小时
|
//获取小时
|
||||||
function get_hour(date) {
|
function get_hour(date) {
|
||||||
var hour = date.getHours();
|
let hour = date.getHours();
|
||||||
if (hour < 6) {
|
if (hour < 6) {
|
||||||
hours = '凌晨' + hour;
|
hours = '凌晨' + hour;
|
||||||
} else if (hour < 9) {
|
} else if (hour < 9) {
|
||||||
|
|
@ -753,8 +753,8 @@ window.Win10 = {
|
||||||
return hours;
|
return hours;
|
||||||
}
|
}
|
||||||
|
|
||||||
var viewdate = {};
|
let viewdate = {};
|
||||||
var date = new Date();
|
let date = new Date();
|
||||||
//秒
|
//秒
|
||||||
viewdate.second = date.getSeconds();
|
viewdate.second = date.getSeconds();
|
||||||
|
|
||||||
|
|
@ -775,11 +775,11 @@ window.Win10 = {
|
||||||
//年份(2位)
|
//年份(2位)
|
||||||
viewdate.year = date.getYear();
|
viewdate.year = date.getYear();
|
||||||
//农历信息
|
//农历信息
|
||||||
var lunar_obj = new lunar(date);
|
let lunar_obj = new lunar(date);
|
||||||
//农历中文月
|
//农历中文月
|
||||||
viewdate.lunarmonth = get_lunarmonth(lunar_obj.month);
|
viewdate.lunarmonth = get_lunarmonth(lunar_obj.month);
|
||||||
//农历中文日
|
//农历中文日
|
||||||
var lunar_day = Math.floor(lunar_obj.day);
|
let lunar_day = Math.floor(lunar_obj.day);
|
||||||
viewdate.lunarday = get_lunarday(lunar_day);
|
viewdate.lunarday = get_lunarday(lunar_day);
|
||||||
//农历年月日
|
//农历年月日
|
||||||
viewdate.lunar = lunar_obj.year + "-" + lunar_obj.month + "-" + lunar_day;
|
viewdate.lunar = lunar_obj.year + "-" + lunar_obj.month + "-" + lunar_day;
|
||||||
|
|
@ -792,11 +792,11 @@ window.Win10 = {
|
||||||
},
|
},
|
||||||
//消息中心渲染
|
//消息中心渲染
|
||||||
renderCommand: function(today = null) {
|
renderCommand: function(today = null) {
|
||||||
var active = $("#win10_command_center .command-body.today").hasClass('active');
|
let active = $("#win10_command_center .command-body.today").hasClass('active');
|
||||||
if (!active) {
|
if (!active) {
|
||||||
if (!today) {
|
if (!today) {
|
||||||
var lunarDate = Win10.getLunarObj();
|
let lunarDate = Win10.getLunarObj();
|
||||||
var today = '<div class="command-body-calendar">' +
|
let today = '<div class="command-body-calendar">' +
|
||||||
'<div class="command-body-calendar-date normal-date">' + lunarDate.month + '月' + lunarDate.day + '日 ' +
|
'<div class="command-body-calendar-date normal-date">' + lunarDate.month + '月' + lunarDate.day + '日 ' +
|
||||||
lunarDate.week + '</div>' +
|
lunarDate.week + '</div>' +
|
||||||
'<div class="command-body-calendar-date lunar-date">' + lunarDate.ganzhi + '年' + lunarDate.lunarmonth +
|
'<div class="command-body-calendar-date lunar-date">' + lunarDate.ganzhi + '年' + lunarDate.lunarmonth +
|
||||||
|
|
@ -841,15 +841,15 @@ window.Win10 = {
|
||||||
renderShortcuts: function() {
|
renderShortcuts: function() {
|
||||||
if (!this.isSmallScreen()) {
|
if (!this.isSmallScreen()) {
|
||||||
//大屏执行pc的布局也就是竖排靠右对齐,小屏幕执行移动端也就是横向排列
|
//大屏执行pc的布局也就是竖排靠右对齐,小屏幕执行移动端也就是横向排列
|
||||||
var h = parseInt(($("#win10 #win10-shortcuts")[0].offsetHeight - 90) / 100);
|
let h = parseInt(($("#win10 #win10-shortcuts")[0].offsetHeight - 90) / 100);
|
||||||
var w = 0;
|
let w = 0;
|
||||||
//计算一列最大几个图标,公式是(桌面图标界面的大小 - 顶部状态栏和底部dock栏的尺寸)/单个图标高度所占的尺寸
|
//计算一列最大几个图标,公式是(桌面图标界面的大小 - 顶部状态栏和底部dock栏的尺寸)/单个图标高度所占的尺寸
|
||||||
var x = 0,
|
let x = 0,
|
||||||
y = 0;
|
y = 0;
|
||||||
$("#win10 #win10-shortcuts .shortcut").each(function() {
|
$("#win10 #win10-shortcuts .shortcut").each(function() {
|
||||||
$(this).css({
|
$(this).css({
|
||||||
left: x * 82 + 10,
|
right: x * 82 + 10,
|
||||||
// left:0,
|
left: 'auto',
|
||||||
top: y * 100 + 10,
|
top: y * 100 + 10,
|
||||||
});
|
});
|
||||||
y++;
|
y++;
|
||||||
|
|
@ -860,8 +860,8 @@ window.Win10 = {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
//小屏幕执行横屏
|
//小屏幕执行横屏
|
||||||
var w = parseInt(($("#win10 #win10-shortcuts")[0].offsetWidth - 10) / 82);
|
let w = parseInt(($("#win10 #win10-shortcuts")[0].offsetWidth - 10) / 82);
|
||||||
var x = 0,
|
let x = 0,
|
||||||
y = 0;
|
y = 0;
|
||||||
$("#win10 #win10-shortcuts .shortcut").each(function() {
|
$("#win10 #win10-shortcuts .shortcut").each(function() {
|
||||||
$(this).css({
|
$(this).css({
|
||||||
|
|
@ -879,11 +879,11 @@ window.Win10 = {
|
||||||
},
|
},
|
||||||
//渲染DOCK
|
//渲染DOCK
|
||||||
renderDocks: function() {
|
renderDocks: function() {
|
||||||
var cell_width = 60;
|
let cell_width = 60;
|
||||||
var width = document.body.clientWidth;
|
let width = document.body.clientWidth;
|
||||||
var docks = $("#footer .dock li");
|
let docks = $("#footer .dock li");
|
||||||
var max_num = parseInt(width / cell_width) - 1;
|
let max_num = parseInt(width / cell_width) - 1;
|
||||||
for (var i = 0; i < docks.length; i++) {
|
for (let i = 0; i < docks.length; i++) {
|
||||||
if (i > max_num) {
|
if (i > max_num) {
|
||||||
docks.eq(i).css('display', 'none');
|
docks.eq(i).css('display', 'none');
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -914,7 +914,7 @@ window.Win10 = {
|
||||||
},
|
},
|
||||||
newMsg: function(title, content, handle_click, app_name = '提示消息', app_icon =
|
newMsg: function(title, content, handle_click, app_name = '提示消息', app_icon =
|
||||||
'<img src="./img/icon/weather.png" class="notice-header-icon-img" />', is_del = true) {
|
'<img src="./img/icon/weather.png" class="notice-header-icon-img" />', is_del = true) {
|
||||||
var msg = '<div class="notice">' +
|
let msg = '<div class="notice">' +
|
||||||
'<div class="notice-header">' +
|
'<div class="notice-header">' +
|
||||||
'<span class="notice-header-icon">' + app_icon + '</span>' +
|
'<span class="notice-header-icon">' + app_icon + '</span>' +
|
||||||
'<span class="notice-header-title">' + app_name + '</span>';
|
'<span class="notice-header-title">' + app_name + '</span>';
|
||||||
|
|
@ -927,7 +927,7 @@ window.Win10 = {
|
||||||
'<div class="title">' + title + '</div>' +
|
'<div class="title">' + title + '</div>' +
|
||||||
'<div class="content">' + content + '</div>' +
|
'<div class="content">' + content + '</div>' +
|
||||||
'</div></div></div>';
|
'</div></div></div>';
|
||||||
var e = $(msg);
|
let e = $(msg);
|
||||||
$("#win10_command_center .msgs").prepend(e);
|
$("#win10_command_center .msgs").prepend(e);
|
||||||
e.find('.content:first,.title:first').click(function() {
|
e.find('.content:first,.title:first').click(function() {
|
||||||
if (handle_click) {
|
if (handle_click) {
|
||||||
|
|
@ -949,11 +949,11 @@ window.Win10 = {
|
||||||
if (!size) {
|
if (!size) {
|
||||||
size = 768
|
size = 768
|
||||||
}
|
}
|
||||||
var width = document.body.clientWidth;
|
let width = document.body.clientWidth;
|
||||||
return width < size;
|
return width < size;
|
||||||
},
|
},
|
||||||
enableFullScreen: function() {
|
enableFullScreen: function() {
|
||||||
var docElm = document.documentElement;
|
let docElm = document.documentElement;
|
||||||
//W3C
|
//W3C
|
||||||
if (docElm.requestFullscreen) {
|
if (docElm.requestFullscreen) {
|
||||||
docElm.requestFullscreen();
|
docElm.requestFullscreen();
|
||||||
|
|
@ -994,7 +994,7 @@ window.Win10 = {
|
||||||
openUrl: function(url, icon, title, areaAndOffset) {
|
openUrl: function(url, icon, title, areaAndOffset) {
|
||||||
//只打开一个应用
|
//只打开一个应用
|
||||||
/*
|
/*
|
||||||
var ifr=document.getElementsByTagName("iframe");
|
let ifr=document.getElementsByTagName("iframe");
|
||||||
for(i=0;i<ifr.length;i++){
|
for(i=0;i<ifr.length;i++){
|
||||||
if(url==ifr[i].src){
|
if(url==ifr[i].src){
|
||||||
Win10.show_win(url);
|
Win10.show_win(url);
|
||||||
|
|
@ -1013,7 +1013,7 @@ window.Win10 = {
|
||||||
url = '404'
|
url = '404'
|
||||||
}
|
}
|
||||||
url = url.replace(/(^\s*)|(\s*$)/g, "");
|
url = url.replace(/(^\s*)|(\s*$)/g, "");
|
||||||
var preg = /^(https?:\/\/|\.\.?\/|\/\/?)/;
|
let preg = /^(https?:\/\/|\.\.?\/|\/\/?)/;
|
||||||
if (!preg.test(url)) {
|
if (!preg.test(url)) {
|
||||||
url = 'http://' + url;
|
url = 'http://' + url;
|
||||||
}
|
}
|
||||||
|
|
@ -1023,7 +1023,7 @@ window.Win10 = {
|
||||||
if (!title) {
|
if (!title) {
|
||||||
title = url;
|
title = url;
|
||||||
}
|
}
|
||||||
var area, offset;
|
let area, offset;
|
||||||
if (this.isSmallScreen() || areaAndOffset === 'max') {
|
if (this.isSmallScreen() || areaAndOffset === 'max') {
|
||||||
area = ['100%', (document.body.clientHeight - 24) + 'px'];
|
area = ['100%', (document.body.clientHeight - 24) + 'px'];
|
||||||
offset = ['24px', '0'];
|
offset = ['24px', '0'];
|
||||||
|
|
@ -1032,7 +1032,7 @@ window.Win10 = {
|
||||||
offset = areaAndOffset[1];
|
offset = areaAndOffset[1];
|
||||||
} else {
|
} else {
|
||||||
area = ['80%', '80%'];
|
area = ['80%', '80%'];
|
||||||
var topset, leftset;
|
let topset, leftset;
|
||||||
topset = parseInt($(window).height());
|
topset = parseInt($(window).height());
|
||||||
topset = (topset - (topset * 0.8)) / 2 - 31;
|
topset = (topset - (topset * 0.8)) / 2 - 31;
|
||||||
leftset = parseInt($(window).width());
|
leftset = parseInt($(window).width());
|
||||||
|
|
@ -1040,7 +1040,7 @@ window.Win10 = {
|
||||||
offset = [Math.round((this._countTask % 10 * 20) + topset) + 'px', Math.round((this._countTask % 10 * 20 + 100) +
|
offset = [Math.round((this._countTask % 10 * 20) + topset) + 'px', Math.round((this._countTask % 10 * 20 + 100) +
|
||||||
leftset) + 'px'];
|
leftset) + 'px'];
|
||||||
}
|
}
|
||||||
var index = layer.open({
|
let index = layer.open({
|
||||||
type: 2,
|
type: 2,
|
||||||
shadeClose: true,
|
shadeClose: true,
|
||||||
shade: false,
|
shade: false,
|
||||||
|
|
@ -1068,9 +1068,9 @@ window.Win10 = {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
$('#win10_btn_group_middle .btn.active').removeClass('active');
|
$('#win10_btn_group_middle .btn.active').removeClass('active');
|
||||||
var btn = $('<div id="win10_' + index + '" index="' + index + '" class="btn show active"><div class="btn_title">' +
|
let btn = $('<div id="win10_' + index + '" index="' + index + '" class="btn show active"><div class="btn_title">' +
|
||||||
icon + '</div></div>');
|
icon + '</div></div>');
|
||||||
var layero_opened = Win10.getLayeroByIndex(index);
|
let layero_opened = Win10.getLayeroByIndex(index);
|
||||||
layero_opened.css('z-index', Win10._countTask + 813);
|
layero_opened.css('z-index', Win10._countTask + 813);
|
||||||
Win10._settop(layero_opened);
|
Win10._settop(layero_opened);
|
||||||
//重新定义菜单布局
|
//重新定义菜单布局
|
||||||
|
|
@ -1082,7 +1082,7 @@ window.Win10 = {
|
||||||
})
|
})
|
||||||
layero_opened.find('.layui-layer-setwin .layui-layer-max').click(function() {
|
layero_opened.find('.layui-layer-setwin .layui-layer-max').click(function() {
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
var height = layero_opened.css('height');
|
let height = layero_opened.css('height');
|
||||||
height = parseInt(height.replace('px', ''));
|
height = parseInt(height.replace('px', ''));
|
||||||
if (height >= document.body.clientHeight) {
|
if (height >= document.body.clientHeight) {
|
||||||
layero_opened.css('height', height - 25);
|
layero_opened.css('height', height - 25);
|
||||||
|
|
@ -1094,11 +1094,11 @@ window.Win10 = {
|
||||||
});
|
});
|
||||||
$("#win10_btn_group_middle").append(btn);
|
$("#win10_btn_group_middle").append(btn);
|
||||||
btn.click(function() {
|
btn.click(function() {
|
||||||
var index = $(this).attr('index');
|
let index = $(this).attr('index');
|
||||||
var layero = Win10.getLayeroByIndex(index);
|
let layero = Win10.getLayeroByIndex(index);
|
||||||
var settop = function() {
|
let settop = function() {
|
||||||
//置顶窗口
|
//置顶窗口
|
||||||
var max_zindex = 0;
|
let max_zindex = 0;
|
||||||
$(".win10-open-iframe").each(function() {
|
$(".win10-open-iframe").each(function() {
|
||||||
z = parseInt($(this).css('z-index'));
|
z = parseInt($(this).css('z-index'));
|
||||||
$(this).css('z-index', z - 1);
|
$(this).css('z-index', z - 1);
|
||||||
|
|
@ -1207,8 +1207,8 @@ window.Win10 = {
|
||||||
},
|
},
|
||||||
hideWins: function() {
|
hideWins: function() {
|
||||||
$('#win10_btn_group_middle>.btn.show').each(function() {
|
$('#win10_btn_group_middle>.btn.show').each(function() {
|
||||||
var index = $(this).attr('index');
|
let index = $(this).attr('index');
|
||||||
var layero = Win10.getLayeroByIndex(index);
|
let layero = Win10.getLayeroByIndex(index);
|
||||||
$(this).removeClass('show');
|
$(this).removeClass('show');
|
||||||
$(this).removeClass('active');
|
$(this).removeClass('active');
|
||||||
layero.hide();
|
layero.hide();
|
||||||
|
|
@ -1216,8 +1216,8 @@ window.Win10 = {
|
||||||
},
|
},
|
||||||
showWins: function() {
|
showWins: function() {
|
||||||
$('#win10_btn_group_middle>.btn').each(function() {
|
$('#win10_btn_group_middle>.btn').each(function() {
|
||||||
var index = $(this).attr('index');
|
let index = $(this).attr('index');
|
||||||
var layero = Win10.getLayeroByIndex(index);
|
let layero = Win10.getLayeroByIndex(index);
|
||||||
$(this).addClass('show');
|
$(this).addClass('show');
|
||||||
layero.show();
|
layero.show();
|
||||||
});
|
});
|
||||||
|
|
@ -1234,8 +1234,8 @@ window.Win10 = {
|
||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
Win10._init();
|
Win10._init();
|
||||||
for (var i in Win10._handleReady) {
|
for (let i in Win10._handleReady) {
|
||||||
var handle = Win10._handleReady[i];
|
let handle = Win10._handleReady[i];
|
||||||
handle();
|
handle();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue