Commit b3b2b0ae authored by Vanessa's avatar Vanessa

add min css and js in workspace

parent 14019e4f
......@@ -143,7 +143,7 @@
<span style="color: orangered; font-weight: bold;">Solo</span></a>, ver ${version}
</div>
</div>
<script src="${staticServePath}/js/common.js"></script>
<script src="${staticServePath}/js/common${miniPostfix}.js"></script>
<#if "" == miniPostfix>
<script src="${staticServePath}/js/admin/admin.js"></script>
<script src="${staticServePath}/js/admin/editor.js"></script>
......
......@@ -18,12 +18,12 @@
* admin style
*
* @author <a href="mailto:LLY219@gmail.com">Liyuan Li</a>
* @version 1.0.3.9, Jun 26, 2012
* @version 1.0.4.0, Aug 27, 2012
*/
/* start resset */
body, input, textarea {
font-family: sans-serif,\5fae\8f6f\96c5\9ed1;
font-family: 'sans-serif','\5fae\8f6f\96c5\9ed1';
}
html, body {
height: 100%;
......
body,input,textarea{font-family:'sans-serif','\5fae\8f6f\96c5\9ed1';}
html,body{height:100%;min-width:1024px;background-color:#FAFAFA;}
a:link{color:#21759B;}
a:visited{color:#551A8B;}
a:active{color:#D54121;}
a:hover{color:#D54121;}
button.selected{background:url("../images/bowknot/completed.png") no-repeat scroll right bottom transparent;color:#D54121;}
.ico-arrow-down,.ico-arrow-up{background:url("../images/arrows.png") repeat scroll 0 4px transparent;float:right;height:20px;margin:2px 3px 0 0;width:18px;}
.ico-arrow-up{background-position:0 -30px;}
.aboutIcon{background-position:-16px -48px;}
#allPanel{height:auto;min-height:100%;position:relative;}
#tabsPanel{margin:30px 0 0 162px;padding:0 12px;}
#tabsPanel>div{padding-bottom:36px;}
.tip{font-weight:bold;margin:0 auto;overflow:hidden;padding:2px 0;position:fixed;text-align:center;top:5px;width:100%;z-index:2;}
.tip-msg{top:33px;}
#tipMsg,#loadMsg{background-color:#E5E7EB;border-radius:3px;padding:2px 0;}
.footer{bottom:12px;position:absolute;text-align:center;width:100%;}
#top{background-image:linear-gradient(top, #666666, #7f7f7f);background-image:-moz-linear-gradient(top, #666666, #7f7f7f);background-image:-ms-linear-gradient(top, #666666, #7f7f7f);background-image:-o-linear-gradient(top, #666666, #7f7f7f);background-image:-webkit-gradient(linear, left top, left bottom, from(#666666), to(#7f7f7f));filter:progid:dximagetransform.microsoft.gradient(startColorstr='#666666', endColorstr='#7F7F7F');}
#top a,#top span span{float:left;line-height:18px;margin:6px 0;padding:0 6px;text-decoration:none;text-shadow:0 -1px 0 #ffffff;font-weight:normal;border-right:1px solid #686868;color:#CCCCCC;text-shadow:0 -1px 0 #555555;}
#top>a{color:#FFFFFF;}
#top a:hover,#top a.hover{border-radius:0 13px 13px 0;margin:0px;line-height:30px;background-color:#4C4C4C;border-left-color:#707070;}
#tabs{background-color:#ECECEC;border-radius:0 5px 5px 0;border-right:1px solid #CCC;border-top:1px solid #DDD;bottom:0;box-shadow:6px 0 6px #ECECEC;min-height:468px;padding:15px 0;position:absolute;top:58px;width:145px;}
#tabs ul{list-style:none;}
#tabs li{margin-left:0px;}
#tabs a,#tabs>ul>li>div{color:#21759B;display:block;text-decoration:none;cursor:pointer;letter-spacing:1px;}
#tabs a:hover,#tabs>ul>li>div:hover{color:#D54121;}
#tabs>ul>li>div{border-bottom:1px solid #DFDFDF;border-top:1px solid #F9F9F9;font-weight:bold;padding-left:12px;line-height:30px;height:30px;}
#tabs>ul>li>div>a.tab-current{background-color:#777777;border-bottom:1px solid #6D6D6D;border-top:1px solid #808080;color:#FFFFFF;margin-left:-12px;padding-left:12px;text-shadow:0 -1px 0 #333333;}
#tabs li li a{background-color:#FFFFFF;padding-left:36px;line-height:28px;height:28px;}
#tabs .tab-current{background-color:#EAF2FA;color:#333333;font-weight:bold;}
#tabs li li a:hover{background-color:#EAF2FA;color:#333333;}
#tabs .commentIcon,#tabs .postIcon,#tabs .preferenceIcon,#tabs .usersIcon,#tabs .aboutIcon{margin:6px 9px 0 0;}
.sub-tabs{height:30px;}
.sub-tabs ul{float:right;list-style:none outside none;margin-right:24px;}
.sub-tabs li{float:left;}
.sub-tabs li a{background-color:#ECECEC;border:1px solid #DFDFDF;border-bottom:0px;border-radius:5px 5px 0 0;color:#333333;display:block;line-height:29px;padding:0 12px;text-decoration:none;}
.sub-tabs .tab-current,.sub-tabs .tab-current:hover{background-color:#FFFFFF;font-weight:bold;line-height:30px;}
.sub-tabs a:hover{background-color:#F5F5F5;}
.sub-tabs-main{background-color:#FFFFFF;border:1px solid #DFDFDF;padding:12px;border-radius:6px;}
.form>div{margin:12px 0;}
.form>div label{font-weight:bold;line-height:28px;margin-right:12px;}
.module-panel{border:1px solid #DFDFDF;border-radius:3px 3px 3px 3px;box-shadow:0 1px 0 #FFFFFF inset;background-color:#F5F5F5;margin-bottom:36px;min-height:160px;}
.module-header{background-color:#f1f1f1;background-image:linear-gradient(top, #f9f9f9, #ececec);background-image:-moz-linear-gradient(top, #f9f9f9, #ececec);background-image:-ms-linear-gradient(top, #f9f9f9, #ececec);background-image:-o-linear-gradient(top, #f9f9f9, #ececec);background-image:-webkit-gradient(linear, left top, left bottom, from(#f9f9f9), to(#ececec));filter:progid:dximagetransform.microsoft.gradient(startColorstr='#f9f9f9', endColorstr='#ececec');border-bottom-color:#DFDFDF;box-shadow:0 1px 0 #FFFFFF;text-shadow:0 1px 0 #FFFFFF;padding:5px 10px;}
.module-header h2{color:#464646;font-size:16px;}
.module-header a{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;}
.markdown-preivew{background-image:-moz-linear-gradient(top, #ffffff, #f3f3f3);background-image:-ms-linear-gradient(top, #ffffff, #f3f3f3);background-image:-o-linear-gradient(top, #ffffff, #f3f3f3);background-image:-webkit-gradient(linear, left top, left bottom, from(#ffffff), to(#f3f3f3));filter:progid:dximagetransform.microsoft.gradient(startColorstr='#FFFFFF', endColorstr='#F3F3F3');border-color:#C0C0C0 #D9D9D9 #D9D9D9;border-style:solid;border-width:1px;float:left;height:500px;margin-left:20px;overflow:auto;width:47%;word-wrap:break-word;}
.markdown-help.ico-help,.markdown-help.ico-close{background-image:url("../images/icon.png");background-position:-16px -47px;cursor:pointer;float:right;height:17px;width:17px;}
.markdown-help.ico-close{height:16px;background-position:-48px -16px;}
.markdown-help-main,.markdown-preview-main{color:#21759B;padding:0 12px;}
.markdown-help-main dt{font-size:14px;font-weight:bold;margin:12px 0 6px 0;}
.markdown-help-main dd{margin-left:12px;}
button#submitArticle{background:none repeat scroll 0 0 #D54121;box-shadow:0 0 0 1px #ffffff inset,0 1px 1px rgba(0, 0, 0, 0.1);text-shadow:0 1px rgba(0, 0, 0, 0.1);color:#FFF;}
#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 #333333;line-height:16px;margin:24px 12px;padding:5px;text-align:center;}
#skinMain .skinItem.selected{background-color:#D54121;}
.skinItem:hover{background-color:#EEE;}
.f-blue,.error-msg{color:#3366CC;}
.signs button{margin:0 12px;}
.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;}
.ico-alipay-me{background-image:url("../images/alipay-me.png");font-size:20px;height:24px;margin:20px 0;width:126px;}
.completed-input{margin:2px 12px 0 0;}
.completed-panel{background-color:#ECECEC;border:1px solid #CCCCCC;color:#0000CC;display:none;overflow:auto;padding:2px;position:absolute;z-index:10;}
.completed-panel a{display:block;text-decoration:none;}
.completed-panel a.selected{background-color:#FFFFFF;color:#D54121;}
.completed-ck{margin-top:9px;}
.completed-ck span{background:url(../images/icon.png) repeat center bottom;border:1px solid;border-color:#CCC #BBBBBB #A0A0A0;border-radius:4px;color:#21759B;cursor:pointer;float:left;height:28px;line-height:26px;margin:3px 6px;padding:0 6px;vertical-align:top;}
.completed-ck span:hover{border-color:#BBB;}
.completed-ck span.selected{color:#D54121;background:url(../images/bowknot/completed.png) no-repeat right bottom;}
.dialog-background{background-color:#000000;display:none;filter:alpha(opacity=30);height:100%;left:0;opacity:.3;position:absolute;top:0;width:100%;z-index:90;}
.dialog-panel{display:none;position:absolute;z-index:100;}
.dialog-title{color:#FFFFFF;float:left;font-size:12px;line-height:27px;margin-left:3px;}
.dialog-header-bg{background:url("../images/icon.png") repeat scroll center bottom #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-close-icon{background:url("../images/bowknot/dialog-close.png") no-repeat scroll 0 0 transparent;cursor:pointer;float:right;height:18px;margin-top:6px;padding:3px;width:22px;}
.dialog-close-icon:hover{background-image:url("../images/bowknot/dialog-close-hover.png");}
.dialog-main{background-color:#FFFFFF;border:2px solid #666666;border-color:#C0C0C0 #D9D9D9 #D9D9D9;border-top-width:0;padding:12px;}
.paginate-paginate div,.paginate-paginate a,.paginate-pageCount{float:left;height:20px;line-height:20px;margin:0 5px;text-decoration:none;}
.pagination-pages{background:url(../images/icon.png) repeat center bottom;border:1px solid;border-color:#CCC #BBBBBB #A0A0A0;border-radius:4px;padding:0 6px;cursor:pointer;float:left;height:20px;line-height:20px;margin:0 5px;}
.pagination-current-page{cursor:auto;font-weight:bold;border-color:#BBB;}
.paginate-inputPage{height:14px;width:24px;}
.table-main{margin:0;padding:0;position:relative;}
.table-main table{word-break:break-all;word-wrap:break-word;}
.table-header{border:1px solid #D0D0D0;border-bottom:0px;border-radius:6px 6px 0 0;}
.table-header th{height:34px;line-height:34px;text-align:left;text-indent:6px;font-size:14px;font-weight:normal;background:url("../images/icon.png") repeat scroll center bottom #f1f1f1;}
.table-main td{border-bottom:1px solid #D0D0D0;color:#333;padding:3px 0;}
.table-lineHover .table-hasExpend td{border-bottom:0px;}
.table-heiglight td,.table-lineHover td{background-color:#F3F3F3;border-right-color:#F3F3F3;}
.table-expendRow td{padding:0 0 5px 36px;}
.table-expendRow td span{margin-left:60px;}
.table-expendRow td a{background-color:#999;border-radius:3px;color:#FFF;font-size:12px;margin-right:5px;padding:1px 6px;text-decoration:none;}
.table-expendRow td a:hover{background-color:#BBB;}
.table-center{margin:0 auto;}
.table-upIcon,.table-downIcon{background-image:url("../images/icon.png");cursor:pointer;float:left;height:16px;width:16px;background-position:-79px -32px;}
.table-upIcon{background-position:-64px -32px;margin-right:6px;}
.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;}
......@@ -18,7 +18,7 @@
* base style
*
* @author <a href="mailto:LLY219@gmail.com">Liyuan Li</a>
* @version 1.0.2.1, Mar 28, 2012
* @version 1.0.2.2, Aug 27, 2012
*/
html, body, div, ul, li, h1, h2, h3, h4, h5, h6, p, dd, dl, ol {
margin: 0;
......@@ -27,7 +27,7 @@ html, body, div, ul, li, h1, h2, h3, h4, h5, h6, p, dd, dl, ol {
body {
background-color: #FFF;
color: #000;
font-family: Helvetica,Arial,sans-serif,\5fae\8f6f\96c5\9ed1;
font-family: elvetica,Arial,'sans-serif','\5fae\8f6f\96c5\9ed1';
font-size: small;
}
......@@ -102,15 +102,15 @@ button:hover,.button:hover {
}
.marginLeft12 {
margin-left: 12px !important;;
margin-left: 12px !important;
}
.marginLeft6 {
margin-left: 6px !important;;
margin-left: 6px !important;
}
.marginRight12 {
margin-right: 12px !important;;
margin-right: 12px !important;
}
.f-bold {
......
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;}
li{margin-left:12px;}
button,.button{background:url(../images/icon.png) repeat center bottom;border:1px solid;border-color:#CCC #BBBBBB #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;}
.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:0px;vertical-align:middle;}
.form input.normalInput{width:auto;}
.form input[type='checkbox']:focus{border:0px;}
.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 #EEEEEE;}
.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 0px;}
.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/classic/emotions-classic.png");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:0px -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 #555555;}
#tags a{border-radius:3px 3px 3px 3px;box-shadow:1px 1px 3px #555555;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;}
......@@ -18,7 +18,7 @@
* 403, 404, 500, article-pwd, init, login and kill-browser page style.
*
* @author <a href="mailto:LLY219@gmail.com">Liyuan Li</a>
* @version 1.0.1.1, Jun 13, 2012
* @version 1.0.1.2, Aug 27, 2012
*/
html {
height: 100%;
......@@ -57,7 +57,7 @@ input {
border: 1px solid #E5E5E5;
box-shadow: 1px 1px 2px rgba(200, 200, 200, 0.2) inset;
color: #4D505D;
font-family: Helvetica,Arial,sans-serif,\5fae\8f6f\96c5\9ed1;
font-family: Helvetica,Arial,'sans-serif','\5fae\8f6f\96c5\9ed1';
font-size: 20px;
font-weight: 200;
height: 28px;
......
html{height:100%;overflow:hidden;}
*,html,body{margin:0;padding:0;}
body{background-color:#F3F1E5;color:#4D505D;font-family:\5fae\8f6f\96c5\9ed1;font-size:small;height:100%;}
button{background:url(../images/icon.png) repeat center bottom;border:1px solid;border-color:#CCC #BBBBBB #A0A0A0;border-radius:4px;height:28px;margin:0;padding:0 6px;vertical-align:top;float:right;margin:12px 0 0 24px;outline:none;}
input{background:none repeat scroll 0 0 #FBFBFB;border:1px solid #E5E5E5;box-shadow:1px 1px 2px rgba(200, 200, 200, 0.2) inset;color:#4D505D;font-family:Helvetica,Arial,'sans-serif','\5fae\8f6f\96c5\9ed1';font-size:20px;font-weight:200;height:28px;margin-top:10px;outline:medium none;padding:3px;width:280px;}
input:focus{box-shadow:0px 0px 5px rgba(200, 200, 200, 0.9);}
.clear{background-color:transparent;border:0px;clear:both;display:block;font-size:0px;height:0px;line-height:0px;overflow:hidden;}
.none{display:none;}
.icon{position:absolute;right:0px;top:0px;width:16px;height:16px;}
.solo{color:orangered;font-weight:bold;}
.logo{float:left;padding:162px 12px 0;width:153px;}
.wrapper{height:auto;min-height:100%;position:relative;}
.wrap{border-top:5px solid #E6E5D9;min-height:400px;}
.content{background:url("../images/zz.jpg") repeat-x scroll center bottom #ffffff;border-color:#E6E5D9;border-style:solid solid none;border-width:1px;margin:0 auto;position:relative;width:700px;top:60px;}
.main{border-left:1px solid #E6E5D9;float:right;font-size:15px;margin:24px 0;padding:12px 24px;width:470px;height:338px;}
.main a{text-decoration:none;}
.main ul{margin-bottom:73px;}
.main li{margin:6px 0 6px 16px;}
.main p{margin:12px 0;}
.mian tr{height:54px;}
.footerWrapper{background-color:#FFFFFF;border-top:1px solid #E6E5D9;bottom:0;padding:12px 0;position:absolute;text-align:center;width:100%;}
.footerWrapper a{text-decoration:none;}
.article-pwd>div{margin-bottom:10px;max-height:264px;overflow:auto;word-wrap:break-word;}
.article-pwd #confirm{margin-top:6px;}
.img-404,.img-403,.img-500{box-shadow:0 0 5px #E6E5D9;margin:20px 0 0 45px;padding:5px;}
.a-404,.a-403,.a-500{margin:20px 50px 0 0 ;text-align:right;}
.img-403{margin:20px 0 0 60px;}
.a-403{margin:20px 75px 0 0 ;}
.img-500{margin:25px 0 0 25px;}
.a-500{margin:25px 35px 0 0 ;}
.login table{margin:66px auto;}
.kill{position:absolute;right:40px;top:230px;}
#init{position:absolute;top:102px;width:470px;}
#sys p{height:166px;}
#initButton{margin-right:10px;}
#tip{color:#21759B;float:right;font-weight:bold;margin-top:18px;}
This source diff could not be displayed because it is too large. You can view the blob instead.
/*
* Copyright (c) 2009, 2010, 2011, 2012, B3log Team
*
* 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.
*//**
* index for admin
*
* @author <a href="mailto:LLY219@gmail.com">Liyuan Li</a>
* @version 1.0.1.9, Jun 19, 2012
*/var Admin=function(){this.register={},this.tools=["#page-list","#file-list","#link-list","#preference","#user-list","#plugin-list","#others"],this.adTools=["link-list","preference","file-list","page-list","user-list","plugin-list"]};$.extend(Admin.prototype,{logout:function(){window.location.href=latkeConfig.servePath+"/logout?goto="+latkeConfig.servePath},setHashByPage:function(e){var t=window.location.hash,n=t.split("/");/^\d*$/.test(n[n.length-1])?n[n.length-1]=e:n.push(e),window.location.hash=n.join("/")},selectTab:function(e){window.location.hash="#"+e},analyseHash:function(){var e=window.location.hash,t=e.substr(1,e.length-1),n=t.split("/"),r={};r.page=1,r.hashList=[];for(var i=0;i<n.length;i++)i===n.length-1&&/^\d+$/.test(n[i])?r.page=n[i]:r.hashList.push(n[i]);return r},setCurByHash:function(){var e=admin.analyseHash(),t=e.hashList[1],n=e.hashList[2];e.hashList.length===1&&(t=e.hashList[0]);if(t==="")return;try{if(t!=="article"&&admin.article.isConfirm&&admin.editorArticle.getContent().replace(/\s/g,"")!==""&&!confirm(Label.editorLeaveLabel)){window.location.hash="#article/article";return}if(t==="article"&&admin.article.isConfirm&&admin.editorArticle.getContent().replace(/\s/g,"")!=="")return}catch(r){var i=$("#articleContent");if(i.length>0){if(t!=="article"&&admin.article.isConfirm&&i.val().replace(/\s/g,"")!==""&&!confirm(Label.editorLeaveLabel)){window.location.hash="#article/article";return}if(t==="article"&&admin.article.isConfirm&&i.val().replace(/\s/g,"")!=="")return}}t!=="article"&&admin.editorArticle.setContent&&admin.article.clear(),admin.article.isConfirm=!0,$("#tabs").tabs("setCurrent",t),$("#loadMsg").text(Label.loadingLabel),$("#tabsPanel_"+t).length===1?$("#tabsPanel_"+t).html().replace(/\s/g,"")===""?$("#tabsPanel_"+t).load("admin-"+t+".do",function(){t==="article"&&admin.article.status.id?admin.register[t].init.call(admin.register[t].obj,admin.article.getAndSet):admin.register[t].init.call(admin.register[t].obj,e.page),n&&$("#tab"+t.substring(0,1).toUpperCase()+t.substring(1)).tabs("setCurrent",n),admin.plugin.setCurByHash(e)}):(t==="article"&&admin.article.status.id&&admin.article.getAndSet(),admin.register[t]&&admin.register[t].refresh&&admin.register[t].refresh.call(admin.register[t].obj,e.page),n&&$("#tab"+t.substring(0,1).toUpperCase()+t.substring(1)).tabs("setCurrent",n),admin.plugin.setCurByHash(e)):($("#tipMsg").text("Error: No tab! "+Label.reportIssueLabel),$("#loadMsg").text(""))},init:function(){Util.killIE(),$("#loadMsg").text(Label.loadingLabel),$("#tabs").tabs(),setInterval(function(){$("#tipMsg").text()!==""&&setTimeout(function(){$("#tipMsg").text("")},7e3)},6e3),$("#loadMsg").text("")},collapseNav:function(e){var t=$(e).next();t.slideToggle("normal",function(){this.style.display!=="none"?$(e).find(".ico-arrow-down")[0].className="ico-arrow-up":$(e).find(".ico-arrow-up")[0].className="ico-arrow-down"})},inited:function(){if(Label.userRole!=="adminRole"){for(var e=0;e<this.adTools.length;e++)$("#tabs").tabs("remove",this.adTools[e]);$("#tabs>ul>li").last().remove()}else for(var t=0;t<this.tools.length;t++)if("#"+window.location.hash.split("/")[1]===this.tools[t]){$("#tabToolsTitle").click();break}this.setCurByHash()}});var admin=new Admin;admin.editors={};var Editor=function(e){this._defaults={type:"tinyMCE",kind:"",id:"",language:""},e.type=Label.editorType,this.conf=e,this._init()};$.extend(Editor.prototype,{_init:function(){this.init()},init:function(){var e=this.conf,t=e.type.split("-");t.length===2&&(e.codeMirrorLanguage=t[1],e.type=t[0]),admin.editors[e.type].init(e)},getContent:function(){var e=this.conf;return admin.editors[e.type].getContent(e.id)},setContent:function(e){var t=this.conf;admin.editors[t.type].setContent(t.id,e)}}),admin.editorArticle={},admin.editorAbstract={},admin.editorPage={},admin.editors.tinyMCE={init:function(e){var t=Label.localeString.substring(0,2);t==="zh"&&(t="zh-cn");if(e.kind&&e.kind==="simple")try{tinyMCE.init({language:t,mode:"exact",elements:e.id,theme:"advanced",theme_advanced_buttons1:"bold,italic,underline,strikethrough,|,undo,redo,|,bullist,numlist",theme_advanced_buttons2:"",theme_advanced_buttons3:"",theme_advanced_toolbar_location:"top",theme_advanced_toolbar_align:"left",valid_children:"+body[style]"})}catch(n){$("#tipMsg").text("TinyMCE load fail")}else try{tinyMCE.init({language:t,mode:"exact",elements:e.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:!0,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:!1,remove_script_host:!1,oninit:function(){typeof e.fun=="function"&&e.fun()}})}catch(n){$("#tipMsg").text("TinyMCE load fail")}},getContent:function(e){var t="";try{t=tinyMCE.get(e).getContent()}catch(n){t=$("#"+e).val()}return t},setContent:function(e,t){try{tinyMCE.get(e)?tinyMCE.get(e).setContent(t):$("#"+e).val(t)}catch(n){$("#"+e).val(t)}}},admin.editors.KindEditor={init:function(e){var t="zh_CN";"en_US"===Label.localeString&&(t="en");if(e.kind&&e.kind==="simple")try{this[e.id]=KindEditor.create("#"+e.id,{langType:t,resizeType:0,items:["bold","italic","underline","strikethrough","|","undo","redo","|","insertunorderedlist","insertorderedlist"]})}catch(n){$("#tipMsg").text("KindEditor load fail")}else try{this[e.id]=KindEditor.create("#"+e.id,{langType:t,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(){typeof e.fun=="function"&&e.fun()}})}catch(n){$("#tipMsg").text("KindEditor load fail")}},getContent:function(e){var t="";try{t=this[e].html()}catch(n){t=$("#"+e).val()}return t},setContent:function(e,t){try{this[e].html(t)}catch(n){$("#"+e).val(t)}}},admin.editors.CodeMirror={init:function(e){var t=this,n="<div class='clear'></div>";e.kind!=="simple"&&(n="<div class='markdown-preivew'><div class='markdown-help ico-close'></div><div class='clear'></div><div class='markdown-preview-main none'></div><div class='markdown-help-main'>"+Label.markdownHelpLabel+"</div>","</div><div class='clear'></div>"),$("#"+e.id).after(n);if(e.kind==="simple")this[e.id]=CodeMirror.fromTextArea(document.getElementById(e.id),{mode:"markdown",lineNumbers:!0,matchBrackets:!0,theme:"default",height:e.height});else{t[e.id+"Timers"]=[],t[e.id+"IsFirst"]=!0;var r=$("#"+e.id).parent().find(".markdown-preivew"),i=$("#"+e.id).parent().find(".markdown-preivew").find(".markdown-help");this[e.id]=CodeMirror.fromTextArea(document.getElementById(e.id),{mode:"markdown",lineNumbers:!0,matchBrackets:!0,theme:"default",height:e.height,onUpdate:function(){var n=function(){if(t[e.id].getValue()==="")return;$.ajax({url:latkeConfig.servePath+"/console/markdown/2html",type:"POST",cache:!1,data:"markdownText="+t[e.id].getValue(),success:function(n,s){n.sc?(t[e.id+"IsFirst"]&&i.hasClass("ico-close")&&i.click(),t[e.id+"IsFirst"]=!1,r.find(".markdown-preview-main").html(n.html)):r.find(".markdown-preview-main").html(n.msg)}})};t[e.id+"Timers"].push(n)}}),this._callPreview(e.id,t[e.id+"Timers"])}e.kind==="simple"?$("#"+e.id).next().width("99%"):this._bindEvent(e.id),typeof e.fun=="function"&&e.fun()},_callPreview:function(e){setInterval(function(){var t=admin.editors.CodeMirror[e+"Timers"];$(document).queue("myAnimation",[t[t.length-1]]),$(document).dequeue("myAnimation"),admin.editors.CodeMirror[e+"Timers"]=[]},2e3)},_bindEvent:function(e){var t=$("#"+e).parent().find(".markdown-preivew");t.find(".markdown-help").click(function(){var e=$(this);e.hasClass("ico-help")?(e.removeClass("ico-help").addClass("ico-close"),t.find(".markdown-preview-main").hide(),t.find(".markdown-help-main").show()):(e.addClass("ico-help").removeClass("ico-close"),t.find(".markdown-preview-main").show(),t.find(".markdown-help-main").hide())})},getContent:function(e){return this[e].getValue()},setContent:function(e,t){this[e].setValue(t)}};var TablePaginate=function(e){this.id=e,this.currentPage=1};$.extend(TablePaginate.prototype,{buildTable:function(e,t){var n={colModel:e,noDataTip:Label.noDataLabel};t||(n.expendRow={index:"expendRow"}),$("#"+this.id+"Table").table(n)},initPagination:function(){var e=this.id;$("#"+e+"Pagination").paginate({bind:function(e,t){t?$("#tipMsg").text(t):admin.setHashByPage(e)},currentPage:1,errorMessage:Label.inputErrorLabel,nextPageText:Label.nextPagePabel,previousPageText:Label.previousPageLabel,goText:Label.gotoLabel,type:"custom",custom:[1],pageCount:1})},initCommentsDialog:function(){var e=this;$("#"+this.id+"Comments").dialog({modal:!0,hideFooter:!0,close:function(){return admin[e.id+"List"].getList(e.currentPage),!0}})},updateTablePagination:function(e,t,n){t=parseInt(t);if(t>n.paginationPageCount&&t>1){$("#tipMsg").text(Label.pageLabel+t+Label.notFoundLabel),$("#loadMsg").text("");return}$("#"+this.id+"Table").table("update",{data:[{groupName:"all",groupData:e}]}),n.paginationPageCount===0&&(n.paginationPageCount=1),$("#"+this.id+"Pagination").paginate("update",{pageCount:n.paginationPageCount,currentPage:t,custom:n.paginationPageNums}),this.currentPage=t}}),admin.article={isConfirm:!0,status:{id:undefined,isArticle:undefined,articleHadBeenPublished:undefined},get:function(e,t){this.status.id=e,this.status.isArticle=t,admin.selectTab("article/article")},getAndSet:function(){$("#loadMsg").text(Label.loadingLabel),$.ajax({url:latkeConfig.servePath+"/console/article/"+admin.article.status.id,type:"GET",cache:!1,success:function(e,t){$("#tipMsg").text(e.msg);if(!e.sc){$("#loadMsg").text("");return}$("#title").val(e.article.articleTitle),admin.article.status.articleHadBeenPublished=e.article.articleHadBeenPublished,admin.editorArticle.setContent(e.article.articleContent),admin.editorAbstract.setContent(e.article.articleAbstract);var n=e.article.articleTags,r="";for(var i=0;i<n.length;i++)0===i?r=n[i].tagTitle:r+=","+n[i].tagTitle;$("#tag").val(r),$("#permalink").val(e.article.articlePermalink),$("#viewPwd").val(e.article.articleViewPwd),$("#articleCommentable").prop("checked",e.article.articleCommentable);var s=e.article.signs;$(".signs button").each(function(t){parseInt(e.article.articleSignId)===parseInt(s[t].oId)?$("#articleSign"+s[t].oId).addClass("selected"):$("#articleSign"+s[t].oId).removeClass("selected")}),admin.article.setStatus(),$("#loadMsg").text("")}})},del:function(e,t){var n=confirm(Label.confirmRemoveLabel);n&&($("#loadMsg").text(Label.loadingLabel),$("#tipMsg").text(""),$.ajax({url:latkeConfig.servePath+"/console/article/"+e,type:"DELETE",cache:!1,success:function(e,n){$("#tipMsg").text(e.msg);if(!e.sc){$("#loadMsg").text("");return}admin[t+"List"].getList(1)}}))},add:function(e){if(admin.article.validate()){var t=this;t._addDisabled(),$("#loadMsg").text(Label.loadingLabel),$("#tipMsg").text("");var n="";$(".signs button").each(function(){this.className==="selected"&&(n=this.id.substr(this.id.length-1,1))});var r=admin.editorArticle.getContent(),i=admin.editorAbstract.getContent(),s={article:{articleTitle:$("#title").val(),articleContent:r,articleAbstract:i,articleTags:this.trimUniqueArray($("#tag").val()).toString(),articlePermalink:$("#permalink").val(),articleIsPublished:e,articleSignId:n,postToCommunity:$("#postToCommunity").prop("checked"),articleCommentable:$("#articleCommentable").prop("checked"),articleViewPwd:$("#viewPwd").val()}};$.ajax({url:latkeConfig.servePath+"/console/article/",type:"POST",cache:!1,data:JSON.stringify(s),success:function(t,n){$("#tipMsg").text(t.msg);if(!t.sc){$("#loadMsg").text("");return}e?(admin.article.status.id=undefined,admin.selectTab("article/article-list")):admin.selectTab("article/draft-list"),admin.article.isConfirm=!1,$("#loadMsg").text("")},complete:function(n,r){t._removeDisabled(),n.status===403&&($.get("/admin-index.do"),t.add(e))}})}},update:function(e){if(admin.article.validate()){var t=this;t._addDisabled(),$("#loadMsg").text(Label.loadingLabel),$("#tipMsg").text("");var n="";$(".signs button").each(function(){this.className==="selected"&&(n=this.id.substr(this.id.length-1,1))});var r=admin.editorArticle.getContent(),i=admin.editorAbstract.getContent(),s={article:{oId:this.status.id,articleTitle:$("#title").val(),articleContent:r,articleAbstract:i,articleTags:this.trimUniqueArray($("#tag").val()).toString(),articlePermalink:$("#permalink").val(),articleIsPublished:e,articleSignId:n,articleCommentable:$("#articleCommentable").prop("checked"),articleViewPwd:$("#viewPwd").val()}};$.ajax({url:latkeConfig.servePath+"/console/article/",type:"PUT",cache:!1,data:JSON.stringify(s),success:function(t,n){$("#tipMsg").text(t.msg);if(!t.sc){$("#loadMsg").text("");return}e?admin.selectTab("article/article-list"):admin.selectTab("article/draft-list"),$("#tipMsg").text(Label.updateSuccLabel),admin.article.status.id=undefined,admin.article.isConfirm=!1,$("#loadMsg").text("")},complete:function(n,r){t._removeDisabled(),n.status===403&&($.get("/admin-index.do"),t.update(e))}})}},setStatus:function(){this.status?(this.status.isArticle?($("#unSubmitArticle").show(),$("#submitArticle").hide()):($("#submitArticle").show(),$("#unSubmitArticle").hide()),this.status.articleHadBeenPublished?$("#postToCommunityPanel").hide():$("#postToCommunityPanel").show()):($("#submitArticle").show(),$("#unSubmitArticle").hide(),$("#postToCommunityPanel").show()),$("#postToCommunity").attr("checked","checked")},clear:function(){this.status={id:undefined,isArticle:undefined,articleHadBeenPublished:undefined},this.setStatus(),$("#title").val(""),admin.editorArticle.setContent(""),admin.editorAbstract.setContent(""),$("#tag").val(""),$("#tagCheckboxPanel").hide().find("span").removeClass("selected"),$("#permalink").val(""),$("#articleCammentable").prop("checked",!0),$("#postToCommunity").prop("checked",!0),$(".signs button").each(function(e){e===0?this.className="selected":this.className=""})},init:function(e){$.ajax({url:latkeConfig.servePath+"/console/signs/",type:"GET",cache:!1,success:function(e,t){$("#tipMsg").text(e.msg);if(!e.sc){$("#loadMsg").text("");return}$(".signs button").each(function(t){t===e.signs.length?$("#articleSign1").addClass("selected"):$("#articleSign"+e.signs[t].oId).tip({content:e.signs[t].signHTML===""?Label.signIsNullLabel:e.signs[t].signHTML.replace(/\n/g,"").replace(/<script.*<\/script>/ig,""),position:"top"}),$(this).click(function(){this.className!=="selected"&&($(".signs button").each(function(){this.className=""}),this.className="selected")})}),$("#loadMsg").text("")}}),$.ajax({url:latkeConfig.servePath+"/console/tags",type:"GET",cache:!1,success:function(e,t){$("#tipMsg").text(e.msg);if(!e.sc){$("#loadMsg").text("");return}if(0>=e.tags.length)return;var n=[];for(var r=0;r<e.tags.length;r++)n.push(e.tags[r].tagTitle);$("#tag").completed({height:160,buttonText:Label.selectLabel,data:n}),$("#loadMsg").text("")}}),$("#submitArticle").click(function(){admin.article.status.id?admin.article.update(!0):admin.article.add(!0)}),$("#saveArticle").click(function(){admin.article.status.id?admin.article.update(admin.article.status.isArticle):admin.article.add(!1)}),admin.editorArticle=new Editor({id:"articleContent",kind:"all",fun:e,height:500}),admin.editorAbstract=new Editor({id:"abstract",kind:"simple",height:200})},validate:function(){var e=admin.editorArticle.getContent();if($("#title").val().replace(/\s/g,"")==="")$("#tipMsg").text(Label.titleEmptyLabel),$("#title").focus().val("");else if(e.replace(/\s/g,"")==="")$("#tipMsg").text(Label.contentEmptyLabel);else{if($("#tag").val().replace(/\s/g,"")!=="")return!0;$("#tipMsg").text(Label.tagsEmptyLabel),$("#tag").focus().val("")}return!1},unPublish:function(){var e=this;e._addDisabled(),$.ajax({url:latkeConfig.servePath+"/console/article/unpublish/"+admin.article.status.id,type:"PUT",cache:!1,success:function(e,t){$("#tipMsg").text(e.msg);if(!e.sc){$("#loadMsg").text("");return}admin.selectTab("article/draft-list"),admin.article.status.id=undefined,admin.article.isConfirm=!1},complete:function(t,n){e._removeDisabled(),t.status===403&&($.get("/admin-index.do"),e.unPublish())}})},trimUniqueArray:function(e){e=e.toString();var t=e.split(",");for(var n=0;n<t.length;n++)t[n]=t[n].replace(/(^\s*)|(\s*$)/g,""),t[n]===""&&(t.splice(n,1),n--);var r=$.unique(t);return r.toString()},prePost:function(){$("#loadMsg").text(Label.loadingLabel);if(!admin.editorArticle.getContent)return;var e=admin.editorArticle.getContent();window.location.hash==="#article/article"&&e.replace(/\s/g,"")!==""&&confirm(Label.editorPostLabel)&&admin.article.clear(),$("#loadMsg").text("")},_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(){$("#loadMsg").text("")}},admin.comment={open:function(e,t){this.getList(e,t),$("#"+t+"Comments").dialog("open")},getList:function(e,t){$("#loadMsg").text(Label.loadingLabel),$("#"+t+"Comments").html("");var n="article";t==="page"&&(n="page"),$.ajax({url:latkeConfig.servePath+"/console/comments/"+n+"/"+e,type:"GET",cache:!1,success:function(n,r){$("#tipMsg").text(n.msg);if(!n.sc){$("#loadMsg").text("");return}var i=n.comments,s="";for(var o=0;o<i.length;o++){var u="<a target='_blank' href='"+i[o].commentURL+"'>",a=i[o].commentContent,f=Util.replaceEmString(a);i[o].commentURL==="http://"&&(u="<a target='_blank'>"),s+="<div class='comment-title'><span class='left'>"+u+i[o].commentName+"</a>",i[o].commentOriginalCommentName&&(s+="@"+i[o].commentOriginalCommentName),s+="</span><span title='"+Label.removeLabel+"' class='right deleteIcon' onclick=\"admin.comment.del('"+i[o].oId+"', '"+t+"', '"+e+"')\"></span><span class='right'><a href='mailto:"+i[o].commentEmail+"'>"+i[o].commentEmail+"</a>&nbsp;&nbsp;"+$.bowknot.getDate(i[o].commentTime)+"&nbsp;</span><div class='clear'></div></div><div class='margin12'>"+f+"</div>"}""===s&&(s=Label.noCommentLabel),$("#"+t+"Comments").html(s),$("#loadMsg").text("")}})},del:function(e,t,n){var r=confirm(Label.confirmRemoveLabel);if(r){$("#loadMsg").text(Label.loadingLabel);var i="article";t==="page"&&(i="page"),$.ajax({url:latkeConfig.servePath+"/console/"+i+"/comment/"+e,type:"DELETE",cache:!1,success:function(e,r){$("#tipMsg").text(e.msg);if(!e.sc){$("#loadMsg").text("");return}admin.comment.getList(n,t),$("#loadMsg").text("")}})}}},admin.articleList={tablePagination:new TablePaginate("article"),init:function(e){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(e)},getList:function(e){var t=this;$("#loadMsg").text(Label.loadingLabel),$.ajax({url:latkeConfig.servePath+"/console/articles/status/published/"+e+"/"+Label.PAGE_SIZE+"/"+Label.WINDOW_SIZE,type:"GET",cache:!1,success:function(n,r){$("#tipMsg").text(n.msg);if(!n.sc){$("#loadMsg").text("");return}var i=n.articles,s=[];for(var o=0;o<i.length;o++){s[o]={},s[o].title="<a href='"+latkeConfig.servePath+i[o].articlePermalink+"' target='_blank' title='"+i[o].articleTitle+"' class='no-underline'>"+i[o].articleTitle+"</a><span class='table-tag'>"+i[o].articleTags+"</span>",s[o].date=$.bowknot.getDate(i[o].articleCreateTime),s[o].comments=i[o].articleCommentCount,s[o].articleViewCount=i[o].articleViewCount,s[o].author=i[o].authorName;var u=i[o].articlePutTop?Label.cancelPutTopLabel:Label.putTopLabel;s[o].expendRow="<a target='_blank' href='"+latkeConfig.servePath+i[o].articlePermalink+"'>"+Label.viewLabel+"</a> <a href='javascript:void(0)' onclick=\"admin.article.get('"+i[o].oId+"', true)\">"+Label.updateLabel+"</a> <a href='javascript:void(0)' onclick=\"admin.article.del('"+i[o].oId+"', 'article')\">"+Label.removeLabel+"</a> <a href='javascript:void(0)' onclick=\"admin.articleList.popTop(this, '"+i[o].oId+"')\">"+u+"</a> <a href='javascript:void(0)' onclick=\"admin.comment.open('"+i[o].oId+"', 'article')\">"+Label.commentLabel+"</a>"}t.tablePagination.updateTablePagination(s,e,n.pagination),$("#loadMsg").text("")}})},popTop:function(e,t){$("#loadMsg").text(Label.loadingLabel),$("#tipMsg").text("");var n=$(e),r="canceltop",i=Label.putTopLabel;n.html()===Label.putTopLabel&&(r="puttop",i=Label.cancelPutTopLabel),$.ajax({url:latkeConfig.servePath+"/console/article/"+r+"/"+t,type:"PUT",cache:!1,success:function(e,t){$("#tipMsg").text(e.msg);if(!e.sc){$("#loadMsg").text("");return}n.html(i)}})}},admin.register["article-list"]={obj:admin.articleList,init:admin.articleList.init,refresh:admin.articleList.getList},admin.draftList={tablePagination:new TablePaginate("draft"),init:function(e){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(e)},getList:function(e){$("#loadMsg").text(Label.loadingLabel);var t=this;$.ajax({url:latkeConfig.servePath+"/console/articles/status/unpublished/"+e+"/"+Label.PAGE_SIZE+"/"+Label.WINDOW_SIZE,type:"GET",cache:!1,success:function(n,r){$("#tipMsg").text(n.msg);if(!n.sc){$("#loadMsg").text("");return}var i=n.articles,s=[];for(var o=0;o<i.length;o++)s[o]={},s[o].tags=i[o].articleTags,s[o].date=$.bowknot.getDate(i[o].articleCreateTime),s[o].comments=i[o].articleCommentCount,s[o].articleViewCount=i[o].articleViewCount,s[o].author=i[o].authorName,s[o].title="<a class='no-underline' href='"+latkeConfig.servePath+i[o].articlePermalink+"' target='_blank'>"+i[o].articleTitle+"</a><span class='table-tag'>"+i[o].articleTags+"</span>",s[o].expendRow="<a target='_blank' href='"+latkeConfig.servePath+i[o].articlePermalink+"'>"+Label.viewLabel+"</a> <a href='javascript:void(0)' onclick=\"admin.article.get('"+i[o].oId+"', false);\">"+Label.updateLabel+"</a> <a href='javascript:void(0)' onclick=\"admin.article.del('"+i[o].oId+"', 'draft')\">"+Label.removeLabel+"</a> <a href='javascript:void(0)' onclick=\"admin.comment.open('"+i[o].oId+"', 'draft')\">"+Label.commentLabel+"</a>";t.tablePagination.updateTablePagination(s,e,n.pagination),$("#loadMsg").text("")}})}},admin.register["draft-list"]={obj:admin.draftList,init:admin.draftList.init,refresh:admin.draftList.getList},admin.pageList={tablePagination:new TablePaginate("page"),pageInfo:{currentCount:1,pageCount:1,currentPage:1},id:"",type:"link",init:function(e){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(e);var t=Label.localeString.substring(0,2);t==="zh"&&(t="zh-cn"),admin.editorPage=new Editor({language:t,kind:"all",id:"pageContent"}),$(".fn-type").click(function(){var e=$(this);if(e.hasClass("selected"))return;$(".fn-type").removeClass("selected"),e.addClass("selected"),admin.pageList.type=e.data("type"),admin.pageList.type==="page"?($("#pagePagePanel").slideDown(),Label.editorType==="CodeMirror-Markdown"&&admin.editorPage.getContent()===""&&admin.editorPage.setContent("")):$("#pagePagePanel").slideUp()})},getList:function(e){$("#loadMsg").text(Label.loadingLabel);var t=this;$.ajax({url:latkeConfig.servePath+"/console/pages/"+e+"/"+Label.PAGE_SIZE+"/"+Label.WINDOW_SIZE,type:"GET",cache:!1,success:function(n,r){$("#tipMsg").text(n.msg);if(!n.sc){$("#loadMsg").text("");return}var i=n.pages,s=[];admin.pageList.pageInfo.currentCount=i.length,admin.pageList.pageInfo.pageCount=n.pagination.paginationPageCount===0?1:n.pagination.paginationPageCount;for(var o=0;o<i.length;o++)s[o]={},o===0?i.length===1?s[o].pageOrder="":s[o].pageOrder='<div class="table-center" style="width:14px"> <span onclick="admin.pageList.changeOrder('+i[o].oId+", "+o+', \'down\');" class="table-downIcon"></span></div>':o===i.length-1?s[o].pageOrder='<div class="table-center" style="width:14px"> <span onclick="admin.pageList.changeOrder('+i[o].oId+", "+o+', \'up\');" class="table-upIcon"></span> </div>':s[o].pageOrder='<div class="table-center" style="width:38px"> <span onclick="admin.pageList.changeOrder('+i[o].oId+", "+o+', \'up\');" class="table-upIcon"></span> <span onclick="admin.pageList.changeOrder('+i[o].oId+", "+o+', \'down\');" class="table-downIcon"></span> </div>',s[o].pageTitle="<a class='no-underline' href='"+i[o].pagePermalink+"' target='_blank'>"+i[o].pageTitle+"</a>",s[o].pagePermalink="<a class='no-underline' href='"+i[o].pagePermalink+"' target='_blank'>"+i[o].pagePermalink+"</a>",s[o].pageTarget=i[o].pageOpenTarget,s[o].pageType=i[o].pageType,s[o].comments=i[o].pageCommentCount,s[o].expendRow="<span><a href='"+i[o].pagePermalink+"' target='_blank'>"+Label.viewLabel+"</a> <a href='javascript:void(0)' onclick=\"admin.pageList.get('"+i[o].oId+"')\">"+Label.updateLabel+"</a> <a href='javascript:void(0)' onclick=\"admin.pageList.del('"+i[o].oId+"')\">"+Label.removeLabel+"</a> <a href='javascript:void(0)' onclick=\"admin.comment.open('"+i[o].oId+"', 'page')\">"+Label.commentLabel+"</a></span>";t.tablePagination.updateTablePagination(s,e,n.pagination),$("#loadMsg").text("")}})},get:function(e){$("#loadMsg").text(Label.loadingLabel),$("#tipMsg").text(""),$.ajax({url:latkeConfig.servePath+"/console/page/"+e,type:"GET",cache:!1,success:function(t,n){$("#tipMsg").text(t.msg);if(!t.sc){$("#loadMsg").text("");return}admin.pageList.id=e,$("#pageTitle").val(t.page.pageTitle),$("#pagePermalink").val(t.page.pagePermalink),$("#pageTarget").val(t.page.pageOpenTarget),t.page.pageType==="page"?$($(".fn-type").get(1)).click():$($(".fn-type").get(0)).click(),$("#pageCommentable").prop("checked",t.page.pageCommentable),admin.editorPage.setContent(t.page.pageContent),$("#loadMsg").text("")}})},del:function(e){var t=confirm(Label.confirmRemoveLabel);t&&($("#loadMsg").text(Label.loadingLabel),$("#tipMsg").text(""),$.ajax({url:latkeConfig.servePath+"/console/page/"+e,type:"DELETE",cache:!1,success:function(e,t){$("#tipMsg").text(e.msg);if(!e.sc){$("#loadMsg").text("");return}var n=admin.pageList.pageInfo.currentPage;admin.pageList.pageInfo.currentCount===1&&admin.pageList.pageInfo.pageCount!==1&&admin.pageList.pageInfo.currentPage===admin.pageList.pageInfo.pageCount&&(admin.pageList.pageInfo.pageCount--,n=admin.pageList.pageInfo.pageCount);var r=window.location.hash.split("/");n==r[r.length-1]?admin.pageList.getList(n):admin.setHashByPage(n),$("#loadMsg").text("")}}))},add:function(){if(this.validate()){$("#loadMsg").text(Label.loadingLabel),$("#tipMsg").text("");var e=admin.editorPage.getContent(),t=$("#pagePermalink").val().replace(/(^\s*)|(\s*$)/g,"");admin.pageList.type==="link"&&(t=Util.proessURL(t));var n={page:{pageTitle:$("#pageTitle").val(),pageContent:e,pagePermalink:t,pageCommentable:$("#pageCommentable").prop("checked"),pageType:admin.pageList.type,pageOpenTarget:$("#pageTarget").val()}};$.ajax({url:latkeConfig.servePath+"/console/page/",type:"POST",cache:!1,data:JSON.stringify(n),success:function(e,t){$("#tipMsg").text(e.msg);if(!e.sc){$("#loadMsg").text("");return}admin.pageList.id="",$("#pagePermalink").val(""),$("#pageTitle").val(""),$("#pageCommentable").prop("cheked",!1),$("#pageTarget").val("_self"),$($(".fn-type").get(0)).click(),admin.editorPage.setContent(""),admin.pageList.pageInfo.currentCount===Label.PAGE_SIZE&&admin.pageList.pageInfo.currentPage===admin.pageList.pageInfo.pageCount&&admin.pageList.pageInfo.pageCount++;var n=window.location.hash.split("/");admin.pageList.pageInfo.pageCount==n[n.length-1]?admin.pageList.getList(admin.pageList.pageInfo.pageCount):admin.setHashByPage(admin.pageList.pageInfo.pageCount),$("#loadMsg").text("")}})}},update:function(){if(this.validate()){$("#loadMsg").text(Label.loadingLabel),$("#tipMsg").text("");var e=admin.editorPage.getContent(),t=$("#pagePermalink").val().replace(/(^\s*)|(\s*$)/g,"");admin.pageList.type==="link"&&(t=Util.proessURL(t));var n={page:{pageTitle:$("#pageTitle").val(),oId:this.id,pageContent:e,pagePermalink:t,pageCommentable:$("#pageCommentable").prop("checked"),pageType:admin.pageList.type,pageOpenTarget:$("#pageTarget").val()}};$.ajax({url:latkeConfig.servePath+"/console/page/",type:"PUT",cache:!1,data:JSON.stringify(n),success:function(e,t){$("#tipMsg").text(e.msg);if(!e.sc){$("#loadMsg").text("");return}admin.pageList.id="",admin.pageList.getList(admin.pageList.pageInfo.currentPage),$("#pageTitle").val(""),$("#pagePermalink").val(""),$("#pageCommentable").prop("cheked",!1),$("#pageTarget").val("_self"),$($(".fn-type").get(0)).click(),admin.editorPage.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,"")!=="")return!0;$("#tipMsg").text(Label.linkEmptyLabel)}return!1},submit:function(){this.id!==""?this.update():this.add()},changeOrder:function(e,t,n){$("#loadMsg").text(Label.loadingLabel),$("#tipMsg").text("");var r={oId:e.toString(),direction:n};$.ajax({url:latkeConfig.servePath+"/console/page/order/",type:"PUT",cache:!1,data:JSON.stringify(r),success:function(e,t){$("#tipMsg").text(e.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:!1,success:function(e,t){$("#tipMsg").text(e.msg);if(!e.sc){$("#loadMsg").text("");return}$("#replayEmailTemplateTitle").val(e.replyNotificationTemplate.subject),$("#replayEmailTemplateBody").val(e.replyNotificationTemplate.body),$("#loadMsg").text("")}})},removeUnusedTags:function(){$("#tipMsg").text(""),$.ajax({url:latkeConfig.servePath+"/console/tag/unused",type:"DELETE",cache:!1,success:function(e,t){$("#tipMsg").text(e.msg)}})},getUnusedTags:function(){$.ajax({url:latkeConfig.servePath+"/console/tag/unused",type:"GET",cache:!1,success:function(e,t){$("#tipMsg").text(e.msg);if(!e.sc){$("#loadMsg").text("");return}var n=e.unusedTags;if(0===n.length)return}})},update:function(){$("#loadMsg").text(Label.loadingLabel),$("#tipMsg").text("");var e={replyNotificationTemplate:{subject:$("#replayEmailTemplateTitle").val(),body:$("#replayEmailTemplateBody").val()}};$.ajax({url:latkeConfig.servePath+"/console/reply/notification/template",type:"PUT",cache:!1,data:JSON.stringify(e),success:function(e,t){$("#tipMsg").text(e.msg),$("#loadMsg").text("")}})}},admin.register.others={obj:admin.others,init:admin.others.init,refresh:function(){$("#loadMsg").text("")}},admin.linkList={tablePagination:new TablePaginate("link"),pageInfo:{currentCount:1,pageCount:1,currentPage:1},id:"",init:function(e){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(e),$("#updateLink").dialog({width:700,height:180,modal:!0,hideFooter:!0})},getList:function(e){$("#loadMsg").text(Label.loadingLabel),e===0&&(e=1),this.pageInfo.currentPage=e;var t=this;$.ajax({url:latkeConfig.servePath+"/console/links/"+e+"/"+Label.PAGE_SIZE+"/"+Label.WINDOW_SIZE,type:"GET",cache:!1,success:function(n,r){$("#tipMsg").text(n.msg);if(!n.sc){$("#loadMsg").text("");return}var i=n.links,s=[];admin.linkList.pageInfo.currentCount=i.length,admin.linkList.pageInfo.pageCount=n.pagination.paginationPageCount===0?1:n.pagination.paginationPageCount;for(var o=0;o<i.length;o++)s[o]={},o===0?i.length===1?s[o].linkOrder="":s[o].linkOrder='<div class="table-center" style="width:14px"> <span onclick="admin.linkList.changeOrder('+i[o].oId+", "+o+', \'down\');" class="table-downIcon"></span> </div>':o===i.length-1?s[o].linkOrder='<div class="table-center" style="width:14px"> <span onclick="admin.linkList.changeOrder('+i[o].oId+", "+o+', \'up\');" class="table-upIcon"></span> </div>':s[o].linkOrder='<div class="table-center" style="width:38px"> <span onclick="admin.linkList.changeOrder('+i[o].oId+", "+o+', \'up\');" class="table-upIcon"></span> <span onclick="admin.linkList.changeOrder('+i[o].oId+", "+o+', \'down\');" class="table-downIcon"></span> </div>',s[o].linkTitle=i[o].linkTitle,s[o].linkAddress="<a target='_blank' class='no-underline' href='"+i[o].linkAddress+"'>"+i[o].linkAddress+"</a>",s[o].linkDescription=i[o].linkDescription,s[o].expendRow="<span><a href='"+i[o].linkAddress+"' target='_blank'>"+Label.viewLabel+"</a> <a href='javascript:void(0)' onclick=\"admin.linkList.get('"+i[o].oId+"')\">"+Label.updateLabel+"</a> <a href='javascript:void(0)' onclick=\"admin.linkList.del('"+i[o].oId+"')\">"+Label.removeLabel+"</a></span>";t.tablePagination.updateTablePagination(s,e,n.pagination),$("#loadMsg").text("")}})},add:function(){if(this.validate()){$("#loadMsg").text(Label.loadingLabel),$("#tipMsg").text("");var e={link:{linkTitle:$("#linkTitle").val(),linkAddress:$("#linkAddress").val(),linkDescription:$("#linkDescription").val()}};$.ajax({url:latkeConfig.servePath+"/console/link/",type:"POST",cache:!1,data:JSON.stringify(e),success:function(e,t){$("#tipMsg").text(e.msg);if(!e.sc){$("#loadMsg").text("");return}$("#linkTitle").val(""),$("#linkAddress").val(""),$("#linkDescription").val(""),admin.linkList.pageInfo.currentCount===Label.PAGE_SIZE&&admin.linkList.pageInfo.currentPage===admin.linkList.pageInfo.pageCount&&admin.linkList.pageInfo.pageCount++;var n=window.location.hash.split("/");admin.linkList.pageInfo.pageCount!==parseInt(n[n.length-1])&&admin.setHashByPage(admin.linkList.pageInfo.pageCount),admin.linkList.getList(admin.linkList.pageInfo.pageCount),$("#loadMsg").text("")}})}},get:function(e){$("#loadMsg").text(Label.loadingLabel),$("#updateLink").dialog("open"),$.ajax({url:latkeConfig.servePath+"/console/link/"+e,type:"GET",cache:!1,success:function(t,n){$("#tipMsg").text(t.msg);if(!t.sc){$("#loadMsg").text("");return}admin.linkList.id=e,$("#linkTitleUpdate").val(t.link.linkTitle),$("#linkAddressUpdate").val(t.link.linkAddress),$("#linkDescriptionUpdate").val(t.link.linkDescription),$("#loadMsg").text("")}})},update:function(){if(this.validate("Update")){$("#loadMsg").text(Label.loadingLabel),$("#tipMsg").text("");var e={link:{linkTitle:$("#linkTitleUpdate").val(),oId:this.id,linkAddress:$("#linkAddressUpdate").val(),linkDescription:$("#linkDescriptionUpdate").val()}};$.ajax({url:latkeConfig.servePath+"/console/link/",type:"PUT",cache:!1,data:JSON.stringify(e),success:function(e,t){$("#updateLink").dialog("close"),$("#tipMsg").text(e.msg);if(!e.sc){$("#loadMsg").text("");return}admin.linkList.getList(admin.linkList.pageInfo.currentPage),$("#loadMsg").text("")}})}},del:function(e){var t=confirm(Label.confirmRemoveLabel);t&&($("#loadMsg").text(Label.loadingLabel),$("#tipMsg").text(""),$.ajax({url:latkeConfig.servePath+"/console/link/"+e,type:"DELETE",cache:!1,success:function(e,t){$("#tipMsg").text(e.msg);if(!e.sc){$("#loadMsg").text("");return}var n=admin.linkList.pageInfo.currentPage;admin.linkList.pageInfo.currentCount===1&&admin.linkList.pageInfo.pageCount!==1&&admin.linkList.pageInfo.currentPage===admin.linkList.pageInfo.pageCount&&(admin.linkList.pageInfo.pageCount--,n=admin.linkList.pageInfo.pageCount);var r=window.location.hash.split("/");n!==parseInt(r[r.length-1])&&admin.setHashByPage(n),admin.linkList.getList(n),$("#loadMsg").text("")}}))},validate:function(e){e||(e="");if($("#linkTitle"+e).val().replace(/\s/g,"")==="")$("#tipMsg").text(Label.titleEmptyLabel),$("#linkTitle"+e).focus().val("");else if($("#linkAddress"+e).val().replace(/\s/g,"")==="")$("#tipMsg").text(Label.addressEmptyLabel),$("#linkAddress"+e).focus().val("");else{if(!!/^\w+:\/\//.test($("#linkAddress"+e).val()))return!0;$("#tipMsg").text(Label.addressInvalidLabel),$("#linkAddress"+e).focus().val("")}return!1},changeOrder:function(e,t,n){$("#loadMsg").text(Label.loadingLabel),$("#tipMsg").text("");var r={oId:e.toString(),direction:n};$.ajax({url:latkeConfig.servePath+"/console/link/order/",type:"PUT",cache:!1,data:JSON.stringify(r),success:function(e,t){$("#tipMsg").text(e.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:!1,success:function(result,textStatus){$("#tipMsg").text(result.msg);if(!result.sc){$("#loadMsg").text("");return}var preference=result.preference;preference.blogHost.indexOf("localhost")>-1&&Label.miniPostfix===".min"&&(preference.blogHost=window.location.host,$("#tipMsg").text(Label.resetBlogHostLabel)),$("#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),$("#blogHost").val(preference.blogHost),$("#localeString").val(preference.localeString),$("#timeZoneId").val(preference.timeZoneId),$("#noticeBoard").val(preference.noticeBoard),$("#htmlHead").val(preference.htmlHead),$("#externalRelevantArticlesDisplayCount").val(preference.externalRelevantArticlesDisplayCount),$("#relevantArticlesDisplayCount").val(preference.relevantArticlesDisplayCount),$("#randomArticlesDisplayCount").val(preference.randomArticlesDisplayCount),$("#keyOfSolo").val(preference.keyOfSolo),preference.enableArticleUpdateHint?$("#enableArticleUpdateHint").attr("checked","checked"):$("#enableArticleUpdateHint").removeAttr("checked"),preference.allowVisitDraftViaPermalink?$("#allowVisitDraftViaPermalink").attr("checked","checked"):$("allowVisitDraftViaPermalink").removeAttr("checked"),admin.preference.locale=preference.localeString,admin.preference.editorType=preference.editorType,$("#skinMain").data("skinDirName",preference.skinDirName);var skins=eval("("+preference.skins+")"),skinsHTML="";for(var i=0;i<skins.length;i++){var selectedClass="";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),$("#preferenceSignButton"+j).tip({content:signs[j].signHTML===""?Label.signIsNullLabel:signs[j].signHTML.replace(/\n/g,"").replace(/<script.*<\/script>/ig,""),position:"bottom"});$("#articleListDisplay").val(preference.articleListStyle),$("#editorType").val(preference.editorType),$("#feedOutputMode").val(preference.feedOutputMode),preference.commentable?$("#commentable").attr("checked","checked"):$("commentable").removeAttr("checked"),$("#loadMsg").text("")}})},validate:function(){return/^\d+$/.test($("#mostUsedTagDisplayCount").val())?/^\d+$/.test($("#recentCommentDisplayCount").val())?/^\d+$/.test($("#mostCommentArticleDisplayCount").val())?/^\d+$/.test($("#mostViewArticleDisplayCount").val())?/^\d+$/.test($("#articleListDisplayCount").val())?/^\d+$/.test($("#articleListPaginationWindowSize").val())?/^\d+$/.test($("#randomArticlesDisplayCount").val())?/^\d+$/.test($("#relevantArticlesDisplayCount").val())?/^\d+$/.test($("#externalRelevantArticlesDisplayCount").val())?!0:($("#tipMsg").text("["+Label.paramSettingsLabel+" - "+Label.externalRelevantArticlesDisplayCntLabel+"] "+Label.nonNegativeIntegerOnlyLabel),$("#externalRelevantArticlesDisplayCount").focus(),!1):($("#tipMsg").text("["+Label.paramSettingsLabel+" - "+Label.relevantArticlesDisplayCntLabel+"] "+Label.nonNegativeIntegerOnlyLabel),$("#relevantArticlesDisplayCount").focus(),!1):($("#tipMsg").text("["+Label.paramSettingsLabel+" - "+Label.randomArticlesDisplayCntLabel+"] "+Label.nonNegativeIntegerOnlyLabel),$("#randomArticlesDisplayCount").focus(),!1):($("#tipMsg").text("["+Label.paramSettingsLabel+" - "+Label.windowSizeLabel+"] "+Label.nonNegativeIntegerOnlyLabel),$("#articleListPaginationWindowSize").focus(),!1):($("#tipMsg").text("["+Label.paramSettingsLabel+" - "+Label.pageSizeLabel+"] "+Label.nonNegativeIntegerOnlyLabel),$("#articleListDisplayCount").focus(),!1):($("#tipMsg").text("["+Label.paramSettingsLabel+" - "+Label.indexMostViewArticleDisplayCntLabel+"] "+Label.nonNegativeIntegerOnlyLabel),$("#mostViewArticleDisplayCount").focus(),!1):($("#tipMsg").text("["+Label.paramSettingsLabel+" - "+Label.indexMostCommentArticleDisplayCntLabel+"] "+Label.nonNegativeIntegerOnlyLabel),$("#mostCommentArticleDisplayCount").focus(),!1):($("#tipMsg").text("["+Label.paramSettingsLabel+" - "+Label.indexRecentCommentDisplayCntLabel+"] "+Label.nonNegativeIntegerOnlyLabel),$("#recentCommentDisplayCount").focus(),!1):($("#tipMsg").text("["+Label.paramSettingsLabel+" - "+Label.indexTagDisplayCntLabel+"] "+Label.nonNegativeIntegerOnlyLabel),$("#mostUsedTagDisplayCount").focus(),!1)},update:function(){if(!admin.preference.validate())return;$("#tipMsg").text(""),$("#loadMsg").text(Label.loadingLabel);var e=[{oId:0,signHTML:""},{oId:1,signHTML:$("#preferenceSign1").val()},{oId:2,signHTML:$("#preferenceSign2").val()},{oId:3,signHTML:$("#preferenceSign3").val()}],t={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"),blogHost:$("#blogHost").val(),localeString:$("#localeString").val(),timeZoneId:$("#timeZoneId").val(),noticeBoard:$("#noticeBoard").val(),htmlHead:$("#htmlHead").val(),externalRelevantArticlesDisplayCount:$("#externalRelevantArticlesDisplayCount").val(),relevantArticlesDisplayCount:$("#relevantArticlesDisplayCount").val(),randomArticlesDisplayCount:$("#randomArticlesDisplayCount").val(),enableArticleUpdateHint:$("#enableArticleUpdateHint").prop("checked"),signs:e,keyOfSolo:$("#keyOfSolo").val(),allowVisitDraftViaPermalink:$("#allowVisitDraftViaPermalink").prop("checked"),articleListStyle:$("#articleListDisplay").val(),editorType:$("#editorType").val(),feedOutputMode:$("#feedOutputMode").val(),commentable:$("#commentable").prop("checked")}};$.ajax({url:latkeConfig.servePath+"/console/preference/",type:"PUT",cache:!1,data:JSON.stringify(t),success:function(t,n){$("#tipMsg").text(t.msg);if(!t.sc){$("#loadMsg").text("");return}($("#localeString").val()!==admin.preference.locale||$("#editorType").val()!==admin.preference.editorType)&&window.location.reload();for(var r=1;r<e.length;r++)$("#articleSign"+e[r].oId).length===1&&$("#articleSign"+e[r].oId).tip("option","content",e[r].signHTML===""?Label.signIsNullLabel:e[r].signHTML.replace(/\n/g,"").replace(/<script.*<\/script>/ig,"")),$("#preferenceSignButton"+e[r].oId).tip("option","content",e[r].signHTML===""?Label.signIsNullLabel:e[r].signHTML.replace(/\n/g,"").replace(/<script.*<\/script>/ig,""));$("#loadMsg").text("")}})}},admin.register.preference={obj:admin.preference,init:admin.preference.init,refresh:function(){$("#loadMsg").text("")}},admin.pluginList={tablePagination:new TablePaginate("plugin"),pageInfo:{currentCount:1,pageCount:1,currentPage:1},init:function(e){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(),this.getList(e)},getList:function(e){$("#loadMsg").text(Label.loadingLabel);var t=this;$.ajax({url:latkeConfig.servePath+"/console/plugins/"+e+"/"+Label.PAGE_SIZE+"/"+Label.WINDOW_SIZE,type:"GET",cache:!1,success:function(n,r){$("#tipMsg").text(n.msg);if(!n.sc){$("#loadMsg").text("");return}admin.pluginList.pageInfo.currentPage=e;var i=n.plugins;for(var s=0;s<i.length;s++)i[s].expendRow="<a href='javascript:void(0)' onclick=\"admin.pluginList.changeStatus('"+i[s].oId+"', '"+i[s].status+"')\">",i[s].status==="ENABLED"?(i[s].status=Label.enabledLabel,i[s].expendRow+=Label.disableLabel):(i[s].status=Label.disabledLabel,i[s].expendRow+=Label.enableLabel),i[s].expendRow+="</a>";t.tablePagination.updateTablePagination(n.plugins,e,n.pagination),$("#loadMsg").text("")}})},changeStatus:function(e,t){t==="ENABLED"?t="DISABLED":t="ENABLED";var n={oId:e,status:t};$.ajax({url:latkeConfig.servePath+"/console/plugin/status/",type:"PUT",cache:!1,data:JSON.stringify(n),success:function(e,t){$("#tipMsg").text(e.msg);if(!e.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(e){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.administratorLabel,index:"isAdmin",width:120}]),this.tablePagination.initPagination(),this.getList(e),$("#userUpdate").dialog({width:700,height:190,modal:!0,hideFooter:!0})},getList:function(e){$("#loadMsg").text(Label.loadingLabel),this.pageInfo.currentPage=e;var t=this;$.ajax({url:latkeConfig.servePath+"/console/users/"+e+"/"+Label.PAGE_SIZE+"/"+Label.WINDOW_SIZE,type:"GET",cache:!1,success:function(n,r){$("#tipMsg").text(n.msg);if(!n.sc){$("#loadMsg").text("");return}var i=n.users,s=[];admin.userList.pageInfo.currentCount=i.length,admin.userList.pageInfo.pageCount=n.pagination.paginationPageCount;if(i.length<1){$("#tipMsg").text("No user "+Label.reportIssueLabel),$("#loadMsg").text("");return}for(var o=0;o<i.length;o++)s[o]={},s[o].userName=i[o].userName,s[o].userEmail=i[o].userEmail,"adminRole"===i[o].userRole?(s[o].isAdmin="&nbsp;"+Label.administratorLabel,s[o].expendRow="<a href='javascript:void(0)' onclick=\"admin.userList.get('"+i[o].oId+"', '"+i[o].userRole+"')\">"+Label.updateLabel+"</a>"):(s[o].expendRow="<a href='javascript:void(0)' onclick=\"admin.userList.get('"+i[o].oId+"', '"+i[o].userRole+"')\">"+Label.updateLabel+"</a> <a href='javascript:void(0)' onclick=\"admin.userList.del('"+i[o].oId+"')\">"+Label.removeLabel+"</a>",s[o].isAdmin=Label.commonUserLabel);t.tablePagination.updateTablePagination(s,e,n.pagination),$("#loadMsg").text("")}})},add:function(){if(this.validate()){$("#loadMsg").text(Label.loadingLabel),$("#tipMsg").text("");var e={userName:$("#userName").val(),userEmail:$("#userEmail").val(),userPassword:$("#userPassword").val()};$.ajax({url:latkeConfig.servePath+"/console/user/",type:"POST",cache:!1,data:JSON.stringify(e),success:function(e,t){$("#tipMsg").text(e.msg);if(!e.sc){$("#loadMsg").text("");return}$("#userName").val(""),$("#userEmail").val(""),$("#userPassword").val(""),admin.userList.pageInfo.currentCount===Label.PAGE_SIZE&&admin.userList.pageInfo.currentPage===admin.userList.pageInfo.pageCount&&admin.userList.pageInfo.pageCount++;var n=window.location.hash.split("/");admin.userList.pageInfo.pageCount!==parseInt(n[n.length-1])&&admin.setHashByPage(admin.userList.pageInfo.pageCount),admin.userList.getList(admin.userList.pageInfo.pageCount),$("#loadMsg").text("")}})}},get:function(e,t){$("#loadMsg").text(Label.loadingLabel),$("#userUpdate").dialog("open"),$.ajax({url:latkeConfig.servePath+"/console/user/"+e,type:"GET",cache:!1,success:function(n,r){$("#tipMsg").text(n.msg);if(!n.sc){$("#loadMsg").text("");return}var i=$("#userEmailUpdate");$("#userNameUpdate").val(n.user.userName).data("userInfo",{oId:e,userRole:t}),i.val(n.user.userEmail),"adminRole"===t?i.attr("disabled","disabled"):i.removeAttr("disabled"),$("#userPasswordUpdate").val(n.user.userPassword),$("#loadMsg").text("")}})},update:function(){if(this.validate("Update")){$("#loadMsg").text(Label.loadingLabel),$("#tipMsg").text("");var e=$("#userNameUpdate").data("userInfo"),t={userName:$("#userNameUpdate").val(),oId:e.oId,userEmail:$("#userEmailUpdate").val(),userRole:e.userRole,userPassword:$("#userPasswordUpdate").val()};$.ajax({url:latkeConfig.servePath+"/console/user/",type:"PUT",cache:!1,data:JSON.stringify(t),success:function(e,t){$("#userUpdate").dialog("close"),$("#tipMsg").text(e.msg);if(!e.sc){$("#loadMsg").text("");return}admin.userList.getList(admin.userList.pageInfo.currentPage),$("#loadMsg").text("")}})}},del:function(e){var t=confirm(Label.confirmRemoveLabel);t&&($("#loadMsg").text(Label.loadingLabel),$("#tipMsg").text(""),$.ajax({url:latkeConfig.servePath+"/console/user/"+e,type:"DELETE",cache:!1,success:function(e,t){$("#tipMsg").text(e.msg);if(!e.sc){$("#loadMsg").text("");return}var n=admin.userList.pageInfo.currentPage;admin.userList.pageInfo.currentCount===1&&admin.userList.pageInfo.pageCount!==1&&admin.userList.pageInfo.currentPage===admin.userList.pageInfo.pageCount&&(admin.userList.pageInfo.pageCount--,n=admin.userList.pageInfo.pageCount);var r=window.location.hash.split("/");n!==parseInt(r[r.length-1])&&admin.setHashByPage(n),admin.userList.getList(n),$("#loadMsg").text("")}}))},validate:function(e){e||(e="");if($("#userName"+e).val().replace(/\s/g,"")==="")$("#tipMsg").text(Label.nameEmptyLabel),$("#userName"+e).focus();else if($("#userEmail"+e).val().replace(/\s/g,"")==="")$("#tipMsg").text(Label.mailCannotEmptyLabel),$("#userEmail"+e).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"+e).val()))$("#tipMsg").text(Label.mailInvalidLabel),$("#userEmail"+e).focus();else{if($("#userPassword"+e).val().replace(/\s/g,"")!=="")return!0;$("#tipMsg").text(Label.passwordEmptyLabel),$("#userPassword"+e).focus()}return!1}},admin.register["user-list"]={obj:admin.userList,init:admin.userList.init,refresh:function(){$("#loadMsg").text("")}},admin.commentList={tablePagination:new TablePaginate("comment"),pageInfo:{currentPage:1},init:function(e){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(e)},getList:function(e){var t=this;$("#loadMsg").text(Label.loadingLabel),$.ajax({url:latkeConfig.servePath+"/console/comments/"+e+"/"+Label.PAGE_SIZE+"/"+Label.WINDOW_SIZE,type:"GET",cache:!1,success:function(n,r){$("#tipMsg").text(n.msg);if(!n.sc){$("#loadMsg").text("");return}t.pageInfo.currentPage=e;var i=n.comments,s=[];for(var o=0;o<i.length;o++){var u="Article";i[o].type==="pageComment"&&(u="Page"),s[o]={},s[o].content=Util.replaceEmString(i[o].commentContent)+"<span class='table-tag'> on &nbsp;&nbsp;</span><a href='"+latkeConfig.servePath+i[o].commentSharpURL+"' target='_blank'>"+i[o].commentTitle+"</a>",s[o].expendRow="<a href='javascript:void(0)' onclick=\"admin.commentList.del('"+i[o].oId+"', '"+u+"')\">"+Label.removeLabel+"</a>",s[o].title="<img class='small-head' src='"+i[o].commentThumbnailURL+"'/>","http://"===i[o].commentURL?s[o].title+=i[o].commentName:s[o].title+="<a href='"+i[o].commentURL+"' target='_blank' class='no-underline'>"+i[o].commentName+"</a>",s[o].title+="<br/><a href='mailto:"+i[o].commentEmail+"'>"+i[o].commentEmail+"</a>",s[o].date=$.bowknot.getDate(i[o].commentTime)}t.tablePagination.updateTablePagination(s,e,n.pagination),$("#loadMsg").text("")}})},del:function(e,t){confirm(Label.confirmRemoveLabel)&&($("#loadMsg").text(Label.loadingLabel),$.ajax({url:latkeConfig.servePath+"/console/"+t.toLowerCase()+"/comment/"+e,type:"DELETE",cache:!1,success:function(e,t){$("#tipMsg").text(e.msg);if(!e.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(e){e.isInit=!1,e.hash=e.path.replace("/","#")+"/"+e.id,this.plugins.push(e);var t=this._analysePath(e.path);e.index&&t.length<2&&this._addNew(e,t)},setCurByHash:function(e){var t=this.plugins;for(var n=0;n<t.length;n++){var r=t[n],i=this._analysePath(r.path),s=!1;if(r.index&&window.location.hash.indexOf(r.hash)>-1)s=!0;else if(r.path.replace("/","#")===window.location.hash||window.location.hash==="#main"&&r.path.indexOf("/main/panel")>-1)s=!0;s&&(r.isInit?plugins[r.id].refresh&&plugins[r.id].refresh(e.page):(r.index?i.length===2&&this._addNew(r,i):this._addToExist(r,i),plugins[r.id].init(e.page),r.isInit=!0))}},_analysePath:function(e){var t=e.split("/");return t.splice(0,1),t},_addNew:function(e,t){if(t.length===2){e.target=$("#tabPreference li").get(e.index-1),$("#tabPreference").tabs("add",e);return}t[0]===""?e.target=$("#tabs>ul>li").get(e.index-1):t[0]==="article"?e.target=$("#tabArticleMgt>li").get(e.index-1):t[0]==="tools"&&(admin.tools.push("#"+e.id),e.target=$("#tabTools>li").get(e.index-1)),e.target||alert("data.index is error!"),$("#tabs").tabs("add",e)},_addToExist:function(e,t){switch(t[0]){case"main":$("#mainPanel"+t[1].charAt(5)).append(e.content);break;case"tools":case"article":t.length===2?$("#tabsPanel_"+t[1]).append(e.content):$("#tabPreferencePanel_"+t[2]).append(e.content);break;case"comment-list":$("#tabsPanel_comment-list").append(e.content)}}},admin.main={},admin.register.main={obj:admin.main,init:function(){$("#loadMsg").text("")},refresh:function(){$("#loadMsg").text("")}},admin.about={init:function(){$.ajax({url:"http://rhythm.b3log.org/version/solo/latest/"+Label.version,type:"GET",cache:!1,dataType:"jsonp",error:function(){},success:function(e,t){var n=e.soloVersion;n===Label.version?$("#aboutLatest").text(Label.upToDateLabel):$("#aboutLatest").html(Label.outOfDateLabel+"<a href='"+e.soloDownload+"'>"+n+"</a>"),$("#loadMsg").text("")}})}},admin.register.about={obj:admin.about,init:admin.about.init,refresh:function(){$("#loadMsg").text("")}};
\ No newline at end of file
/*
* Copyright (c) 2009, 2010, 2011, 2012, B3log Team
*
* 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.
*//**
* @fileoverview util and every page should be used.
*
* @author <a href="mailto:LLY219@gmail.com">Liyuan Li</a>
* @author <a href="mailto:DL88250@gmail.com">Liang Ding</a>
* @version 1.0.2.2, Jul 23, 2012
*//**
* @description Util
* @static
*/var Util={error:function(){$("#tipMsg").text("Error: "+arguments[0]+" File: "+arguments[1]+"\nLine: "+arguments[2]+" please report this issue on https://github.com/b3log/b3log-solo/issues/new"),$("#loadMsg").text("")},killIE:function(){if($.browser.msie){if($.browser.version==="6.0"||$.browser.version==="7.0"){window.location=latkeConfig.servePath+"/kill-browser.html";return}if(window.external&&window.external.twGetRunPath){var e=external.twGetRunPath();if(e&&e.toLowerCase().indexOf("360se")>-1&&window.location.href.indexOf("admin-index")>-1){window.location=latkeConfig.servePath+"/kill-browser.html";return}}}},replaceEmString:function(e){var t=e.split("[em");if(t.length===1)return e;e=t[0];for(var n=1;n<t.length;n++){var r=t[n].substr(0,2);e+="<img src='"+latkeConfig.staticServePath+"/skins/"+Label.skinDirName+"/images/emotions/em"+r+".png' alt='"+Label["em"+r+"Label"]+"' title='"+Label["em"+r+"Label"]+"'/>"+t[n].substr(3)}return e},proessURL:function(e){return/^\w+:\/\//.test(e)||(e="http://"+e),e},switchMobile:function(e){Cookie.createCookie("btouch_switch_toggle",e,365),setTimeout(function(){location.reload()},1250)},setTopBar:function(){var e=$("#top");if(e.length===1){var t=$("#showTop");t.click(function(){e.slideDown(),t.hide()}),$("#hideTop").click(function(){e.slideUp(),t.show()})}},goTop:function(){var e=e||.1,t=$(window).scrollTop(),n=1+e;window.scrollTo(0,Math.floor(t/n));if(t>0){var r="Util.goTop("+e+")";window.setTimeout(r,16)}},goBottom:function(e){e||(e=0),window.scrollTo(0,$("body").height()-$(window).height()-e)},init:function(){Util.killIE(),Util.setTopBar()},clearCache:function(e){var t={};e==="all"?t={all:"all",URI:""}:t={all:"",URI:window.location.pathname},$.ajax({type:"POST",url:latkeConfig.servePath+"/clear-cache.do",cache:!1,contentType:"application/json",data:JSON.stringify(t),success:function(e){window.location.reload()}})},replaceSideEm:function(e){for(var t=0;t<e.length;t++){var n=$(e[t]);n.html(Util.replaceEmString(n.html()))}},buildTags:function(e){e=e||"tags";var t=["tags1","tags2","tags3","tags4","tags5"],n=$("#"+e+" b").get(),r=parseInt($("#"+e+" b").last().text()),i=Math.ceil(r/t.length);for(var s=0;s<n.length;s++){var o=parseInt(n[s].innerHTML);for(var u=0;u<t.length;u++)if(o>u*i&&o<=(u+1)*i){n[s].parentNode.className=t[u];break}}$("#"+e).html($("#"+e+" li").get().sort(function(e,t){var n=$(e).find("span").text().toLowerCase(),r=$(t).find("span").text().toLowerCase();return n.localeCompare(r)}))},toDate:function(e,t){var n=new Date(e),r,i=n.getFullYear(),s=n.getMonth()+1,o=n.getDate(),u=n.getHours()+1,a=n.getMinutes()+1;switch(t){case"yy-MM-dd HH:mm":r=i.toString().substr(2)+"-"+s+"-"+o+" "+u+":"+a;break;default:}return r}};if(!Cookie)var Cookie={readCookie:function(e){var t=e+"=",n=document.cookie.split(";");for(var r=0;r<n.length;r++){var i=n[r];while(i.charAt(0)==" ")i=i.substring(1,i.length);if(i.indexOf(t)==0)return decodeURIComponent(i.substring(t.length,i.length))}return""},eraseCookie:function(e){this.createCookie(e,"",-1)},createCookie:function(e,t,n){var r="";if(n){var i=new Date;i.setTime(i.getTime()+n*24*60*60*1e3),r="; expires="+i.toGMTString()}document.cookie=e+"="+encodeURIComponent(t)+r+"; path=/"}};
\ No newline at end of file
/*
* Copyright (c) 2009, 2010, 2011, 2012, B3log Team
*
* 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.
*//**
* @fileoverview Page util, load heighlight and process comment.
*
* @author <a href="mailto:LLY219@gmail.com">Liyuan Li</a>
* @author <a href="mailto:DL88250@gmail.com">Liang Ding</a>
* @version 1.0.3.1, Jul 5, 2012
*/var Page=function(e){this.currentCommentId="",this.tips=e};$.extend(Page.prototype,{insertEmotions:function(e){var t=this;e===undefined&&(e=""),$("#emotions"+e+" span").click(function(){var n=$("#comment"+e),r=t._getCursorEndPosition(n[0]),i="["+this.className+"]",s=n[0].value;s=s.substring(0,r)+i+s.substring(r,s.length),$("#comment"+e).val(s);if($.browser.msie){r-=s.split("\n").length-1;var o=n[0].createTextRange();o.collapse(!0),o.moveStart("character",r+6),o.select()}else n[0].setSelectionRange(r+6,r+6)})},_getCursorEndPosition:function(e){e.focus();if(e.setSelectionRange)return e.selectionEnd;if(document.selection){var t=0,n=document.selection.createRange(),r=document.body.createTextRange();r.moveToElementText(e),n.getBookmark();for(t=0;r.compareEndPoints("StartToStart",n)<0&&n.moveStart("character",-1)!==0;t++)e.value.charAt(t)=="\n"&&t++;return t}},validateComment:function(e){var t=$("#commentName"+e).val().replace(/(^\s*)|(\s*$)/g,""),n=$("#comment"+e).val().replace(/(^\s*)|(\s*$)/g,"");if(2>t.length||t.length>20)$("#commentErrorTip"+e).html(this.tips.nameTooLongLabel),$("#commentName"+e).focus();else if($("#commentEmail"+e).val().replace(/\s/g,"")==="")$("#commentErrorTip"+e).html(this.tips.mailCannotEmptyLabel),$("#commentEmail"+e).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"+e).val()))$("#commentErrorTip"+e).html(this.tips.mailInvalidLabel),$("#commentEmail"+e).focus();else if(2>n.length||n.length>500)$("#commentErrorTip"+e).html(this.tips.commentContentCannotEmptyLabel),$("#comment"+e).focus();else{if($("#commentValidate"+e).val().replace(/\s/g,"")!=="")return!0;$("#commentErrorTip"+e).html(this.tips.captchaCannotEmptyLabel),$("#commentValidate"+e).focus()}return $("#commentErrorTip"+e).show(),!1},replaceCommentsEm:function(e){var t=$(e);for(var n=0;n<t.length;n++){var r=t[n].innerHTML;t[n].innerHTML=Util.replaceEmString(r)}},_initSyntaxHighlighter:function(e){for(var t=0;t<e.length;t++)switch(e[t]){case"groovy":e[t]="groovy "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushGroovy.js";break;case"java":e[t]="java "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushJava.js";break;case"php":e[t]="php "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushPhp.js";break;case"scala":e[t]="scala "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushScala.js";break;case"sql":e[t]="sql "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushSql.js";break;case"applescript":e[t]="applescript "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushAppleScript.js";break;case"as3":case"actionscript3":e[t]="actionscript3 as3 "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushAS3.js";break;case"bash":case"shell":e[t]="bash shell "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushBash.js";break;case"coldfusion":case"cf":e[t]="coldfusion cf "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushColdFusion.js";break;case"c#":case"c-sharp":case"csharp":e[t]="c# c-sharp csharp "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushCSharp.js";break;case"cpp":case"c":e[t]="cpp c "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushCpp.js";break;case"css":e[t]="css "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushCss.js";break;case"delphi":case"pascal":e[t]="delphi pascal "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushDelphi.js";break;case"diff":case"patch":case"pas":e[t]="diff patch pas "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushDiff.js";break;case"erl":case"erlang":e[t]="erl erlang "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushErlang.js";break;case"js":case"jscript":case"javascript":e[t]="js jscript javascript "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushJScript.js";break;case"jfx":case"javafx":e[t]="jfx javafx "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushJavaFX.js";break;case"perl":case"pl":e[t]="perl pl "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushPerl.js";break;case"plain":case"text":e[t]="text plain "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushPlain.js";break;case"ps":case"powershell":e[t]="ps powershell "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushPowerShell.js";break;case"py":case"python":e[t]="py python "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushPython.js";break;case"rails":case"ror":case"ruby":case"rb":e[t]="ruby rails ror rb "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushRuby.js";break;case"sass":case"scss":e[t]="sass scss "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushSass.js";break;case"vb":case"vbnet":e[t]="vb vbnet "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushVb.js";break;case"xml":case"xhtml":case"xslt":case"html":e[t]="xml xhtml xslt html "+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushXml.js";break;default:}SyntaxHighlighter.autoloader.apply(null,e),SyntaxHighlighter.config.stripBrs=!0,SyntaxHighlighter.all()},_loadSyntaxHighlighter:function(e){var t=e?e:"shCoreEclipse",n=this;document.createStyleSheet?document.createStyleSheet(latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/styles/"+t+".css"):$("head").append($("<link rel='stylesheet' href='"+latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/styles/"+t+".css' type='text/css' charset='utf-8' />")),$.ajax({url:latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shCore.js",dataType:"script",cache:!0,success:function(){var e=[],t=!1;$(".article-body pre").each(function(){var n=this.className.split(";")[0],r=n.substr(7,n.length-1);this.className.indexOf("html-script: true")>-1&&r!=="xml"&&r!=="xhtml"&&r!=="xslt"&&r!="html"&&(t=!0),e.push(r)}),t?$.ajax({url:latkeConfig.staticServePath+"/js/lib/SyntaxHighlighter/scripts/shBrushXml.js",dataType:"script",cache:!0,success:function(){n._initSyntaxHighlighter(e)}}):n._initSyntaxHighlighter(e)}})},parseLanguage:function(e){var t=!1,n=!1;$(".article-body pre").each(function(){this.className.indexOf("brush")>-1&&(n=!0),this.className.indexOf("prettyprint")>-1&&(t=!0)}),n&&this._loadSyntaxHighlighter(e?e.SHTheme?e.SHTheme:undefined:undefined),t&&(document.createStyleSheet?document.createStyleSheet(latkeConfig.staticServePath+"/js/lib/google-code-prettify/prettify.css"):$("head").append($("<link rel='stylesheet' href='"+latkeConfig.staticServePath+"/js/lib/google-code-prettify/prettify.css'>")),document.write('<script src="'+latkeConfig.staticServePath+'/js/lib/google-code-prettify/prettify.js"></script>'),$(document).ready(function(){prettyPrint()}))},load:function(e){var t=this;t.insertEmotions(),t.parseLanguage(e?e.language?e.language:undefined:undefined),$("#commentValidate").keypress(function(e){e.keyCode===13&&t.submitComment()}),$("#captcha").click(function(){$(this).attr("src",latkeConfig.servePath+"/captcha.do?code="+Math.random())});var n=$("#top #admin");n.length===1&&n.find("a").length>2&&(Cookie.readCookie("commentName")===""&&Cookie.createCookie("commentName",n.find("span").text(),365),Cookie.readCookie("commentURL")===""&&Cookie.createCookie("commentURL",window.location.host,365)),$("#commentEmail").val(Cookie.readCookie("commentEmail")),$("#commentURL").val(Cookie.readCookie("commentURL")),$("#commentName").val(Cookie.readCookie("commentName"))},loadRandomArticles:function(e){var t=this.tips.randomArticles1Label;$.ajax({url:latkeConfig.staticServePath+"/get-random-articles.do",type:"POST",success:function(n,r){var i=n.randomArticles;if(!i||0===i.length){$("#randomArticles").remove();return}var s="";for(var o=0;o<i.length;o++){var u=i[o],a=u.articleTitle,f="<li><a rel='nofollow' title='"+a+"' href='"+u.articlePermalink+"'>"+a+"</a></li>";s+=f}var l=e?e:"<h4>"+t+"</h4>",c=l+"<ul class='marginLeft12'>"+s+"</ul>";$("#randomArticles").append(c)}})},loadRelevantArticles:function(e,t){$.ajax({url:latkeConfig.staticServePath+"/article/id/"+e+"/relevant/articles",type:"GET",success:function(e,n){var r=e.relevantArticles;if(!r||0===r.length){$("#relevantArticles").remove();return}var i="";for(var s=0;s<r.length;s++){var o=r[s],u=o.articleTitle,a="<li><a rel='nofollow' title='"+u+"' href='"+o.articlePermalink+"'>"+u+"</a></li>";i+=a}var f=t+"<ul class='marginLeft12'>"+i+"</ul>";$("#relevantArticles").append(f)},error:function(){$("#relevantArticles").remove()}})},loadExternalRelevantArticles:function(e,t){var n=this.tips;try{$.ajax({url:"http://rhythm.b3log.org:80/get-articles-by-tags.do?tags="+e+"&blogHost="+n.blogHost+"&paginationPageSize="+n.externalRelevantArticlesDisplayCount,type:"GET",cache:!0,dataType:"jsonp",error:function(){$("#externalRelevantArticles").remove()},success:function(e,r){var i=e.articles;if(!i||0===i.length){$("#externalRelevantArticles").remove();return}var s="";for(var o=0;o<i.length;o++){var u=i[o],a=u.articleTitle,f="<li><a rel='nofollow' title='"+a+"' target='_blank' href='"+u.articlePermalink+"'>"+a+"</a></li>";s+=f}var l=t?t:"<h4>"+n.externalRelevantArticles1Label+"</h4>",c=l+"<ul class='marginLeft12'>"+s+"</ul>";$("#externalRelevantArticles").append(c)}})}catch(r){}},submitComment:function(e,t){t||(t="");var n=this,r=this.tips,i="article";r.externalRelevantArticlesDisplayCount===undefined&&(i="page");if(this.validateComment(t)){$("#submitCommentButton"+t).attr("disabled","disabled"),$("#commentErrorTip"+t).show().html(this.tips.loadingLabel);var s={oId:r.oId,commentContent:$("#comment"+t).val().replace(/(^\s*)|(\s*$)/g,""),commentEmail:$("#commentEmail"+t).val(),commentURL:Util.proessURL($("#commentURL"+t).val().replace(/(^\s*)|(\s*$)/g,"")),commentName:$("#commentName"+t).val().replace(/(^\s*)|(\s*$)/g,""),captcha:$("#commentValidate"+t).val()};t==="Reply"&&(s.commentOriginalCommentId=e),$.ajax({type:"POST",url:latkeConfig.servePath+"/add-"+i+"-comment.do",cache:!1,contentType:"application/json",data:JSON.stringify(s),success:function(e){if(!e.sc){$("#commentErrorTip"+t).html(e.msg),$("#commentValidate"+t).val("").focus(),$("#submitCommentButton"+t).removeAttr("disabled"),$("#captcha"+t).attr("src",latkeConfig.servePath+"/captcha.do?code="+Math.random());return}e.replyNameHTML="",$("#commentURL"+t).val().replace(/\s/g,"")===""?e.replyNameHTML="<a>"+$("#commentName"+t).val()+"</a>":e.replyNameHTML='<a href="'+Util.proessURL($("#commentURL"+t).val())+'" target="_blank">'+$("#commentName"+t).val()+"</a>",n.addCommentAjax(addComment(e,t),t),$("#submitCommentButton"+t).removeAttr("disabled"),$("#captcha"+t).attr("src",latkeConfig.servePath+"/captcha.do?code="+Math.random())}}),Cookie.createCookie("commentName",s.commentName,365),Cookie.createCookie("commentEmail",s.commentEmail,365),Cookie.createCookie("commentURL",$("#commentURL"+t).val().replace(/(^\s*)|(\s*$)/g,""),365)}},addReplyForm:function(e,t,n){var r=this;if(e===this.currentCommentId){Cookie.readCookie("commentName")===""?$("#commentNameReply").focus():$("#commentReply").focus();return}$("#replyForm").remove(),n=n?n:"",n==="</div>"?$("#"+e).append(t+$("#commentForm").html()+n):$("#"+e).append(t+$("#commentForm").html()+"</table>"+n),$("#replyForm input, #replyForm textarea").each(function(){this.id=this.id+"Reply"}),$("#commentNameReply").val(Cookie.readCookie("commentName")),$("#commentEmailReply").val(Cookie.readCookie("commentEmail"));var i=$("#replyForm #commentURLLabel");i.length===1&&i.attr("id","commentURLLabelReply"),$("#commentURLReply").val(Cookie.readCookie("commentURL")),$("#replyForm #emotions").attr("id","emotionsReply"),this.insertEmotions("Reply"),$("#commentValidateReply").unbind().keypress(function(t){t.keyCode===13&&(r.submitComment(e,"Reply"),t.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(){r.submitComment(e,"Reply")}),Cookie.readCookie("commentName")===""?$("#commentNameReply").focus():$("#commentReply").focus(),this.currentCommentId=e},hideComment:function(e){$("#commentRef"+e).hide()},showComment:function(e,t,n,r){var i=parseInt($(e).position().top);r&&(i=parseInt($(e).parents(r).position().top));if($("#commentRef"+t).length>0)$("#commentRef"+t).show().css("top",i+n+"px");else{var s=$("#"+t).clone();s.addClass("comment-body-ref").attr("id","commentRef"+t),s.find("#replyForm").remove(),$("#comments").append(s),$("#commentRef"+t).css("top",i+n+"px")}},addCommentAjax:function(e,t){$("#comments").children().length>0?$($("#comments").children()[0]).before(e):$("#comments").html(e),t===""?($("#commentErrorTip").html("").hide(),$("#comment").val(""),$("#commentValidate").val(""),$("#captcha").attr("src",latkeConfig.servePath+"/captcha.do?code="+Math.random())):$("#replyForm").remove(),window.location.hash="#comments"}});
\ No newline at end of file
var fs = require("fs"),
exec = require("child_process").exec;
// js compress
// b3log js compress
exec("uglifyjs ../../js/common.js > ../../js/common.min.js", function (error, stdout, stderr) {
if (error !== null) {
console.log(error);
}
});
exec("uglifyjs ../../js/page.js > ../../js/page.min.js", function (error, stdout, stderr) {
if (error !== null) {
console.log(error);
}
});
// combi admin js
var adminJs = fs.readFileSync("../../js/admin/admin.js");
adminJs += fs.readFileSync("../../js/admin/editor.js");
adminJs += fs.readFileSync("../../js/admin/editorTinyMCE.js");
adminJs += fs.readFileSync("../../js/admin/editorKindEditor.js");
adminJs += fs.readFileSync("../../js/admin/editorCodeMirror.js");
adminJs += fs.readFileSync("../../js/admin/tablePaginate.js");
adminJs += fs.readFileSync("../../js/admin/article.js");
adminJs += fs.readFileSync("../../js/admin/comment.js");
adminJs += fs.readFileSync("../../js/admin/articleList.js");
adminJs += fs.readFileSync("../../js/admin/draftList.js");
adminJs += fs.readFileSync("../../js/admin/pageList.js");
adminJs += fs.readFileSync("../../js/admin/others.js");
adminJs += fs.readFileSync("../../js/admin/linkList.js");
adminJs += fs.readFileSync("../../js/admin/preference.js");
adminJs += fs.readFileSync("../../js/admin/pluginList.js");
adminJs += fs.readFileSync("../../js/admin/userList.js");
adminJs += fs.readFileSync("../../js/admin/commentList.js");
adminJs += fs.readFileSync("../../js/admin/plugin.js");
adminJs += fs.readFileSync("../../js/admin/main.js");
adminJs += fs.readFileSync("../../js/admin/about.js");
fs.writeFileSync("../../js/admin/latkeAdmin.js", adminJs, "UTF-8");
// compress admin js
exec("uglifyjs ../../js/admin/latkeAdmin.js > ../../js/admin/latkeAdmin.min.js", function (error, stdout, stderr) {
if (error !== null) {
console.log(error);
}
});
// b3log css compress
var b3logCsses = ["default-admin", "default-base", "default-init"];
for (var i = 0; i < b3logCsses.length; i++) {
exec("lessc -compress ../../css/" + b3logCsses[i] + ".css > ../../css/" + b3logCsses[i] + ".min.css", function (error, stdout, stderr) {
if (error !== null) {
console.log(error);
}
});
}
// skin js compress
var jsPaths = ["ease"];
for (var i = 0; i < jsPaths.length; i++) {
var content = "";
exec("uglifyjs ../../skins/" + jsPaths[i] + "/js/" + jsPaths[i] + ".js > ../../skins/" + jsPaths[i] + "/js/" + jsPaths[i] + ".min.js", function (error, stdout, stderr) {
if (error !== null) {
console.log(error);
......@@ -11,11 +60,9 @@ for (var i = 0; i < jsPaths.length; i++) {
});
}
// css compress
// skin css compress
var csses = ["ease", "ease-ie8"];
for (var i = 0; i < csses.length; i++) {
var content = "";
exec("lessc -compress ../../skins/ease/css/" + csses[i] + ".css > ../../skins/ease/css/" + csses[i] + ".min.css", function (error, stdout, stderr) {
if (error !== null) {
console.log(error);
......
var fs = require('fs'),
path = require('path');
var getAllFiles = function (root){
var res = [],
files = fs.readdirSync(root);
files.forEach(function(file){
var pathname = root+'/'+file,
stat = fs.lstatSync(pathname);
if (!stat.isDirectory()){
if (file.indexOf(".ftl") < 0 && file.indexOf(".properties") < 0 && root.indexOf("js/tools") < 0) {
res.push(pathname);
}
} else {
res = res.concat(getAllFiles(pathname));
}
});
return res;
};
var mkdirsSync = function(dirpath) {
if(fs.existsSync(dirpath)){
return;
}
var dirs = dirpath.split('/');
var dir = '';
for(var i = 0; i < dirs.length; i++) {
dir += dirs[i] + '/';
if(!fs.existsSync(dir)){
fs.mkdirSync(dir);
}
}
};
var css = getAllFiles("../../css"),
image = getAllFiles("../../images"),
js = getAllFiles("../../js"),
plugin = getAllFiles("../../plugins"),
skins = getAllFiles("../../skins");
(function () {
mkdirsSync("static/css");
for (var i = 0; i < css.length; i++) {
if (css[i].indexOf(".min.css") > -1) {
fs.writeFileSync(css[i].replace("../..", "static"), fs.readFileSync(css[i]), "UTF-8");
}
}
for (var i = 0; i < image.length; i++) {
mkdirsSync(path.dirname(image[i].replace("../..", "static")));
fs.writeFileSync(image[i].replace("../..", "static"), fs.readFileSync(image[i]), "UTF-8");
}
for (var i = 0; i < js.length; i++) {
var pathdir = path.dirname(js[i].replace("../..", "static"));
if (pathdir.indexOf("/js/tools") < 0) {
mkdirsSync(pathdir);
}
if ((pathdir.indexOf("/js/admin") > -1 && path.basename(js[i]) === "latkeAdmin.min.js")
|| pathdir.indexOf("/js/lib") > -1
|| (pathdir.split("/").length == 2 && js[i].indexOf(".min.js") > -1)) {
fs.writeFileSync(js[i].replace("../..", "static"), fs.readFileSync(js[i]), "UTF-8");
}
}
for (var i = 0; i < plugin.length; i++) {
mkdirsSync(path.dirname(plugin[i].replace("../..", "static")));
fs.writeFileSync(plugin[i].replace("../..", "static"), fs.readFileSync(plugin[i]), "UTF-8");
}
for (var i = 0; i < skins.length; i++) {
mkdirsSync(path.dirname(skins[i].replace("../..", "static")));
fs.writeFileSync(skins[i].replace("../..", "static"), fs.readFileSync(skins[i]), "UTF-8");
}
fs.writeFileSync("static/favicon.ico", fs.readFileSync("../../favicon.ico"), "UTF-8");
fs.writeFileSync("static/favicon.png", fs.readFileSync("../../favicon.png"), "UTF-8");
})();
\ 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