//该插件提供桌面图标二级分类的支持
Macui.onReady(function () {
//注册打开事件
(function () {
// 注册事件委派 打开url窗口
$('body').on('click', '.shortcut-drawer.mac-open-window', function () {
//>> 获取当前点击的对象
$this = $(this);
//>> 判断url地址是否为空 如果为空 不予处理
if ($this.data('url') !== "") {
//>> 获取弹窗标题
var title = $this.data('title') || '',
areaAndOffset, icon;
//>> 判断是否有标题图片
var 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(areaAndOsffset);
}
}
//>> 调用win10打开url方法
Macui.openUrl($this.data('url'), icon, title, areaAndOffset);
}
})
})();
$('body').on('click', '.mac-drawer', function () {
var content = $(this).find('.mac-drawer-box').html();
var title = $(this).children('.title').html();
var index = layer.open({
type: 1,
shadeClose: true,
skin: 'drawer',
area: Macui.isSmallScreen() ? "80%" : "60%",
closeBtn: 0,
title: title,
content: content,
});
var layero = Macui.getLayeroByIndex(index);
layero.find('.shortcut-drawer').click(function () {
layer.close(index);
})
})
});