This commit is contained in:
季圣华
2016-10-30 16:49:51 +08:00
parent b796dce5cc
commit 943f1ecf05
115 changed files with 2305 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 771 B

View File

@@ -0,0 +1,41 @@
#topcontrol{z-index:999}
#topcontrol a{display:block;width:54px;height:41px;background:url(scrolltotop.gif) no-repeat 0 0}
#topcontrol a:hover{display:block;width:54px;height:41px;background:url(scrolltotop.gif) no-repeat -54px 0}
.zeng_msgbox_layer,
.zeng_msgbox_layer .gtl_ico_succ,
.zeng_msgbox_layer .gtl_ico_fail,
.zeng_msgbox_layer .gtl_ico_hits,
.zeng_msgbox_layer .gtl_ico_clear,
.zeng_msgbox_layer .gtl_end{display:inline-block;height:54px;line-height:54px;font-weight:bold;font-size:14px;color:#606060;background-image:url(gb_tip_layer.png);_background-image:url(gb_tip_layer_ie6.png);background-repeat:no-repeat}
.zeng_msgbox_layer_wrap{width:100%;position:fixed;_position:absolute;top:46%;left:0;text-align:center;z-index:65533}
.zeng_msgbox_layer{background-position:0 -161px;background-repeat:repeat-x;padding:0 18px 0 9px;margin:0 auto;position:relative}
.zeng_msgbox_layer .gtl_ico_succ{background-position:-6px 0;left:-45px;top:0;width:45px;position:absolute}
.zeng_msgbox_layer .gtl_end{background-position:0 0;position:absolute;right:-6px;top:0;width:6px}
.zeng_msgbox_layer .gtl_ico_fail{background-position:-6px -108px;position:absolute;left:-45px;top:0;width:45px}
.zeng_msgbox_layer .gtl_ico_hits{background-position:-6px -54px;position:absolute;left:-45px;top:0;width:45px}
.zeng_msgbox_layer .gtl_ico_clear{background-position:-6px 0;left:-5px;width:5px;position:absolute;top:0}
.zeng_msgbox_layer .gtl_ico_loading{width:16px;height:16px;border:0;background-image:url(gb_tip_loading.gif);float:left;margin:19px 10px 0 5px}
.colorTip{display:none;position:absolute;left:50%;top:-30px;padding:6px;background-color:white;font-family:Arial,Helvetica,sans-serif;font-size:11px;font-style:normal;line-height:1;text-decoration:none;text-align:center;text-shadow:0 0 1px white;white-space:nowrap;-moz-border-radius:4px;-webkit-border-radius:4px;border-radius:4px}
.pointyTip,.pointyTipShadow{border:6px solid transparent;bottom:-12px;height:0;left:50%;margin-left:-6px;position:absolute;width:0}
.pointyTipShadow{border-width:7px;bottom:-14px;margin-left:-7px}
.colorTipContainer{position:relative;text-decoration:none!important}
.white .pointyTip{border-top-color:white}
.white .pointyTipShadow{border-top-color:#ddd}
.white .colorTip{background-color:white;border:1px solid #ddd;color:#555}
.yellow .pointyTip{border-top-color:#f9f2ba}
.yellow .pointyTipShadow{border-top-color:#e9d315}
.yellow .colorTip{background-color:#f9f2ba;border:1px solid #e9d315;color:#5b5316}
.blue .pointyTip{border-top-color:#d9f1fb}
.blue .pointyTipShadow{border-top-color:#7fcdee}
.blue .colorTip{background-color:#d9f1fb;border:1px solid #7fcdee;color:#1b475a}
.green .pointyTip{border-top-color:#f2fdf1}
.green .pointyTipShadow{border-top-color:#b6e184}
.green .colorTip{background-color:#f2fdf1;border:1px solid #b6e184;color:#558221}
.red .pointyTip{border-top-color:#bb3b1d}
.red .pointyTipShadow{border-top-color:#8f2a0f}
.red .colorTip{background-color:#bb3b1d;border:1px solid #8f2a0f;color:#fcfcfc;text-shadow:none}
.black .pointyTip{border-top-color:#333}
.black .pointyTipShadow{border-top-color:#111}
.black .colorTip{background-color:#333;border:1px solid #111;color:#fcfcfc;text-shadow:none}

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@@ -0,0 +1,25 @@
/*
** HoorayOS开源桌面应用框架
** 作者:胡尐睿丶
** 地址http://hoorayos.com
** 我希望能将这项目继续开源下去,所以请手下留情,保留以上这段版权信息,授权用户可删除代码中任何信息
*/
var TEMP = {};
var HROS = {};
HROS.CONFIG = {
appButtonTop : 20, //快捷方式top初始位置
appButtonLeft : 20, //快捷方式left初始位置
windowIndexid : 10000, //窗口z-index初始值
widgetIndexid : 1, //挂件z-index初始值
windowMinWidth : 215, //窗口最小宽度
windowMinHeight : 59, //窗口最小高度
wallpaper : '' //壁纸
};
HROS.VAR = {
zoomLevel : 1,
dock : '',
desk : ''
};

View File

@@ -0,0 +1,170 @@
/*
** 应用
*/
HROS.app = (function(){
return {
/*
** 初始化桌面应用
*/
init : function(){
//绑定应用打开事件
HROS.app.click();
//绑定滚动条拖动事件
HROS.app.moveScrollbar();
HROS.app.get();
},
get : function(){
$.getJSON('../../app/findDesk.action', function (sc) {
HROS.VAR.dock = sc['dock'];
HROS.VAR.desk = sc['desk'];
//输出桌面应用
HROS.app.set();
});
},
/*
** 输出应用
*/
set : function(){
//绘制应用表格
var grid = HROS.grid.getAppGrid(), dockGrid = HROS.grid.getDockAppGrid();
//加载应用码头应用
if(HROS.VAR.dock != ''){
var dock_append = '';
$(HROS.VAR.dock).each(function(i){
dock_append += appbtnTemp({
'top' : dockGrid[i]['startY'],
'left' : dockGrid[i]['startX'],
'title' : this.title,
'type' : this.type,
'id' : 'd_' + this.id,
'appid' : this.id,
'imgsrc' : this.icon
});
});
$('#dock-bar .dock-applist').html('').append(dock_append);
}else{
$('#dock-bar .dock-applist').html('');
}
//加载桌面应用
if(HROS.VAR.desk != ''){
var desk_append = '';
$(HROS.VAR.desk).each(function(i){
desk_append += appbtnTemp({
'top' : grid[i]['startY'] + 7,
'left' : grid[i]['startX'] + 16,
'title' : this.title,
'type' : this.type,
'id' : 'd_' + this.id,
'appid' : this.id,
'imgsrc' : this.icon
});
});
}
$('#desk-1 li').remove();
$('#desk-1').append(desk_append);
HROS.deskTop.appresize();
//加载滚动条
HROS.app.getScrollbar();
},
/*
** 应用打开
*/
click : function(){
//应用码头应用拖动
$('#dock-bar .dock-applist').on('click', 'li', function(e){
e.preventDefault();
e.stopPropagation();
switch($(this).attr('type')){
case 'app':
HROS.window.create($(this).attr('appid'));
break;
case 'widget':
HROS.widget.create($(this).attr('appid'));
break;
}
});
//桌面应用拖动
$('#desktop .desktop-container').on('click', 'li:not(.add)', function(e){
e.preventDefault();
e.stopPropagation();
switch($(this).attr('type')){
case 'app':
HROS.window.create($(this).attr('appid'));
break;
case 'widget':
HROS.widget.create($(this).attr('appid'));
break;
}
});
},
/*
** 加载滚动条
*/
getScrollbar : function(){
setTimeout(function(){
$('#desk .desktop-container').each(function(){
var desk = $(this), scrollbar = desk.children('.scrollbar');
//先清空所有附加样式
scrollbar.hide();
desk.scrollLeft(0);
var deskW = parseInt(desk.children('.appbtn').last().css('left')) + 106;
if(desk.width() / deskW < 1){
desk.children('.scrollbar-x').width(desk.width() / deskW * desk.width()).css('left',0).show();
}
});
}, 500);
},
/*
** 移动滚动条
*/
moveScrollbar : function(){
/*
** 手动拖动
*/
$('#desk .scrollbar').on('mousedown', function(e){
var x, y, cx, cy, deskrealw, deskrealh, movew, moveh;
var scrollbar = $(this), desk = scrollbar.parent('.desktop-container');
deskrealw = parseInt(desk.children('.appbtn').last().css('left')) + 106;
deskrealh = parseInt(desk.children('.appbtn').last().css('top')) + 108;
movew = desk.width() - scrollbar.width();
moveh = desk.height() - scrollbar.height();
if(scrollbar.hasClass('scrollbar-x')){
x = e.clientX - scrollbar.offset().left;
}else{
y = e.clientY - scrollbar.offset().top;
}
$(document).on('mousemove', function(e){
if(scrollbar.hasClass('scrollbar-x')){
cx = e.clientX - x - 73 < 0 ? 0 : e.clientX - x - 73 > movew ? movew : e.clientX - x - 73;
scrollbar.css('left', cx / desk.width() * deskrealw + cx);
desk.scrollLeft(cx / desk.width() * deskrealw);
}else{
cy = e.clientY - y < 0 ? 0 : e.clientY - y > moveh ? moveh : e.clientY - y;
scrollbar.css('top', cy / desk.height() * deskrealh + cy);
desk.scrollTop(cy / desk.height() * deskrealh);
}
}).on('mouseup', function(){
$(this).off('mousemove').off('mouseup');
});
});
/*
** 鼠标滚动
*/
$('#desk .desktop-container').each(function(i){
$('#desk-' + (i + 1)).on('mousewheel', function(event, delta){
var desk = $(this);
var deskrealw = parseInt(desk.children('.appbtn').last().css('left')) + 106, scrollleftright;
if(delta < 0){
scrollleftright = desk.scrollLeft() + 200 > deskrealw - desk.width() ? deskrealw - desk.width() : desk.scrollLeft() + 200;
}else{
scrollleftright = desk.scrollLeft() - 200 < 0 ? 0 : desk.scrollLeft() - 200;
}
desk.stop(false, true).animate({scrollLeft : scrollleftright}, 300);
desk.children('.scrollbar-x').stop(false, true).animate({
left : scrollleftright / deskrealw * desk.width() + scrollleftright
}, 300);
});
});
}
}
})();

View File

@@ -0,0 +1,44 @@
/*
** 一个不属于其他模块的模块
*/
HROS.base = (function(){
return {
/*
** 系统初始化
*/
init : function(){
//阻止弹出浏览器默认右键菜单
$('body').on('contextmenu', function(){
return false;
});
//用于判断网页是否缩放
HROS.zoom.init();
//桌面(容器)初始化
HROS.deskTop.init();
//初始化壁纸
HROS.wallpaper.init();
//初始化任务栏
HROS.taskbar.init();
/*
** 当dockPos为top时 当dockPos为left时 当dockPos为right时
** ----------------------- ----------------------- -----------------------
** | o o o dock | | o | o | | o | o |
** ----------------------- | o | o | | o | o |
** | o o | | o | o | | o | o |
** | o + | | | o | | o | |
** | o desk | | | o desk | | o desk | |
** | o | | | + | | + | |
** ----------------------- ----------------------- -----------------------
** 因为desk区域的尺寸和定位受dock位置的影响所以加载应用前必须先定位好dock的位置
*/
//初始化应用码头
HROS.dock.init();
//初始化桌面应用
HROS.app.init();
//初始化widget模块
HROS.widget.init();
//初始化窗口模块
HROS.window.init();
}
}
})();

View File

@@ -0,0 +1,101 @@
/*
** 桌面
*/
HROS.deskTop = (function(){
return {
init : function(){
//绑定浏览器resize事件
$(window).on('resize', function(){
HROS.deskTop.resize();
});
$('body').on('click', '#desktop', function(){
HROS.popupMenu.hide();
}).on('contextmenu', '#desktop', function(e){
HROS.popupMenu.hide();
return false;
});
},
/*
** 处理浏览器改变大小后的事件
*/
resize : function(){
HROS.dock.setPos();
//更新应用定位
HROS.deskTop.appresize();
//更新窗口定位
HROS.deskTop.windowresize();
HROS.wallpaper.set(false);
},
/*
** 重新排列应用
*/
appresize : function(){
switch(HROS.CONFIG.appSize){
case 's':
$('#desk').removeClass('smallIcon').addClass('smallIcon');
break;
case 'm':
$('#desk').removeClass('smallIcon');
break;
}
var grid = HROS.grid.getAppGrid(), dockGrid = HROS.grid.getDockAppGrid();
$('#dock-bar .dock-applist li').each(function(i){
$(this).css({
'left' : dockGrid[i]['startX'],
'top' : dockGrid[i]['startY']
});
$(this).attr('left', $(this).offset().left).attr('top', $(this).offset().top);
});
$('#desk-1 li').each(function(i){
var left = grid[i]['startX'] + 16, top = grid[i]['startY'] + 7;
$(this).stop(true, false).animate({
'left' : left,
'top' : top
}, 500);
switch(HROS.CONFIG.dockPos){
case 'top':
$(this).attr('left', left).attr('top', top + 73);
break;
case 'left':
$(this).attr('left', left + 73).attr('top', top);
break;
case 'right':
$(this).attr('left', left).attr('top', top);
break;
}
});
//更新滚动条
HROS.app.getScrollbar();
},
/*
** 重新定位窗口位置
*/
windowresize : function(){
$('#desk div.window-container').each(function(){
var windowdata = $(this).data('info');
currentW = $(window).width() - $(this).width();
currentH = $(window).height() - $(this).height();
var _l = windowdata['left'] / windowdata['emptyW'] * currentW >= currentW ? currentW : windowdata['left'] / windowdata['emptyW'] * currentW;
_l = _l <= 0 ? 0 : _l;
var _t = windowdata['top'] / windowdata['emptyH'] * currentH >= currentH ? currentH : windowdata['top'] / windowdata['emptyH'] * currentH;
_t = _t <= 0 ? 0 : _t;
if($(this).attr('state') != 'hide'){
$(this).animate({
'left' : _l,
'top' : _t
}, 500, function(){
windowdata['left'] = _l;
windowdata['top'] = _t;
windowdata['emptyW'] = $(window).width() - $(this).width();
windowdata['emptyH'] = $(window).height() - $(this).height();
});
}else{
windowdata['left'] = _l;
windowdata['top'] = _t;
windowdata['emptyW'] = $(window).width() - $(this).width();
windowdata['emptyH'] = $(window).height() - $(this).height();
}
});
}
}
})();

View File

@@ -0,0 +1,37 @@
/*
** 应用码头
*/
HROS.dock = (function(){
return {
/*
** 初始化
*/
init : function(){
$(window).resize(function(){
HROS.dock.setPos();
});
HROS.dock.setPos();
},
setPos : function(){
var desktop = $('#desk-1'), desktops = $('#desk .desktop-container');
var desk_w = desktop.css('width', '100%').width(), desk_h = desktop.css('height', '100%').height();
//清除dock位置样式
$('#dock-container').removeClass('dock-top').removeClass('dock-left').removeClass('dock-right');
$('#dock-bar').removeClass('top-bar').removeClass('left-bar').removeClass('right-bar').hide();
$('#dock-bar').addClass('left-bar').children('#dock-container').addClass('dock-left');
desktops.css({
'width' : desk_w - 73,
'height' : desk_h - 70,
'left' : desk_w + 73,
'top' : 0
});
desktop.css({
'left' : 73
});
$('#dock-bar').show();
HROS.taskbar.resize();
}
}
})();

View File

@@ -0,0 +1,83 @@
/*
** 应用布局格子
** 这篇文章里有简单说明格子的作用
** http://www.cnblogs.com/hooray/archive/2012/03/23/2414410.html
*/
HROS.grid = (function(){
return {
getAppGrid : function(){
var width, height;
width = $('#desk-1').width() - HROS.CONFIG.appButtonLeft;
height = $('#desk-1').height() - HROS.CONFIG.appButtonTop;
var appGrid = [], _top = HROS.CONFIG.appButtonTop, _left = HROS.CONFIG.appButtonLeft;
for(var i = 0; i < 10000; i++){
appGrid.push({
startY : _top,
endY : _top + 100,
startX : _left,
endX : _left + 120
});
_top += 100;
if(_top + 70 > height){
_top = HROS.CONFIG.appButtonTop;
_left += 120;
}
}
return appGrid;
},
searchAppGrid : function(x, y){
var grid = HROS.grid.getAppGrid(), j = grid.length;
var flags = 0, appLength = $('#desk-1 li.appbtn:not(.add)').length - 1;
for(var i = 0; i < j; i++){
if(x >= grid[i].startX && x <= grid[i].endX){
flags += 1;
}
if(y >= grid[i].startY && y <= grid[i].endY){
flags += 1;
}
if(flags === 2){
return i > appLength ? appLength : i;
}else{
flags = 0;
}
}
return null;
},
getDockAppGrid : function(){
var height = $('#dock-bar .dock-applist').height();
var dockAppGrid = [], _left = 0, _top = 0;
for(var i = 0; i < 7; i++){
dockAppGrid.push({
startY : _top,
endY : _top + 62,
startX : _left,
endX : _left + 62
});
_top += 62;
if(_top + 62 > height){
_top = 0;
_left += 62;
}
}
return dockAppGrid;
},
searchDockAppGrid : function(x, y){
var grid = HROS.grid.getDockAppGrid(), j = grid.length, flags = 0,
appLength = $('#dock-bar .dock-applist li').length - 1;
for(var i = 0; i < j; i++){
if(x >= grid[i].startX && x <= grid[i].endX){
flags += 1;
}
if(y >= grid[i].startY && y <= grid[i].endY){
flags += 1;
}
if(flags === 2){
return i > appLength ? appLength : i;
}else{
flags = 0;
}
}
return null;
}
}
})();

View File

@@ -0,0 +1,16 @@
/*
** 透明遮罩层
** 当拖动应用、窗口等一切可拖动的对象时,会加载一个遮罩层
** 避免拖动时触发或选中一些不必要的操作,安全第一
*/
HROS.maskBox = (function(){
return {
desk : function(){
if(!TEMP.maskBoxDesk){
TEMP.maskBoxDesk = $('<div id="maskbox"></div>');
$('body').append(TEMP.maskBoxDesk);
}
return TEMP.maskBoxDesk;
}
}
})();

View File

@@ -0,0 +1,37 @@
/*
** 右键菜单
*/
HROS.popupMenu = (function(){
return {
/*
** 任务栏右键
*/
task : function(obj){
HROS.window.show2under();
if(!TEMP.popupMenuTask){
TEMP.popupMenuTask = $('<div class="popup-menu task-menu" style="z-index:9990;display:none"><ul><li><a menu="max" href="javascript:;">最大化</a></li><li style="border-bottom:1px solid #F0F0F0"><a menu="hide" href="javascript:;">最小化</a></li><li><a menu="close" href="javascript:;">关闭</a></li></ul></div>');
$('body').append(TEMP.popupMenuTask);
$('.task-menu').on('contextmenu', function(){
return false;
});
}
//绑定事件
$('.task-menu a[menu="max"]').off('click').on('click', function(){
HROS.window.max(obj.attr('appid'), obj.attr('type'));
$('.popup-menu').hide();
});
$('.task-menu a[menu="hide"]').off('click').on('click', function(){
HROS.window.hide(obj.attr('appid'), obj.attr('type'));
$('.popup-menu').hide();
});
$('.task-menu a[menu="close"]').off('click').on('click', function(){
HROS.window.close(obj.attr('appid'), obj.attr('type'));
$('.popup-menu').hide();
});
return TEMP.popupMenuTask;
},
hide : function(){
$('.popup-menu').hide();
}
}
})();

View File

@@ -0,0 +1,93 @@
/*
** 任务栏
*/
HROS.taskbar = (function(){
return {
/*
** 初始化
*/
init : function(){
//当浏览器窗口改变大小时,任务栏的显示也需进行刷新
$(window).on('resize', function(){
HROS.taskbar.resize();
});
//绑定任务栏点击事件
HROS.taskbar.click();
//绑定任务栏前进后退按钮事件
HROS.taskbar.pageClick();
},
click : function(){
$('#task-content-inner').on('click', 'a.task-item', function(){
if($(this).hasClass('task-item-current')){
HROS.window.hide($(this).attr('appid'));
}else{
HROS.window.show2top($(this).attr('appid'));
}
}).on('contextmenu', 'a.task-item', function(e){
HROS.popupMenu.hide();
var popupmenu = HROS.popupMenu.task($(this));
var l = $(window).width() - e.clientX < popupmenu.width() ? e.clientX - popupmenu.width() : e.clientX;
var t = e.clientY - popupmenu.height();
popupmenu.css({
left : l,
top : t
}).show();
return false;
});
},
pageClick : function(){
$('#task-next-btn').on('click', function(){
if($(this).hasClass('disable') == false){
var w = $('#task-bar').width(), realW = $('#task-content-inner .task-item').length * 114, showW = w - 112, overW = realW - showW;
var marginL = parseInt($('#task-content-inner').css('margin-left')) - 114;
if(marginL <= overW * -1){
marginL = overW * -1;
$('#task-next a').addClass('disable');
}
$('#task-pre a').removeClass('disable');
$('#task-content-inner').animate({
marginLeft : marginL
}, 200);
}
});
$('#task-pre-btn').on('click', function(){
if($(this).hasClass('disable') == false){
var marginL = parseInt($('#task-content-inner').css('margin-left')) + 114;
if(marginL >= 0){
marginL = 0;
$('#task-pre a').addClass('disable');
}
$('#task-next a').removeClass('disable');
$('#task-content-inner').animate({
marginLeft : marginL
}, 200);
}
});
},
resize : function(){
$('#task-content-inner').removeClass('fl');
$('#task-bar').css({
'left' : 73,
'right' : 0
});
var w = $('#task-bar').width(), realW = $('#task-content-inner .task-item').length * 114, showW = w - 112;
$('#task-content-inner').css('width', realW);
if(realW >= showW){
$('#task-next, #task-pre').show();
$('#task-content').css('width', showW);
$('#task-content-inner').addClass('fl').stop(true, false).animate({
marginLeft : 0
}, 200);
$('#task-next a').removeClass('disable');
$('#task-pre a').addClass('disable');
}else{
$('#task-next, #task-pre').hide();
$('#task-content').css('width','100%');
$('#task-content-inner').css({
'margin-left' : 0,
'margin-right' : 0
});
}
}
}
})();

View File

@@ -0,0 +1,38 @@
/*
** 壁纸
*/
HROS.wallpaper = (function(){
return {
/*
** 初始化
*/
init : function(){
HROS.wallpaper.set();
},
/*
** 设置壁纸
*/
set : function(isreload){
/*
** 判断壁纸是否需要重新载入
** 比如当浏览器尺寸改变时,只需更新壁纸,而无需重新载入
*/
var isreload = typeof(isreload) == 'undefined' ? true : isreload;
if(isreload){
$('#zoomWallpaperGrid').remove();
}
var w = $(window).width(), h = $(window).height();
if(isreload){
$('body').append('<div id="zoomWallpaperGrid" style="position:absolute;z-index:-10;left:0;top:0;overflow:hidden;height:' + h + 'px;width:' + w + 'px"><img id="zoomWallpaper" style="position:absolute;height:' + h + 'px;width:' + w + 'px;top:0;left:0"><div style="position:absolute;height:' + h + 'px;width:' + w + 'px;background:#fff;opacity:0;filter:alpha(opacity=0)"></div></div>');
$('#zoomWallpaper').attr('src', HROS.CONFIG.wallpaper).on('load', function(){
$(this).show();
});
}else{
$('#zoomWallpaperGrid, #zoomWallpaperGrid div, #zoomWallpaper').css({
height : h + 'px',
width : w + 'px'
});
}
}
}
})();

View File

@@ -0,0 +1,156 @@
/*
** 小挂件
*/
HROS.widget = (function(){
return {
init : function(){
//挂件上各个按钮
HROS.widget.handle();
//挂件移动
HROS.widget.move();
},
/*
** 创建挂件
** 自定义挂件HROS.widget.createTemp({url,width,height,left,top});
** 示例HROS.widget.createTemp({url:"http://www.baidu.com",width:800,height:400,left:100,top:100});
*/
createTemp : function(obj){
var appid = obj.appid == null ? Date.parse(new Date()) : obj.appid;
//判断窗口是否已打开
var iswidgetopen = false;
$('#desk .widget').each(function(){
if($(this).attr('appid') == appid){
iswidgetopen = true;
return false;
}
});
//如果没有打开,则进行创建
if(!iswidgetopen){
function nextDo(options){
$('#desk').append(widgetWindowTemp({
'width' : options.width,
'height' : options.height,
'type' : 'widget',
'id' : 'w_' + options.appid,
'appid' : options.appid,
'top' : options.top,
'right' : options.right,
'url' : options.url,
'zIndex' : HROS.CONFIG.widgetIndexid
}));
HROS.CONFIG.widgetIndexid += 1;
}
nextDo({
appid : appid,
url : obj.url,
width : obj.width,
height : obj.height,
top : obj.top == null ? 0 : obj.top,
right : obj.right == null ? 0 : obj.right
});
}
},
create : function(appid){
//判断窗口是否已打开
var iswidgetopen = false;
$('#desk .widget').each(function(){
if($(this).attr('appid') == appid){
iswidgetopen = true;
return false;
}
});
//如果没有打开,则进行创建
if(!iswidgetopen){
function nextDo(options){
var widgetId = '#w_' + options.appid;
TEMP.widgetTemp = {
'title' : options.title,
'width' : options.width,
'height' : options.height,
'type' : options.type,
'id' : 'w_' + options.appid,
'appid' : options.appid,
'top' : options.top,
'right' : options.right,
'url' : options.url,
'zIndex' : HROS.CONFIG.widgetIndexid,
'issetbar' : 1
};
$('#desk').append(widgetWindowTemp(TEMP.widgetTemp));
$(widgetId).data('info', TEMP.widgetTemp);
HROS.CONFIG.widgetIndexid += 1;
}
$(HROS.VAR.dock).each(function(){
if(this.id == appid){
nextDo({
appid : this.id,
title : this.title,
url : this.url,
type : this.type,
width : this.width,
height : this.height,
top : typeof(this.top) == 'undefined' ? 0 : this.top,
right : typeof(this.right) == 'undefined' ? 0 : this.right
});
}
});
$(HROS.VAR.desk).each(function(){
if(this.id == appid){
nextDo({
appid : this.id,
title : this.title,
url : this.url,
type : this.type,
width : this.width,
height : this.height,
top : typeof(this.top) == 'undefined' ? 0 : this.top,
right : typeof(this.right) == 'undefined' ? 0 : this.right
});
}
});
}
},
move : function(){
$('#desk').on('mousedown', '.widget .move', function(e){
var obj = $(this).parents('.widget');
HROS.widget.show2top(obj.attr('appid'));
var lay, x, y;
x = e.clientX - obj.offset().left;
y = e.clientY - obj.offset().top;
//绑定鼠标移动事件
$(document).on('mousemove', function(e){
lay = HROS.maskBox.desk();
lay.show();
_r = e.clientX - x;
_t = e.clientY - y;
_t = _t < 0 ? 0 : _t;
_r = $(window).width() - obj.width() - _r;
obj.css({
right : _r,
top : _t
});
}).on('mouseup', function(){
$(this).off('mousemove').off('mouseup');
if(typeof(lay) !== 'undefined'){
lay.hide();
}
});
});
},
close : function(appid){
var widgetId = '#w_' + appid;
$(widgetId).html('').remove();
},
show2top : function(appid){
var widgetId = '#w_' + appid;
$(widgetId).css('z-index', HROS.CONFIG.widgetIndexid);
HROS.CONFIG.widgetIndexid += 1;
},
handle : function(){
$('#desk').on('click', '.widget .ha-close', function(e){
var obj = $(this).parents('.widget');
HROS.widget.close(obj.attr('appid'));
});
}
}
})();

View File

@@ -0,0 +1,608 @@
/*
** 应用窗口
*/
HROS.window = (function(){
return {
init : function(){
//窗口上各个按钮
HROS.window.handle();
//窗口移动
HROS.window.move();
//窗口拉伸
HROS.window.resize();
//绑定窗口遮罩层点击事件
$('#desk').on('click', '.window-container .window-mask', function(){
HROS.window.show2top($(this).parents('.window-container').attr('appid'), true);
});
//屏蔽窗口右键
$('#desk').on('contextmenu', '.window-container', function(){
return false;
});
},
/*
** 创建窗口
** 自定义窗口HROS.window.createTemp({title,url,width,height,top,left,resize,isflash});
** 后面参数依次为标题、地址、宽、高、是否可拉伸、是否打开默认最大化、是否为flash
** 示例HROS.window.createTemp({title:"百度",url:"http://www.baidu.com",width:800,height:400,top:0,left:100,isresize:false,isopenmax:false,isflash:false});
*/
createTemp : function(obj){
var type = 'app', appid = obj.appid == null ? Date.parse(new Date()) : obj.appid;
//判断窗口是否已打开
var iswindowopen = false;
$('#task-content-inner a.task-item').each(function(){
if($(this).attr('appid') == appid){
iswindowopen = true;
HROS.window.show2top($(this).attr('appid'));
return false;
}
});
//如果没有打开,则进行创建
if(!iswindowopen){
function nextDo(options){
var windowId = '#w_' + options.appid;
//新增任务栏
$('#task-content-inner').prepend(taskTemp({
'type' : options.type,
'id' : 't_' + options.appid,
'appid' : options.appid,
'title' : options.title,
'imgsrc' : options.imgsrc
}));
HROS.taskbar.resize();
//新增窗口
TEMP.windowTemp = {
'width' : options.width,
'height' : options.height,
'top' : options.top,
'left' : options.left,
'emptyW' : $(window).width() - options.width,
'emptyH' : $(window).height() - options.height,
'zIndex' : HROS.CONFIG.windowIndexid,
'type' : options.type,
'id' : 'w_' + options.appid,
'appid' : options.appid,
'title' : options.title,
'url' : options.url,
'imgsrc' : options.imgsrc,
'isresize' : options.isresize,
'isopenmax' : options.isopenmax,
'istitlebar' : options.isresize,
'istitlebarFullscreen' : options.isresize ? window.fullScreenApi.supportsFullScreen == true ? true : false : false,
'isflash' : options.isflash
};
$('#desk').append(windowTemp(TEMP.windowTemp));
$(windowId).data('info', TEMP.windowTemp);
HROS.CONFIG.windowIndexid += 1;
//iframe加载完毕后隐藏loading遮罩层
$(windowId + ' iframe').load(function(){
$(windowId + ' .window-frame').children('div').eq(1).fadeOut();
});
HROS.window.show2top(options.appid);
}
nextDo({
type : type,
appid : appid,
imgsrc : 'img/ui/default_icon.png',
title : obj.title,
url : obj.url,
width : obj.width,
height : obj.height,
top : typeof(obj.top) == 'undefined' ? (($(window).height() - obj.height) / 2 <= 0 ? 0 : ($(window).height() - obj.height) / 2) : obj.top,
left : typeof(obj.left) == 'undefined' ? (($(window).width() - obj.width) / 2 <= 0 ? 0 : ($(window).width() - obj.width) / 2) : obj.left,
isresize : typeof(obj.isresize) == 'undefined' ? false : obj.isresize,
isopenmax : typeof(obj.isopenmax) == 'undefined' ? false : obj.isopenmax,
isflash : typeof(obj.isflash) == 'undefined' ? true : obj.isflash
});
}else{
//如果设置强制刷新
if(obj.refresh){
var windowId = '#w_' + appid;
$(windowId).find('iframe').attr('src', obj.url);
}
}
},
/*
** 创建窗口
** 系统窗口HROS.window.create(appid);
** 示例HROS.window.create(12);
*/
create : function(appid){
//判断窗口是否已打开
var iswindowopen = false;
$('#task-content-inner a.task-item').each(function(){
if($(this).attr('appid') == appid){
iswindowopen = true;
HROS.window.show2top(appid);
return false;
}
});
//如果没有打开,则进行创建
if(!iswindowopen){
function nextDo(options){
var windowId = '#w_' + options.appid;
//新增任务栏
$('#task-content-inner').prepend(taskTemp({
'type' : options.type,
'id' : 't_' + options.appid,
'appid' : options.appid,
'title' : options.title,
'imgsrc' : options.imgsrc
}));
HROS.taskbar.resize();
//新增窗口
TEMP.windowTemp = {
'width' : options.width,
'height' : options.height,
'top' : options.top,
'left' : options.left,
'emptyW' : $(window).width() - options.width,
'emptyH' : $(window).height() - options.height,
'zIndex' : HROS.CONFIG.windowIndexid,
'type' : options.type,
'id' : 'w_' + options.appid,
'appid' : options.appid,
'title' : options.title,
'url' : options.url,
'imgsrc' : options.imgsrc,
'isresize' : options.isresize == 1 ? true : false,
'isopenmax' : options.isresize == 1 ? options.isopenmax == 1 ? true : false : false,
'istitlebar' : options.isresize == 1 ? true : false,
'istitlebarFullscreen' : options.isresize == 1 ? window.fullScreenApi.supportsFullScreen == true ? true : false : false,
'isflash' : options.isflash == 1 ? true : false
};
$('#desk').append(windowTemp(TEMP.windowTemp));
$(windowId).data('info', TEMP.windowTemp);
HROS.CONFIG.windowIndexid += 1;
//iframe加载完毕后隐藏loading遮罩层
$(windowId + ' iframe').load(function(){
$(windowId + ' .window-frame').children('div').eq(1).fadeOut();
});
HROS.window.show2top(options.appid);
}
$(HROS.VAR.dock).each(function(){
if(this.id == appid){
nextDo({
type : this.type,
id : this.id,
appid : this.id,
title : this.title,
imgsrc : this.icon,
url : this.url,
width : this.width,
height : this.height,
top : typeof(this.top) == 'undefined' ? (($(window).height() - this.height) / 2 <= 0 ? 0 : ($(window).height() - this.height) / 2) : this.top,
left : typeof(this.left) == 'undefined' ? (($(window).width() - this.width) / 2 <= 0 ? 0 : ($(window).width() - this.width) / 2) : this.left,
isresize : this.isresize,
isopenmax : this.isopenmax,
isflash : this.isflash
});
}
});
$(HROS.VAR.desk).each(function(){
if(this.id == appid){
nextDo({
type : this.type,
id : this.id,
appid : this.id,
title : this.title,
imgsrc : this.icon,
url : this.url,
width : this.width,
height : this.height,
top : typeof(this.top) == 'undefined' ? (($(window).height() - this.height) / 2 <= 0 ? 0 : ($(window).height() - this.height) / 2) : this.top,
left : typeof(this.left) == 'undefined' ? (($(window).width() - this.width) / 2 <= 0 ? 0 : ($(window).width() - this.width) / 2) : this.left,
isresize : this.isresize,
isopenmax : this.isopenmax,
isflash : this.isflash
});
}
});
}
},
close : function(appid){
var windowId = '#w_' + appid, taskId = '#t_' + appid;
$(windowId).removeData('info').html('').remove();
$('#task-content-inner ' + taskId).html('').remove();
$('#task-content-inner').css('width', $('#task-content-inner .task-item').length * 114);
$('#task-bar, #nav-bar').removeClass('min-zIndex');
HROS.taskbar.resize();
},
closeAll : function(){
$('#desk .window-container').each(function(){
HROS.window.close($(this).attr('appid'));
});
},
hide : function(appid){
HROS.window.show2top(appid);
var windowId = '#w_' + appid, taskId = '#t_' + appid;
$(windowId).css('left', -10000).attr('state', 'hide');
$('#task-content-inner ' + taskId).removeClass('task-item-current');
if($(windowId).attr('ismax') == 1){
$('#task-bar, #nav-bar').removeClass('min-zIndex');
}
},
hideAll : function(){
$('#task-content-inner a.task-item').removeClass('task-item-current');
$('#desk-1').nextAll('div.window-container').css('left', -10000).attr('state', 'hide');
},
max : function(appid){
HROS.window.show2top(appid);
var windowId = '#w_' + appid, taskId = '#t_' + appid;
$(windowId + ' .title-handle .ha-max').hide().next(".ha-revert").show();
$(windowId).addClass('window-maximize').attr('ismax',1).animate({
width : '100%',
height : '100%',
top : 0,
left : 0
}, 200);
$('#task-bar, #nav-bar').addClass('min-zIndex');
},
revert : function(appid){
HROS.window.show2top(appid);
var windowId = '#w_' + appid, taskId = '#t_' + appid;
$(windowId + ' .title-handle .ha-revert').hide().prev('.ha-max').show();
var obj = $(windowId), windowdata = obj.data('info');
obj.removeClass('window-maximize').attr('ismax',0).animate({
width : windowdata['width'],
height : windowdata['height'],
left : windowdata['left'],
top : windowdata['top']
}, 500);
$('#task-bar, #nav-bar').removeClass('min-zIndex');
},
show2top : function(appid, isanimate){
isanimate = isanimate == null ? false : isanimate;
var windowId = '#w_' + appid, taskId = '#t_' + appid;
var windowdata = $(windowId).data('info');
var arr = [];
function show(){
HROS.window.show2under();
//改变当前任务栏样式
$('#task-content-inner ' + taskId).addClass('task-item-current');
if($(windowId).attr('ismax') == 1){
$('#task-bar, #nav-bar').addClass('min-zIndex');
}
//改变当前窗口样式
$(windowId).addClass('window-current').css({
'z-index' : HROS.CONFIG.windowIndexid,
'left' : windowdata['left'],
'top' : windowdata['top']
}).attr('state', 'show');
//如果窗口最小化前是最大化状态的则坐标位置设为0
if($(windowId).attr('ismax') == 1){
$(windowId).css({
'left' : 0,
'top' : 0
});
}
//改变当前窗口遮罩层样式
$(windowId + ' .window-mask').hide();
//改变当前iframe显示
$(windowId + ' iframe').show();
HROS.CONFIG.windowIndexid += 1;
}
if(isanimate){
var baseStartX = $(windowId).offset().left, baseEndX = baseStartX + $(windowId).width();
var baseStartY = $(windowId).offset().top, baseEndY = baseStartY + $(windowId).height();
var baseCenterX = baseStartX + ($(windowId).width() / 2), baseCenterY = baseStartY + ($(windowId).height() / 2);
var baseZIndex = parseInt($(windowId).css('zIndex'));
$('#desk .window-container:not(' + windowId + ')').each(function(){
var thisStartX = $(this).offset().left, thisEndX = thisStartX + $(this).width();
var thisStartY = $(this).offset().top, thisEndY = thisStartY + $(this).height();
var thisCenterX = thisStartX + ($(this).width() / 2), thisCenterY = thisStartY + ($(this).height() / 2);
var thisZIndex = parseInt($(this).css('zIndex'));
var flag = '';
if(thisZIndex > baseZIndex){
// 常规情况,只要有一个角处于区域内,则可以判断窗口有覆盖
// _______ _______ _______ _______
// | ___|___ ___| | ___|___ | | |___
// | | | | | | | | | | | |
// |___| | | |_______| | |___| |_______| |
// |_______| |_______| |_______| |_______|
if(
(thisStartX >= baseStartX && thisStartX <= baseEndX && thisStartY >= baseStartY && thisStartY <= baseEndY)
||
(thisStartX >= baseStartX && thisStartX <= baseEndX && thisEndY >= baseStartY && thisEndY <= baseEndY)
||
(thisEndX >= baseStartX && thisEndX <= baseEndX && thisStartY >= baseStartY && thisStartY <= baseEndY)
||
(thisEndX >= baseStartX && thisEndX <= baseEndX && thisEndY >= baseStartY && thisEndY <= baseEndY)
){
flag = 'x';
}
// 非常规情况
// _______ _______ _____
// ___| | | |___ _| |___
// | | | | | | | | | |
// |___| | | |___| |_| |___|
// |_______| |_______| |_____|
if(
(thisStartX >= baseStartX && thisStartX <= baseEndX && thisStartY < baseStartY && thisEndY > baseEndY)
||
(thisEndX >= baseStartX && thisEndX <= baseEndX && thisStartY < baseStartY && thisEndY > baseEndY)
){
flag = 'x';
}
// _____ ___________ _____
// __|_____|__ | | _|_____|___
// | | | | | |
// | | |___________| |___________|
// |___________| |_____| |_____|
if(
(thisStartY >= baseStartY && thisStartY <= baseEndY && thisStartX < baseStartX && thisEndX > baseEndX)
||
(thisEndY >= baseStartY && thisEndY <= baseEndY && thisStartX < baseStartX && thisEndX > baseEndX)
){
flag = 'y';
}
// 两个角处于区域内,另外两种情况不用处理,因为这两种情况下,被移动的窗口是需要进行上下滑动,而非左右
// _____ ___________
// __| |__ | _____ |
// | | | | | | | |
// | |_____| | |__| |__|
// |___________| |_____|
if(
(thisStartX >= baseStartX && thisStartX <= baseEndX && thisEndY >= baseStartY && thisEndY <= baseEndY)
&&
(thisEndX >= baseStartX && thisEndX <= baseEndX && thisEndY >= baseStartY && thisEndY <= baseEndY)
||
(thisStartX >= baseStartX && thisStartX <= baseEndX && thisStartY >= baseStartY && thisStartY <= baseEndY)
&&
(thisEndX >= baseStartX && thisEndX <= baseEndX && thisStartY >= baseStartY && thisStartY <= baseEndY)
){
flag = 'y';
}
}
if(flag != ''){
var direction, distance;
if(flag == 'x'){
if(thisCenterX > baseCenterX){
direction = 'right';
distance = baseEndX - thisStartX + 30;
}else{
direction = 'left';
distance = thisEndX - baseStartX + 30;
}
}else{
if(thisCenterY > baseCenterY){
direction = 'bottom';
distance = baseEndY - thisStartY + 30;
}else{
direction = 'top';
distance = thisEndY - baseStartY + 30;
}
}
arr.push({
id : $(this).attr('id'),
direction : direction, //移动方向
distance : distance //移动距离
});
}
});
//开始移动
var delayTime = 0;
for(var i = 0; i < arr.length; i++){
var baseLeft = $('#' + arr[i].id).offset().left, baseTop = $('#' + arr[i].id).offset().top;
if(arr[i].direction == 'left'){
$('#' + arr[i].id).delay(delayTime).animate({
left : baseLeft - arr[i].distance
}, 300).animate({
left : baseLeft
}, 300);
}else if(arr[i].direction == 'right'){
$('#' + arr[i].id).delay(delayTime).animate({
left : baseLeft + arr[i].distance
}, 300).animate({
left : baseLeft
}, 300);
}else if(arr[i].direction == 'top'){
$('#' + arr[i].id).delay(delayTime).animate({
top : baseTop - arr[i].distance
}, 300).animate({
top : baseTop
}, 300);
}else if(arr[i].direction == 'bottom'){
$('#' + arr[i].id).delay(delayTime).animate({
top : baseTop + arr[i].distance
}, 300).animate({
top : baseTop
}, 300);
}
delayTime += 100;
}
setTimeout(show, delayTime + 100);
}else{
show();
}
},
show2under : function(){
//改变任务栏样式
$('#task-content-inner a.task-item').removeClass('task-item-current');
//改变窗口样式
$('#desk .window-container').removeClass('window-current');
//改变窗口遮罩层样式
$('#desk .window-container .window-mask').show();
//改变iframe显示
$('#desk .window-container-flash iframe').hide();
},
handle : function(){
$('#desk').on('dblclick', '.window-container .title-bar', function(e){
var obj = $(this).parents('.window-container');
//判断当前窗口是否已经是最大化
if(obj.find('.ha-max').is(':hidden')){
obj.find('.ha-revert').click();
}else{
obj.find('.ha-max').click();
}
}).on('click', '.window-container .ha-hide', function(){
var obj = $(this).parents('.window-container');
HROS.window.hide(obj.attr('appid'));
}).on('click', '.window-container .ha-max', function(){
var obj = $(this).parents('.window-container');
HROS.window.max(obj.attr('appid'));
}).on('click', '.window-container .ha-revert', function(){
var obj = $(this).parents('.window-container');
HROS.window.revert(obj.attr('appid'));
}).on('click', '.window-container .ha-fullscreen', function(){
var obj = $(this).parents('.window-container');
window.fullScreenApi.requestFullScreen(document.getElementById(obj.find('iframe').attr('id')));
}).on('click', '.window-container .ha-close', function(){
var obj = $(this).parents('.window-container');
HROS.window.close(obj.attr('appid'));
}).on('contextmenu', '.window-container', function(){
$('.popup-menu').hide();
$('.quick_view_container').remove();
return false;
});
},
move : function(){
$('#desk').on('mousedown', '.window-container .title-bar', function(e){
var obj = $(this).parents('.window-container');
if(obj.attr('ismax') == 1){
return false;
}
HROS.window.show2top(obj.attr('appid'));
var windowdata = obj.data('info'), lay, x, y;
x = e.clientX - obj.offset().left;
y = e.clientY - obj.offset().top;
//绑定鼠标移动事件
$(document).on('mousemove', function(e){
lay = HROS.maskBox.desk();
lay.show();
//强制把右上角还原按钮隐藏,最大化按钮显示
obj.find('.ha-revert').hide().prev('.ha-max').show();
_l = e.clientX - x;
_t = e.clientY - y;
_w = windowdata['width'];
_h = windowdata['height'];
//窗口贴屏幕顶部10px内 || 底部60px内
_t = _t <= 10 ? 0 : _t >= lay.height()-30 ? lay.height()-30 : _t;
obj.css({
width : _w,
height : _h,
left : _l,
top : _t
});
obj.data('info').left = obj.offset().left;
obj.data('info').top = obj.offset().top;
}).on('mouseup', function(){
$(this).off('mousemove').off('mouseup');
if(typeof(lay) !== 'undefined'){
lay.hide();
}
});
});
},
resize : function(obj){
$('#desk').on('mousedown', '.window-container .window-resize', function(e){
var obj = $(this).parents('.window-container');
//增加背景遮罩层
var resizeobj = $(this), lay, x = e.clientX, y = e.clientY, w = obj.width(), h = obj.height();
$(document).on('mousemove', function(e){
lay = HROS.maskBox.desk();
lay.show();
_x = e.clientX;
_y = e.clientY;
//当拖动到屏幕边缘时,自动贴屏
_x = _x <= 10 ? 0 : _x >= (lay.width()-12) ? (lay.width()-2) : _x;
_y = _y <= 10 ? 0 : _y >= (lay.height()-12) ? lay.height() : _y;
switch(resizeobj.attr('resize')){
case 't':
h + y - _y > HROS.CONFIG.windowMinHeight ? obj.css({
height : h + y - _y,
top : _y
}) : obj.css({
height : HROS.CONFIG.windowMinHeight
});
break;
case 'r':
w - x + _x > HROS.CONFIG.windowMinWidth ? obj.css({
width : w - x + _x
}) : obj.css({
width : HROS.CONFIG.windowMinWidth
});
break;
case 'b':
h - y + _y > HROS.CONFIG.windowMinHeight ? obj.css({
height : h - y + _y
}) : obj.css({
height : HROS.CONFIG.windowMinHeight
});
break;
case 'l':
w + x - _x > HROS.CONFIG.windowMinWidth ? obj.css({
width : w + x - _x,
left : _x
}) : obj.css({
width : HROS.CONFIG.windowMinWidth
});
break;
case 'rt':
h + y - _y > HROS.CONFIG.windowMinHeight ? obj.css({
height : h + y - _y,
top : _y
}) : obj.css({
height : HROS.CONFIG.windowMinHeight
});
w - x + _x > HROS.CONFIG.windowMinWidth ? obj.css({
width : w - x + _x
}) : obj.css({
width : HROS.CONFIG.windowMinWidth
});
break;
case 'rb':
w - x + _x > HROS.CONFIG.windowMinWidth ? obj.css({
width : w - x + _x
}) : obj.css({
width : HROS.CONFIG.windowMinWidth
});
h - y + _y > HROS.CONFIG.windowMinHeight ? obj.css({
height : h - y + _y
}) : obj.css({
height : HROS.CONFIG.windowMinHeight
});
break;
case 'lt':
w + x - _x > HROS.CONFIG.windowMinWidth ? obj.css({
width : w + x - _x,
left : _x
}) : obj.css({
width : HROS.CONFIG.windowMinWidth
});
h + y - _y > HROS.CONFIG.windowMinHeight ? obj.css({
height : h + y - _y,
top : _y
}) : obj.css({
height : HROS.CONFIG.windowMinHeight
});
break;
case 'lb':
w + x - _x > HROS.CONFIG.windowMinWidth ? obj.css({
width : w + x - _x,
left : _x
}) : obj.css({
width : HROS.CONFIG.windowMinWidth
});
h - y + _y > HROS.CONFIG.windowMinHeight ? obj.css({
height : h - y + _y
}) : obj.css({
height : HROS.CONFIG.windowMinHeight
});
break;
}
}).on('mouseup',function(){
if(typeof(lay) !== 'undefined'){
lay.hide();
}
obj.data('info').width = obj.width();
obj.data('info').height = obj.height();
obj.data('info').left = obj.offset().left;
obj.data('info').top = obj.offset().top;
obj.data('info').emptyW = $(window).width() - obj.width();
obj.data('info').emptyH = $(window).height() - obj.height();
$(this).off('mousemove').off('mouseup');
});
});
}
}
})();

View File

@@ -0,0 +1,43 @@
/*
** 该功能是从QQ空间里提取出来的
** 用于判断页面是否处于缩放状态中,并给予提示
** 可在浏览页时按住ctrl+鼠标滚轮进行测试预览
*/
HROS.zoom = (function(){
return {
/*
** 初始化
** 其实也不用初始化可以直接把object代码写在页面上
** 需要注意的是onchange参数调用的是HROS.zoom.check方法
*/
init : function(){
$('body').append('<div id="zoombox"></div>');
/*
** 使用SWFObject.js插入flash
** http://www.cnblogs.com/wuxinxi007/archive/2009/10/27/1590709.html
*/
swfobject.embedSWF('js/zoom.swf?onchange=HROS.zoom.check', 'zoombox', '10', '10', '6.0.0', 'expressInstall.swf', '', {allowScriptAccess : 'always', wmode : 'transparent', scale : 'noScale'}, {id : 'accessory_zoom', name : 'zoom_detect'});
},
/*
** 为什么会有个参数o其实我也不知道
** o.scale的值是数字当o.scale大于1时页面处于放大状态反之则为缩小状态
*/
check : function(o){
var s = o.scale, m = s > 1 ? '放大' : '缩小';
if(s != 1){
HROS.VAR.zoomLevel = s;
$('#zoom-tip').show().find('span').text('您的浏览器目前处于' + m + '状态会导致显示不正常您可以键盘按“ctrl+数字0”组合键恢复初始状态');
}else{
if(s != HROS.VAR.zoomLevel){
$('#zoom-tip').fadeOut();
}
}
},
/*
** 关闭其实是删除如果想做关闭把代码改成hide()即可
*/
close : function(){
$('#zoom-tip').remove();
}
}
})();

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,66 @@
//桌面应用
var appbtnTemp = template(
'<li class="appbtn" id="<%=id%>" appid="<%=appid%>" type="<%=type%>" top="<%=top%>" left="<%=left%>" style="top:<%=top%>px;left:<%=left%>px">'+
'<div><img src="<%=imgsrc%>" alt="<%=title%>"></div>'+
'<span><%=title%></span>'+
'</li>'
);
//任务栏
var taskTemp = template(
'<a id="<%=id%>" appid="<%=appid%>" type="<%=type%>" class="task-item task-item-current">'+
'<div class="task-item-icon">'+
'<img src="<%=imgsrc%>">'+
'</div>'+
'<div class="task-item-txt"><%=title%></div>'+
'</a>'
);
//小挂件
var widgetWindowTemp = template(
'<div id="<%=id%>" appid="<%=appid%>" type="<%=type%>" class="widget" style="z-index:<%=zIndex%>;width:<%=width%>px;height:<%=height%>px;top:<%=top%>px;right:<%=right%>px">'+
'<div class="move"></div>'+
'<a class="ha-close" href="javascript:;" title="关闭"></a>'+
'<div class="frame">'+
'<iframe src="<%=url%>" frameborder="0" allowtransparency="true"></iframe>'+
'</div>'+
'</div>'
);
//应用窗口
var windowTemp = template(
'<div id="<%=id%>" appid="<%=appid%>" type="<%=type%>" state="show" class="window-container window-current<% if(isflash){ %> window-container-flash<% } %>" style="<% if(isopenmax){ %>width:100%;height:100%;left:0;top:0;<% }else{ %>width:<%=width%>px;height:<%=height%>px;top:<%=top%>px;left:<%=left%>px;<% } %>z-index:<%=zIndex%>" ismax="<% if(isopenmax){ %>1<% }else{ %>0<% } %>">'+
'<div style="height:100%">'+
'<div class="title-bar">'+
'<img class="icon" src="<%=imgsrc%>"><span class="title"><%=title%></span>'+
'</div>'+
'<div class="title-handle">'+
'<a class="ha-hide" btn="hide" href="javascript:;" title="最小化"><b class="hide-b"></b></a>'+
'<% if(istitlebar){ %>'+
'<a class="ha-max" btn="max" href="javascript:;" title="最大化" <% if(isopenmax){ %>style="display:none"<% } %>><b class="max-b"></b></a>'+
'<a class="ha-revert" btn="revert" href="javascript:;" title="还原" <% if(!isopenmax){ %>style="display:none"<% } %>><b class="revert-b"></b><b class="revert-t"></b></a>'+
'<% } %>'+
'<% if(istitlebarFullscreen){ %>'+
'<a class="ha-fullscreen" btn="fullscreen" href="javascript:;" title="全屏">+</a>'+
'<% } %>'+
'<a class="ha-close" btn="close" href="javascript:;" title="关闭">×</a>'+
'</div>'+
'<div class="window-frame">'+
'<% if(isflash){ %>'+
'<div class="window-mask"><div class="maskbg"></div><div>运行中,点击恢复显示 :)</div></div>'+
'<% }else{ %>'+
'<div class="window-mask window-mask-noflash"></div>'+
'<% } %>'+
'<div class="window-loading"></div>'+
'<iframe id="<%=id%>_iframe" frameborder="0" src="<%=url%>"></iframe>'+
'</div>'+
'</div>'+
'<% if(isresize){ %>'+
'<div class="window-resize window-resize-t" resize="t"></div>'+
'<div class="window-resize window-resize-r" resize="r"></div>'+
'<div class="window-resize window-resize-b" resize="b"></div>'+
'<div class="window-resize window-resize-l" resize="l"></div>'+
'<div class="window-resize window-resize-rt" resize="rt"></div>'+
'<div class="window-resize window-resize-rb" resize="rb"></div>'+
'<div class="window-resize window-resize-lt" resize="lt"></div>'+
'<div class="window-resize window-resize-lb" resize="lb"></div>'+
'<% } %>'+
'</div>'
);

Binary file not shown.

After

Width:  |  Height:  |  Size: 482 KiB

Binary file not shown.