diff --git a/css/index.css b/css/index.css index 510fa27..a0abda0 100644 --- a/css/index.css +++ b/css/index.css @@ -1,5 +1,5 @@ @charset "utf-8"; -body,a,h1,h2,h3,h4,h5,h6,p,div,em,ul,li { +body, a, h1, h2, h3, h4, h5, h6, p, div, em, ul, li { font-family: PingFang SC, Verdana, Helvetica Neue, Microsoft Yahei, Hiragino Sans GB, Microsoft Sans Serif, WenQuanYi Micro Hei, sans-serif; } @@ -8,11 +8,12 @@ html { } /*去除ul中li左边的圆点*/ -ul{ +ul { list-style: none; - padding: 0; + padding: 0; margin: 0; } + body { padding: 0; margin: 0; @@ -40,22 +41,22 @@ body { background-color: rgba(50, 50, 50, .3); } -#mac *{ - -webkit-user-select:none; - -moz-user-select:none; - -ms-user-select:none; - user-select:none; +#mac * { + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; } -#mac-login{ +#mac-login { background: black no-repeat fixed; width: 100%; height: 100%; background-size: 100% 100%; position: fixed; z-index: -1; - top:0; - left:0; + top: 0; + left: 0; } #mac { @@ -100,18 +101,24 @@ body { background-position: center center; } -#mac *{ - scrollbar-arrow-color: #5e6a5c; /*图6,三角箭头的颜色*/ - scrollbar-face-color: #5e6a5c; /*图5,立体滚动条的颜色*/ - scrollbar-3dlight-color: #5e6a5c; /*图1,立体滚动条亮边的颜色*/ - scrollbar-highlight-color: #5e6a5c; /*图2,滚动条空白部分的颜色*/ - scrollbar-shadow-color: #5e6a5c; /*图3,立体滚动条阴影的颜色*/ +#mac * { + scrollbar-arrow-color: #5e6a5c; /*图6,三角箭头的颜色*/ + scrollbar-face-color: #5e6a5c; /*图5,立体滚动条的颜色*/ + scrollbar-3dlight-color: #5e6a5c; /*图1,立体滚动条亮边的颜色*/ + scrollbar-highlight-color: #5e6a5c; /*图2,滚动条空白部分的颜色*/ + scrollbar-shadow-color: #5e6a5c; /*图3,立体滚动条阴影的颜色*/ scrollbar-darkshadow-color: #5e6a5c; /*图4,立体滚动条强阴影的颜色*/ - scrollbar-track-color: rgba(74, 84, 78, 0.41); /*图7,立体滚动条背景颜色*/ - scrollbar-base-color:#5e6a5c; /*滚动条的基本颜色*/ + scrollbar-track-color: rgba(74, 84, 78, 0.41); /*图7,立体滚动条背景颜色*/ + scrollbar-base-color: #5e6a5c; /*滚动条的基本颜色*/ } -#mac hr { height:0; border-top:1px solid #999; border-right:0; border-bottom:0; border-left:0; } +#mac hr { + height: 0; + border-top: 1px solid #999; + border-right: 0; + border-bottom: 0; + border-left: 0; +} #mac .desktop { width: 100%; @@ -125,8 +132,8 @@ body { position: fixed; top: 0; height: 24px; - line-height:24px; - background-color: rgba(255,255,255,0.5); + line-height: 24px; + background-color: rgba(255, 255, 255, 0.5); -webkit-box-shadow: 0 0.3125rem 0.07rem -0.3125rem rgba(0, 0, 0, 0.42); -moz-box-shadow: 0 0.3125rem 0.07rem -0.3125rem rgba(0, 0, 0, 0.42); box-shadow: 0 0.3125rem 0.07rem -0.3125rem rgba(0, 0, 0, 0.42); @@ -139,36 +146,36 @@ body { #mac .btn_group .btn { float: left; - color:#333; - font-weight:bold; + color: #333; + font-weight: bold; text-align: center; height: 100%; line-height: 24px; - text-overflow:ellipsis; + text-overflow: ellipsis; overflow: hidden; transition: background-color 0.3s; } #mac .btn_group .btn:hover { color: white; - background-color: rgba(49,156,241,0.71); + background-color: rgba(49, 156, 241, 0.71); cursor: pointer; } -#mac_btn_group_left{ +#mac_btn_group_left { float: left; overflow: auto; - max-width:200px; - padding-left:0.5%; + max-width: 200px; + padding-left: 0.5%; } -#mac_btn_group_middle{ +#mac_btn_group_middle { overflow: auto; display: inline-block; } -#mac_btn_group_middle .btn_title{ +#mac_btn_group_middle .btn_title { /* width: 100%; */ display: inline-block; padding: 0 4px; @@ -191,13 +198,13 @@ body { background-color: rgba(30, 39, 34, 0.41); } -#mac_btn_group_right{ +#mac_btn_group_right { float: right; - max-width:200px; + max-width: 200px; overflow: auto; } -#mac_btn_group_left .btn,#mac_btn_group_middle .btn{ +#mac_btn_group_left .btn, #mac_btn_group_middle .btn { height: 100%; width: 35px; overflow: hidden; @@ -208,7 +215,7 @@ body { height: 100%; min-width: 4px; padding: 0 10px; - font-size: 12px ; + font-size: 12px; } #mac_btn_show_desktop { @@ -222,14 +229,15 @@ body { font-size: 14px; /*line-height: 30px !important */ } + #mac-menu { position: fixed; top: 24px; left: 0.5rem; - background-color: rgba(255,255,255,0.55); + background-color: rgba(255, 255, 255, 0.55); box-shadow: 1px 1px 5px #909090; - -moz-box-shadow: 1px 1px 5px #909090;/*firefox*/ - -webkit-box-shadow: 1px 1px 5px #909090;/*safari或chrome*/ + -moz-box-shadow: 1px 1px 5px #909090; /*firefox*/ + -webkit-box-shadow: 1px 1px 5px #909090; /*safari或chrome*/ height: auto; width: 12rem; max-width: 880px; @@ -237,58 +245,58 @@ body { z-index: 1000; overflow-y: hidden; transition: bottom 0.5s; - border-radius:0 0 3px 3px; + border-radius: 0 0 3px 3px; } #mac-menu.hidden { - top:-70%; + top: -70%; } -#mac-menu .list::-webkit-scrollbar,#mac_command_center::-webkit-scrollbar { +#mac-menu .list::-webkit-scrollbar, #mac_command_center::-webkit-scrollbar { width: 0; height: 0; } -#mac-menu .list::-webkit-scrollbar-track,#mac_command_center::-webkit-scrollbar-track { +#mac-menu .list::-webkit-scrollbar-track, #mac_command_center::-webkit-scrollbar-track { background-color: rgba(74, 84, 78, 0.41); } -#mac-menu .list::-webkit-scrollbar-thumb,#mac_command_center::-webkit-scrollbar-thumb { +#mac-menu .list::-webkit-scrollbar-thumb, #mac_command_center::-webkit-scrollbar-thumb { background-color: #6a6a6a; } -#mac-menu .list{ +#mac-menu .list { float: left; width: 180px; - height:100%; + height: 100%; overflow: auto; -webkit-animation-duration: 0.5s; animation-duration: 0.5s; } -#mac-menu .list{ - width:100%; +#mac-menu .list { + width: 100%; padding: 5px 0 0; font-size: 12px; height: 100%; } -#mac-menu .list .item.has-sub-down::after{ +#mac-menu .list .item.has-sub-down::after { font: normal normal normal 14px/1 FontAwesome; - content:"\f107"; + content: "\f107"; line-height: inherit; float: right; } -#mac-menu .list .item.has-sub-up::after{ +#mac-menu .list .item.has-sub-up::after { font: normal normal normal 14px/1 FontAwesome; - content:"\f106"; + content: "\f106"; line-height: inherit; float: right; } -#mac-menu .list .item,.sub-item{ - color:#333; +#mac-menu .list .item, .sub-item { + color: #333; margin: 1px 0; line-height: 2em; padding: 0 10px; @@ -299,8 +307,8 @@ body { width: calc(100% - 20px); } -#mac-menu .list .item>.icon,#mac-menu .list .sub-item>.icon,.sub-item>.icon{ - line-height:2em; +#mac-menu .list .item > .icon, #mac-menu .list .sub-item > .icon, .sub-item > .icon { + line-height: 2em; font-size: 1.2em; float: left; margin-right: 0.5em; @@ -310,18 +318,18 @@ body { } -#mac-menu .list .sub-item{ - padding-left:30px; +#mac-menu .list .sub-item { + padding-left: 30px; width: calc(100% - 40px); } -#mac-menu .list .item:hover,.sub-item:hover{ - background-color: rgba(49,156,241,0.71); +#mac-menu .list .item:hover, .sub-item:hover { + background-color: rgba(49, 156, 241, 0.71); cursor: pointer; } -#mac-menu-switcher{ +#mac-menu-switcher { position: absolute; height: 100%; border-left: 1px solid grey; @@ -332,7 +340,7 @@ body { cursor: pointer; } -#mac-menu-switcher:active{ +#mac-menu-switcher:active { background-color: rgba(92, 109, 92, 0.81); } @@ -350,16 +358,16 @@ body { font-size: 13px; } -#mac-menu .menu_group:hover .title::after{ +#mac-menu .menu_group:hover .title::after { font: normal normal normal 14px/1 FontAwesome; - content:"\f0c9"; + content: "\f0c9"; line-height: inherit; float: right; margin-right: 17px; color: grey; } -#mac-shortcuts { +#mac-shortcuts { height: 100%; width: 100%; position: absolute; @@ -368,9 +376,11 @@ body { z-index: 100; } -#mac-shortcuts .shortcuts-hidden .shortcut{display: none} +#mac-shortcuts .shortcuts-hidden .shortcut { + display: none +} -#mac-shortcuts .shortcut { +#mac-shortcuts .shortcut { width: 80px; overflow: hidden; cursor: pointer; @@ -379,11 +389,11 @@ body { transition: all 0.5s; } -#mac-shortcuts .shortcut:hover { +#mac-shortcuts .shortcut:hover { background-color: rgba(255, 255, 255, 0.11); } -#mac-shortcuts .shortcut>.icon { +#mac .shortcut > .icon { width: 50px; height: 50px; overflow: hidden; @@ -399,7 +409,7 @@ body { line-height: 50px; } -#mac-shortcuts .shortcut .title { +#mac .shortcut .title { color: white; font-size: 12px; text-align: center; @@ -414,8 +424,8 @@ body { width: 300px; background-color: rgba(255, 255, 255, 0.6); /* -webkit-box-shadow: 0 0.3125rem 0.3125rem -0.3125rem rgba(0,0,0,0.117); */ - -moz-box-shadow: 0 0.3125rem 0.3125rem -0.3125rem rgba(0,0,0,0.117); - box-shadow: 0 0.3125rem 0.3125rem -0.3125rem rgba(0,0,0,0.117); + -moz-box-shadow: 0 0.3125rem 0.3125rem -0.3125rem rgba(0, 0, 0, 0.117); + box-shadow: 0 0.3125rem 0.3125rem -0.3125rem rgba(0, 0, 0, 0.117); height: calc(100% - 25px); overflow-x: hidden; overflow-y: auto; @@ -428,7 +438,7 @@ body { right: -300px; } -#mac_command_center > .title{ +#mac_command_center > .title { position: absolute; top: 0; left: 0; @@ -437,18 +447,18 @@ body { transition: background-color 0.5s; } -#mac_command_center > .title:hover{ +#mac_command_center > .title:hover { background-color: rgba(255, 255, 255, 0.19); } -#mac_command_center .command-header{ +#mac_command_center .command-header { height: 50px; text-align: center; border-bottom: 1px outset; } -#mac_command_center .command-header .item{ +#mac_command_center .command-header .item { width: 45%; height: 20px; margin: 15px 0; @@ -458,7 +468,7 @@ body { background-color: rgba(121, 121, 121, 0.5); } -#mac_command_center .command-header div{ +#mac_command_center .command-header div { width: 45%; height: 20px; margin: 15px 0; @@ -466,7 +476,7 @@ body { font-size: 14px; color: #eaeaea; background-color: rgba(121, 121, 121, 0.5); - border-radius:2px; + border-radius: 2px; } #mac_command_center .command-header div:hover { @@ -502,49 +512,49 @@ body { margin: 5px 0; } -#mac_command_center .command-body .notice .notice-header { - background-color:rgba(255,255,255,0.8); +#mac_command_center .command-body .notice .notice-header { + background-color: rgba(255, 255, 255, 0.8); height: 25px; border-radius: 5px 5px 0 0; line-height: 25px; } -#mac_command_center .command-body .notice-header-icon { +#mac_command_center .command-body .notice-header-icon { margin: 2px 5px; vertical-align: middle; } -#mac_command_center .command-body .notice-header-icon> img { +#mac_command_center .command-body .notice-header-icon > img { width: 15px; height: 15px; } -#mac_command_center .command-body .notice-header-title { +#mac_command_center .command-body .notice-header-title { font-size: 10px; margin: 0 5px; vertical-align: middle; } -#mac_command_center .command-body .notice .notice-body { - background-color: rgba(255,255,255,0.6); +#mac_command_center .command-body .notice .notice-body { + background-color: rgba(255, 255, 255, 0.6); border-radius: 0 0 5px 5px; } -#mac_command_center .command-body .notice .weather-item { +#mac_command_center .command-body .notice .weather-item { height: 50px; } -#mac_command_center .command-body .notice .weather-item div { +#mac_command_center .command-body .notice .weather-item div { display: inline-block; text-align: center; } -#mac_command_center .command-body .notice .weather-city { +#mac_command_center .command-body .notice .weather-city { float: left; } -#mac_command_center .command-body .notice .weather-city .weather-city-time { +#mac_command_center .command-body .notice .weather-city .weather-city-time { display: block; font-size: 10px; font-weight: 400; @@ -553,7 +563,7 @@ body { color: #868585; } -#mac_command_center .command-body .notice .weather-city .weather-city-text { +#mac_command_center .command-body .notice .weather-city .weather-city-text { font-size: 15px; font-weight: 400; display: block; @@ -561,37 +571,38 @@ body { margin: 0 0 5px 10px; } -#mac_command_center .command-body .notice .weather-type { +#mac_command_center .command-body .notice .weather-type { position: absolute; right: 70px; } -#mac_command_center .command-body .notice .weather-type img { +#mac_command_center .command-body .notice .weather-type img { width: 30px; margin: 5px; } -#mac_command_center .command-body .notice .weather-temperature { +#mac_command_center .command-body .notice .weather-temperature { float: right; font-size: 35px; font-weight: 200; margin-right: 10px; } -#mac_command_center .command-body .notice .notice-header, .notice .notice-body { +#mac_command_center .command-body .notice .notice-header, .notice .notice-body { width: 95%; margin: 0 auto; } -#mac_command_center .command-body .notice .notice-header .notice-header-icon img{ +#mac_command_center .command-body .notice .notice-header .notice-header-icon img { width: 15px; height: 15px; } -#mac_btn_group_right #mac_btn_command{ +#mac_btn_group_right #mac_btn_command { font-size: 14px; } -#mac_btn_command .msgNof{ + +#mac_btn_command .msgNof { position: fixed; right: 0; bottom: 20px; @@ -600,24 +611,25 @@ body { color: white; border-radius: 3px; } -#mac_btn_command_center_clean_all{ - color:#777; + +#mac_btn_command_center_clean_all { + color: #777; text-align: right; - font-size:12px; + font-size: 12px; float: right; - margin-top:40px; - margin-right:24px; + margin-top: 40px; + margin-right: 24px; transition: color 0.5s; } -#mac_btn_command_center_clean_all:hover{ +#mac_btn_command_center_clean_all:hover { cursor: pointer; - color:#333; + color: #333; } -#mac_command_center .msgs{ +#mac_command_center .msgs { position: absolute; - top:60px; + top: 60px; left: 0; width: 100%; overflow: hidden; @@ -625,38 +637,38 @@ body { /*padding: 10px;*/ } -#mac_command_center .btn_close_msg{ +#mac_command_center .btn_close_msg { line-height: inherit; - transition: color 0.5s ; + transition: color 0.5s; } -#mac_command_center .msgs .msg{ +#mac_command_center .msgs .msg { width: calc(100% - 20px); min-height: 40px; - padding:10px; + padding: 10px; transition: background-color 0.5s; position: relative; } -#mac_command_center .msgs .msg.animated{ +#mac_command_center .msgs .msg.animated { -webkit-animation-duration: 0.5s; animation-duration: 0.5s; } -#mac_command_center .command-body .notice:hover .notice-body{ +#mac_command_center .command-body .notice:hover .notice-body { color: #333; } -#mac_command_center .command-body .notice:hover>.notice-header .btn_close_msg{ +#mac_command_center .command-body .notice:hover > .notice-header .btn_close_msg { color: grey; } -#mac_command_center .msgs .msg>.title{ +#mac_command_center .msgs .msg > .title { font-size: 14px; line-height: 28px; } -#mac_command_center .command-body .notice .notice-header>.btn_close_msg{ +#mac_command_center .command-body .notice .notice-header > .btn_close_msg { cursor: pointer; color: transparent; margin-right: 8px; @@ -665,25 +677,25 @@ body { float: right; } -#mac_command_center .msgs .msg>.btn_close_msg:hover{ +#mac_command_center .msgs .msg > .btn_close_msg:hover { color: white; } -#mac_command_center .msgs .msg>.content{ +#mac_command_center .msgs .msg > .content { font-size: 12px; padding-bottom: 5px; } -#mac_btn_group_middle .btn.active{ - background: rgba(255,255,255,0.6); +#mac_btn_group_middle .btn.active { + background: rgba(255, 255, 255, 0.6); } -#mac_btn_group_middle .btn:hover{ +#mac_btn_group_middle .btn:hover { cursor: pointer; } -.mac-open-iframe{ - /*繁华年间许你一世安宁提供*/ +.mac-open-iframe { + /*繁华年间许你一世安宁提供*/ background-color: transparent; border: #f0f6f6 solid 1px; -webkit-box-shadow: 0 0 50px 0 rgba(0, 0, 0, 0.8); @@ -694,84 +706,95 @@ body { -moz-border-radius: 6px !important; } -.mac-open-iframe .layui-layer-content{ +.mac-open-iframe .layui-layer-content { background-color: white; max-height: calc(100% - 24px); } -.mac-open-iframe .layui-layer-title{ +.mac-open-iframe .layui-layer-title { box-sizing: border-box; background: rgba(250, 250, 250, 0.9); padding-left: 120px; - border-radius:4px 4px 0 0; + border-radius: 4px 4px 0 0; color: #333; - text-align:center; + text-align: center; } -.mac-open-iframe.hide{ + +.mac-open-iframe.hide { display: none; } -.mac-btn_refresh{ + +.mac-btn_refresh { float: right; } -#mac .img-loader{ + +#mac .img-loader { display: none; } -.mac-open-iframe .layui-layer-min cite{display: none;} -.mac-open-iframe .layui-layer-max:hover{background-image:none} -.mac-open-iframe .layui-layer-max,.layui-layer-maxmin{background:none} +.mac-open-iframe .layui-layer-min cite { + display: none; +} -.mac-open-iframe .layui-layer-setwin a::before{ +.mac-open-iframe .layui-layer-max:hover { + background-image: none +} + +.mac-open-iframe .layui-layer-max, .layui-layer-maxmin { + background: none +} + +.mac-open-iframe .layui-layer-setwin a::before { display: inline-block; width: 0.9rem; height: 0.9rem; border-radius: 50%; } -.mac-open-iframe .layui-layer-setwin a.layui-layer-close1:hover::before{ - content:"\f057"; +.mac-open-iframe .layui-layer-setwin a.layui-layer-close1:hover::before { + content: "\f057"; color: #FF6057; font: normal normal normal 0.9rem/1 FontAwesome; } -.mac-open-iframe .layui-layer-min::before{ - content:"\f111"; +.mac-open-iframe .layui-layer-min::before { + content: "\f111"; color: #28CA40; font: normal normal normal 0.9rem/1 FontAwesome; } -.mac-open-iframe .layui-layer-min:hover::before{ - content:"\f056"; +.mac-open-iframe .layui-layer-min:hover::before { + content: "\f056"; color: #28CA40; font: normal normal normal 0.9rem/1 FontAwesome; } -.mac-open-iframe .layui-layer-max::before{ - content:"\f111"; +.mac-open-iframe .layui-layer-max::before { + content: "\f111"; color: #FFBD2E; font: normal normal normal 0.9rem/1 FontAwesome; } -.mac-open-iframe .layui-layer-max:hover::before{ - content:"\f055"; +.mac-open-iframe .layui-layer-max:hover::before { + content: "\f055"; color: #FFBD2E; font: normal normal normal 0.9rem/1 FontAwesome; } -.mac-open-iframe .layui-layer-maxmin.layui-layer-max::before{ - content:"\f111"; +.mac-open-iframe .layui-layer-maxmin.layui-layer-max::before { + content: "\f111"; color: #FFBD2E; font: normal normal normal 0.9rem/1 FontAwesome; } -.mac-open-iframe .layui-layer-maxmin.layui-layer-max:hover::before{ - content:"\f055"; +.mac-open-iframe .layui-layer-maxmin.layui-layer-max:hover::before { + content: "\f055"; color: #FFBD2E; font: normal normal normal 0.9rem/1 FontAwesome; } -.mac-open-iframe .layui-layer-close::before{ - content:"\f111"; +.mac-open-iframe .layui-layer-close::before { + content: "\f111"; color: #FF6057; font: normal normal normal 0.9rem/1 FontAwesome; } @@ -796,35 +819,81 @@ body { */ -.mac-open-iframe .layui-layer-min,.layui-layer-close,.layui-layer-max{ +.mac-open-iframe .layui-layer-min, .layui-layer-close, .layui-layer-max { text-decoration: none; } -.mac-btn-refresh,.mac-btn-change-url,.mac-btn-refresh:hover,.mac-btn-change-url:hover{ - text-decoration:none; + +.mac-btn-refresh, .mac-btn-change-url, .mac-btn-refresh:hover, .mac-btn-change-url:hover { + text-decoration: none; } -.mac-open-iframe .mac-btn-refresh::before,.mac-btn-change-url::before{ - content:"\f111"; +.mac-open-iframe .mac-btn-refresh::before, .mac-btn-change-url::before { + content: "\f111"; color: #029FFF; font: normal normal normal 0.9rem/1 FontAwesome; } -.mac-open-iframe .mac-btn-refresh:hover::before,.mac-btn-change-url:hover::before{ - content:"\f192"; +.mac-open-iframe .mac-btn-refresh:hover::before, .mac-btn-change-url:hover::before { + content: "\f192"; color: #029FFF; font: normal normal normal 0.9rem/1 FontAwesome; } /*右键菜单*/ -#mac .mac-context-menu { left: 0;top: 0;position: fixed; width: 150px; height: auto; background-color: rgba(255, 255, 255,0.45); display: block; border-radius: 5px; z-index: 99999999; } -#mac .mac-context-menu ul { margin: 0; padding: 0; } -#mac .mac-context-menu ul li {transition: background-color 0.5s;cursor: default;padding: 0 1em; list-style: none; line-height: 25px; height: 25px; margin: 3px 0; font-size: 13px; } -#mac .mac-context-menu ul li:hover { background-color: rgba(49,156,241,0.71);cursor: pointer; } -#mac .mac-context-menu ul li a {text-decoration: none; display: block; height: 100%; color: #333; outline: none; } -#mac .mac-context-menu ul hr { margin: 0; height: 0; border: 0; border-bottom: rgba(121, 121, 121, 0.24) 1px solid;border-top: none } +#mac .mac-context-menu { + left: 0; + top: 0; + position: fixed; + width: 150px; + height: auto; + background-color: rgba(255, 255, 255, 0.45); + display: block; + border-radius: 5px; + z-index: 99999999; +} + +#mac .mac-context-menu ul { + margin: 0; + padding: 0; +} + +#mac .mac-context-menu ul li { + transition: background-color 0.5s; + cursor: default; + padding: 0 1em; + list-style: none; + line-height: 25px; + height: 25px; + margin: 3px 0; + font-size: 13px; +} + +#mac .mac-context-menu ul li:hover { + background-color: rgba(49, 156, 241, 0.71); + cursor: pointer; +} + +#mac .mac-context-menu ul li a { + text-decoration: none; + display: block; + height: 100%; + color: #333; + outline: none; +} + +#mac .mac-context-menu ul hr { + margin: 0; + height: 0; + border: 0; + border-bottom: rgba(121, 121, 121, 0.24) 1px solid; + border-top: none +} /*块级按钮*/ -.mac-open-iframe .layui-layer-ico{background-image:none;} +.mac-open-iframe .layui-layer-ico { + background-image: none; +} + .mac-open-iframe .layui-layer-setwin { position: absolute; left: 0; @@ -833,6 +902,7 @@ body { height: 30px; line-height: 30px; } + .mac-open-iframe .layui-layer-setwin a { position: relative; width: 30px; @@ -840,14 +910,15 @@ body { font-size: 13px; text-align: center; overflow: hidden; - margin:0; + margin: 0; } -.mac-open-iframe .layui-layer-title{ - line-height:30px; + +.mac-open-iframe .layui-layer-title { + line-height: 30px; height: 30px; } -.mac-open-iframe .layui-layer-title .icon ,#mac_btn_group_middle .btn_title .icon{ +.mac-open-iframe .layui-layer-title .icon, #mac_btn_group_middle .btn_title .icon { font-size: 15px; padding: 1px; width: 20px; @@ -857,24 +928,25 @@ body { border-radius: 3px; text-align: center; } -.mac-open-iframe .layui-layer-title img.icon,#mac_btn_group_middle .btn_title img.icon{ + +.mac-open-iframe .layui-layer-title img.icon, #mac_btn_group_middle .btn_title img.icon { width: 20px; position: relative; } -.mac-open-iframe .layui-layer-title img.icon{ - top:5px ; +.mac-open-iframe .layui-layer-title img.icon { + top: 5px; } -#mac-menu>.list>.sub-item img.icon,#mac-menu>.list>.item img.icon{ +#mac-menu > .list > .sub-item img.icon, #mac-menu > .list > .item img.icon { width: 36px; - height:36px; + height: 36px; position: relative; - top:2px ; + top: 2px; } /*桌面舞台样式*/ -#mac-desktop-scene{ +#mac-desktop-scene { width: 100%; height: 100%; position: absolute; @@ -883,76 +955,92 @@ body { z-index: 0; background-color: transparent; } + /*--------------尾部--------------------*/ .dock { - width: 100%; - bottom: 0; - position: absolute; - left: 0; - height: 60px; - text-align: center; - z-index:1003; + width: 100%; + bottom: 0; + position: absolute; + left: 0; + height: 60px; + text-align: center; + z-index: 1003; } + .dock-container { - position: absolute; - height: 60px; - border-radius: 5px 5px 0 0 ; - background-color: rgba(255,255,255,0.45) ;/* IE9、标准浏览器、IE6和部分IE7内核的浏览器(如QQ浏览器)会读懂 */ - padding:0 5px; + width: 100%; + height: 60px; + flex-flow: row nowrap; + place-content: stretch center; + align-items: center; + display:flex; + flex-direction: row; + flex-wrap: nowrap; + justify-content: center; + align-content: stretch; + border-radius: 5px 5px 0 0; + background-color: rgba(255, 255, 255, 0.45); /* IE9、标准浏览器、IE6和部分IE7内核的浏览器(如QQ浏览器)会读懂 */ + padding: 0 5px; + margin: 0 auto; } .dock a.dock-item { - display: block; - font: bold 12px Arial, Helvetica, sans-serif; - width: 60px; - color: #fff; - bottom: 0; - position: absolute; - text-align: center; - text-decoration: none; + display: block; + font: bold 12px Arial, Helvetica, sans-serif; + width: 60px; + color: #fff; + bottom: 0; + position: absolute; + text-align: center; + text-decoration: none; + align-self: auto; + flex-basis: auto; + flex-grow: 0; } + .dock-item span { - display: none; - padding:3px 0; - border-radius: 5px; - background-color: rgba(0,0,0,0.45); + display: none; + padding: 3px 0; + border-radius: 5px; + background-color: rgba(0, 0, 0, 0.45); } + .dock-item img { - border: none; - margin: 5px; - width: 100%; + border: none; + margin: 5px; + width: 100%; } #launchpad { - position: fixed; - width: 100%; - height: 100%; - overflow-y:auto; - display: block; - top: 0; - z-index: 1001; + position: fixed; + width: 100%; + height: 100%; + overflow-y: auto; + display: block; + top: 0; + z-index: 1001; } #launchpad.hidden { - display: none; + display: none; } -#launchpad .app-serach-box{ - position: relative; - margin: 3vh auto 20px; - height: 1.75rem; - width: 16rem; - color: var(--d-main); - background-color: transparent; - font-size: 14px; - line-height: 20px; +#launchpad .app-serach-box { + position: relative; + margin: 3vh auto 20px; + height: 1.75rem; + width: 16rem; + background-color: transparent; + font-size: 14px; + line-height: 20px; } .search .serach-box { position: relative; - background-color: rgba(229,231,235,0.1); + background-color: rgba(229, 231, 235, 0.1); } + .search label { background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAMAAAAolt3jAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAALFQTFRFAAAA////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////t5hynAAAADt0Uk5TABqT4f/1u0487ui5zf6bARv6agInexLmEOPqeVS+THTz02JntjPAKkLZHoS18pFzyhXnq9wEW1Ecxze6XPngAAAAhUlEQVR4nE2MWRKCUAwEAw4C+hAEcVcEdxH3/f4HMxCknI+e6lQSItL0Goy6SRLLRqOpHLTc3Dy77QdEHYUwVx1+sdTtGX2uwTCQoxHGTEzKH1NEzFlcaoI5c4Gl6Apr5gbbHZebYl9MU2SH5HgC4rMcXQA419vP79bjqdGrcgn7m/5dfb4TpgmCJFVbRAAAAABJRU5ErkJggg==) no-repeat 0 50%; color: #fff; @@ -963,23 +1051,26 @@ body { transition: left .4s, transform .4s; padding-left: 1.25em; } + .search .input-search { -webkit-appearance: textfield; - background-color: rgba(229,231,235,0.1); + background-color: rgba(229, 231, 235, 0.1); border-radius: .25em; - border-color: rgba(229,231,235,0.3); - border-width: 1px; - border-style: solid; + border-color: rgba(229, 231, 235, 0.3); + border-width: 1px; + border-style: solid; display: block; padding: .5em 1.75em; width: 100%; - outline: none;/*点击之后。不出现边框*/ + outline: none; /*点击之后。不出现边框*/ } + .search .input-search:focus + label, .search .input-search:valid + label { left: .5em; transform: translate(0, -50%); } + .search .input-search:valid + label { text-indent: -9999px; } @@ -991,122 +1082,131 @@ body { border-color: #ebe6e5; } -.search .input-search,.search .input-search:hover { +.search .input-search, .search .input-search:hover { --un-text-opacity: 1; - color: rgba(255,255,255,var(--un-text-opacity)); + color: rgba(255, 255, 255, var(--un-text-opacity)); } -#launchpad .app-shortcuts{ - display:flex; - flex-direction: row; - flex-wrap: wrap; - justify-content: flex-start; - align-content: stretch; - align-items: flex-start; - position: fixed; - width: calc(100% - 90px); - height: 100%; - margin: 0 auto; - padding: 0 45px; +#launchpad .app-shortcuts { + display: flex; + flex-direction: row; + flex-wrap: wrap; + justify-content: flex-start; + align-content: stretch; + align-items: flex-start; + position: fixed; + width: calc(100% - 90px); + height: 100%; + margin: 0 auto; + padding: 0 45px; } -#launchpad .shortcut{ +#launchpad .shortcut { width: 75px; height: 75px; order: 1; align-self: auto; flex-basis: auto; flex-grow: 0; - padding: 0.625rem; + padding: 0.625rem; flex-shrink: 1; } -#launchpad .shortcut>.icon { - width: 50px; - height: 50px; - overflow: hidden; - color: white; - box-sizing: border-box; - margin: 5px auto; - text-align: center; - -webkit-border-radius: 5px; - -moz-border-radius: 5px; - border-radius: 5px; - display: block; - font-size: 37px; - line-height: 50px; -} - -#launchpad .shortcut .title { - color: white; - font-size: 12px; - text-align: center; - line-height: 18px; - margin-bottom: 5px; -} - - /*各种颜色 具体效果见 https://www.kancloud.cn/qq85569256/xzui/350010*/ -.mac-open-iframe .black-green, #mac .black-green{background:#009688!important;} -.mac-open-iframe .green,#mac .green{background:#5FB878!important;} -.mac-open-iframe .black,#mac .black{background:#393D49!important;} -.mac-open-iframe .blue,#mac .blue{background:#1E9FFF!important;} -.mac-open-iframe .orange,#mac .orange{background:#F7B824!important;} -.mac-open-iframe .red,#mac .red{background:#FF5722!important;} -.mac-open-iframe .dark,#mac .dark{background:#2F4056!important;} -.mac-open-iframe .purple,#mac .purple{background:#b074e6!important;} -@media screen and (max-width:768px){ - #mac-menu{ - width:100%; +.mac-open-iframe .black-green, #mac .black-green { + background: #009688 !important; +} + +.mac-open-iframe .green, #mac .green { + background: #5FB878 !important; +} + +.mac-open-iframe .black, #mac .black { + background: #393D49 !important; +} + +.mac-open-iframe .blue, #mac .blue { + background: #1E9FFF !important; +} + +.mac-open-iframe .orange, #mac .orange { + background: #F7B824 !important; +} + +.mac-open-iframe .red, #mac .red { + background: #FF5722 !important; +} + +.mac-open-iframe .dark, #mac .dark { + background: #2F4056 !important; +} + +.mac-open-iframe .purple, #mac .purple { + background: #b074e6 !important; +} + +@media screen and (max-width: 768px) { + #mac-menu { + width: 100%; top: 24px; - left:0; + left: 0; height: calc(100% - 25px); - border-radius:0 0 2px 2px; + border-radius: 0 0 2px 2px; } - #mac-menu.hidden{ + + #mac-menu.hidden { top: calc(-100% + 25px); } - #mac_command_center{ + + #mac_command_center { top: 24px; width: 100%; } + #mac_command_center.hidden_right { right: -100%; } - .layui-layer-setwin .layui-layer-max{ + + .layui-layer-setwin .layui-layer-max { display: none; } + #mac_btn_group_left .btn { height: 100%; width: 40px; overflow: hidden; font-size: 16px; } + #mac_btn_group_right .btn { height: 100%; min-width: 4px; padding: 0 10px; - font-size: 16px!important; + font-size: 16px !important; } + #mac_btn_show_desktop { border-left: grey 1px solid; width: 15px; margin-left: 3px; padding: 0 !important } - #mac_btn_group_left{ - max-width:100px; - } - #mac_btn_group_middle{ - width:calc(100% - 160px); + + #mac_btn_group_left { + max-width: 100px; } - #mac_btn_group_right{ - max-width:150px; + #mac_btn_group_middle { + width: calc(100% - 160px); } - #mac-menu .list{ + + #mac_btn_group_right { + max-width: 150px; + } + + #mac-menu .list { position: absolute; - width:100%; + width: 100%; left: 0; top: 0; @@ -1119,39 +1219,49 @@ body { clear: both; } - #mac-menu .list .item, .sub-item{ + #mac-menu .list .item, .sub-item { width: calc(100% - 20px); } - #mac_btn_time{display: none} - #mac-menu-switcher{ + #mac_btn_time { + display: none + } + + #mac-menu-switcher { display: none; } - #mac-menu>.mac-menu-hidden{ + + #mac-menu > .mac-menu-hidden { display: block; } - #mac_btn_group_middle .btn_close{ + + #mac_btn_group_middle .btn_close { display: none; } + .mac-open-iframe .layui-layer-setwin a { width: 32px; } - - .dock{ - width: 100%; - height:60px; - border-radius: 0; - } - .dock .dock-container{ - width: 100%; - border-radius: 0; - } - - .dock a.dock-item{ - width: 100%; - margin-left: 25px; - float:left; - position: static; - } - -} \ No newline at end of file + + #dock { + width: 100%; + height: 60px; + border-radius: 0; + } + + #dock .dock-container { + width: 100%; + border-radius: 0; + flex-flow: row nowrap; + place-content: stretch center; + align-items: center; + left: 0; + } + + #dock a.dock-item { + width: 100%; + float: left; + position: static; + } + +} diff --git a/index.html b/index.html index 6cbd20a..58ae92c 100644 --- a/index.html +++ b/index.html @@ -11,7 +11,7 @@ - + @@ -124,10 +124,10 @@ + - + - + - \ No newline at end of file + diff --git a/js/index.js b/js/index.js index 8d9450b..6211bfa 100644 --- a/js/index.js +++ b/js/index.js @@ -2,1350 +2,1347 @@ * Created by Yuri2 on 2017/7/10. */ window.Macui = { - _version: 'v1.1.2.5', - _debug: true, - _bgs: { - main: '', - mobile: '', - }, - _wallpaperBlur: true, //壁纸模糊(影响性能) - _countTask: 0, - _newMsgCount: 0, - _animated_classes: [], - _animated_liveness: 0, - _switchMenuTooHurry: false, - _lang: 'unknown', - _iframeOnClick: { - resolution: 200, - iframes: [], - interval: null, - Iframe: function() { - this.element = arguments[0]; - this.cb = arguments[1]; - this.hasTracked = false; - }, - track: function(element, cb) { - this.iframes.push(new this.Iframe(element, cb)); - if (!this.interval) { - let _this = this; - this.interval = setInterval(function() { - _this.checkClick(); - }, this.resolution); - } - }, - checkClick: function() { - if (document.activeElement) { - let activeElement = document.activeElement; - for (let i in this.iframes) { - let eid = undefined; - if ((eid = this.iframes[i].element.id) && !document.getElementById(eid)) { - delete this.iframes[i]; - continue; - } - if (activeElement === this.iframes[i].element) { // user is in this Iframe - if (this.iframes[i].hasTracked === false) { - this.iframes[i].cb.apply(window, []); - this.iframes[i].hasTracked = true; - } - } else { - this.iframes[i].hasTracked = false; - } - } - } - } - }, - _iframe_click_lock_children: {}, - _renderBar: function() { - //调整任务栏项目的宽度 - if (this._countTask <= 0) { - return; - } //防止除以0 - let btns = $("#mac_btn_group_middle>.btn"); - btns.css('width', ('calc(' + (1 / this._countTask * 100) + '% - 1px )')) - }, - _handleReady: [], - _hideShortcut: function() { - let that = $("#mac #mac-shortcuts .shortcut"); - that.removeClass('animated flipInX'); - that.addClass('animated flipOutX'); - }, - _showShortcut: function() { - let that = $("#mac #mac-shortcuts .shortcut"); - that.removeClass('animated flipOutX'); - that.addClass('animated flipInX'); - }, - _checkBgUrls: function() { - let loaders = $('#mac>.img-loader'); - let flag = false; - if (Macui.isSmallScreen()) { - if (Macui._bgs.mobile) { - loaders.each(function() { - let loader = $(this); - if (loader.attr('src') === Macui._bgs.mobile && loader.hasClass('loaded')) { - Macui._setBackgroundImg(Macui._bgs.mobile); - flag = true; - } - }); - if (!flag) { - //没找到加载完毕的图片 - let img = $(''); - $('#mac').append(img); - Macui._onImgComplete(img[0], function() { - img.addClass('loaded'); - Macui._setBackgroundImg(Macui._bgs.mobile); - }) - } - } - } else { - if (Macui._bgs.main) { - loaders.each(function() { - let loader = $(this); - if (loader.attr('src') === Macui._bgs.main && loader.hasClass('loaded')) { - Macui._setBackgroundImg(Macui._bgs.main); - flag = true; - } - }); - if (!flag) { - //没找到加载完毕的图片 - let img = $(''); - $('#mac').append(img); - Macui._onImgComplete(img[0], function() { - img.addClass('loaded'); - Macui._setBackgroundImg(Macui._bgs.main); - }) - } - } - } + _version: 'v1.1.2.5', + _debug: true, + _bgs: { + main: '', + mobile: '', + }, + _wallpaperBlur: true, //壁纸模糊(影响性能) + _countTask: 0, + _newMsgCount: 0, + _animated_classes: [], + _animated_liveness: 0, + _switchMenuTooHurry: false, + _lang: 'unknown', + _iframeOnClick: { + resolution: 200, + iframes: [], + interval: null, + Iframe: function () { + this.element = arguments[0]; + this.cb = arguments[1]; + this.hasTracked = false; + }, + track: function (element, cb) { + this.iframes.push(new this.Iframe(element, cb)); + if (!this.interval) { + let _this = this; + this.interval = setInterval(function () { + _this.checkClick(); + }, this.resolution); + } + }, + checkClick: function () { + if (document.activeElement) { + let activeElement = document.activeElement; + for (let i in this.iframes) { + let eid = undefined; + if ((eid = this.iframes[i].element.id) && !document.getElementById(eid)) { + delete this.iframes[i]; + continue; + } + if (activeElement === this.iframes[i].element) { // user is in this Iframe + if (this.iframes[i].hasTracked === false) { + this.iframes[i].cb.apply(window, []); + this.iframes[i].hasTracked = true; + } + } else { + this.iframes[i].hasTracked = false; + } + } + } + } + }, + _iframe_click_lock_children: {}, + _renderBar: function () { + //调整任务栏项目的宽度 + if (this._countTask <= 0) { + return; + } //防止除以0 + let btns = $("#mac_btn_group_middle>.btn"); + btns.css('width', ('calc(' + (1 / this._countTask * 100) + '% - 1px )')) + }, + _handleReady: [], + _hideShortcut: function () { + let that = $("#mac #mac-shortcuts .shortcut"); + that.removeClass('animated flipInX'); + that.addClass('animated flipOutX'); + }, + _showShortcut: function () { + let that = $("#mac #mac-shortcuts .shortcut"); + that.removeClass('animated flipOutX'); + that.addClass('animated flipInX'); + }, + _checkBgUrls: function () { + let loaders = $('#mac>.img-loader'); + let flag = false; + if (Macui.isSmallScreen()) { + if (Macui._bgs.mobile) { + loaders.each(function () { + let loader = $(this); + if (loader.attr('src') === Macui._bgs.mobile && loader.hasClass('loaded')) { + Macui._setBackgroundImg(Macui._bgs.mobile); + flag = true; + } + }); + if (!flag) { + //没找到加载完毕的图片 + let img = $(''); + $('#mac').append(img); + Macui._onImgComplete(img[0], function () { + img.addClass('loaded'); + Macui._setBackgroundImg(Macui._bgs.mobile); + }) + } + } + } else { + if (Macui._bgs.main) { + loaders.each(function () { + let loader = $(this); + if (loader.attr('src') === Macui._bgs.main && loader.hasClass('loaded')) { + Macui._setBackgroundImg(Macui._bgs.main); + flag = true; + } + }); + if (!flag) { + //没找到加载完毕的图片 + let img = $(''); + $('#mac').append(img); + Macui._onImgComplete(img[0], function () { + img.addClass('loaded'); + Macui._setBackgroundImg(Macui._bgs.main); + }) + } + } + } - //开始渲染壁纸模糊 - if (Macui._wallpaperBlur) { - $('.background').addClass('blur'); - } - }, - //动态加载JS文件 - loadScript: function(url, callback) { - let el = document.createElement("script"); - el.type = "text/javascript"; + //开始渲染壁纸模糊 + if (Macui._wallpaperBlur) { + $('.background').addClass('blur'); + } + }, + //动态加载JS文件 + loadScript: function (url, callback) { + let el = document.createElement("script"); + el.type = "text/javascript"; - if (typeof(callback) != "undefined") { - if (el.readyState) { - el.onreadystatechange = function() { - if (el.readyState === "loaded" || el.readyState === "complete") { - el.onreadystatechange = null; - callback(); - } - }; - } else { - el.onload = function() { - callback(); - }; - } - } + if (typeof (callback) != "undefined") { + if (el.readyState) { + el.onreadystatechange = function () { + if (el.readyState === "loaded" || el.readyState === "complete") { + el.onreadystatechange = null; + callback(); + } + }; + } else { + el.onload = function () { + callback(); + }; + } + } - el.src = url; - document.head.appendChild(el); - }, - _startAnimate: function() { - setInterval(function() { - let classes_length = Macui._animated_classes.length; - let animated_live_ness = Macui._animated_liveness; - if (animated_live_ness === 0 || classes_length === 0 || !$("#mac-menu").hasClass( - 'opened')) { - return; - } - $('#mac-menu>.blocks>.menu_group>.block').each(function() { - if (!$(this).hasClass('onAnimate') && Math.random() <= animated_live_ness) { - let that = $(this); - let class_animate = Macui._animated_classes[Math.floor((Math.random() * - classes_length))]; - that.addClass('onAnimate'); - setTimeout(function() { - that.addClass(class_animate); - setTimeout(function() { - that.removeClass('onAnimate'); - that.removeClass(class_animate); - }, 3000); - }, Math.random() * 2 * 1000) - } - }) - }, 1000); - }, - _onImgComplete: function(img, callback) { - if (!img) { - return; - } - let timer = setInterval(function() { - if (img.complete) { - callback(img); - clearInterval(timer); - } - }, 50) - }, - _setBackgroundImg: function(img) { - $('#mac .background').css('background-image', 'url(' + img + ')') - }, - _settop: function(layero) { - if (!isNaN(layero)) { - layero = this.getLayeroByIndex(layero); - } - //置顶窗口 - let max_zindex = 0; - $(".mac-open-iframe").each(function() { - z = parseInt($(this).css('z-index')); - $(this).css('z-index', z - 1); - if (z > max_zindex) { - max_zindex = z; - } - }); - layero.css('z-index', max_zindex + 1); - }, - _checkTop: function() { - let max_index = 0, - max_z = 0, - btn = null; - $("#mac_btn_group_middle .btn.show").each(function() { - let index = $(this).attr('index'); - let layero = Macui.getLayeroByIndex(index); - let z = layero.css('z-index'); - if (z > max_z) { - max_index = index; - max_z = z; - btn = $(this); - } - }); - this._settop(max_index); - $("#mac_btn_group_middle .btn").removeClass('active'); - if (btn) { - btn.addClass('active'); - } - }, - //渲染右键 - _renderContextMenu: function(x, y, menu, trigger) { - this._removeContextMenu(); - if (menu === true) { - return; - } - let dom = $("
"); - $('#mac').append(dom); - let ul = dom.find('ul'); - for (let i = 0; i < menu.length; i++) { - let item = menu[i]; - if (item === '|') { - ul.append($('
')); - continue; - } - if (typeof(item) === 'string') { - ul.append($('
  • ' + item + '
  • ')); - continue; - } - if (typeof(item) === 'object') { - let sub = $('
  • ' + item[0] + '
  • '); - ul.append(sub); - sub.click(trigger, item[1]); - } - } - //修正坐标 - if (x + 150 > document.body.clientWidth) { - x -= 150 - } - if (y + dom.height() > document.body.clientHeight) { - y -= dom.height() - } - dom.css({ - top: y, - left: x, - }); - }, - _removeContextMenu: function() { - $('.mac-context-menu').remove(); - }, - _closeWin: function(index) { - $("#mac_" + index).remove(); - layer.close(index); - Macui._checkTop(); - Macui._countTask--; //回退countTask数 - Macui._renderBar(); - }, - _fixWindowsHeightAndWidth: function() { - //此处代码修正全屏切换引起的子窗体尺寸超出屏幕 - let opens = $('.mac-open-iframe'); - let clientHeight = document.body.clientHeight; - opens.each(function() { - let layero_opened = $(this); - let height = layero_opened.css('height'); - height = parseInt(height.replace('px', '')); - if (height + 30 >= clientHeight) { - layero_opened.css('height', clientHeight - 30); - layero_opened.find('.layui-layer-content').css('height', clientHeight - 62); - layero_opened.find('.layui-layer-content iframe').css('height', clientHeight - 62); - } - }) - }, + el.src = url; + document.head.appendChild(el); + }, + _startAnimate: function () { + setInterval(function () { + let classes_length = Macui._animated_classes.length; + let animated_live_ness = Macui._animated_liveness; + if (animated_live_ness === 0 || classes_length === 0 || !$("#mac-menu").hasClass( + 'opened')) { + return; + } + $('#mac-menu>.blocks>.menu_group>.block').each(function () { + if (!$(this).hasClass('onAnimate') && Math.random() <= animated_live_ness) { + let that = $(this); + let class_animate = Macui._animated_classes[Math.floor((Math.random() * + classes_length))]; + that.addClass('onAnimate'); + setTimeout(function () { + that.addClass(class_animate); + setTimeout(function () { + that.removeClass('onAnimate'); + that.removeClass(class_animate); + }, 3000); + }, Math.random() * 2 * 1000) + } + }) + }, 1000); + }, + _onImgComplete: function (img, callback) { + if (!img) { + return; + } + let timer = setInterval(function () { + if (img.complete) { + callback(img); + clearInterval(timer); + } + }, 50) + }, + _setBackgroundImg: function (img) { + $('#mac .background').css('background-image', 'url(' + img + ')') + }, + _settop: function (layero) { + if (!isNaN(layero)) { + layero = this.getLayeroByIndex(layero); + } + //置顶窗口 + let max_zindex = 0; + $(".mac-open-iframe").each(function () { + z = parseInt($(this).css('z-index')); + $(this).css('z-index', z - 1); + if (z > max_zindex) { + max_zindex = z; + } + }); + layero.css('z-index', max_zindex + 1); + }, + _checkTop: function () { + let max_index = 0, + max_z = 0, + btn = null; + $("#mac_btn_group_middle .btn.show").each(function () { + let index = $(this).attr('index'); + let layero = Macui.getLayeroByIndex(index); + let z = layero.css('z-index'); + if (z > max_z) { + max_index = index; + max_z = z; + btn = $(this); + } + }); + this._settop(max_index); + $("#mac_btn_group_middle .btn").removeClass('active'); + if (btn) { + btn.addClass('active'); + } + }, + //渲染右键 + _renderContextMenu: function (x, y, menu, trigger) { + this._removeContextMenu(); + if (menu === true) { + return; + } + let dom = $("
    "); + $('#mac').append(dom); + let ul = dom.find('ul'); + for (let i = 0; i < menu.length; i++) { + let item = menu[i]; + if (item === '|') { + ul.append($('
    ')); + continue; + } + if (typeof (item) === 'string') { + ul.append($('
  • ' + item + '
  • ')); + continue; + } + if (typeof (item) === 'object') { + let sub = $('
  • ' + item[0] + '
  • '); + ul.append(sub); + sub.click(trigger, item[1]); + } + } + //修正坐标 + if (x + 150 > document.body.clientWidth) { + x -= 150 + } + if (y + dom.height() > document.body.clientHeight) { + y -= dom.height() + } + dom.css({ + top: y, + left: x, + }); + }, + _removeContextMenu: function () { + $('.mac-context-menu').remove(); + }, + _closeWin: function (index) { + $("#mac_" + index).remove(); + layer.close(index); + Macui._checkTop(); + Macui._countTask--; //回退countTask数 + Macui._renderBar(); + }, + _fixWindowsHeightAndWidth: function () { + //此处代码修正全屏切换引起的子窗体尺寸超出屏幕 + let opens = $('.mac-open-iframe'); + let clientHeight = document.body.clientHeight; + opens.each(function () { + let layero_opened = $(this); + let height = layero_opened.css('height'); + height = parseInt(height.replace('px', '')); + if (height + 30 >= clientHeight) { + layero_opened.css('height', clientHeight - 30); + layero_opened.find('.layui-layer-content').css('height', clientHeight - 62); + layero_opened.find('.layui-layer-content iframe').css('height', clientHeight - 62); + } + }) + }, - /** - * 原 #mac_bind_open_windows 子窗口事件自动绑定插件 - * @author:vG - * @修订:Yuri2 - * @version:2.0.1 - * 说明: 所有#win10下的元素加入类win10-open-window即可自动绑定openUrl函数,无须用onclick手动绑定 - */ - _bind_open_windows: function() { - // 注册事件委派 打开url窗口 - $('#mac').on('click', '.mac-open-window', function() { - //>> 获取当前点击的对象 - $this = $(this); - //>> 判断url地址是否为空 如果为空 不予处理 - if ($this.data('url') !== "") { - //>> 获取弹窗标题 - let title = $this.data('title') || '', - areaAndOffset, icon; + /** + * 原 #mac_bind_open_windows 子窗口事件自动绑定插件 + * @author:vG + * @修订:Yuri2 + * @version:2.0.1 + * 说明: 所有#win10下的元素加入类win10-open-window即可自动绑定openUrl函数,无须用onclick手动绑定 + */ + _bind_open_windows: function () { + // 注册事件委派 打开url窗口 + $('#mac').on('click', '.mac-open-window', function () { + //>> 获取当前点击的对象 + $this = $(this); + //>> 判断url地址是否为空 如果为空 不予处理 + if ($this.data('url') !== "") { + //>> 获取弹窗标题 + let title = $this.data('title') || '', + areaAndOffset, icon; - //>> 判断是否有标题图片 - let bg = $this.data('icon-bg') ? $this.data('icon-bg') : ''; - if ($this.data('icon-image')) { - //>> 加入到标题中 - icon = ''; - } - if ($this.data('icon-font')) { - //>> 加入到标题中 - icon = ''; - } - if (!title && $this.children('.icon').length === 1 && $this.children('.title') - .length === 1) { - title = $this.children('.title').html(); - if (!icon) { - icon = $this.children('.icon').prop("outerHTML"); - } - } - //>> 判断是否需要 设置 区域宽度高度 - if ($this.data('area-offset')) { - areaAndOffset = $this.data('area-offset'); - //>> 判断是否有分隔符 - if (areaAndOffset.indexOf(',') !== -1) { - areaAndOffset = eval(areaAndOffset); - } - } - //>> 调用win10打开url方法 - Macui.openUrl($this.data('url'), icon, title, areaAndOffset); - } - }) - }, - _init: function() { + //>> 判断是否有标题图片 + let bg = $this.data('icon-bg') ? $this.data('icon-bg') : ''; + if ($this.data('icon-image')) { + //>> 加入到标题中 + icon = ''; + } + if ($this.data('icon-font')) { + //>> 加入到标题中 + icon = ''; + } + if (!title && $this.children('.icon').length === 1 && $this.children('.title') + .length === 1) { + title = $this.children('.title').html(); + if (!icon) { + icon = $this.children('.icon').prop("outerHTML"); + } + } + //>> 判断是否需要 设置 区域宽度高度 + if ($this.data('area-offset')) { + areaAndOffset = $this.data('area-offset'); + //>> 判断是否有分隔符 + if (areaAndOffset.indexOf(',') !== -1) { + areaAndOffset = eval(areaAndOffset); + } + } + //>> 调用win10打开url方法 + Macui.openUrl($this.data('url'), icon, title, areaAndOffset); + } + }) + }, + _init: function () { - //获取语言 - this._lang = (navigator.language || navigator.browserLanguage).toLowerCase(); + //获取语言 + this._lang = (navigator.language || navigator.browserLanguage).toLowerCase(); - $("#mac_btn_win").click(function() { - Macui.commandCenterClose(); - Macui.menuToggle(); - }); - $("#mac_btn_command").click(function() { - Macui.renderCommand(); - Macui.menuClose(); - Macui.commandCenterToggle(); - }); - $("#mac .desktop").click(function() { - Macui.menuClose(); - Macui.commandCenterClose(); - }); - $('#mac').on('click', ".notice .btn_close_msg", function() { - let msg = $(this).parents('.notice'); - $(msg).addClass('animated slideOutRight'); - setTimeout(function() { - msg.remove() - }, 500) - }); - $("#mac .launchpad").click(function() { - if ($("#launchpad").hasClass("hidden")) { - Macui.renderLaunchpad(); - Macui.menuClose(); - Macui.commandCenterClose(); - } else { - Macui.closeLaunchpad(); - } - }); - //消息界面切换 - $('#mac_command_center').on('click', ".command-header div", function() { - if (!$(this).hasClass('active')) { - if ($(this).hasClass('tab-today')) { - $(this).parent().siblings('.msgs').hide().siblings('.today').show(); - $(this).addClass('active').siblings('div').removeClass('active'); - } else { - $(this).parent().siblings('.today').hide().siblings('.msgs').show(); - $(this).addClass('active').siblings('div').removeClass('active'); - } - } - }); - $('#mac_btn_command_center_clean_all').click(function() { - let msgs = $('#mac_command_center .msg'); - msgs.addClass('animated slideOutRight'); - setTimeout(function() { - msgs.remove() - }, 1500); - setTimeout(function() { - Macui.commandCenterClose(); - }, 1000); - }); - $("#mac_btn_show_desktop").click(function() { - $("#mac .desktop").click(); - Macui.hideWins(); - }); - $("#mac-menu-switcher").click(function() { - if (Macui._switchMenuTooHurry) { - return; - } - Macui._switchMenuTooHurry = true; - let class_name = 'mac-menu-hidden'; - let list = $("#mac-menu>.list"); - let blocks = $("#mac-menu>.blocks"); - let toggleSlide = function(obj) { - if (obj.hasClass(class_name)) { - obj.addClass('animated slideInLeft'); - obj.removeClass('animated slideOutLeft'); - obj.removeClass(class_name); - } else { - setTimeout(function() { - obj.addClass(class_name); - }, 450); - obj.addClass('animated slideOutLeft'); - obj.removeClass('animated slideInLeft'); - } - }; - toggleSlide(list); - toggleSlide(blocks); - setTimeout(function() { - Macui._switchMenuTooHurry = false; - }, 520) - }); - $("#mac_btn_group_middle").click(function() { - $("#mac .desktop").click(); - }); - $(document).on('click', '.mac-btn-refresh', function() { - let index = $(this).attr('index'); - let iframe = Macui.getLayeroByIndex(index).find('iframe'); - iframe.attr('src', iframe.attr('src')); - }); - $(document).on('mousedown', '.mac-open-iframe', function() { - let layero = $(this); - Macui._settop(layero); - Macui._checkTop(); - }); - $('#mac_btn_group_middle').on('click', '.btn_close', function() { - let index = $(this).parent().attr('index'); - Macui._closeWin(index); - }); - $('#mac-menu .list').on('click', '.item', function() { - let e = $(this); - if (e.hasClass('has-sub-down')) { - $('#mac-menu .list .item.has-sub-up').toggleClass('has-sub-down').toggleClass( - 'has-sub-up'); - $("#mac-menu .list .sub-item").slideUp(); - } - if (e.next().hasClass('sub-item')) { - e.toggleClass('has-sub-down').toggleClass('has-sub-up'); - } - while (e.next().hasClass('sub-item')) { - e.next().slideToggle(); - e = e.next(); - } - }); - setInterval(function() { - //重新写mac时间 - let myDate = Macui.getLunarObj(); - $("#mac_btn_time").html(myDate.weekDay + myDate.hour + ':' + myDate.minute); - }, 1000); - //离开前警告 - document.body.onbeforeunload = function(event) { - let rel = Macui.lang('系统可能不会保存您所做的更改', 'The system may not save the changes you have made.'); - if (!window.event) { - event.returnValue = rel; - } else { - window.event.returnValue = rel; - } - }; - Macui.buildList(); //预处理左侧菜单 - Macui._startAnimate(); //动画处理 - Macui.renderShortcuts(); //渲染图标 - $("#mac-shortcuts").removeClass('shortcuts-hidden'); //显示图标 - Macui._showShortcut(); //显示图标 - Macui.renderDocks(); //渲染DOCK - //窗口改大小,重新渲染 - $(window).resize(function() { - Macui.renderShortcuts(); - Macui._checkBgUrls(); - if (!Macui.isSmallScreen()) Macui._fixWindowsHeightAndWidth(); //2017年11月14日修改,加入了if条件 - Macui.renderDocks(); - }); - //打广告 - setTimeout(function() { - console.log(Macui.lang( - '本页由Mac-UI强力驱动\n更多信息:https://mac.apecloud.cn \nMac-UI,轻松打造别具一格的后台界面 ', - 'The page is strongly driven by Mac-UI.\nFor more info: https://mac.apecloud.cn.\n Mac-UI, easy to create a unique background interface.' - )) - }, 2000); - //点击清空右键菜单 - $(document).click(function(event) { - if (!event.button) - Macui._removeContextMenu(); - }); - //禁用右键的右键 - $(document).on('contextmenu', '.mac-context-menu', function(e) { - e.preventDefault(); - e.stopPropagation(); - }); - //设置默认右键菜单 - Macui.setContextMenu('#mac', true); - Macui.setContextMenu('#mac>.desktop', [ - [' 收藏本页', function() { - let url = window.location; - let title = document.title; - let ua = navigator.userAgent.toLowerCase(); - if (ua.indexOf("360se") > -1) { - layer.alert(Macui.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) { - try { - window.external.addFavorite(url, title); - } catch (e) { - layer.alert(Macui.lang('您的浏览器不支持,请按 Ctrl+D 手动收藏!', - 'Your browser does not support, please press Ctrl+D to manual collection!' - )); - } - } else if (window.sidebar) { - window.sidebar.addPanel(title, url, ""); - } else { - layer.alert(Macui.lang('您的浏览器不支持,请按 Ctrl+D 手动收藏!', - 'Your browser does not support, please press Ctrl+D to manual collection!' - )); - } - }], - [' ' + Macui.lang('进入全屏', 'Enable Full Screen'), - function() { - Macui.enableFullScreen() - } - ], - [' ' + Macui.lang('退出全屏', 'Disable Full Screen'), - function() { - Macui.disableFullScreen() - } - ], - '|', - [' ' + Macui.lang('关于', 'About Us'), function() { - Macui.aboutUs() - }], - ]); - Macui.setContextMenu('#mac_btn_group_middle', [ - [' ' + Macui.lang('全部显示', 'Show All Windows'), - function() { - Macui.showWins() - } - ], - [' ' + Macui.lang('全部隐藏', 'Hide All Windows'), - function() { - Macui.hideWins() - } - ], - [' ' + Macui.lang('全部关闭', 'Close All Windows'), - function() { - Macui.closeAll() - } - ], - ]); + $("#mac_btn_win").click(function () { + Macui.commandCenterClose(); + Macui.menuToggle(); + }); + $("#mac_btn_command").click(function () { + Macui.renderCommand(); + Macui.menuClose(); + Macui.commandCenterToggle(); + }); + $("#mac .desktop").click(function () { + Macui.menuClose(); + Macui.commandCenterClose(); + }); + $('#mac').on('click', ".notice .btn_close_msg", function () { + let msg = $(this).parents('.notice'); + $(msg).addClass('animated slideOutRight'); + setTimeout(function () { + msg.remove() + }, 500) + }); + $("#mac .launchpad").click(function () { + if ($("#launchpad").hasClass("hidden")) { + Macui.renderLaunchpad(); + Macui.menuClose(); + Macui.commandCenterClose(); + } else { + Macui.closeLaunchpad(); + } + }); + //消息界面切换 + $('#mac_command_center').on('click', ".command-header div", function () { + if (!$(this).hasClass('active')) { + if ($(this).hasClass('tab-today')) { + $(this).parent().siblings('.msgs').hide().siblings('.today').show(); + $(this).addClass('active').siblings('div').removeClass('active'); + } else { + $(this).parent().siblings('.today').hide().siblings('.msgs').show(); + $(this).addClass('active').siblings('div').removeClass('active'); + } + } + }); + $('#mac_btn_command_center_clean_all').click(function () { + let msgs = $('#mac_command_center .msg'); + msgs.addClass('animated slideOutRight'); + setTimeout(function () { + msgs.remove() + }, 1500); + setTimeout(function () { + Macui.commandCenterClose(); + }, 1000); + }); + $("#mac_btn_show_desktop").click(function () { + $("#mac .desktop").click(); + Macui.hideWins(); + }); + $("#mac-menu-switcher").click(function () { + if (Macui._switchMenuTooHurry) { + return; + } + Macui._switchMenuTooHurry = true; + let class_name = 'mac-menu-hidden'; + let list = $("#mac-menu>.list"); + let blocks = $("#mac-menu>.blocks"); + let toggleSlide = function (obj) { + if (obj.hasClass(class_name)) { + obj.addClass('animated slideInLeft'); + obj.removeClass('animated slideOutLeft'); + obj.removeClass(class_name); + } else { + setTimeout(function () { + obj.addClass(class_name); + }, 450); + obj.addClass('animated slideOutLeft'); + obj.removeClass('animated slideInLeft'); + } + }; + toggleSlide(list); + toggleSlide(blocks); + setTimeout(function () { + Macui._switchMenuTooHurry = false; + }, 520) + }); + $("#mac_btn_group_middle").click(function () { + $("#mac .desktop").click(); + }); + $(document).on('click', '.mac-btn-refresh', function () { + let index = $(this).attr('index'); + let iframe = Macui.getLayeroByIndex(index).find('iframe'); + iframe.attr('src', iframe.attr('src')); + }); + $(document).on('mousedown', '.mac-open-iframe', function () { + let layero = $(this); + Macui._settop(layero); + Macui._checkTop(); + }); + $('#mac_btn_group_middle').on('click', '.btn_close', function () { + let index = $(this).parent().attr('index'); + Macui._closeWin(index); + }); + $('#mac-menu .list').on('click', '.item', function () { + let e = $(this); + if (e.hasClass('has-sub-down')) { + $('#mac-menu .list .item.has-sub-up').toggleClass('has-sub-down').toggleClass( + 'has-sub-up'); + $("#mac-menu .list .sub-item").slideUp(); + } + if (e.next().hasClass('sub-item')) { + e.toggleClass('has-sub-down').toggleClass('has-sub-up'); + } + while (e.next().hasClass('sub-item')) { + e.next().slideToggle(); + e = e.next(); + } + }); + setInterval(function () { + //重新写mac时间 + let myDate = Macui.getLunarObj(); + $("#mac_btn_time").html(myDate.weekDay + myDate.hour + ':' + myDate.minute); + }, 1000); + //离开前警告 + document.body.onbeforeunload = function (event) { + let rel = Macui.lang('系统可能不会保存您所做的更改', 'The system may not save the changes you have made.'); + if (!window.event) { + event.returnValue = rel; + } else { + window.event.returnValue = rel; + } + }; + Macui.buildList(); //预处理左侧菜单 + Macui._startAnimate(); //动画处理 + Macui.renderShortcuts(); //渲染图标 + $("#mac-shortcuts").removeClass('shortcuts-hidden'); //显示图标 + Macui._showShortcut(); //显示图标 + Macui.renderDocks(); //渲染DOCK + //窗口改大小,重新渲染 + $(window).resize(function () { + Macui.renderShortcuts(); + Macui._checkBgUrls(); + if (!Macui.isSmallScreen()) Macui._fixWindowsHeightAndWidth(); //2017年11月14日修改,加入了if条件 + Macui.renderDocks(); + }); + //打广告 + setTimeout(function () { + console.log(Macui.lang( + '本页由Mac-UI强力驱动\n更多信息:https://mac.apecloud.cn \nMac-UI,轻松打造别具一格的后台界面 ', + 'The page is strongly driven by Mac-UI.\nFor more info: https://mac.apecloud.cn.\n Mac-UI, easy to create a unique background interface.' + )) + }, 2000); + //点击清空右键菜单 + $(document).click(function (event) { + if (!event.button) + Macui._removeContextMenu(); + }); + //禁用右键的右键 + $(document).on('contextmenu', '.mac-context-menu', function (e) { + e.preventDefault(); + e.stopPropagation(); + }); + //设置默认右键菜单 + Macui.setContextMenu('#mac', true); + Macui.setContextMenu('#mac>.desktop', [ + [' 收藏本页', function () { + let url = window.location; + let title = document.title; + let ua = navigator.userAgent.toLowerCase(); + if (ua.indexOf("360se") > -1) { + layer.alert(Macui.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) { + try { + window.external.addFavorite(url, title); + } catch (e) { + layer.alert(Macui.lang('您的浏览器不支持,请按 Ctrl+D 手动收藏!', + 'Your browser does not support, please press Ctrl+D to manual collection!' + )); + } + } else if (window.sidebar) { + window.sidebar.addPanel(title, url, ""); + } else { + layer.alert(Macui.lang('您的浏览器不支持,请按 Ctrl+D 手动收藏!', + 'Your browser does not support, please press Ctrl+D to manual collection!' + )); + } + }], + [' ' + Macui.lang('进入全屏', 'Enable Full Screen'), + function () { + Macui.enableFullScreen() + } + ], + [' ' + Macui.lang('退出全屏', 'Disable Full Screen'), + function () { + Macui.disableFullScreen() + } + ], + '|', + [' ' + Macui.lang('关于', 'About Us'), function () { + Macui.aboutUs() + }], + ]); + Macui.setContextMenu('#mac_btn_group_middle', [ + [' ' + Macui.lang('全部显示', 'Show All Windows'), + function () { + Macui.showWins() + } + ], + [' ' + Macui.lang('全部隐藏', 'Hide All Windows'), + function () { + Macui.hideWins() + } + ], + [' ' + Macui.lang('全部关闭', 'Close All Windows'), + function () { + Macui.closeAll() + } + ], + ]); - //处理消息图标闪烁 - setInterval(function() { - let btn = $("#mac-msg-nof.on-new-msg"); - if (btn.length > 0) { - btn.toggleClass('fa-commenting-o'); - } - }, 600); + //处理消息图标闪烁 + setInterval(function () { + let btn = $("#mac-msg-nof.on-new-msg"); + if (btn.length > 0) { + btn.toggleClass('fa-commenting-o'); + } + }, 600); - //绑定快捷键 - $("body").keyup(function(e) { - if (e.ctrlKey) { - switch (e.keyCode) { - case 37: //left - $("#mac_btn_win").click(); - break; - case 38: //up - Macui.showWins(); - break; - case 39: //right - $("#mac_btn_command").click(); - break; - case 40: //down - Macui.hideWins(); - break; - } - } - }); - //launchpad 搜索功能 - $("#launchpad .input-search").on("input propertychange", function() { - //在输入框中打印输入的值 - var searchName = $(this).val(); - if (searchName == "") { - $("#app-shortcuts .shortcut").show(); - } else { - $("#app-shortcuts .shortcut").each(function() { - var appName = $(this).children(".title").text().toLowerCase(); - if (appName.indexOf(searchName.toLowerCase()) != -1){ - $(this).show(); - } else { - $(this).hide(); - } - }); - } - }); + //绑定快捷键 + $("body").keyup(function (e) { + if (e.ctrlKey) { + switch (e.keyCode) { + case 37: //left + $("#mac_btn_win").click(); + break; + case 38: //up + Macui.showWins(); + break; + case 39: //right + $("#mac_btn_command").click(); + break; + case 40: //down + Macui.hideWins(); + break; + } + } + }); + //launchpad 搜索功能 + $("#launchpad .input-search").on("input propertychange", function () { + //在输入框中打印输入的值 + var searchName = $(this).val(); + if (searchName == "") { + $("#app-shortcuts .shortcut").show(); + } else { + $("#app-shortcuts .shortcut").each(function () { + var appName = $(this).children(".title").text().toLowerCase(); + if (appName.indexOf(searchName.toLowerCase()) != -1) { + $(this).show(); + } else { + $(this).hide(); + } + }); + } + }); - /** - * WIN10-UI v1.1.2.2 桌面舞台支持补丁 - * WIN10-UI v1.1.2.2之后的版本不需要此补丁 - * @usage 直接引用即可(需要jquery) - * @author Yuri2 - */ - if ($("#mac-desktop-scene").length < 1) { - $("#mac-shortcuts").css({ - position: 'absolute', - left: 0, - top: 30, - 'z-index': 100, - }); - $("#mac .desktop").append( - "
    " - ) - } + /** + * WIN10-UI v1.1.2.2 桌面舞台支持补丁 + * WIN10-UI v1.1.2.2之后的版本不需要此补丁 + * @usage 直接引用即可(需要jquery) + * @author Yuri2 + */ + if ($("#mac-desktop-scene").length < 1) { + $("#mac-shortcuts").css({ + position: 'absolute', + left: 0, + top: 30, + 'z-index': 100, + }); + $("#mac .desktop").append( + "
    " + ) + } - //属性绑定 - Macui._bind_open_windows(); - }, - setBgUrl: function(bgs) { - this._bgs = bgs; - this._checkBgUrls(); - }, - setBg: function(bgs) { - this._bgs = bgs; - this._checkBgUrls(); - }, - menuClose: function() { - $("#mac-menu").removeClass('opened').addClass('hidden'); - this._showShortcut(); - $(".mac-open-iframe").removeClass('hide'); - }, - getLunarObj: function() { - //农历年信息 - let 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, - 0x0d4a0, 0x1d8a6, 0x0b550, 0x056a0, 0x1a5b4, 0x025d0, 0x092d0, 0x0d2b2, 0x0a950, - 0x0b557, - 0x06ca0, 0x0b550, 0x15355, 0x04da0, 0x0a5d0, 0x14573, 0x052d0, 0x0a9a8, 0x0e950, - 0x06aa0, - 0x0aea6, 0x0ab50, 0x04b60, 0x0aae4, 0x0a570, 0x05260, 0x0f263, 0x0d950, 0x05b57, - 0x056a0, - 0x096d0, 0x04dd5, 0x04ad0, 0x0a4d0, 0x0d4d4, 0x0d250, 0x0d558, 0x0b540, 0x0b5a0, - 0x195a6, - 0x095b0, 0x049b0, 0x0a974, 0x0a4b0, 0x0b27a, 0x06a50, 0x06d40, 0x0af46, 0x0ab60, - 0x09570, - 0x04af5, 0x04970, 0x064b0, 0x074a3, 0x0ea50, 0x06b58, 0x055c0, 0x0ab60, 0x096d5, - 0x092e0, - 0x0c960, 0x0d954, 0x0d4a0, 0x0da50, 0x07552, 0x056a0, 0x0abb7, 0x025d0, 0x092d0, - 0x0cab5, - 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 - ]; - let Animals = ["鼠", "牛", "虎", "兔", "龙", "蛇", "马", "羊", "猴", "鸡", "狗", "猪"]; - let Gan = ["甲", "乙", "丙", "丁", "戊", "己", "庚", "辛", "壬", "癸"]; - let Zhi = ["子", "丑", "寅", "卯", "辰", "巳", "午", "未", "申", "酉", "戌", "亥"]; + //属性绑定 + Macui._bind_open_windows(); + }, + setBgUrl: function (bgs) { + this._bgs = bgs; + this._checkBgUrls(); + }, + setBg: function (bgs) { + this._bgs = bgs; + this._checkBgUrls(); + }, + menuClose: function () { + $("#mac-menu").removeClass('opened').addClass('hidden'); + this._showShortcut(); + $(".mac-open-iframe").removeClass('hide'); + }, + getLunarObj: function () { + //农历年信息 + let 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, + 0x0d4a0, 0x1d8a6, 0x0b550, 0x056a0, 0x1a5b4, 0x025d0, 0x092d0, 0x0d2b2, 0x0a950, + 0x0b557, + 0x06ca0, 0x0b550, 0x15355, 0x04da0, 0x0a5d0, 0x14573, 0x052d0, 0x0a9a8, 0x0e950, + 0x06aa0, + 0x0aea6, 0x0ab50, 0x04b60, 0x0aae4, 0x0a570, 0x05260, 0x0f263, 0x0d950, 0x05b57, + 0x056a0, + 0x096d0, 0x04dd5, 0x04ad0, 0x0a4d0, 0x0d4d4, 0x0d250, 0x0d558, 0x0b540, 0x0b5a0, + 0x195a6, + 0x095b0, 0x049b0, 0x0a974, 0x0a4b0, 0x0b27a, 0x06a50, 0x06d40, 0x0af46, 0x0ab60, + 0x09570, + 0x04af5, 0x04970, 0x064b0, 0x074a3, 0x0ea50, 0x06b58, 0x055c0, 0x0ab60, 0x096d5, + 0x092e0, + 0x0c960, 0x0d954, 0x0d4a0, 0x0da50, 0x07552, 0x056a0, 0x0abb7, 0x025d0, 0x092d0, + 0x0cab5, + 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 + ]; + let Animals = ["鼠", "牛", "虎", "兔", "龙", "蛇", "马", "羊", "猴", "鸡", "狗", "猪"]; + let Gan = ["甲", "乙", "丙", "丁", "戊", "己", "庚", "辛", "壬", "癸"]; + let Zhi = ["子", "丑", "寅", "卯", "辰", "巳", "午", "未", "申", "酉", "戌", "亥"]; - //==== 传回农历 y年的总天数 - function lYearDays(y) { - let i, sum = 348 - for (i = 0x8000; i > 0x8; i >>= 1) sum += (lunarInfo[y - 1900] & i) ? 1 : 0 - return (sum + leapDays(y)) - } + //==== 传回农历 y年的总天数 + function lYearDays(y) { + let i, sum = 348 + 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)) - return ((lunarInfo[y - 1900] & 0x10000) ? 30 : 29) - else - return (0) - } + //==== 传回农历 y年闰月的天数 + function leapDays(y) { + if (leapMonth(y)) + return ((lunarInfo[y - 1900] & 0x10000) ? 30 : 29) + else + return (0) + } - //==== 传回农历 y年闰哪个月 1-12 , 没闰传回 0 - function leapMonth(y) { - return (lunarInfo[y - 1900] & 0xf); - } + //==== 传回农历 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); - } + //==== 传回农历 y年m月的总天数 + function monthDays(y, m) { + return ((lunarInfo[y - 1900] & (0x10000 >> m)) ? 30 : 29); + } - //==== 算出农历, 传入日期物件, 传回农历日期物件 - // 该物件属性有 .year .month .day .isLeap .yearCyl .dayCyl .monCyl - function Lunar(objDate) { - let i, leap = 0, - temp = 0 - let baseDate = new Date(1900, 0, 31) - let offset = (objDate - baseDate) / 86400000 + //==== 算出农历, 传入日期物件, 传回农历日期物件 + // 该物件属性有 .year .month .day .isLeap .yearCyl .dayCyl .monCyl + function Lunar(objDate) { + let i, leap = 0, + temp = 0 + let baseDate = new Date(1900, 0, 31) + let offset = (objDate - baseDate) / 86400000 - this.dayCyl = offset + 40 - this.monCyl = 14 + this.dayCyl = offset + 40 + this.monCyl = 14 - for (i = 1900; i < 2050 && offset > 0; i++) { - temp = lYearDays(i) - offset -= temp - this.monCyl += 12 - } - if (offset < 0) { - offset += temp; - i--; - this.monCyl -= 12 - } + for (i = 1900; i < 2050 && offset > 0; i++) { + temp = lYearDays(i) + offset -= temp + this.monCyl += 12 + } + if (offset < 0) { + offset += temp; + i--; + this.monCyl -= 12 + } - this.year = i - this.yearCyl = i - 1864 + this.year = i + this.yearCyl = i - 1864 - leap = leapMonth(i) //闰哪个月 - this.isLeap = false + leap = leapMonth(i) //闰哪个月 + this.isLeap = false - for (i = 1; i < 13 && offset > 0; i++) { - //闰月 - if (leap > 0 && i === (leap + 1) && this.isLeap === false) { - --i; - this.isLeap = true; - temp = leapDays(this.year); - } else { - temp = monthDays(this.year, i); - } + for (i = 1; i < 13 && offset > 0; i++) { + //闰月 + if (leap > 0 && i === (leap + 1) && this.isLeap === false) { + --i; + this.isLeap = true; + temp = leapDays(this.year); + } else { + temp = monthDays(this.year, i); + } - //解除闰月 - if (this.isLeap === true && i === (leap + 1)) this.isLeap = false + //解除闰月 + if (this.isLeap === true && i === (leap + 1)) this.isLeap = false - offset -= temp - if (this.isLeap === false) this.monCyl++ - } + offset -= temp + if (this.isLeap === false) this.monCyl++ + } - if (offset === 0 && leap > 0 && i === leap + 1) - if (this.isLeap) { - this.isLeap = false; - } else { - this.isLeap = true; - --i; - --this.monCyl; - } + if (offset === 0 && leap > 0 && i === leap + 1) + 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 - } + this.month = i + this.day = offset + 1 + } - //获取农历(月)中文格式 - function get_lunar_month(month) { - let fm = ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "腊月"]; - return fm[month - 1]; - } + //获取农历(月)中文格式 + function get_lunar_month(month) { + let fm = ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "腊月"]; + return fm[month - 1]; + } - //获取农历(日)中文格式 - function get_lunar_day(day) { - let fd = ["十", "一", "二", "三", "四", "五", "六", "七", "八", "九", "十"]; - if (day <= 10) { - return "初" + fd[day]; - } else if (day < 20) { - return "十" + fd[day - 10]; - } else if (day === 20) { - return "二十"; - } else if (day < 30) { - return "廿" + fd[day - 20]; - } else { - return "三" + fd[day - 30]; - } - } + //获取农历(日)中文格式 + function get_lunar_day(day) { + let fd = ["十", "一", "二", "三", "四", "五", "六", "七", "八", "九", "十"]; + if (day <= 10) { + return "初" + fd[day]; + } else if (day < 20) { + return "十" + fd[day - 10]; + } else if (day === 20) { + return "二十"; + } else if (day < 30) { + return "廿" + fd[day - 20]; + } else { + return "三" + fd[day - 30]; + } + } - //获取干支 - function get_ganzhi(year) { - let num = year - 1900 + 36; - return (Gan[num % 10] + Zhi[num % 12]); - } + //获取干支 + function get_ganzhi(year) { + let num = year - 1900 + 36; + return (Gan[num % 10] + Zhi[num % 12]); + } - //获取生肖 - function get_animal(year) { - return Animals[(year - 4) % 12]; - } + //获取生肖 + function get_animal(year) { + return Animals[(year - 4) % 12]; + } - //获取周 - function get_weekday(date) { - let values = ["周日", "周一", "周二", "周三", "周四", "周五", "周六"]; - return values[date.getDay()]; - } + //获取周 + function get_weekday(date) { + let values = ["周日", "周一", "周二", "周三", "周四", "周五", "周六"]; + return values[date.getDay()]; + } - //获取星期 - function get_week(date) { - let values = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"]; - return values[date.getDay()]; - } + //获取星期 + function get_week(date) { + let values = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"]; + return values[date.getDay()]; + } - //获取分钟 - function get_min(date) { - let mins = date.getMinutes(); - if (mins < 10) { - mins = '0' + mins - } - return mins; - } + //获取分钟 + function get_min(date) { + let mins = date.getMinutes(); + if (mins < 10) { + mins = '0' + mins + } + return mins; + } - //获取小时 - function get_hour(date) { - let hour = date.getHours(); - let hours; - 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; - } + //获取小时 + function get_hour(date) { + let hour = date.getHours(); + let hours; + 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; + } - let viewdate = {}; - let date = new Date(); - //秒 - viewdate.second = date.getSeconds(); - //分钟 - viewdate.minute = get_min(date); - //小时 - viewdate.hour = get_hour(date); - //日期 - viewdate.day = date.getDate(); - //星期 - viewdate.week = get_week(date); - //星期 - viewdate.weekDay = get_weekday(date); - //月 - viewdate.month = date.getMonth() + 1; - //完整的年份(4位,1970-????) - viewdate.fullYear = date.getFullYear(); - //年份(2位) - viewdate.year = date.getYear(); - //农历信息 - let lunar_obj = new Lunar(date); - //农历中文月 - viewdate.lunarmonth = get_lunar_month(lunar_obj.month); - //农历中文日 - let lunar_day = Math.floor(lunar_obj.day); - viewdate.lunarday = get_lunar_day(lunar_day); - //农历年月日 - viewdate.lunar = lunar_obj.year + "-" + lunar_obj.month + "-" + lunar_day; - //干支 - viewdate.ganzhi = get_ganzhi(lunar_obj.year); - //生肖 - viewdate.animal = get_animal(lunar_obj.year); + let viewdate = {}; + let date = new Date(); + //秒 + viewdate.second = date.getSeconds(); + //分钟 + viewdate.minute = get_min(date); + //小时 + viewdate.hour = get_hour(date); + //日期 + viewdate.day = date.getDate(); + //星期 + viewdate.week = get_week(date); + //星期 + viewdate.weekDay = get_weekday(date); + //月 + viewdate.month = date.getMonth() + 1; + //完整的年份(4位,1970-????) + viewdate.fullYear = date.getFullYear(); + //年份(2位) + viewdate.year = date.getYear(); + //农历信息 + let lunar_obj = new Lunar(date); + //农历中文月 + viewdate.lunarmonth = get_lunar_month(lunar_obj.month); + //农历中文日 + let lunar_day = Math.floor(lunar_obj.day); + viewdate.lunarday = get_lunar_day(lunar_day); + //农历年月日 + viewdate.lunar = lunar_obj.year + "-" + lunar_obj.month + "-" + lunar_day; + //干支 + viewdate.ganzhi = get_ganzhi(lunar_obj.year); + //生肖 + viewdate.animal = get_animal(lunar_obj.year); - return viewdate; - }, - //launchpad渲染 - renderLaunchpad: function() { - $("#launchpad").removeClass("hidden").addClass("show").show(); - $("#mac-shortcuts").addClass('shortcuts-hidden'); //隐藏图标 - this.renderDocks(); //渲染DOCK - }, - //close Launchpad - closeLaunchpad: function() { - $("#launchpad").removeClass("show").addClass("hidden").hide(); - }, - //消息中心渲染 - renderCommand: function(todayHtml = null) { - let active = $("#mac_command_center .command-body.today").hasClass('active'); - if (!active) { - if (!todayHtml) { - let lunarDate = Macui.getLunarObj(); - todayHtml = '
    \n' + - '
    ' + lunarDate.month + '月' + - lunarDate.day + '日 \n' + lunarDate.week + '
    \n' + - '
    ' + lunarDate.ganzhi + '年' + - lunarDate.lunarmonth + lunarDate.lunarday + '
    \n' + - '
    \n' + - '
    ' + - '
    ' + - ' \n' + - ' 天气\n' + - '
    \n' + - '
    \n' + - ' \n' + - '
    \n' + - '
    \n'; - } - $("#mac_command_center .command-body.today").html(todayHtml).addClass('active'); - } - }, - menuOpen: function() { - $("#mac-menu").addClass('opened').removeClass('hidden'); - //this._hideShortcut(); //不关闭 - $(".mac-open-iframe").addClass('hide'); - }, - menuToggle: function() { - if (!$("#mac-menu").hasClass('opened')) { - this.menuOpen(); - } else { - this.menuClose(); - } - }, - commandCenterClose: function() { - $("#mac_command_center").addClass('hidden_right'); - this._showShortcut(); - $(".mac-open-iframe").removeClass('hide'); - }, - commandCenterOpen: function() { - $("#mac_command_center").removeClass('hidden_right'); - //this._hideShortcut(); - $(".mac-open-iframe").addClass('hide'); - $("#mac-msg-nof").removeClass('on-new-msg fa-commenting-o'); - }, - renderShortcuts: function() { - if (!this.isSmallScreen()) { - //大屏执行pc的布局也就是竖排靠右对齐,小屏幕执行移动端也就是横向排列 - let h = parseInt(($("#mac #mac-shortcuts")[0].offsetHeight - 90) / 100); - let w = 0; - //计算一列最大几个图标,公式是(桌面图标界面的大小 - 顶部状态栏和底部dock栏的尺寸)/单个图标高度所占的尺寸 - let x = 0, - y = 0; - $("#mac #mac-shortcuts .shortcut").each(function() { - $(this).css({ - right: x * 82 + 10, - left: 'auto', - top: y * 100 + 10, - }); - y++; - if (y >= h) { - y = 0; - x++; - } - }); - } else { - //小屏幕执行横屏 - let w = parseInt(($("#mac #mac-shortcuts")[0].offsetWidth - 10) / 82); - let x = 0, - y = 0; - $("#mac #mac-shortcuts .shortcut").each(function() { - $(this).css({ - left: x * 82 + 10, - right: 0, - top: y * 100 + 10, - }); - x++; - if (x >= w) { - x = 0; - y++; - } - }); - } - }, - //渲染DOCK - renderDocks: function() { - let cell_width = 50; - let width = document.body.clientWidth; - let docks = $(".dock .dock-container a"); - let max_num = parseInt((width - 40) / (cell_width + 25)) - 1; - for (let i = 0; i <= docks.length; i++) { - if (i >= max_num) { - docks.eq(i).hide(); - } else { - docks.eq(i).show(); - } - } - if (width > 768) { - $('#dock').Fisheye({ - maxWidth: 70, - items: 'a', - itemsText: 'span', - container: '.dock-container', - itemWidth: 50, - proximity: 80, - alignment: 'left', - valign: 'bottom', - halign: 'center' - }) - } else { - $('.dock-container').css({ - 'width': width - }); - for (let i = 0; i < max_num; i++) { + return viewdate; + }, + //launchpad渲染 + renderLaunchpad: function () { + $("#launchpad").removeClass("hidden").addClass("show").show(); + $("#mac-shortcuts").addClass('shortcuts-hidden'); //隐藏图标 + this.renderDocks(); //渲染DOCK + }, + //close Launchpad + closeLaunchpad: function () { + $("#launchpad").removeClass("show").addClass("hidden").hide(); + }, + //消息中心渲染 + renderCommand: function (todayHtml = null) { + let active = $("#mac_command_center .command-body.today").hasClass('active'); + if (!active) { + if (!todayHtml) { + let lunarDate = Macui.getLunarObj(); + todayHtml = '
    \n' + + '
    ' + lunarDate.month + '月' + + lunarDate.day + '日 \n' + lunarDate.week + '
    \n' + + '
    ' + lunarDate.ganzhi + '年' + + lunarDate.lunarmonth + lunarDate.lunarday + '
    \n' + + '
    \n' + + '
    ' + + '
    ' + + ' \n' + + ' 天气\n' + + '
    \n' + + '
    \n' + + ' \n' + + '
    \n' + + '
    \n'; + } + $("#mac_command_center .command-body.today").html(todayHtml).addClass('active'); + } + }, + menuOpen: function () { + $("#mac-menu").addClass('opened').removeClass('hidden'); + //this._hideShortcut(); //不关闭 + $(".mac-open-iframe").addClass('hide'); + }, + menuToggle: function () { + if (!$("#mac-menu").hasClass('opened')) { + this.menuOpen(); + } else { + this.menuClose(); + } + }, + commandCenterClose: function () { + $("#mac_command_center").addClass('hidden_right'); + this._showShortcut(); + $(".mac-open-iframe").removeClass('hide'); + }, + commandCenterOpen: function () { + $("#mac_command_center").removeClass('hidden_right'); + //this._hideShortcut(); + $(".mac-open-iframe").addClass('hide'); + $("#mac-msg-nof").removeClass('on-new-msg fa-commenting-o'); + }, + renderShortcuts: function () { + if (!this.isSmallScreen()) { + //大屏执行pc的布局也就是竖排靠右对齐,小屏幕执行移动端也就是横向排列 + let h = parseInt(($("#mac #mac-shortcuts")[0].offsetHeight - 90) / 100); + let w = 0; + //计算一列最大几个图标,公式是(桌面图标界面的大小 - 顶部状态栏和底部dock栏的尺寸)/单个图标高度所占的尺寸 + let x = 0, + y = 0; + $("#mac #mac-shortcuts .shortcut").each(function () { + $(this).css({ + right: x * 82 + 10, + left: 'auto', + top: y * 100 + 10, + }); + y++; + if (y >= h) { + y = 0; + x++; + } + }); + } else { + //小屏幕执行横屏 + let w = parseInt(($("#mac #mac-shortcuts")[0].offsetWidth - 10) / 82); + let x = 0, + y = 0; + $("#mac #mac-shortcuts .shortcut").each(function () { + $(this).css({ + left: x * 82 + 10, + right: 0, + top: y * 100 + 10, + }); + x++; + if (x >= w) { + x = 0; + y++; + } + }); + } + }, + //渲染DOCK + renderDocks: function () { + let cell_width = 50; + let width = document.body.clientWidth; + let docks = $(".dock .dock-container a"); + let max_num = width / cell_width - 1; + for (let i = 0; i <= docks.length; i++) { + if (i >= max_num) { + docks.eq(i).hide(); + } else { + docks.eq(i).show(); + } + } + if (width > 768) { + $('#dock').Fisheye({ + maxWidth: 70, + items: 'a', + itemsText: 'span', + container: '.dock-container', + itemWidth: 50, + proximity: 80, + alignment: 'left', + valign: 'bottom', + halign: 'center' + }) + } else { + for (let i = 0; i <= max_num; i++) { + docks.on('mouseover', function (e) { + e.preventDefault(); + }); + docks.on('mouseout', function (e) { + e.preventDefault(); + }); + docks.on('click', function (e) { + e.preventDefault(); + }); + docks.unbind("mouseover").unbind('mouseout').unbind('click').css({ + "width": cell_width + }); + if (i === 0) { + docks.eq(i).css("margin-left", 0); + } + } + } + }, + commandCenterToggle: function () { + if ($("#mac_command_center").hasClass('hidden_right')) { + this.commandCenterOpen(); + } else { + this.commandCenterClose(); + } + }, + newMsg: function (title, content, handle_click, app_name = '提示消息', app_icon = + '', is_del = true) { + let msg = '
    ' + + '
    ' + + '' + app_icon + '' + + '' + app_name + ''; + if (is_del) { + msg += ''; + } + msg += '
    ' + + '
    ' + + '
    ' + + '
    ' + title + '
    ' + + '
    ' + content + '
    ' + + '
    '; + let e = $(msg); + $("#mac_command_center .msgs").prepend(e); + e.find('.content:first,.title:first').click(function () { + if (handle_click) { + handle_click(e); + } + }); + layer.tips(Macui.lang('新消息:', 'New message:') + title, '#mac_btn_command', { + tips: [1, 'rgba(0, 0, 0, 0.7)'], + time: 3000 + }); + if ($("#mac_command_center").hasClass('hidden_right')) { + $("#mac-msg-nof").addClass('on-new-msg'); + } + }, + getLayeroByIndex: function (index) { + return $('#' + 'layui-layer' + index) + }, + isSmallScreen: function (size) { + if (!size) { + size = 768 + } + let width = document.body.clientWidth; + return width < size; + }, + enableFullScreen: function () { + let docElm = document.documentElement; + //W3C + if (docElm.requestFullscreen) { + docElm.requestFullscreen(); + } + //FireFox + else if (docElm.mozRequestFullScreen) { + docElm.mozRequestFullScreen(); + } + //Chrome等 + else if (docElm.webkitRequestFullScreen) { + docElm.webkitRequestFullScreen(); + } + //IE11 + else if (docElm.msRequestFullscreen) { + document.body.msRequestFullscreen(); + } + }, + disableFullScreen: function () { + if (document.exitFullscreen) { + document.exitFullscreen(); + } else if (document.mozCancelFullScreen) { + document.mozCancelFullScreen(); + } else if (document.webkitCancelFullScreen) { + document.webkitCancelFullScreen(); + } else if (document.msExitFullscreen) { + document.msExitFullscreen(); + } + }, + buildList: function () { + $("#mac-menu .list .sub-item").slideUp(); + $("#mac-menu .list .item").each(function () { + if ($(this).next().hasClass('sub-item')) { + $(this).addClass('has-sub-down'); + $(this).removeClass('has-sub-up'); + } + }) + }, + openUrl: function (url, icon, title, areaAndOffset) { + if (this._countTask > 12) { + layer.msg("您打开的太多了,歇会儿吧~"); + return false; + } else { + this._countTask++; + } + if (!url) { + url = '404' + } + url = url.replace(/(^\s*)|(\s*$)/g, ""); + let preg = /^(https?:\/\/|\.\.?\/|\/\/?)/; + if (!preg.test(url)) { + url = 'http://' + url; + } + if (!url) { + url = '//yuri2.cn'; + } + if (!title) { + title = url; + } + let area, offset; + if (this.isSmallScreen() || areaAndOffset === 'max') { + area = ['100%', (document.body.clientHeight - 24) + 'px']; + offset = ['24px', '0']; + } else if (typeof areaAndOffset === 'object') { + area = areaAndOffset[0]; + offset = areaAndOffset[1]; + } else { + area = ['80%', '80%']; + let topset, leftset; + topset = parseInt($(window).height()); + 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']; + } + let index = layer.open({ + type: 2, + shadeClose: true, + shade: false, + maxmin: true, //开启最大化最小化按钮 + title: icon + title, + content: url, + area: area, + offset: offset, + isOutAnim: false, + skin: 'mac-open-iframe', + cancel: function (index, layero) { + $("#mac_" + index).remove(); + Macui._checkTop(); + Macui._countTask--; //回退countTask数 + Macui._renderBar(); + }, + min: function (layero) { + layero.hide(); + $("#mac_" + index).removeClass('show'); + Macui._checkTop(); + return false; + }, + full: function (layero) { + layero.find('.layui-layer-min').css('display', 'inline-block'); + layero_opened.css('top', 24); + }, + }); + $('#mac_btn_group_middle .btn.active').removeClass('active'); + let btn = $('
    ' + icon + '
    '); + let layero_opened = Macui.getLayeroByIndex(index); + layero_opened.css('z-index', Macui._countTask + 813); + Macui._settop(layero_opened); + //重新定义菜单布局 + layero_opened.find('.layui-layer-setwin').prepend(''); + //菜单排列倒序 + layero_opened.find(".layui-layer-setwin>a").each(function () { + $(this).prependTo(layero_opened.find(".layui-layer-setwin")); + }) + layero_opened.find('.layui-layer-setwin .layui-layer-max').click(function () { + setTimeout(function () { + let height = layero_opened.css('height'); + height = parseInt(height.replace('px', '')); + if (height >= document.body.clientHeight) { + layero_opened.css('height', height - 25); + layero_opened.find('.layui-layer-content').css('height', height - + 55); + layero_opened.find('.layui-layer-content iframe').css('height', + height - 55); + } + }, 300); - docks.on('mouseover', function(e) { - e.preventDefault(); - }); - docks.on('mouseout', function(e) { - e.preventDefault(); - }); - docks.on('click', function(e) { - e.preventDefault(); - }); - docks.unbind("mouseover").unbind('mouseout').unbind('click').css({ - "width": cell_width - }); - if (i === 0) { - docks.eq(i).css("margin-left", 0); - } - } - } - }, - commandCenterToggle: function() { - if ($("#mac_command_center").hasClass('hidden_right')) { - this.commandCenterOpen(); - } else { - this.commandCenterClose(); - } - }, - newMsg: function(title, content, handle_click, app_name = '提示消息', app_icon = - '', is_del = true) { - let msg = '
    ' + - '
    ' + - '' + app_icon + '' + - '' + app_name + ''; - if (is_del) { - msg += ''; - } - msg += '
    ' + - '
    ' + - '
    ' + - '
    ' + title + '
    ' + - '
    ' + content + '
    ' + - '
    '; - let e = $(msg); - $("#mac_command_center .msgs").prepend(e); - e.find('.content:first,.title:first').click(function() { - if (handle_click) { - handle_click(e); - } - }); - layer.tips(Macui.lang('新消息:', 'New message:') + title, '#mac_btn_command', { - tips: [1, 'rgba(0, 0, 0, 0.7)'], - time: 3000 - }); - if ($("#mac_command_center").hasClass('hidden_right')) { - $("#mac-msg-nof").addClass('on-new-msg'); - } - }, - getLayeroByIndex: function(index) { - return $('#' + 'layui-layer' + index) - }, - isSmallScreen: function(size) { - if (!size) { - size = 768 - } - let width = document.body.clientWidth; - return width < size; - }, - enableFullScreen: function() { - let docElm = document.documentElement; - //W3C - if (docElm.requestFullscreen) { - docElm.requestFullscreen(); - } - //FireFox - else if (docElm.mozRequestFullScreen) { - docElm.mozRequestFullScreen(); - } - //Chrome等 - else if (docElm.webkitRequestFullScreen) { - docElm.webkitRequestFullScreen(); - } - //IE11 - else if (docElm.msRequestFullscreen) { - document.body.msRequestFullscreen(); - } - }, - disableFullScreen: function() { - if (document.exitFullscreen) { - document.exitFullscreen(); - } else if (document.mozCancelFullScreen) { - document.mozCancelFullScreen(); - } else if (document.webkitCancelFullScreen) { - document.webkitCancelFullScreen(); - } else if (document.msExitFullscreen) { - document.msExitFullscreen(); - } - }, - buildList: function() { - $("#mac-menu .list .sub-item").slideUp(); - $("#mac-menu .list .item").each(function() { - if ($(this).next().hasClass('sub-item')) { - $(this).addClass('has-sub-down'); - $(this).removeClass('has-sub-up'); - } - }) - }, - openUrl: function(url, icon, title, areaAndOffset) { - if (this._countTask > 12) { - layer.msg("您打开的太多了,歇会儿吧~"); - return false; - } else { - this._countTask++; - } - if (!url) { - url = '404' - } - url = url.replace(/(^\s*)|(\s*$)/g, ""); - let preg = /^(https?:\/\/|\.\.?\/|\/\/?)/; - if (!preg.test(url)) { - url = 'http://' + url; - } - if (!url) { - url = '//yuri2.cn'; - } - if (!title) { - title = url; - } - let area, offset; - if (this.isSmallScreen() || areaAndOffset === 'max') { - area = ['100%', (document.body.clientHeight - 24) + 'px']; - offset = ['24px', '0']; - } else if (typeof areaAndOffset === 'object') { - area = areaAndOffset[0]; - offset = areaAndOffset[1]; - } else { - area = ['80%', '80%']; - let topset, leftset; - topset = parseInt($(window).height()); - 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']; - } - let index = layer.open({ - type: 2, - shadeClose: true, - shade: false, - maxmin: true, //开启最大化最小化按钮 - title: icon + title, - content: url, - area: area, - offset: offset, - isOutAnim: false, - skin: 'mac-open-iframe', - cancel: function(index, layero) { - $("#mac_" + index).remove(); - Macui._checkTop(); - Macui._countTask--; //回退countTask数 - Macui._renderBar(); - }, - min: function(layero) { - layero.hide(); - $("#mac_" + index).removeClass('show'); - Macui._checkTop(); - return false; - }, - full: function(layero) { - layero.find('.layui-layer-min').css('display', 'inline-block'); - layero_opened.css('top', 24); - }, - }); - $('#mac_btn_group_middle .btn.active').removeClass('active'); - let btn = $('
    ' + icon + '
    '); - let layero_opened = Macui.getLayeroByIndex(index); - layero_opened.css('z-index', Macui._countTask + 813); - Macui._settop(layero_opened); - //重新定义菜单布局 - layero_opened.find('.layui-layer-setwin').prepend(''); - //菜单排列倒序 - layero_opened.find(".layui-layer-setwin>a").each(function() { - $(this).prependTo(layero_opened.find(".layui-layer-setwin")); - }) - layero_opened.find('.layui-layer-setwin .layui-layer-max').click(function() { - setTimeout(function() { - let height = layero_opened.css('height'); - height = parseInt(height.replace('px', '')); - if (height >= document.body.clientHeight) { - layero_opened.css('height', height - 25); - layero_opened.find('.layui-layer-content').css('height', height - - 55); - layero_opened.find('.layui-layer-content iframe').css('height', - height - 55); - } - }, 300); - - }); - $("#mac_btn_group_middle").append(btn); - Macui._renderBar(); - btn.click(function() { - let index = $(this).attr('index'); - let layero = Macui.getLayeroByIndex(index); - let settop = function() { - //置顶窗口 - let max_zindex = 0; - $(".mac-open-iframe").each(function() { - z = parseInt($(this).css('z-index')); - $(this).css('z-index', z - 1); - if (z > max_zindex) { - max_zindex = z; - } - }); - layero.css('z-index', max_zindex + 1); - }; - if ($(this).hasClass('show')) { - if ($(this).hasClass('active')) { - $(this).removeClass('active'); - $(this).removeClass('show'); - Macui._checkTop(); - layero.hide(); - } else { - $('#mac_btn_group_middle .btn.active').removeClass('active'); - $(this).addClass('active'); - Macui._settop(layero); - } - } else { - $(this).addClass('show'); - $('#mac_btn_group_middle .btn.active').removeClass('active'); - $(this).addClass('active'); - Macui._settop(layero); - layero.show(); - } - }); + }); + $("#mac_btn_group_middle").append(btn); + Macui._renderBar(); + btn.click(function () { + let index = $(this).attr('index'); + let layero = Macui.getLayeroByIndex(index); + let settop = function () { + //置顶窗口 + let max_zindex = 0; + $(".mac-open-iframe").each(function () { + z = parseInt($(this).css('z-index')); + $(this).css('z-index', z - 1); + if (z > max_zindex) { + max_zindex = z; + } + }); + layero.css('z-index', max_zindex + 1); + }; + if ($(this).hasClass('show')) { + if ($(this).hasClass('active')) { + $(this).removeClass('active'); + $(this).removeClass('show'); + Macui._checkTop(); + layero.hide(); + } else { + $('#mac_btn_group_middle .btn.active').removeClass('active'); + $(this).addClass('active'); + Macui._settop(layero); + } + } else { + $(this).addClass('show'); + $('#mac_btn_group_middle .btn.active').removeClass('active'); + $(this).addClass('active'); + Macui._settop(layero); + layero.show(); + } + }); - Macui._iframeOnClick.track(layero_opened.find('iframe:first')[0], function() { - if (Object.getOwnPropertyNames(Macui._iframe_click_lock_children).length === 0) { - Macui._settop(layero_opened); - Macui._checkTop(); - } else { - console.log('click locked'); - } - }); + Macui._iframeOnClick.track(layero_opened.find('iframe:first')[0], function () { + if (Object.getOwnPropertyNames(Macui._iframe_click_lock_children).length === 0) { + Macui._settop(layero_opened); + Macui._checkTop(); + } else { + console.log('click locked'); + } + }); - this.menuClose(); - this.commandCenterClose(); - this.closeLaunchpad(); - return index; - }, - closeAll: function() { - $(".mac-open-iframe").remove(); - $("#mac_btn_group_middle").html(""); - Macui._countTask = 0; - Macui._renderBar(); - }, - setAnimated: function(animated_classes, animated_liveness) { - this._animated_classes = animated_classes; - this._animated_liveness = animated_liveness; - }, - exit: function() { - layer.confirm(Macui.lang('确认要关闭本页吗?', 'Are you sure you want to close this page?'), { - icon: 3, - title: Macui.lang('提示', 'Prompt') - }, function(index) { - document.body.onbeforeunload = function() {}; - window.location.href = "about:blank"; - window.close(); - layer.close(index); - layer.alert(Macui.lang('哎呀,好像失败了呢。', 'Ops...There seems to be a little problem.'), { - skin: 'layui-layer-lan', - closeBtn: 0 - }); - }); + this.menuClose(); + this.commandCenterClose(); + this.closeLaunchpad(); + return index; + }, + closeAll: function () { + $(".mac-open-iframe").remove(); + $("#mac_btn_group_middle").html(""); + Macui._countTask = 0; + Macui._renderBar(); + }, + setAnimated: function (animated_classes, animated_liveness) { + this._animated_classes = animated_classes; + this._animated_liveness = animated_liveness; + }, + exit: function () { + layer.confirm(Macui.lang('确认要关闭本页吗?', 'Are you sure you want to close this page?'), { + icon: 3, + title: Macui.lang('提示', 'Prompt') + }, function (index) { + document.body.onbeforeunload = function () { + }; + window.location.href = "about:blank"; + window.close(); + layer.close(index); + layer.alert(Macui.lang('哎呀,好像失败了呢。', 'Ops...There seems to be a little problem.'), { + skin: 'layui-layer-lan', + closeBtn: 0 + }); + }); - }, - lang: function(cn, en) { - return this._lang === 'zh-cn' || this._lang === 'zh-tw' ? cn : en; - }, - aboutUs: function() { - //关于我们 - layer.open({ - type: 1, - closeBtn: 1, //不显示关闭按钮 - anim: 2, - skin: 'mac-open-iframe', - title: 'MAC-UI ' + this._version, - shadeClose: true, //开启遮罩关闭 - area: ['320px', '200px'], //宽高 - content: '
    ' + - '

    支持组件:layer、jquery、animated.css、font-awesome

    ' + - '

    木子的忧伤、尤里2号©版权所有

    ' + - '

    作者邮箱:1099438829@qq.com

    ' + - '
    ' - }); - }, - setContextMenu: function(jq_dom, menu) { - if (typeof(jq_dom) === 'string') { - jq_dom = $(jq_dom); - } - jq_dom.unbind('contextmenu'); - jq_dom.on('contextmenu', function(e) { - if (menu) { - Macui._renderContextMenu(e.clientX, e.clientY, menu, this); - if (e.cancelable) { - // 判断默认行为是否已经被禁用 - if (!e.defaultPrevented) { - e.preventDefault(); - } - } - e.stopPropagation(); - } - }); - }, - hideWins: function() { - $('#mac_btn_group_middle>.btn.show').each(function() { - let index = $(this).attr('index'); - let layero = Macui.getLayeroByIndex(index); - $(this).removeClass('show'); - $(this).removeClass('active'); - layero.hide(); - }) - }, - showWins: function() { - $('#mac_btn_group_middle>.btn').each(function() { - let index = $(this).attr('index'); - let layero = Macui.getLayeroByIndex(index); - $(this).addClass('show'); - layero.show(); - }); - Macui._checkTop(); - }, - getDesktopScene: function() { - return $("#mac-desktop-scene"); - }, - onReady: function(handle) { - Macui._handleReady.push(handle); - } + }, + lang: function (cn, en) { + return this._lang === 'zh-cn' || this._lang === 'zh-tw' ? cn : en; + }, + aboutUs: function () { + //关于我们 + layer.open({ + type: 1, + closeBtn: 1, //不显示关闭按钮 + anim: 2, + skin: 'mac-open-iframe', + title: 'MAC-UI ' + this._version, + shadeClose: true, //开启遮罩关闭 + area: ['320px', '200px'], //宽高 + content: '
    ' + + '

    支持组件:layer、jquery、animated.css、font-awesome

    ' + + '

    木子的忧伤、尤里2号©版权所有

    ' + + '

    作者邮箱:1099438829@qq.com

    ' + + '
    ' + }); + }, + setContextMenu: function (jq_dom, menu) { + if (typeof (jq_dom) === 'string') { + jq_dom = $(jq_dom); + } + jq_dom.unbind('contextmenu'); + jq_dom.on('contextmenu', function (e) { + if (menu) { + Macui._renderContextMenu(e.clientX, e.clientY, menu, this); + if (e.cancelable) { + // 判断默认行为是否已经被禁用 + if (!e.defaultPrevented) { + e.preventDefault(); + } + } + e.stopPropagation(); + } + }); + }, + hideWins: function () { + $('#mac_btn_group_middle>.btn.show').each(function () { + let index = $(this).attr('index'); + let layero = Macui.getLayeroByIndex(index); + $(this).removeClass('show'); + $(this).removeClass('active'); + layero.hide(); + }) + }, + showWins: function () { + $('#mac_btn_group_middle>.btn').each(function () { + let index = $(this).attr('index'); + let layero = Macui.getLayeroByIndex(index); + $(this).addClass('show'); + layero.show(); + }); + Macui._checkTop(); + }, + getDesktopScene: function () { + return $("#mac-desktop-scene"); + }, + onReady: function (handle) { + Macui._handleReady.push(handle); + } }; -$(function() { - Macui._init(); - for (let i in Macui._handleReady) { - let handle = Macui._handleReady[i]; - handle(); - } +$(function () { + Macui._init(); + for (let i in Macui._handleReady) { + let handle = Macui._handleReady[i]; + handle(); + } });