修改错误提示样式
更新slug name自适应宽度取法,修正在新版chrome下可能引起的bug
This commit is contained in:
@@ -109,28 +109,27 @@ $(document).ready(function() {
|
||||
var slug = $('#slug');
|
||||
|
||||
if (slug.length > 0) {
|
||||
var justifySlug = $('<div />').css(slug.css()).css({
|
||||
'display' : 'none',
|
||||
'width' : 'auto'
|
||||
}).insertAfter(slug), originalWidth = slug.width();
|
||||
var wrap = $('<div />').css({
|
||||
'position' : 'relative',
|
||||
'display' : 'inline-block'
|
||||
}),
|
||||
justifySlug = $('<pre />').css({
|
||||
'display' : 'block',
|
||||
'visibility': 'hidden',
|
||||
'height' : slug.height(),
|
||||
'padding' : '0 2px',
|
||||
'margin' : 0
|
||||
}).insertAfter(slug.wrap(wrap).css({
|
||||
'left' : 0,
|
||||
'top' : 0,
|
||||
'minWidth' : '5px',
|
||||
'position' : 'absolute',
|
||||
'width' : '100%'
|
||||
})), originalWidth = slug.width();
|
||||
|
||||
function justifySlugWidth() {
|
||||
var html = slug.val().replace(/&/g, '&')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/'/g, ''')
|
||||
.replace(/"/g, '"')
|
||||
.replace(/ /g, ' ')
|
||||
.replace(/(( )*) /g, '$1 ')
|
||||
.replace(/\n/g, '<br />')
|
||||
.replace(/<br \/>[ ]*$/, '<br />-')
|
||||
.replace(/<br \/> /g, '<br /> ');
|
||||
|
||||
justifySlug.css('min-width', html.length > 0
|
||||
? 'inherit' : originalWidth);
|
||||
|
||||
justifySlug.html(html);
|
||||
slug.width(justifySlug.width());
|
||||
var val = slug.val();
|
||||
justifySlug.text(val.length > 0 ? val : ' ');
|
||||
}
|
||||
|
||||
slug.bind('input propertychange', justifySlugWidth);
|
||||
|
||||
@@ -331,7 +331,7 @@ class Typecho_Common
|
||||
<style>
|
||||
html {
|
||||
padding: 50px 10px;
|
||||
font-size: 20px;
|
||||
font-size: 16px;
|
||||
line-height: 1.4;
|
||||
color: #666;
|
||||
background: #F6F6F3;
|
||||
@@ -344,15 +344,10 @@ class Typecho_Common
|
||||
body {
|
||||
max-width: 500px;
|
||||
_width: 500px;
|
||||
padding: 30px 20px 50px;
|
||||
padding: 30px 20px;
|
||||
margin: 0 auto;
|
||||
background: #FFF;
|
||||
}
|
||||
h1 {
|
||||
font-size: 50px;
|
||||
text-align: center;
|
||||
}
|
||||
h1 span { color: #bbb; }
|
||||
ul {
|
||||
padding: 0 0 0 40px;
|
||||
}
|
||||
@@ -365,7 +360,6 @@ class Typecho_Common
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>{$code}</h1>
|
||||
{$message}
|
||||
</div>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user