From df9bc37e1d7713e77346dae065e3b27337cbc702 Mon Sep 17 00:00:00 2001 From: life Date: Sat, 10 Jan 2015 19:04:06 +0800 Subject: [PATCH] blog theme redesign --- public/blog/README.html | 5 ++ public/blog/css/share_comment.css | 1 + public/blog/js/bootstrap-dialog.min.js | 2 +- public/blog/js/common.js | 18 +++--- public/blog/js/share_comment.js | 28 +++++----- public/blog/themes/default/archive.html | 29 ++++++---- public/blog/themes/default/cate.html | 30 +--------- public/blog/themes/default/footer.html | 20 ++++--- public/blog/themes/default/header.html | 16 +++--- public/blog/themes/default/index.html | 28 +--------- public/blog/themes/default/paging.html | 4 +- public/blog/themes/default/post.html | 39 +++++++------ public/blog/themes/default/post_abstract.html | 37 +++++++++++++ public/blog/themes/default/search.html | 37 +------------ public/blog/themes/default/share_comment.html | 55 +++++++++---------- public/blog/themes/default/single.html | 8 +-- public/blog/themes/default/style.css | 2 + public/blog/themes/default/tag_posts.html | 34 +----------- public/blog/themes/default/tags.html | 2 +- public/blog/themes/default/theme.json | 12 ++-- public/blog/themes/elegant/archive.html | 29 ++++++---- public/blog/themes/elegant/cate.html | 30 +--------- public/blog/themes/elegant/footer.html | 20 ++++--- public/blog/themes/elegant/header.html | 12 ++-- public/blog/themes/elegant/index.html | 39 ------------- public/blog/themes/elegant/paging.html | 4 +- public/blog/themes/elegant/post.html | 39 +++++++------ public/blog/themes/elegant/post_abstract.html | 37 +++++++++++++ public/blog/themes/elegant/search.html | 37 +------------ public/blog/themes/elegant/share_comment.html | 55 +++++++++---------- public/blog/themes/elegant/single.html | 8 +-- public/blog/themes/elegant/style.css | 1 + public/blog/themes/elegant/tag_posts.html | 34 +----------- public/blog/themes/elegant/tags.html | 2 +- public/blog/themes/elegant/theme.json | 16 +++--- public/blog/themes/nav_fixed/archive.html | 29 ++++++---- public/blog/themes/nav_fixed/cate.html | 30 +--------- public/blog/themes/nav_fixed/footer.html | 20 ++++--- public/blog/themes/nav_fixed/header.html | 16 +++--- public/blog/themes/nav_fixed/index.html | 39 ------------- public/blog/themes/nav_fixed/paging.html | 4 +- public/blog/themes/nav_fixed/post.html | 39 +++++++------ .../blog/themes/nav_fixed/post_abstract.html | 37 +++++++++++++ public/blog/themes/nav_fixed/search.html | 37 +------------ .../blog/themes/nav_fixed/share_comment.html | 55 +++++++++---------- public/blog/themes/nav_fixed/single.html | 8 +-- public/blog/themes/nav_fixed/style.css | 1 + public/blog/themes/nav_fixed/tag_posts.html | 34 +----------- public/blog/themes/nav_fixed/tags.html | 2 +- public/blog/themes/nav_fixed/theme.json | 14 +++-- 50 files changed, 481 insertions(+), 654 deletions(-) create mode 100644 public/blog/README.html create mode 100644 public/blog/themes/default/post_abstract.html delete mode 100644 public/blog/themes/elegant/index.html create mode 100644 public/blog/themes/elegant/post_abstract.html delete mode 100644 public/blog/themes/nav_fixed/index.html create mode 100644 public/blog/themes/nav_fixed/post_abstract.html diff --git a/public/blog/README.html b/public/blog/README.html new file mode 100644 index 0000000..2f4dc6b --- /dev/null +++ b/public/blog/README.html @@ -0,0 +1,5 @@ +

博客的默认主题和一些公用的静态文件

+ +

themes 是默认主题, 有3个

+ +

用户自定义的主题不在这里, 在public/upload/userId/thmems下

diff --git a/public/blog/css/share_comment.css b/public/blog/css/share_comment.css index d1b0cac..882f5f4 100644 --- a/public/blog/css/share_comment.css +++ b/public/blog/css/share_comment.css @@ -253,6 +253,7 @@ } #comments form { display: none; + margin-top: 5px; } @media screen and (max-width: 600px) { .comment-form { diff --git a/public/blog/js/bootstrap-dialog.min.js b/public/blog/js/bootstrap-dialog.min.js index eeb36be..6fe3a1c 100644 --- a/public/blog/js/bootstrap-dialog.min.js +++ b/public/blog/js/bootstrap-dialog.min.js @@ -1 +1 @@ -!function(t,e){"use strict";"undefined"!=typeof module&&module.exports?module.exports=e(require("jquery")(t)):"function"==typeof define&&define.amd?define("bootstrap-dialog",["jquery"],function(t){return e(t)}):t.BootstrapDialog=e(t.jQuery)}(this,function(t){"use strict";var e=function(n){this.defaultOptions=t.extend(!0,{id:e.newGuid(),buttons:[],data:{},onshow:null,onshown:null,onhide:null,onhidden:null},e.defaultOptions),this.indexedButtons={},this.registeredButtonHotkeys={},this.draggableData={isMouseDown:!1,mouseOffset:{}},this.realized=!1,this.opened=!1,this.initOptions(n),this.holdThisInstance()};return e.NAMESPACE="bootstrap-dialog",e.TYPE_DEFAULT="type-default",e.TYPE_INFO="type-info",e.TYPE_PRIMARY="type-primary",e.TYPE_SUCCESS="type-success",e.TYPE_WARNING="type-warning",e.TYPE_DANGER="type-danger",e.DEFAULT_TEXTS={},e.DEFAULT_TEXTS[e.TYPE_DEFAULT]="提示",e.DEFAULT_TEXTS[e.TYPE_INFO]="提示",e.DEFAULT_TEXTS[e.TYPE_PRIMARY]="提示",e.DEFAULT_TEXTS[e.TYPE_SUCCESS]="Success",e.DEFAULT_TEXTS[e.TYPE_WARNING]="Warning",e.DEFAULT_TEXTS[e.TYPE_DANGER]="Danger",e.SIZE_NORMAL="size-normal",e.SIZE_LARGE="size-large",e.BUTTON_SIZES={},e.BUTTON_SIZES[e.SIZE_NORMAL]="",e.BUTTON_SIZES[e.SIZE_LARGE]="btn-lg",e.ICON_SPINNER="glyphicon glyphicon-asterisk",e.ZINDEX_BACKDROP=1040,e.ZINDEX_MODAL=1050,e.defaultOptions={type:e.TYPE_PRIMARY,size:e.SIZE_NORMAL,cssClass:"",title:null,message:null,nl2br:!0,closable:!0,closeByBackdrop:!0,closeByKeyboard:!0,spinicon:e.ICON_SPINNER,autodestroy:!0,draggable:!1,animate:!0,description:""},e.configDefaultOptions=function(n){e.defaultOptions=t.extend(!0,e.defaultOptions,n)},e.dialogs={},e.openAll=function(){t.each(e.dialogs,function(t,e){e.open()})},e.closeAll=function(){t.each(e.dialogs,function(t,e){e.close()})},e.moveFocus=function(){var n=null;t.each(e.dialogs,function(t,e){n=e}),null!==n&&n.isRealized()&&n.getModal().focus()},e.showScrollbar=function(){var n=null;if(t.each(e.dialogs,function(t,e){n=e}),null!==n&&n.isRealized()&&n.isOpened()){var o=n.getModal().data("bs.modal");o.checkScrollbar(),t("body").addClass("modal-open"),o.setScrollbar()}},e.prototype={constructor:e,initOptions:function(e){return this.options=t.extend(!0,this.defaultOptions,e),this},holdThisInstance:function(){return e.dialogs[this.getId()]=this,this},initModalStuff:function(){return this.setModal(this.createModal()).setModalDialog(this.createModalDialog()).setModalContent(this.createModalContent()).setModalHeader(this.createModalHeader()).setModalBody(this.createModalBody()).setModalFooter(this.createModalFooter()),this.getModal().append(this.getModalDialog()),this.getModalDialog().append(this.getModalContent()),this.getModalContent().append(this.getModalHeader()).append(this.getModalBody()).append(this.getModalFooter()),this},createModal:function(){var e=t('');return e.prop("id",this.getId()).attr("aria-labelledby",this.getId()+"_title"),e},getModal:function(){return this.$modal},setModal:function(t){return this.$modal=t,this},createModalDialog:function(){return t('')},getModalDialog:function(){return this.$modalDialog},setModalDialog:function(t){return this.$modalDialog=t,this},createModalContent:function(){return t('')},getModalContent:function(){return this.$modalContent},setModalContent:function(t){return this.$modalContent=t,this},createModalHeader:function(){return t('')},getModalHeader:function(){return this.$modalHeader},setModalHeader:function(t){return this.$modalHeader=t,this},createModalBody:function(){return t('')},getModalBody:function(){return this.$modalBody},setModalBody:function(t){return this.$modalBody=t,this},createModalFooter:function(){return t('')},getModalFooter:function(){return this.$modalFooter},setModalFooter:function(t){return this.$modalFooter=t,this},createDynamicContent:function(t){var e=null;return e="function"==typeof t?t.call(t,this):t,"string"==typeof e&&(e=this.formatStringContent(e)),e},formatStringContent:function(t){return this.options.nl2br?t.replace(/\r\n/g,"
").replace(/[\r\n]/g,"
"):t},setData:function(t,e){return this.options.data[t]=e,this},getData:function(t){return this.options.data[t]},setId:function(t){return this.options.id=t,this},getId:function(){return this.options.id},getType:function(){return this.options.type},setType:function(t){return this.options.type=t,this.updateType(),this},updateType:function(){if(this.isRealized()){var t=[e.TYPE_DEFAULT,e.TYPE_INFO,e.TYPE_PRIMARY,e.TYPE_SUCCESS,e.TYPE_WARNING,e.TYPE_DANGER];this.getModal().removeClass(t.join(" ")).addClass(this.getType())}return this},getSize:function(){return this.options.size},setSize:function(t){return this.options.size=t,this},getCssClass:function(){return this.options.cssClass},setCssClass:function(t){return this.options.cssClass=t,this},getTitle:function(){return this.options.title},setTitle:function(t){return this.options.title=t,this.updateTitle(),this},updateTitle:function(){if(this.isRealized()){var t=null!==this.getTitle()?this.createDynamicContent(this.getTitle()):this.getDefaultText();this.getModalHeader().find("."+this.getNamespace("title")).html("").append(t).prop("id",this.getId()+"_title")}return this},getMessage:function(){return this.options.message},setMessage:function(t){return this.options.message=t,this.updateMessage(),this},updateMessage:function(){if(this.isRealized()){var t=this.createDynamicContent(this.getMessage());this.getModalBody().find("."+this.getNamespace("message")).html("").append(t)}return this},isClosable:function(){return this.options.closable},setClosable:function(t){return this.options.closable=t,this.updateClosable(),this},setCloseByBackdrop:function(t){return this.options.closeByBackdrop=t,this},canCloseByBackdrop:function(){return this.options.closeByBackdrop},setCloseByKeyboard:function(t){return this.options.closeByKeyboard=t,this},canCloseByKeyboard:function(){return this.options.closeByKeyboard},isAnimate:function(){return this.options.animate},setAnimate:function(t){return this.options.animate=t,this},updateAnimate:function(){return this.isRealized()&&this.getModal().toggleClass("fade",this.isAnimate()),this},getSpinicon:function(){return this.options.spinicon},setSpinicon:function(t){return this.options.spinicon=t,this},addButton:function(t){return this.options.buttons.push(t),this},addButtons:function(e){var n=this;return t.each(e,function(t,e){n.addButton(e)}),this},getButtons:function(){return this.options.buttons},setButtons:function(t){return this.options.buttons=t,this.updateButtons(),this},getButton:function(t){return"undefined"!=typeof this.indexedButtons[t]?this.indexedButtons[t]:null},getButtonSize:function(){return"undefined"!=typeof e.BUTTON_SIZES[this.getSize()]?e.BUTTON_SIZES[this.getSize()]:""},updateButtons:function(){return this.isRealized()&&(0===this.getButtons().length?this.getModalFooter().hide():this.getModalFooter().find("."+this.getNamespace("footer")).html("").append(this.createFooterButtons())),this},isAutodestroy:function(){return this.options.autodestroy},setAutodestroy:function(t){this.options.autodestroy=t},getDescription:function(){return this.options.description},setDescription:function(t){return this.options.description=t,this},getDefaultText:function(){return e.DEFAULT_TEXTS[this.getType()]},getNamespace:function(t){return e.NAMESPACE+"-"+t},createHeaderContent:function(){var e=t("
");return e.addClass(this.getNamespace("header")),e.append(this.createTitleContent()),e.prepend(this.createCloseButton()),e},createTitleContent:function(){var e=t("
");return e.addClass(this.getNamespace("title")),e},createCloseButton:function(){var e=t("
");e.addClass(this.getNamespace("close-button"));var n=t('');return e.append(n),e.on("click",{dialog:this},function(t){t.data.dialog.close()}),e},createBodyContent:function(){var e=t("
");return e.addClass(this.getNamespace("body")),e.append(this.createMessageContent()),e},createMessageContent:function(){var e=t("
");return e.addClass(this.getNamespace("message")),e},createFooterContent:function(){var e=t("
");return e.addClass(this.getNamespace("footer")),e},createFooterButtons:function(){var n=this,o=t("
");return o.addClass(this.getNamespace("footer-buttons")),this.indexedButtons={},t.each(this.options.buttons,function(t,i){i.id||(i.id=e.newGuid());var s=n.createButton(i);n.indexedButtons[i.id]=s,o.append(s)}),o},createButton:function(e){var n=t('');return n.addClass(this.getButtonSize()),n.prop("id",e.id),"undefined"!=typeof e.icon&&""!==t.trim(e.icon)&&n.append(this.createButtonIcon(e.icon)),"undefined"!=typeof e.label&&n.append(e.label),n.addClass("undefined"!=typeof e.cssClass&&""!==t.trim(e.cssClass)?e.cssClass:"btn-default"),"undefined"!=typeof e.hotkey&&(this.registeredButtonHotkeys[e.hotkey]=n),n.on("click",{dialog:this,$button:n,button:e},function(t){var e=t.data.dialog,n=t.data.$button,o=t.data.button;"function"==typeof o.action&&o.action.call(n,e),o.autospin&&n.toggleSpin(!0)}),this.enhanceButton(n),n},enhanceButton:function(t){return t.dialog=this,t.toggleEnable=function(t){var e=this;return"undefined"!=typeof t?e.prop("disabled",!t).toggleClass("disabled",!t):e.prop("disabled",!e.prop("disabled")),e},t.enable=function(){var t=this;return t.toggleEnable(!0),t},t.disable=function(){var t=this;return t.toggleEnable(!1),t},t.toggleSpin=function(e){var n=this,o=n.dialog,i=n.find("."+o.getNamespace("button-icon"));return"undefined"==typeof e&&(e=!(t.find(".icon-spin").length>0)),e?(i.hide(),t.prepend(o.createButtonIcon(o.getSpinicon()).addClass("icon-spin"))):(i.show(),t.find(".icon-spin").remove()),n},t.spin=function(){var t=this;return t.toggleSpin(!0),t},t.stopSpin=function(){var t=this;return t.toggleSpin(!1),t},this},createButtonIcon:function(e){var n=t("");return n.addClass(this.getNamespace("button-icon")).addClass(e),n},enableButtons:function(e){return t.each(this.indexedButtons,function(t,n){n.toggleEnable(e)}),this},updateClosable:function(){return this.isRealized()&&this.getModalHeader().find("."+this.getNamespace("close-button")).toggle(this.isClosable()),this},onShow:function(t){return this.options.onshow=t,this},onShown:function(t){return this.options.onshown=t,this},onHide:function(t){return this.options.onhide=t,this},onHidden:function(t){return this.options.onhidden=t,this},isRealized:function(){return this.realized},setRealized:function(t){return this.realized=t,this},isOpened:function(){return this.opened},setOpened:function(t){return this.opened=t,this},handleModalEvents:function(){return this.getModal().on("show.bs.modal",{dialog:this},function(t){var e=t.data.dialog;return"function"==typeof e.options.onshow?e.options.onshow(e):void 0}),this.getModal().on("shown.bs.modal",{dialog:this},function(t){var e=t.data.dialog;"function"==typeof e.options.onshown&&e.options.onshown(e)}),this.getModal().on("hide.bs.modal",{dialog:this},function(t){var e=t.data.dialog;return"function"==typeof e.options.onhide?e.options.onhide(e):void 0}),this.getModal().on("hidden.bs.modal",{dialog:this},function(n){var o=n.data.dialog;"function"==typeof o.options.onhidden&&o.options.onhidden(o),o.isAutodestroy()&&t(this).remove(),e.moveFocus()}),this.getModal().on("click",{dialog:this},function(t){t.target===this&&t.data.dialog.isClosable()&&t.data.dialog.canCloseByBackdrop()&&t.data.dialog.close()}),this.getModal().on("keyup",{dialog:this},function(t){27===t.which&&t.data.dialog.isClosable()&&t.data.dialog.canCloseByKeyboard()&&t.data.dialog.close()}),this.getModal().on("keyup",{dialog:this},function(e){var n=e.data.dialog;if("undefined"!=typeof n.registeredButtonHotkeys[e.which]){var o=t(n.registeredButtonHotkeys[e.which]);!o.prop("disabled")&&o.focus().trigger("click")}}),this},makeModalDraggable:function(){return this.options.draggable&&(this.getModalHeader().addClass(this.getNamespace("draggable")).on("mousedown",{dialog:this},function(t){var e=t.data.dialog;e.draggableData.isMouseDown=!0;var n=e.getModalContent().offset();e.draggableData.mouseOffset={top:t.clientY-n.top,left:t.clientX-n.left}}),this.getModal().on("mouseup mouseleave",{dialog:this},function(t){t.data.dialog.draggableData.isMouseDown=!1}),t("body").on("mousemove",{dialog:this},function(t){var e=t.data.dialog;e.draggableData.isMouseDown&&e.getModalContent().offset({top:t.clientY-e.draggableData.mouseOffset.top,left:t.clientX-e.draggableData.mouseOffset.left})})),this},updateZIndex:function(){var n=0;t.each(e.dialogs,function(){n++});var o=this.getModal(),i=o.data("bs.modal").$backdrop;return o.css("z-index",e.ZINDEX_MODAL+20*(n-1)),i.css("z-index",e.ZINDEX_BACKDROP+20*(n-1)),this},realize:function(){return this.initModalStuff(),this.getModal().addClass(e.NAMESPACE).addClass(this.getSize()).addClass(this.getCssClass()),this.getDescription()&&this.getModal().attr("aria-describedby",this.getDescription()),this.getModalFooter().append(this.createFooterContent()),this.getModalHeader().append(this.createHeaderContent()),this.getModalBody().append(this.createBodyContent()),this.getModal().modal({backdrop:"static",keyboard:!1,show:!1}),this.makeModalDraggable(),this.handleModalEvents(),this.setRealized(!0),this.updateButtons(),this.updateType(),this.updateTitle(),this.updateMessage(),this.updateClosable(),this.updateAnimate(),this},open:function(){return!this.isRealized()&&this.realize(),this.getModal().modal("show"),this.updateZIndex(),this.setOpened(!0),this},close:function(){return this.getModal().modal("hide"),this.isAutodestroy()&&delete e.dialogs[this.getId()],this.setOpened(!1),e.showScrollbar(),this}},e.newGuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=16*Math.random()|0,n="x"===t?e:3&e|8;return n.toString(16)})},e.show=function(t){return new e(t).open()},e.alert=function(){var n={},o={type:e.TYPE_PRIMARY,title:null,message:null,closable:!0,buttonLabel:"确认",callback:null};return n="object"==typeof arguments[0]&&arguments[0].constructor==={}.constructor?t.extend(!0,o,arguments[0]):t.extend(!0,o,{message:arguments[0],closable:!1,buttonLabel:"确认",callback:"undefined"!=typeof arguments[1]?arguments[1]:null}),new e({type:n.type,title:n.title,message:n.message,closable:n.closable,data:{callback:n.callback},onhide:function(t){!t.getData("btnClicked")&&t.isClosable()&&"function"==typeof t.getData("callback")&&t.getData("callback")(!1)},buttons:[{label:n.buttonLabel,action:function(t){t.setData("btnClicked",!0),"function"==typeof t.getData("callback")&&t.getData("callback")(!0),t.close()}}]}).open()},e.confirm=function(t,n){return new e({title:"确认?",message:t,closable:!1,data:{callback:n},buttons:[{label:"取消",action:function(t){"function"==typeof t.getData("callback")&&t.getData("callback")(!1),t.close()}},{label:"确认",cssClass:"btn-primary",action:function(t){"function"==typeof t.getData("callback")&&t.getData("callback")(!0),t.close()}}]}).open()},e.warning=function(t){return new e({type:e.TYPE_WARNING,message:t}).open()},e.danger=function(t){return new e({type:e.TYPE_DANGER,message:t}).open()},e.success=function(t){return new e({type:e.TYPE_SUCCESS,message:t}).open()},e}); \ No newline at end of file +!function(t,e){"use strict";"undefined"!=typeof module&&module.exports?module.exports=e(require("jquery")(t)):"function"==typeof define&&define.amd?define("bootstrap-dialog",["jquery"],function(t){return e(t)}):t.BootstrapDialog=e(t.jQuery)}(this,function(t){"use strict";var e=function(n){this.defaultOptions=t.extend(!0,{id:e.newGuid(),buttons:[],data:{},onshow:null,onshown:null,onhide:null,onhidden:null},e.defaultOptions),this.indexedButtons={},this.registeredButtonHotkeys={},this.draggableData={isMouseDown:!1,mouseOffset:{}},this.realized=!1,this.opened=!1,this.initOptions(n),this.holdThisInstance()};return e.NAMESPACE="bootstrap-dialog",e.TYPE_DEFAULT="type-default",e.TYPE_INFO="type-info",e.TYPE_PRIMARY="type-primary",e.TYPE_SUCCESS="type-success",e.TYPE_WARNING="type-warning",e.TYPE_DANGER="type-danger",e.DEFAULT_TEXTS={},e.DEFAULT_TEXTS[e.TYPE_DEFAULT]="Tips",e.DEFAULT_TEXTS[e.TYPE_INFO]="Tips",e.DEFAULT_TEXTS[e.TYPE_PRIMARY]="Tips",e.DEFAULT_TEXTS[e.TYPE_SUCCESS]="Success",e.DEFAULT_TEXTS[e.TYPE_WARNING]="Warning",e.DEFAULT_TEXTS[e.TYPE_DANGER]="Danger",e.SIZE_NORMAL="size-normal",e.SIZE_LARGE="size-large",e.BUTTON_SIZES={},e.BUTTON_SIZES[e.SIZE_NORMAL]="",e.BUTTON_SIZES[e.SIZE_LARGE]="btn-lg",e.ICON_SPINNER="glyphicon glyphicon-asterisk",e.ZINDEX_BACKDROP=1040,e.ZINDEX_MODAL=1050,e.defaultOptions={type:e.TYPE_PRIMARY,size:e.SIZE_NORMAL,cssClass:"",title:null,message:null,nl2br:!0,closable:!0,closeByBackdrop:!0,closeByKeyboard:!0,spinicon:e.ICON_SPINNER,autodestroy:!0,draggable:!1,animate:!0,description:""},e.configDefaultOptions=function(n){e.defaultOptions=t.extend(!0,e.defaultOptions,n)},e.dialogs={},e.openAll=function(){t.each(e.dialogs,function(t,e){e.open()})},e.closeAll=function(){t.each(e.dialogs,function(t,e){e.close()})},e.moveFocus=function(){var n=null;t.each(e.dialogs,function(t,e){n=e}),null!==n&&n.isRealized()&&n.getModal().focus()},e.showScrollbar=function(){var n=null;if(t.each(e.dialogs,function(t,e){n=e}),null!==n&&n.isRealized()&&n.isOpened()){var o=n.getModal().data("bs.modal");o.checkScrollbar(),t("body").addClass("modal-open"),o.setScrollbar()}},e.prototype={constructor:e,initOptions:function(e){return this.options=t.extend(!0,this.defaultOptions,e),this},holdThisInstance:function(){return e.dialogs[this.getId()]=this,this},initModalStuff:function(){return this.setModal(this.createModal()).setModalDialog(this.createModalDialog()).setModalContent(this.createModalContent()).setModalHeader(this.createModalHeader()).setModalBody(this.createModalBody()).setModalFooter(this.createModalFooter()),this.getModal().append(this.getModalDialog()),this.getModalDialog().append(this.getModalContent()),this.getModalContent().append(this.getModalHeader()).append(this.getModalBody()).append(this.getModalFooter()),this},createModal:function(){var e=t('');return e.prop("id",this.getId()).attr("aria-labelledby",this.getId()+"_title"),e},getModal:function(){return this.$modal},setModal:function(t){return this.$modal=t,this},createModalDialog:function(){return t('')},getModalDialog:function(){return this.$modalDialog},setModalDialog:function(t){return this.$modalDialog=t,this},createModalContent:function(){return t('')},getModalContent:function(){return this.$modalContent},setModalContent:function(t){return this.$modalContent=t,this},createModalHeader:function(){return t('')},getModalHeader:function(){return this.$modalHeader},setModalHeader:function(t){return this.$modalHeader=t,this},createModalBody:function(){return t('')},getModalBody:function(){return this.$modalBody},setModalBody:function(t){return this.$modalBody=t,this},createModalFooter:function(){return t('')},getModalFooter:function(){return this.$modalFooter},setModalFooter:function(t){return this.$modalFooter=t,this},createDynamicContent:function(t){var e=null;return e="function"==typeof t?t.call(t,this):t,"string"==typeof e&&(e=this.formatStringContent(e)),e},formatStringContent:function(t){return this.options.nl2br?t.replace(/\r\n/g,"
").replace(/[\r\n]/g,"
"):t},setData:function(t,e){return this.options.data[t]=e,this},getData:function(t){return this.options.data[t]},setId:function(t){return this.options.id=t,this},getId:function(){return this.options.id},getType:function(){return this.options.type},setType:function(t){return this.options.type=t,this.updateType(),this},updateType:function(){if(this.isRealized()){var t=[e.TYPE_DEFAULT,e.TYPE_INFO,e.TYPE_PRIMARY,e.TYPE_SUCCESS,e.TYPE_WARNING,e.TYPE_DANGER];this.getModal().removeClass(t.join(" ")).addClass(this.getType())}return this},getSize:function(){return this.options.size},setSize:function(t){return this.options.size=t,this},getCssClass:function(){return this.options.cssClass},setCssClass:function(t){return this.options.cssClass=t,this},getTitle:function(){return this.options.title},setTitle:function(t){return this.options.title=t,this.updateTitle(),this},updateTitle:function(){if(this.isRealized()){var t=null!==this.getTitle()?this.createDynamicContent(this.getTitle()):this.getDefaultText();this.getModalHeader().find("."+this.getNamespace("title")).html("").append(t).prop("id",this.getId()+"_title")}return this},getMessage:function(){return this.options.message},setMessage:function(t){return this.options.message=t,this.updateMessage(),this},updateMessage:function(){if(this.isRealized()){var t=this.createDynamicContent(this.getMessage());this.getModalBody().find("."+this.getNamespace("message")).html("").append(t)}return this},isClosable:function(){return this.options.closable},setClosable:function(t){return this.options.closable=t,this.updateClosable(),this},setCloseByBackdrop:function(t){return this.options.closeByBackdrop=t,this},canCloseByBackdrop:function(){return this.options.closeByBackdrop},setCloseByKeyboard:function(t){return this.options.closeByKeyboard=t,this},canCloseByKeyboard:function(){return this.options.closeByKeyboard},isAnimate:function(){return this.options.animate},setAnimate:function(t){return this.options.animate=t,this},updateAnimate:function(){return this.isRealized()&&this.getModal().toggleClass("fade",this.isAnimate()),this},getSpinicon:function(){return this.options.spinicon},setSpinicon:function(t){return this.options.spinicon=t,this},addButton:function(t){return this.options.buttons.push(t),this},addButtons:function(e){var n=this;return t.each(e,function(t,e){n.addButton(e)}),this},getButtons:function(){return this.options.buttons},setButtons:function(t){return this.options.buttons=t,this.updateButtons(),this},getButton:function(t){return"undefined"!=typeof this.indexedButtons[t]?this.indexedButtons[t]:null},getButtonSize:function(){return"undefined"!=typeof e.BUTTON_SIZES[this.getSize()]?e.BUTTON_SIZES[this.getSize()]:""},updateButtons:function(){return this.isRealized()&&(0===this.getButtons().length?this.getModalFooter().hide():this.getModalFooter().find("."+this.getNamespace("footer")).html("").append(this.createFooterButtons())),this},isAutodestroy:function(){return this.options.autodestroy},setAutodestroy:function(t){this.options.autodestroy=t},getDescription:function(){return this.options.description},setDescription:function(t){return this.options.description=t,this},getDefaultText:function(){return e.DEFAULT_TEXTS[this.getType()]},getNamespace:function(t){return e.NAMESPACE+"-"+t},createHeaderContent:function(){var e=t("
");return e.addClass(this.getNamespace("header")),e.append(this.createTitleContent()),e.prepend(this.createCloseButton()),e},createTitleContent:function(){var e=t("
");return e.addClass(this.getNamespace("title")),e},createCloseButton:function(){var e=t("
");e.addClass(this.getNamespace("close-button"));var n=t('');return e.append(n),e.on("click",{dialog:this},function(t){t.data.dialog.close()}),e},createBodyContent:function(){var e=t("
");return e.addClass(this.getNamespace("body")),e.append(this.createMessageContent()),e},createMessageContent:function(){var e=t("
");return e.addClass(this.getNamespace("message")),e},createFooterContent:function(){var e=t("
");return e.addClass(this.getNamespace("footer")),e},createFooterButtons:function(){var n=this,o=t("
");return o.addClass(this.getNamespace("footer-buttons")),this.indexedButtons={},t.each(this.options.buttons,function(t,i){i.id||(i.id=e.newGuid());var s=n.createButton(i);n.indexedButtons[i.id]=s,o.append(s)}),o},createButton:function(e){var n=t('');return n.addClass(this.getButtonSize()),n.prop("id",e.id),"undefined"!=typeof e.icon&&""!==t.trim(e.icon)&&n.append(this.createButtonIcon(e.icon)),"undefined"!=typeof e.label&&n.append(e.label),n.addClass("undefined"!=typeof e.cssClass&&""!==t.trim(e.cssClass)?e.cssClass:"btn-default"),"undefined"!=typeof e.hotkey&&(this.registeredButtonHotkeys[e.hotkey]=n),n.on("click",{dialog:this,$button:n,button:e},function(t){var e=t.data.dialog,n=t.data.$button,o=t.data.button;"function"==typeof o.action&&o.action.call(n,e),o.autospin&&n.toggleSpin(!0)}),this.enhanceButton(n),n},enhanceButton:function(t){return t.dialog=this,t.toggleEnable=function(t){var e=this;return"undefined"!=typeof t?e.prop("disabled",!t).toggleClass("disabled",!t):e.prop("disabled",!e.prop("disabled")),e},t.enable=function(){var t=this;return t.toggleEnable(!0),t},t.disable=function(){var t=this;return t.toggleEnable(!1),t},t.toggleSpin=function(e){var n=this,o=n.dialog,i=n.find("."+o.getNamespace("button-icon"));return"undefined"==typeof e&&(e=!(t.find(".icon-spin").length>0)),e?(i.hide(),t.prepend(o.createButtonIcon(o.getSpinicon()).addClass("icon-spin"))):(i.show(),t.find(".icon-spin").remove()),n},t.spin=function(){var t=this;return t.toggleSpin(!0),t},t.stopSpin=function(){var t=this;return t.toggleSpin(!1),t},this},createButtonIcon:function(e){var n=t("");return n.addClass(this.getNamespace("button-icon")).addClass(e),n},enableButtons:function(e){return t.each(this.indexedButtons,function(t,n){n.toggleEnable(e)}),this},updateClosable:function(){return this.isRealized()&&this.getModalHeader().find("."+this.getNamespace("close-button")).toggle(this.isClosable()),this},onShow:function(t){return this.options.onshow=t,this},onShown:function(t){return this.options.onshown=t,this},onHide:function(t){return this.options.onhide=t,this},onHidden:function(t){return this.options.onhidden=t,this},isRealized:function(){return this.realized},setRealized:function(t){return this.realized=t,this},isOpened:function(){return this.opened},setOpened:function(t){return this.opened=t,this},handleModalEvents:function(){return this.getModal().on("show.bs.modal",{dialog:this},function(t){var e=t.data.dialog;return"function"==typeof e.options.onshow?e.options.onshow(e):void 0}),this.getModal().on("shown.bs.modal",{dialog:this},function(t){var e=t.data.dialog;"function"==typeof e.options.onshown&&e.options.onshown(e)}),this.getModal().on("hide.bs.modal",{dialog:this},function(t){var e=t.data.dialog;return"function"==typeof e.options.onhide?e.options.onhide(e):void 0}),this.getModal().on("hidden.bs.modal",{dialog:this},function(n){var o=n.data.dialog;"function"==typeof o.options.onhidden&&o.options.onhidden(o),o.isAutodestroy()&&t(this).remove(),e.moveFocus()}),this.getModal().on("click",{dialog:this},function(t){t.target===this&&t.data.dialog.isClosable()&&t.data.dialog.canCloseByBackdrop()&&t.data.dialog.close()}),this.getModal().on("keyup",{dialog:this},function(t){27===t.which&&t.data.dialog.isClosable()&&t.data.dialog.canCloseByKeyboard()&&t.data.dialog.close()}),this.getModal().on("keyup",{dialog:this},function(e){var n=e.data.dialog;if("undefined"!=typeof n.registeredButtonHotkeys[e.which]){var o=t(n.registeredButtonHotkeys[e.which]);!o.prop("disabled")&&o.focus().trigger("click")}}),this},makeModalDraggable:function(){return this.options.draggable&&(this.getModalHeader().addClass(this.getNamespace("draggable")).on("mousedown",{dialog:this},function(t){var e=t.data.dialog;e.draggableData.isMouseDown=!0;var n=e.getModalContent().offset();e.draggableData.mouseOffset={top:t.clientY-n.top,left:t.clientX-n.left}}),this.getModal().on("mouseup mouseleave",{dialog:this},function(t){t.data.dialog.draggableData.isMouseDown=!1}),t("body").on("mousemove",{dialog:this},function(t){var e=t.data.dialog;e.draggableData.isMouseDown&&e.getModalContent().offset({top:t.clientY-e.draggableData.mouseOffset.top,left:t.clientX-e.draggableData.mouseOffset.left})})),this},updateZIndex:function(){var n=0;t.each(e.dialogs,function(){n++});var o=this.getModal(),i=o.data("bs.modal").$backdrop;return o.css("z-index",e.ZINDEX_MODAL+20*(n-1)),i.css("z-index",e.ZINDEX_BACKDROP+20*(n-1)),this},realize:function(){return this.initModalStuff(),this.getModal().addClass(e.NAMESPACE).addClass(this.getSize()).addClass(this.getCssClass()),this.getDescription()&&this.getModal().attr("aria-describedby",this.getDescription()),this.getModalFooter().append(this.createFooterContent()),this.getModalHeader().append(this.createHeaderContent()),this.getModalBody().append(this.createBodyContent()),this.getModal().modal({backdrop:"static",keyboard:!1,show:!1}),this.makeModalDraggable(),this.handleModalEvents(),this.setRealized(!0),this.updateButtons(),this.updateType(),this.updateTitle(),this.updateMessage(),this.updateClosable(),this.updateAnimate(),this},open:function(){return!this.isRealized()&&this.realize(),this.getModal().modal("show"),this.updateZIndex(),this.setOpened(!0),this},close:function(){return this.getModal().modal("hide"),this.isAutodestroy()&&delete e.dialogs[this.getId()],this.setOpened(!1),e.showScrollbar(),this}},e.newGuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=16*Math.random()|0,n="x"===t?e:3&e|8;return n.toString(16)})},e.show=function(t){return new e(t).open()},e.alert=function(){var n={},o={type:e.TYPE_PRIMARY,title:null,message:null,closable:!0,buttonLabel:"Confirm",callback:null};return n="object"==typeof arguments[0]&&arguments[0].constructor==={}.constructor?t.extend(!0,o,arguments[0]):t.extend(!0,o,{message:arguments[0],closable:!1,buttonLabel:"Confirm",callback:"undefined"!=typeof arguments[1]?arguments[1]:null}),new e({type:n.type,title:n.title,message:n.message,closable:n.closable,data:{callback:n.callback},onhide:function(t){!t.getData("btnClicked")&&t.isClosable()&&"function"==typeof t.getData("callback")&&t.getData("callback")(!1)},buttons:[{label:n.buttonLabel,action:function(t){t.setData("btnClicked",!0),"function"==typeof t.getData("callback")&&t.getData("callback")(!0),t.close()}}]}).open()},e.confirm=function(t,n){return new e({title:"Confirm?",message:t,closable:!1,data:{callback:n},buttons:[{label:"Cancel",action:function(t){"function"==typeof t.getData("callback")&&t.getData("callback")(!1),t.close()}},{label:"Confirm",cssClass:"btn-primary",action:function(t){"function"==typeof t.getData("callback")&&t.getData("callback")(!0),t.close()}}]}).open()},e.warning=function(t){return new e({type:e.TYPE_WARNING,message:t}).open()},e.danger=function(t){return new e({type:e.TYPE_DANGER,message:t}).open()},e.success=function(t){return new e({type:e.TYPE_SUCCESS,message:t}).open()},e}); \ No newline at end of file diff --git a/public/blog/js/common.js b/public/blog/js/common.js index 8430f75..9bc5218 100644 --- a/public/blog/js/common.js +++ b/public/blog/js/common.js @@ -53,7 +53,7 @@ function getShareUrl() { return location.href; } function getShareTitle(title) { - return encodeURI(title + " (来自leanote.com)"); + return encodeURI(title + " (from https://leanote.com)"); } function shareSinaWeibo(noteId, title, pic) { var url = "http://service.weibo.com/share/share.php?title=" + getShareTitle(title) + "&url=" + getShareUrl(noteId); @@ -135,17 +135,17 @@ function getDateDiff(dateTimeStamp) { var hourC = diffValue / diff.hour; var minC = parseInt(diffValue / diff.minute); if (monthC >= 1) { - result = parseInt(monthC) + "个月前"; + result = parseInt(monthC) + " month ago"; } else if (weekC >= 1) { - result = parseInt(weekC) + "周前"; + result = parseInt(weekC) + " weeks ago"; } else if (dayC >= 1) { - result = parseInt(dayC) + "天前"; + result = parseInt(dayC) + " days ago"; } else if (hourC >= 1) { - result = parseInt(hourC) + "小时前"; + result = parseInt(hourC) + " hours ago"; } else if (minC > 1) { - result = minC + "分钟前"; + result = minC + " minutes ago"; } else { - result = "刚刚"; + result = "Just now"; } return result; } @@ -328,8 +328,8 @@ function needLogin() { var registerUrl = siteUrl + '/register?from=' + encodeURI(location.href); try { var modal = BootstrapDialog.show({ - title: "你还未登录", - message: '
立即登录, 发表评论.
没有帐号? 立即注册', + title: "Please sign in first", + message: '
Sign in to to leave a comment.
No Leanote account? Sign up now', nl2br: false }); } catch(e) {} diff --git a/public/blog/js/share_comment.js b/public/blog/js/share_comment.js index 2f10df8..dee82a8 100644 --- a/public/blog/js/share_comment.js +++ b/public/blog/js/share_comment.js @@ -26,13 +26,10 @@ var C = { } self.initEvent(); self.incReadNum(); - - // }, // 博客的统计信息 getPostStat: function() { - }, // 增加阅读量 incReadNum: function() { @@ -292,7 +289,7 @@ var C = { var commentId = $(this).parent().data("comment-id"); var t = this; try { - BootstrapDialog.confirm("确定删除该评论?", function(yes) { + BootstrapDialog.confirm("Are you sure?", function(yes) { if(yes) { deleteComment(noteId, commentId, function(ret) { if(ret.Ok) { @@ -325,20 +322,23 @@ var C = { $(t).parent().find(".like-num-i").text(ret.Num) } if(ret.IsILikeIt) { - $(t).find(".like-text").text("取消赞"); + var ever = $(t).find(".like-text").text(); + if(ever == "赞") { + $(t).find(".like-text").text("取消赞"); + } else { + $(t).find(".like-text").text("Unlike"); + } } else { - $(t).find(".like-text").text("赞"); + var ever = $(t).find(".like-text").text(); + if(ever == "取消赞") { + $(t).find(".like-text").text("赞"); + } else { + $(t).find(".like-text").text("Like"); + } } } }); }); - $(".comment-box").on("click", ".comment-report", function() { - if(needLogin()) { - return; - } - var commentId = $(this).parent().data("comment-id"); - report(commentId, self.noteId, "举报评论?"); - }); self.initShare(); }, weixinQRCodeO: $("#weixinQRCode"), @@ -349,7 +349,7 @@ var C = { self.weixinQRCodeO.qrcode(location.href); } BootstrapDialog.show({ - title: "打开微信扫一扫二维码", + title: "Open Wechat to scan the code", message: self.weixinQRCodeO }); }); diff --git a/public/blog/themes/default/archive.html b/public/blog/themes/default/archive.html index 2d19517..1fee95a 100644 --- a/public/blog/themes/default/archive.html +++ b/public/blog/themes/default/archive.html @@ -2,30 +2,37 @@
-

归档 {{if $.curCateTitle}} - {{$.curCateTitle}}{{end}}

+

Archives {{if $.curCateTitle}} - {{$.curCateTitle}}{{end}}

diff --git a/public/blog/themes/default/cate.html b/public/blog/themes/default/cate.html index 0ec59db..d74fb18 100644 --- a/public/blog/themes/default/cate.html +++ b/public/blog/themes/default/cate.html @@ -2,35 +2,11 @@
-

分类 - {{$.curCateTitle}}

+

Category - {{$.curCateTitle}}

- {{range $.posts}} -
- -
- - {{if .Tags}} - {{blogTags $ .Tags}} - {{else}} - 无 - {{end}} - | - 更新 {{.UpdatedTime | datetime}} - | - 创建 {{.CreatedTime | datetime}} -
-
- {{.Abstract | raw}} -
- 查看 -
- {{end}} - + {{template "post_abstract.html" $}} + {{template "paging.html" $}}
diff --git a/public/blog/themes/default/footer.html b/public/blog/themes/default/footer.html index a2ea9e7..49d8bb5 100644 --- a/public/blog/themes/default/footer.html +++ b/public/blog/themes/default/footer.html @@ -2,9 +2,9 @@ {{$userId := $.blogInfo.UserId}}