From 78e34fed06275f4c1699aa73e833c61af9bf3205 Mon Sep 17 00:00:00 2001 From: Van Date: Tue, 21 Oct 2014 15:11:28 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E7=A6=81=E6=AD=A2=E9=BC=A0=E6=A0=87?= =?UTF-8?q?=E5=8F=B3=E9=94=AE=E8=8F=9C=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- conf/wide.json | 12 ++++++++---- static/js/wide.js | 7 +++++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/conf/wide.json b/conf/wide.json index bc97fbb..5c9e624 100644 --- a/conf/wide.json +++ b/conf/wide.json @@ -10,16 +10,20 @@ "MaxProcs": 4, "RuntimeMode": "dev", "Pwd": "{pwd}", - "Workspace": "{pwd}/data/workspace", "Users": [ { "Name": "admin", "Password": "admin", "Workspace": "{pwd}/data/user_workspaces/admin", "LatestSessionContent": { - "FileTree": [], - "Files": [], - "CurrentFile": "" + "FileTree": [ + "E:\\Work\\go\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest", + "E:\\Work\\go\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest\\hello" + ], + "Files": [ + "E:\\Work\\go\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest\\hello\\main.go" + ], + "CurrentFile": "E:\\Work\\go\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest\\hello\\main.go" } } ] diff --git a/static/js/wide.js b/static/js/wide.js index 03ea2c7..577fb94 100644 --- a/static/js/wide.js +++ b/static/js/wide.js @@ -367,6 +367,7 @@ var wide = { this._initBottomWindowGroup(); + // 点击隐藏弹出层 $("body").bind("mousedown", function (event) { if (!(event.target.id === "dirRMenu" || $(event.target).closest("#dirRMenu").length > 0)) { $("#dirRMenu").hide(); @@ -383,11 +384,17 @@ var wide = { } }); + // 刷新提示 window.onbeforeunload = function () { if (editors.data.length > 0) { return config.label.confirm_save; } }; + + // 禁止鼠标右键菜单 + document.oncontextmenu = function () { + return false; + }; this._initDialog(); From a739426a0bbc154e7d4bae5b7535ef7113801681 Mon Sep 17 00:00:00 2001 From: Van Date: Tue, 21 Oct 2014 16:46:09 +0800 Subject: [PATCH 2/2] start page --- i18n/zh_CN.json | 4 +++- static/css/start.css | 25 ++++++++++++++++++++++++- static/css/wide.css | 4 ++++ static/js/editors.js | 36 +++++++++++++++++++++++++++--------- view/start.html | 21 ++++++++++++++------- 5 files changed, 72 insertions(+), 18 deletions(-) diff --git a/i18n/zh_CN.json b/i18n/zh_CN.json index 1efd291..2374694 100644 --- a/i18n/zh_CN.json +++ b/i18n/zh_CN.json @@ -53,5 +53,7 @@ "ver": "版本", "dev_team": "开发团队", "donate": "捐赠", - "confirm_save": "请确认所有文件已保存" + "confirm_save": "请确认所有文件已保存", + "workspace": "工作空间", + "project_address": "项目地址" } diff --git a/static/css/start.css b/static/css/start.css index 26ac9dc..3d13a69 100644 --- a/static/css/start.css +++ b/static/css/start.css @@ -1,9 +1,32 @@ +#startPage { + font-size: 15px; + padding: 50px 70px; + line-height: 28px; + color: #666; +} + #startPage .details { width: 40%; float: left; + border-right: 1px solid #DDD; + margin-right: 10%; } #startPage .news { - width: 60%; + width: 50%; float: left; +} + +#startPage a { + color: #4183c4; + text-decoration: none; +} + +#startPage a:hover { + text-decoration: underline; +} + +#startPage .date { + color: #bbb; + font-size: 13px; } \ No newline at end of file diff --git a/static/css/wide.css b/static/css/wide.css index 103049f..07827d3 100644 --- a/static/css/wide.css +++ b/static/css/wide.css @@ -224,6 +224,10 @@ overflow-y: auto; } +.CodeMirror { + font-family: monospace; +} + .CodeMirror-focused .cm-matchhighlight { background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAYAAABytg0kAAAAFklEQVQI12NgYGBgkKzc8x9CMDAwAAAmhwSbidEoSQAAAABJRU5ErkJggg==); background-position: bottom; diff --git a/static/js/editors.js b/static/js/editors.js index a614f8c..ef1aba1 100644 --- a/static/js/editors.js +++ b/static/js/editors.js @@ -79,6 +79,27 @@ var editors = { this.openStartPage() }, openStartPage: function () { + var dateFormat = function (time, fmt) { + var date = new Date(time); + var dateObj = { + "M+": date.getMonth() + 1, //月份 + "d+": date.getDate(), //日 + "h+": date.getHours(), //小时 + "m+": date.getMinutes(), //分 + "s+": date.getSeconds(), //秒 + "q+": Math.floor((date.getMonth() + 3) / 3), //季度 + "S": date.getMilliseconds() //毫秒 + }; + if (/(y+)/.test(fmt)) + fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length)); + for (var k in dateObj) + if (new RegExp("(" + k + ")").test(fmt)) { + fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) + ? (dateObj[k]) : (("00" + dateObj[k]).substr(("" + dateObj[k]).length))); + } + return fmt; + }; + editors.tabs.add({ id: "startPage", title: '' + config.label.initialise + '', @@ -90,9 +111,6 @@ var editors = { type: "GET", dataType: "jsonp", jsonp: "callback", - error: function () { - $("#startPage").html("Loading B3log Announcement failed :-("); - }, success: function (data, textStatus) { var articles = data.articles; if (0 === articles.length) { @@ -108,15 +126,15 @@ var editors = { var listHTML = ""; - $("#startPage .news").html(listHTML); + $("#startPage .news").html(listHTML + ""); } }); } diff --git a/view/start.html b/view/start.html index 85bddcd..de753af 100644 --- a/view/start.html +++ b/view/start.html @@ -4,22 +4,29 @@ {{.i18n.username}} {{.username}}
  • - {{.i18n.user_guide}} http://88250.gitbooks.io/wide-user-guide + {{.i18n.workspace}} {{.username}}
  • - {{.i18n.dev_guide}} http://88250.gitbooks.io/wide-user-guide + {{.i18n.user_guide}} + 88250.gitbooks.io/wide-user-guide
  • - Wide - {{.i18n.ver}} {{.ver}} - {{.i18n.dev_team}} + {{.i18n.dev_guide}} + 88250.gitbooks.io/wide-dev-guide
  • - {{.i18n.donate}} http://b3log.org/donate.html + Wide
    + {{.i18n.ver}} {{.ver}}
    + {{.i18n.dev_team}} B3log
    + {{.i18n.project_address}} + github.com/b3log/wide +
  • +
  • + {{.i18n.donate}} + b3log.org/donate.html
  • - aaa