Commit 1f1710b2 authored by Liang Ding's avatar Liang Ding

🚧 #12256

parent 1493c52b
...@@ -335,9 +335,7 @@ public class CategoryConsole { ...@@ -335,9 +335,7 @@ public class CategoryConsole {
if (StringUtils.isBlank(uri)) { if (StringUtils.isBlank(uri)) {
uri = title; uri = title;
} }
if (!StringUtils.startsWith(uri, "/")) {
uri = '/' + uri;
}
mayExist = categoryQueryService.getByURI(uri); mayExist = categoryQueryService.getByURI(uri);
if (null != mayExist && !mayExist.optString(Keys.OBJECT_ID).equals(categoryId)) { if (null != mayExist && !mayExist.optString(Keys.OBJECT_ID).equals(categoryId)) {
final JSONObject jsonObject = QueryResults.defaultResult(); final JSONObject jsonObject = QueryResults.defaultResult();
...@@ -459,9 +457,7 @@ public class CategoryConsole { ...@@ -459,9 +457,7 @@ public class CategoryConsole {
if (StringUtils.isBlank(uri)) { if (StringUtils.isBlank(uri)) {
uri = title; uri = title;
} }
if (!StringUtils.startsWith(uri, "/")) {
uri = '/' + uri;
}
mayExist = categoryQueryService.getByURI(uri); mayExist = categoryQueryService.getByURI(uri);
if (null != mayExist) { if (null != mayExist) {
final JSONObject jsonObject = QueryResults.defaultResult(); final JSONObject jsonObject = QueryResults.defaultResult();
......
This diff is collapsed.
/**
* Copyright (c) 2010-2017, b3log.org & hacpai.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
html,body,div,ul,li,h1,h2,h3,h4,h5,h6,p,dd,dl,ol{margin:0;padding:0}body{background-color:#FFF;color:#000;font-family:elvetica,Arial,'sans-serif','\5fae\8f6f\96c5\9ed1';font-size:small}img{border:medium none;margin:0;padding:0;vertical-align:middle}h1{font-size:160%}h2{font-size:140%}h3{font-size:120%}h4{font-size:110%}textarea{overflow:auto}li{margin-left:12px}button,.button{background:url(../images/icon.png) repeat center bottom;border:1px solid;border-color:#CCc #bbb #A0A0A0;border-radius:4px;height:28px;margin:0;padding:0 6px;vertical-align:top}button:hover,.button:hover{border-color:#BBB}.padding12{padding:12px}.paddingBottom12{padding-bottom:12px!important}.paddingTop12{padding-top:12px!important}.margin12{margin:12px}.marginTop12{margin-top:12px!important}.marginBottom12{margin-bottom:12px!important}.marginLeft12{margin-left:12px!important}.marginLeft6{margin-left:6px!important}.marginRight12{margin-right:12px!important}.f-bold{font-weight:bold!important}.nowrap{white-space:nowrap}.left{float:left}.right{float:right}.clear{background-color:transparent;border:0;clear:both;display:block;font-size:0;height:0;line-height:0;overflow:hidden}.fn-clear:before,.fn-clear:after{display:table;content:""}.fn-clear:after{clear:both}.none{display:none}.pointer{cursor:pointer}.no-underline{text-decoration:none!important}.red{color:red}.contentBody{margin-bottom:12px;padding:3px 12px}.form th{text-align:right;white-space:nowrap}.form input[type='text'],.form input[type='password'],.form textarea{border-color:#c0c0c0 #D9D9D9 #d9d9d9;border-right:1px solid #d9d9d9;border-style:solid;border-width:1px;font-family:Helvetica,Arial,sans-serif;font-size:12px;outline:medium none;width:99%;padding:0 3px}.form input{height:24px}.form input[type='checkbox']{border:0;vertical-align:middle}.form input.normalInput{width:auto}.form input[type='checkbox']:focus{border:0}.form input:focus,.form textarea:focus{box-shadow:0 1px 2px rgba(0,0,0,0.3) inset}.form textarea{padding:3px;overflow:auto;resize:vertical}.logo{padding:0 5px;text-decoration:none;text-shadow:0 0 1px #eee}.putTopIcon,.notPutTopIcon,.deleteIcon,.updateIcon,.commentIcon,.homeIcon,.adminIcon,.loginIcon,.logoutIcon,.calendarIcon,.browserIcon,.postIcon,.articlesIcon,.draftsIcon,.usersIcon,.linkIcon,.preferenceIcon,.pageIcon,.trueIcon,.falseIcon,.fileIcon,.othersIcon,.goTopIcon,.goBottomIcon,.cacheIcon,.aboutIcon{background-image:url("../images/icon.png");cursor:pointer;height:16px;width:16px}.adminIcon,.loginIcon,.logoutIcon,.homeIcon{margin-top:3px}.pageIcon{background-position:-144px 0}.postIcon{background-position:-16px 0}.linkIcon{background-position:-32px 0}.preferenceIcon{background-position:-48px 0}.articlesIcon{background-position:-64px 0}.trueIcon{background-position:-80px 0;cursor:auto}.falseIcon{background-position:-96px 0;cursor:auto}.fileIcon{background-position:-112px 0}.deleteIcon{background-position:0 -16px}.updateIcon{background-position:-16px -16px}.commentIcon{background-position:-32px -16px}.homeIcon{background-position:-64px -16px}.adminIcon{background-position:-80px -16px}.logoutIcon{background-position:-96px -16px}.loginIcon{background-position:-112px -16px}.browserIcon{background-position:-128px -16px}.calendarIcon{background-position:-144px -16px}.putTopIcon{background-position:-16px -32px;float:left}.notPutTopIcon{background-position:-32px -32px;float:left}.othersIcon{background-position:-48px -32px}.cacheIcon{background-position:-96px -32px}.draftsIcon{background-position:-96px -32px}.usersIcon{background-position:-112px -32px}.goTopIcon{background-position:-64px -32px;position:fixed;right:20px;top:45%}.goBottomIcon{background-position:-80px -32px;bottom:40%;position:fixed;right:20px}.article-body{overflow:hidden;line-height:145%;word-wrap:break-word}.article-body blockquote{border:1px dotted #98a47f;font-style:italic;margin:12px;padding:12px}.article-body h1{font-size:2em;margin:.67em 0}.article-body h2{font-size:1.5em;margin:.75em 0}.article-body h3{font-size:1.17em;margin:.83em 0}.article-body h4,.article-body p,.article-body blockquote,.article-body ul,.article-body fieldset,.article-body form,.article-body ol,.article-body dl,.article-body dir,.article-body menu{margin:1.12em 0}.article-body h5{font-size:.83em;margin:1.5em 0}.article-body h6{font-size:.75em;margin:1.67em 0}.article-body blockquote{margin-left:40px;margin-right:40px}.article-body ol,.article-body ul,.article-body dir,.article-body menu,.article-body dd{margin-left:40px}.em00,.em01,.em02,.em03,.em04,.em05,.em06,.em07,.em08,.em09,.em10,.em11,.em12,.em13,.em14{background-image:url("../images/emotions/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:0 -24px}.em06{background-position:-24px -24px}.em07{background-position:-48px -24px}.em08{background-position:-72px -24px}.em09{background-position:-96px -24px}.em10{background-position:0 -48px}.em11{background-position:-24px -48px}.em12{background-position:-48px -48px}.em13{background-position:-72px -48px}.em14{background-position:-96px -48px}#tags{list-style:none}#tags li{float:left;list-style:none;height:38px}#tags a:hover{text-shadow:0 0 2px #555}#tags a{border-radius:3px 3px 3px 3px;box-shadow:1px 1px 3px #555;float:left;margin:3px 6px;padding:3px 12px;text-decoration:none}#tags .tags1{font-size:12px;font-weight:normal}#tags .tags2{font-size:14px;font-weight:normal}#tags .tags3{font-size:16px;font-weight:normal}#tags .tags4{font-size:18px;font-weight:bold}#tags .tags5{font-size:20px;font-weight:bold}#captcha,#captchaReply{cursor:pointer} html,body,div,ul,li,h1,h2,h3,h4,h5,h6,p,dd,dl,ol{margin:0;padding:0}body{background-color:#FFF;color:#000;font-family:elvetica,Arial,'sans-serif','\5fae\8f6f\96c5\9ed1';font-size:small}img{border:medium none;margin:0;padding:0;vertical-align:middle}h1{font-size:160%}h2{font-size:140%}h3{font-size:120%}h4{font-size:110%}textarea{overflow:auto}li{margin-left:12px}button,.button{background:url(../images/icon.png) repeat center bottom;border:1px solid;border-color:#CCc #bbb #A0A0A0;border-radius:4px;height:28px;margin:0;padding:0 6px;vertical-align:top}button:hover,.button:hover{border-color:#BBB}.padding12{padding:12px}.paddingBottom12{padding-bottom:12px!important}.paddingTop12{padding-top:12px!important}.margin12{margin:12px}.marginTop12{margin-top:12px!important}.marginBottom12{margin-bottom:12px!important}.marginLeft12{margin-left:12px!important}.marginLeft6{margin-left:6px!important}.marginRight12{margin-right:12px!important}.f-bold{font-weight:bold!important}.nowrap{white-space:nowrap}.left{float:left}.right{float:right}.clear{background-color:transparent;border:0;clear:both;display:block;font-size:0;height:0;line-height:0;overflow:hidden}.fn-clear:before,.fn-clear:after{display:table;content:""}.fn-clear:after{clear:both}.none{display:none}.pointer{cursor:pointer}.no-underline{text-decoration:none!important}.red{color:red}.contentBody{margin-bottom:12px;padding:3px 12px}.form th{text-align:right;white-space:nowrap}.form input[type='text'],.form input[type='password'],.form textarea{border-color:#c0c0c0 #D9D9D9 #d9d9d9;border-right:1px solid #d9d9d9;border-style:solid;border-width:1px;font-family:Helvetica,Arial,sans-serif;font-size:12px;outline:medium none;width:99%;padding:0 3px}.form input{height:24px}.form input[type='checkbox']{border:0;vertical-align:middle}.form input.normalInput{width:auto}.form input[type='checkbox']:focus{border:0}.form input:focus,.form textarea:focus{box-shadow:0 1px 2px rgba(0,0,0,0.3) inset}.form textarea{padding:3px;overflow:auto;resize:vertical}.logo{padding:0 5px;text-decoration:none;text-shadow:0 0 1px #eee}.putTopIcon,.notPutTopIcon,.deleteIcon,.updateIcon,.commentIcon,.homeIcon,.adminIcon,.loginIcon,.logoutIcon,.calendarIcon,.browserIcon,.postIcon,.articlesIcon,.draftsIcon,.usersIcon,.linkIcon,.preferenceIcon,.pageIcon,.trueIcon,.falseIcon,.fileIcon,.othersIcon,.goTopIcon,.goBottomIcon,.cacheIcon,.aboutIcon{background-image:url("../images/icon.png");cursor:pointer;height:16px;width:16px}.adminIcon,.loginIcon,.logoutIcon,.homeIcon{margin-top:3px}.pageIcon{background-position:-144px 0}.postIcon{background-position:-16px 0}.linkIcon{background-position:-32px 0}.preferenceIcon{background-position:-48px 0}.articlesIcon{background-position:-64px 0}.trueIcon{background-position:-80px 0;cursor:auto}.falseIcon{background-position:-96px 0;cursor:auto}.fileIcon{background-position:-112px 0}.deleteIcon{background-position:0 -16px}.updateIcon{background-position:-16px -16px}.commentIcon{background-position:-32px -16px}.homeIcon{background-position:-64px -16px}.adminIcon{background-position:-80px -16px}.logoutIcon{background-position:-96px -16px}.loginIcon{background-position:-112px -16px}.browserIcon{background-position:-128px -16px}.calendarIcon{background-position:-144px -16px}.putTopIcon{background-position:-16px -32px;float:left}.notPutTopIcon{background-position:-32px -32px;float:left}.othersIcon{background-position:-48px -32px}.cacheIcon{background-position:-96px -32px}.draftsIcon{background-position:-96px -32px}.usersIcon{background-position:-112px -32px}.goTopIcon{background-position:-64px -32px;position:fixed;right:20px;top:45%}.goBottomIcon{background-position:-80px -32px;bottom:40%;position:fixed;right:20px}.article-body{overflow:hidden;line-height:145%;word-wrap:break-word}.article-body blockquote{border:1px dotted #98a47f;font-style:italic;margin:12px;padding:12px}.article-body h1{font-size:2em;margin:.67em 0}.article-body h2{font-size:1.5em;margin:.75em 0}.article-body h3{font-size:1.17em;margin:.83em 0}.article-body h4,.article-body p,.article-body blockquote,.article-body ul,.article-body fieldset,.article-body form,.article-body ol,.article-body dl,.article-body dir,.article-body menu{margin:1.12em 0}.article-body h5{font-size:.83em;margin:1.5em 0}.article-body h6{font-size:.75em;margin:1.67em 0}.article-body blockquote{margin-left:40px;margin-right:40px}.article-body ol,.article-body ul,.article-body dir,.article-body menu,.article-body dd{margin-left:40px}.em00,.em01,.em02,.em03,.em04,.em05,.em06,.em07,.em08,.em09,.em10,.em11,.em12,.em13,.em14{background-image:url("../images/emotions/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:0 -24px}.em06{background-position:-24px -24px}.em07{background-position:-48px -24px}.em08{background-position:-72px -24px}.em09{background-position:-96px -24px}.em10{background-position:0 -48px}.em11{background-position:-24px -48px}.em12{background-position:-48px -48px}.em13{background-position:-72px -48px}.em14{background-position:-96px -48px}#tags{list-style:none}#tags li{float:left;list-style:none;height:38px}#tags a:hover{text-shadow:0 0 2px #555}#tags a{border-radius:3px 3px 3px 3px;box-shadow:1px 1px 3px #555;float:left;margin:3px 6px;padding:3px 12px;text-decoration:none}#tags .tags1{font-size:12px;font-weight:normal}#tags .tags2{font-size:14px;font-weight:normal}#tags .tags3{font-size:16px;font-weight:normal}#tags .tags4{font-size:18px;font-weight:bold}#tags .tags5{font-size:20px;font-weight:bold}#captcha,#captchaReply{cursor:pointer}
\ No newline at end of file
/**
* Copyright (c) 2010-2017, b3log.org & hacpai.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
html{height:100%;overflow:hidden}html,body{margin:0;padding:0}body{background-color:#f3f1e5;color:#333;font-family:\5fae\8f6f\96c5\9ed1;font-size:small;height:100%}h2{background-color:#ececec;background-image:linear-gradient(#f9f9f9,#ececec);background-repeat:repeat-x;border-radius:4px 4px 0 0;font-size:16px;margin:0;padding:10px 20px;text-shadow:0 -1px 0 rgba(255,255,255,0.5)}input{border:1px solid #ccc;border-radius:3px 3px 3px 3px;box-shadow:0 1px 2px rgba(0,0,0,0.075) inset;font-size:13px;margin:15px 0;padding:7px 8px;transition:all .15s ease-in 0s;vertical-align:middle;width:410px;font-family:\5fae\8f6f\96c5\9ed1;font-size:small}input:focus{box-shadow:0 1px 2px rgba(0,0,0,0.075) inset,0 0 5px rgbargba(200,200,200,0.9);border:1px solid #e6e5d9}.form{padding:20px}label{font-size:13px}button{position:relative;display:inline-block;font-size:13px;font-weight:700;color:#333;text-shadow:0 1px 0 rgba(255,255,255,0.9);white-space:nowrap;background-color:#eaeaea;background-image:linear-gradient(#fafafa,#eaeaea);background-repeat:repeat-x;border-radius:3px;border:1px solid #ddd;border-bottom-color:#c5c5c5;box-shadow:0 1px 3px rgba(0,0,0,0.075);vertical-align:baseline;cursor:pointer;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-appearance:none;outline:0;padding:7px 15px;margin-top:10px}button:hover,button:active{color:#fff;text-decoration:none;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-color:#3072b3;background-image:linear-gradient(#599bcd,#3072b3);background-repeat:repeat-x}.clear{background-color:transparent;border:0;clear:both;display:block;font-size:0;height:0;line-height:0;overflow:hidden}.none{display:none}.main .icon{position:absolute;right:0;top:0;width:16px;height:16px}.solo{color:orangered;font-weight:bold}.logo{float:left;padding:162px 12px 0;width:217px;text-align:center}.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 white;border-color:#e6e5d9;border-style:solid solid none;border-width:1px;margin:0 auto;padding:0 0 28px 0;position:relative;width:760px;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 li{margin:6px 0 6px 16px}.footerWrapper{background-color:#fff;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,.article-pwd>form{margin:0 20px}.article-pwd>div{margin-bottom:10px;max-height:264px;overflow:auto;word-wrap:break-word}.img-403,.img-500{box-shadow:0 0 5px #e6e5d9;margin:20px 0 0 45px;padding:5px}.a-403,.a-500,.a-404{margin:20px 50px 0 0;text-align:right}.a-403{margin:10px 75px 0 0}.img-500{margin:20px 0 0 25px}.a-500{margin:25px 35px 0 0}.a-404{margin:42px 35px 0 0}.kill img{position:absolute;right:40px;top:200px}.kill ul{margin-bottom:50px}.kill p{margin:12px 20px}.kill span{margin-left:20px}#init{position:absolute;top:81px;width:470px}#init .form{padding:10px 20px}#init input,.register input{margin:5px 0;padding:5px 8px}.register{height:400px}#sys p{height:206px}#sys{padding:0 20px}#initButton{margin-right:10px}#tip{color:#21759b;font-weight:bold;margin-left:10px} html{height:100%;overflow:hidden}html,body{margin:0;padding:0}body{background-color:#f3f1e5;color:#333;font-family:\5fae\8f6f\96c5\9ed1;font-size:small;height:100%}h2{background-color:#ececec;background-image:linear-gradient(#f9f9f9,#ececec);background-repeat:repeat-x;border-radius:4px 4px 0 0;font-size:16px;margin:0;padding:10px 20px;text-shadow:0 -1px 0 rgba(255,255,255,0.5)}input{border:1px solid #ccc;border-radius:3px 3px 3px 3px;box-shadow:0 1px 2px rgba(0,0,0,0.075) inset;font-size:13px;margin:15px 0;padding:7px 8px;transition:all .15s ease-in 0s;vertical-align:middle;width:410px;font-family:\5fae\8f6f\96c5\9ed1;font-size:small}input:focus{box-shadow:0 1px 2px rgba(0,0,0,0.075) inset,0 0 5px rgbargba(200,200,200,0.9);border:1px solid #e6e5d9}.form{padding:20px}label{font-size:13px}button{position:relative;display:inline-block;font-size:13px;font-weight:700;color:#333;text-shadow:0 1px 0 rgba(255,255,255,0.9);white-space:nowrap;background-color:#eaeaea;background-image:linear-gradient(#fafafa,#eaeaea);background-repeat:repeat-x;border-radius:3px;border:1px solid #ddd;border-bottom-color:#c5c5c5;box-shadow:0 1px 3px rgba(0,0,0,0.075);vertical-align:baseline;cursor:pointer;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-appearance:none;outline:0;padding:7px 15px;margin-top:10px}button:hover,button:active{color:#fff;text-decoration:none;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-color:#3072b3;background-image:linear-gradient(#599bcd,#3072b3);background-repeat:repeat-x}.clear{background-color:transparent;border:0;clear:both;display:block;font-size:0;height:0;line-height:0;overflow:hidden}.none{display:none}.main .icon{position:absolute;right:0;top:0;width:16px;height:16px}.solo{color:orangered;font-weight:bold}.logo{float:left;padding:162px 12px 0;width:217px;text-align:center}.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 white;border-color:#e6e5d9;border-style:solid solid none;border-width:1px;margin:0 auto;padding:0 0 28px 0;position:relative;width:760px;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 li{margin:6px 0 6px 16px}.footerWrapper{background-color:#fff;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,.article-pwd>form{margin:0 20px}.article-pwd>div{margin-bottom:10px;max-height:264px;overflow:auto;word-wrap:break-word}.img-403,.img-500{box-shadow:0 0 5px #e6e5d9;margin:20px 0 0 45px;padding:5px}.a-403,.a-500,.a-404{margin:20px 50px 0 0;text-align:right}.a-403{margin:10px 75px 0 0}.img-500{margin:20px 0 0 25px}.a-500{margin:25px 35px 0 0}.a-404{margin:42px 35px 0 0}.kill img{position:absolute;right:40px;top:200px}.kill ul{margin-bottom:50px}.kill p{margin:12px 20px}.kill span{margin-left:20px}#init{position:absolute;top:81px;width:470px}#init .form{padding:10px 20px}#init input,.register input{margin:5px 0;padding:5px 8px}.register{height:400px}#sys p{height:206px}#sys{padding:0 20px}#initButton{margin-right:10px}#tip{color:#21759b;font-weight:bold;margin-left:10px}
\ No newline at end of file
/*
* Copyright (c) 2010-2017, b3log.org & hacpai.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var Util={isLoggedIn:function(){if(($("#admin").length===1&&$("#admin").data("login"))||latkeConfig.isLoggedIn==="true"){return true}else{return false}},getUserName:function(){if($("#adminName").length===1){return $("#adminName").text()}else{return latkeConfig.userName}},error:function(){$("#tipMsg").text("Error: "+arguments[0]+" File: "+arguments[1]+"\nLine: "+arguments[2]+" please report this issue on https://github.com/b3log/solo/issues/new");$("#loadMsg").text("")},killIE:function(){var addKillPanel=function(){if(Cookie.readCookie("showKill")===""){var left=($(window).width()-701)/2,top=($(window).height()-420)/2;$("body").append("<div style='display: block; height: 100%; width: 100%; position: fixed; background-color: rgb(0, 0, 0); opacity: 0.6; top: 0px;z-index:11'></div><iframe style='left:"+left+"px;z-index:20;top: "+top+"px; position: fixed; border: 0px none; width: 701px; height: 420px;' src='"+latkeConfig.servePath+"/kill-browser'></iframe>")}};if($.browser.msie){if($.browser.version==="6.0"||$.browser.version==="7.0"){addKillPanel();return}if(window.external&&window.external.twGetRunPath){var path=external.twGetRunPath();if(path&&path.toLowerCase().indexOf("360se")>-1&&window.location.href.indexOf("admin-index")>-1){addKillPanel();return}}}},replaceEmString:function(str){var commentSplited=str.split("[em");if(commentSplited.length===1){return str}str=commentSplited[0];for(var j=1;j<commentSplited.length;j++){var key=commentSplited[j].substr(0,2);str+="<img src='"+latkeConfig.staticServePath+"/skins/"+Label.skinDirName+"/images/emotions/em"+key+".png' alt='"+Label["em"+key+"Label"]+"' title='"+Label["em"+key+"Label"]+"'/>"+commentSplited[j].substr(3)}return str},proessURL:function(url){if(!/^\w+:\/\//.test(url)){url="http://"+url}return url},switchMobile:function(skin){Cookie.createCookie("btouch_switch_toggle",skin,365);setTimeout(function(){location.reload()},1250)},setTopBar:function(){var $top=$("#top");if($top.length===1){var $showTop=$("#showTop");$showTop.click(function(){$top.slideDown();$showTop.hide()});$("#hideTop").click(function(){$top.slideUp();$showTop.show()})}},goTop:function(){$("html, body").animate({scrollTop:0},800)},goBottom:function(bottom){if(!bottom){bottom=0}var wHeight=$("body").height()>$(document).height()?$("body").height():$(document).height();window.scrollTo(0,wHeight-$(window).height()-bottom)},init:function(){Util.killIE();Util.setTopBar()},replaceSideEm:function(comments){for(var i=0;i<comments.length;i++){var $comment=$(comments[i]);$comment.html(Util.replaceEmString($comment.html()))}},buildTags:function(id){id=id||"tags";var classes=["tags1","tags2","tags3","tags4","tags5"],bList=$("#"+id+" b").get();var max=parseInt($("#"+id+" b").last().text());var distance=Math.ceil(max/classes.length);for(var i=0;i<bList.length;i++){var num=parseInt(bList[i].innerHTML);for(var j=0;j<classes.length;j++){if(num>j*distance&&num<=(j+1)*distance){bList[i].parentNode.className=classes[j];break}}}$("#"+id).html($("#"+id+" li").get().sort(function(a,b){var valA=$(a).find("span").text().toLowerCase();var valB=$(b).find("span").text().toLowerCase();return valA.localeCompare(valB)}))},toDate:function(time,format){var dateTime=new Date(time);var o={"M+":dateTime.getMonth()+1,"d+":dateTime.getDate(),"H+":dateTime.getHours(),"m+":dateTime.getMinutes(),"s+":dateTime.getSeconds(),"q+":Math.floor((dateTime.getMonth()+3)/3),S:dateTime.getMilliseconds()};if(/(y+)/.test(format)){format=format.replace(RegExp.$1,(dateTime.getFullYear()+"").substr(4-RegExp.$1.length))}for(var k in o){if(new RegExp("("+k+")").test(format)){format=format.replace(RegExp.$1,RegExp.$1.length==1?o[k]:("00"+o[k]).substr((""+o[k]).length))}}return format},getWinHeight:function(){if(window.innerHeight){return window.innerHeight}if(document.compatMode==="CSS1Compat"){return window.document.documentElement.clientHeight}return window.document.body.clientHeight}};if(!Cookie){var Cookie={readCookie:function(name){var nameEQ=name+"=";var ca=document.cookie.split(";");for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==" "){c=c.substring(1,c.length)}if(c.indexOf(nameEQ)==0){return decodeURIComponent(c.substring(nameEQ.length,c.length))}}return""},eraseCookie:function(name){this.createCookie(name,"",-1)},createCookie:function(name,value,days){var expires="";if(days){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));expires="; expires="+date.toGMTString()}document.cookie=name+"="+encodeURIComponent(value)+expires+"; path=/"}}}; var Util={isLoggedIn:function(){if(($("#admin").length===1&&$("#admin").data("login"))||latkeConfig.isLoggedIn==="true"){return true}else{return false}},getUserName:function(){if($("#adminName").length===1){return $("#adminName").text()}else{return latkeConfig.userName}},error:function(){$("#tipMsg").text("Error: "+arguments[0]+" File: "+arguments[1]+"\nLine: "+arguments[2]+" please report this issue on https://github.com/b3log/solo/issues/new");$("#loadMsg").text("")},killIE:function(){var addKillPanel=function(){if(Cookie.readCookie("showKill")===""){var left=($(window).width()-701)/2,top=($(window).height()-420)/2;$("body").append("<div style='display: block; height: 100%; width: 100%; position: fixed; background-color: rgb(0, 0, 0); opacity: 0.6; top: 0px;z-index:11'></div><iframe style='left:"+left+"px;z-index:20;top: "+top+"px; position: fixed; border: 0px none; width: 701px; height: 420px;' src='"+latkeConfig.servePath+"/kill-browser'></iframe>")}};if($.browser.msie){if($.browser.version==="6.0"||$.browser.version==="7.0"){addKillPanel();return}if(window.external&&window.external.twGetRunPath){var path=external.twGetRunPath();if(path&&path.toLowerCase().indexOf("360se")>-1&&window.location.href.indexOf("admin-index")>-1){addKillPanel();return}}}},replaceEmString:function(str){var commentSplited=str.split("[em");if(commentSplited.length===1){return str}str=commentSplited[0];for(var j=1;j<commentSplited.length;j++){var key=commentSplited[j].substr(0,2);str+="<img src='"+latkeConfig.staticServePath+"/skins/"+Label.skinDirName+"/images/emotions/em"+key+".png' alt='"+Label["em"+key+"Label"]+"' title='"+Label["em"+key+"Label"]+"'/>"+commentSplited[j].substr(3)}return str},proessURL:function(url){if(!/^\w+:\/\//.test(url)){url="http://"+url}return url},switchMobile:function(skin){Cookie.createCookie("btouch_switch_toggle",skin,365);setTimeout(function(){location.reload()},1250)},setTopBar:function(){var $top=$("#top");if($top.length===1){var $showTop=$("#showTop");$showTop.click(function(){$top.slideDown();$showTop.hide()});$("#hideTop").click(function(){$top.slideUp();$showTop.show()})}},goTop:function(){$("html, body").animate({scrollTop:0},800)},goBottom:function(bottom){if(!bottom){bottom=0}var wHeight=$("body").height()>$(document).height()?$("body").height():$(document).height();window.scrollTo(0,wHeight-$(window).height()-bottom)},init:function(){Util.killIE();Util.setTopBar()},replaceSideEm:function(comments){for(var i=0;i<comments.length;i++){var $comment=$(comments[i]);$comment.html(Util.replaceEmString($comment.html()))}},buildTags:function(id){id=id||"tags";var classes=["tags1","tags2","tags3","tags4","tags5"],bList=$("#"+id+" b").get();var max=parseInt($("#"+id+" b").last().text());var distance=Math.ceil(max/classes.length);for(var i=0;i<bList.length;i++){var num=parseInt(bList[i].innerHTML);for(var j=0;j<classes.length;j++){if(num>j*distance&&num<=(j+1)*distance){bList[i].parentNode.className=classes[j];break}}}$("#"+id).html($("#"+id+" li").get().sort(function(a,b){var valA=$(a).find("span").text().toLowerCase();var valB=$(b).find("span").text().toLowerCase();return valA.localeCompare(valB)}))},toDate:function(time,format){var dateTime=new Date(time);var o={"M+":dateTime.getMonth()+1,"d+":dateTime.getDate(),"H+":dateTime.getHours(),"m+":dateTime.getMinutes(),"s+":dateTime.getSeconds(),"q+":Math.floor((dateTime.getMonth()+3)/3),S:dateTime.getMilliseconds()};if(/(y+)/.test(format)){format=format.replace(RegExp.$1,(dateTime.getFullYear()+"").substr(4-RegExp.$1.length))}for(var k in o){if(new RegExp("("+k+")").test(format)){format=format.replace(RegExp.$1,RegExp.$1.length==1?o[k]:("00"+o[k]).substr((""+o[k]).length))}}return format},getWinHeight:function(){if(window.innerHeight){return window.innerHeight}if(document.compatMode==="CSS1Compat"){return window.document.documentElement.clientHeight}return window.document.body.clientHeight}};if(!Cookie){var Cookie={readCookie:function(name){var nameEQ=name+"=";var ca=document.cookie.split(";");for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==" "){c=c.substring(1,c.length)}if(c.indexOf(nameEQ)==0){return decodeURIComponent(c.substring(nameEQ.length,c.length))}}return""},eraseCookie:function(name){this.createCookie(name,"",-1)},createCookie:function(name,value,days){var expires="";if(days){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));expires="; expires="+date.toGMTString()}document.cookie=name+"="+encodeURIComponent(value)+expires+"; path=/"}}};
\ No newline at end of file
This diff is collapsed.
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