dialog position fixed

This commit is contained in:
Van 2015-01-28 16:21:35 +08:00
parent 534661f643
commit e3c2826183
6 changed files with 38 additions and 31 deletions

View File

@ -12,7 +12,7 @@
"Theme": "default",
"Created": 1414080000000000000,
"Updated": 1414080000000000000,
"Lived": 1414080000000000000,
"Lived": 1422433217150692000,
"Editor": {
"FontFamily": "Consolas, 'Courier New', monospace",
"FontSize": "13px",

View File

@ -19,6 +19,7 @@
line-height: 28px;
white-space: normal;
word-wrap: break-word;
overflow: auto;
}
#startPage a {
@ -65,7 +66,6 @@
}
#startPage .news {
height: 300px;
width: 60%;
float: right;
border-left: 1px solid #f1f1f1;
@ -80,4 +80,6 @@
#startPage .date {
color: #bbb;
font-size: 13px;
word-wrap: normal;
white-space: nowrap;
}

View File

@ -135,25 +135,6 @@
$($("#" + id + "Dialog ." + styleClass.main + " div").get(0)).append(cloneObj);
$(cloneObj).show();
// Sets position.
var top = "", left = "",
$dialog = $("#" + id + "Dialog");
if (settings.position) {
top = settings.position.top;
left = settings.position.left;
} else {
// 20(footer) + 23(header)
top = parseInt((windowH - dialogH - 43) / 2);
if (top < 0) {
top = 0;
}
left = parseInt((windowW - dialogW) / 2);
}
$dialog.css({
"top": top + "px",
"left": left + "px"
});
// Bind event.
$("#" + id + "Dialog ." + styleClass.closeIcon).bind("click", function () {
$.dialog._close(id, settings);
@ -263,9 +244,30 @@
_openDialog: function (target, msg) {
var inst = this._getInst(target);
var id = inst.id,
settings = inst.settings;
settings = inst.settings,
top = "", left = "",
$dialog = $("#" + id + "Dialog"),
windowH = $(window).height(),
windowW = $(window).width(),
dialogH = settings.height ? settings.height : parseInt(windowH * 0.6),
dialogW = settings.width ? settings.width : parseInt(windowW * 0.6);
$("#" + id + "Dialog").show();
// Sets position.
if (settings.position) {
top = settings.position.top;
left = settings.position.left;
} else {
// 20(footer) + 23(header)
top = parseInt((windowH - dialogH - 43) / 2);
if (top < 0) {
top = 0;
}
left = parseInt((windowW - dialogW) / 2);
}
$dialog.css({
"top": top + "px",
"left": left + "px"
}).show();
if (settings.modal) {
var styleClass = this._getDefaults($.dialog._defaults, settings, "styleClass");

View File

@ -272,6 +272,7 @@ var editors = {
+ '"><span class="ico-start font-ico"></span> ' + config.label.start_page + '</span>',
content: '<div id="startPage"></div>',
after: function () {
$("#startPage").height($('.side-right').height() - $(".bottom-window-group").children(".tabs").height() - 100);
$("#startPage").load(config.context + '/start?sid=' + config.wideSessionId);
$.ajax({
url: "https://symphony.b3log.org/apis/articles?tags=wide,golang&p=1&size=30",

View File

@ -379,6 +379,8 @@ var wide = {
} else {
$(".side-right > .tabs-panel > div").height($('.side-right').height() - $bottomGroup.children(".tabs").height());
}
$("#startPage").height($('.side-right').height() - $bottomGroup.children(".tabs").height() - 100);
},
_initWS: function () {
var outputWS = new ReconnectingWebSocket(config.channel + '/output/ws?sid=' + config.wideSessionId);
@ -489,10 +491,10 @@ var wide = {
// 点击隐藏弹出层
$("body").bind("mouseup", function (event) {
//fix issue#200 右键文件树失效
if (event.which == 3) {
return false;
}
//fix issue#200 右键文件树失效
if (event.which === 3) {
return false;
}
$(".frame").hide();
if (!($(event.target).closest(".frame").length === 1 || event.target.className === "frame")) {
@ -524,7 +526,6 @@ var wide = {
for (var i = 0, ii = editorDatas.length; i < ii; i++) {
editorDatas[i].editor.setSize("100%", height);
}
});
},
_save: function (path, editor) {

View File

@ -170,6 +170,7 @@ var windows = {
editorDatas[i].editor.setSize("100%", height);
}
$("#startPage").height(height - 100);
$it.show();
$(".footer .ico-restore:eq(1)").hide();
});
@ -225,7 +226,7 @@ var windows = {
for (var i = 0, ii = editorDatas.length; i < ii; i++) {
editorDatas[i].editor.setSize("100%", height);
}
$("#startPage").height(height - 100);
$(".bottom-window-group").css("top", "100%").hide();
$(".footer .ico-restore:eq(1)").show();
},