Commit bb579d46 authored by Liang Ding's avatar Liang Ding

Merge remote-tracking branch 'refs/remotes/origin/2.2.0-dev'

parents 12fb9e78 d1bd1eb2
...@@ -61,7 +61,7 @@ import java.util.List; ...@@ -61,7 +61,7 @@ import java.util.List;
* *
* @author <a href="http://88250.b3log.org">Liang Ding</a> * @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="https://github.com/feroozkhanchintu">feroozkhanchintu</a> * @author <a href="https://github.com/feroozkhanchintu">feroozkhanchintu</a>
* @version 1.1.0.6, Sep 28, 2016 * @version 1.1.0.6, Jun 11, 2017
* @since 0.3.1 * @since 0.3.1
*/ */
@RequestProcessor @RequestProcessor
...@@ -70,7 +70,7 @@ public class FeedProcessor { ...@@ -70,7 +70,7 @@ public class FeedProcessor {
/** /**
* Logger. * Logger.
*/ */
private static final Logger LOGGER = Logger.getLogger(FeedProcessor.class.getName()); private static final Logger LOGGER = Logger.getLogger(FeedProcessor.class);
/** /**
* Article query service. * Article query service.
...@@ -172,7 +172,7 @@ public class FeedProcessor { ...@@ -172,7 +172,7 @@ public class FeedProcessor {
} }
private Entry getEntry(final boolean hasMultipleUsers, String authorName, final JSONArray articles, private Entry getEntry(final boolean hasMultipleUsers, String authorName, final JSONArray articles,
final boolean isFullContent, int i) final boolean isFullContent, int i)
throws org.json.JSONException, org.b3log.latke.service.ServiceException { throws org.json.JSONException, org.b3log.latke.service.ServiceException {
final JSONObject article = articles.getJSONObject(i); final JSONObject article = articles.getJSONObject(i);
final Entry ret = new Entry(); final Entry ret = new Entry();
...@@ -211,27 +211,22 @@ public class FeedProcessor { ...@@ -211,27 +211,22 @@ public class FeedProcessor {
@RequestProcessing(value = {"/tag-articles-feed.do"}, method = {HTTPRequestMethod.GET, HTTPRequestMethod.HEAD}) @RequestProcessing(value = {"/tag-articles-feed.do"}, method = {HTTPRequestMethod.GET, HTTPRequestMethod.HEAD})
public void tagArticlesAtom(final HTTPRequestContext context) throws IOException { public void tagArticlesAtom(final HTTPRequestContext context) throws IOException {
final AtomRenderer renderer = new AtomRenderer(); final AtomRenderer renderer = new AtomRenderer();
context.setRenderer(renderer); context.setRenderer(renderer);
final HttpServletRequest request = context.getRequest(); final HttpServletRequest request = context.getRequest();
final HttpServletResponse response = context.getResponse(); final HttpServletResponse response = context.getResponse();
final String queryString = request.getQueryString(); final String tagId = request.getParameter(Keys.OBJECT_ID);
if (Strings.isEmptyOrNull(tagId)) {
response.sendError(HttpServletResponse.SC_NOT_FOUND);
if (Strings.isEmptyOrNull(queryString)) {
response.sendError(HttpServletResponse.SC_BAD_REQUEST);
return; return;
} }
final String oIdMap = queryString.split("&")[0];
final String tagId = oIdMap.split("=")[1];
final Feed feed = new Feed(); final Feed feed = new Feed();
try { try {
final JSONObject tag = tagRepository.get(tagId); final JSONObject tag = tagRepository.get(tagId);
if (null == tag) { if (null == tag) {
response.sendError(HttpServletResponse.SC_NOT_FOUND); response.sendError(HttpServletResponse.SC_NOT_FOUND);
return; return;
...@@ -305,7 +300,7 @@ public class FeedProcessor { ...@@ -305,7 +300,7 @@ public class FeedProcessor {
} }
private Entry getEntryForArticle(final List<JSONObject> articles, final boolean hasMultipleUsers, String authorName, private Entry getEntryForArticle(final List<JSONObject> articles, final boolean hasMultipleUsers, String authorName,
final boolean isFullContent, int i) final boolean isFullContent, int i)
throws org.json.JSONException, org.b3log.latke.service.ServiceException { throws org.json.JSONException, org.b3log.latke.service.ServiceException {
final JSONObject article = articles.get(i); final JSONObject article = articles.get(i);
final Entry ret = new Entry(); final Entry ret = new Entry();
...@@ -343,14 +338,12 @@ public class FeedProcessor { ...@@ -343,14 +338,12 @@ public class FeedProcessor {
public void blogArticlesRSS(final HTTPRequestContext context) { public void blogArticlesRSS(final HTTPRequestContext context) {
final HttpServletResponse response = context.getResponse(); final HttpServletResponse response = context.getResponse();
final RssRenderer renderer = new RssRenderer(); final RssRenderer renderer = new RssRenderer();
context.setRenderer(renderer); context.setRenderer(renderer);
final Channel channel = new Channel(); final Channel channel = new Channel();
try { try {
final JSONObject preference = preferenceQueryService.getPreference(); final JSONObject preference = preferenceQueryService.getPreference();
if (null == preference) { if (null == preference) {
response.sendError(HttpServletResponse.SC_NOT_FOUND); response.sendError(HttpServletResponse.SC_NOT_FOUND);
return; return;
...@@ -409,7 +402,7 @@ public class FeedProcessor { ...@@ -409,7 +402,7 @@ public class FeedProcessor {
} }
private Item getItem(final JSONArray articles, final boolean hasMultipleUsers, String authorName, private Item getItem(final JSONArray articles, final boolean hasMultipleUsers, String authorName,
final boolean isFullContent, int i) final boolean isFullContent, int i)
throws org.json.JSONException, org.b3log.latke.service.ServiceException { throws org.json.JSONException, org.b3log.latke.service.ServiceException {
final JSONObject article = articles.getJSONObject(i); final JSONObject article = articles.getJSONObject(i);
final Item ret = new Item(); final Item ret = new Item();
...@@ -453,24 +446,19 @@ public class FeedProcessor { ...@@ -453,24 +446,19 @@ public class FeedProcessor {
final HttpServletRequest request = context.getRequest(); final HttpServletRequest request = context.getRequest();
final RssRenderer renderer = new RssRenderer(); final RssRenderer renderer = new RssRenderer();
context.setRenderer(renderer); context.setRenderer(renderer);
final String queryString = request.getQueryString(); final String tagId = request.getParameter(Keys.OBJECT_ID);
if (Strings.isEmptyOrNull(tagId)) {
response.sendError(HttpServletResponse.SC_NOT_FOUND);
if (Strings.isEmptyOrNull(queryString)) {
response.sendError(HttpServletResponse.SC_BAD_REQUEST);
return; return;
} }
final String oIdMap = queryString.split("&")[0];
final String tagId = oIdMap.split("=")[1];
final Channel channel = new Channel(); final Channel channel = new Channel();
try { try {
final JSONObject tag = tagRepository.get(tagId); final JSONObject tag = tagRepository.get(tagId);
if (null == tag) { if (null == tag) {
response.sendError(HttpServletResponse.SC_NOT_FOUND); response.sendError(HttpServletResponse.SC_NOT_FOUND);
return; return;
...@@ -549,7 +537,7 @@ public class FeedProcessor { ...@@ -549,7 +537,7 @@ public class FeedProcessor {
} }
private Item getItemForArticles(final List<JSONObject> articles, final boolean hasMultipleUsers, String authorName, private Item getItemForArticles(final List<JSONObject> articles, final boolean hasMultipleUsers, String authorName,
final boolean isFullContent, int i) final boolean isFullContent, int i)
throws org.json.JSONException, org.b3log.latke.service.ServiceException { throws org.json.JSONException, org.b3log.latke.service.ServiceException {
final JSONObject article = articles.get(i); final JSONObject article = articles.get(i);
final Item ret = new Item(); final Item ret = new Item();
......
/**
* Copyright (c) 2010-2017, b3log.org & hacpai.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
body,input,textarea{font-family:"Helvetica Neue","Luxi Sans","DejaVu Sans",Tahoma,"Hiragino Sans GB","Microsoft Yahei",sans-serif}html,body{min-width:1024px;color:#767676;background:#f1f2f7;font-size:13px}a{color:#4183c4;text-decoration:none}a:visited{color:#7ba9d6}a:active{color:#2c5d8d}a:hover{text-decoration:underline}.content-reset{font-family:"Helvetica Neue","Luxi Sans","DejaVu Sans",Tahoma,"Hiragino Sans GB","Microsoft Yahei",sans-serif;word-wrap:break-word;overflow:hidden;line-height:1.5}.content-reset ul,.content-reset ol{padding-left:2em;margin-top:0;margin-bottom:16px}.content-reset h1,.content-reset h2,.content-reset h3,.content-reset h4,.content-reset h5,.content-reset h6{margin-top:24px;margin-bottom:16px;font-weight:600;line-height:1.25}.content-reset h1{padding-bottom:.3em;font-size:2em}.content-reset h2{padding-bottom:.3em;font-size:1.5em}.content-reset h3{font-size:1.25em}.content-reset h4{font-size:1em}.content-reset h5{font-size:.875em}.content-reset h6{font-size:.85em}.content-reset p{margin-top:0;margin-bottom:16px}.content-reset blockquote{padding:0 1em;color:#777;border-left:.25em solid #ddd;margin-bottom:16px}.content-reset blockquote p{margin:0}.content-reset iframe{border:1px solid #ccc}.content-reset table{width:100%;border:1px solid #dedede;margin:15px auto;border-collapse:collapse;empty-cells:show}.content-reset thead{text-align:center}.content-reset td,.content-reset th{height:35px;border:1px solid #dedede;padding:0 10px}.content-reset th{font-weight:bold;text-align:center !important;background:rgba(158,188,226,0.2)}.content-reset tbody tr:nth-child(2n){background:rgba(158,188,226,0.12)}.content-reset tr:hover{background:#efefef}.content-reset code{padding:.2em .4em;margin:0;font-size:85%;background-color:rgba(252,41,41,0.12);border-radius:3px;color:#d23f31;font-family:mononoki,Consolas,"Liberation Mono",Menlo,Courier,monospace}.content-reset pre>code{padding:.5em;border-radius:0;color:#333;background-color:rgba(0,0,0,0.04);background-image:url(../images/code-bg.png);background-size:20px 20px;border-radius:5px}.content-reset kbd{display:inline-block;padding:3px 5px;font:11px Consolas,"Liberation Mono",Menlo,Courier,monospace;line-height:10px;color:#555;vertical-align:middle;background-color:#fcfcfc;border:solid 1px #ccc;border-bottom-color:#bbb;border-radius:3px;box-shadow:inset 0 -1px 0 #bbb}.tooltipped{position:relative;cursor:pointer}.tooltipped::after{position:absolute;z-index:1000000;display:none;padding:5px 8px;font-size:11px;font-weight:normal;-webkit-font-smoothing:subpixel-antialiased;color:#fff;text-align:center;text-decoration:none;text-shadow:none;text-transform:none;letter-spacing:normal;word-wrap:break-word;white-space:pre;pointer-events:none;content:attr(aria-label);background:rgba(0,0,0,0.8);border-radius:3px;line-height:16px;opacity:0}.tooltipped::before{position:absolute;z-index:1000001;display:none;width:0;height:0;color:rgba(0,0,0,0.8);pointer-events:none;content:"";border:5px solid transparent;opacity:0}@-webkit-keyframes tooltip-appear{from{opacity:0}to{opacity:1}}@keyframes tooltip-appear{from{opacity:0}to{opacity:1}}.tooltipped-hover::before,.tooltipped-hover::after,.tooltipped:hover::before,.tooltipped:hover::after,.tooltipped:active::before,.tooltipped:active::after,.tooltipped:focus::before,.tooltipped:focus::after{display:inline-block;text-decoration:none;-webkit-animation-name:tooltip-appear;animation-name:tooltip-appear;-webkit-animation-duration:.1s;animation-duration:.1s;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards;-webkit-animation-timing-function:ease-in;animation-timing-function:ease-in;-webkit-animation-delay:.4s;animation-delay:.4s}.tooltipped-s::after,.tooltipped-se::after,.tooltipped-sw::after{top:100%;right:50%;margin-top:5px}.tooltipped-s::before,.tooltipped-se::before,.tooltipped-sw::before{top:auto;right:50%;bottom:-5px;margin-right:-5px;border-bottom-color:rgba(0,0,0,0.8)}.tooltipped-se::after{right:auto;left:50%;margin-left:-15px}.tooltipped-sw::after{margin-right:-15px}.tooltipped-n::after,.tooltipped-ne::after,.tooltipped-nw::after{right:50%;bottom:100%;margin-bottom:5px}.tooltipped-n::before,.tooltipped-ne::before,.tooltipped-nw::before{top:-5px;right:50%;bottom:auto;margin-right:-5px;border-top-color:rgba(0,0,0,0.8)}.tooltipped-ne::after{right:auto;left:50%;margin-left:-15px}.tooltipped-nw::after{margin-right:-15px}.tooltipped-s::after,.tooltipped-n::after{-webkit-transform:translateX(50%);transform:translateX(50%)}.tooltipped-w::after{right:100%;bottom:50%;margin-right:5px;-webkit-transform:translateY(50%);transform:translateY(50%)}.tooltipped-w::before{top:50%;bottom:50%;left:-5px;margin-top:-5px;border-left-color:rgba(0,0,0,0.8)}.tooltipped-e::after{bottom:50%;left:100%;margin-left:5px;-webkit-transform:translateY(50%);transform:translateY(50%)}.tooltipped-e::before{top:50%;right:-5px;bottom:50%;margin-top:-5px;border-right-color:rgba(0,0,0,0.8)}button,.completed-ck span{padding:6px 12px;margin-bottom:0;font-size:14px;font-weight:400;text-align:center;white-space:nowrap;vertical-align:baseline;cursor:pointer;user-select:none;background-image:none;border:1px solid #1fb5ad;border-radius:4px;background-color:#1fb5ad;color:#fff;height:auto;outline:0;line-height:18px}button:hover{background-color:#1ca59e;border-color:#1ca59e}@font-face{font-family:'icomoon';src:url('fonts/icomoon.eot?f71494');src:url('fonts/icomoon.eot?f71494#iefix') format('embedded-opentype'),url('fonts/icomoon.ttf?f71494') format('truetype'),url('fonts/icomoon.woff?f71494') format('woff'),url('fonts/icomoon.svg?f71494#icomoon') format('svg');font-weight:normal;font-style:normal}[class^="icon-"],[class*=" icon-"]{font-family:'icomoon' !important;speak:none;font-style:normal;font-weight:normal;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.icon-move-down:before{content:"\e90a"}.icon-move-up:before{content:"\e90b"}.icon-points:before{content:"\e900"}.icon-goods:before{content:"\e904"}.icon-bold:before{content:"\e000"}.icon-italic:before{content:"\e001"}.icon-quote:before{content:"\e003"}.icon-unordered-list:before{content:"\e004"}.icon-ordered-list:before{content:"\e005"}.icon-link:before{content:"\e006"}.icon-image:before{content:"\e007"}.icon-play:before{content:"\e008"}.icon-music:before{content:"\e009"}.icon-contract:before{content:"\e00a"}.icon-fullscreen:before{content:"\e00b"}.icon-question:before{content:"\e00c"}.icon-info:before{content:"\e00d"}.icon-undo:before{content:"\e00e"}.icon-redo:before{content:"\e00f"}.icon-code:before{content:"\e011"}.icon-preview:before{content:"\e002"}.icon-navigation:before{content:"\e903"}.icon-thumbs-down:before{content:"\e901"}.icon-thumbs-up:before{content:"\e902"}.icon-video:before{content:"\f057"}.icon-feed:before{content:"\e61f"}.icon-article:before{content:"\e61d"}.icon-star:before{content:"\e600"}.icon-register:before{content:"\e602"}.icon-logout:before{content:"\e603"}.icon-setting:before{content:"\e604"}.icon-google:before{content:"\e605"}.icon-search:before{content:"\e606"}.icon-weibo:before{content:"\e607"}.icon-date:before{content:"\e608"}.icon-view:before{content:"\e609"}.icon-cmts:before{content:"\e60a"}.icon-refresh:before{content:"\e60b"}.icon-up:before{content:"\e60c"}.icon-twitter:before{content:"\e60d"}.icon-edit:before{content:"\e60e"}.icon-tencent:before{content:"\e60f"}.icon-tag:before{content:"\e610"}.icon-tags:before{content:"\e611"}.icon-addfile:before{content:"\e612"}.icon-login:before{content:"\e613"}.icon-articles:before{content:"\e614"}.icon-userrole:before{content:"\e615"}.icon-email:before{content:"\e616"}.icon-flag:before{content:"\e617"}.icon-chevron-down:before{content:"\e618"}.icon-chevron-up:before{content:"\e619"}.icon-reply:before{content:"\e61a"}.icon-clock:before{content:"\e61b"}.icon-compass:before{content:"\e61c"}.icon-heart:before{content:"\e9da"}.icon-locked:before{content:"\e61e"}.icon-close:before{content:"\e909"}.icon-wechat:before{content:"\e907"}.icon-upload:before{content:"\f0ee"}.icon-copy:before{content:"\e908"}.icon-time:before{content:"\e906"}.icon-sortasc:before{content:"\e905"}a[class^="icon-"],a[class*=" icon-"]{color:#333}a[class^="icon-"]:hover,a[class*=" icon-"]:hover{text-decoration:none;color:#4183c4}.aboutIcon{background-position:-16px -48px}.icon-move-down,.icon-move-up{cursor:pointer}#allPanel{height:auto;min-height:100%;position:relative}#tabsPanel{margin:50px 0 0 240px;padding:15px;min-height:100px}#tabsPanel>div{padding-bottom:36px}#tabsPanel_article-list,#tabsPanel_draft-list,#tabsPanel_comment-list,#tabsPanel_plugin-list,#tabsPanel_page-list>div:first-child,#tabsPanel_user-list>div:first-child,#tabsPanel_category-list>div:first-child,#tabsPanel_link-list>div:first-child{background-color:#FFF;border-radius:4px;margin-bottom:40px;overflow:hidden}.tip{font-weight:bold;margin:0 auto;overflow:hidden;padding:2px 0;position:fixed;text-align:center;top:3px;left:255px;z-index:1001}#tipMsg,#loadMsg{color:#31708f;background-color:#d9edf7;border-radius:4px;line-height:40px;display:inline-block}.footer{bottom:12px;position:absolute;text-align:center;width:100%;padding-left:240px;box-sizing:border-box}#top{height:50px;position:fixed;box-shadow:1px 0 3px rgba(0,0,0,.15);width:100%;top:0;background-color:#fff;z-index:80}#top>a{background:#1fb5ad;float:left;width:240px;height:50px;position:relative;color:#f7f7f7;text-align:center;text-decoration:none;font-size:20px;line-height:50px}#top>.right a{color:#555;line-height:50px;margin:0 10px;border:1px solid #f6f6f6;background-color:#f6f6f6;border-radius:100px;padding:10px;text-decoration:none}#top>.right a:hover{color:#333}#tabs{height:100%;min-height:468px;width:240px;margin-top:50px;position:fixed;top:0;background-color:#32323a;overflow:auto}#tabs ul{list-style:none}#tabs li{margin-left:0;border-bottom:1px solid rgba(255,255,255,0.05)}#tabs li>div>a,#tabs #tabToolsTitle,#tabs #tabArticleTitle{color:#aeb2b7;display:block;text-decoration:none;letter-spacing:1px;padding:18px 0 18px 25px;line-height:18px;height:18px;transition:all .3s ease}#tabs a:hover,#tabs a.tab-current,#tabs #tabToolsTitle.tab-current,#tabs #tabArticleTitle.tab-current,#tabs #tabToolsTitle:hover,#tabs #tabArticleTitle:hover{background-color:#28282e;color:#1fb5ad}#tabs li li{border-bottom:0}#tabs li li>div>a{padding:13px 0 13px 46px;line-height:15px;height:15px;background-color:#28282e}#tabs li li>div>a:hover,#tabs li li>div>a.tab-current{background-color:#202025}#tabs .commentIcon,#tabs .postIcon,#tabs .preferenceIcon,#tabs .usersIcon,#tabs .aboutIcon{display:none}#tabs .icon-chevron-up,#tabs .icon-chevron-down{margin-right:10px}.sub-tabs{background-color:#e0e1e7;border-radius:4px 4px 0 0;overflow:hidden}.sub-tabs ul{float:left;list-style:none outside none;margin-right:24px}.sub-tabs li{float:left;margin:0}.sub-tabs li a{border-right:1px solid #e0e1e7;color:#898989;display:block;line-height:18px;padding:20px 15px;text-decoration:none}.sub-tabs .tab-current,.sub-tabs .tab-current:hover,.sub-tabs a:hover{background-color:#fff;color:#1fb5ad}.sub-tabs-main{background-color:#fff;padding:15px;border-radius:0 0 4px 4px}.form>div{margin:15px 0}.form label{margin-bottom:10px;display:inline-block}.form input[type='text'],.form input[type='password'],.form textarea{font-size:14px;outline:medium none;width:100%;padding:6px 12px;height:34px;box-sizing:border-box;border:1px solid #e2e2e4;color:#333;border-radius:4px;transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s}.form textarea{height:auto}.form input[type='text']:focus,.form input[type='password']:focus,.form textarea:focus{box-shadow:none;border-color:#1fb5ad}table.form label{margin:10px 0 0 0}table.form th{vertical-align:initial}.module-panel{border-radius:4px;background-color:#fff;margin-bottom:20px;min-height:160px}.module-header{background:#fafafa;padding:15px;border-bottom:1px solid #eff2f7;border-top-left-radius:3px;border-top-right-radius:3px}.module-header h2{font-size:13px;font-weight:400}.module-header a{color:#767676;text-decoration:none}.module-header a:hover{color:#1fb5ad}.module-panel .module-body{padding:15px}.module-panel .module-body li{padding:10px;line-height:18px;border-bottom:1px solid #ddd}.module-panel .module-body li:hover{background-color:#f5f5f5}.module-panel .module-body li a:hover{text-decoration:none}.comment-title{background-color:#ececec;border-bottom:1px solid #dfdfdf;border-top:1px solid #f9f9f9;padding:3px 6px 3px 12px}#comments{height:462px;overflow:auto}#articleUpload input{width:170px}button#submitArticle{background-color:#fa8564;border-color:#fa8564}button#submitArticle:hover{background-color:#ec6459;border-color:#ec6459}.CodeMirror{border-radius:0 0 3px 3px;box-shadow:0 1px 2px rgba(0,0,0,0.075) inset;border:1px solid #ccc;margin-bottom:20px;border-top-width:0;height:470px}.comment-content .CodeMirror{height:170px}#pagePagePanel{margin-top:0}#skinsPanel{min-width:328px;width:99%}.skinPreview{cursor:pointer;height:160px;margin:6px;width:280px}.skinItem{background-color:#fafafa;border-radius:3px;box-shadow:1px 1px 3px #333;line-height:16px;margin:10px;text-align:center}#skinMain .skinItem.selected{background-color:#1fb5ad}.skinItem:hover{background-color:#EEE}.f-blue,.error-msg{color:#36c}.signs button{margin:0 12px}#keyOfSolo{width:200px}.small-head{float:left;height:35px;margin:3px 9px 0 3px;width:35px}#commentTable .table-main td{vertical-align:top}.about-logo{float:left;margin:62px 36px 62px 24px}.about-margin{font-size:20px;margin:20px 0}.content-reset .about-list li{border:0}.content-reset .about-list li:hover{background-color:#fff;text-decoration:underline}.completed-input{margin:2px 12px 0 0}.completed-panel{background-color:#fff;border:1px solid #ddd;color:#00c;display:none;overflow:auto;padding:2px;position:absolute;z-index:10;width:50%;border-top:0}.completed-panel a{display:block;text-decoration:none;line-height:26px;padding:0 5px}.completed-panel a.selected{background-color:#f5f5f5;color:#fa8564}.completed-ck{margin-top:9px}.completed-ck span,.signs button{margin:5px 10px 5px 0;display:inline-block;background-color:#c7cbd6;border-color:#c7cbd6}.completed-ck span:hover,.signs button:hover{background-color:#b0b5b9;border-color:#b0b5b9}.completed-ck span.selected,.signs button.selected{background-color:#1ca59e;border-color:#1ca59e;color:#fff}.dialog-background{background-color:#000;display:none;filter:alpha(opacity=30);height:100%;left:0;opacity:.3;position:fixed;top:0;width:100%;z-index:90}.dialog-panel{display:none;position:absolute;z-index:100}.dialog-title{color:#fff;float:left;font-size:12px;line-height:27px;margin-left:3px}.dialog-header-bg{background:#f1f1f1;border-color:#c0c0c0 #d9d9d9 #d9d9d9;border-radius:6px 6px 0 0;border-style:solid;border-width:1px 1px 0;cursor:move;height:34px}.dialog-header-bg .icon-close{cursor:pointer;float:right;height:18px;margin-top:6px;padding:3px;width:22px}.dialog-main{background-color:#fff;border:1px solid #666;border-color:#c0c0c0 #d9d9d9 #d9d9d9;border-top-width:0;padding:12px}.paginate-paginate div.button.paginate-page,.paginate-paginate a,.paginate-pageCount,.pagination-pages{border:1px solid #eff2f7;padding:6px 12px;cursor:pointer;float:left;line-height:18px;background:#eee;height:18px;margin-left:1px;border-radius:0;text-decoration:none;color:#333}.pagination-current-page,.paginate-pageCount{cursor:auto}.paginate-pageCount{margin-left:10px}.pagination-current-page,.paginate-paginate a:hover,.paginate-paginate div.button.paginate-page:hover,.pagination-pages:hover{border-color:#2eb4ad;background-color:#2eb4ad;color:#FFF}.paginate-paginate div.button{padding:0;float:left;border:0;background:0}.paginate-inputPage{height:26px;width:24px;margin:0 5px}.table-main{margin:0;padding:0;position:relative}.table-main table{word-break:break-all;word-wrap:break-word}.table-header{border-bottom:1px solid #ddd;background-color:#fafafa;padding:15px 0}.table-header th{line-height:18px;text-align:left;text-indent:6px;font-weight:normal}.table-main td{border-bottom:1px solid #ddd;color:#767676;padding:10px 0}.table-lineHover .table-hasExpend td{border-bottom:0}.table-heiglight td,.table-lineHover td{background-color:#f5f5f5;border-right-color:#f5f5f5}.table-expendRow td{padding:0 0 5px 36px}.table-expendRow td span{margin-left:60px}.table-expendRow td a{padding:1px 5px;font-size:12px;line-height:1.5;border-radius:3px;text-decoration:none;color:#FFF;background-color:#c7cbd6;border-color:#c7cbd6}.table-expendRow td a:hover{background-color:#b0b5b9;border-color:#b0b5b9}.table-center{margin:0 auto}.table-tag{color:#d54121;font-size:12px;font-style:italic;margin-left:10px}.tip-panel{background-color:#FFF;box-shadow:0 3px 10px #8b8b8b;display:none;max-height:500px;max-width:500px;overflow:hidden;padding:3px;position:absolute;z-index:1} body,input,textarea{font-family:"Helvetica Neue","Luxi Sans","DejaVu Sans",Tahoma,"Hiragino Sans GB","Microsoft Yahei",sans-serif}html,body{min-width:1024px;color:#767676;background:#f1f2f7;font-size:13px}a{color:#4183c4;text-decoration:none}a:visited{color:#7ba9d6}a:active{color:#2c5d8d}a:hover{text-decoration:underline}.content-reset{font-family:"Helvetica Neue","Luxi Sans","DejaVu Sans",Tahoma,"Hiragino Sans GB","Microsoft Yahei",sans-serif;word-wrap:break-word;overflow:hidden;line-height:1.5}.content-reset ul,.content-reset ol{padding-left:2em;margin-top:0;margin-bottom:16px}.content-reset h1,.content-reset h2,.content-reset h3,.content-reset h4,.content-reset h5,.content-reset h6{margin-top:24px;margin-bottom:16px;font-weight:600;line-height:1.25}.content-reset h1{padding-bottom:.3em;font-size:2em}.content-reset h2{padding-bottom:.3em;font-size:1.5em}.content-reset h3{font-size:1.25em}.content-reset h4{font-size:1em}.content-reset h5{font-size:.875em}.content-reset h6{font-size:.85em}.content-reset p{margin-top:0;margin-bottom:16px}.content-reset blockquote{padding:0 1em;color:#777;border-left:.25em solid #ddd;margin-bottom:16px}.content-reset blockquote p{margin:0}.content-reset iframe{border:1px solid #ccc}.content-reset table{width:100%;border:1px solid #dedede;margin:15px auto;border-collapse:collapse;empty-cells:show}.content-reset thead{text-align:center}.content-reset td,.content-reset th{height:35px;border:1px solid #dedede;padding:0 10px}.content-reset th{font-weight:bold;text-align:center !important;background:rgba(158,188,226,0.2)}.content-reset tbody tr:nth-child(2n){background:rgba(158,188,226,0.12)}.content-reset tr:hover{background:#efefef}.content-reset code{padding:.2em .4em;margin:0;font-size:85%;background-color:rgba(252,41,41,0.12);border-radius:3px;color:#d23f31;font-family:mononoki,Consolas,"Liberation Mono",Menlo,Courier,monospace}.content-reset pre>code{padding:.5em;border-radius:0;color:#333;background-color:rgba(0,0,0,0.04);background-image:url(../images/code-bg.png);background-size:20px 20px;border-radius:5px}.content-reset kbd{display:inline-block;padding:3px 5px;font:11px Consolas,"Liberation Mono",Menlo,Courier,monospace;line-height:10px;color:#555;vertical-align:middle;background-color:#fcfcfc;border:solid 1px #ccc;border-bottom-color:#bbb;border-radius:3px;box-shadow:inset 0 -1px 0 #bbb}.tooltipped{position:relative;cursor:pointer}.tooltipped::after{position:absolute;z-index:1000000;display:none;padding:5px 8px;font-size:11px;font-weight:normal;-webkit-font-smoothing:subpixel-antialiased;color:#fff;text-align:center;text-decoration:none;text-shadow:none;text-transform:none;letter-spacing:normal;word-wrap:break-word;white-space:pre;pointer-events:none;content:attr(aria-label);background:rgba(0,0,0,0.8);border-radius:3px;line-height:16px;opacity:0}.tooltipped::before{position:absolute;z-index:1000001;display:none;width:0;height:0;color:rgba(0,0,0,0.8);pointer-events:none;content:"";border:5px solid transparent;opacity:0}@-webkit-keyframes tooltip-appear{from{opacity:0}to{opacity:1}}@keyframes tooltip-appear{from{opacity:0}to{opacity:1}}.tooltipped-hover::before,.tooltipped-hover::after,.tooltipped:hover::before,.tooltipped:hover::after,.tooltipped:active::before,.tooltipped:active::after,.tooltipped:focus::before,.tooltipped:focus::after{display:inline-block;text-decoration:none;-webkit-animation-name:tooltip-appear;animation-name:tooltip-appear;-webkit-animation-duration:.1s;animation-duration:.1s;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards;-webkit-animation-timing-function:ease-in;animation-timing-function:ease-in;-webkit-animation-delay:.4s;animation-delay:.4s}.tooltipped-s::after,.tooltipped-se::after,.tooltipped-sw::after{top:100%;right:50%;margin-top:5px}.tooltipped-s::before,.tooltipped-se::before,.tooltipped-sw::before{top:auto;right:50%;bottom:-5px;margin-right:-5px;border-bottom-color:rgba(0,0,0,0.8)}.tooltipped-se::after{right:auto;left:50%;margin-left:-15px}.tooltipped-sw::after{margin-right:-15px}.tooltipped-n::after,.tooltipped-ne::after,.tooltipped-nw::after{right:50%;bottom:100%;margin-bottom:5px}.tooltipped-n::before,.tooltipped-ne::before,.tooltipped-nw::before{top:-5px;right:50%;bottom:auto;margin-right:-5px;border-top-color:rgba(0,0,0,0.8)}.tooltipped-ne::after{right:auto;left:50%;margin-left:-15px}.tooltipped-nw::after{margin-right:-15px}.tooltipped-s::after,.tooltipped-n::after{-webkit-transform:translateX(50%);transform:translateX(50%)}.tooltipped-w::after{right:100%;bottom:50%;margin-right:5px;-webkit-transform:translateY(50%);transform:translateY(50%)}.tooltipped-w::before{top:50%;bottom:50%;left:-5px;margin-top:-5px;border-left-color:rgba(0,0,0,0.8)}.tooltipped-e::after{bottom:50%;left:100%;margin-left:5px;-webkit-transform:translateY(50%);transform:translateY(50%)}.tooltipped-e::before{top:50%;right:-5px;bottom:50%;margin-top:-5px;border-right-color:rgba(0,0,0,0.8)}button,.completed-ck span{padding:6px 12px;margin-bottom:0;font-size:14px;font-weight:400;text-align:center;white-space:nowrap;vertical-align:baseline;cursor:pointer;user-select:none;background-image:none;border:1px solid #1fb5ad;border-radius:4px;background-color:#1fb5ad;color:#fff;height:auto;outline:0;line-height:18px}button:hover{background-color:#1ca59e;border-color:#1ca59e}@font-face{font-family:'icomoon';src:url('fonts/icomoon.eot?f71494');src:url('fonts/icomoon.eot?f71494#iefix') format('embedded-opentype'),url('fonts/icomoon.ttf?f71494') format('truetype'),url('fonts/icomoon.woff?f71494') format('woff'),url('fonts/icomoon.svg?f71494#icomoon') format('svg');font-weight:normal;font-style:normal}[class^="icon-"],[class*=" icon-"]{font-family:'icomoon' !important;speak:none;font-style:normal;font-weight:normal;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.icon-move-down:before{content:"\e90a"}.icon-move-up:before{content:"\e90b"}.icon-points:before{content:"\e900"}.icon-goods:before{content:"\e904"}.icon-bold:before{content:"\e000"}.icon-italic:before{content:"\e001"}.icon-quote:before{content:"\e003"}.icon-unordered-list:before{content:"\e004"}.icon-ordered-list:before{content:"\e005"}.icon-link:before{content:"\e006"}.icon-image:before{content:"\e007"}.icon-play:before{content:"\e008"}.icon-music:before{content:"\e009"}.icon-contract:before{content:"\e00a"}.icon-fullscreen:before{content:"\e00b"}.icon-question:before{content:"\e00c"}.icon-info:before{content:"\e00d"}.icon-undo:before{content:"\e00e"}.icon-redo:before{content:"\e00f"}.icon-code:before{content:"\e011"}.icon-preview:before{content:"\e002"}.icon-navigation:before{content:"\e903"}.icon-thumbs-down:before{content:"\e901"}.icon-thumbs-up:before{content:"\e902"}.icon-video:before{content:"\f057"}.icon-feed:before{content:"\e61f"}.icon-article:before{content:"\e61d"}.icon-star:before{content:"\e600"}.icon-register:before{content:"\e602"}.icon-logout:before{content:"\e603"}.icon-setting:before{content:"\e604"}.icon-google:before{content:"\e605"}.icon-search:before{content:"\e606"}.icon-weibo:before{content:"\e607"}.icon-date:before{content:"\e608"}.icon-view:before{content:"\e609"}.icon-cmts:before{content:"\e60a"}.icon-refresh:before{content:"\e60b"}.icon-up:before{content:"\e60c"}.icon-twitter:before{content:"\e60d"}.icon-edit:before{content:"\e60e"}.icon-tencent:before{content:"\e60f"}.icon-tag:before{content:"\e610"}.icon-tags:before{content:"\e611"}.icon-addfile:before{content:"\e612"}.icon-login:before{content:"\e613"}.icon-articles:before{content:"\e614"}.icon-userrole:before{content:"\e615"}.icon-email:before{content:"\e616"}.icon-flag:before{content:"\e617"}.icon-chevron-down:before{content:"\e618"}.icon-chevron-up:before{content:"\e619"}.icon-reply:before{content:"\e61a"}.icon-clock:before{content:"\e61b"}.icon-compass:before{content:"\e61c"}.icon-heart:before{content:"\e9da"}.icon-locked:before{content:"\e61e"}.icon-close:before{content:"\e909"}.icon-wechat:before{content:"\e907"}.icon-upload:before{content:"\f0ee"}.icon-copy:before{content:"\e908"}.icon-time:before{content:"\e906"}.icon-sortasc:before{content:"\e905"}a[class^="icon-"],a[class*=" icon-"]{color:#333}a[class^="icon-"]:hover,a[class*=" icon-"]:hover{text-decoration:none;color:#4183c4}.aboutIcon{background-position:-16px -48px}.icon-move-down,.icon-move-up{cursor:pointer}#allPanel{height:auto;min-height:100%;position:relative}#tabsPanel{margin:50px 0 0 240px;padding:15px;min-height:100px}#tabsPanel>div{padding-bottom:36px}#tabsPanel_article-list,#tabsPanel_draft-list,#tabsPanel_comment-list,#tabsPanel_plugin-list,#tabsPanel_page-list>div:first-child,#tabsPanel_user-list>div:first-child,#tabsPanel_category-list>div:first-child,#tabsPanel_link-list>div:first-child{background-color:#FFF;border-radius:4px;margin-bottom:40px;overflow:hidden}.tip{font-weight:bold;margin:0 auto;overflow:hidden;padding:2px 0;position:fixed;text-align:center;top:3px;left:255px;z-index:1001}#tipMsg,#loadMsg{color:#31708f;background-color:#d9edf7;border-radius:4px;line-height:40px;display:inline-block}.footer{bottom:12px;position:absolute;text-align:center;width:100%;padding-left:240px;box-sizing:border-box}#top{height:50px;position:fixed;box-shadow:1px 0 3px rgba(0,0,0,.15);width:100%;top:0;background-color:#fff;z-index:80}#top>a{background:#1fb5ad;float:left;width:240px;height:50px;position:relative;color:#f7f7f7;text-align:center;text-decoration:none;font-size:20px;line-height:50px}#top>.right a{color:#555;line-height:50px;margin:0 10px;border:1px solid #f6f6f6;background-color:#f6f6f6;border-radius:100px;padding:10px;text-decoration:none}#top>.right a:hover{color:#333}#tabs{height:100%;min-height:468px;width:240px;margin-top:50px;position:fixed;top:0;background-color:#32323a;overflow:auto}#tabs ul{list-style:none}#tabs li{margin-left:0;border-bottom:1px solid rgba(255,255,255,0.05)}#tabs li>div>a,#tabs #tabToolsTitle,#tabs #tabArticleTitle{color:#aeb2b7;display:block;text-decoration:none;letter-spacing:1px;padding:18px 0 18px 25px;line-height:18px;height:18px;transition:all .3s ease}#tabs a:hover,#tabs a.tab-current,#tabs #tabToolsTitle.tab-current,#tabs #tabArticleTitle.tab-current,#tabs #tabToolsTitle:hover,#tabs #tabArticleTitle:hover{background-color:#28282e;color:#1fb5ad}#tabs li li{border-bottom:0}#tabs li li>div>a{padding:13px 0 13px 46px;line-height:15px;height:15px;background-color:#28282e}#tabs li li>div>a:hover,#tabs li li>div>a.tab-current{background-color:#202025}#tabs .commentIcon,#tabs .postIcon,#tabs .preferenceIcon,#tabs .usersIcon,#tabs .aboutIcon{display:none}#tabs .icon-chevron-up,#tabs .icon-chevron-down{margin-right:10px}.sub-tabs{background-color:#e0e1e7;border-radius:4px 4px 0 0;overflow:hidden}.sub-tabs ul{float:left;list-style:none outside none;margin-right:24px}.sub-tabs li{float:left;margin:0}.sub-tabs li a{border-right:1px solid #e0e1e7;color:#898989;display:block;line-height:18px;padding:20px 15px;text-decoration:none}.sub-tabs .tab-current,.sub-tabs .tab-current:hover,.sub-tabs a:hover{background-color:#fff;color:#1fb5ad}.sub-tabs-main{background-color:#fff;padding:15px;border-radius:0 0 4px 4px}.form>div{margin:15px 0}.form label{margin-bottom:10px;display:inline-block}.form input[type='text'],.form input[type='password'],.form textarea{font-size:14px;outline:medium none;width:100%;padding:6px 12px;height:34px;box-sizing:border-box;border:1px solid #e2e2e4;color:#333;border-radius:4px;transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s}.form textarea{height:auto}.form input[type='text']:focus,.form input[type='password']:focus,.form textarea:focus{box-shadow:none;border-color:#1fb5ad}table.form label{margin:10px 0 0 0}table.form th{vertical-align:initial}.module-panel{border-radius:4px;background-color:#fff;margin-bottom:20px;min-height:160px}.module-header{background:#fafafa;padding:15px;border-bottom:1px solid #eff2f7;border-top-left-radius:3px;border-top-right-radius:3px}.module-header h2{font-size:13px;font-weight:400}.module-header a{color:#767676;text-decoration:none}.module-header a:hover{color:#1fb5ad}.module-panel .module-body{padding:15px}.module-panel .module-body li{padding:10px;line-height:18px;border-bottom:1px solid #ddd}.module-panel .module-body li:hover{background-color:#f5f5f5}.module-panel .module-body li a:hover{text-decoration:none}.comment-title{background-color:#ececec;border-bottom:1px solid #dfdfdf;border-top:1px solid #f9f9f9;padding:3px 6px 3px 12px}#comments{height:462px;overflow:auto}#articleUpload input{width:170px}button#submitArticle{background-color:#fa8564;border-color:#fa8564}button#submitArticle:hover{background-color:#ec6459;border-color:#ec6459}.CodeMirror{border-radius:0 0 3px 3px;box-shadow:0 1px 2px rgba(0,0,0,0.075) inset;border:1px solid #ccc;margin-bottom:20px;border-top-width:0;height:470px}.comment-content .CodeMirror{height:170px}#pagePagePanel{margin-top:0}#skinsPanel{min-width:328px;width:99%}.skinPreview{cursor:pointer;height:160px;margin:6px;width:280px}.skinItem{background-color:#fafafa;border-radius:3px;box-shadow:1px 1px 3px #333;line-height:16px;margin:10px;text-align:center}#skinMain .skinItem.selected{background-color:#1fb5ad}.skinItem:hover{background-color:#EEE}.f-blue,.error-msg{color:#36c}.signs button{margin:0 12px}#keyOfSolo{width:200px}.small-head{float:left;height:35px;margin:3px 9px 0 3px;width:35px}#commentTable .table-main td{vertical-align:top}.about-logo{float:left;margin:62px 36px 62px 24px}.about-margin{font-size:20px;margin:20px 0}.content-reset .about-list li{border:0}.content-reset .about-list li:hover{background-color:#fff;text-decoration:underline}.completed-input{margin:2px 12px 0 0}.completed-panel{background-color:#fff;border:1px solid #ddd;color:#00c;display:none;overflow:auto;padding:2px;position:absolute;z-index:10;width:50%;border-top:0}.completed-panel a{display:block;text-decoration:none;line-height:26px;padding:0 5px}.completed-panel a.selected{background-color:#f5f5f5;color:#fa8564}.completed-ck{margin-top:9px}.completed-ck span,.signs button{margin:5px 10px 5px 0;display:inline-block;background-color:#c7cbd6;border-color:#c7cbd6}.completed-ck span:hover,.signs button:hover{background-color:#b0b5b9;border-color:#b0b5b9}.completed-ck span.selected,.signs button.selected{background-color:#1ca59e;border-color:#1ca59e;color:#fff}.dialog-background{background-color:#000;display:none;filter:alpha(opacity=30);height:100%;left:0;opacity:.3;position:fixed;top:0;width:100%;z-index:90}.dialog-panel{display:none;position:absolute;z-index:100}.dialog-title{color:#fff;float:left;font-size:12px;line-height:27px;margin-left:3px}.dialog-header-bg{background:#f1f1f1;border-color:#c0c0c0 #d9d9d9 #d9d9d9;border-radius:6px 6px 0 0;border-style:solid;border-width:1px 1px 0;cursor:move;height:34px}.dialog-header-bg .icon-close{cursor:pointer;float:right;height:18px;margin-top:6px;padding:3px;width:22px}.dialog-main{background-color:#fff;border:1px solid #666;border-color:#c0c0c0 #d9d9d9 #d9d9d9;border-top-width:0;padding:12px}.paginate-paginate div.button.paginate-page,.paginate-paginate a,.paginate-pageCount,.pagination-pages{border:1px solid #eff2f7;padding:6px 12px;cursor:pointer;float:left;line-height:18px;background:#eee;height:18px;margin-left:1px;border-radius:0;text-decoration:none;color:#333}.pagination-current-page,.paginate-pageCount{cursor:auto}.paginate-pageCount{margin-left:10px}.pagination-current-page,.paginate-paginate a:hover,.paginate-paginate div.button.paginate-page:hover,.pagination-pages:hover{border-color:#2eb4ad;background-color:#2eb4ad;color:#FFF}.paginate-paginate div.button{padding:0;float:left;border:0;background:0}.paginate-inputPage{height:26px;width:24px;margin:0 5px}.table-main{margin:0;padding:0;position:relative}.table-main table{word-break:break-all;word-wrap:break-word}.table-header{border-bottom:1px solid #ddd;background-color:#fafafa;padding:15px 0}.table-header th{line-height:18px;text-align:left;text-indent:6px;font-weight:normal}.table-main td{border-bottom:1px solid #ddd;color:#767676;padding:10px 0}.table-lineHover .table-hasExpend td{border-bottom:0}.table-heiglight td,.table-lineHover td{background-color:#f5f5f5;border-right-color:#f5f5f5}.table-expendRow td{padding:0 0 5px 36px}.table-expendRow td span{margin-left:60px}.table-expendRow td a{padding:1px 5px;font-size:12px;line-height:1.5;border-radius:3px;text-decoration:none;color:#FFF;background-color:#c7cbd6;border-color:#c7cbd6}.table-expendRow td a:hover{background-color:#b0b5b9;border-color:#b0b5b9}.table-center{margin:0 auto}.table-tag{color:#d54121;font-size:12px;font-style:italic;margin-left:10px}.tip-panel{background-color:#FFF;box-shadow:0 3px 10px #8b8b8b;display:none;max-height:500px;max-width:500px;overflow:hidden;padding:3px;position:absolute;z-index:1}
\ No newline at end of file
/**
* Copyright (c) 2010-2017, b3log.org & hacpai.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
html,body,div,ul,li,h1,h2,h3,h4,h5,h6,p,dd,dl,ol{margin:0;padding:0}body{background-color:#FFF;color:#000;font-family:elvetica,Arial,'sans-serif','\5fae\8f6f\96c5\9ed1';font-size:small}img{border:medium none;margin:0;padding:0;vertical-align:middle}h1{font-size:160%}h2{font-size:140%}h3{font-size:120%}h4{font-size:110%}textarea{overflow:auto}button,.button{background:url(../images/icon.png) repeat center bottom;border:1px solid;border-color:#CCC #bbb #a0a0a0;border-radius:4px;height:28px;margin:0;padding:0 6px;vertical-align:top}button:hover,.button:hover{border-color:#BBB}.padding12{padding:12px}.paddingBottom12{padding-bottom:12px !important}.paddingTop12{padding-top:12px !important}.margin12{margin:12px}.marginTop12{margin-top:12px !important}.marginBottom12{margin-bottom:12px !important}.marginLeft12{margin-left:12px !important}.marginLeft6{margin-left:6px !important}.marginRight12{margin-right:12px !important}.f-bold{font-weight:bold !important}.nowrap{white-space:nowrap}.left{float:left}.right{float:right}.clear{background-color:transparent;border:0;clear:both;display:block;font-size:0;height:0;line-height:0;overflow:hidden}.fn-clear:before,.fn-clear:after{display:table;content:""}.fn-clear:after{clear:both}.none{display:none}.pointer{cursor:pointer}.no-underline{text-decoration:none !important}.red{color:red}.contentBody{margin-bottom:12px;padding:3px 12px}.form th{text-align:right;white-space:nowrap}.form input[type='text'],.form input[type='password'],.form textarea{border-color:#c0c0c0 #d9d9d9 #d9d9d9;border-right:1px solid #d9d9d9;border-style:solid;border-width:1px;font-family:Helvetica,Arial,sans-serif;font-size:12px;outline:medium none;width:99%;padding:0 3px}.form input{height:24px}.form input[type='checkbox']{border:0;vertical-align:middle}.form input.normalInput{width:auto}.form input[type='checkbox']:focus{border:0}.form input:focus,.form textarea:focus{box-shadow:0 1px 2px rgba(0,0,0,0.3) inset}.form textarea{padding:3px;overflow:auto;resize:vertical}.logo{padding:0 5px;text-decoration:none;text-shadow:0 0 1px #eee}.putTopIcon,.notPutTopIcon,.deleteIcon,.updateIcon,.commentIcon,.homeIcon,.adminIcon,.loginIcon,.logoutIcon,.calendarIcon,.browserIcon,.postIcon,.articlesIcon,.draftsIcon,.usersIcon,.linkIcon,.preferenceIcon,.pageIcon,.trueIcon,.falseIcon,.fileIcon,.othersIcon,.goTopIcon,.goBottomIcon,.cacheIcon,.aboutIcon{background-image:url("../images/icon.png");cursor:pointer;height:16px;width:16px}.adminIcon,.loginIcon,.logoutIcon,.homeIcon{margin-top:3px}.pageIcon{background-position:-144px 0}.postIcon{background-position:-16px 0}.linkIcon{background-position:-32px 0}.preferenceIcon{background-position:-48px 0}.articlesIcon{background-position:-64px 0}.trueIcon{background-position:-80px 0;cursor:auto}.falseIcon{background-position:-96px 0;cursor:auto}.fileIcon{background-position:-112px 0}.deleteIcon{background-position:0 -16px}.updateIcon{background-position:-16px -16px}.commentIcon{background-position:-32px -16px}.homeIcon{background-position:-64px -16px}.adminIcon{background-position:-80px -16px}.logoutIcon{background-position:-96px -16px}.loginIcon{background-position:-112px -16px}.browserIcon{background-position:-128px -16px}.calendarIcon{background-position:-144px -16px}.putTopIcon{background-position:-16px -32px;float:left}.notPutTopIcon{background-position:-32px -32px;float:left}.othersIcon{background-position:-48px -32px}.cacheIcon{background-position:-96px -32px}.draftsIcon{background-position:-96px -32px}.usersIcon{background-position:-112px -32px}.goTopIcon{background-position:-64px -32px;position:fixed;right:20px;top:45%}.goBottomIcon{background-position:-80px -32px;bottom:40%;position:fixed;right:20px}.article-body{overflow:hidden;line-height:145%;word-wrap:break-word}.article-body blockquote{border:1px dotted #98a47f;font-style:italic;margin:12px;padding:12px}.article-body h1{font-size:2em;margin:.67em 0}.article-body h2{font-size:1.5em;margin:.75em 0}.article-body h3{font-size:1.17em;margin:.83em 0}.article-body h4,.article-body p,.article-body blockquote,.article-body ul,.article-body fieldset,.article-body form,.article-body ol,.article-body dl,.article-body dir,.article-body menu{margin:1.12em 0}.article-body h5{font-size:.83em;margin:1.5em 0}.article-body h6{font-size:.75em;margin:1.67em 0}.article-body blockquote{margin-left:40px;margin-right:40px}.article-body ol,.article-body ul,.article-body dir,.article-body menu,.article-body dd{margin-left:40px}.em00,.em01,.em02,.em03,.em04,.em05,.em06,.em07,.em08,.em09,.em10,.em11,.em12,.em13,.em14{background-image:url("../images/emotions/emotions.png");background-size:120px;float:left;height:24px;margin-right:5px;width:24px}#emotions span{cursor:pointer}.em01{background-position:-24px 0}.em02{background-position:-48px 0}.em03{background-position:-72px 0}.em04{background-position:-96px 0}.em05{background-position:0 -24px}.em06{background-position:-24px -24px}.em07{background-position:-48px -24px}.em08{background-position:-72px -24px}.em09{background-position:-96px -24px}.em10{background-position:0 -48px}.em11{background-position:-24px -48px}.em12{background-position:-48px -48px}.em13{background-position:-72px -48px}.em14{background-position:-96px -48px}#tags{list-style:none}#tags li{float:left;list-style:none;height:38px}#tags a:hover{text-shadow:0 0 2px #555}#tags a{border-radius:3px 3px 3px 3px;box-shadow:1px 1px 3px #555;float:left;margin:3px 6px;padding:3px 12px;text-decoration:none}#tags .tags1{font-size:12px;font-weight:normal}#tags .tags2{font-size:14px;font-weight:normal}#tags .tags3{font-size:16px;font-weight:normal}#tags .tags4{font-size:18px;font-weight:bold}#tags .tags5{font-size:20px;font-weight:bold}#captcha,#captchaReply{cursor:pointer} html,body,div,ul,li,h1,h2,h3,h4,h5,h6,p,dd,dl,ol{margin:0;padding:0}body{background-color:#FFF;color:#000;font-family:elvetica,Arial,'sans-serif','\5fae\8f6f\96c5\9ed1';font-size:small}img{border:medium none;margin:0;padding:0;vertical-align:middle}h1{font-size:160%}h2{font-size:140%}h3{font-size:120%}h4{font-size:110%}textarea{overflow:auto}button,.button{background:url(../images/icon.png) repeat center bottom;border:1px solid;border-color:#CCC #bbb #a0a0a0;border-radius:4px;height:28px;margin:0;padding:0 6px;vertical-align:top}button:hover,.button:hover{border-color:#BBB}.padding12{padding:12px}.paddingBottom12{padding-bottom:12px !important}.paddingTop12{padding-top:12px !important}.margin12{margin:12px}.marginTop12{margin-top:12px !important}.marginBottom12{margin-bottom:12px !important}.marginLeft12{margin-left:12px !important}.marginLeft6{margin-left:6px !important}.marginRight12{margin-right:12px !important}.f-bold{font-weight:bold !important}.nowrap{white-space:nowrap}.left{float:left}.right{float:right}.clear{background-color:transparent;border:0;clear:both;display:block;font-size:0;height:0;line-height:0;overflow:hidden}.fn-clear:before,.fn-clear:after{display:table;content:""}.fn-clear:after{clear:both}.none{display:none}.pointer{cursor:pointer}.no-underline{text-decoration:none !important}.red{color:red}.contentBody{margin-bottom:12px;padding:3px 12px}.form th{text-align:right;white-space:nowrap}.form input[type='text'],.form input[type='password'],.form textarea{border-color:#c0c0c0 #d9d9d9 #d9d9d9;border-right:1px solid #d9d9d9;border-style:solid;border-width:1px;font-family:Helvetica,Arial,sans-serif;font-size:12px;outline:medium none;width:99%;padding:0 3px}.form input{height:24px}.form input[type='checkbox']{border:0;vertical-align:middle}.form input.normalInput{width:auto}.form input[type='checkbox']:focus{border:0}.form input:focus,.form textarea:focus{box-shadow:0 1px 2px rgba(0,0,0,0.3) inset}.form textarea{padding:3px;overflow:auto;resize:vertical}.logo{padding:0 5px;text-decoration:none;text-shadow:0 0 1px #eee}.putTopIcon,.notPutTopIcon,.deleteIcon,.updateIcon,.commentIcon,.homeIcon,.adminIcon,.loginIcon,.logoutIcon,.calendarIcon,.browserIcon,.postIcon,.articlesIcon,.draftsIcon,.usersIcon,.linkIcon,.preferenceIcon,.pageIcon,.trueIcon,.falseIcon,.fileIcon,.othersIcon,.goTopIcon,.goBottomIcon,.cacheIcon,.aboutIcon{background-image:url("../images/icon.png");cursor:pointer;height:16px;width:16px}.adminIcon,.loginIcon,.logoutIcon,.homeIcon{margin-top:3px}.pageIcon{background-position:-144px 0}.postIcon{background-position:-16px 0}.linkIcon{background-position:-32px 0}.preferenceIcon{background-position:-48px 0}.articlesIcon{background-position:-64px 0}.trueIcon{background-position:-80px 0;cursor:auto}.falseIcon{background-position:-96px 0;cursor:auto}.fileIcon{background-position:-112px 0}.deleteIcon{background-position:0 -16px}.updateIcon{background-position:-16px -16px}.commentIcon{background-position:-32px -16px}.homeIcon{background-position:-64px -16px}.adminIcon{background-position:-80px -16px}.logoutIcon{background-position:-96px -16px}.loginIcon{background-position:-112px -16px}.browserIcon{background-position:-128px -16px}.calendarIcon{background-position:-144px -16px}.putTopIcon{background-position:-16px -32px;float:left}.notPutTopIcon{background-position:-32px -32px;float:left}.othersIcon{background-position:-48px -32px}.cacheIcon{background-position:-96px -32px}.draftsIcon{background-position:-96px -32px}.usersIcon{background-position:-112px -32px}.goTopIcon{background-position:-64px -32px;position:fixed;right:20px;top:45%}.goBottomIcon{background-position:-80px -32px;bottom:40%;position:fixed;right:20px}.article-body{overflow:hidden;line-height:145%;word-wrap:break-word}.article-body blockquote{border:1px dotted #98a47f;font-style:italic;margin:12px;padding:12px}.article-body h1{font-size:2em;margin:.67em 0}.article-body h2{font-size:1.5em;margin:.75em 0}.article-body h3{font-size:1.17em;margin:.83em 0}.article-body h4,.article-body p,.article-body blockquote,.article-body ul,.article-body fieldset,.article-body form,.article-body ol,.article-body dl,.article-body dir,.article-body menu{margin:1.12em 0}.article-body h5{font-size:.83em;margin:1.5em 0}.article-body h6{font-size:.75em;margin:1.67em 0}.article-body blockquote{margin-left:40px;margin-right:40px}.article-body ol,.article-body ul,.article-body dir,.article-body menu,.article-body dd{margin-left:40px}.em00,.em01,.em02,.em03,.em04,.em05,.em06,.em07,.em08,.em09,.em10,.em11,.em12,.em13,.em14{background-image:url("../images/emotions/emotions.png");background-size:120px;float:left;height:24px;margin-right:5px;width:24px}#emotions span{cursor:pointer}.em01{background-position:-24px 0}.em02{background-position:-48px 0}.em03{background-position:-72px 0}.em04{background-position:-96px 0}.em05{background-position:0 -24px}.em06{background-position:-24px -24px}.em07{background-position:-48px -24px}.em08{background-position:-72px -24px}.em09{background-position:-96px -24px}.em10{background-position:0 -48px}.em11{background-position:-24px -48px}.em12{background-position:-48px -48px}.em13{background-position:-72px -48px}.em14{background-position:-96px -48px}#tags{list-style:none}#tags li{float:left;list-style:none;height:38px}#tags a:hover{text-shadow:0 0 2px #555}#tags a{border-radius:3px 3px 3px 3px;box-shadow:1px 1px 3px #555;float:left;margin:3px 6px;padding:3px 12px;text-decoration:none}#tags .tags1{font-size:12px;font-weight:normal}#tags .tags2{font-size:14px;font-weight:normal}#tags .tags3{font-size:16px;font-weight:normal}#tags .tags4{font-size:18px;font-weight:bold}#tags .tags5{font-size:20px;font-weight:bold}#captcha,#captchaReply{cursor:pointer}
\ No newline at end of file
/**
* Copyright (c) 2010-2017, b3log.org & hacpai.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
html{height:100%}html,body{margin:0;padding:0}body{background-color:#fff;color:#333;font-family:\5fae\8f6f\96c5\9ed1;font-size:small;height:100%}h2{background-color:#f3f1e5;border-radius:4px 4px 0 0;font-size:16px;margin:0;padding:10px 20px;text-shadow:0 -1px 0 rgba(255,255,255,0.5)}input{border:1px solid #ccc;border-radius:3px 3px 3px 3px;box-shadow:0 1px 2px rgba(0,0,0,0.075) inset;font-size:13px;margin:15px 0;padding:7px 8px;vertical-align:middle;width:410px;font-family:\5fae\8f6f\96c5\9ed1;font-size:small}input:focus{box-shadow:0 1px 2px rgba(0,0,0,0.075) inset,0 0 5px rgbargba(200,200,200,0.9);border:1px solid #e6e5d9}.form{padding:20px}label{font-size:13px}button{position:relative;display:inline-block;font-size:13px;font-weight:700;color:#333;text-shadow:0 1px 0 rgba(255,255,255,0.9);white-space:nowrap;background-color:#eaeaea;background-image:linear-gradient(#fafafa,#eaeaea);background-repeat:repeat-x;border-radius:3px;border:1px solid #ddd;border-bottom-color:#c5c5c5;box-shadow:0 1px 3px rgba(0,0,0,0.075);vertical-align:baseline;cursor:pointer;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-appearance:none;outline:0;padding:7px 15px;margin-top:10px}button:hover,button:active{color:#fff;text-decoration:none;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-color:#3072b3;background-image:linear-gradient(#599bcd,#3072b3);background-repeat:repeat-x}.clear{background-color:transparent;border:0;clear:both;display:block;font-size:0;height:0;line-height:0;overflow:hidden}.none{display:none}.solo{color:orangered;font-weight:bold}.logo{float:left;padding:142px 12px 0;width:217px;text-align:center}.wrap{border-top:5px solid #e6e5d9;padding:110px 0;background-color:#f3f1e5}.content{background-color:#fff;margin:0 auto;width:760px}.main{border-left:1px solid #e6e5d9;float:right;font-size:15px;padding:20px;width:470px;min-height:360px}.main a{text-decoration:none}.main li{margin:6px 0 6px 16px}.footerWrapper{background-color:#fff;border-top:1px solid #e6e5d9;padding:12px 0;text-align:center}.footerWrapper a{text-decoration:none}.article-pwd>div,.article-pwd>form{margin:0 20px}.article-pwd>div{margin-bottom:10px;max-height:264px;overflow:auto;word-wrap:break-word}.a-403,.a-500,.a-404{margin:20px 50px 0 0;text-align:right}.a-403{margin:10px 75px 0 0}.img-500,.img-403,.img-404{max-width:100%;margin:20px 0;padding:0}.a-500{margin:25px 35px 0 0}.a-404{margin:42px 35px 0 0}.kill img{position:absolute;right:40px;top:200px}.kill ul{margin-bottom:50px}.kill p{margin:12px 20px}.kill span{margin-left:20px}#init{position:absolute;width:470px}#init input,.register input{margin:5px 0;padding:5px 8px}.register{height:400px}#sys p{height:206px}#sys{padding:0 20px}#initButton{margin-right:10px}#tip{color:#21759b;font-weight:bold;margin-left:10px}@media(max-width:780px){.wrap{padding:40px 0}.content{width:auto}.logo{display:none}.main{border:0;float:none;width:auto}input{width:100%;box-sizing:border-box;display:block}.a-500,.a-403,.a-404{margin:0 20px 0 0}#init{width:100%;padding:0 20px;box-sizing:border-box;left:0}} html{height:100%}html,body{margin:0;padding:0}body{background-color:#fff;color:#333;font-family:\5fae\8f6f\96c5\9ed1;font-size:small;height:100%}h2{background-color:#f3f1e5;border-radius:4px 4px 0 0;font-size:16px;margin:0;padding:10px 20px;text-shadow:0 -1px 0 rgba(255,255,255,0.5)}input{border:1px solid #ccc;border-radius:3px 3px 3px 3px;box-shadow:0 1px 2px rgba(0,0,0,0.075) inset;font-size:13px;margin:15px 0;padding:7px 8px;vertical-align:middle;width:410px;font-family:\5fae\8f6f\96c5\9ed1;font-size:small}input:focus{box-shadow:0 1px 2px rgba(0,0,0,0.075) inset,0 0 5px rgbargba(200,200,200,0.9);border:1px solid #e6e5d9}.form{padding:20px}label{font-size:13px}button{position:relative;display:inline-block;font-size:13px;font-weight:700;color:#333;text-shadow:0 1px 0 rgba(255,255,255,0.9);white-space:nowrap;background-color:#eaeaea;background-image:linear-gradient(#fafafa,#eaeaea);background-repeat:repeat-x;border-radius:3px;border:1px solid #ddd;border-bottom-color:#c5c5c5;box-shadow:0 1px 3px rgba(0,0,0,0.075);vertical-align:baseline;cursor:pointer;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-appearance:none;outline:0;padding:7px 15px;margin-top:10px}button:hover,button:active{color:#fff;text-decoration:none;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-color:#3072b3;background-image:linear-gradient(#599bcd,#3072b3);background-repeat:repeat-x}.clear{background-color:transparent;border:0;clear:both;display:block;font-size:0;height:0;line-height:0;overflow:hidden}.none{display:none}.solo{color:orangered;font-weight:bold}.logo{float:left;padding:142px 12px 0;width:217px;text-align:center}.wrap{border-top:5px solid #e6e5d9;padding:110px 0;background-color:#f3f1e5}.content{background-color:#fff;margin:0 auto;width:760px}.main{border-left:1px solid #e6e5d9;float:right;font-size:15px;padding:20px;width:470px;min-height:360px}.main a{text-decoration:none}.main li{margin:6px 0 6px 16px}.footerWrapper{background-color:#fff;border-top:1px solid #e6e5d9;padding:12px 0;text-align:center}.footerWrapper a{text-decoration:none}.article-pwd>div,.article-pwd>form{margin:0 20px}.article-pwd>div{margin-bottom:10px;max-height:264px;overflow:auto;word-wrap:break-word}.a-403,.a-500,.a-404{margin:20px 50px 0 0;text-align:right}.a-403{margin:10px 75px 0 0}.img-500,.img-403,.img-404{max-width:100%;margin:20px 0;padding:0}.a-500{margin:25px 35px 0 0}.a-404{margin:42px 35px 0 0}.kill img{position:absolute;right:40px;top:200px}.kill ul{margin-bottom:50px}.kill p{margin:12px 20px}.kill span{margin-left:20px}#init{position:absolute;width:470px}#init input,.register input{margin:5px 0;padding:5px 8px}.register{height:400px}#sys p{height:206px}#sys{padding:0 20px}#initButton{margin-right:10px}#tip{color:#21759b;font-weight:bold;margin-left:10px}@media(max-width:780px){.wrap{padding:40px 0}.content{width:auto}.logo{display:none}.main{border:0;float:none;width:auto}input{width:100%;box-sizing:border-box;display:block}.a-500,.a-403,.a-404{margin:0 20px 0 0}#init{width:100%;padding:0 20px;box-sizing:border-box;left:0}}
\ No newline at end of file
...@@ -1049,7 +1049,7 @@ $.extend(TablePaginate.prototype, { ...@@ -1049,7 +1049,7 @@ $.extend(TablePaginate.prototype, {
* *
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a> * @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a> * @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.4.6.7, May 21, 2017 * @version 1.4.5.7, May 21, 2017
*/ */
admin.article = { admin.article = {
currentEditorType: '', currentEditorType: '',
......
/*
* Copyright (c) 2010-2017, b3log.org & hacpai.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var Admin=function(){this.register={};this.tools=["#page-list","#file-list","#link-list","#preference","#user-list","#plugin-list","#others","#category-list"];this.adTools=["link-list","preference","file-list","page-list","user-list","plugin-list","others","category-list"]};$.extend(Admin.prototype,{logout:function(){window.location.href=latkeConfig.servePath+"/logout?goto="+latkeConfig.servePath},clearTip:function(){$("#tipMsg").text("");$("#loadMsg").text("")},setHashByPage:function(currentPage){var hash=window.location.hash,hashList=hash.split("/");if(/^\d*$/.test(hashList[hashList.length-1])){hashList[hashList.length-1]=currentPage}else{hashList.push(currentPage)}window.location.hash=hashList.join("/")},selectTab:function(id){window.location.hash="#"+id},analyseHash:function(){var hash=window.location.hash;var tag=hash.substr(1,hash.length-1);var tagList=tag.split("/");var tags={};tags.page=1,tags.hashList=[];for(var i=0;i<tagList.length;i++){if(i===tagList.length-1&&(/^\d+$/.test(tagList[i]))){tags.page=tagList[i]}else{tags.hashList.push(tagList[i])}}return tags},setCurByHash:function(){$(window).scrollTop(0);$("#tipMsg").text("");var tags=admin.analyseHash();var tab=tags.hashList[1],subTab=tags.hashList[2];if(tags.hashList.length===1){tab=tags.hashList[0]}if(tab===""){return}if(tab!=="article"){admin.article.clearDraftTimer()}else{if(tab==="article"){admin.article.autoSaveDraftTimer=setInterval(function(){admin.article._autoSaveToDraft()},admin.article.AUTOSAVETIME)}}try{if(tab!=="article"&&admin.article.isConfirm&&admin.editors.articleEditor.getContent().replace(/\s/g,"")!==""&&admin.article.content!==admin.editors.articleEditor.getContent()){if(!confirm(Label.editorLeaveLabel)){window.location.hash="#article/article";return}}if(tab==="article"&&admin.article.isConfirm&&admin.editors.articleEditor.getContent().replace(/\s/g,"")!==""&&admin.article.content!==admin.editors.articleEditor.getContent()){return}}catch(e){var $articleContent=$("#articleContent");if($articleContent.length>0){if(tab!=="article"&&admin.article.isConfirm&&$articleContent.val().replace(/\s/g,"")!==""&&admin.article.content!==$articleContent.val()){if(!confirm(Label.editorLeaveLabel)){window.location.hash="#article/article";return}}if(tab==="article"&&admin.article.isConfirm&&$articleContent.val().replace(/\s/g,"")!==""&&admin.article.content!==$articleContent.val()){return}}}if(tab!=="article"&&admin.editors.articleEditor.setContent){admin.article.clear()}admin.article.isConfirm=true;$("#tabs").tabs("setCurrent",tab);$("#loadMsg").text(Label.loadingLabel);if($("#tabsPanel_"+tab).length===1){if($("#tabsPanel_"+tab).html().replace(/\s/g,"")===""){$("#tabsPanel_"+tab).load("admin-"+tab+".do",function(){if(tab==="article"&&admin.article.status.id){admin.register[tab].init.call(admin.register[tab].obj,admin.article.getAndSet)}else{admin.register[tab].init.call(admin.register[tab].obj,tags.page)}if(subTab){$("#tab"+tab.substring(0,1).toUpperCase()+tab.substring(1)).tabs("setCurrent",subTab)}admin.plugin.setCurByHash(tags)})}else{if(tab==="article"&&admin.article.status.id){admin.article.getAndSet()}if(admin.register[tab]&&admin.register[tab].refresh){admin.register[tab].refresh.call(admin.register[tab].obj,tags.page)}if(subTab){$("#tab"+tab.substring(0,1).toUpperCase()+tab.substring(1)).tabs("setCurrent",subTab)}admin.plugin.setCurByHash(tags)}}else{$("#tipMsg").text("Error: No tab! "+Label.reportIssueLabel);$("#loadMsg").text("")}},init:function(){Util.killIE();$("#loadMsg").text(Label.loadingLabel);$("#tabs").tabs();setInterval(function(){if($("#tipMsg").text()!==""){setTimeout(function(){$("#tipMsg").text("")},7000)}},6000);$("#loadMsg").text("")},collapseNav:function(it){var subNav=$(it).next();subNav.slideToggle("normal",function(){if(this.style.display!=="none"){$(it).find(".icon-chevron-down")[0].className="icon-chevron-up right";$(it).addClass("tab-current")}else{$(it).find(".icon-chevron-up")[0].className="icon-chevron-down right";$(it).removeClass("tab-current")}$("#tabs > ul").height("auto");$("#tabs > ul").height($("#tabs > ul").height()+80)})},inited:function(){if(Label.userRole!=="adminRole"){for(var i=0;i<this.adTools.length;i++){$("#tabs").tabs("remove",this.adTools[i])}}else{for(var j=0;j<this.tools.length;j++){if("#"+window.location.hash.split("/")[1]===this.tools[j]){$("#tabToolsTitle").click();break}}}this.setCurByHash()}});var admin=new Admin();admin.editors={};var SoloEditor=function(conf){this._defaults={type:"tinyMCE",kind:"",id:"",language:""};conf.type=Label.editorType;this.conf=conf;this._init()};$.extend(SoloEditor.prototype,{_init:function(){this.init()},init:function(type){var conf=this.conf;if(type){conf.type=type}var types=conf.type.split("-");if(types.length===2){conf.codeMirrorLanguage=types[1];conf.type=types[0]}admin.editors[conf.type].init(conf)},getContent:function(){var conf=this.conf;return admin.editors[conf.type].getContent(conf.id)},setContent:function(content){var conf=this.conf;admin.editors[conf.type].setContent(conf.id,content)},remove:function(){var conf=this.conf;admin.editors[conf.type].remove(conf.id)}});admin.editors.articleEditor={};admin.editors.abstractEditor={};admin.editors.pageEditor={};admin.editors.tinyMCE={init:function(conf){var language=Label.localeString.substring(0,2);if(language==="zh"){language="zh-cn"}if(conf.kind&&conf.kind==="simple"){try{tinyMCE.init({language:language,mode:"exact",elements:conf.id,theme:"advanced",plugins:"media",theme_advanced_buttons1:"bold,italic,underline,strikethrough,|,undo,redo,|,bullist,numlist,|,code",theme_advanced_buttons2:"",theme_advanced_buttons3:"",theme_advanced_toolbar_location:"top",theme_advanced_toolbar_align:"left",valid_children:"+body[style]"})}catch(e){$("#tipMsg").text("TinyMCE load fail")}}else{try{tinyMCE.init({language:language,mode:"exact",elements:conf.id,theme:"advanced",plugins:"autosave,style,advhr,advimage,advlink,preview,inlinepopups,media,paste,syntaxhl,wordcount",theme_advanced_buttons1:"formatselect,fontselect,fontsizeselect,|,bold,italic,underline,strikethrough,forecolor,|,advhr,blockquote,syntaxhl,",theme_advanced_buttons2:"undo,redo,|,bullist,numlist,outdent,indent,|,justifyleft,justifycenter,justifyright,justifyfull,|,pastetext,pasteword,|,link,unlink,image,iespell,media,|,cleanup,code,preview,",theme_advanced_buttons3:"",theme_advanced_toolbar_location:"top",theme_advanced_toolbar_align:"left",theme_advanced_resizing:true,theme_advanced_statusbar_location:"bottom",extended_valid_elements:"link[type|rel|href|charset],pre[name|class],iframe[src|width|height|name|align],+a[*]",valid_children:"+body[style]",relative_urls:false,remove_script_host:false,oninit:function(){if(typeof(conf.fun)==="function"){conf.fun()}}})}catch(e){$("#tipMsg").text("TinyMCE load fail")}}},getContent:function(id){var content="";try{content=tinyMCE.get(id).getContent()}catch(e){content=$("#"+id).val()}return content},setContent:function(id,content){try{if(tinyMCE.get(id)){tinyMCE.get(id).setContent(content)}else{$("#"+id).val(content)}}catch(e){$("#"+id).val(content)}},remove:function(id){tinyMCE.get(id).remove()}};admin.editors.KindEditor={init:function(conf){var language="zh_CN";if("en_US"===Label.localeString){language="en"}if(conf.kind&&conf.kind==="simple"){try{this[conf.id]=KindEditor.create("#"+conf.id,{langType:language,resizeType:0,items:["bold","italic","underline","strikethrough","|","undo","redo","|","insertunorderedlist","insertorderedlist","|","source"]})}catch(e){$("#tipMsg").text("KindEditor load fail")}}else{try{this[conf.id]=KindEditor.create("#"+conf.id,{uploadJson:"kindeditor/php/upyunUpload.php",langType:language,items:["formatblock","fontname","fontsize","|","bold","italic","underline","strikethrough","forecolor","|","link","unlink","image","media","|","pagebreak","emoticons","code","/","undo","redo","|","insertunorderedlist","insertorderedlist","indent","outdent","|","justifyleft","justifycenter","justifyright","justifyfull","|","plainpaste","wordpaste","|","clearhtml","source","preview"],afterCreate:function(){if(typeof(conf.fun)==="function"){conf.fun()}}})}catch(e){$("#tipMsg").text("KindEditor load fail")}}},getContent:function(id){var content="";try{content=this[id].html()}catch(e){content=$("#"+id).val()}return content},setContent:function(id,content){try{this[id].html(content)}catch(e){$("#"+id).val(content)}},remove:function(id){this[id].remove()}};Util.processClipBoard=function(text,cm){var text=toMarkdown(text,{converters:[],gfm:true});text=$("<div>"+text+"</div>").text().replace(/\n{2,}/g,"\n\n").replace(/ /g," ");return $.trim(text)};Util.startsWith=function(string,prefix){return(string.match("^"+prefix)==prefix)};Util.processClipBoard=function(clipboardData,cm){if(clipboardData.getData("text/html")===""&&clipboardData.items.length===2){return""}var text=toMarkdown(clipboardData.getData("text/html"),{converters:[{filter:"img",replacement:function(innerHTML,node){if(1===node.attributes.length){return""}return"![]("+node.src+")"}}],gfm:true});var codes=text.split("```");if(codes.length>1){for(var i=0,iMax=codes.length;i<iMax;i++){if(i%2===1){codes[i]=codes[i].replace(/<\/span><span style="color:#\w{6};">/g,"").replace(/</g,"&lt;").replace(/>/g,"&gt;")}}}text=codes.join("```");text=$("<div>"+text+"</div>").text().replace(/\n{2,}/g,"\n\n").replace(/ /g," ");return $.trim(text)};Util.initUploadFile=function(obj){var isImg=false;$("#"+obj.id).fileupload({multipart:true,pasteZone:obj.pasteZone,dropZone:obj.pasteZone,url:"https://up.qbox.me/",paramName:"file",add:function(e,data){if(data.files[0].name){var processName=data.files[0].name.match(/[a-zA-Z0-9.]/g).join("");filename=getUUID()+"-"+processName;if(processName.split(".")[0]===""){filename=getUUID()+processName}}else{filename=getUUID()+"."+data.files[0].type.split("/")[1]}if(window.File&&window.FileReader&&window.FileList&&window.Blob){var reader=new FileReader();reader.readAsArrayBuffer(data.files[0]);reader.onload=function(evt){var fileBuf=new Uint8Array(evt.target.result.slice(0,11));isImg=data.files[0].type.indexOf("image")===0?true:false;data.submit()}}else{data.submit()}},formData:function(form){var data=form.serializeArray();data.push({name:"key",value:"file/"+(new Date()).getFullYear()+"/"+((new Date()).getMonth()+1)+"/"+filename});data.push({name:"token",value:obj.qiniuUploadToken});return data},submit:function(e,data){if(obj.editor.replaceRange){var cursor=obj.editor.getCursor();obj.editor.replaceRange(obj.uploadingLabel,cursor,cursor)}else{$("#"+obj.id+" input").prop("disabled",false)}},done:function(e,data){var qiniuKey=data.result.key;if(!qiniuKey){alert("Upload error");return}if(obj.editor.replaceRange){var cursor=obj.editor.getCursor();if(isImg){obj.editor.replaceRange("!["+filename+"]("+obj.qiniuDomain+"/"+qiniuKey+") \n\n",CodeMirror.Pos(cursor.line,cursor.ch-obj.uploadingLabel.length),cursor)}else{obj.editor.replaceRange("["+filename+"]("+obj.qiniuDomain+"/"+qiniuKey+") \n\n",CodeMirror.Pos(cursor.line,cursor.ch-obj.uploadingLabel.length),cursor)}}else{obj.editor.$it.val("!["+filename+"]("+obj.qiniuDomain+"/"+qiniuKey+") \n\n");$("#"+obj.id+" input").prop("disabled",false)}},fail:function(e,data){alert("Upload error: "+data.errorThrown);if(obj.editor.replaceRange){var cursor=obj.editor.getCursor();obj.editor.replaceRange("",CodeMirror.Pos(cursor.line,cursor.ch-obj.uploadingLabel.length),cursor)}else{$("#"+obj.id+" input").prop("disabled",false)}}}).on("fileuploadprocessalways",function(e,data){var currentFile=data.files[data.index];if(data.files.error&&currentFile.error){alert(currentFile.error)}})};admin.editors.CodeMirror={init:function(conf){var emojis="+1,-1,100,1234,8ball,a,ab,abc,abcd,accept,aerial_tramway,airplane,alarm_clock,alien,ambulance,anchor,angel,anger,angry,anguished,ant,apple,aquarius,aries,arrow_backward,arrow_double_down,arrow_double_up,arrow_down,arrow_down_small,arrow_forward,arrow_heading_down,arrow_heading_up,arrow_left,arrow_lower_left,arrow_lower_right,arrow_right,arrow_right_hook,arrow_up,arrow_up_down,arrow_up_small,arrow_upper_left,arrow_upper_right,arrows_clockwise,arrows_counterclockwise,art,articulated_lorry,astonished,atm,b,baby,baby_bottle,baby_chick,baby_symbol,back,baggage_claim,balloon,ballot_box_with_check,bamboo,banana,bangbang,bank,bar_chart,barber,baseball,basketball,bath,bathtub,battery,bear,bee,beer,beers,beetle,beginner,bell,bento,bicyclist,bike,bikini,bird,birthday,black_circle,black_joker,black_medium_small_square,black_medium_square,black_nib,black_small_square,black_square,black_square_button,blossom,blowfish,blue_book,blue_car,blue_heart,blush,boar,boat,bomb,book,bookmark,bookmark_tabs,books,boom,boot,bouquet,bow,bowling,bowtie,boy,bread,bride_with_veil,bridge_at_night,briefcase,broken_heart,bug,bulb,bullettrain_front,bullettrain_side,bus,busstop,bust_in_silhouette,busts_in_silhouette,cactus,cake,calendar,calling,camel,camera,cancer,candy,capital_abcd,capricorn,car,card_index,carousel_horse,cat,cat2,cd,chart,chart_with_downwards_trend,chart_with_upwards_trend,checkered_flag,cherries,cherry_blossom,chestnut,chicken,children_crossing,chocolate_bar,christmas_tree,church,cinema,circus_tent,city_sunrise,city_sunset,cl,clap,clapper,clipboard,clock1,clock10,clock1030,clock11,clock1130,clock12,clock1230,clock130,clock2,clock230,clock3,clock330,clock4,clock430,clock5,clock530,clock6,clock630,clock7,clock730,clock8,clock830,clock9,clock930,closed_book,closed_lock_with_key,closed_umbrella,cloud,clubs,cn,cocktail,coffee,cold_sweat,collision,computer,confetti_ball,confounded,confused,congratulations,construction,construction_worker,convenience_store,cookie,cool,cop,copyright,corn,couple,couple_with_heart,couplekiss,cow,cow2,credit_card,crescent_moon,crocodile,crossed_flags,crown,cry,crying_cat_face,crystal_ball,cupid,curly_loop,currency_exchange,curry,custard,customs,cyclone,dancer,dancers,dango,dart,dash,date,de,deciduous_tree,department_store,diamond_shape_with_a_dot_inside,diamonds,disappointed,disappointed_relieved,dizzy,dizzy_face,do_not_litter,dog,dog2,dollar,dolls,dolphin,donut,door,doughnut,dragon,dragon_face,dress,dromedary_camel,droplet,dvd,e-mail,ear,ear_of_rice,earth_africa,earth_americas,earth_asia,egg,eggplant,eight,eight_pointed_black_star,eight_spoked_asterisk,electric_plug,elephant,email,end,envelope,es,euro,european_castle,european_post_office,evergreen_tree,exclamation,expressionless,eyeglasses,eyes,facepunch,factory,fallen_leaf,family,fast_forward,fax,fearful,feelsgood,feet,ferris_wheel,file_folder,finnadie,fire,fire_engine,fireworks,first_quarter_moon,first_quarter_moon_with_face,fish,fish_cake,fishing_pole_and_fish,fist,five,flags,flashlight,floppy_disk,flower_playing_cards,flushed,foggy,football,fork_and_knife,fountain,four,four_leaf_clover,fr,free,fried_shrimp,fries,frog,frowning,fu,fuelpump,full_moon,full_moon_with_face,game_die,gb,gem,gemini,ghost,gift,gift_heart,girl,globe_with_meridians,goat,goberserk,godmode,golf,grapes,green_apple,green_book,green_heart,grey_exclamation,grey_question,grimacing,grin,grinning,guardsman,guitar,gun,haircut,hamburger,hammer,hamster,hand,handbag,hankey,hash,hatched_chick,hatching_chick,headphones,hear_no_evil,heart,heart_decoration,heart_eyes,heart_eyes_cat,heartbeat,heartpulse,hearts,heavy_check_mark,heavy_division_sign,heavy_dollar_sign,heavy_exclamation_mark,heavy_minus_sign,heavy_multiplication_x,heavy_plus_sign,helicopter,herb,hibiscus,high_brightness,high_heel,hocho,honey_pot,honeybee,horse,horse_racing,hospital,hotel,hotsprings,hourglass,hourglass_flowing_sand,house,house_with_garden,hurtrealbad,hushed,ice_cream,icecream,id,ideograph_advantage,imp,inbox_tray,incoming_envelope,information_desk_person,information_source,innocent,interrobang,iphone,it,izakaya_lantern,jack_o_lantern,japan,japanese_castle,japanese_goblin,japanese_ogre,jeans,joy,joy_cat,jp,key,keycap_ten,kimono,kiss,kissing,kissing_cat,kissing_closed_eyes,kissing_face,kissing_heart,kissing_smiling_eyes,koala,koko,kr,large_blue_circle,large_blue_diamond,large_orange_diamond,last_quarter_moon,last_quarter_moon_with_face,laughing,leaves,ledger,left_luggage,left_right_arrow,leftwards_arrow_with_hook,lemon,leo,leopard,libra,light_rail,link,lips,lipstick,lock,lock_with_ink_pen,lollipop,loop,loudspeaker,love_hotel,love_letter,low_brightness,m,mag,mag_right,mahjong,mailbox,mailbox_closed,mailbox_with_mail,mailbox_with_no_mail,man,man_with_gua_pi_mao,man_with_turban,mans_shoe,maple_leaf,mask,massage,meat_on_bone,mega,melon,memo,mens,metal,metro,microphone,microscope,milky_way,minibus,minidisc,mobile_phone_off,money_with_wings,moneybag,monkey,monkey_face,monorail,mortar_board,mount_fuji,mountain_bicyclist,mountain_cableway,mountain_railway,mouse,mouse2,movie_camera,moyai,muscle,mushroom,musical_keyboard,musical_note,musical_score,mute,nail_care,name_badge,neckbeard,necktie,negative_squared_cross_mark,neutral_face,new,new_moon,new_moon_with_face,newspaper,ng,nine,no_bell,no_bicycles,no_entry,no_entry_sign,no_good,no_mobile_phones,no_mouth,no_pedestrians,no_smoking,non-potable_water,nose,notebook,notebook_with_decorative_cover,notes,nut_and_bolt,o,o2,ocean,octocat,octopus,oden,office,ok,ok_hand,ok_woman,older_man,older_woman,on,oncoming_automobile,oncoming_bus,oncoming_police_car,oncoming_taxi,one,open_file_folder,open_hands,open_mouth,ophiuchus,orange_book,outbox_tray,ox,package,page_facing_up,page_with_curl,pager,palm_tree,panda_face,paperclip,parking,part_alternation_mark,partly_sunny,passport_control,paw_prints,peach,pear,pencil,pencil2,penguin,pensive,performing_arts,persevere,person_frowning,person_with_blond_hair,person_with_pouting_face,phone,pig,pig2,pig_nose,pill,pineapple,pisces,pizza,plus1,point_down,point_left,point_right,point_up,point_up_2,police_car,poodle,poop,post_office,postal_horn,postbox,potable_water,pouch,poultry_leg,pound,pouting_cat,pray,princess,punch,purple_heart,purse,pushpin,put_litter_in_its_place,question,rabbit,rabbit2,racehorse,radio,radio_button,rage,rage1,rage2,rage3,rage4,railway_car,rainbow,raised_hand,raised_hands,raising_hand,ram,ramen,rat,recycle,red_car,red_circle,registered,relaxed,relieved,repeat,repeat_one,restroom,revolving_hearts,rewind,ribbon,rice,rice_ball,rice_cracker,rice_scene,ring,rocket,roller_coaster,rooster,rose,rotating_light,round_pushpin,rowboat,ru,rugby_football,runner,running,running_shirt_with_sash,sa,sagittarius,sailboat,sake,sandal,santa,satellite,satisfied,saxophone,school,school_satchel,scissors,scorpius,scream,scream_cat,scroll,seat,secret,see_no_evil,seedling,seven,shaved_ice,sheep,shell,ship,shipit,shirt,shit,shoe,shower,signal_strength,six,six_pointed_star,ski,skull,sleeping,sleepy,slot_machine,small_blue_diamond,small_orange_diamond,small_red_triangle,small_red_triangle_down,smile,smile_cat,smiley,smiley_cat,smiling_imp,smirk,smirk_cat,smoking,snail,snake,snowboarder,snowflake,snowman,sob,soccer,soon,sos,sound,space_invader,spades,spaghetti,sparkle,sparkler,sparkles,sparkling_heart,speak_no_evil,speaker,speech_balloon,speedboat,squirrel,star,star2,stars,station,statue_of_liberty,steam_locomotive,stew,straight_ruler,strawberry,stuck_out_tongue,stuck_out_tongue_closed_eyes,stuck_out_tongue_winking_eye,sun_with_face,sunflower,sunglasses,sunny,sunrise,sunrise_over_mountains,surfer,sushi,suspect,suspension_railway,sweat,sweat_drops,sweat_smile,sweet_potato,swimmer,symbols,syringe,tada,tanabata_tree,tangerine,taurus,taxi,tea,telephone,telephone_receiver,telescope,tennis,tent,thought_balloon,three,thumbsdown,thumbsup,ticket,tiger,tiger2,tired_face,tm,toilet,tokyo_tower,tomato,tongue,top,tophat,tractor,traffic_light,train,train2,tram,triangular_flag_on_post,triangular_ruler,trident,triumph,trolleybus,trollface,trophy,tropical_drink,tropical_fish,truck,trumpet,tshirt,tulip,turtle,tv,twisted_rightwards_arrows,two,two_hearts,two_men_holding_hands,two_women_holding_hands,u5272,u5408,u55b6,u6307,u6708,u6709,u6e80,u7121,u7533,u7981,u7a7a,uk,umbrella,unamused,underage,unlock,up,us,v,vertical_traffic_light,vhs,vibration_mode,video_camera,video_game,violin,virgo,volcano,vs,walking,waning_crescent_moon,waning_gibbous_moon,warning,watch,water_buffalo,watermelon,wave,wavy_dash,waxing_crescent_moon,waxing_gibbous_moon,wc,weary,wedding,whale,whale2,wheelchair,white_check_mark,white_circle,white_flower,white_large_square,white_medium_small_square,white_medium_square,white_small_square,white_square_button,wind_chime,wine_glass,wink,wolf,woman,womans_clothes,womans_hat,womens,worried,wrench,x,yellow_heart,yen,yum,zap,zero,zzz".split(",");CodeMirror.registerHelper("hint","emoji",function(cm){var word=/[\w$]+/;var cur=cm.getCursor(),curLine=cm.getLine(cur.line);var start=cur.ch,end=start;while(end<curLine.length&&word.test(curLine.charAt(end))){++end}while(start&&word.test(curLine.charAt(start-1))){--start}var tok=cm.getTokenAt(cur);var autocompleteHints=[];var input=tok.string.trim();var matchCnt=0;for(var i=0;i<emojis.length;i++){var displayText=emojis[i];var text=emojis[i];if(Util.startsWith(text,input)){autocompleteHints.push({displayText:'<span style="font-size: 1rem;line-height:22px"><img style="width: 1rem;margin:3px 0;float:left" src="'+latkeConfig.servePath+"/js/lib/emojify.js-1.1.0/images/basic/"+text+'.png"> '+displayText.toString()+"</span>",text:":"+text+": "});matchCnt++}if(matchCnt>10){break}}return{list:autocompleteHints,from:CodeMirror.Pos(cur.line,start),to:CodeMirror.Pos(cur.line,end)}});CodeMirror.commands.autocompleteEmoji=function(cm){cm.showHint({hint:CodeMirror.hint.emoji,completeSingle:false});return CodeMirror.Pass};var commentEditor=new Editor({element:document.getElementById(conf.id),dragDrop:false,lineWrapping:true,status:false,htmlURL:latkeConfig.servePath+"/console/markdown/2html",toolbar:[{name:"bold"},{name:"italic"},{name:"quote"},{name:"link"},{name:"unordered-list"},{name:"ordered-list"},{name:"image",html:'<span style="display: inline-block;top:1px" class="tooltipped tooltipped-n" aria-label="'+Label.uploadFilesLabel+'" ><form id="'+conf.id+'fileUpload" method="POST" enctype="multipart/form-data"><label class="icon-upload"><input type="file"/></label></form></span>'},{name:"redo"},{name:"undo"},{name:"preview"},{name:"fullscreen"}],extraKeys:{"Cmd-/":"autocompleteEmoji","Ctrl-/":"autocompleteEmoji"}});commentEditor.render();Util.initUploadFile({id:conf.id+"fileUpload",pasteZone:$("#"+conf.id).next().next(),qiniuUploadToken:qiniu.qiniuUploadToken,editor:commentEditor.codemirror,uploadingLabel:"uploading...",qiniuDomain:"//"+qiniu.qiniuDomain});this[conf.id]=commentEditor.codemirror;this[conf.id].on("changes",function(cm){if($("#"+conf.id).parent().find(".CodeMirror-preview").length===0){return false}$.ajax({url:latkeConfig.servePath+"/console/markdown/2html",type:"POST",cache:false,data:{markdownText:cm.getValue()},success:function(result,textStatus){$("#"+conf.id).parent().find(".CodeMirror-preview").html(result.html);hljs.initHighlighting.called=false;hljs.initHighlighting()}})});if(typeof(conf.fun)==="function"){conf.fun()}},getContent:function(id){return this[id].getValue()},setContent:function(id,content){this[id].setValue(content);var $preview=$("#"+id).parent().find(".markdown-preivew");$preview.find(".markdown-preview-main").html(content)},remove:function(id){this[id].toTextArea();$(".editor-toolbar").remove()}};var TablePaginate=function(id){this.id=id;this.currentPage=1};$.extend(TablePaginate.prototype,{buildTable:function(colModel,noExpend){var tableData={colModel:colModel,noDataTip:Label.noDataLabel};if(!noExpend){tableData.expendRow={index:"expendRow"}}$("#"+this.id+"Table").table(tableData)},initPagination:function(){var id=this.id;$("#"+id+"Pagination").paginate({bind:function(currentPage,errorMessage){if(errorMessage){$("#tipMsg").text(errorMessage)}else{admin.setHashByPage(currentPage)}},currentPage:1,errorMessage:Label.inputErrorLabel,nextPageText:">",previousPageText:"<",goText:Label.gotoLabel,type:"custom",custom:[1],pageCount:1})},initCommentsDialog:function(){var that=this;$("#"+this.id+"Comments").dialog({modal:true,hideFooter:true,close:function(){admin[that.id+"List"].getList(that.currentPage);return true}})},updateTablePagination:function(data,currentPage,pageInfo){currentPage=parseInt(currentPage);if(currentPage>pageInfo.paginationPageCount&&currentPage>1){$("#tipMsg").text(Label.pageLabel+currentPage+Label.notFoundLabel);$("#loadMsg").text("");return}$("#"+this.id+"Table").table("update",{data:[{groupName:"all",groupData:data}]});if(pageInfo.paginationPageCount===0){pageInfo.paginationPageCount=1}$("#"+this.id+"Pagination").paginate("update",{pageCount:pageInfo.paginationPageCount,currentPage:currentPage,custom:pageInfo.paginationPageNums});this.currentPage=currentPage}});admin.article={currentEditorType:"",isConfirm:true,status:{id:undefined,isArticle:undefined,articleHadBeenPublished:undefined},content:"",autoSaveDraftTimer:"",AUTOSAVETIME:1000*60,initUploadFile:function(id){var filename="";$("#"+id).fileupload({multipart:true,url:"https://up.qbox.me",add:function(e,data){filename=data.files[0].name;data.submit();$("#"+id+" span").text("uploading...")},formData:function(form){var data=form.serializeArray();var ext=filename.substring(filename.lastIndexOf(".")+1);data.push({name:"key",value:getUUID()+"."+ext});data.push({name:"token",value:qiniu.qiniuUploadToken});return data},done:function(e,data){$("#"+id+" span").text("");var qiniuKey=data.result.key;if(!qiniuKey){alert("Upload error, please check Qiniu configurations");return}$("#"+id).after("<div>!["+data.files[0].name+"](http://"+qiniu.qiniuDomain+qiniuKey+")</div>")},fail:function(e,data){$("#"+id+" span").text("Upload error, please check Qiniu configurations ["+data.errorThrown+"]")}}).on("fileuploadprocessalways",function(e,data){var currentFile=data.files[data.index];if(data.files.error&&currentFile.error){alert(currentFile.error)}})},get:function(id,isArticle){this.status.id=id;this.status.isArticle=isArticle;admin.selectTab("article/article")},getAndSet:function(){$("#loadMsg").text(Label.loadingLabel);$("#tipMsg").text("");$.ajax({url:latkeConfig.servePath+"/console/article/"+admin.article.status.id,type:"GET",cache:false,success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}$("#title").val(result.article.articleTitle);admin.article.status.articleHadBeenPublished=result.article.articleHadBeenPublished;if(admin.article.currentEditorType!==result.article.articleEditorType){admin.editors.articleEditor.remove();admin.editors.abstractEditor.remove();admin.article.currentEditorType=result.article.articleEditorType;admin.editors.articleEditor.init(result.article.articleEditorType);admin.editors.abstractEditor.init(result.article.articleEditorType)}admin.editors.articleEditor.setContent(result.article.articleContent);admin.editors.abstractEditor.setContent(result.article.articleAbstract);admin.article.content=admin.editors.articleEditor.getContent();var tags=result.article.articleTags,tagsString="";for(var i=0;i<tags.length;i++){if(0===i){tagsString=tags[i].tagTitle}else{tagsString+=","+tags[i].tagTitle}}$("#tag").val(tagsString);$("#permalink").val(result.article.articlePermalink);$("#viewPwd").val(result.article.articleViewPwd);$("#articleCommentable").prop("checked",result.article.articleCommentable);var signs=result.article.signs;$(".signs button").each(function(i){if(parseInt(result.article.articleSignId)===parseInt(signs[i].oId)){$("#articleSign"+signs[i].oId).addClass("selected")}else{$("#articleSign"+signs[i].oId).removeClass("selected")}});admin.article.setStatus();$("#loadMsg").text("")}})},del:function(id,fromId,title){var isDelete=confirm(Label.confirmRemoveLabel+Label.articleLabel+'"'+title+'"?');if(isDelete){$("#loadMsg").text(Label.loadingLabel);$("#tipMsg").text("");$.ajax({url:latkeConfig.servePath+"/console/article/"+id,type:"DELETE",cache:false,success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}admin[fromId+"List"].getList(1)}})}},add:function(articleIsPublished,isAuto){if(admin.article.validate()){var that=this;that._addDisabled();$("#loadMsg").text(Label.loadingLabel);$("#tipMsg").text("");var signId="";$(".signs button").each(function(){if(this.className==="selected"){signId=this.id.substr(this.id.length-1,1)}});var articleContent=admin.editors.articleEditor.getContent(),articleAbstract=admin.editors.abstractEditor.getContent();var requestJSONObject={article:{articleTitle:$("#title").val(),articleContent:articleContent,articleAbstract:articleAbstract,articleTags:this.trimUniqueArray($("#tag").val()).toString(),articlePermalink:$("#permalink").val(),articleIsPublished:articleIsPublished,articleSignId:signId,postToCommunity:$("#postToCommunity").prop("checked"),articleCommentable:$("#articleCommentable").prop("checked"),articleViewPwd:$("#viewPwd").val()}};$.ajax({url:latkeConfig.servePath+"/console/article/",type:"POST",cache:false,data:JSON.stringify(requestJSONObject),success:function(result,textStatus){if(isAuto){$("#tipMsg").text(Label.autoSaveLabel);admin.article.status.id=result.oId;return}$("#tipMsg").text(result.msg);if(!result.sc){return}if(articleIsPublished){admin.article.status.id=undefined;admin.selectTab("article/article-list")}else{admin.selectTab("article/draft-list")}admin.article.isConfirm=false},complete:function(jqXHR,textStatus){that._removeDisabled();$("#loadMsg").text("");if(jqXHR.status===403){$.get("/admin-index.do");that.add(articleIsPublished)}}})}},update:function(articleIsPublished,isAuto){if(admin.article.validate()){var that=this;that._addDisabled();$("#loadMsg").text(Label.loadingLabel);$("#tipMsg").text("");var signId="";$(".signs button").each(function(){if(this.className==="selected"){signId=this.id.substr(this.id.length-1,1)}});var articleContent=admin.editors.articleEditor.getContent(),articleAbstract=admin.editors.abstractEditor.getContent();var requestJSONObject={article:{oId:this.status.id,articleTitle:$("#title").val(),articleContent:articleContent,articleAbstract:articleAbstract,articleTags:this.trimUniqueArray($("#tag").val()).toString(),articlePermalink:$("#permalink").val(),articleIsPublished:articleIsPublished,articleSignId:signId,articleCommentable:$("#articleCommentable").prop("checked"),articleViewPwd:$("#viewPwd").val(),postToCommunity:$("#postToCommunity").prop("checked"),articleEditorType:admin.article.currentEditorType}};$.ajax({url:latkeConfig.servePath+"/console/article/",type:"PUT",cache:false,data:JSON.stringify(requestJSONObject),success:function(result,textStatus){if(isAuto){$("#tipMsg").text(Label.autoSaveLabel);return}$("#tipMsg").text(result.msg);if(!result.sc){return}if(articleIsPublished){admin.selectTab("article/article-list")}else{admin.selectTab("article/draft-list")}$("#tipMsg").text(Label.updateSuccLabel);admin.article.status.id=undefined;admin.article.isConfirm=false},complete:function(jqXHR,textStatus){that._removeDisabled();$("#loadMsg").text("");if(jqXHR.status===403){$.get("/admin-index.do");that.update(articleIsPublished)}}})}},setStatus:function(){$.ajax({url:latkeConfig.servePath+"/console/tags",type:"GET",cache:false,success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}if(0>=result.tags.length){return}$("#tagCheckboxPanel>span").remove("");var spans="";for(var i=0;i<result.tags.length;i++){spans+="<span>"+result.tags[i].tagTitle+"</span>"}$("#tagCheckboxPanel").html(spans+'<div class="clear"></div>');$("#loadMsg").text("")}});if(this.status){if(this.status.isArticle){$("#unSubmitArticle").show();$("#saveArticle").hide();$("#submitArticle").show()}else{$("#submitArticle").show();$("#unSubmitArticle").hide();$("#saveArticle").show()}if(this.status.articleHadBeenPublished){$("#postToCommunityPanel").hide()}else{}}else{$("#submitArticle").show();$("#unSubmitArticle").hide();$("#saveArticle").show()}$("#postToCommunity").attr("checked","checked")},clear:function(){this.status={id:undefined,isArticle:undefined,articleHadBeenPublished:undefined};this.setStatus();$("#title").val("");admin.editors.articleEditor.setContent("");admin.editors.abstractEditor.setContent("");$("#tag").val("");$("#tagCheckboxPanel").hide().find("span").removeClass("selected");$("#permalink").val("");$("#articleCammentable").prop("checked",true);$("#postToCommunity").prop("checked",true);$(".signs button").each(function(i){if(i===0){this.className="selected"}else{this.className=""}});$(".editor-preview-active").html("").removeClass("editor-preview-active");$("#uploadContent").remove()},init:function(fun){this.currentEditorType=Label.editorType;$(".signs button").click(function(i){$(".signs button").removeClass("selected");$(this).addClass("selected")});$.ajax({url:latkeConfig.servePath+"/console/tags",type:"GET",cache:false,success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}if(0>=result.tags.length){return}var tags=[];for(var i=0;i<result.tags.length;i++){tags.push(result.tags[i].tagTitle)}$("#tag").completed({height:160,buttonText:Label.selectLabel,data:tags}).width($("#tag").parent().width()-68);$("#loadMsg").text("")}});$("#submitArticle").click(function(){if(admin.article.status.id){admin.article.update(true)}else{admin.article.add(true)}});$("#saveArticle").click(function(){if(admin.article.status.id){admin.article.update(admin.article.status.isArticle)}else{admin.article.add(false)}});this.initUploadFile("articleUpload");admin.editors.articleEditor=new SoloEditor({id:"articleContent",kind:"all",fun:fun,height:500});admin.editors.abstractEditor=new SoloEditor({id:"abstract",kind:"simple",height:200});admin.article.clearDraftTimer();admin.article.autoSaveDraftTimer=setInterval(function(){admin.article._autoSaveToDraft()},admin.article.AUTOSAVETIME)},_autoSaveToDraft:function(){if($("#title").val().replace(/\s/g,"")===""||admin.editors.articleEditor.getContent().replace(/\s/g,"")===""||$("#tag").val().replace(/\s/g,"")===""){return}if(admin.article.status.id){if(!admin.article.status.isArticle){admin.article.update(false,true)}}else{admin.article.add(false,true);admin.article.status.isArticle=false}},clearDraftTimer:function(){if(admin.article.autoSaveDraftTimer!==""){window.clearInterval(admin.article.autoSaveDraftTimer);admin.article.autoSaveDraftTimer=""}},validate:function(){var articleContent=admin.editors.articleEditor.getContent();if($("#title").val().replace(/\s/g,"")===""){$("#tipMsg").text(Label.titleEmptyLabel);$("#title").focus().val("")}else{if(articleContent.replace(/\s/g,"")===""){$("#tipMsg").text(Label.contentEmptyLabel)}else{if($("#tag").val().replace(/\s/g,"")===""){$("#tipMsg").text(Label.tagsEmptyLabel);$("#tag").focus().val("")}else{return true}}}return false},unPublish:function(isAuto){var that=this;that._addDisabled();$.ajax({url:latkeConfig.servePath+"/console/article/unpublish/"+admin.article.status.id,type:"PUT",cache:false,success:function(result,textStatus){if(isAuto){$("#tipMsg").text(Label.autoSaveLabel);return}$("#tipMsg").text(result.msg);if(!result.sc){return}admin.selectTab("article/draft-list");admin.article.status.id=undefined;admin.article.isConfirm=false},complete:function(jqXHR,textStatus){that._removeDisabled();$("#loadMsg").text("");if(jqXHR.status===403){$.get("/admin-index.do");that.unPublish()}}})},trimUniqueArray:function(str){str=str.toString();var arr=str.split(",");for(var i=0;i<arr.length;i++){arr[i]=arr[i].replace(/(^\s*)|(\s*$)/g,"");if(arr[i]===""){arr.splice(i,1);i--}}var unique=$.unique(arr);return unique.toString()},prePost:function(){$("#loadMsg").text(Label.loadingLabel);admin.article.content="";if(!admin.editors.articleEditor.getContent){return}var articleContent=admin.editors.articleEditor.getContent();if(window.location.hash==="#article/article"&&articleContent.replace(/\s/g,"")!==""){if(confirm(Label.editorPostLabel)){admin.article.clear()}}$("#tipMsg").text("");$("#loadMsg").text("");if(admin.article.currentEditorType!==Label.editorType){admin.editors.articleEditor.remove();admin.editors.abstractEditor.remove();admin.article.currentEditorType=Label.editorType;admin.editors.articleEditor.init(Label.editorType);admin.editors.abstractEditor.init(Label.editorType)}},_addDisabled:function(){$("#unSubmitArticle").attr("disabled","disabled");$("#saveArticle").attr("disabled","disabled");$("#submitArticle").attr("disabled","disabled")},_removeDisabled:function(){$("#unSubmitArticle").removeAttr("disabled");$("#saveArticle").removeAttr("disabled");$("#submitArticle").removeAttr("disabled")}};admin.register.article={obj:admin.article,init:admin.article.init,refresh:function(){admin.editors.abstractEditor.setContent("");admin.editors.articleEditor.setContent("");$("#loadMsg").text("");$("#tipMsg").text("")}};function getUUID(){var d=new Date().getTime();var ret="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(c){var r=(d+Math.random()*16)%16|0;d=Math.floor(d/16);return(c=="x"?r:(r&3|8)).toString(16)});ret=ret.replace(new RegExp("-","g"),"");return ret}admin.comment={open:function(id,fromId){this.getList(id,fromId);$("#"+fromId+"Comments").dialog("open")},getList:function(onId,fromId){$("#loadMsg").text(Label.loadingLabel);$("#tipMsg").text("");$("#"+fromId+"Comments").html("");var from="article";if(fromId==="page"){from="page"}$.ajax({url:latkeConfig.servePath+"/console/comments/"+from+"/"+onId,type:"GET",cache:false,success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}var comments=result.comments,commentsHTML="";for(var i=0;i<comments.length;i++){var hrefHTML="<a target='_blank' href='"+comments[i].commentURL+"'>",content=comments[i].commentContent,contentHTML=Util.replaceEmString(content);if(comments[i].commentURL==="http://"){hrefHTML="<a target='_blank'>"}commentsHTML+="<div class='comment-title'><span class='left'>"+hrefHTML+comments[i].commentName+"</a>";if(comments[i].commentOriginalCommentName){commentsHTML+="@"+comments[i].commentOriginalCommentName}commentsHTML+="</span><span title='"+Label.removeLabel+"' class='right deleteIcon' onclick=\"admin.comment.del('"+comments[i].oId+"', '"+fromId+"', '"+onId+"')\"></span><span class='right'><a href='mailto:"+comments[i].commentEmail+"'>"+comments[i].commentEmail+"</a>&nbsp;&nbsp;"+$.bowknot.getDate(comments[i].commentTime)+"&nbsp;</span><div class='clear'></div></div><div class='margin12'>"+contentHTML+"</div>"}if(""===commentsHTML){commentsHTML=Label.noCommentLabel}$("#"+fromId+"Comments").html(commentsHTML);$("#loadMsg").text("")}})},del:function(id,fromId,articleId){var isDelete=confirm(Label.confirmRemoveLabel+Label.commentLabel+"?");if(isDelete){$("#loadMsg").text(Label.loadingLabel);var from="article";if(fromId==="page"){from="page"}$.ajax({url:latkeConfig.servePath+"/console/"+from+"/comment/"+id,type:"DELETE",cache:false,success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}admin.comment.getList(articleId,fromId);$("#loadMsg").text("")}})}}};admin.articleList={tablePagination:new TablePaginate("article"),init:function(page){this.tablePagination.buildTable([{text:Label.titleLabel,index:"title",minWidth:110,style:"padding-left: 12px;font-size:14px;"},{text:Label.authorLabel,index:"author",width:150,style:"padding-left: 12px;"},{text:Label.commentLabel,index:"comments",width:80,style:"padding-left: 12px;"},{text:Label.viewLabel,width:60,index:"articleViewCount",style:"padding-left: 12px;"},{text:Label.createDateLabel,index:"date",width:90,style:"padding-left: 12px;"}]);this.tablePagination.initPagination();this.tablePagination.initCommentsDialog();this.getList(page)},getList:function(pageNum){var that=this;$("#loadMsg").text(Label.loadingLabel);$.ajax({url:latkeConfig.servePath+"/console/articles/status/published/"+pageNum+"/"+Label.PAGE_SIZE+"/"+Label.WINDOW_SIZE,type:"GET",cache:false,success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}var articles=result.articles,articleData=[];for(var i=0;i<articles.length;i++){articleData[i]={};articleData[i].title='<a href="'+latkeConfig.servePath+articles[i].articlePermalink+"\" target='_blank' title='"+articles[i].articleTitle+"' class='no-underline'>"+articles[i].articleTitle+"</a><span class='table-tag'>"+articles[i].articleTags+"</span>";articleData[i].date=$.bowknot.getDate(articles[i].articleCreateTime);articleData[i].comments=articles[i].articleCommentCount;articleData[i].articleViewCount=articles[i].articleViewCount;articleData[i].author=articles[i].authorName;var topClass=articles[i].articlePutTop?Label.cancelPutTopLabel:Label.putTopLabel;articleData[i].expendRow="<a target='_blank' href='"+latkeConfig.servePath+articles[i].articlePermalink+"'>"+Label.viewLabel+"</a> <a href='javascript:void(0)' onclick=\"admin.article.get('"+articles[i].oId+"', true)\">"+Label.updateLabel+"</a> <a href='javascript:void(0)' onclick=\"admin.article.del('"+articles[i].oId+"', 'article', '"+articles[i].articleTitle+"')\">"+Label.removeLabel+"</a> <a href='javascript:void(0)' onclick=\"admin.articleList.popTop(this, '"+articles[i].oId+"')\">"+topClass+"</a> <a href='javascript:void(0)' onclick=\"admin.comment.open('"+articles[i].oId+"', 'article')\">"+Label.commentLabel+"</a>"}that.tablePagination.updateTablePagination(articleData,pageNum,result.pagination);$("#loadMsg").text("")}})},popTop:function(it,id){$("#loadMsg").text(Label.loadingLabel);$("#tipMsg").text("");var $it=$(it),ajaxUrl="canceltop",tip=Label.putTopLabel;if($it.html()===Label.putTopLabel){ajaxUrl="puttop";tip=Label.cancelPutTopLabel}$.ajax({url:latkeConfig.servePath+"/console/article/"+ajaxUrl+"/"+id,type:"PUT",cache:false,success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}$it.html(tip);$("#loadMsg").text("")}})}};admin.register["article-list"]={obj:admin.articleList,init:admin.articleList.init,refresh:admin.articleList.getList};admin.draftList={tablePagination:new TablePaginate("draft"),init:function(page){this.tablePagination.buildTable([{text:Label.titleLabel,index:"title",minWidth:110,style:"padding-left: 12px;font-size:14px;"},{text:Label.authorLabel,index:"author",width:150,style:"padding-left: 12px;"},{text:Label.commentLabel,index:"comments",width:80,style:"padding-left: 12px;"},{text:Label.viewLabel,width:60,index:"articleViewCount",style:"padding-left: 12px;"},{text:Label.createDateLabel,index:"date",width:90,style:"padding-left: 12px;"}]);this.tablePagination.initPagination();this.tablePagination.initCommentsDialog();this.getList(page)},getList:function(pageNum){$("#loadMsg").text(Label.loadingLabel);var that=this;$.ajax({url:latkeConfig.servePath+"/console/articles/status/unpublished/"+pageNum+"/"+Label.PAGE_SIZE+"/"+Label.WINDOW_SIZE,type:"GET",cache:false,success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}var articles=result.articles,articleData=[];for(var i=0;i<articles.length;i++){articleData[i]={};articleData[i].tags=articles[i].articleTags;articleData[i].date=$.bowknot.getDate(articles[i].articleCreateTime);articleData[i].comments=articles[i].articleCommentCount;articleData[i].articleViewCount=articles[i].articleViewCount;articleData[i].author=articles[i].authorName;articleData[i].title="<a class='no-underline' href='"+latkeConfig.servePath+articles[i].articlePermalink+"' target='_blank'>"+articles[i].articleTitle+"</a><span class='table-tag'>"+articles[i].articleTags+"</span>";articleData[i].expendRow="<a href='javascript:void(0)' onclick=\"admin.article.get('"+articles[i].oId+"', false);\">"+Label.updateLabel+"</a> <a href='javascript:void(0)' onclick=\"admin.article.del('"+articles[i].oId+"', 'draft', '"+articles[i].articleTitle+"')\">"+Label.removeLabel+"</a> <a href='javascript:void(0)' onclick=\"admin.comment.open('"+articles[i].oId+"', 'draft')\">"+Label.commentLabel+"</a>"}that.tablePagination.updateTablePagination(articleData,pageNum,result.pagination);$("#loadMsg").text("")}})}};admin.register["draft-list"]={obj:admin.draftList,init:admin.draftList.init,refresh:admin.draftList.getList};admin.pageList={currentEditorType:"",tablePagination:new TablePaginate("page"),pageInfo:{currentCount:1,pageCount:1,currentPage:1},id:"",type:"link",init:function(page){this.tablePagination.buildTable([{text:"",index:"pageOrder",width:60,style:"padding-left: 12px;font-size:14px;"},{style:"padding-left: 12px;",text:Label.titleLabel,index:"pageTitle",width:300},{style:"padding-left: 12px;",text:Label.permalinkLabel,index:"pagePermalink",minWidth:300},{style:"padding-left: 12px;",text:Label.openMethodLabel,index:"pageTarget",width:120},{style:"padding-left: 12px;",text:Label.typeLabel,index:"pageType",width:80},{text:Label.commentLabel,index:"comments",width:80,style:"padding-left: 12px;"}]);this.tablePagination.initPagination();this.tablePagination.initCommentsDialog();this.getList(page);var language=Label.localeString.substring(0,2);if(language==="zh"){language="zh-cn"}admin.pageList.currentEditorType=Label.editorType;admin.editors.pageEditor=new SoloEditor({language:language,kind:"all",id:"pageContent"});$(".fn-type").click(function(){var $it=$(this);if($it.hasClass("selected")){return}$(".fn-type").removeClass("selected");$it.addClass("selected");admin.pageList.type=$it.data("type");if(admin.pageList.type==="page"){$("#pagePagePanel").slideDown();if(Label.editorType==="CodeMirror-Markdown"&&admin.editors.pageEditor.getContent()===""){admin.editors.pageEditor.setContent("")}}else{$("#pagePagePanel").slideUp()}})},getList:function(pageNum){$("#loadMsg").text(Label.loadingLabel);$("#tipMsg").text("");var that=this;$.ajax({url:latkeConfig.servePath+"/console/pages/"+pageNum+"/"+Label.PAGE_SIZE+"/"+Label.WINDOW_SIZE,type:"GET",cache:false,success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}var pages=result.pages;var pageData=[];admin.pageList.pageInfo.currentCount=pages.length;admin.pageList.pageInfo.pageCount=result.pagination.paginationPageCount===0?1:result.pagination.paginationPageCount;for(var i=0;i<pages.length;i++){pageData[i]={};if(i===0){if(pages.length===1){pageData[i].pageOrder=""}else{pageData[i].pageOrder='<div class="table-center" style="width:14px"> <span onclick="admin.pageList.changeOrder('+pages[i].oId+", "+i+', \'down\');" class="icon-move-down"></span></div>'}}else{if(i===pages.length-1){pageData[i].pageOrder='<div class="table-center" style="width:14px"> <span onclick="admin.pageList.changeOrder('+pages[i].oId+", "+i+', \'up\');" class="icon-move-up"></span> </div>'}else{pageData[i].pageOrder='<div class="table-center" style="width:38px"> <span onclick="admin.pageList.changeOrder('+pages[i].oId+", "+i+', \'up\');" class="icon-move-up"></span> <span onclick="admin.pageList.changeOrder('+pages[i].oId+", "+i+', \'down\');" class="icon-move-down"></span> </div>'}}pageData[i].pageTitle="<a class='no-underline' href='"+pages[i].pagePermalink+"' target='_blank'>"+pages[i].pageTitle+"</a>";pageData[i].pagePermalink="<a class='no-underline' href='"+pages[i].pagePermalink+"' target='_blank'>"+pages[i].pagePermalink+"</a>";pageData[i].pageTarget=pages[i].pageOpenTarget;pageData[i].pageType=pages[i].pageType;pageData[i].comments=pages[i].pageCommentCount;pageData[i].expendRow="<span><a href='"+pages[i].pagePermalink+"' target='_blank'>"+Label.viewLabel+"</a> <a href='javascript:void(0)' onclick=\"admin.pageList.get('"+pages[i].oId+"')\">"+Label.updateLabel+"</a> <a href='javascript:void(0)' onclick=\"admin.pageList.del('"+pages[i].oId+"', '"+pages[i].pageTitle+"')\">"+Label.removeLabel+"</a> <a href='javascript:void(0)' onclick=\"admin.comment.open('"+pages[i].oId+"', 'page')\">"+Label.commentLabel+"</a></span>"}that.tablePagination.updateTablePagination(pageData,pageNum,result.pagination);$("#loadMsg").text("")}})},get:function(id){$("#loadMsg").text(Label.loadingLabel);$("#tipMsg").text("");$.ajax({url:latkeConfig.servePath+"/console/page/"+id,type:"GET",cache:false,success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}admin.pageList.id=id;$("#pageTitle").val(result.page.pageTitle);$("#pagePermalink").val(result.page.pagePermalink);$("#pageTarget").val(result.page.pageOpenTarget);if(result.page.pageType==="page"){$($(".fn-type").get(1)).click()}else{$($(".fn-type").get(0)).click()}$("#pageCommentable").prop("checked",result.page.pageCommentable);if(admin.pageList.currentEditorType!==result.page.pageEditorType){admin.editors.pageEditor.remove();admin.pageList.currentEditorType=result.page.pageEditorType;admin.editors.pageEditor.init(result.page.pageEditorType)}admin.editors.pageEditor.setContent(result.page.pageContent);$("#loadMsg").text("")}})},del:function(id,title){var isDelete=confirm(Label.confirmRemoveLabel+Label.navLabel+'"'+title+'"?');if(isDelete){$("#loadMsg").text(Label.loadingLabel);$("#tipMsg").text("");$.ajax({url:latkeConfig.servePath+"/console/page/"+id,type:"DELETE",cache:false,success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}var pageNum=admin.pageList.pageInfo.currentPage;if(admin.pageList.pageInfo.currentCount===1&&admin.pageList.pageInfo.pageCount!==1&&admin.pageList.pageInfo.currentPage===admin.pageList.pageInfo.pageCount){admin.pageList.pageInfo.pageCount--;pageNum=admin.pageList.pageInfo.pageCount}var hashList=window.location.hash.split("/");if(pageNum==hashList[hashList.length-1]){admin.pageList.getList(pageNum)}else{admin.setHashByPage(pageNum)}$("#loadMsg").text("")}})}},add:function(){if(this.validate()){$("#loadMsg").text(Label.loadingLabel);$("#tipMsg").text("");var pageContent=admin.editors.pageEditor.getContent();var pagePermalink=$("#pagePermalink").val().replace(/(^\s*)|(\s*$)/g,"");if(admin.pageList.type==="link"){pagePermalink=Util.proessURL(pagePermalink)}var requestJSONObject={page:{pageTitle:$("#pageTitle").val(),pageContent:pageContent,pagePermalink:pagePermalink,pageCommentable:$("#pageCommentable").prop("checked"),pageType:admin.pageList.type,pageOpenTarget:$("#pageTarget").val()}};$.ajax({url:latkeConfig.servePath+"/console/page/",type:"POST",cache:false,data:JSON.stringify(requestJSONObject),success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}admin.pageList.id="";$("#pagePermalink").val("");$("#pageTitle").val("");$("#pageCommentable").prop("cheked",false);$("#pageTarget").val("_self");$($(".fn-type").get(0)).click();admin.editors.pageEditor.setContent("");if(admin.pageList.pageInfo.currentCount===Label.PAGE_SIZE&&admin.pageList.pageInfo.currentPage===admin.pageList.pageInfo.pageCount){admin.pageList.pageInfo.pageCount++}var hashList=window.location.hash.split("/");if(admin.pageList.pageInfo.pageCount==hashList[hashList.length-1]){admin.pageList.getList(admin.pageList.pageInfo.pageCount)}else{admin.setHashByPage(admin.pageList.pageInfo.pageCount)}$("#loadMsg").text("")}})}},update:function(){if(this.validate()){$("#loadMsg").text(Label.loadingLabel);$("#tipMsg").text("");var pageContent=admin.editors.pageEditor.getContent();var pagePermalink=$("#pagePermalink").val().replace(/(^\s*)|(\s*$)/g,"");if(admin.pageList.type==="link"){pagePermalink=Util.proessURL(pagePermalink)}var requestJSONObject={page:{pageTitle:$("#pageTitle").val(),oId:this.id,pageContent:pageContent,pagePermalink:pagePermalink,pageCommentable:$("#pageCommentable").prop("checked"),pageType:admin.pageList.type,pageOpenTarget:$("#pageTarget").val(),pageEditorType:admin.pageList.currentEditorType}};$.ajax({url:latkeConfig.servePath+"/console/page/",type:"PUT",cache:false,data:JSON.stringify(requestJSONObject),success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}admin.pageList.id="";admin.pageList.getList(admin.pageList.pageInfo.currentPage);$("#pageTitle").val("");$("#pagePermalink").val("");$("#pageCommentable").prop("cheked",false);$("#pageTarget").val("_self");$($(".fn-type").get(0)).click();admin.editors.pageEditor.setContent("");$("#loadMsg").text("")}})}},validate:function(){if($("#pageTitle").val().replace(/\s/g,"")===""){$("#tipMsg").text(Label.titleEmptyLabel);$("#pageTitle").focus()}else{if(admin.pageList.type==="link"&&$("#pagePermalink").val().replace(/\s/g,"")===""){$("#tipMsg").text(Label.linkEmptyLabel)}else{return true}}return false},submit:function(){if(this.id!==""){this.update()}else{this.add()}if(admin.pageList.currentEditorType!==Label.editorType){admin.editors.pageEditor.remove();admin.pageList.currentEditorType=Label.editorType;admin.editors.pageEditor.init(Label.editorType)}},changeOrder:function(id,order,status){$("#loadMsg").text(Label.loadingLabel);$("#tipMsg").text("");var requestJSONObject={oId:id.toString(),direction:status};$.ajax({url:latkeConfig.servePath+"/console/page/order/",type:"PUT",cache:false,data:JSON.stringify(requestJSONObject),success:function(result,textStatus){$("#tipMsg").text(result.msg);admin.pageList.getList(admin.pageList.pageInfo.currentPage);$("#loadMsg").text("")}})}};admin.register["page-list"]={obj:admin.pageList,init:admin.pageList.init,refresh:admin.pageList.getList};admin.others={init:function(){$("#tabOthers").tabs();$.ajax({url:latkeConfig.servePath+"/console/reply/notification/template",type:"GET",cache:false,success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}$("#replayEmailTemplateTitle").val(result.replyNotificationTemplate.subject);$("#replayEmailTemplateBody").val(result.replyNotificationTemplate.body);$("#loadMsg").text("")}})},removeUnusedTags:function(){$("#tipMsg").text("");$.ajax({url:latkeConfig.servePath+"/console/tag/unused",type:"DELETE",cache:false,success:function(result,textStatus){$("#tipMsg").text(result.msg)}})},exportSQL:function(){$("#tipMsg").text("");$.ajax({url:latkeConfig.servePath+"/console/export/sql",type:"GET",cache:false,success:function(result,textStatus){if(!result.sc){window.location=latkeConfig.servePath+"/console/export/sql"}else{$("#tipMsg").text(result.msg)}}})},getUnusedTags:function(){$.ajax({url:latkeConfig.servePath+"/console/tag/unused",type:"GET",cache:false,success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}var unusedTags=result.unusedTags;if(0===unusedTags.length){return}}})},update:function(){$("#loadMsg").text(Label.loadingLabel);$("#tipMsg").text("");var requestJSONObject={replyNotificationTemplate:{subject:$("#replayEmailTemplateTitle").val(),body:$("#replayEmailTemplateBody").val()}};$.ajax({url:latkeConfig.servePath+"/console/reply/notification/template",type:"PUT",cache:false,data:JSON.stringify(requestJSONObject),success:function(result,textStatus){$("#tipMsg").text(result.msg);$("#loadMsg").text("")}})}};admin.register.others={obj:admin.others,init:admin.others.init,refresh:function(){admin.clearTip()}};admin.linkList={tablePagination:new TablePaginate("link"),pageInfo:{currentCount:1,pageCount:1,currentPage:1},id:"",init:function(page){this.tablePagination.buildTable([{text:"",index:"linkOrder",width:60},{style:"padding-left: 12px;",text:Label.linkTitleLabel,index:"linkTitle",width:230},{style:"padding-left: 12px;",text:Label.urlLabel,index:"linkAddress",minWidth:180},{style:"padding-left: 12px;",text:Label.linkDescriptionLabel,index:"linkDescription",width:360}]);this.tablePagination.initPagination();this.getList(page);$("#updateLink").dialog({width:700,height:210,modal:true,hideFooter:true})},getList:function(pageNum){$("#loadMsg").text(Label.loadingLabel);if(pageNum===0){pageNum=1}this.pageInfo.currentPage=pageNum;var that=this;$.ajax({url:latkeConfig.servePath+"/console/links/"+pageNum+"/"+Label.PAGE_SIZE+"/"+Label.WINDOW_SIZE,type:"GET",cache:false,success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}var links=result.links;var linkData=[];admin.linkList.pageInfo.currentCount=links.length;admin.linkList.pageInfo.pageCount=result.pagination.paginationPageCount===0?1:result.pagination.paginationPageCount;for(var i=0;i<links.length;i++){linkData[i]={};if(i===0){if(links.length===1){linkData[i].linkOrder=""}else{linkData[i].linkOrder='<div class="table-center" style="width:14px"> <span onclick="admin.linkList.changeOrder('+links[i].oId+", "+i+', \'down\');" class="icon-move-down"></span> </div>'}}else{if(i===links.length-1){linkData[i].linkOrder='<div class="table-center" style="width:14px"> <span onclick="admin.linkList.changeOrder('+links[i].oId+", "+i+', \'up\');" class="icon-move-up"></span> </div>'}else{linkData[i].linkOrder='<div class="table-center" style="width:38px"> <span onclick="admin.linkList.changeOrder('+links[i].oId+", "+i+', \'up\');" class="icon-move-up"></span> <span onclick="admin.linkList.changeOrder('+links[i].oId+", "+i+', \'down\');" class="icon-move-down"></span> </div>'}}linkData[i].linkTitle=links[i].linkTitle;linkData[i].linkAddress="<a target='_blank' class='no-underline' href='"+links[i].linkAddress+"'>"+links[i].linkAddress+"</a>";linkData[i].linkDescription=links[i].linkDescription;linkData[i].expendRow="<span><a href='"+links[i].linkAddress+"' target='_blank'>"+Label.viewLabel+"</a> <a href='javascript:void(0)' onclick=\"admin.linkList.get('"+links[i].oId+"')\">"+Label.updateLabel+"</a> <a href='javascript:void(0)' onclick=\"admin.linkList.del('"+links[i].oId+"', '"+links[i].linkTitle+"')\">"+Label.removeLabel+"</a></span>"}that.tablePagination.updateTablePagination(linkData,pageNum,result.pagination);$("#loadMsg").text("")}})},add:function(){if(this.validate()){$("#loadMsg").text(Label.loadingLabel);$("#tipMsg").text("");var requestJSONObject={link:{linkTitle:$("#linkTitle").val(),linkAddress:$("#linkAddress").val(),linkDescription:$("#linkDescription").val()}};$.ajax({url:latkeConfig.servePath+"/console/link/",type:"POST",cache:false,data:JSON.stringify(requestJSONObject),success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}$("#linkTitle").val("");$("#linkAddress").val("");$("#linkDescription").val("");if(admin.linkList.pageInfo.currentCount===Label.PAGE_SIZE&&admin.linkList.pageInfo.currentPage===admin.linkList.pageInfo.pageCount){admin.linkList.pageInfo.pageCount++}var hashList=window.location.hash.split("/");if(admin.linkList.pageInfo.pageCount!==parseInt(hashList[hashList.length-1])){admin.setHashByPage(admin.linkList.pageInfo.pageCount)}admin.linkList.getList(admin.linkList.pageInfo.pageCount);$("#loadMsg").text("")}})}},get:function(id){$("#loadMsg").text(Label.loadingLabel);$("#updateLink").dialog("open");$.ajax({url:latkeConfig.servePath+"/console/link/"+id,type:"GET",cache:false,success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}admin.linkList.id=id;$("#linkTitleUpdate").val(result.link.linkTitle);$("#linkAddressUpdate").val(result.link.linkAddress);$("#linkDescriptionUpdate").val(result.link.linkDescription);$("#loadMsg").text("")}})},update:function(){if(this.validate("Update")){$("#loadMsg").text(Label.loadingLabel);$("#tipMsg").text("");var requestJSONObject={link:{linkTitle:$("#linkTitleUpdate").val(),oId:this.id,linkAddress:$("#linkAddressUpdate").val(),linkDescription:$("#linkDescriptionUpdate").val()}};$.ajax({url:latkeConfig.servePath+"/console/link/",type:"PUT",cache:false,data:JSON.stringify(requestJSONObject),success:function(result,textStatus){$("#updateLink").dialog("close");$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}admin.linkList.getList(admin.linkList.pageInfo.currentPage);$("#loadMsg").text("")}})}},del:function(id,title){var isDelete=confirm(Label.confirmRemoveLabel+Label.permalinkLabel+'"'+title+'"?');if(isDelete){$("#loadMsg").text(Label.loadingLabel);$("#tipMsg").text("");$.ajax({url:latkeConfig.servePath+"/console/link/"+id,type:"DELETE",cache:false,success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}var pageNum=admin.linkList.pageInfo.currentPage;if(admin.linkList.pageInfo.currentCount===1&&admin.linkList.pageInfo.pageCount!==1&&admin.linkList.pageInfo.currentPage===admin.linkList.pageInfo.pageCount){admin.linkList.pageInfo.pageCount--;pageNum=admin.linkList.pageInfo.pageCount}var hashList=window.location.hash.split("/");if(pageNum!==parseInt(hashList[hashList.length-1])){admin.setHashByPage(pageNum)}admin.linkList.getList(pageNum);$("#loadMsg").text("")}})}},validate:function(status){if(!status){status=""}if($("#linkTitle"+status).val().replace(/\s/g,"")===""){$("#tipMsg").text(Label.titleEmptyLabel);$("#linkTitle"+status).focus().val("")}else{if($("#linkAddress"+status).val().replace(/\s/g,"")===""){$("#tipMsg").text(Label.addressEmptyLabel);$("#linkAddress"+status).focus().val("")}else{if(!/^\w+:\/\//.test($("#linkAddress"+status).val())){$("#tipMsg").text(Label.addressInvalidLabel);$("#linkAddress"+status).focus().val("")}else{return true}}}return false},changeOrder:function(id,order,status){$("#loadMsg").text(Label.loadingLabel);$("#tipMsg").text("");var requestJSONObject={oId:id.toString(),direction:status};$.ajax({url:latkeConfig.servePath+"/console/link/order/",type:"PUT",cache:false,data:JSON.stringify(requestJSONObject),success:function(result,textStatus){$("#tipMsg").text(result.msg);admin.linkList.getList(admin.linkList.pageInfo.currentPage);$("#loadMsg").text("")}})}};admin.register["link-list"]={obj:admin.linkList,init:admin.linkList.init,refresh:admin.linkList.getList};admin.preference={locale:"",editorType:"",init:function(){$("#tabPreference").tabs();$.ajax({url:latkeConfig.servePath+"/console/preference/",type:"GET",cache:false,success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}var preference=result.preference;$("#metaKeywords").val(preference.metaKeywords),$("#metaDescription").val(preference.metaDescription),$("#blogTitle").val(preference.blogTitle),$("#blogSubtitle").val(preference.blogSubtitle),$("#mostCommentArticleDisplayCount").val(preference.mostCommentArticleDisplayCount);$("#mostViewArticleDisplayCount").val(preference.mostViewArticleDisplayCount),$("#recentCommentDisplayCount").val(preference.recentCommentDisplayCount);$("#mostUsedTagDisplayCount").val(preference.mostUsedTagDisplayCount);$("#articleListDisplayCount").val(preference.articleListDisplayCount);$("#articleListPaginationWindowSize").val(preference.articleListPaginationWindowSize);$("#localeString").val(preference.localeString);$("#timeZoneId").val(preference.timeZoneId);$("#noticeBoard").val(preference.noticeBoard);$("#footerContent").val(preference.footerContent);$("#htmlHead").val(preference.htmlHead);$("#externalRelevantArticlesDisplayCount").val(preference.externalRelevantArticlesDisplayCount);$("#relevantArticlesDisplayCount").val(preference.relevantArticlesDisplayCount);$("#randomArticlesDisplayCount").val(preference.randomArticlesDisplayCount);$("#keyOfSolo").val(preference.keyOfSolo);"true"===preference.enableArticleUpdateHint?$("#enableArticleUpdateHint").attr("checked","checked"):$("#enableArticleUpdateHint").removeAttr("checked");"true"===preference.allowVisitDraftViaPermalink?$("#allowVisitDraftViaPermalink").attr("checked","checked"):$("allowVisitDraftViaPermalink").removeAttr("checked");"true"===preference.allowRegister?$("#allowRegister").attr("checked","checked"):$("#allowRegister").removeAttr("checked");"true"===preference.commentable?$("#commentable").attr("checked","checked"):$("commentable").removeAttr("checked");admin.preference.locale=preference.localeString;admin.preference.editorType=preference.editorType;$("#skinMain").data("skinDirName",preference.skinDirName);var skins=eval("("+preference.skins+")");var skinsHTML="";for(var i=0;i<skins.length;i++){var selectedClass="";if(skins[i].skinName===preference.skinName&&skins[i].skinDirName===preference.skinDirName){selectedClass+=" selected"}skinsHTML+="<div title='"+skins[i].skinDirName+"' class='left skinItem"+selectedClass+"'><img class='skinPreview' src='"+latkeConfig.staticServePath+"/skins/"+skins[i].skinDirName+"/preview.png'/><div>"+skins[i].skinName+"</div></div>"}$("#skinMain").append(skinsHTML+"<div class='clear'></div>");$(".skinItem").click(function(){$(".skinItem").removeClass("selected");$(this).addClass("selected");$("#skinMain").data("skinDirName",this.title)});var signs=eval("("+preference.signs+")");for(var j=1;j<signs.length;j++){$("#preferenceSign"+j).val(signs[j].signHTML)}$("#articleListDisplay").val(preference.articleListStyle);$("#editorType").val(preference.editorType);$("#feedOutputMode").val(preference.feedOutputMode);$("#feedOutputCnt").val(preference.feedOutputCnt);$("#loadMsg").text("")}});$.ajax({url:latkeConfig.servePath+"/console/preference/qiniu",type:"GET",cache:false,success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}$("#qiniuAccessKey").val(result.qiniu.qiniuAccessKey);$("#qiniuSecretKey").val(result.qiniu.qiniuSecretKey);$("#qiniuDomain").val(result.qiniu.qiniuDomain);$("#qiniuBucket").val(result.qiniu.qiniuBucket)}})},validate:function(){if(!/^\d+$/.test($("#mostUsedTagDisplayCount").val())){$("#tipMsg").text("["+Label.paramSettingsLabel+" - "+Label.indexTagDisplayCntLabel+"] "+Label.nonNegativeIntegerOnlyLabel);$("#mostUsedTagDisplayCount").focus();return false}else{if(!/^\d+$/.test($("#recentCommentDisplayCount").val())){$("#tipMsg").text("["+Label.paramSettingsLabel+" - "+Label.indexRecentCommentDisplayCntLabel+"] "+Label.nonNegativeIntegerOnlyLabel);$("#recentCommentDisplayCount").focus();return false}else{if(!/^\d+$/.test($("#mostCommentArticleDisplayCount").val())){$("#tipMsg").text("["+Label.paramSettingsLabel+" - "+Label.indexMostCommentArticleDisplayCntLabel+"] "+Label.nonNegativeIntegerOnlyLabel);$("#mostCommentArticleDisplayCount").focus();return false}else{if(!/^\d+$/.test($("#mostViewArticleDisplayCount").val())){$("#tipMsg").text("["+Label.paramSettingsLabel+" - "+Label.indexMostViewArticleDisplayCntLabel+"] "+Label.nonNegativeIntegerOnlyLabel);$("#mostViewArticleDisplayCount").focus();return false}else{if(!/^\d+$/.test($("#articleListDisplayCount").val())){$("#tipMsg").text("["+Label.paramSettingsLabel+" - "+Label.pageSizeLabel+"] "+Label.nonNegativeIntegerOnlyLabel);$("#articleListDisplayCount").focus();return false}else{if(!/^\d+$/.test($("#articleListPaginationWindowSize").val())){$("#tipMsg").text("["+Label.paramSettingsLabel+" - "+Label.windowSizeLabel+"] "+Label.nonNegativeIntegerOnlyLabel);$("#articleListPaginationWindowSize").focus();return false}else{if(!/^\d+$/.test($("#randomArticlesDisplayCount").val())){$("#tipMsg").text("["+Label.paramSettingsLabel+" - "+Label.randomArticlesDisplayCntLabel+"] "+Label.nonNegativeIntegerOnlyLabel);$("#randomArticlesDisplayCount").focus();return false}else{if(!/^\d+$/.test($("#relevantArticlesDisplayCount").val())){$("#tipMsg").text("["+Label.paramSettingsLabel+" - "+Label.relevantArticlesDisplayCntLabel+"] "+Label.nonNegativeIntegerOnlyLabel);$("#relevantArticlesDisplayCount").focus();return false}else{if(!/^\d+$/.test($("#externalRelevantArticlesDisplayCount").val())){$("#tipMsg").text("["+Label.paramSettingsLabel+" - "+Label.externalRelevantArticlesDisplayCntLabel+"] "+Label.nonNegativeIntegerOnlyLabel);$("#externalRelevantArticlesDisplayCount").focus();return false}}}}}}}}}return true},update:function(){if(!admin.preference.validate()){return}$("#tipMsg").text("");$("#loadMsg").text(Label.loadingLabel);var signs=[{oId:0,signHTML:""},{oId:1,signHTML:$("#preferenceSign1").val()},{oId:2,signHTML:$("#preferenceSign2").val()},{oId:3,signHTML:$("#preferenceSign3").val()}];var requestJSONObject={preference:{metaKeywords:$("#metaKeywords").val(),metaDescription:$("#metaDescription").val(),blogTitle:$("#blogTitle").val(),blogSubtitle:$("#blogSubtitle").val(),mostCommentArticleDisplayCount:$("#mostCommentArticleDisplayCount").val(),mostViewArticleDisplayCount:$("#mostViewArticleDisplayCount").val(),recentCommentDisplayCount:$("#recentCommentDisplayCount").val(),mostUsedTagDisplayCount:$("#mostUsedTagDisplayCount").val(),articleListDisplayCount:$("#articleListDisplayCount").val(),articleListPaginationWindowSize:$("#articleListPaginationWindowSize").val(),skinDirName:$("#skinMain").data("skinDirName"),localeString:$("#localeString").val(),timeZoneId:$("#timeZoneId").val(),noticeBoard:$("#noticeBoard").val(),footerContent:$("#footerContent").val(),htmlHead:$("#htmlHead").val(),externalRelevantArticlesDisplayCount:$("#externalRelevantArticlesDisplayCount").val(),relevantArticlesDisplayCount:$("#relevantArticlesDisplayCount").val(),randomArticlesDisplayCount:$("#randomArticlesDisplayCount").val(),enableArticleUpdateHint:$("#enableArticleUpdateHint").prop("checked"),signs:signs,keyOfSolo:$("#keyOfSolo").val(),allowVisitDraftViaPermalink:$("#allowVisitDraftViaPermalink").prop("checked"),articleListStyle:$("#articleListDisplay").val(),editorType:$("#editorType").val(),feedOutputMode:$("#feedOutputMode").val(),feedOutputCnt:$("#feedOutputCnt").val(),commentable:$("#commentable").prop("checked"),allowRegister:$("#allowRegister").prop("checked")}};$.ajax({url:latkeConfig.servePath+"/console/preference/",type:"PUT",cache:false,data:JSON.stringify(requestJSONObject),success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}if($("#localeString").val()!==admin.preference.locale||$("#editorType").val()!==admin.preference.editorType){window.location.reload()}for(var i=1;i<signs.length;i++){if($("#articleSign"+signs[i].oId).length===1){$("#articleSign"+signs[i].oId).tip("option","content",signs[i].signHTML===""?Label.signIsNullLabel:signs[i].signHTML.replace(/\n/g,"").replace(/<script.*<\/script>/ig,""))}}$("#loadMsg").text("")}})},updateQiniu:function(){$("#tipMsg").text("");$("#loadMsg").text(Label.loadingLabel);var requestJSONObject={qiniuAccessKey:$("#qiniuAccessKey").val(),qiniuSecretKey:$("#qiniuSecretKey").val(),qiniuDomain:$("#qiniuDomain").val(),qiniuBucket:$("#qiniuBucket").val()};$.ajax({url:latkeConfig.servePath+"/console/preference/qiniu",type:"PUT",cache:false,data:JSON.stringify(requestJSONObject),success:function(result,textStatus){if(result.sc){window.location.reload()}$("#tipMsg").text(result.msg);$("#loadMsg").text("")}})}};admin.register.preference={obj:admin.preference,init:admin.preference.init,refresh:function(){admin.clearTip()}};admin.pluginList={tablePagination:new TablePaginate("plugin"),pageInfo:{currentCount:1,pageCount:1,currentPage:1},init:function(page){this.tablePagination.buildTable([{style:"padding-left: 12px;",text:Label.pluginNameLabel,index:"name",width:230},{style:"padding-left: 12px;",text:Label.statusLabel,index:"status",minWidth:180},{style:"padding-left: 12px;",text:Label.authorLabel,index:"author",width:200},{style:"padding-left: 12px;",text:Label.versionLabel,index:"version",width:120}]);this.tablePagination.initPagination();$("#pluginSetting").dialog({width:700,height:180,modal:true,hideFooter:true});this.getList(page)},getList:function(pageNum){$("#loadMsg").text(Label.loadingLabel);$("#tipMsg").text("");var that=this;$.ajax({url:latkeConfig.servePath+"/console/plugins/"+pageNum+"/"+Label.PAGE_SIZE+"/"+Label.WINDOW_SIZE,type:"GET",cache:false,success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}admin.pluginList.pageInfo.currentPage=pageNum;var datas=result.plugins;for(var i=0;i<datas.length;i++){datas[i].expendRow="<a href='javascript:void(0)' onclick=\"admin.pluginList.changeStatus('"+datas[i].oId+"', '"+datas[i].status+"')\">";if(datas[i].status==="ENABLED"){datas[i].status=Label.enabledLabel;datas[i].expendRow+=Label.disableLabel}else{datas[i].status=Label.disabledLabel;datas[i].expendRow+=Label.enableLabel}datas[i].expendRow+="</a> ";if(datas[i].setting!="{}"){datas[i].expendRow+="<a href='javascript:void(0)' onclick=\"admin.pluginList.toSetting('"+datas[i].oId+"')\"> "+Label.settingLabel+" </a> "}}that.tablePagination.updateTablePagination(result.plugins,pageNum,result.pagination);$("#loadMsg").text("")}})},toSetting:function(pluginId){$("#loadMsg").text(Label.loadingLabel);$("#tipMsg").text("");var requestJSONObject={oId:pluginId};$.ajax({url:latkeConfig.servePath+"/console/plugin/toSetting",type:"POST",cache:false,data:JSON.stringify(requestJSONObject),success:function(result,textStatus){$("#tipMsg").text(result.msg);$("#pluginSetting").html(result);$("#pluginSetting").dialog("open");$("#loadMsg").text("")}})},changeStatus:function(pluginId,status){$("#loadMsg").text(Label.loadingLabel);$("#tipMsg").text("");if(status==="ENABLED"){status="DISABLED"}else{status="ENABLED"}var requestJSONObject={oId:pluginId,status:status};$.ajax({url:latkeConfig.servePath+"/console/plugin/status/",type:"PUT",cache:false,data:JSON.stringify(requestJSONObject),success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}$("#loadMsg").text("");window.location.reload()}})}};admin.register["plugin-list"]={obj:admin.pluginList,init:admin.pluginList.init,refresh:function(){$("#loadMsg").text("")}};admin.userList={tablePagination:new TablePaginate("user"),pageInfo:{currentCount:1,pageCount:1,currentPage:1},userInfo:{oId:"",userRole:""},init:function(page){this.tablePagination.buildTable([{style:"padding-left: 12px;",text:Label.commentNameLabel,index:"userName",width:230},{style:"padding-left: 12px;",text:Label.commentEmailLabel,index:"userEmail",minWidth:180},{style:"padding-left: 12px;",text:Label.roleLabel,index:"isAdmin",width:120}]);this.tablePagination.initPagination();this.getList(page);$("#userUpdate").dialog({width:700,height:300,modal:true,hideFooter:true})},getList:function(pageNum){$("#loadMsg").text(Label.loadingLabel);$("#tipMsg").text("");this.pageInfo.currentPage=pageNum;var that=this;$.ajax({url:latkeConfig.servePath+"/console/users/"+pageNum+"/"+Label.PAGE_SIZE+"/"+Label.WINDOW_SIZE,type:"GET",cache:false,success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}var users=result.users;var userData=[];admin.userList.pageInfo.currentCount=users.length;admin.userList.pageInfo.pageCount=result.pagination.paginationPageCount;if(users.length<1){$("#tipMsg").text("No user "+Label.reportIssueLabel);$("#loadMsg").text("");return}for(var i=0;i<users.length;i++){userData[i]={};userData[i].userName=users[i].userName;userData[i].userEmail=users[i].userEmail;if("adminRole"===users[i].userRole){userData[i].isAdmin="&nbsp;"+Label.administratorLabel;userData[i].expendRow="<a href='javascript:void(0)' onclick=\"admin.userList.get('"+users[i].oId+"', '"+users[i].userRole+"')\">"+Label.updateLabel+"</a>"}else{userData[i].expendRow="<a href='javascript:void(0)' onclick=\"admin.userList.get('"+users[i].oId+"', '"+users[i].userRole+"')\">"+Label.updateLabel+"</a> <a href='javascript:void(0)' onclick=\"admin.userList.del('"+users[i].oId+"', '"+users[i].userName+"')\">"+Label.removeLabel+"</a> <a href='javascript:void(0)' onclick=\"admin.userList.changeRole('"+users[i].oId+"')\">"+Label.changeRoleLabel+"</a>";if("defaultRole"===users[i].userRole){userData[i].isAdmin=Label.commonUserLabel}else{userData[i].isAdmin=Label.visitorUserLabel}}that.tablePagination.updateTablePagination(userData,pageNum,result.pagination);$("#loadMsg").text("")}}})},add:function(){if(this.validate()){$("#loadMsg").text(Label.loadingLabel);$("#tipMsg").text("");var requestJSONObject={userName:$("#userName").val(),userEmail:$("#userEmail").val(),userURL:$("#userURL").val(),userPassword:$("#userPassword").val(),userAvatar:$("#userAvatar").val()};$.ajax({url:latkeConfig.servePath+"/console/user/",type:"POST",cache:false,data:JSON.stringify(requestJSONObject),success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}$("#userName").val("");$("#userEmail").val("");$("#userURL").val("");$("#userPassword").val("");$("#userAvatar").val("");if(admin.userList.pageInfo.currentCount===Label.PAGE_SIZE&&admin.userList.pageInfo.currentPage===admin.userList.pageInfo.pageCount){admin.userList.pageInfo.pageCount++}var hashList=window.location.hash.split("/");if(admin.userList.pageInfo.pageCount!==parseInt(hashList[hashList.length-1])){admin.setHashByPage(admin.userList.pageInfo.pageCount)}admin.userList.getList(admin.userList.pageInfo.pageCount);$("#loadMsg").text("")}})}},get:function(id,userRole){$("#loadMsg").text(Label.loadingLabel);$("#tipMsg").text("");$("#userUpdate").dialog("open");$.ajax({url:latkeConfig.servePath+"/console/user/"+id,type:"GET",cache:false,success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}var $userEmailUpdate=$("#userEmailUpdate");$("#userNameUpdate").val(result.user.userName).data("userInfo",{oId:id,userRole:userRole});$userEmailUpdate.val(result.user.userEmail);if("adminRole"===userRole){$userEmailUpdate.attr("disabled","disabled")}else{$userEmailUpdate.removeAttr("disabled")}$("#userURLUpdate").val(result.user.userURL);$("#userPasswordUpdate").val(result.user.userPassword);$("#userAvatarUpdate").val(result.user.userAvatar);$("#loadMsg").text("")}})},update:function(){if(this.validate("Update")){$("#loadMsg").text(Label.loadingLabel);$("#tipMsg").text("");var userInfo=$("#userNameUpdate").data("userInfo");var requestJSONObject={userName:$("#userNameUpdate").val(),oId:userInfo.oId,userEmail:$("#userEmailUpdate").val(),userURL:$("#userURLUpdate").val(),userRole:userInfo.userRole,userPassword:$("#userPasswordUpdate").val(),userAvatar:$("#userAvatarUpdate").val()};$.ajax({url:latkeConfig.servePath+"/console/user/",type:"PUT",cache:false,data:JSON.stringify(requestJSONObject),success:function(result,textStatus){$("#userUpdate").dialog("close");$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}admin.userList.getList(admin.userList.pageInfo.currentPage);$("#loadMsg").text("")}})}},del:function(id,userName){var isDelete=confirm(Label.confirmRemoveLabel+Label.userLabel+'"'+userName+'"?');if(isDelete){$("#loadMsg").text(Label.loadingLabel);$("#tipMsg").text("");$.ajax({url:latkeConfig.servePath+"/console/user/"+id,type:"DELETE",cache:false,success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}var pageNum=admin.userList.pageInfo.currentPage;if(admin.userList.pageInfo.currentCount===1&&admin.userList.pageInfo.pageCount!==1&&admin.userList.pageInfo.currentPage===admin.userList.pageInfo.pageCount){admin.userList.pageInfo.pageCount--;pageNum=admin.userList.pageInfo.pageCount}var hashList=window.location.hash.split("/");if(pageNum!==parseInt(hashList[hashList.length-1])){admin.setHashByPage(pageNum)}admin.userList.getList(pageNum);$("#loadMsg").text("")}})}},changeRole:function(id){$("#tipMsg").text("");$.ajax({url:latkeConfig.servePath+"/console/changeRole/"+id,type:"GET",cache:false,success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}var pageNum=admin.userList.pageInfo.currentPage;if(admin.userList.pageInfo.currentCount===1&&admin.userList.pageInfo.pageCount!==1&&admin.userList.pageInfo.currentPage===admin.userList.pageInfo.pageCount){admin.userList.pageInfo.pageCount--;pageNum=admin.userList.pageInfo.pageCount}var hashList=window.location.hash.split("/");if(pageNum!==parseInt(hashList[hashList.length-1])){admin.setHashByPage(pageNum)}admin.userList.getList(pageNum);$("#loadMsg").text("")}})},validate:function(status){if(!status){status=""}var userName=$("#userName"+status).val().replace(/(^\s*)|(\s*$)/g,"");if(2>userName.length||userName.length>20){$("#tipMsg").text(Label.nameTooLongLabel);$("#userName"+status).focus()}else{if($("#userEmail"+status).val().replace(/\s/g,"")===""){$("#tipMsg").text(Label.mailCannotEmptyLabel);$("#userEmail"+status).focus()}else{if(!/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test($("#userEmail"+status).val())){$("#tipMsg").text(Label.mailInvalidLabel);$("#userEmail"+status).focus()}else{if($("#userPassword"+status).val()===""){$("#tipMsg").text(Label.passwordEmptyLabel);$("#userPassword"+status).focus()}else{return true}}}}return false}};admin.register["user-list"]={obj:admin.userList,init:admin.userList.init,refresh:admin.userList.getList};admin.categoryList={tablePagination:new TablePaginate("category"),pageInfo:{currentCount:1,pageCount:1,currentPage:1},init:function(page){this.tablePagination.buildTable([{text:"",index:"linkOrder",width:60},{style:"padding-left: 12px;",text:Label.titleLabel,index:"categoryTitle",width:230},{style:"padding-left: 12px;",text:"URI",index:"categoryURI",width:230},{style:"padding-left: 12px;",text:Label.descriptionLabel,index:"categoryDesc",minWidth:180}]);this.tablePagination.initPagination();this.getList(page);$("#categoryUpdate").dialog({width:700,height:260,modal:true,hideFooter:true});$.ajax({url:latkeConfig.servePath+"/console/tags",type:"GET",cache:false,success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}if(0>=result.tags.length){return}var tags=[];for(var i=0;i<result.tags.length;i++){tags.push(result.tags[i].tagTitle)}$("#categoryTags").completed({height:160,buttonText:Label.selectLabel,data:tags}).width($("#categoryTags").parent().width()-68);$("#loadMsg").text("")}})},getList:function(pageNum){$("#loadMsg").text(Label.loadingLabel);$("#tipMsg").text("");this.pageInfo.currentPage=pageNum;var that=this;$.ajax({url:latkeConfig.servePath+"/console/categories/"+pageNum+"/"+Label.PAGE_SIZE+"/"+Label.WINDOW_SIZE,type:"GET",cache:false,success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}var categories=result.categories;var categoryData=[];admin.categoryList.pageInfo.currentCount=categories.length;admin.categoryList.pageInfo.pageCount=result.pagination.paginationPageCount===0?1:result.pagination.paginationPageCount;for(var i=0;i<categories.length;i++){categoryData[i]={};if(i===0){if(categories.length===1){categoryData[i].linkOrder=""}else{categoryData[i].linkOrder='<div class="table-center" style="width:14px"> <span onclick="admin.categoryList.changeOrder('+categories[i].oId+", "+i+', \'down\');" class="icon-move-down"></span> </div>'}}else{if(i===categories.length-1){categoryData[i].linkOrder='<div class="table-center" style="width:14px"> <span onclick="admin.categoryList.changeOrder('+categories[i].oId+", "+i+', \'up\');" class="icon-move-up"></span> </div>'}else{categoryData[i].linkOrder='<div class="table-center" style="width:38px"> <span onclick="admin.categoryList.changeOrder('+categories[i].oId+", "+i+', \'up\');" class="icon-move-up"></span> <span onclick="admin.categoryList.changeOrder('+categories[i].oId+", "+i+', \'down\');" class="icon-move-down"></span> </div>'}}categoryData[i].categoryTitle=categories[i].categoryTitle;categoryData[i].categoryURI=categories[i].categoryURI;categoryData[i].categoryDesc=categories[i].categoryDescription;categoryData[i].expendRow="<a href='javascript:void(0)' onclick=\"admin.categoryList.get('"+categories[i].oId+"')\">"+Label.updateLabel+"</a> <a href='javascript:void(0)' onclick=\"admin.categoryList.del('"+categories[i].oId+"', '"+categories[i].categoryTitle+"')\">"+Label.removeLabel+"</a> "}that.tablePagination.updateTablePagination(categoryData,pageNum,result.pagination);$("#loadMsg").text("")}})},add:function(){if(this.validate()){$("#loadMsg").text(Label.loadingLabel);$("#tipMsg").text("");var requestJSONObject={categoryTitle:$("#categoryName").val(),categoryTags:$("#categoryTags").val(),categoryURI:$("#categoryURI").val(),categoryDescription:$("#categoryDesc").val()};$.ajax({url:latkeConfig.servePath+"/console/category/",type:"POST",cache:false,data:JSON.stringify(requestJSONObject),success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}$("#categoryName").val("");$("#categoryTags").val("");$("#categoryURI").val("");$("#categoryDesc").val("");if(admin.categoryList.pageInfo.currentCount===Label.PAGE_SIZE&&admin.categoryList.pageInfo.currentPage===admin.categoryList.pageInfo.pageCount){admin.categoryList.pageInfo.pageCount++}var hashList=window.location.hash.split("/");if(admin.categoryList.pageInfo.pageCount!==parseInt(hashList[hashList.length-1])){admin.setHashByPage(admin.categoryList.pageInfo.pageCount)}admin.categoryList.getList(admin.categoryList.pageInfo.pageCount);$("#loadMsg").text("")}})}},get:function(id){$("#loadMsg").text(Label.loadingLabel);$("#tipMsg").text("");$("#categoryUpdate").dialog("open");$.ajax({url:latkeConfig.servePath+"/console/category/"+id,type:"GET",cache:false,success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}$("#categoryNameUpdate").val(result.categoryTitle).data("oId",id);$("#categoryURIUpdate").val(result.categoryURI);$("#categoryDescUpdate").val(result.categoryDescription);$("#categoryTagsUpdate").val(result.categoryTags);$("#loadMsg").text("")}})},update:function(){if(this.validate("Update")){$("#loadMsg").text(Label.loadingLabel);$("#tipMsg").text("");var requestJSONObject={categoryTitle:$("#categoryNameUpdate").val(),oId:$("#categoryNameUpdate").data("oId"),categoryTags:$("#categoryTagsUpdate").val(),categoryURI:$("#categoryURIUpdate").val(),categoryDescription:$("#categoryDescUpdate").val()};$.ajax({url:latkeConfig.servePath+"/console/category/",type:"PUT",cache:false,data:JSON.stringify(requestJSONObject),success:function(result,textStatus){$("#categoryUpdate").dialog("close");$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}admin.categoryList.getList(admin.categoryList.pageInfo.currentPage);$("#loadMsg").text("")}})}},del:function(id,categoryName){var isDelete=confirm(Label.confirmRemoveLabel+Label.categoryLabel+'"'+categoryName+'"?');if(isDelete){$("#loadMsg").text(Label.loadingLabel);$("#tipMsg").text("");$.ajax({url:latkeConfig.servePath+"/console/category/"+id,type:"DELETE",cache:false,success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}var pageNum=admin.categoryList.pageInfo.currentPage;if(admin.categoryList.pageInfo.currentCount===1&&admin.categoryList.pageInfo.pageCount!==1&&admin.categoryList.pageInfo.currentPage===admin.categoryList.pageInfo.pageCount){admin.categoryList.pageInfo.pageCount--;pageNum=admin.categoryList.pageInfo.pageCount}var hashList=window.location.hash.split("/");if(pageNum!==parseInt(hashList[hashList.length-1])){admin.setHashByPage(pageNum)}admin.categoryList.getList(pageNum);$("#loadMsg").text("")}})}},validate:function(status){if(!status){status=""}var categoryName=$("#categoryName"+status).val().replace(/(^\s*)|(\s*$)/g,"");if(2>categoryName.length||categoryName.length>32){$("#tipMsg").text(Label.categoryTooLongLabel);$("#categoryName"+status).focus()}else{if($.trim($("#categoryTags"+status).val())===""){$("#tipMsg").text(Label.tagsEmptyLabel);$("#categoryTags"+status).focus()}else{return true}}return false},changeOrder:function(id,order,status){$("#loadMsg").text(Label.loadingLabel);$("#tipMsg").text("");var requestJSONObject={oId:id.toString(),direction:status};$.ajax({url:latkeConfig.servePath+"/console/category/order/",type:"PUT",cache:false,data:JSON.stringify(requestJSONObject),success:function(result,textStatus){$("#tipMsg").text(result.msg);admin.categoryList.getList(admin.categoryList.pageInfo.currentPage);$("#loadMsg").text("")}})}};admin.register["category-list"]={obj:admin.categoryList,init:admin.categoryList.init,refresh:admin.categoryList.getList};admin.commentList={tablePagination:new TablePaginate("comment"),pageInfo:{currentPage:1},init:function(page){this.tablePagination.buildTable([{text:Label.commentContentLabel,index:"content",minWidth:300,style:"padding-left: 12px;"},{text:Label.authorLabel,index:"title",width:230,style:"padding-left: 12px;"},{text:Label.createDateLabel,index:"date",width:90,style:"padding-left: 12px;"}]);this.tablePagination.initPagination();this.getList(page)},getList:function(pageNum){var that=this;$("#loadMsg").text(Label.loadingLabel);$.ajax({url:latkeConfig.servePath+"/console/comments/"+pageNum+"/"+Label.PAGE_SIZE+"/"+Label.WINDOW_SIZE,type:"GET",cache:false,success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}that.pageInfo.currentPage=pageNum;var comments=result.comments,commentsData=[];for(var i=0;i<comments.length;i++){var type="Article";if(comments[i].type==="pageComment"){type="Page"}commentsData[i]={};commentsData[i].content=Util.replaceEmString(comments[i].commentContent)+"<span class='table-tag'> on &nbsp;&nbsp;</span><a href='"+latkeConfig.servePath+comments[i].commentSharpURL+"' target='_blank'>"+comments[i].commentTitle+"</a>";commentsData[i].expendRow="<a href='javascript:void(0)' onclick=\"admin.commentList.del('"+comments[i].oId+"', '"+type+"')\">"+Label.removeLabel+"</a>";commentsData[i].title="<img class='small-head' src='"+comments[i].commentThumbnailURL+"'/>";if("http://"===comments[i].commentURL){commentsData[i].title+=comments[i].commentName}else{commentsData[i].title+="<a href='"+comments[i].commentURL+"' target='_blank' class='no-underline'>"+comments[i].commentName+"</a>"}commentsData[i].title+="<br/><a href='mailto:"+comments[i].commentEmail+"'>"+comments[i].commentEmail+"</a>";commentsData[i].date=$.bowknot.getDate(comments[i].commentTime)}that.tablePagination.updateTablePagination(commentsData,pageNum,result.pagination);$("#loadMsg").text("")}})},del:function(id,type){if(confirm(Label.confirmRemoveLabel+Label.commentLabel+"?")){$("#loadMsg").text(Label.loadingLabel);$.ajax({url:latkeConfig.servePath+"/console/"+type.toLowerCase()+"/comment/"+id,type:"DELETE",cache:false,success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}admin.commentList.getList(admin.commentList.pageInfo.currentPage);$("#loadMsg").text("")}})}}};admin.register["comment-list"]={obj:admin.commentList,init:admin.commentList.init,refresh:admin.commentList.getList};var plugins={};admin.plugin={plugins:[],add:function(data){data.isInit=false;data.hash=data.path.replace("/","#")+"/"+data.id;this.plugins.push(data);var pathList=this._analysePath(data.path);if(data.index&&pathList.length<2){this._addNew(data,pathList)}},setCurByHash:function(tags){var pluginList=this.plugins;for(var i=0;i<pluginList.length;i++){var data=pluginList[i];var pathList=this._analysePath(data.path),isCurrentPlugin=false;if(data.index&&window.location.hash.indexOf(data.hash)>-1){isCurrentPlugin=true}else{if(data.path.replace("/","#")===window.location.hash||(window.location.hash==="#main"&&data.path.indexOf("/main/panel")>-1)){isCurrentPlugin=true}}if(isCurrentPlugin){if(data.isInit){if(plugins[data.id].refresh){plugins[data.id].refresh(tags.page)}}else{if(!data.index){this._addToExist(data,pathList)}else{if(pathList.length===2){this._addNew(data,pathList)}}plugins[data.id].init(tags.page);data.isInit=true}}}},_analysePath:function(path){var paths=path.split("/");paths.splice(0,1);return paths},_addNew:function(data,pathList){if(pathList.length===2){data.target=$("#tabPreference li").get(data.index-1);$("#tabPreference").tabs("add",data);return}else{if(pathList[0]===""){data.target=$("#tabs>ul>li").get(data.index-1)}else{if(pathList[0]==="article"){data.target=$("#tabArticleMgt>li").get(data.index-1)}else{if(pathList[0]==="tools"){admin.tools.push("#"+data.id);data.target=$("#tabTools>li").get(data.index-1)}}}}if(!data.target){alert("data.index is error!")}$("#tabs").tabs("add",data)},_addToExist:function(data,pathList){switch(pathList[0]){case"main":$("#mainPanel"+pathList[1].charAt(5)).append(data.content);break;case"tools":case"article":if(pathList.length===2){$("#tabsPanel_"+pathList[1]).append(data.content)}else{$("#tabPreferencePanel_"+pathList[2]).append(data.content)}break;case"comment-list":$("#tabsPanel_comment-list").append(data.content);break}}};admin.main={};admin.register.main={obj:admin.main,init:function(){admin.clearTip()},refresh:function(){admin.clearTip()}};admin.about={init:function(){$.ajax({url:"https://rhythm.b3log.org/version/solo/latest/"+Label.version,type:"GET",cache:false,dataType:"jsonp",success:function(data,textStatus){var version=data.soloVersion;if(version===Label.version){$("#aboutLatest").text(Label.upToDateLabel)}else{$("#aboutLatest").html(Label.outOfDateLabel+"<a href='"+data.soloDownload+"'>"+version+"</a>")}},complete:function(XHR,TS){admin.clearTip()}})}};admin.register.about={obj:admin.about,init:admin.about.init,refresh:function(){admin.clearTip()}}; var Admin=function(){this.register={};this.tools=["#page-list","#file-list","#link-list","#preference","#user-list","#plugin-list","#others","#category-list"];this.adTools=["link-list","preference","file-list","page-list","user-list","plugin-list","others","category-list"]};$.extend(Admin.prototype,{logout:function(){window.location.href=latkeConfig.servePath+"/logout?goto="+latkeConfig.servePath},clearTip:function(){$("#tipMsg").text("");$("#loadMsg").text("")},setHashByPage:function(currentPage){var hash=window.location.hash,hashList=hash.split("/");if(/^\d*$/.test(hashList[hashList.length-1])){hashList[hashList.length-1]=currentPage}else{hashList.push(currentPage)}window.location.hash=hashList.join("/")},selectTab:function(id){window.location.hash="#"+id},analyseHash:function(){var hash=window.location.hash;var tag=hash.substr(1,hash.length-1);var tagList=tag.split("/");var tags={};tags.page=1,tags.hashList=[];for(var i=0;i<tagList.length;i++){if(i===tagList.length-1&&(/^\d+$/.test(tagList[i]))){tags.page=tagList[i]}else{tags.hashList.push(tagList[i])}}return tags},setCurByHash:function(){$(window).scrollTop(0);$("#tipMsg").text("");var tags=admin.analyseHash();var tab=tags.hashList[1],subTab=tags.hashList[2];if(tags.hashList.length===1){tab=tags.hashList[0]}if(tab===""){return}if(tab!=="article"){admin.article.clearDraftTimer()}else{if(tab==="article"){admin.article.autoSaveDraftTimer=setInterval(function(){admin.article._autoSaveToDraft()},admin.article.AUTOSAVETIME)}}try{if(tab!=="article"&&admin.article.isConfirm&&admin.editors.articleEditor.getContent().replace(/\s/g,"")!==""&&admin.article.content!==admin.editors.articleEditor.getContent()){if(!confirm(Label.editorLeaveLabel)){window.location.hash="#article/article";return}}if(tab==="article"&&admin.article.isConfirm&&admin.editors.articleEditor.getContent().replace(/\s/g,"")!==""&&admin.article.content!==admin.editors.articleEditor.getContent()){return}}catch(e){var $articleContent=$("#articleContent");if($articleContent.length>0){if(tab!=="article"&&admin.article.isConfirm&&$articleContent.val().replace(/\s/g,"")!==""&&admin.article.content!==$articleContent.val()){if(!confirm(Label.editorLeaveLabel)){window.location.hash="#article/article";return}}if(tab==="article"&&admin.article.isConfirm&&$articleContent.val().replace(/\s/g,"")!==""&&admin.article.content!==$articleContent.val()){return}}}if(tab!=="article"&&admin.editors.articleEditor.setContent){admin.article.clear()}admin.article.isConfirm=true;$("#tabs").tabs("setCurrent",tab);$("#loadMsg").text(Label.loadingLabel);if($("#tabsPanel_"+tab).length===1){if($("#tabsPanel_"+tab).html().replace(/\s/g,"")===""){$("#tabsPanel_"+tab).load("admin-"+tab+".do",function(){if(tab==="article"&&admin.article.status.id){admin.register[tab].init.call(admin.register[tab].obj,admin.article.getAndSet)}else{admin.register[tab].init.call(admin.register[tab].obj,tags.page)}if(subTab){$("#tab"+tab.substring(0,1).toUpperCase()+tab.substring(1)).tabs("setCurrent",subTab)}admin.plugin.setCurByHash(tags)})}else{if(tab==="article"&&admin.article.status.id){admin.article.getAndSet()}if(admin.register[tab]&&admin.register[tab].refresh){admin.register[tab].refresh.call(admin.register[tab].obj,tags.page)}if(subTab){$("#tab"+tab.substring(0,1).toUpperCase()+tab.substring(1)).tabs("setCurrent",subTab)}admin.plugin.setCurByHash(tags)}}else{$("#tipMsg").text("Error: No tab! "+Label.reportIssueLabel);$("#loadMsg").text("")}},init:function(){Util.killIE();$("#loadMsg").text(Label.loadingLabel);$("#tabs").tabs();setInterval(function(){if($("#tipMsg").text()!==""){setTimeout(function(){$("#tipMsg").text("")},7000)}},6000);$("#loadMsg").text("")},collapseNav:function(it){var subNav=$(it).next();subNav.slideToggle("normal",function(){if(this.style.display!=="none"){$(it).find(".icon-chevron-down")[0].className="icon-chevron-up right";$(it).addClass("tab-current")}else{$(it).find(".icon-chevron-up")[0].className="icon-chevron-down right";$(it).removeClass("tab-current")}$("#tabs > ul").height("auto");$("#tabs > ul").height($("#tabs > ul").height()+80)})},inited:function(){if(Label.userRole!=="adminRole"){for(var i=0;i<this.adTools.length;i++){$("#tabs").tabs("remove",this.adTools[i])}}else{for(var j=0;j<this.tools.length;j++){if("#"+window.location.hash.split("/")[1]===this.tools[j]){$("#tabToolsTitle").click();break}}}this.setCurByHash()}});var admin=new Admin();admin.editors={};var SoloEditor=function(conf){this._defaults={type:"tinyMCE",kind:"",id:"",language:""};conf.type=Label.editorType;this.conf=conf;this._init()};$.extend(SoloEditor.prototype,{_init:function(){this.init()},init:function(type){var conf=this.conf;if(type){conf.type=type}var types=conf.type.split("-");if(types.length===2){conf.codeMirrorLanguage=types[1];conf.type=types[0]}admin.editors[conf.type].init(conf)},getContent:function(){var conf=this.conf;return admin.editors[conf.type].getContent(conf.id)},setContent:function(content){var conf=this.conf;admin.editors[conf.type].setContent(conf.id,content)},remove:function(){var conf=this.conf;admin.editors[conf.type].remove(conf.id)}});admin.editors.articleEditor={};admin.editors.abstractEditor={};admin.editors.pageEditor={};admin.editors.tinyMCE={init:function(conf){var language=Label.localeString.substring(0,2);if(language==="zh"){language="zh-cn"}if(conf.kind&&conf.kind==="simple"){try{tinyMCE.init({language:language,mode:"exact",elements:conf.id,theme:"advanced",plugins:"media",theme_advanced_buttons1:"bold,italic,underline,strikethrough,|,undo,redo,|,bullist,numlist,|,code",theme_advanced_buttons2:"",theme_advanced_buttons3:"",theme_advanced_toolbar_location:"top",theme_advanced_toolbar_align:"left",valid_children:"+body[style]"})}catch(e){$("#tipMsg").text("TinyMCE load fail")}}else{try{tinyMCE.init({language:language,mode:"exact",elements:conf.id,theme:"advanced",plugins:"autosave,style,advhr,advimage,advlink,preview,inlinepopups,media,paste,syntaxhl,wordcount",theme_advanced_buttons1:"formatselect,fontselect,fontsizeselect,|,bold,italic,underline,strikethrough,forecolor,|,advhr,blockquote,syntaxhl,",theme_advanced_buttons2:"undo,redo,|,bullist,numlist,outdent,indent,|,justifyleft,justifycenter,justifyright,justifyfull,|,pastetext,pasteword,|,link,unlink,image,iespell,media,|,cleanup,code,preview,",theme_advanced_buttons3:"",theme_advanced_toolbar_location:"top",theme_advanced_toolbar_align:"left",theme_advanced_resizing:true,theme_advanced_statusbar_location:"bottom",extended_valid_elements:"link[type|rel|href|charset],pre[name|class],iframe[src|width|height|name|align],+a[*]",valid_children:"+body[style]",relative_urls:false,remove_script_host:false,oninit:function(){if(typeof(conf.fun)==="function"){conf.fun()}}})}catch(e){$("#tipMsg").text("TinyMCE load fail")}}},getContent:function(id){var content="";try{content=tinyMCE.get(id).getContent()}catch(e){content=$("#"+id).val()}return content},setContent:function(id,content){try{if(tinyMCE.get(id)){tinyMCE.get(id).setContent(content)}else{$("#"+id).val(content)}}catch(e){$("#"+id).val(content)}},remove:function(id){tinyMCE.get(id).remove()}};admin.editors.KindEditor={init:function(conf){var language="zh_CN";if("en_US"===Label.localeString){language="en"}if(conf.kind&&conf.kind==="simple"){try{this[conf.id]=KindEditor.create("#"+conf.id,{langType:language,resizeType:0,items:["bold","italic","underline","strikethrough","|","undo","redo","|","insertunorderedlist","insertorderedlist","|","source"]})}catch(e){$("#tipMsg").text("KindEditor load fail")}}else{try{this[conf.id]=KindEditor.create("#"+conf.id,{uploadJson:"kindeditor/php/upyunUpload.php",langType:language,items:["formatblock","fontname","fontsize","|","bold","italic","underline","strikethrough","forecolor","|","link","unlink","image","media","|","pagebreak","emoticons","code","/","undo","redo","|","insertunorderedlist","insertorderedlist","indent","outdent","|","justifyleft","justifycenter","justifyright","justifyfull","|","plainpaste","wordpaste","|","clearhtml","source","preview"],afterCreate:function(){if(typeof(conf.fun)==="function"){conf.fun()}}})}catch(e){$("#tipMsg").text("KindEditor load fail")}}},getContent:function(id){var content="";try{content=this[id].html()}catch(e){content=$("#"+id).val()}return content},setContent:function(id,content){try{this[id].html(content)}catch(e){$("#"+id).val(content)}},remove:function(id){this[id].remove()}};Util.processClipBoard=function(text,cm){var text=toMarkdown(text,{converters:[],gfm:true});text=$("<div>"+text+"</div>").text().replace(/\n{2,}/g,"\n\n").replace(/ /g," ");return $.trim(text)};Util.startsWith=function(string,prefix){return(string.match("^"+prefix)==prefix)};Util.processClipBoard=function(clipboardData,cm){if(clipboardData.getData("text/html")===""&&clipboardData.items.length===2){return""}var text=toMarkdown(clipboardData.getData("text/html"),{converters:[{filter:"img",replacement:function(innerHTML,node){if(1===node.attributes.length){return""}return"![]("+node.src+")"}}],gfm:true});var codes=text.split("```");if(codes.length>1){for(var i=0,iMax=codes.length;i<iMax;i++){if(i%2===1){codes[i]=codes[i].replace(/<\/span><span style="color:#\w{6};">/g,"").replace(/</g,"&lt;").replace(/>/g,"&gt;")}}}text=codes.join("```");text=$("<div>"+text+"</div>").text().replace(/\n{2,}/g,"\n\n").replace(/ /g," ");return $.trim(text)};Util.initUploadFile=function(obj){var isImg=false;$("#"+obj.id).fileupload({multipart:true,pasteZone:obj.pasteZone,dropZone:obj.pasteZone,url:"https://up.qbox.me/",paramName:"file",add:function(e,data){if(data.files[0].name){var processName=data.files[0].name.match(/[a-zA-Z0-9.]/g).join("");filename=getUUID()+"-"+processName;if(processName.split(".")[0]===""){filename=getUUID()+processName}}else{filename=getUUID()+"."+data.files[0].type.split("/")[1]}if(window.File&&window.FileReader&&window.FileList&&window.Blob){var reader=new FileReader();reader.readAsArrayBuffer(data.files[0]);reader.onload=function(evt){var fileBuf=new Uint8Array(evt.target.result.slice(0,11));isImg=data.files[0].type.indexOf("image")===0?true:false;data.submit()}}else{data.submit()}},formData:function(form){var data=form.serializeArray();data.push({name:"key",value:"file/"+(new Date()).getFullYear()+"/"+((new Date()).getMonth()+1)+"/"+filename});data.push({name:"token",value:obj.qiniuUploadToken});return data},submit:function(e,data){if(obj.editor.replaceRange){var cursor=obj.editor.getCursor();obj.editor.replaceRange(obj.uploadingLabel,cursor,cursor)}else{$("#"+obj.id+" input").prop("disabled",false)}},done:function(e,data){var qiniuKey=data.result.key;if(!qiniuKey){alert("Upload error");return}if(obj.editor.replaceRange){var cursor=obj.editor.getCursor();if(isImg){obj.editor.replaceRange("!["+filename+"]("+obj.qiniuDomain+"/"+qiniuKey+") \n\n",CodeMirror.Pos(cursor.line,cursor.ch-obj.uploadingLabel.length),cursor)}else{obj.editor.replaceRange("["+filename+"]("+obj.qiniuDomain+"/"+qiniuKey+") \n\n",CodeMirror.Pos(cursor.line,cursor.ch-obj.uploadingLabel.length),cursor)}}else{obj.editor.$it.val("!["+filename+"]("+obj.qiniuDomain+"/"+qiniuKey+") \n\n");$("#"+obj.id+" input").prop("disabled",false)}},fail:function(e,data){alert("Upload error: "+data.errorThrown);if(obj.editor.replaceRange){var cursor=obj.editor.getCursor();obj.editor.replaceRange("",CodeMirror.Pos(cursor.line,cursor.ch-obj.uploadingLabel.length),cursor)}else{$("#"+obj.id+" input").prop("disabled",false)}}}).on("fileuploadprocessalways",function(e,data){var currentFile=data.files[data.index];if(data.files.error&&currentFile.error){alert(currentFile.error)}})};admin.editors.CodeMirror={init:function(conf){var emojis="+1,-1,100,1234,8ball,a,ab,abc,abcd,accept,aerial_tramway,airplane,alarm_clock,alien,ambulance,anchor,angel,anger,angry,anguished,ant,apple,aquarius,aries,arrow_backward,arrow_double_down,arrow_double_up,arrow_down,arrow_down_small,arrow_forward,arrow_heading_down,arrow_heading_up,arrow_left,arrow_lower_left,arrow_lower_right,arrow_right,arrow_right_hook,arrow_up,arrow_up_down,arrow_up_small,arrow_upper_left,arrow_upper_right,arrows_clockwise,arrows_counterclockwise,art,articulated_lorry,astonished,atm,b,baby,baby_bottle,baby_chick,baby_symbol,back,baggage_claim,balloon,ballot_box_with_check,bamboo,banana,bangbang,bank,bar_chart,barber,baseball,basketball,bath,bathtub,battery,bear,bee,beer,beers,beetle,beginner,bell,bento,bicyclist,bike,bikini,bird,birthday,black_circle,black_joker,black_medium_small_square,black_medium_square,black_nib,black_small_square,black_square,black_square_button,blossom,blowfish,blue_book,blue_car,blue_heart,blush,boar,boat,bomb,book,bookmark,bookmark_tabs,books,boom,boot,bouquet,bow,bowling,bowtie,boy,bread,bride_with_veil,bridge_at_night,briefcase,broken_heart,bug,bulb,bullettrain_front,bullettrain_side,bus,busstop,bust_in_silhouette,busts_in_silhouette,cactus,cake,calendar,calling,camel,camera,cancer,candy,capital_abcd,capricorn,car,card_index,carousel_horse,cat,cat2,cd,chart,chart_with_downwards_trend,chart_with_upwards_trend,checkered_flag,cherries,cherry_blossom,chestnut,chicken,children_crossing,chocolate_bar,christmas_tree,church,cinema,circus_tent,city_sunrise,city_sunset,cl,clap,clapper,clipboard,clock1,clock10,clock1030,clock11,clock1130,clock12,clock1230,clock130,clock2,clock230,clock3,clock330,clock4,clock430,clock5,clock530,clock6,clock630,clock7,clock730,clock8,clock830,clock9,clock930,closed_book,closed_lock_with_key,closed_umbrella,cloud,clubs,cn,cocktail,coffee,cold_sweat,collision,computer,confetti_ball,confounded,confused,congratulations,construction,construction_worker,convenience_store,cookie,cool,cop,copyright,corn,couple,couple_with_heart,couplekiss,cow,cow2,credit_card,crescent_moon,crocodile,crossed_flags,crown,cry,crying_cat_face,crystal_ball,cupid,curly_loop,currency_exchange,curry,custard,customs,cyclone,dancer,dancers,dango,dart,dash,date,de,deciduous_tree,department_store,diamond_shape_with_a_dot_inside,diamonds,disappointed,disappointed_relieved,dizzy,dizzy_face,do_not_litter,dog,dog2,dollar,dolls,dolphin,donut,door,doughnut,dragon,dragon_face,dress,dromedary_camel,droplet,dvd,e-mail,ear,ear_of_rice,earth_africa,earth_americas,earth_asia,egg,eggplant,eight,eight_pointed_black_star,eight_spoked_asterisk,electric_plug,elephant,email,end,envelope,es,euro,european_castle,european_post_office,evergreen_tree,exclamation,expressionless,eyeglasses,eyes,facepunch,factory,fallen_leaf,family,fast_forward,fax,fearful,feelsgood,feet,ferris_wheel,file_folder,finnadie,fire,fire_engine,fireworks,first_quarter_moon,first_quarter_moon_with_face,fish,fish_cake,fishing_pole_and_fish,fist,five,flags,flashlight,floppy_disk,flower_playing_cards,flushed,foggy,football,fork_and_knife,fountain,four,four_leaf_clover,fr,free,fried_shrimp,fries,frog,frowning,fu,fuelpump,full_moon,full_moon_with_face,game_die,gb,gem,gemini,ghost,gift,gift_heart,girl,globe_with_meridians,goat,goberserk,godmode,golf,grapes,green_apple,green_book,green_heart,grey_exclamation,grey_question,grimacing,grin,grinning,guardsman,guitar,gun,haircut,hamburger,hammer,hamster,hand,handbag,hankey,hash,hatched_chick,hatching_chick,headphones,hear_no_evil,heart,heart_decoration,heart_eyes,heart_eyes_cat,heartbeat,heartpulse,hearts,heavy_check_mark,heavy_division_sign,heavy_dollar_sign,heavy_exclamation_mark,heavy_minus_sign,heavy_multiplication_x,heavy_plus_sign,helicopter,herb,hibiscus,high_brightness,high_heel,hocho,honey_pot,honeybee,horse,horse_racing,hospital,hotel,hotsprings,hourglass,hourglass_flowing_sand,house,house_with_garden,hurtrealbad,hushed,ice_cream,icecream,id,ideograph_advantage,imp,inbox_tray,incoming_envelope,information_desk_person,information_source,innocent,interrobang,iphone,it,izakaya_lantern,jack_o_lantern,japan,japanese_castle,japanese_goblin,japanese_ogre,jeans,joy,joy_cat,jp,key,keycap_ten,kimono,kiss,kissing,kissing_cat,kissing_closed_eyes,kissing_face,kissing_heart,kissing_smiling_eyes,koala,koko,kr,large_blue_circle,large_blue_diamond,large_orange_diamond,last_quarter_moon,last_quarter_moon_with_face,laughing,leaves,ledger,left_luggage,left_right_arrow,leftwards_arrow_with_hook,lemon,leo,leopard,libra,light_rail,link,lips,lipstick,lock,lock_with_ink_pen,lollipop,loop,loudspeaker,love_hotel,love_letter,low_brightness,m,mag,mag_right,mahjong,mailbox,mailbox_closed,mailbox_with_mail,mailbox_with_no_mail,man,man_with_gua_pi_mao,man_with_turban,mans_shoe,maple_leaf,mask,massage,meat_on_bone,mega,melon,memo,mens,metal,metro,microphone,microscope,milky_way,minibus,minidisc,mobile_phone_off,money_with_wings,moneybag,monkey,monkey_face,monorail,mortar_board,mount_fuji,mountain_bicyclist,mountain_cableway,mountain_railway,mouse,mouse2,movie_camera,moyai,muscle,mushroom,musical_keyboard,musical_note,musical_score,mute,nail_care,name_badge,neckbeard,necktie,negative_squared_cross_mark,neutral_face,new,new_moon,new_moon_with_face,newspaper,ng,nine,no_bell,no_bicycles,no_entry,no_entry_sign,no_good,no_mobile_phones,no_mouth,no_pedestrians,no_smoking,non-potable_water,nose,notebook,notebook_with_decorative_cover,notes,nut_and_bolt,o,o2,ocean,octocat,octopus,oden,office,ok,ok_hand,ok_woman,older_man,older_woman,on,oncoming_automobile,oncoming_bus,oncoming_police_car,oncoming_taxi,one,open_file_folder,open_hands,open_mouth,ophiuchus,orange_book,outbox_tray,ox,package,page_facing_up,page_with_curl,pager,palm_tree,panda_face,paperclip,parking,part_alternation_mark,partly_sunny,passport_control,paw_prints,peach,pear,pencil,pencil2,penguin,pensive,performing_arts,persevere,person_frowning,person_with_blond_hair,person_with_pouting_face,phone,pig,pig2,pig_nose,pill,pineapple,pisces,pizza,plus1,point_down,point_left,point_right,point_up,point_up_2,police_car,poodle,poop,post_office,postal_horn,postbox,potable_water,pouch,poultry_leg,pound,pouting_cat,pray,princess,punch,purple_heart,purse,pushpin,put_litter_in_its_place,question,rabbit,rabbit2,racehorse,radio,radio_button,rage,rage1,rage2,rage3,rage4,railway_car,rainbow,raised_hand,raised_hands,raising_hand,ram,ramen,rat,recycle,red_car,red_circle,registered,relaxed,relieved,repeat,repeat_one,restroom,revolving_hearts,rewind,ribbon,rice,rice_ball,rice_cracker,rice_scene,ring,rocket,roller_coaster,rooster,rose,rotating_light,round_pushpin,rowboat,ru,rugby_football,runner,running,running_shirt_with_sash,sa,sagittarius,sailboat,sake,sandal,santa,satellite,satisfied,saxophone,school,school_satchel,scissors,scorpius,scream,scream_cat,scroll,seat,secret,see_no_evil,seedling,seven,shaved_ice,sheep,shell,ship,shipit,shirt,shit,shoe,shower,signal_strength,six,six_pointed_star,ski,skull,sleeping,sleepy,slot_machine,small_blue_diamond,small_orange_diamond,small_red_triangle,small_red_triangle_down,smile,smile_cat,smiley,smiley_cat,smiling_imp,smirk,smirk_cat,smoking,snail,snake,snowboarder,snowflake,snowman,sob,soccer,soon,sos,sound,space_invader,spades,spaghetti,sparkle,sparkler,sparkles,sparkling_heart,speak_no_evil,speaker,speech_balloon,speedboat,squirrel,star,star2,stars,station,statue_of_liberty,steam_locomotive,stew,straight_ruler,strawberry,stuck_out_tongue,stuck_out_tongue_closed_eyes,stuck_out_tongue_winking_eye,sun_with_face,sunflower,sunglasses,sunny,sunrise,sunrise_over_mountains,surfer,sushi,suspect,suspension_railway,sweat,sweat_drops,sweat_smile,sweet_potato,swimmer,symbols,syringe,tada,tanabata_tree,tangerine,taurus,taxi,tea,telephone,telephone_receiver,telescope,tennis,tent,thought_balloon,three,thumbsdown,thumbsup,ticket,tiger,tiger2,tired_face,tm,toilet,tokyo_tower,tomato,tongue,top,tophat,tractor,traffic_light,train,train2,tram,triangular_flag_on_post,triangular_ruler,trident,triumph,trolleybus,trollface,trophy,tropical_drink,tropical_fish,truck,trumpet,tshirt,tulip,turtle,tv,twisted_rightwards_arrows,two,two_hearts,two_men_holding_hands,two_women_holding_hands,u5272,u5408,u55b6,u6307,u6708,u6709,u6e80,u7121,u7533,u7981,u7a7a,uk,umbrella,unamused,underage,unlock,up,us,v,vertical_traffic_light,vhs,vibration_mode,video_camera,video_game,violin,virgo,volcano,vs,walking,waning_crescent_moon,waning_gibbous_moon,warning,watch,water_buffalo,watermelon,wave,wavy_dash,waxing_crescent_moon,waxing_gibbous_moon,wc,weary,wedding,whale,whale2,wheelchair,white_check_mark,white_circle,white_flower,white_large_square,white_medium_small_square,white_medium_square,white_small_square,white_square_button,wind_chime,wine_glass,wink,wolf,woman,womans_clothes,womans_hat,womens,worried,wrench,x,yellow_heart,yen,yum,zap,zero,zzz".split(",");CodeMirror.registerHelper("hint","emoji",function(cm){var word=/[\w$]+/;var cur=cm.getCursor(),curLine=cm.getLine(cur.line);var start=cur.ch,end=start;while(end<curLine.length&&word.test(curLine.charAt(end))){++end}while(start&&word.test(curLine.charAt(start-1))){--start}var tok=cm.getTokenAt(cur);var autocompleteHints=[];var input=tok.string.trim();var matchCnt=0;for(var i=0;i<emojis.length;i++){var displayText=emojis[i];var text=emojis[i];if(Util.startsWith(text,input)){autocompleteHints.push({displayText:'<span style="font-size: 1rem;line-height:22px"><img style="width: 1rem;margin:3px 0;float:left" src="'+latkeConfig.servePath+"/js/lib/emojify.js-1.1.0/images/basic/"+text+'.png"> '+displayText.toString()+"</span>",text:":"+text+": "});matchCnt++}if(matchCnt>10){break}}return{list:autocompleteHints,from:CodeMirror.Pos(cur.line,start),to:CodeMirror.Pos(cur.line,end)}});CodeMirror.commands.autocompleteEmoji=function(cm){cm.showHint({hint:CodeMirror.hint.emoji,completeSingle:false});return CodeMirror.Pass};var commentEditor=new Editor({element:document.getElementById(conf.id),dragDrop:false,lineWrapping:true,status:false,htmlURL:latkeConfig.servePath+"/console/markdown/2html",toolbar:[{name:"bold"},{name:"italic"},{name:"quote"},{name:"link"},{name:"unordered-list"},{name:"ordered-list"},{name:"image",html:'<span style="display: inline-block;top:1px" class="tooltipped tooltipped-n" aria-label="'+Label.uploadFilesLabel+'" ><form id="'+conf.id+'fileUpload" method="POST" enctype="multipart/form-data"><label class="icon-upload"><input type="file"/></label></form></span>'},{name:"redo"},{name:"undo"},{name:"preview"},{name:"fullscreen"}],extraKeys:{"Cmd-/":"autocompleteEmoji","Ctrl-/":"autocompleteEmoji"}});commentEditor.render();Util.initUploadFile({id:conf.id+"fileUpload",pasteZone:$("#"+conf.id).next().next(),qiniuUploadToken:qiniu.qiniuUploadToken,editor:commentEditor.codemirror,uploadingLabel:"uploading...",qiniuDomain:"//"+qiniu.qiniuDomain});this[conf.id]=commentEditor.codemirror;this[conf.id].on("changes",function(cm){if($("#"+conf.id).parent().find(".CodeMirror-preview").length===0){return false}$.ajax({url:latkeConfig.servePath+"/console/markdown/2html",type:"POST",cache:false,data:{markdownText:cm.getValue()},success:function(result,textStatus){$("#"+conf.id).parent().find(".CodeMirror-preview").html(result.html);hljs.initHighlighting.called=false;hljs.initHighlighting()}})});if(typeof(conf.fun)==="function"){conf.fun()}},getContent:function(id){return this[id].getValue()},setContent:function(id,content){this[id].setValue(content);var $preview=$("#"+id).parent().find(".markdown-preivew");$preview.find(".markdown-preview-main").html(content)},remove:function(id){this[id].toTextArea();$(".editor-toolbar").remove()}};var TablePaginate=function(id){this.id=id;this.currentPage=1};$.extend(TablePaginate.prototype,{buildTable:function(colModel,noExpend){var tableData={colModel:colModel,noDataTip:Label.noDataLabel};if(!noExpend){tableData.expendRow={index:"expendRow"}}$("#"+this.id+"Table").table(tableData)},initPagination:function(){var id=this.id;$("#"+id+"Pagination").paginate({bind:function(currentPage,errorMessage){if(errorMessage){$("#tipMsg").text(errorMessage)}else{admin.setHashByPage(currentPage)}},currentPage:1,errorMessage:Label.inputErrorLabel,nextPageText:">",previousPageText:"<",goText:Label.gotoLabel,type:"custom",custom:[1],pageCount:1})},initCommentsDialog:function(){var that=this;$("#"+this.id+"Comments").dialog({modal:true,hideFooter:true,close:function(){admin[that.id+"List"].getList(that.currentPage);return true}})},updateTablePagination:function(data,currentPage,pageInfo){currentPage=parseInt(currentPage);if(currentPage>pageInfo.paginationPageCount&&currentPage>1){$("#tipMsg").text(Label.pageLabel+currentPage+Label.notFoundLabel);$("#loadMsg").text("");return}$("#"+this.id+"Table").table("update",{data:[{groupName:"all",groupData:data}]});if(pageInfo.paginationPageCount===0){pageInfo.paginationPageCount=1}$("#"+this.id+"Pagination").paginate("update",{pageCount:pageInfo.paginationPageCount,currentPage:currentPage,custom:pageInfo.paginationPageNums});this.currentPage=currentPage}});admin.article={currentEditorType:"",isConfirm:true,status:{id:undefined,isArticle:undefined,articleHadBeenPublished:undefined},content:"",autoSaveDraftTimer:"",AUTOSAVETIME:1000*60,initUploadFile:function(id){var filename="";$("#"+id).fileupload({multipart:true,url:"https://up.qbox.me",add:function(e,data){filename=data.files[0].name;data.submit();$("#"+id+" span").text("uploading...")},formData:function(form){var data=form.serializeArray();var ext=filename.substring(filename.lastIndexOf(".")+1);data.push({name:"key",value:getUUID()+"."+ext});data.push({name:"token",value:qiniu.qiniuUploadToken});return data},done:function(e,data){$("#"+id+" span").text("");var qiniuKey=data.result.key;if(!qiniuKey){alert("Upload error, please check Qiniu configurations");return}$("#"+id).after("<div>!["+data.files[0].name+"](http://"+qiniu.qiniuDomain+qiniuKey+")</div>")},fail:function(e,data){$("#"+id+" span").text("Upload error, please check Qiniu configurations ["+data.errorThrown+"]")}}).on("fileuploadprocessalways",function(e,data){var currentFile=data.files[data.index];if(data.files.error&&currentFile.error){alert(currentFile.error)}})},get:function(id,isArticle){this.status.id=id;this.status.isArticle=isArticle;admin.selectTab("article/article")},getAndSet:function(){$("#loadMsg").text(Label.loadingLabel);$("#tipMsg").text("");$.ajax({url:latkeConfig.servePath+"/console/article/"+admin.article.status.id,type:"GET",cache:false,success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}$("#title").val(result.article.articleTitle);admin.article.status.articleHadBeenPublished=result.article.articleHadBeenPublished;if(admin.article.currentEditorType!==result.article.articleEditorType){admin.editors.articleEditor.remove();admin.editors.abstractEditor.remove();admin.article.currentEditorType=result.article.articleEditorType;admin.editors.articleEditor.init(result.article.articleEditorType);admin.editors.abstractEditor.init(result.article.articleEditorType)}admin.editors.articleEditor.setContent(result.article.articleContent);admin.editors.abstractEditor.setContent(result.article.articleAbstract);admin.article.content=admin.editors.articleEditor.getContent();var tags=result.article.articleTags,tagsString="";for(var i=0;i<tags.length;i++){if(0===i){tagsString=tags[i].tagTitle}else{tagsString+=","+tags[i].tagTitle}}$("#tag").val(tagsString);$("#permalink").val(result.article.articlePermalink);$("#viewPwd").val(result.article.articleViewPwd);$("#articleCommentable").prop("checked",result.article.articleCommentable);var signs=result.article.signs;$(".signs button").each(function(i){if(parseInt(result.article.articleSignId)===parseInt(signs[i].oId)){$("#articleSign"+signs[i].oId).addClass("selected")}else{$("#articleSign"+signs[i].oId).removeClass("selected")}});admin.article.setStatus();$("#loadMsg").text("")}})},del:function(id,fromId,title){var isDelete=confirm(Label.confirmRemoveLabel+Label.articleLabel+'"'+title+'"?');if(isDelete){$("#loadMsg").text(Label.loadingLabel);$("#tipMsg").text("");$.ajax({url:latkeConfig.servePath+"/console/article/"+id,type:"DELETE",cache:false,success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}admin[fromId+"List"].getList(1)}})}},add:function(articleIsPublished,isAuto){if(admin.article.validate()){var that=this;that._addDisabled();$("#loadMsg").text(Label.loadingLabel);$("#tipMsg").text("");var signId="";$(".signs button").each(function(){if(this.className==="selected"){signId=this.id.substr(this.id.length-1,1)}});var articleContent=admin.editors.articleEditor.getContent(),articleAbstract=admin.editors.abstractEditor.getContent();var requestJSONObject={article:{articleTitle:$("#title").val(),articleContent:articleContent,articleAbstract:articleAbstract,articleTags:this.trimUniqueArray($("#tag").val()).toString(),articlePermalink:$("#permalink").val(),articleIsPublished:articleIsPublished,articleSignId:signId,postToCommunity:$("#postToCommunity").prop("checked"),articleCommentable:$("#articleCommentable").prop("checked"),articleViewPwd:$("#viewPwd").val()}};$.ajax({url:latkeConfig.servePath+"/console/article/",type:"POST",cache:false,data:JSON.stringify(requestJSONObject),success:function(result,textStatus){if(isAuto){$("#tipMsg").text(Label.autoSaveLabel);admin.article.status.id=result.oId;return}$("#tipMsg").text(result.msg);if(!result.sc){return}if(articleIsPublished){admin.article.status.id=undefined;admin.selectTab("article/article-list")}else{admin.selectTab("article/draft-list")}admin.article.isConfirm=false},complete:function(jqXHR,textStatus){that._removeDisabled();$("#loadMsg").text("");if(jqXHR.status===403){$.get("/admin-index.do");that.add(articleIsPublished)}}})}},update:function(articleIsPublished,isAuto){if(admin.article.validate()){var that=this;that._addDisabled();$("#loadMsg").text(Label.loadingLabel);$("#tipMsg").text("");var signId="";$(".signs button").each(function(){if(this.className==="selected"){signId=this.id.substr(this.id.length-1,1)}});var articleContent=admin.editors.articleEditor.getContent(),articleAbstract=admin.editors.abstractEditor.getContent();var requestJSONObject={article:{oId:this.status.id,articleTitle:$("#title").val(),articleContent:articleContent,articleAbstract:articleAbstract,articleTags:this.trimUniqueArray($("#tag").val()).toString(),articlePermalink:$("#permalink").val(),articleIsPublished:articleIsPublished,articleSignId:signId,articleCommentable:$("#articleCommentable").prop("checked"),articleViewPwd:$("#viewPwd").val(),postToCommunity:$("#postToCommunity").prop("checked"),articleEditorType:admin.article.currentEditorType}};$.ajax({url:latkeConfig.servePath+"/console/article/",type:"PUT",cache:false,data:JSON.stringify(requestJSONObject),success:function(result,textStatus){if(isAuto){$("#tipMsg").text(Label.autoSaveLabel);return}$("#tipMsg").text(result.msg);if(!result.sc){return}if(articleIsPublished){admin.selectTab("article/article-list")}else{admin.selectTab("article/draft-list")}$("#tipMsg").text(Label.updateSuccLabel);admin.article.status.id=undefined;admin.article.isConfirm=false},complete:function(jqXHR,textStatus){that._removeDisabled();$("#loadMsg").text("");if(jqXHR.status===403){$.get("/admin-index.do");that.update(articleIsPublished)}}})}},setStatus:function(){$.ajax({url:latkeConfig.servePath+"/console/tags",type:"GET",cache:false,success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}if(0>=result.tags.length){return}$("#tagCheckboxPanel>span").remove("");var spans="";for(var i=0;i<result.tags.length;i++){spans+="<span>"+result.tags[i].tagTitle+"</span>"}$("#tagCheckboxPanel").html(spans+'<div class="clear"></div>');$("#loadMsg").text("")}});if(this.status){if(this.status.isArticle){$("#unSubmitArticle").show();$("#saveArticle").hide();$("#submitArticle").show()}else{$("#submitArticle").show();$("#unSubmitArticle").hide();$("#saveArticle").show()}if(this.status.articleHadBeenPublished){$("#postToCommunityPanel").hide()}else{}}else{$("#submitArticle").show();$("#unSubmitArticle").hide();$("#saveArticle").show()}$("#postToCommunity").attr("checked","checked")},clear:function(){this.status={id:undefined,isArticle:undefined,articleHadBeenPublished:undefined};this.setStatus();$("#title").val("");admin.editors.articleEditor.setContent("");admin.editors.abstractEditor.setContent("");$("#tag").val("");$("#tagCheckboxPanel").hide().find("span").removeClass("selected");$("#permalink").val("");$("#articleCammentable").prop("checked",true);$("#postToCommunity").prop("checked",true);$(".signs button").each(function(i){if(i===0){this.className="selected"}else{this.className=""}});$(".editor-preview-active").html("").removeClass("editor-preview-active");$("#uploadContent").remove()},init:function(fun){this.currentEditorType=Label.editorType;$(".signs button").click(function(i){$(".signs button").removeClass("selected");$(this).addClass("selected")});$.ajax({url:latkeConfig.servePath+"/console/tags",type:"GET",cache:false,success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}if(0>=result.tags.length){return}var tags=[];for(var i=0;i<result.tags.length;i++){tags.push(result.tags[i].tagTitle)}$("#tag").completed({height:160,buttonText:Label.selectLabel,data:tags}).width($("#tag").parent().width()-68);$("#loadMsg").text("")}});$("#submitArticle").click(function(){if(admin.article.status.id){admin.article.update(true)}else{admin.article.add(true)}});$("#saveArticle").click(function(){if(admin.article.status.id){admin.article.update(admin.article.status.isArticle)}else{admin.article.add(false)}});this.initUploadFile("articleUpload");admin.editors.articleEditor=new SoloEditor({id:"articleContent",kind:"all",fun:fun,height:500});admin.editors.abstractEditor=new SoloEditor({id:"abstract",kind:"simple",height:200});admin.article.clearDraftTimer();admin.article.autoSaveDraftTimer=setInterval(function(){admin.article._autoSaveToDraft()},admin.article.AUTOSAVETIME)},_autoSaveToDraft:function(){if($("#title").val().replace(/\s/g,"")===""||admin.editors.articleEditor.getContent().replace(/\s/g,"")===""||$("#tag").val().replace(/\s/g,"")===""){return}if(admin.article.status.id){if(!admin.article.status.isArticle){admin.article.update(false,true)}}else{admin.article.add(false,true);admin.article.status.isArticle=false}},clearDraftTimer:function(){if(admin.article.autoSaveDraftTimer!==""){window.clearInterval(admin.article.autoSaveDraftTimer);admin.article.autoSaveDraftTimer=""}},validate:function(){var articleContent=admin.editors.articleEditor.getContent();if($("#title").val().replace(/\s/g,"")===""){$("#tipMsg").text(Label.titleEmptyLabel);$("#title").focus().val("")}else{if(articleContent.replace(/\s/g,"")===""){$("#tipMsg").text(Label.contentEmptyLabel)}else{if($("#tag").val().replace(/\s/g,"")===""){$("#tipMsg").text(Label.tagsEmptyLabel);$("#tag").focus().val("")}else{return true}}}return false},unPublish:function(isAuto){var that=this;that._addDisabled();$.ajax({url:latkeConfig.servePath+"/console/article/unpublish/"+admin.article.status.id,type:"PUT",cache:false,success:function(result,textStatus){if(isAuto){$("#tipMsg").text(Label.autoSaveLabel);return}$("#tipMsg").text(result.msg);if(!result.sc){return}admin.selectTab("article/draft-list");admin.article.status.id=undefined;admin.article.isConfirm=false},complete:function(jqXHR,textStatus){that._removeDisabled();$("#loadMsg").text("");if(jqXHR.status===403){$.get("/admin-index.do");that.unPublish()}}})},trimUniqueArray:function(str){str=str.toString();var arr=str.split(",");for(var i=0;i<arr.length;i++){arr[i]=arr[i].replace(/(^\s*)|(\s*$)/g,"");if(arr[i]===""){arr.splice(i,1);i--}}var unique=$.unique(arr);return unique.toString()},prePost:function(){$("#loadMsg").text(Label.loadingLabel);admin.article.content="";if(!admin.editors.articleEditor.getContent){return}var articleContent=admin.editors.articleEditor.getContent();if(window.location.hash==="#article/article"&&articleContent.replace(/\s/g,"")!==""){if(confirm(Label.editorPostLabel)){admin.article.clear()}}$("#tipMsg").text("");$("#loadMsg").text("");if(admin.article.currentEditorType!==Label.editorType){admin.editors.articleEditor.remove();admin.editors.abstractEditor.remove();admin.article.currentEditorType=Label.editorType;admin.editors.articleEditor.init(Label.editorType);admin.editors.abstractEditor.init(Label.editorType)}},_addDisabled:function(){$("#unSubmitArticle").attr("disabled","disabled");$("#saveArticle").attr("disabled","disabled");$("#submitArticle").attr("disabled","disabled")},_removeDisabled:function(){$("#unSubmitArticle").removeAttr("disabled");$("#saveArticle").removeAttr("disabled");$("#submitArticle").removeAttr("disabled")}};admin.register.article={obj:admin.article,init:admin.article.init,refresh:function(){admin.editors.abstractEditor.setContent("");admin.editors.articleEditor.setContent("");$("#loadMsg").text("");$("#tipMsg").text("")}};function getUUID(){var d=new Date().getTime();var ret="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(c){var r=(d+Math.random()*16)%16|0;d=Math.floor(d/16);return(c=="x"?r:(r&3|8)).toString(16)});ret=ret.replace(new RegExp("-","g"),"");return ret}admin.comment={open:function(id,fromId){this.getList(id,fromId);$("#"+fromId+"Comments").dialog("open")},getList:function(onId,fromId){$("#loadMsg").text(Label.loadingLabel);$("#tipMsg").text("");$("#"+fromId+"Comments").html("");var from="article";if(fromId==="page"){from="page"}$.ajax({url:latkeConfig.servePath+"/console/comments/"+from+"/"+onId,type:"GET",cache:false,success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}var comments=result.comments,commentsHTML="";for(var i=0;i<comments.length;i++){var hrefHTML="<a target='_blank' href='"+comments[i].commentURL+"'>",content=comments[i].commentContent,contentHTML=Util.replaceEmString(content);if(comments[i].commentURL==="http://"){hrefHTML="<a target='_blank'>"}commentsHTML+="<div class='comment-title'><span class='left'>"+hrefHTML+comments[i].commentName+"</a>";if(comments[i].commentOriginalCommentName){commentsHTML+="@"+comments[i].commentOriginalCommentName}commentsHTML+="</span><span title='"+Label.removeLabel+"' class='right deleteIcon' onclick=\"admin.comment.del('"+comments[i].oId+"', '"+fromId+"', '"+onId+"')\"></span><span class='right'><a href='mailto:"+comments[i].commentEmail+"'>"+comments[i].commentEmail+"</a>&nbsp;&nbsp;"+$.bowknot.getDate(comments[i].commentTime)+"&nbsp;</span><div class='clear'></div></div><div class='margin12'>"+contentHTML+"</div>"}if(""===commentsHTML){commentsHTML=Label.noCommentLabel}$("#"+fromId+"Comments").html(commentsHTML);$("#loadMsg").text("")}})},del:function(id,fromId,articleId){var isDelete=confirm(Label.confirmRemoveLabel+Label.commentLabel+"?");if(isDelete){$("#loadMsg").text(Label.loadingLabel);var from="article";if(fromId==="page"){from="page"}$.ajax({url:latkeConfig.servePath+"/console/"+from+"/comment/"+id,type:"DELETE",cache:false,success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}admin.comment.getList(articleId,fromId);$("#loadMsg").text("")}})}}};admin.articleList={tablePagination:new TablePaginate("article"),init:function(page){this.tablePagination.buildTable([{text:Label.titleLabel,index:"title",minWidth:110,style:"padding-left: 12px;font-size:14px;"},{text:Label.authorLabel,index:"author",width:150,style:"padding-left: 12px;"},{text:Label.commentLabel,index:"comments",width:80,style:"padding-left: 12px;"},{text:Label.viewLabel,width:60,index:"articleViewCount",style:"padding-left: 12px;"},{text:Label.createDateLabel,index:"date",width:90,style:"padding-left: 12px;"}]);this.tablePagination.initPagination();this.tablePagination.initCommentsDialog();this.getList(page)},getList:function(pageNum){var that=this;$("#loadMsg").text(Label.loadingLabel);$.ajax({url:latkeConfig.servePath+"/console/articles/status/published/"+pageNum+"/"+Label.PAGE_SIZE+"/"+Label.WINDOW_SIZE,type:"GET",cache:false,success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}var articles=result.articles,articleData=[];for(var i=0;i<articles.length;i++){articleData[i]={};articleData[i].title='<a href="'+latkeConfig.servePath+articles[i].articlePermalink+"\" target='_blank' title='"+articles[i].articleTitle+"' class='no-underline'>"+articles[i].articleTitle+"</a><span class='table-tag'>"+articles[i].articleTags+"</span>";articleData[i].date=$.bowknot.getDate(articles[i].articleCreateTime);articleData[i].comments=articles[i].articleCommentCount;articleData[i].articleViewCount=articles[i].articleViewCount;articleData[i].author=articles[i].authorName;var topClass=articles[i].articlePutTop?Label.cancelPutTopLabel:Label.putTopLabel;articleData[i].expendRow="<a target='_blank' href='"+latkeConfig.servePath+articles[i].articlePermalink+"'>"+Label.viewLabel+"</a> <a href='javascript:void(0)' onclick=\"admin.article.get('"+articles[i].oId+"', true)\">"+Label.updateLabel+"</a> <a href='javascript:void(0)' onclick=\"admin.article.del('"+articles[i].oId+"', 'article', '"+articles[i].articleTitle+"')\">"+Label.removeLabel+"</a> <a href='javascript:void(0)' onclick=\"admin.articleList.popTop(this, '"+articles[i].oId+"')\">"+topClass+"</a> <a href='javascript:void(0)' onclick=\"admin.comment.open('"+articles[i].oId+"', 'article')\">"+Label.commentLabel+"</a>"}that.tablePagination.updateTablePagination(articleData,pageNum,result.pagination);$("#loadMsg").text("")}})},popTop:function(it,id){$("#loadMsg").text(Label.loadingLabel);$("#tipMsg").text("");var $it=$(it),ajaxUrl="canceltop",tip=Label.putTopLabel;if($it.html()===Label.putTopLabel){ajaxUrl="puttop";tip=Label.cancelPutTopLabel}$.ajax({url:latkeConfig.servePath+"/console/article/"+ajaxUrl+"/"+id,type:"PUT",cache:false,success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}$it.html(tip);$("#loadMsg").text("")}})}};admin.register["article-list"]={obj:admin.articleList,init:admin.articleList.init,refresh:admin.articleList.getList};admin.draftList={tablePagination:new TablePaginate("draft"),init:function(page){this.tablePagination.buildTable([{text:Label.titleLabel,index:"title",minWidth:110,style:"padding-left: 12px;font-size:14px;"},{text:Label.authorLabel,index:"author",width:150,style:"padding-left: 12px;"},{text:Label.commentLabel,index:"comments",width:80,style:"padding-left: 12px;"},{text:Label.viewLabel,width:60,index:"articleViewCount",style:"padding-left: 12px;"},{text:Label.createDateLabel,index:"date",width:90,style:"padding-left: 12px;"}]);this.tablePagination.initPagination();this.tablePagination.initCommentsDialog();this.getList(page)},getList:function(pageNum){$("#loadMsg").text(Label.loadingLabel);var that=this;$.ajax({url:latkeConfig.servePath+"/console/articles/status/unpublished/"+pageNum+"/"+Label.PAGE_SIZE+"/"+Label.WINDOW_SIZE,type:"GET",cache:false,success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}var articles=result.articles,articleData=[];for(var i=0;i<articles.length;i++){articleData[i]={};articleData[i].tags=articles[i].articleTags;articleData[i].date=$.bowknot.getDate(articles[i].articleCreateTime);articleData[i].comments=articles[i].articleCommentCount;articleData[i].articleViewCount=articles[i].articleViewCount;articleData[i].author=articles[i].authorName;articleData[i].title="<a class='no-underline' href='"+latkeConfig.servePath+articles[i].articlePermalink+"' target='_blank'>"+articles[i].articleTitle+"</a><span class='table-tag'>"+articles[i].articleTags+"</span>";articleData[i].expendRow="<a href='javascript:void(0)' onclick=\"admin.article.get('"+articles[i].oId+"', false);\">"+Label.updateLabel+"</a> <a href='javascript:void(0)' onclick=\"admin.article.del('"+articles[i].oId+"', 'draft', '"+articles[i].articleTitle+"')\">"+Label.removeLabel+"</a> <a href='javascript:void(0)' onclick=\"admin.comment.open('"+articles[i].oId+"', 'draft')\">"+Label.commentLabel+"</a>"}that.tablePagination.updateTablePagination(articleData,pageNum,result.pagination);$("#loadMsg").text("")}})}};admin.register["draft-list"]={obj:admin.draftList,init:admin.draftList.init,refresh:admin.draftList.getList};admin.pageList={currentEditorType:"",tablePagination:new TablePaginate("page"),pageInfo:{currentCount:1,pageCount:1,currentPage:1},id:"",type:"link",init:function(page){this.tablePagination.buildTable([{text:"",index:"pageOrder",width:60,style:"padding-left: 12px;font-size:14px;"},{style:"padding-left: 12px;",text:Label.titleLabel,index:"pageTitle",width:300},{style:"padding-left: 12px;",text:Label.permalinkLabel,index:"pagePermalink",minWidth:300},{style:"padding-left: 12px;",text:Label.openMethodLabel,index:"pageTarget",width:120},{style:"padding-left: 12px;",text:Label.typeLabel,index:"pageType",width:80},{text:Label.commentLabel,index:"comments",width:80,style:"padding-left: 12px;"}]);this.tablePagination.initPagination();this.tablePagination.initCommentsDialog();this.getList(page);var language=Label.localeString.substring(0,2);if(language==="zh"){language="zh-cn"}admin.pageList.currentEditorType=Label.editorType;admin.editors.pageEditor=new SoloEditor({language:language,kind:"all",id:"pageContent"});$(".fn-type").click(function(){var $it=$(this);if($it.hasClass("selected")){return}$(".fn-type").removeClass("selected");$it.addClass("selected");admin.pageList.type=$it.data("type");if(admin.pageList.type==="page"){$("#pagePagePanel").slideDown();if(Label.editorType==="CodeMirror-Markdown"&&admin.editors.pageEditor.getContent()===""){admin.editors.pageEditor.setContent("")}}else{$("#pagePagePanel").slideUp()}})},getList:function(pageNum){$("#loadMsg").text(Label.loadingLabel);$("#tipMsg").text("");var that=this;$.ajax({url:latkeConfig.servePath+"/console/pages/"+pageNum+"/"+Label.PAGE_SIZE+"/"+Label.WINDOW_SIZE,type:"GET",cache:false,success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}var pages=result.pages;var pageData=[];admin.pageList.pageInfo.currentCount=pages.length;admin.pageList.pageInfo.pageCount=result.pagination.paginationPageCount===0?1:result.pagination.paginationPageCount;for(var i=0;i<pages.length;i++){pageData[i]={};if(i===0){if(pages.length===1){pageData[i].pageOrder=""}else{pageData[i].pageOrder='<div class="table-center" style="width:14px"> <span onclick="admin.pageList.changeOrder('+pages[i].oId+", "+i+', \'down\');" class="icon-move-down"></span></div>'}}else{if(i===pages.length-1){pageData[i].pageOrder='<div class="table-center" style="width:14px"> <span onclick="admin.pageList.changeOrder('+pages[i].oId+", "+i+', \'up\');" class="icon-move-up"></span> </div>'}else{pageData[i].pageOrder='<div class="table-center" style="width:38px"> <span onclick="admin.pageList.changeOrder('+pages[i].oId+", "+i+', \'up\');" class="icon-move-up"></span> <span onclick="admin.pageList.changeOrder('+pages[i].oId+", "+i+', \'down\');" class="icon-move-down"></span> </div>'}}pageData[i].pageTitle="<a class='no-underline' href='"+pages[i].pagePermalink+"' target='_blank'>"+pages[i].pageTitle+"</a>";pageData[i].pagePermalink="<a class='no-underline' href='"+pages[i].pagePermalink+"' target='_blank'>"+pages[i].pagePermalink+"</a>";pageData[i].pageTarget=pages[i].pageOpenTarget;pageData[i].pageType=pages[i].pageType;pageData[i].comments=pages[i].pageCommentCount;pageData[i].expendRow="<span><a href='"+pages[i].pagePermalink+"' target='_blank'>"+Label.viewLabel+"</a> <a href='javascript:void(0)' onclick=\"admin.pageList.get('"+pages[i].oId+"')\">"+Label.updateLabel+"</a> <a href='javascript:void(0)' onclick=\"admin.pageList.del('"+pages[i].oId+"', '"+pages[i].pageTitle+"')\">"+Label.removeLabel+"</a> <a href='javascript:void(0)' onclick=\"admin.comment.open('"+pages[i].oId+"', 'page')\">"+Label.commentLabel+"</a></span>"}that.tablePagination.updateTablePagination(pageData,pageNum,result.pagination);$("#loadMsg").text("")}})},get:function(id){$("#loadMsg").text(Label.loadingLabel);$("#tipMsg").text("");$.ajax({url:latkeConfig.servePath+"/console/page/"+id,type:"GET",cache:false,success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}admin.pageList.id=id;$("#pageTitle").val(result.page.pageTitle);$("#pagePermalink").val(result.page.pagePermalink);$("#pageTarget").val(result.page.pageOpenTarget);if(result.page.pageType==="page"){$($(".fn-type").get(1)).click()}else{$($(".fn-type").get(0)).click()}$("#pageCommentable").prop("checked",result.page.pageCommentable);if(admin.pageList.currentEditorType!==result.page.pageEditorType){admin.editors.pageEditor.remove();admin.pageList.currentEditorType=result.page.pageEditorType;admin.editors.pageEditor.init(result.page.pageEditorType)}admin.editors.pageEditor.setContent(result.page.pageContent);$("#loadMsg").text("")}})},del:function(id,title){var isDelete=confirm(Label.confirmRemoveLabel+Label.navLabel+'"'+title+'"?');if(isDelete){$("#loadMsg").text(Label.loadingLabel);$("#tipMsg").text("");$.ajax({url:latkeConfig.servePath+"/console/page/"+id,type:"DELETE",cache:false,success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}var pageNum=admin.pageList.pageInfo.currentPage;if(admin.pageList.pageInfo.currentCount===1&&admin.pageList.pageInfo.pageCount!==1&&admin.pageList.pageInfo.currentPage===admin.pageList.pageInfo.pageCount){admin.pageList.pageInfo.pageCount--;pageNum=admin.pageList.pageInfo.pageCount}var hashList=window.location.hash.split("/");if(pageNum==hashList[hashList.length-1]){admin.pageList.getList(pageNum)}else{admin.setHashByPage(pageNum)}$("#loadMsg").text("")}})}},add:function(){if(this.validate()){$("#loadMsg").text(Label.loadingLabel);$("#tipMsg").text("");var pageContent=admin.editors.pageEditor.getContent();var pagePermalink=$("#pagePermalink").val().replace(/(^\s*)|(\s*$)/g,"");if(admin.pageList.type==="link"){pagePermalink=Util.proessURL(pagePermalink)}var requestJSONObject={page:{pageTitle:$("#pageTitle").val(),pageContent:pageContent,pagePermalink:pagePermalink,pageCommentable:$("#pageCommentable").prop("checked"),pageType:admin.pageList.type,pageOpenTarget:$("#pageTarget").val()}};$.ajax({url:latkeConfig.servePath+"/console/page/",type:"POST",cache:false,data:JSON.stringify(requestJSONObject),success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}admin.pageList.id="";$("#pagePermalink").val("");$("#pageTitle").val("");$("#pageCommentable").prop("cheked",false);$("#pageTarget").val("_self");$($(".fn-type").get(0)).click();admin.editors.pageEditor.setContent("");if(admin.pageList.pageInfo.currentCount===Label.PAGE_SIZE&&admin.pageList.pageInfo.currentPage===admin.pageList.pageInfo.pageCount){admin.pageList.pageInfo.pageCount++}var hashList=window.location.hash.split("/");if(admin.pageList.pageInfo.pageCount==hashList[hashList.length-1]){admin.pageList.getList(admin.pageList.pageInfo.pageCount)}else{admin.setHashByPage(admin.pageList.pageInfo.pageCount)}$("#loadMsg").text("")}})}},update:function(){if(this.validate()){$("#loadMsg").text(Label.loadingLabel);$("#tipMsg").text("");var pageContent=admin.editors.pageEditor.getContent();var pagePermalink=$("#pagePermalink").val().replace(/(^\s*)|(\s*$)/g,"");if(admin.pageList.type==="link"){pagePermalink=Util.proessURL(pagePermalink)}var requestJSONObject={page:{pageTitle:$("#pageTitle").val(),oId:this.id,pageContent:pageContent,pagePermalink:pagePermalink,pageCommentable:$("#pageCommentable").prop("checked"),pageType:admin.pageList.type,pageOpenTarget:$("#pageTarget").val(),pageEditorType:admin.pageList.currentEditorType}};$.ajax({url:latkeConfig.servePath+"/console/page/",type:"PUT",cache:false,data:JSON.stringify(requestJSONObject),success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}admin.pageList.id="";admin.pageList.getList(admin.pageList.pageInfo.currentPage);$("#pageTitle").val("");$("#pagePermalink").val("");$("#pageCommentable").prop("cheked",false);$("#pageTarget").val("_self");$($(".fn-type").get(0)).click();admin.editors.pageEditor.setContent("");$("#loadMsg").text("")}})}},validate:function(){if($("#pageTitle").val().replace(/\s/g,"")===""){$("#tipMsg").text(Label.titleEmptyLabel);$("#pageTitle").focus()}else{if(admin.pageList.type==="link"&&$("#pagePermalink").val().replace(/\s/g,"")===""){$("#tipMsg").text(Label.linkEmptyLabel)}else{return true}}return false},submit:function(){if(this.id!==""){this.update()}else{this.add()}if(admin.pageList.currentEditorType!==Label.editorType){admin.editors.pageEditor.remove();admin.pageList.currentEditorType=Label.editorType;admin.editors.pageEditor.init(Label.editorType)}},changeOrder:function(id,order,status){$("#loadMsg").text(Label.loadingLabel);$("#tipMsg").text("");var requestJSONObject={oId:id.toString(),direction:status};$.ajax({url:latkeConfig.servePath+"/console/page/order/",type:"PUT",cache:false,data:JSON.stringify(requestJSONObject),success:function(result,textStatus){$("#tipMsg").text(result.msg);admin.pageList.getList(admin.pageList.pageInfo.currentPage);$("#loadMsg").text("")}})}};admin.register["page-list"]={obj:admin.pageList,init:admin.pageList.init,refresh:admin.pageList.getList};admin.others={init:function(){$("#tabOthers").tabs();$.ajax({url:latkeConfig.servePath+"/console/reply/notification/template",type:"GET",cache:false,success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}$("#replayEmailTemplateTitle").val(result.replyNotificationTemplate.subject);$("#replayEmailTemplateBody").val(result.replyNotificationTemplate.body);$("#loadMsg").text("")}})},removeUnusedTags:function(){$("#tipMsg").text("");$.ajax({url:latkeConfig.servePath+"/console/tag/unused",type:"DELETE",cache:false,success:function(result,textStatus){$("#tipMsg").text(result.msg)}})},exportSQL:function(){$("#tipMsg").text("");$.ajax({url:latkeConfig.servePath+"/console/export/sql",type:"GET",cache:false,success:function(result,textStatus){if(!result.sc){window.location=latkeConfig.servePath+"/console/export/sql"}else{$("#tipMsg").text(result.msg)}}})},getUnusedTags:function(){$.ajax({url:latkeConfig.servePath+"/console/tag/unused",type:"GET",cache:false,success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}var unusedTags=result.unusedTags;if(0===unusedTags.length){return}}})},update:function(){$("#loadMsg").text(Label.loadingLabel);$("#tipMsg").text("");var requestJSONObject={replyNotificationTemplate:{subject:$("#replayEmailTemplateTitle").val(),body:$("#replayEmailTemplateBody").val()}};$.ajax({url:latkeConfig.servePath+"/console/reply/notification/template",type:"PUT",cache:false,data:JSON.stringify(requestJSONObject),success:function(result,textStatus){$("#tipMsg").text(result.msg);$("#loadMsg").text("")}})}};admin.register.others={obj:admin.others,init:admin.others.init,refresh:function(){admin.clearTip()}};admin.linkList={tablePagination:new TablePaginate("link"),pageInfo:{currentCount:1,pageCount:1,currentPage:1},id:"",init:function(page){this.tablePagination.buildTable([{text:"",index:"linkOrder",width:60},{style:"padding-left: 12px;",text:Label.linkTitleLabel,index:"linkTitle",width:230},{style:"padding-left: 12px;",text:Label.urlLabel,index:"linkAddress",minWidth:180},{style:"padding-left: 12px;",text:Label.linkDescriptionLabel,index:"linkDescription",width:360}]);this.tablePagination.initPagination();this.getList(page);$("#updateLink").dialog({width:700,height:210,modal:true,hideFooter:true})},getList:function(pageNum){$("#loadMsg").text(Label.loadingLabel);if(pageNum===0){pageNum=1}this.pageInfo.currentPage=pageNum;var that=this;$.ajax({url:latkeConfig.servePath+"/console/links/"+pageNum+"/"+Label.PAGE_SIZE+"/"+Label.WINDOW_SIZE,type:"GET",cache:false,success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}var links=result.links;var linkData=[];admin.linkList.pageInfo.currentCount=links.length;admin.linkList.pageInfo.pageCount=result.pagination.paginationPageCount===0?1:result.pagination.paginationPageCount;for(var i=0;i<links.length;i++){linkData[i]={};if(i===0){if(links.length===1){linkData[i].linkOrder=""}else{linkData[i].linkOrder='<div class="table-center" style="width:14px"> <span onclick="admin.linkList.changeOrder('+links[i].oId+", "+i+', \'down\');" class="icon-move-down"></span> </div>'}}else{if(i===links.length-1){linkData[i].linkOrder='<div class="table-center" style="width:14px"> <span onclick="admin.linkList.changeOrder('+links[i].oId+", "+i+', \'up\');" class="icon-move-up"></span> </div>'}else{linkData[i].linkOrder='<div class="table-center" style="width:38px"> <span onclick="admin.linkList.changeOrder('+links[i].oId+", "+i+', \'up\');" class="icon-move-up"></span> <span onclick="admin.linkList.changeOrder('+links[i].oId+", "+i+', \'down\');" class="icon-move-down"></span> </div>'}}linkData[i].linkTitle=links[i].linkTitle;linkData[i].linkAddress="<a target='_blank' class='no-underline' href='"+links[i].linkAddress+"'>"+links[i].linkAddress+"</a>";linkData[i].linkDescription=links[i].linkDescription;linkData[i].expendRow="<span><a href='"+links[i].linkAddress+"' target='_blank'>"+Label.viewLabel+"</a> <a href='javascript:void(0)' onclick=\"admin.linkList.get('"+links[i].oId+"')\">"+Label.updateLabel+"</a> <a href='javascript:void(0)' onclick=\"admin.linkList.del('"+links[i].oId+"', '"+links[i].linkTitle+"')\">"+Label.removeLabel+"</a></span>"}that.tablePagination.updateTablePagination(linkData,pageNum,result.pagination);$("#loadMsg").text("")}})},add:function(){if(this.validate()){$("#loadMsg").text(Label.loadingLabel);$("#tipMsg").text("");var requestJSONObject={link:{linkTitle:$("#linkTitle").val(),linkAddress:$("#linkAddress").val(),linkDescription:$("#linkDescription").val()}};$.ajax({url:latkeConfig.servePath+"/console/link/",type:"POST",cache:false,data:JSON.stringify(requestJSONObject),success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}$("#linkTitle").val("");$("#linkAddress").val("");$("#linkDescription").val("");if(admin.linkList.pageInfo.currentCount===Label.PAGE_SIZE&&admin.linkList.pageInfo.currentPage===admin.linkList.pageInfo.pageCount){admin.linkList.pageInfo.pageCount++}var hashList=window.location.hash.split("/");if(admin.linkList.pageInfo.pageCount!==parseInt(hashList[hashList.length-1])){admin.setHashByPage(admin.linkList.pageInfo.pageCount)}admin.linkList.getList(admin.linkList.pageInfo.pageCount);$("#loadMsg").text("")}})}},get:function(id){$("#loadMsg").text(Label.loadingLabel);$("#updateLink").dialog("open");$.ajax({url:latkeConfig.servePath+"/console/link/"+id,type:"GET",cache:false,success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}admin.linkList.id=id;$("#linkTitleUpdate").val(result.link.linkTitle);$("#linkAddressUpdate").val(result.link.linkAddress);$("#linkDescriptionUpdate").val(result.link.linkDescription);$("#loadMsg").text("")}})},update:function(){if(this.validate("Update")){$("#loadMsg").text(Label.loadingLabel);$("#tipMsg").text("");var requestJSONObject={link:{linkTitle:$("#linkTitleUpdate").val(),oId:this.id,linkAddress:$("#linkAddressUpdate").val(),linkDescription:$("#linkDescriptionUpdate").val()}};$.ajax({url:latkeConfig.servePath+"/console/link/",type:"PUT",cache:false,data:JSON.stringify(requestJSONObject),success:function(result,textStatus){$("#updateLink").dialog("close");$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}admin.linkList.getList(admin.linkList.pageInfo.currentPage);$("#loadMsg").text("")}})}},del:function(id,title){var isDelete=confirm(Label.confirmRemoveLabel+Label.permalinkLabel+'"'+title+'"?');if(isDelete){$("#loadMsg").text(Label.loadingLabel);$("#tipMsg").text("");$.ajax({url:latkeConfig.servePath+"/console/link/"+id,type:"DELETE",cache:false,success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}var pageNum=admin.linkList.pageInfo.currentPage;if(admin.linkList.pageInfo.currentCount===1&&admin.linkList.pageInfo.pageCount!==1&&admin.linkList.pageInfo.currentPage===admin.linkList.pageInfo.pageCount){admin.linkList.pageInfo.pageCount--;pageNum=admin.linkList.pageInfo.pageCount}var hashList=window.location.hash.split("/");if(pageNum!==parseInt(hashList[hashList.length-1])){admin.setHashByPage(pageNum)}admin.linkList.getList(pageNum);$("#loadMsg").text("")}})}},validate:function(status){if(!status){status=""}if($("#linkTitle"+status).val().replace(/\s/g,"")===""){$("#tipMsg").text(Label.titleEmptyLabel);$("#linkTitle"+status).focus().val("")}else{if($("#linkAddress"+status).val().replace(/\s/g,"")===""){$("#tipMsg").text(Label.addressEmptyLabel);$("#linkAddress"+status).focus().val("")}else{if(!/^\w+:\/\//.test($("#linkAddress"+status).val())){$("#tipMsg").text(Label.addressInvalidLabel);$("#linkAddress"+status).focus().val("")}else{return true}}}return false},changeOrder:function(id,order,status){$("#loadMsg").text(Label.loadingLabel);$("#tipMsg").text("");var requestJSONObject={oId:id.toString(),direction:status};$.ajax({url:latkeConfig.servePath+"/console/link/order/",type:"PUT",cache:false,data:JSON.stringify(requestJSONObject),success:function(result,textStatus){$("#tipMsg").text(result.msg);admin.linkList.getList(admin.linkList.pageInfo.currentPage);$("#loadMsg").text("")}})}};admin.register["link-list"]={obj:admin.linkList,init:admin.linkList.init,refresh:admin.linkList.getList};admin.preference={locale:"",editorType:"",init:function(){$("#tabPreference").tabs();$.ajax({url:latkeConfig.servePath+"/console/preference/",type:"GET",cache:false,success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}var preference=result.preference;$("#metaKeywords").val(preference.metaKeywords),$("#metaDescription").val(preference.metaDescription),$("#blogTitle").val(preference.blogTitle),$("#blogSubtitle").val(preference.blogSubtitle),$("#mostCommentArticleDisplayCount").val(preference.mostCommentArticleDisplayCount);$("#mostViewArticleDisplayCount").val(preference.mostViewArticleDisplayCount),$("#recentCommentDisplayCount").val(preference.recentCommentDisplayCount);$("#mostUsedTagDisplayCount").val(preference.mostUsedTagDisplayCount);$("#articleListDisplayCount").val(preference.articleListDisplayCount);$("#articleListPaginationWindowSize").val(preference.articleListPaginationWindowSize);$("#localeString").val(preference.localeString);$("#timeZoneId").val(preference.timeZoneId);$("#noticeBoard").val(preference.noticeBoard);$("#footerContent").val(preference.footerContent);$("#htmlHead").val(preference.htmlHead);$("#externalRelevantArticlesDisplayCount").val(preference.externalRelevantArticlesDisplayCount);$("#relevantArticlesDisplayCount").val(preference.relevantArticlesDisplayCount);$("#randomArticlesDisplayCount").val(preference.randomArticlesDisplayCount);$("#keyOfSolo").val(preference.keyOfSolo);"true"===preference.enableArticleUpdateHint?$("#enableArticleUpdateHint").attr("checked","checked"):$("#enableArticleUpdateHint").removeAttr("checked");"true"===preference.allowVisitDraftViaPermalink?$("#allowVisitDraftViaPermalink").attr("checked","checked"):$("allowVisitDraftViaPermalink").removeAttr("checked");"true"===preference.allowRegister?$("#allowRegister").attr("checked","checked"):$("#allowRegister").removeAttr("checked");"true"===preference.commentable?$("#commentable").attr("checked","checked"):$("commentable").removeAttr("checked");admin.preference.locale=preference.localeString;admin.preference.editorType=preference.editorType;$("#skinMain").data("skinDirName",preference.skinDirName);var skins=eval("("+preference.skins+")");var skinsHTML="";for(var i=0;i<skins.length;i++){var selectedClass="";if(skins[i].skinName===preference.skinName&&skins[i].skinDirName===preference.skinDirName){selectedClass+=" selected"}skinsHTML+="<div title='"+skins[i].skinDirName+"' class='left skinItem"+selectedClass+"'><img class='skinPreview' src='"+latkeConfig.staticServePath+"/skins/"+skins[i].skinDirName+"/preview.png'/><div>"+skins[i].skinName+"</div></div>"}$("#skinMain").append(skinsHTML+"<div class='clear'></div>");$(".skinItem").click(function(){$(".skinItem").removeClass("selected");$(this).addClass("selected");$("#skinMain").data("skinDirName",this.title)});var signs=eval("("+preference.signs+")");for(var j=1;j<signs.length;j++){$("#preferenceSign"+j).val(signs[j].signHTML)}$("#articleListDisplay").val(preference.articleListStyle);$("#editorType").val(preference.editorType);$("#feedOutputMode").val(preference.feedOutputMode);$("#feedOutputCnt").val(preference.feedOutputCnt);$("#loadMsg").text("")}});$.ajax({url:latkeConfig.servePath+"/console/preference/qiniu",type:"GET",cache:false,success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}$("#qiniuAccessKey").val(result.qiniu.qiniuAccessKey);$("#qiniuSecretKey").val(result.qiniu.qiniuSecretKey);$("#qiniuDomain").val(result.qiniu.qiniuDomain);$("#qiniuBucket").val(result.qiniu.qiniuBucket)}})},validate:function(){if(!/^\d+$/.test($("#mostUsedTagDisplayCount").val())){$("#tipMsg").text("["+Label.paramSettingsLabel+" - "+Label.indexTagDisplayCntLabel+"] "+Label.nonNegativeIntegerOnlyLabel);$("#mostUsedTagDisplayCount").focus();return false}else{if(!/^\d+$/.test($("#recentCommentDisplayCount").val())){$("#tipMsg").text("["+Label.paramSettingsLabel+" - "+Label.indexRecentCommentDisplayCntLabel+"] "+Label.nonNegativeIntegerOnlyLabel);$("#recentCommentDisplayCount").focus();return false}else{if(!/^\d+$/.test($("#mostCommentArticleDisplayCount").val())){$("#tipMsg").text("["+Label.paramSettingsLabel+" - "+Label.indexMostCommentArticleDisplayCntLabel+"] "+Label.nonNegativeIntegerOnlyLabel);$("#mostCommentArticleDisplayCount").focus();return false}else{if(!/^\d+$/.test($("#mostViewArticleDisplayCount").val())){$("#tipMsg").text("["+Label.paramSettingsLabel+" - "+Label.indexMostViewArticleDisplayCntLabel+"] "+Label.nonNegativeIntegerOnlyLabel);$("#mostViewArticleDisplayCount").focus();return false}else{if(!/^\d+$/.test($("#articleListDisplayCount").val())){$("#tipMsg").text("["+Label.paramSettingsLabel+" - "+Label.pageSizeLabel+"] "+Label.nonNegativeIntegerOnlyLabel);$("#articleListDisplayCount").focus();return false}else{if(!/^\d+$/.test($("#articleListPaginationWindowSize").val())){$("#tipMsg").text("["+Label.paramSettingsLabel+" - "+Label.windowSizeLabel+"] "+Label.nonNegativeIntegerOnlyLabel);$("#articleListPaginationWindowSize").focus();return false}else{if(!/^\d+$/.test($("#randomArticlesDisplayCount").val())){$("#tipMsg").text("["+Label.paramSettingsLabel+" - "+Label.randomArticlesDisplayCntLabel+"] "+Label.nonNegativeIntegerOnlyLabel);$("#randomArticlesDisplayCount").focus();return false}else{if(!/^\d+$/.test($("#relevantArticlesDisplayCount").val())){$("#tipMsg").text("["+Label.paramSettingsLabel+" - "+Label.relevantArticlesDisplayCntLabel+"] "+Label.nonNegativeIntegerOnlyLabel);$("#relevantArticlesDisplayCount").focus();return false}else{if(!/^\d+$/.test($("#externalRelevantArticlesDisplayCount").val())){$("#tipMsg").text("["+Label.paramSettingsLabel+" - "+Label.externalRelevantArticlesDisplayCntLabel+"] "+Label.nonNegativeIntegerOnlyLabel);$("#externalRelevantArticlesDisplayCount").focus();return false}}}}}}}}}return true},update:function(){if(!admin.preference.validate()){return}$("#tipMsg").text("");$("#loadMsg").text(Label.loadingLabel);var signs=[{oId:0,signHTML:""},{oId:1,signHTML:$("#preferenceSign1").val()},{oId:2,signHTML:$("#preferenceSign2").val()},{oId:3,signHTML:$("#preferenceSign3").val()}];var requestJSONObject={preference:{metaKeywords:$("#metaKeywords").val(),metaDescription:$("#metaDescription").val(),blogTitle:$("#blogTitle").val(),blogSubtitle:$("#blogSubtitle").val(),mostCommentArticleDisplayCount:$("#mostCommentArticleDisplayCount").val(),mostViewArticleDisplayCount:$("#mostViewArticleDisplayCount").val(),recentCommentDisplayCount:$("#recentCommentDisplayCount").val(),mostUsedTagDisplayCount:$("#mostUsedTagDisplayCount").val(),articleListDisplayCount:$("#articleListDisplayCount").val(),articleListPaginationWindowSize:$("#articleListPaginationWindowSize").val(),skinDirName:$("#skinMain").data("skinDirName"),localeString:$("#localeString").val(),timeZoneId:$("#timeZoneId").val(),noticeBoard:$("#noticeBoard").val(),footerContent:$("#footerContent").val(),htmlHead:$("#htmlHead").val(),externalRelevantArticlesDisplayCount:$("#externalRelevantArticlesDisplayCount").val(),relevantArticlesDisplayCount:$("#relevantArticlesDisplayCount").val(),randomArticlesDisplayCount:$("#randomArticlesDisplayCount").val(),enableArticleUpdateHint:$("#enableArticleUpdateHint").prop("checked"),signs:signs,keyOfSolo:$("#keyOfSolo").val(),allowVisitDraftViaPermalink:$("#allowVisitDraftViaPermalink").prop("checked"),articleListStyle:$("#articleListDisplay").val(),editorType:$("#editorType").val(),feedOutputMode:$("#feedOutputMode").val(),feedOutputCnt:$("#feedOutputCnt").val(),commentable:$("#commentable").prop("checked"),allowRegister:$("#allowRegister").prop("checked")}};$.ajax({url:latkeConfig.servePath+"/console/preference/",type:"PUT",cache:false,data:JSON.stringify(requestJSONObject),success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}if($("#localeString").val()!==admin.preference.locale||$("#editorType").val()!==admin.preference.editorType){window.location.reload()}for(var i=1;i<signs.length;i++){if($("#articleSign"+signs[i].oId).length===1){$("#articleSign"+signs[i].oId).tip("option","content",signs[i].signHTML===""?Label.signIsNullLabel:signs[i].signHTML.replace(/\n/g,"").replace(/<script.*<\/script>/ig,""))}}$("#loadMsg").text("")}})},updateQiniu:function(){$("#tipMsg").text("");$("#loadMsg").text(Label.loadingLabel);var requestJSONObject={qiniuAccessKey:$("#qiniuAccessKey").val(),qiniuSecretKey:$("#qiniuSecretKey").val(),qiniuDomain:$("#qiniuDomain").val(),qiniuBucket:$("#qiniuBucket").val()};$.ajax({url:latkeConfig.servePath+"/console/preference/qiniu",type:"PUT",cache:false,data:JSON.stringify(requestJSONObject),success:function(result,textStatus){if(result.sc){window.location.reload()}$("#tipMsg").text(result.msg);$("#loadMsg").text("")}})}};admin.register.preference={obj:admin.preference,init:admin.preference.init,refresh:function(){admin.clearTip()}};admin.pluginList={tablePagination:new TablePaginate("plugin"),pageInfo:{currentCount:1,pageCount:1,currentPage:1},init:function(page){this.tablePagination.buildTable([{style:"padding-left: 12px;",text:Label.pluginNameLabel,index:"name",width:230},{style:"padding-left: 12px;",text:Label.statusLabel,index:"status",minWidth:180},{style:"padding-left: 12px;",text:Label.authorLabel,index:"author",width:200},{style:"padding-left: 12px;",text:Label.versionLabel,index:"version",width:120}]);this.tablePagination.initPagination();$("#pluginSetting").dialog({width:700,height:180,modal:true,hideFooter:true});this.getList(page)},getList:function(pageNum){$("#loadMsg").text(Label.loadingLabel);$("#tipMsg").text("");var that=this;$.ajax({url:latkeConfig.servePath+"/console/plugins/"+pageNum+"/"+Label.PAGE_SIZE+"/"+Label.WINDOW_SIZE,type:"GET",cache:false,success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}admin.pluginList.pageInfo.currentPage=pageNum;var datas=result.plugins;for(var i=0;i<datas.length;i++){datas[i].expendRow="<a href='javascript:void(0)' onclick=\"admin.pluginList.changeStatus('"+datas[i].oId+"', '"+datas[i].status+"')\">";if(datas[i].status==="ENABLED"){datas[i].status=Label.enabledLabel;datas[i].expendRow+=Label.disableLabel}else{datas[i].status=Label.disabledLabel;datas[i].expendRow+=Label.enableLabel}datas[i].expendRow+="</a> ";if(datas[i].setting!="{}"){datas[i].expendRow+="<a href='javascript:void(0)' onclick=\"admin.pluginList.toSetting('"+datas[i].oId+"')\"> "+Label.settingLabel+" </a> "}}that.tablePagination.updateTablePagination(result.plugins,pageNum,result.pagination);$("#loadMsg").text("")}})},toSetting:function(pluginId){$("#loadMsg").text(Label.loadingLabel);$("#tipMsg").text("");var requestJSONObject={oId:pluginId};$.ajax({url:latkeConfig.servePath+"/console/plugin/toSetting",type:"POST",cache:false,data:JSON.stringify(requestJSONObject),success:function(result,textStatus){$("#tipMsg").text(result.msg);$("#pluginSetting").html(result);$("#pluginSetting").dialog("open");$("#loadMsg").text("")}})},changeStatus:function(pluginId,status){$("#loadMsg").text(Label.loadingLabel);$("#tipMsg").text("");if(status==="ENABLED"){status="DISABLED"}else{status="ENABLED"}var requestJSONObject={oId:pluginId,status:status};$.ajax({url:latkeConfig.servePath+"/console/plugin/status/",type:"PUT",cache:false,data:JSON.stringify(requestJSONObject),success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}$("#loadMsg").text("");window.location.reload()}})}};admin.register["plugin-list"]={obj:admin.pluginList,init:admin.pluginList.init,refresh:function(){$("#loadMsg").text("")}};admin.userList={tablePagination:new TablePaginate("user"),pageInfo:{currentCount:1,pageCount:1,currentPage:1},userInfo:{oId:"",userRole:""},init:function(page){this.tablePagination.buildTable([{style:"padding-left: 12px;",text:Label.commentNameLabel,index:"userName",width:230},{style:"padding-left: 12px;",text:Label.commentEmailLabel,index:"userEmail",minWidth:180},{style:"padding-left: 12px;",text:Label.roleLabel,index:"isAdmin",width:120}]);this.tablePagination.initPagination();this.getList(page);$("#userUpdate").dialog({width:700,height:300,modal:true,hideFooter:true})},getList:function(pageNum){$("#loadMsg").text(Label.loadingLabel);$("#tipMsg").text("");this.pageInfo.currentPage=pageNum;var that=this;$.ajax({url:latkeConfig.servePath+"/console/users/"+pageNum+"/"+Label.PAGE_SIZE+"/"+Label.WINDOW_SIZE,type:"GET",cache:false,success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}var users=result.users;var userData=[];admin.userList.pageInfo.currentCount=users.length;admin.userList.pageInfo.pageCount=result.pagination.paginationPageCount;if(users.length<1){$("#tipMsg").text("No user "+Label.reportIssueLabel);$("#loadMsg").text("");return}for(var i=0;i<users.length;i++){userData[i]={};userData[i].userName=users[i].userName;userData[i].userEmail=users[i].userEmail;if("adminRole"===users[i].userRole){userData[i].isAdmin="&nbsp;"+Label.administratorLabel;userData[i].expendRow="<a href='javascript:void(0)' onclick=\"admin.userList.get('"+users[i].oId+"', '"+users[i].userRole+"')\">"+Label.updateLabel+"</a>"}else{userData[i].expendRow="<a href='javascript:void(0)' onclick=\"admin.userList.get('"+users[i].oId+"', '"+users[i].userRole+"')\">"+Label.updateLabel+"</a> <a href='javascript:void(0)' onclick=\"admin.userList.del('"+users[i].oId+"', '"+users[i].userName+"')\">"+Label.removeLabel+"</a> <a href='javascript:void(0)' onclick=\"admin.userList.changeRole('"+users[i].oId+"')\">"+Label.changeRoleLabel+"</a>";if("defaultRole"===users[i].userRole){userData[i].isAdmin=Label.commonUserLabel}else{userData[i].isAdmin=Label.visitorUserLabel}}that.tablePagination.updateTablePagination(userData,pageNum,result.pagination);$("#loadMsg").text("")}}})},add:function(){if(this.validate()){$("#loadMsg").text(Label.loadingLabel);$("#tipMsg").text("");var requestJSONObject={userName:$("#userName").val(),userEmail:$("#userEmail").val(),userURL:$("#userURL").val(),userPassword:$("#userPassword").val(),userAvatar:$("#userAvatar").val()};$.ajax({url:latkeConfig.servePath+"/console/user/",type:"POST",cache:false,data:JSON.stringify(requestJSONObject),success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}$("#userName").val("");$("#userEmail").val("");$("#userURL").val("");$("#userPassword").val("");$("#userAvatar").val("");if(admin.userList.pageInfo.currentCount===Label.PAGE_SIZE&&admin.userList.pageInfo.currentPage===admin.userList.pageInfo.pageCount){admin.userList.pageInfo.pageCount++}var hashList=window.location.hash.split("/");if(admin.userList.pageInfo.pageCount!==parseInt(hashList[hashList.length-1])){admin.setHashByPage(admin.userList.pageInfo.pageCount)}admin.userList.getList(admin.userList.pageInfo.pageCount);$("#loadMsg").text("")}})}},get:function(id,userRole){$("#loadMsg").text(Label.loadingLabel);$("#tipMsg").text("");$("#userUpdate").dialog("open");$.ajax({url:latkeConfig.servePath+"/console/user/"+id,type:"GET",cache:false,success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}var $userEmailUpdate=$("#userEmailUpdate");$("#userNameUpdate").val(result.user.userName).data("userInfo",{oId:id,userRole:userRole});$userEmailUpdate.val(result.user.userEmail);if("adminRole"===userRole){$userEmailUpdate.attr("disabled","disabled")}else{$userEmailUpdate.removeAttr("disabled")}$("#userURLUpdate").val(result.user.userURL);$("#userPasswordUpdate").val(result.user.userPassword);$("#userAvatarUpdate").val(result.user.userAvatar);$("#loadMsg").text("")}})},update:function(){if(this.validate("Update")){$("#loadMsg").text(Label.loadingLabel);$("#tipMsg").text("");var userInfo=$("#userNameUpdate").data("userInfo");var requestJSONObject={userName:$("#userNameUpdate").val(),oId:userInfo.oId,userEmail:$("#userEmailUpdate").val(),userURL:$("#userURLUpdate").val(),userRole:userInfo.userRole,userPassword:$("#userPasswordUpdate").val(),userAvatar:$("#userAvatarUpdate").val()};$.ajax({url:latkeConfig.servePath+"/console/user/",type:"PUT",cache:false,data:JSON.stringify(requestJSONObject),success:function(result,textStatus){$("#userUpdate").dialog("close");$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}admin.userList.getList(admin.userList.pageInfo.currentPage);$("#loadMsg").text("")}})}},del:function(id,userName){var isDelete=confirm(Label.confirmRemoveLabel+Label.userLabel+'"'+userName+'"?');if(isDelete){$("#loadMsg").text(Label.loadingLabel);$("#tipMsg").text("");$.ajax({url:latkeConfig.servePath+"/console/user/"+id,type:"DELETE",cache:false,success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}var pageNum=admin.userList.pageInfo.currentPage;if(admin.userList.pageInfo.currentCount===1&&admin.userList.pageInfo.pageCount!==1&&admin.userList.pageInfo.currentPage===admin.userList.pageInfo.pageCount){admin.userList.pageInfo.pageCount--;pageNum=admin.userList.pageInfo.pageCount}var hashList=window.location.hash.split("/");if(pageNum!==parseInt(hashList[hashList.length-1])){admin.setHashByPage(pageNum)}admin.userList.getList(pageNum);$("#loadMsg").text("")}})}},changeRole:function(id){$("#tipMsg").text("");$.ajax({url:latkeConfig.servePath+"/console/changeRole/"+id,type:"GET",cache:false,success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}var pageNum=admin.userList.pageInfo.currentPage;if(admin.userList.pageInfo.currentCount===1&&admin.userList.pageInfo.pageCount!==1&&admin.userList.pageInfo.currentPage===admin.userList.pageInfo.pageCount){admin.userList.pageInfo.pageCount--;pageNum=admin.userList.pageInfo.pageCount}var hashList=window.location.hash.split("/");if(pageNum!==parseInt(hashList[hashList.length-1])){admin.setHashByPage(pageNum)}admin.userList.getList(pageNum);$("#loadMsg").text("")}})},validate:function(status){if(!status){status=""}var userName=$("#userName"+status).val().replace(/(^\s*)|(\s*$)/g,"");if(2>userName.length||userName.length>20){$("#tipMsg").text(Label.nameTooLongLabel);$("#userName"+status).focus()}else{if($("#userEmail"+status).val().replace(/\s/g,"")===""){$("#tipMsg").text(Label.mailCannotEmptyLabel);$("#userEmail"+status).focus()}else{if(!/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test($("#userEmail"+status).val())){$("#tipMsg").text(Label.mailInvalidLabel);$("#userEmail"+status).focus()}else{if($("#userPassword"+status).val()===""){$("#tipMsg").text(Label.passwordEmptyLabel);$("#userPassword"+status).focus()}else{return true}}}}return false}};admin.register["user-list"]={obj:admin.userList,init:admin.userList.init,refresh:admin.userList.getList};admin.categoryList={tablePagination:new TablePaginate("category"),pageInfo:{currentCount:1,pageCount:1,currentPage:1},init:function(page){this.tablePagination.buildTable([{text:"",index:"linkOrder",width:60},{style:"padding-left: 12px;",text:Label.titleLabel,index:"categoryTitle",width:230},{style:"padding-left: 12px;",text:"URI",index:"categoryURI",width:230},{style:"padding-left: 12px;",text:Label.descriptionLabel,index:"categoryDesc",minWidth:180}]);this.tablePagination.initPagination();this.getList(page);$("#categoryUpdate").dialog({width:700,height:260,modal:true,hideFooter:true});$.ajax({url:latkeConfig.servePath+"/console/tags",type:"GET",cache:false,success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}if(0>=result.tags.length){return}var tags=[];for(var i=0;i<result.tags.length;i++){tags.push(result.tags[i].tagTitle)}$("#categoryTags").completed({height:160,buttonText:Label.selectLabel,data:tags}).width($("#categoryTags").parent().width()-68);$("#loadMsg").text("")}})},getList:function(pageNum){$("#loadMsg").text(Label.loadingLabel);$("#tipMsg").text("");this.pageInfo.currentPage=pageNum;var that=this;$.ajax({url:latkeConfig.servePath+"/console/categories/"+pageNum+"/"+Label.PAGE_SIZE+"/"+Label.WINDOW_SIZE,type:"GET",cache:false,success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}var categories=result.categories;var categoryData=[];admin.categoryList.pageInfo.currentCount=categories.length;admin.categoryList.pageInfo.pageCount=result.pagination.paginationPageCount===0?1:result.pagination.paginationPageCount;for(var i=0;i<categories.length;i++){categoryData[i]={};if(i===0){if(categories.length===1){categoryData[i].linkOrder=""}else{categoryData[i].linkOrder='<div class="table-center" style="width:14px"> <span onclick="admin.categoryList.changeOrder('+categories[i].oId+", "+i+', \'down\');" class="icon-move-down"></span> </div>'}}else{if(i===categories.length-1){categoryData[i].linkOrder='<div class="table-center" style="width:14px"> <span onclick="admin.categoryList.changeOrder('+categories[i].oId+", "+i+', \'up\');" class="icon-move-up"></span> </div>'}else{categoryData[i].linkOrder='<div class="table-center" style="width:38px"> <span onclick="admin.categoryList.changeOrder('+categories[i].oId+", "+i+', \'up\');" class="icon-move-up"></span> <span onclick="admin.categoryList.changeOrder('+categories[i].oId+", "+i+', \'down\');" class="icon-move-down"></span> </div>'}}categoryData[i].categoryTitle=categories[i].categoryTitle;categoryData[i].categoryURI=categories[i].categoryURI;categoryData[i].categoryDesc=categories[i].categoryDescription;categoryData[i].expendRow="<a href='javascript:void(0)' onclick=\"admin.categoryList.get('"+categories[i].oId+"')\">"+Label.updateLabel+"</a> <a href='javascript:void(0)' onclick=\"admin.categoryList.del('"+categories[i].oId+"', '"+categories[i].categoryTitle+"')\">"+Label.removeLabel+"</a> "}that.tablePagination.updateTablePagination(categoryData,pageNum,result.pagination);$("#loadMsg").text("")}})},add:function(){if(this.validate()){$("#loadMsg").text(Label.loadingLabel);$("#tipMsg").text("");var requestJSONObject={categoryTitle:$("#categoryName").val(),categoryTags:$("#categoryTags").val(),categoryURI:$("#categoryURI").val(),categoryDescription:$("#categoryDesc").val()};$.ajax({url:latkeConfig.servePath+"/console/category/",type:"POST",cache:false,data:JSON.stringify(requestJSONObject),success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}$("#categoryName").val("");$("#categoryTags").val("");$("#categoryURI").val("");$("#categoryDesc").val("");if(admin.categoryList.pageInfo.currentCount===Label.PAGE_SIZE&&admin.categoryList.pageInfo.currentPage===admin.categoryList.pageInfo.pageCount){admin.categoryList.pageInfo.pageCount++}var hashList=window.location.hash.split("/");if(admin.categoryList.pageInfo.pageCount!==parseInt(hashList[hashList.length-1])){admin.setHashByPage(admin.categoryList.pageInfo.pageCount)}admin.categoryList.getList(admin.categoryList.pageInfo.pageCount);$("#loadMsg").text("")}})}},get:function(id){$("#loadMsg").text(Label.loadingLabel);$("#tipMsg").text("");$("#categoryUpdate").dialog("open");$.ajax({url:latkeConfig.servePath+"/console/category/"+id,type:"GET",cache:false,success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}$("#categoryNameUpdate").val(result.categoryTitle).data("oId",id);$("#categoryURIUpdate").val(result.categoryURI);$("#categoryDescUpdate").val(result.categoryDescription);$("#categoryTagsUpdate").val(result.categoryTags);$("#loadMsg").text("")}})},update:function(){if(this.validate("Update")){$("#loadMsg").text(Label.loadingLabel);$("#tipMsg").text("");var requestJSONObject={categoryTitle:$("#categoryNameUpdate").val(),oId:$("#categoryNameUpdate").data("oId"),categoryTags:$("#categoryTagsUpdate").val(),categoryURI:$("#categoryURIUpdate").val(),categoryDescription:$("#categoryDescUpdate").val()};$.ajax({url:latkeConfig.servePath+"/console/category/",type:"PUT",cache:false,data:JSON.stringify(requestJSONObject),success:function(result,textStatus){$("#categoryUpdate").dialog("close");$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}admin.categoryList.getList(admin.categoryList.pageInfo.currentPage);$("#loadMsg").text("")}})}},del:function(id,categoryName){var isDelete=confirm(Label.confirmRemoveLabel+Label.categoryLabel+'"'+categoryName+'"?');if(isDelete){$("#loadMsg").text(Label.loadingLabel);$("#tipMsg").text("");$.ajax({url:latkeConfig.servePath+"/console/category/"+id,type:"DELETE",cache:false,success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}var pageNum=admin.categoryList.pageInfo.currentPage;if(admin.categoryList.pageInfo.currentCount===1&&admin.categoryList.pageInfo.pageCount!==1&&admin.categoryList.pageInfo.currentPage===admin.categoryList.pageInfo.pageCount){admin.categoryList.pageInfo.pageCount--;pageNum=admin.categoryList.pageInfo.pageCount}var hashList=window.location.hash.split("/");if(pageNum!==parseInt(hashList[hashList.length-1])){admin.setHashByPage(pageNum)}admin.categoryList.getList(pageNum);$("#loadMsg").text("")}})}},validate:function(status){if(!status){status=""}var categoryName=$("#categoryName"+status).val().replace(/(^\s*)|(\s*$)/g,"");if(2>categoryName.length||categoryName.length>32){$("#tipMsg").text(Label.categoryTooLongLabel);$("#categoryName"+status).focus()}else{if($.trim($("#categoryTags"+status).val())===""){$("#tipMsg").text(Label.tagsEmptyLabel);$("#categoryTags"+status).focus()}else{return true}}return false},changeOrder:function(id,order,status){$("#loadMsg").text(Label.loadingLabel);$("#tipMsg").text("");var requestJSONObject={oId:id.toString(),direction:status};$.ajax({url:latkeConfig.servePath+"/console/category/order/",type:"PUT",cache:false,data:JSON.stringify(requestJSONObject),success:function(result,textStatus){$("#tipMsg").text(result.msg);admin.categoryList.getList(admin.categoryList.pageInfo.currentPage);$("#loadMsg").text("")}})}};admin.register["category-list"]={obj:admin.categoryList,init:admin.categoryList.init,refresh:admin.categoryList.getList};admin.commentList={tablePagination:new TablePaginate("comment"),pageInfo:{currentPage:1},init:function(page){this.tablePagination.buildTable([{text:Label.commentContentLabel,index:"content",minWidth:300,style:"padding-left: 12px;"},{text:Label.authorLabel,index:"title",width:230,style:"padding-left: 12px;"},{text:Label.createDateLabel,index:"date",width:90,style:"padding-left: 12px;"}]);this.tablePagination.initPagination();this.getList(page)},getList:function(pageNum){var that=this;$("#loadMsg").text(Label.loadingLabel);$.ajax({url:latkeConfig.servePath+"/console/comments/"+pageNum+"/"+Label.PAGE_SIZE+"/"+Label.WINDOW_SIZE,type:"GET",cache:false,success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}that.pageInfo.currentPage=pageNum;var comments=result.comments,commentsData=[];for(var i=0;i<comments.length;i++){var type="Article";if(comments[i].type==="pageComment"){type="Page"}commentsData[i]={};commentsData[i].content=Util.replaceEmString(comments[i].commentContent)+"<span class='table-tag'> on &nbsp;&nbsp;</span><a href='"+latkeConfig.servePath+comments[i].commentSharpURL+"' target='_blank'>"+comments[i].commentTitle+"</a>";commentsData[i].expendRow="<a href='javascript:void(0)' onclick=\"admin.commentList.del('"+comments[i].oId+"', '"+type+"')\">"+Label.removeLabel+"</a>";commentsData[i].title="<img class='small-head' src='"+comments[i].commentThumbnailURL+"'/>";if("http://"===comments[i].commentURL){commentsData[i].title+=comments[i].commentName}else{commentsData[i].title+="<a href='"+comments[i].commentURL+"' target='_blank' class='no-underline'>"+comments[i].commentName+"</a>"}commentsData[i].title+="<br/><a href='mailto:"+comments[i].commentEmail+"'>"+comments[i].commentEmail+"</a>";commentsData[i].date=$.bowknot.getDate(comments[i].commentTime)}that.tablePagination.updateTablePagination(commentsData,pageNum,result.pagination);$("#loadMsg").text("")}})},del:function(id,type){if(confirm(Label.confirmRemoveLabel+Label.commentLabel+"?")){$("#loadMsg").text(Label.loadingLabel);$.ajax({url:latkeConfig.servePath+"/console/"+type.toLowerCase()+"/comment/"+id,type:"DELETE",cache:false,success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}admin.commentList.getList(admin.commentList.pageInfo.currentPage);$("#loadMsg").text("")}})}}};admin.register["comment-list"]={obj:admin.commentList,init:admin.commentList.init,refresh:admin.commentList.getList};var plugins={};admin.plugin={plugins:[],add:function(data){data.isInit=false;data.hash=data.path.replace("/","#")+"/"+data.id;this.plugins.push(data);var pathList=this._analysePath(data.path);if(data.index&&pathList.length<2){this._addNew(data,pathList)}},setCurByHash:function(tags){var pluginList=this.plugins;for(var i=0;i<pluginList.length;i++){var data=pluginList[i];var pathList=this._analysePath(data.path),isCurrentPlugin=false;if(data.index&&window.location.hash.indexOf(data.hash)>-1){isCurrentPlugin=true}else{if(data.path.replace("/","#")===window.location.hash||(window.location.hash==="#main"&&data.path.indexOf("/main/panel")>-1)){isCurrentPlugin=true}}if(isCurrentPlugin){if(data.isInit){if(plugins[data.id].refresh){plugins[data.id].refresh(tags.page)}}else{if(!data.index){this._addToExist(data,pathList)}else{if(pathList.length===2){this._addNew(data,pathList)}}plugins[data.id].init(tags.page);data.isInit=true}}}},_analysePath:function(path){var paths=path.split("/");paths.splice(0,1);return paths},_addNew:function(data,pathList){if(pathList.length===2){data.target=$("#tabPreference li").get(data.index-1);$("#tabPreference").tabs("add",data);return}else{if(pathList[0]===""){data.target=$("#tabs>ul>li").get(data.index-1)}else{if(pathList[0]==="article"){data.target=$("#tabArticleMgt>li").get(data.index-1)}else{if(pathList[0]==="tools"){admin.tools.push("#"+data.id);data.target=$("#tabTools>li").get(data.index-1)}}}}if(!data.target){alert("data.index is error!")}$("#tabs").tabs("add",data)},_addToExist:function(data,pathList){switch(pathList[0]){case"main":$("#mainPanel"+pathList[1].charAt(5)).append(data.content);break;case"tools":case"article":if(pathList.length===2){$("#tabsPanel_"+pathList[1]).append(data.content)}else{$("#tabPreferencePanel_"+pathList[2]).append(data.content)}break;case"comment-list":$("#tabsPanel_comment-list").append(data.content);break}}};admin.main={};admin.register.main={obj:admin.main,init:function(){admin.clearTip()},refresh:function(){admin.clearTip()}};admin.about={init:function(){$.ajax({url:"https://rhythm.b3log.org/version/solo/latest/"+Label.version,type:"GET",cache:false,dataType:"jsonp",success:function(data,textStatus){var version=data.soloVersion;if(version===Label.version){$("#aboutLatest").text(Label.upToDateLabel)}else{$("#aboutLatest").html(Label.outOfDateLabel+"<a href='"+data.soloDownload+"'>"+version+"</a>")}},complete:function(XHR,TS){admin.clearTip()}})}};admin.register.about={obj:admin.about,init:admin.about.init,refresh:function(){admin.clearTip()}};
\ No newline at end of file
/*
* Copyright (c) 2010-2017, b3log.org & hacpai.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var Util={isLoggedIn:function(){if(($("#admin").length===1&&$("#admin").data("login"))||latkeConfig.isLoggedIn==="true"){return true}else{return false}},getUserName:function(){if($("#adminName").length===1){return $("#adminName").text()}else{return latkeConfig.userName}},error:function(){$("#tipMsg").text("Error: "+arguments[0]+" File: "+arguments[1]+"\nLine: "+arguments[2]+" please report this issue on https://github.com/b3log/solo/issues/new");$("#loadMsg").text("")},killIE:function(){var addKillPanel=function(){if(Cookie.readCookie("showKill")===""){var left=($(window).width()-701)/2,top1=($(window).height()-420)/2;$("body").append("<div style='display: block; height: 100%; width: 100%; position: fixed; background-color: rgb(0, 0, 0); opacity: 0.6; top: 0px;z-index:11'></div><iframe style='left:"+left+"px;z-index:20;top: "+top1+"px; position: fixed; border: 0px none; width: 701px; height: 420px;' src='"+latkeConfig.servePath+"/kill-browser'></iframe>")}};if($.browser.msie){if($.browser.version==="6.0"||$.browser.version==="7.0"){addKillPanel();return}if(window.external&&window.external.twGetRunPath){var path=external.twGetRunPath();if(path&&path.toLowerCase().indexOf("360se")>-1&&window.location.href.indexOf("admin-index")>-1){addKillPanel();return}}}},replaceEmString:function(str){var commentSplited=str.split("[em");if(commentSplited.length===1){return str}str=commentSplited[0];for(var j=1;j<commentSplited.length;j++){var key=commentSplited[j].substr(0,2);str+="<img width='20' src='"+latkeConfig.staticServePath+"/images/emotions/em"+key+".png' alt='"+Label["em"+key+"Label"]+"' title='"+Label["em"+key+"Label"]+"'/> "+commentSplited[j].substr(3)}return str},proessURL:function(url){if(!/^\w+:\/\//.test(url)){url="http://"+url}return url},switchMobile:function(skin){Cookie.createCookie("btouch_switch_toggle",skin,365);setTimeout(function(){location.reload()},1250)},setTopBar:function(){var $top=$("#top");if($top.length===1){var $showTop=$("#showTop");$showTop.click(function(){$top.slideDown();$showTop.hide()});$("#hideTop").click(function(){$top.slideUp();$showTop.show()})}},goTop:function(){$("html, body").animate({scrollTop:0},800)},goBottom:function(bottom){if(!bottom){bottom=0}var wHeight=$("body").height()>$(document).height()?$("body").height():$(document).height();window.scrollTo(0,wHeight-$(window).height()-bottom)},init:function(){Util.killIE();Util.setTopBar()},replaceSideEm:function(comments){for(var i=0;i<comments.length;i++){var $comment=$(comments[i]);$comment.html(Util.replaceEmString($comment.html()))}},buildTags:function(id){id=id||"tags";var classes=["tags1","tags2","tags3","tags4","tags5"],bList=$("#"+id+" b").get();var max=parseInt($("#"+id+" b").last().text());var distance=Math.ceil(max/classes.length);for(var i=0;i<bList.length;i++){var num=parseInt(bList[i].innerHTML);for(var j=0;j<classes.length;j++){if(num>j*distance&&num<=(j+1)*distance){bList[i].parentNode.className=classes[j];break}}}$("#"+id).html($("#"+id+" li").get().sort(function(a,b){var valA=$(a).find("span").text().toLowerCase();var valB=$(b).find("span").text().toLowerCase();return valA.localeCompare(valB)}))},toDate:function(time,format){var dateTime=new Date(time);var o={"M+":dateTime.getMonth()+1,"d+":dateTime.getDate(),"H+":dateTime.getHours(),"m+":dateTime.getMinutes(),"s+":dateTime.getSeconds(),"q+":Math.floor((dateTime.getMonth()+3)/3),S:dateTime.getMilliseconds()};if(/(y+)/.test(format)){format=format.replace(RegExp.$1,(dateTime.getFullYear()+"").substr(4-RegExp.$1.length))}for(var k in o){if(new RegExp("("+k+")").test(format)){format=format.replace(RegExp.$1,RegExp.$1.length==1?o[k]:("00"+o[k]).substr((""+o[k]).length))}}return format},getWinHeight:function(){if(window.innerHeight){return window.innerHeight}if(document.compatMode==="CSS1Compat"){return window.document.documentElement.clientHeight}return window.document.body.clientHeight}};if(!Cookie){var Cookie={readCookie:function(name){var nameEQ=name+"=";var ca=document.cookie.split(";");for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==" "){c=c.substring(1,c.length)}if(c.indexOf(nameEQ)==0){return decodeURIComponent(c.substring(nameEQ.length,c.length))}}return""},eraseCookie:function(name){this.createCookie(name,"",-1)},createCookie:function(name,value,days){var expires="";if(days){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));expires="; expires="+date.toGMTString()}document.cookie=name+"="+encodeURIComponent(value)+expires+"; path=/"}}}; var Util={isLoggedIn:function(){if(($("#admin").length===1&&$("#admin").data("login"))||latkeConfig.isLoggedIn==="true"){return true}else{return false}},getUserName:function(){if($("#adminName").length===1){return $("#adminName").text()}else{return latkeConfig.userName}},error:function(){$("#tipMsg").text("Error: "+arguments[0]+" File: "+arguments[1]+"\nLine: "+arguments[2]+" please report this issue on https://github.com/b3log/solo/issues/new");$("#loadMsg").text("")},killIE:function(){var addKillPanel=function(){if(Cookie.readCookie("showKill")===""){var left=($(window).width()-701)/2,top1=($(window).height()-420)/2;$("body").append("<div style='display: block; height: 100%; width: 100%; position: fixed; background-color: rgb(0, 0, 0); opacity: 0.6; top: 0px;z-index:11'></div><iframe style='left:"+left+"px;z-index:20;top: "+top1+"px; position: fixed; border: 0px none; width: 701px; height: 420px;' src='"+latkeConfig.servePath+"/kill-browser'></iframe>")}};if($.browser.msie){if($.browser.version==="6.0"||$.browser.version==="7.0"){addKillPanel();return}if(window.external&&window.external.twGetRunPath){var path=external.twGetRunPath();if(path&&path.toLowerCase().indexOf("360se")>-1&&window.location.href.indexOf("admin-index")>-1){addKillPanel();return}}}},replaceEmString:function(str){var commentSplited=str.split("[em");if(commentSplited.length===1){return str}str=commentSplited[0];for(var j=1;j<commentSplited.length;j++){var key=commentSplited[j].substr(0,2);str+="<img width='20' src='"+latkeConfig.staticServePath+"/images/emotions/em"+key+".png' alt='"+Label["em"+key+"Label"]+"' title='"+Label["em"+key+"Label"]+"'/> "+commentSplited[j].substr(3)}return str},proessURL:function(url){if(!/^\w+:\/\//.test(url)){url="http://"+url}return url},switchMobile:function(skin){Cookie.createCookie("btouch_switch_toggle",skin,365);setTimeout(function(){location.reload()},1250)},setTopBar:function(){var $top=$("#top");if($top.length===1){var $showTop=$("#showTop");$showTop.click(function(){$top.slideDown();$showTop.hide()});$("#hideTop").click(function(){$top.slideUp();$showTop.show()})}},goTop:function(){$("html, body").animate({scrollTop:0},800)},goBottom:function(bottom){if(!bottom){bottom=0}var wHeight=$("body").height()>$(document).height()?$("body").height():$(document).height();window.scrollTo(0,wHeight-$(window).height()-bottom)},init:function(){Util.killIE();Util.setTopBar()},replaceSideEm:function(comments){for(var i=0;i<comments.length;i++){var $comment=$(comments[i]);$comment.html(Util.replaceEmString($comment.html()))}},buildTags:function(id){id=id||"tags";var classes=["tags1","tags2","tags3","tags4","tags5"],bList=$("#"+id+" b").get();var max=parseInt($("#"+id+" b").last().text());var distance=Math.ceil(max/classes.length);for(var i=0;i<bList.length;i++){var num=parseInt(bList[i].innerHTML);for(var j=0;j<classes.length;j++){if(num>j*distance&&num<=(j+1)*distance){bList[i].parentNode.className=classes[j];break}}}$("#"+id).html($("#"+id+" li").get().sort(function(a,b){var valA=$(a).find("span").text().toLowerCase();var valB=$(b).find("span").text().toLowerCase();return valA.localeCompare(valB)}))},toDate:function(time,format){var dateTime=new Date(time);var o={"M+":dateTime.getMonth()+1,"d+":dateTime.getDate(),"H+":dateTime.getHours(),"m+":dateTime.getMinutes(),"s+":dateTime.getSeconds(),"q+":Math.floor((dateTime.getMonth()+3)/3),S:dateTime.getMilliseconds()};if(/(y+)/.test(format)){format=format.replace(RegExp.$1,(dateTime.getFullYear()+"").substr(4-RegExp.$1.length))}for(var k in o){if(new RegExp("("+k+")").test(format)){format=format.replace(RegExp.$1,RegExp.$1.length==1?o[k]:("00"+o[k]).substr((""+o[k]).length))}}return format},getWinHeight:function(){if(window.innerHeight){return window.innerHeight}if(document.compatMode==="CSS1Compat"){return window.document.documentElement.clientHeight}return window.document.body.clientHeight}};if(!Cookie){var Cookie={readCookie:function(name){var nameEQ=name+"=";var ca=document.cookie.split(";");for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==" "){c=c.substring(1,c.length)}if(c.indexOf(nameEQ)==0){return decodeURIComponent(c.substring(nameEQ.length,c.length))}}return""},eraseCookie:function(name){this.createCookie(name,"",-1)},createCookie:function(name,value,days){var expires="";if(days){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));expires="; expires="+date.toGMTString()}document.cookie=name+"="+encodeURIComponent(value)+expires+"; path=/"}}};
\ No newline at end of file
...@@ -377,7 +377,8 @@ $.extend(Page.prototype, { ...@@ -377,7 +377,8 @@ $.extend(Page.prototype, {
dataType: "script", dataType: "script",
cache: true, cache: true,
success: function () { success: function () {
hljs.initHighlightingOnLoad(); hljs.initHighlighting.called = false;
hljs.initHighlighting();
} }
}); });
......
/*
* Copyright (c) 2010-2017, b3log.org & hacpai.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var Page=function(tips){this.currentCommentId="";this.tips=tips};$.extend(Page.prototype,{insertEmotions:function(name){var _it=this;if(name===undefined){name=""}$("#emotions"+name+" span").click(function(){var $comment=$("#comment"+name);var endPosition=_it._getCursorEndPosition($comment[0]);var key=this.title+" ",textValue=$comment[0].value;textValue=textValue.substring(0,endPosition)+key+textValue.substring(endPosition,textValue.length);$("#comment"+name).val(textValue);if($.browser.msie){endPosition-=textValue.split("\n").length-1;var oR=$comment[0].createTextRange();oR.collapse(true);oR.moveStart("character",endPosition+key.length);oR.select()}else{$comment[0].setSelectionRange(endPosition+key.length,endPosition+key.length)}})},_getCursorEndPosition:function(textarea){textarea.focus();if(textarea.setSelectionRange){return textarea.selectionEnd}else{if(document.selection){var i=0,oS=document.selection.createRange(),oR=document.body.createTextRange();oR.moveToElementText(textarea);oS.getBookmark();for(i=0;oR.compareEndPoints("StartToStart",oS)<0&&oS.moveStart("character",-1)!==0;i++){if(textarea.value.charAt(i)==="\n"){i++}}return i}}},validateComment:function(state){if(Util.isLoggedIn()){var commenterContent=$("#comment"+state).val().replace(/(^\s*)|(\s*$)/g,"");if(2>commenterContent.length||commenterContent.length>500){$("#commentErrorTip"+state).html(this.tips.commentContentCannotEmptyLabel);$("#comment"+state).focus()}else{return true}$("#commentErrorTip"+state).show();return false}var commentName=$("#commentName"+state).val().replace(/(^\s*)|(\s*$)/g,""),commenterContent=$("#comment"+state).val().replace(/(^\s*)|(\s*$)/g,"");if(2>commentName.length||commentName.length>20){$("#commentErrorTip"+state).html(this.tips.nameTooLongLabel);$("#commentName"+state).focus()}else{if($("#commentEmail"+state).val().replace(/\s/g,"")===""){$("#commentErrorTip"+state).html(this.tips.mailCannotEmptyLabel);$("#commentEmail"+state).focus()}else{if(!/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test($("#commentEmail"+state).val())){$("#commentErrorTip"+state).html(this.tips.mailInvalidLabel);$("#commentEmail"+state).focus()}else{if(2>commenterContent.length||commenterContent.length>500){$("#commentErrorTip"+state).html(this.tips.commentContentCannotEmptyLabel);$("#comment"+state).focus()}else{if($("#commentValidate"+state).val().replace(/\s/g,"")===""){$("#commentErrorTip"+state).html(this.tips.captchaCannotEmptyLabel);$("#commentValidate"+state).focus()}else{return true}}}}}$("#commentErrorTip"+state).show();return false},replaceCommentsEm:function(selector){var $commentContents=$(selector);for(var i=0;i<$commentContents.length;i++){var str=$commentContents[i].innerHTML;$commentContents[i].innerHTML=Util.replaceEmString(str)}},_initSyntaxHighlighter:function(languages){for(var i=0;i<languages.length;i++){switch(languages[i]){case"groovy":languages[i]="groovy "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushGroovy.js";break;case"java":languages[i]="java "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushJava.js";break;case"php":languages[i]="php "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushPhp.js";break;case"scala":languages[i]="scala "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushScala.js";break;case"sql":languages[i]="sql "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushSql.js";break;case"applescript":languages[i]="applescript "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushAppleScript.js";break;case"as3":case"actionscript3":languages[i]="actionscript3 as3 "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushAS3.js";break;case"bash":case"shell":languages[i]="bash shell "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushBash.js";break;case"coldfusion":case"cf":languages[i]="coldfusion cf "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushColdFusion.js";break;case"c#":case"c-sharp":case"csharp":languages[i]="c# c-sharp csharp "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushCSharp.js";break;case"cpp":case"c":languages[i]="cpp c "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushCpp.js";break;case"css":languages[i]="css "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushCss.js";break;case"delphi":case"pascal":languages[i]="delphi pascal "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushDelphi.js";break;case"diff":case"patch":case"pas":languages[i]="diff patch pas "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushDiff.js";break;case"erl":case"erlang":languages[i]="erl erlang "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushErlang.js";break;case"js":case"jscript":case"javascript":languages[i]="js jscript javascript "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushJScript.js";break;case"jfx":case"javafx":languages[i]="jfx javafx "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushJavaFX.js";break;case"perl":case"pl":languages[i]="perl pl "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushPerl.js";break;case"plain":case"text":languages[i]="text plain "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushPlain.js";break;case"ps":case"powershell":languages[i]="ps powershell "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushPowerShell.js";break;case"py":case"python":languages[i]="py python "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushPython.js";break;case"rails":case"ror":case"ruby":case"rb":languages[i]="ruby rails ror rb "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushRuby.js";break;case"sass":case"scss":languages[i]="sass scss "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushSass.js";break;case"vb":case"vbnet":languages[i]="vb vbnet "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushVb.js";break;case"xml":case"xhtml":case"xslt":case"html":languages[i]="xml xhtml xslt html "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushXml.js";break;default:break}}SyntaxHighlighter.autoloader.apply(null,languages);SyntaxHighlighter.config.stripBrs=true;SyntaxHighlighter.all()},_loadSyntaxHighlighter:function(SHTheme){var cssName=SHTheme?SHTheme:"shCoreEclipse",that=this;if(document.createStyleSheet){document.createStyleSheet(latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/styles/"+cssName+".css")}else{$("head").append($("<link rel='stylesheet' href='"+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/styles/"+cssName+".css' type='text/css' charset='utf-8' />"))}$.ajax({url:latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shCore.js",dataType:"script",cache:true,success:function(){var languages=[],isScrip=false;$(".article-body pre, .code-highlight pre").each(function(){var name=this.className.split(";")[0];var language=name.substr(7,name.length-1);if(this.className.indexOf("html-script: true")>-1&&(language!=="xml"&&language!=="xhtml"&&language!=="xslt"&&language!="html")){isScrip=true}languages.push(language)});if(isScrip){$.ajax({url:latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushXml.js",dataType:"script",cache:true,success:function(){that._initSyntaxHighlighter(languages)}})}else{that._initSyntaxHighlighter(languages)}}})},parseLanguage:function(obj){var isPrettify=false,isSH=false;$(".article-body pre, .code-highlight pre").each(function(){if(this.className.indexOf("brush")>-1){isSH=true}if(this.className.indexOf("prettyprint")>-1){isPrettify=true}});if(isSH){this._loadSyntaxHighlighter(obj?(obj.SHTheme?obj.SHTheme:undefined):undefined);return false}if(isPrettify){if(document.createStyleSheet){document.createStyleSheet(latkeConfig.staticServePath+"/js/lib/google-code-prettify/prettify.css")}else{$("head").append($("<link rel='stylesheet' href='"+latkeConfig.staticServePath+"/js/lib/google-code-prettify/prettify.css'>"))}$.ajax({url:latkeConfig.staticServePath+"/js/lib/google-code-prettify/prettify.js",dataType:"script",cache:true,success:function(){prettyPrint()}});return false}if(document.createStyleSheet){document.createStyleSheet(latkeConfig.staticServePath+"/js/lib/highlight.js-9.6.0/styles/default.css")}else{$("head").append($("<link rel='stylesheet' href='"+latkeConfig.staticServePath+"/js/lib/highlight.js-9.6.0/styles/github.css'>"))}$.ajax({url:latkeConfig.staticServePath+"/js/lib/highlight.js-9.6.0/highlight.pack.js",dataType:"script",cache:true,success:function(){hljs.initHighlightingOnLoad()}})},load:function(obj){var that=this;that.insertEmotions();that.parseLanguage(obj?(obj.language?obj.language:undefined):undefined);$("#commentValidate").keypress(function(event){if(event.keyCode===13){that.submitComment()}});$("#comment").keypress(function(event){if(event.keyCode===13&&event.ctrlKey){that.submitComment()}});$("#captcha").click(function(){$(this).attr("src",latkeConfig.servePath+"/captcha.do?code="+Math.random())});if(!Util.isLoggedIn()){$("#commentEmail").val(Cookie.readCookie("commentEmail"));$("#commentURL").val(Cookie.readCookie("commentURL"));$("#commentName").val(Cookie.readCookie("commentName"))}try{JSON}catch(e){document.write('<script src="'+latkeConfig.staticServePath+'/js/lib/json2.js"><\/script>')}},loadRandomArticles:function(headTitle){var randomArticles1Label=this.tips.randomArticles1Label;$.ajax({url:latkeConfig.servePath+"/get-random-articles.do",type:"POST",success:function(result,textStatus){var randomArticles=result.randomArticles;if(!randomArticles||0===randomArticles.length){$("#randomArticles").remove();return}var listHtml="";for(var i=0;i<randomArticles.length;i++){var article=randomArticles[i];var title=article.articleTitle;var randomArticleLiHtml="<li><a rel='nofollow' title='"+title+"' href='"+latkeConfig.servePath+article.articlePermalink+"'>"+title+"</a></li>";listHtml+=randomArticleLiHtml}var titleHTML=headTitle?headTitle:"<h4>"+randomArticles1Label+"</h4>";var randomArticleListHtml=titleHTML+"<ul class='marginLeft12'>"+listHtml+"</ul>";$("#randomArticles").append(randomArticleListHtml)}})},loadRelevantArticles:function(id,headTitle){$.ajax({url:latkeConfig.servePath+"/article/id/"+id+"/relevant/articles",type:"GET",success:function(data,textStatus){var articles=data.relevantArticles;if(!articles||0===articles.length){$("#relevantArticles").remove();return}var listHtml="";for(var i=0;i<articles.length;i++){var article=articles[i];var title=article.articleTitle;var articleLiHtml="<li><a rel='nofollow' title='"+title+"' href='"+latkeConfig.servePath+article.articlePermalink+"'>"+title+"</a></li>";listHtml+=articleLiHtml}var relevantArticleListHtml=headTitle+"<ul class='marginLeft12'>"+listHtml+"</ul>";$("#relevantArticles").append(relevantArticleListHtml)},error:function(){$("#relevantArticles").remove()}})},loadExternalRelevantArticles:function(tags,headTitle){var tips=this.tips;try{$.ajax({url:"https://rhythm.b3log.org/get-articles-by-tags.do?tags="+tags+"&blogHost="+tips.blogHost+"&paginationPageSize="+tips.externalRelevantArticlesDisplayCount,type:"GET",cache:true,dataType:"jsonp",error:function(){$("#externalRelevantArticles").remove()},success:function(data,textStatus){var articles=data.articles;if(!articles||0===articles.length){$("#externalRelevantArticles").remove();return}var listHtml="";for(var i=0;i<articles.length;i++){var article=articles[i];var title=article.articleTitle;var articleLiHtml="<li><a rel='nofollow' title='"+title+"' target='_blank' href='"+article.articlePermalink+"'>"+title+"</a></li>";listHtml+=articleLiHtml}var titleHTML=headTitle?headTitle:"<h4>"+tips.externalRelevantArticles1Label+"</h4>";var randomArticleListHtml=titleHTML+"<ul class='marginLeft12'>"+listHtml+"</ul>";$("#externalRelevantArticles").append(randomArticleListHtml)}})}catch(e){}},submitComment:function(commentId,state){if(!state){state=""}var that=this,tips=this.tips,type="article";if(tips.externalRelevantArticlesDisplayCount===undefined){type="page"}if(this.validateComment(state)){$("#submitCommentButton"+state).attr("disabled","disabled");$("#commentErrorTip"+state).show().html(this.tips.loadingLabel);var requestJSONObject={oId:tips.oId,commentContent:$("#comment"+state).val().replace(/(^\s*)|(\s*$)/g,"")};if(!Util.isLoggedIn()){requestJSONObject={oId:tips.oId,commentContent:$("#comment"+state).val().replace(/(^\s*)|(\s*$)/g,""),commentEmail:$("#commentEmail"+state).val(),commentURL:Util.proessURL($("#commentURL"+state).val().replace(/(^\s*)|(\s*$)/g,"")),commentName:$("#commentName"+state).val().replace(/(^\s*)|(\s*$)/g,""),captcha:$("#commentValidate"+state).val()};Cookie.createCookie("commentName",requestJSONObject.commentName,365);Cookie.createCookie("commentEmail",requestJSONObject.commentEmail,365);Cookie.createCookie("commentURL",$("#commentURL"+state).val().replace(/(^\s*)|(\s*$)/g,""),365)}if(state==="Reply"){requestJSONObject.commentOriginalCommentId=commentId}$.ajax({type:"POST",url:latkeConfig.servePath+"/add-"+type+"-comment.do",cache:false,contentType:"application/json",data:JSON.stringify(requestJSONObject),success:function(result){$("#submitCommentButton"+state).removeAttr("disabled");if(!result.sc){$("#commentErrorTip"+state).html(result.msg);$("#commentValidate"+state).val("");$("#captcha"+state).click();if(!Util.isLoggedIn()){$("#captcha"+state).attr("src",latkeConfig.servePath+"/captcha.do?code="+Math.random())}return}$("#comment"+state).val(result.commentContent);$("#commentName"+state).val(result.commentName);result.replyNameHTML="";if(!Util.isLoggedIn()){$("#captcha"+state).attr("src",latkeConfig.servePath+"/captcha.do?code="+Math.random());if($("#commentURL"+state).val().replace(/\s/g,"")===""){result.replyNameHTML="<a>"+$("#commentName"+state).val()+"</a>"}else{result.replyNameHTML='<a href="'+Util.proessURL($("#commentURL"+state).val())+'" target="_blank">'+$("#commentName"+state).val()+"</a>"}result.userName=result.commentName}else{result.replyNameHTML='<a href="'+window.location.host+'" target="_blank">'+Util.getUserName()+"</a>";result.userName=Util.getUserName()}that.addCommentAjax(Util.replaceEmString(result.cmtTpl),state)}})}},addReplyForm:function(id,commentFormHTML,endHTML){var that=this;if(id===this.currentCommentId){if($("#commentNameReply").val()===""){$("#commentNameReply").focus()}else{if($("#commentEmailReply").val()===""){$("#commentEmailReply").focus()}else{$("#commentReply").focus()}}return}$("#replyForm").remove();endHTML=endHTML?endHTML:"";if(endHTML==="</div>"){$("#"+id).append(commentFormHTML+$("#commentForm").html()+endHTML)}else{$("#"+id).append(commentFormHTML+$("#commentForm").html()+"</table>"+endHTML)}$("#replyForm input, #replyForm textarea").each(function(){this.id=this.id+"Reply"});$("#commentNameReply").val(Cookie.readCookie("commentName"));$("#commentEmailReply").val(Cookie.readCookie("commentEmail"));var $label=$("#replyForm #commentURLLabel");if($label.length===1){$label.attr("id","commentURLLabelReply")}$("#commentURLReply").val(Cookie.readCookie("commentURL"));$("#replyForm #emotions").attr("id","emotionsReply");this.insertEmotions("Reply");$("#commentReply").unbind().keypress(function(event){if(event.keyCode===13&&event.ctrlKey){that.submitComment(id,"Reply");event.preventDefault()}});$("#commentValidateReply").unbind().keypress(function(event){if(event.keyCode===13){that.submitComment(id,"Reply");event.preventDefault()}});$("#replyForm #captcha").attr("id","captchaReply").attr("src",latkeConfig.servePath+"/captcha.do?"+new Date().getTime()).click(function(){$(this).attr("src",latkeConfig.servePath+"/captcha.do?code="+Math.random())});$("#replyForm #commentErrorTip").attr("id","commentErrorTipReply").html("").hide();$("#replyForm #submitCommentButton").attr("id","submitCommentButtonReply");$("#replyForm #submitCommentButtonReply").unbind("click").removeAttr("onclick").click(function(){that.submitComment(id,"Reply")});if($("#commentNameReply").val()===""){$("#commentNameReply").focus()}else{if($("#commentEmailReply").val()===""){$("#commentEmailReply").focus()}else{$("#commentReply").focus()}}this.currentCommentId=id},hideComment:function(id){$("#commentRef"+id).hide()},showComment:function(it,id,top,parentTag){var positionTop=parseInt($(it).position().top);if(parentTag){positionTop=parseInt($(it).parents(parentTag).position().top)}if($("#commentRef"+id).length>0){$("#commentRef"+id).show().css("top",(positionTop+top)+"px")}else{var $refComment=$("#"+id).clone();$refComment.addClass("comment-body-ref").attr("id","commentRef"+id);$refComment.find("#replyForm").remove();$("#comments").append($refComment);$("#commentRef"+id).css("top",(positionTop+top)+"px")}},addCommentAjax:function(commentHTML,state){if($("#comments").children().length>0){$($("#comments").children()[0]).before(commentHTML)}else{$("#comments").html(commentHTML)}if(state===""){$("#commentErrorTip").html("").hide();$("#comment").val("");$("#commentValidate").val("");$("#captcha").attr("src",latkeConfig.servePath+"/captcha.do?code="+Math.random())}else{$("#replyForm").remove()}window.location.hash="#comments"}}); var Page=function(tips){this.currentCommentId="";this.tips=tips};$.extend(Page.prototype,{insertEmotions:function(name){var _it=this;if(name===undefined){name=""}$("#emotions"+name+" span").click(function(){var $comment=$("#comment"+name);var endPosition=_it._getCursorEndPosition($comment[0]);var key=this.title+" ",textValue=$comment[0].value;textValue=textValue.substring(0,endPosition)+key+textValue.substring(endPosition,textValue.length);$("#comment"+name).val(textValue);if($.browser.msie){endPosition-=textValue.split("\n").length-1;var oR=$comment[0].createTextRange();oR.collapse(true);oR.moveStart("character",endPosition+key.length);oR.select()}else{$comment[0].setSelectionRange(endPosition+key.length,endPosition+key.length)}})},_getCursorEndPosition:function(textarea){textarea.focus();if(textarea.setSelectionRange){return textarea.selectionEnd}else{if(document.selection){var i=0,oS=document.selection.createRange(),oR=document.body.createTextRange();oR.moveToElementText(textarea);oS.getBookmark();for(i=0;oR.compareEndPoints("StartToStart",oS)<0&&oS.moveStart("character",-1)!==0;i++){if(textarea.value.charAt(i)==="\n"){i++}}return i}}},validateComment:function(state){if(Util.isLoggedIn()){var commenterContent=$("#comment"+state).val().replace(/(^\s*)|(\s*$)/g,"");if(2>commenterContent.length||commenterContent.length>500){$("#commentErrorTip"+state).html(this.tips.commentContentCannotEmptyLabel);$("#comment"+state).focus()}else{return true}$("#commentErrorTip"+state).show();return false}var commentName=$("#commentName"+state).val().replace(/(^\s*)|(\s*$)/g,""),commenterContent=$("#comment"+state).val().replace(/(^\s*)|(\s*$)/g,"");if(2>commentName.length||commentName.length>20){$("#commentErrorTip"+state).html(this.tips.nameTooLongLabel);$("#commentName"+state).focus()}else{if($("#commentEmail"+state).val().replace(/\s/g,"")===""){$("#commentErrorTip"+state).html(this.tips.mailCannotEmptyLabel);$("#commentEmail"+state).focus()}else{if(!/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test($("#commentEmail"+state).val())){$("#commentErrorTip"+state).html(this.tips.mailInvalidLabel);$("#commentEmail"+state).focus()}else{if(2>commenterContent.length||commenterContent.length>500){$("#commentErrorTip"+state).html(this.tips.commentContentCannotEmptyLabel);$("#comment"+state).focus()}else{if($("#commentValidate"+state).val().replace(/\s/g,"")===""){$("#commentErrorTip"+state).html(this.tips.captchaCannotEmptyLabel);$("#commentValidate"+state).focus()}else{return true}}}}}$("#commentErrorTip"+state).show();return false},replaceCommentsEm:function(selector){var $commentContents=$(selector);for(var i=0;i<$commentContents.length;i++){var str=$commentContents[i].innerHTML;$commentContents[i].innerHTML=Util.replaceEmString(str)}},_initSyntaxHighlighter:function(languages){for(var i=0;i<languages.length;i++){switch(languages[i]){case"groovy":languages[i]="groovy "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushGroovy.js";break;case"java":languages[i]="java "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushJava.js";break;case"php":languages[i]="php "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushPhp.js";break;case"scala":languages[i]="scala "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushScala.js";break;case"sql":languages[i]="sql "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushSql.js";break;case"applescript":languages[i]="applescript "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushAppleScript.js";break;case"as3":case"actionscript3":languages[i]="actionscript3 as3 "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushAS3.js";break;case"bash":case"shell":languages[i]="bash shell "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushBash.js";break;case"coldfusion":case"cf":languages[i]="coldfusion cf "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushColdFusion.js";break;case"c#":case"c-sharp":case"csharp":languages[i]="c# c-sharp csharp "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushCSharp.js";break;case"cpp":case"c":languages[i]="cpp c "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushCpp.js";break;case"css":languages[i]="css "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushCss.js";break;case"delphi":case"pascal":languages[i]="delphi pascal "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushDelphi.js";break;case"diff":case"patch":case"pas":languages[i]="diff patch pas "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushDiff.js";break;case"erl":case"erlang":languages[i]="erl erlang "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushErlang.js";break;case"js":case"jscript":case"javascript":languages[i]="js jscript javascript "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushJScript.js";break;case"jfx":case"javafx":languages[i]="jfx javafx "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushJavaFX.js";break;case"perl":case"pl":languages[i]="perl pl "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushPerl.js";break;case"plain":case"text":languages[i]="text plain "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushPlain.js";break;case"ps":case"powershell":languages[i]="ps powershell "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushPowerShell.js";break;case"py":case"python":languages[i]="py python "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushPython.js";break;case"rails":case"ror":case"ruby":case"rb":languages[i]="ruby rails ror rb "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushRuby.js";break;case"sass":case"scss":languages[i]="sass scss "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushSass.js";break;case"vb":case"vbnet":languages[i]="vb vbnet "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushVb.js";break;case"xml":case"xhtml":case"xslt":case"html":languages[i]="xml xhtml xslt html "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushXml.js";break;default:break}}SyntaxHighlighter.autoloader.apply(null,languages);SyntaxHighlighter.config.stripBrs=true;SyntaxHighlighter.all()},_loadSyntaxHighlighter:function(SHTheme){var cssName=SHTheme?SHTheme:"shCoreEclipse",that=this;if(document.createStyleSheet){document.createStyleSheet(latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/styles/"+cssName+".css")}else{$("head").append($("<link rel='stylesheet' href='"+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/styles/"+cssName+".css' type='text/css' charset='utf-8' />"))}$.ajax({url:latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shCore.js",dataType:"script",cache:true,success:function(){var languages=[],isScrip=false;$(".article-body pre, .code-highlight pre").each(function(){var name=this.className.split(";")[0];var language=name.substr(7,name.length-1);if(this.className.indexOf("html-script: true")>-1&&(language!=="xml"&&language!=="xhtml"&&language!=="xslt"&&language!="html")){isScrip=true}languages.push(language)});if(isScrip){$.ajax({url:latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushXml.js",dataType:"script",cache:true,success:function(){that._initSyntaxHighlighter(languages)}})}else{that._initSyntaxHighlighter(languages)}}})},parseLanguage:function(obj){var isPrettify=false,isSH=false;$(".article-body pre, .code-highlight pre").each(function(){if(this.className.indexOf("brush")>-1){isSH=true}if(this.className.indexOf("prettyprint")>-1){isPrettify=true}});if(isSH){this._loadSyntaxHighlighter(obj?(obj.SHTheme?obj.SHTheme:undefined):undefined);return false}if(isPrettify){if(document.createStyleSheet){document.createStyleSheet(latkeConfig.staticServePath+"/js/lib/google-code-prettify/prettify.css")}else{$("head").append($("<link rel='stylesheet' href='"+latkeConfig.staticServePath+"/js/lib/google-code-prettify/prettify.css'>"))}$.ajax({url:latkeConfig.staticServePath+"/js/lib/google-code-prettify/prettify.js",dataType:"script",cache:true,success:function(){prettyPrint()}});return false}if(document.createStyleSheet){document.createStyleSheet(latkeConfig.staticServePath+"/js/lib/highlight.js-9.6.0/styles/default.css")}else{$("head").append($("<link rel='stylesheet' href='"+latkeConfig.staticServePath+"/js/lib/highlight.js-9.6.0/styles/github.css'>"))}$.ajax({url:latkeConfig.staticServePath+"/js/lib/highlight.js-9.6.0/highlight.pack.js",dataType:"script",cache:true,success:function(){hljs.initHighlightingOnLoad()}})},load:function(obj){var that=this;that.insertEmotions();that.parseLanguage(obj?(obj.language?obj.language:undefined):undefined);$("#commentValidate").keypress(function(event){if(event.keyCode===13){that.submitComment()}});$("#comment").keypress(function(event){if(event.keyCode===13&&event.ctrlKey){that.submitComment()}});$("#captcha").click(function(){$(this).attr("src",latkeConfig.servePath+"/captcha.do?code="+Math.random())});if(!Util.isLoggedIn()){$("#commentEmail").val(Cookie.readCookie("commentEmail"));$("#commentURL").val(Cookie.readCookie("commentURL"));$("#commentName").val(Cookie.readCookie("commentName"))}try{JSON}catch(e){document.write('<script src="'+latkeConfig.staticServePath+'/js/lib/json2.js"><\/script>')}},loadRandomArticles:function(headTitle){var randomArticles1Label=this.tips.randomArticles1Label;$.ajax({url:latkeConfig.servePath+"/get-random-articles.do",type:"POST",success:function(result,textStatus){var randomArticles=result.randomArticles;if(!randomArticles||0===randomArticles.length){$("#randomArticles").remove();return}var listHtml="";for(var i=0;i<randomArticles.length;i++){var article=randomArticles[i];var title=article.articleTitle;var randomArticleLiHtml="<li><a rel='nofollow' title='"+title+"' href='"+latkeConfig.servePath+article.articlePermalink+"'>"+title+"</a></li>";listHtml+=randomArticleLiHtml}var titleHTML=headTitle?headTitle:"<h4>"+randomArticles1Label+"</h4>";var randomArticleListHtml=titleHTML+"<ul class='marginLeft12'>"+listHtml+"</ul>";$("#randomArticles").append(randomArticleListHtml)}})},loadRelevantArticles:function(id,headTitle){$.ajax({url:latkeConfig.servePath+"/article/id/"+id+"/relevant/articles",type:"GET",success:function(data,textStatus){var articles=data.relevantArticles;if(!articles||0===articles.length){$("#relevantArticles").remove();return}var listHtml="";for(var i=0;i<articles.length;i++){var article=articles[i];var title=article.articleTitle;var articleLiHtml="<li><a rel='nofollow' title='"+title+"' href='"+latkeConfig.servePath+article.articlePermalink+"'>"+title+"</a></li>";listHtml+=articleLiHtml}var relevantArticleListHtml=headTitle+"<ul class='marginLeft12'>"+listHtml+"</ul>";$("#relevantArticles").append(relevantArticleListHtml)},error:function(){$("#relevantArticles").remove()}})},loadExternalRelevantArticles:function(tags,headTitle){var tips=this.tips;try{$.ajax({url:"https://rhythm.b3log.org/get-articles-by-tags.do?tags="+tags+"&blogHost="+tips.blogHost+"&paginationPageSize="+tips.externalRelevantArticlesDisplayCount,type:"GET",cache:true,dataType:"jsonp",error:function(){$("#externalRelevantArticles").remove()},success:function(data,textStatus){var articles=data.articles;if(!articles||0===articles.length){$("#externalRelevantArticles").remove();return}var listHtml="";for(var i=0;i<articles.length;i++){var article=articles[i];var title=article.articleTitle;var articleLiHtml="<li><a rel='nofollow' title='"+title+"' target='_blank' href='"+article.articlePermalink+"'>"+title+"</a></li>";listHtml+=articleLiHtml}var titleHTML=headTitle?headTitle:"<h4>"+tips.externalRelevantArticles1Label+"</h4>";var randomArticleListHtml=titleHTML+"<ul class='marginLeft12'>"+listHtml+"</ul>";$("#externalRelevantArticles").append(randomArticleListHtml)}})}catch(e){}},submitComment:function(commentId,state){if(!state){state=""}var that=this,tips=this.tips,type="article";if(tips.externalRelevantArticlesDisplayCount===undefined){type="page"}if(this.validateComment(state)){$("#submitCommentButton"+state).attr("disabled","disabled");$("#commentErrorTip"+state).show().html(this.tips.loadingLabel);var requestJSONObject={oId:tips.oId,commentContent:$("#comment"+state).val().replace(/(^\s*)|(\s*$)/g,"")};if(!Util.isLoggedIn()){requestJSONObject={oId:tips.oId,commentContent:$("#comment"+state).val().replace(/(^\s*)|(\s*$)/g,""),commentEmail:$("#commentEmail"+state).val(),commentURL:Util.proessURL($("#commentURL"+state).val().replace(/(^\s*)|(\s*$)/g,"")),commentName:$("#commentName"+state).val().replace(/(^\s*)|(\s*$)/g,""),captcha:$("#commentValidate"+state).val()};Cookie.createCookie("commentName",requestJSONObject.commentName,365);Cookie.createCookie("commentEmail",requestJSONObject.commentEmail,365);Cookie.createCookie("commentURL",$("#commentURL"+state).val().replace(/(^\s*)|(\s*$)/g,""),365)}if(state==="Reply"){requestJSONObject.commentOriginalCommentId=commentId}$.ajax({type:"POST",url:latkeConfig.servePath+"/add-"+type+"-comment.do",cache:false,contentType:"application/json",data:JSON.stringify(requestJSONObject),success:function(result){$("#submitCommentButton"+state).removeAttr("disabled");if(!result.sc){$("#commentErrorTip"+state).html(result.msg);$("#commentValidate"+state).val("");$("#captcha"+state).click();if(!Util.isLoggedIn()){$("#captcha"+state).attr("src",latkeConfig.servePath+"/captcha.do?code="+Math.random())}return}$("#comment"+state).val(result.commentContent);$("#commentName"+state).val(result.commentName);result.replyNameHTML="";if(!Util.isLoggedIn()){$("#captcha"+state).attr("src",latkeConfig.servePath+"/captcha.do?code="+Math.random());if($("#commentURL"+state).val().replace(/\s/g,"")===""){result.replyNameHTML="<a>"+$("#commentName"+state).val()+"</a>"}else{result.replyNameHTML='<a href="'+Util.proessURL($("#commentURL"+state).val())+'" target="_blank">'+$("#commentName"+state).val()+"</a>"}result.userName=result.commentName}else{result.replyNameHTML='<a href="'+window.location.host+'" target="_blank">'+Util.getUserName()+"</a>";result.userName=Util.getUserName()}that.addCommentAjax(Util.replaceEmString(result.cmtTpl),state)}})}},addReplyForm:function(id,commentFormHTML,endHTML){var that=this;if(id===this.currentCommentId){if($("#commentNameReply").val()===""){$("#commentNameReply").focus()}else{if($("#commentEmailReply").val()===""){$("#commentEmailReply").focus()}else{$("#commentReply").focus()}}return}$("#replyForm").remove();endHTML=endHTML?endHTML:"";if(endHTML==="</div>"){$("#"+id).append(commentFormHTML+$("#commentForm").html()+endHTML)}else{$("#"+id).append(commentFormHTML+$("#commentForm").html()+"</table>"+endHTML)}$("#replyForm input, #replyForm textarea").each(function(){this.id=this.id+"Reply"});$("#commentNameReply").val(Cookie.readCookie("commentName"));$("#commentEmailReply").val(Cookie.readCookie("commentEmail"));var $label=$("#replyForm #commentURLLabel");if($label.length===1){$label.attr("id","commentURLLabelReply")}$("#commentURLReply").val(Cookie.readCookie("commentURL"));$("#replyForm #emotions").attr("id","emotionsReply");this.insertEmotions("Reply");$("#commentReply").unbind().keypress(function(event){if(event.keyCode===13&&event.ctrlKey){that.submitComment(id,"Reply");event.preventDefault()}});$("#commentValidateReply").unbind().keypress(function(event){if(event.keyCode===13){that.submitComment(id,"Reply");event.preventDefault()}});$("#replyForm #captcha").attr("id","captchaReply").attr("src",latkeConfig.servePath+"/captcha.do?"+new Date().getTime()).click(function(){$(this).attr("src",latkeConfig.servePath+"/captcha.do?code="+Math.random())});$("#replyForm #commentErrorTip").attr("id","commentErrorTipReply").html("").hide();$("#replyForm #submitCommentButton").attr("id","submitCommentButtonReply");$("#replyForm #submitCommentButtonReply").unbind("click").removeAttr("onclick").click(function(){that.submitComment(id,"Reply")});if($("#commentNameReply").val()===""){$("#commentNameReply").focus()}else{if($("#commentEmailReply").val()===""){$("#commentEmailReply").focus()}else{$("#commentReply").focus()}}this.currentCommentId=id},hideComment:function(id){$("#commentRef"+id).hide()},showComment:function(it,id,top,parentTag){var positionTop=parseInt($(it).position().top);if(parentTag){positionTop=parseInt($(it).parents(parentTag).position().top)}if($("#commentRef"+id).length>0){$("#commentRef"+id).show().css("top",(positionTop+top)+"px")}else{var $refComment=$("#"+id).clone();$refComment.addClass("comment-body-ref").attr("id","commentRef"+id);$refComment.find("#replyForm").remove();$("#comments").append($refComment);$("#commentRef"+id).css("top",(positionTop+top)+"px")}},addCommentAjax:function(commentHTML,state){if($("#comments").children().length>0){$($("#comments").children()[0]).before(commentHTML)}else{$("#comments").html(commentHTML)}if(state===""){$("#commentErrorTip").html("").hide();$("#comment").val("");$("#commentValidate").val("");$("#captcha").attr("src",latkeConfig.servePath+"/captcha.do?code="+Math.random())}else{$("#replyForm").remove()}window.location.hash="#comments"}});
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment