小幅度更新UI

This commit is contained in:
joyqi 2013-10-07 16:08:01 +08:00
parent 1f6300093b
commit f574a3e746
5 changed files with 45 additions and 126 deletions

View File

@ -5,7 +5,6 @@
(function () {
window.addEvent('domready', function() {
var _d = $(document);
var handle = new Typecho.guid('typecho:guid', {offset: 1, type: 'mouse'});
//增加高亮效果
(function () {

View File

@ -60,7 +60,6 @@
width: 100%;
display: inline;
position: relative;
overflow: hidden;
}
/**

View File

@ -218,22 +218,15 @@ input, select, textarea {
input[type=text], input[type=password],
input.text, input.title,
textarea {
background: #fff;
padding: 3px;
border: 1px solid #a0a0a0;
border-bottom-color: #c4c4c4;
border-right-color: #c4c4c4;
box-shadow: inset 1px 1px #dedede, inset 2px 2px #f4f4f4;
-o-box-shadow: inset 1px 1px #dedede, inset 2px 2px #f4f4f4;
-moz-box-shadow: inset 1px 1px #dedede, inset 2px 2px #f4f4f4;
-webkit-box-shadow: inset 1px 1px #dedede, inset 2px 2px #f4f4f4;
background: #FFF;
border: 1px solid #C6C6C6;
-webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 0 rgba(255, 255, 255, 0.5);
-moz-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 0 rgba(255, 255, 255, 0.5);
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 0 rgba(255, 255, 255, 0.5);
}
/** hack webkit border by 70 */
input:focus, textarea:focus, select:focus {
outline: 0 !important;
}
select {
font-size: 13px;
padding: 1px;
@ -246,27 +239,26 @@ select {
button {
line-height: 22px; height: 26px; vertical-align: middle;
background-color: #f4f4f4;
font-size: 13px;
padding: 0 10px;
*padding: 0 5px;
-moz-border-radius: 13px;
-webkit-border-radius: 13px;
-khtml-border-radius: 13px;
border-radius: 13px;
cursor: pointer;
margin: 0;
border: 1px solid #AAA;
color: #333;
text-shadow: 0 1px #fff;
background: -webkit-gradient(linear, 0 0, 0 100%, from(#FFFFFF), to(#DDDDDD));
background: -moz-linear-gradient(top, #FFFFFF, #DDDDDD);
background: -o-linear-gradient(top, #FFFFFF, #DDDDDD);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#dddddd'); /* IE6,IE7 */
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#dddddd')";
display: inline-block;
color: #666;
cursor: pointer;
text-decoration: none !important;
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #fcfcfc), color-stop(100%, #eeeeee));
background-image: -webkit-linear-gradient(#fcfcfc, #eeeeee);
background-image: -moz-linear-gradient(#fcfcfc, #eeeeee);
background-image: -o-linear-gradient(#fcfcfc, #eeeeee);
background-image: linear-gradient(#fcfcfc, #eeeeee);
border: 1px solid #bbbbbb;
border-bottom-color: #AAA;
-webkit-box-shadow: rgba(0, 0, 0, 0.12) 0 1px 2px, inset white 0 1px 0;
-moz-box-shadow: rgba(0, 0, 0, 0.12) 0 1px 2px, inset white 0 1px 0;
box-shadow: rgba(0, 0, 0, 0.12) 0 1px 2px, inset white 0 1px 0;
}
button:hover { border-color: #666 }
button:hover {
background: #F6F6F6;
color: #777;
}
img.avatar {
padding: 2px;
@ -788,7 +780,7 @@ margin-top: 25px;
border-top: none;
}
#typecho-nav-list .child li:last-child {
#typecho-nav-list .child li.last {
border-bottom: none;
}
@ -1662,6 +1654,10 @@ ul.typecho-list-notable li #typecho-respond {
border-top: 1px solid #fff;
}
.typecho-page-main .typecho-option:first-child {
border-top: none;
}
.typecho-page-main .typecho-option-clear {
border-bottom: 1px solid #F7FBE9;
border-top: 1px solid #F7FBE9;

View File

@ -1,97 +1,6 @@
/** 初始化全局对象 */
var Typecho = {};
Typecho.guid = function (el, config) {
var _dl = $(el);
if (null == _dl) {
return;
}
var _dt = _dl.getElements('dt');
var _dd = _dl.getElements('dd');
var _cur = null, _timer = null, _iframe = null;
var handle = {
reSet: function() {
/*
if (_cur) {
console.info(_cur);
//_cur.removeClass('current');
//_cur.getNext('dd').setStyle('display', 'none');
delete _cur;
} else {
*/
_dt.removeClass('current');
_dd.setStyle('display', 'none');
//}
},
popUp: function(el) {
el = _cur = $(el) || el;
el.addClass('current');
var _d = el.getNext('dd');
if (_d) {
_d.setStyle('left', el.getPosition().x - el.getParent('dl').getPosition().x - config.offset);
if (_d.getStyle('display') != 'none') {
_d.setStyle('display', 'none');
} else {
_d.setStyle('display', 'block');
_d.getElement('ul li:first-child').setStyle('border-top', 'none');
_d.getElement('ul li:last-child').setStyle('border-bottom', 'none');
if (Browser.Engine.trident) { // IE的安慰
_d.getElements('ul li').setStyle('width', _d.getCoordinates().width - 22);
}
}
}
}
};
if (config.type == 'mouse') {
_dt.addEvent('mouseenter', function(event){
_timer = $clear(_timer); handle.reSet();
if (event.target.nodeName.toLowerCase() == 'a') {
event.target = $(event.target).getParent('dt');
}
handle.popUp(event.target);
});
_dt.addEvent('mouseout', function(event){
if (!_timer) {
_timer = handle.reSet.delay(500);
}
});
_dd.addEvent('mouseenter', function(event){
if (_timer) {
_timer = $clear(_timer);
}
});
_dd.addEvent('mouseleave', function(event){
if (!_timer) {
_timer = handle.reSet.delay(50);
}
});
}
if (config.type == 'click') {
_dt.addEvent('click', function(event){
handle.reSet();
if (event.target.nodeName.toLowerCase() == 'a') {
event.target = $(event.target).getParent('dt');
}
handle.popUp(event.target);
event.stop(); // 停止事件传播
});
$(document).addEvent('click', handle.reSet);
}
return handle;
};
Typecho.Table = {
table: null, //当前表格

View File

@ -281,13 +281,29 @@ class Widget_Menu extends Typecho_Widget
echo "<ul class=\"root" . ($key == $this->_currentParent ? ' ' . $class : NULL)
. "\"><li class=\"parent\"><a href=\"{$node[2]}\" title=\"{$node[0]}\">{$node[0]}</a></dt>"
. "</li><ul class=\"child\">";
$last = 0;
foreach ($node[3] as $inKey => $inNode) {
if (!$inNode[4]) {
$last = $inKey;
}
}
foreach ($node[3] as $inKey => $inNode) {
if ($inNode[4]) {
continue;
}
echo "<li" . ($key == $this->_currentParent && $inKey == $this->_currentChild ? ' class="' . $childClass . '"' : NULL) .
$classes = array();
if ($key == $this->_currentParent && $inKey == $this->_currentChild) {
$classes[] = $childClass;
}
if ($inKey == $last) {
$classes[] = 'last';
}
echo "<li" . (!empty($classes) ? ' class="' . implode(' ', $classes) . '"' : NULL) .
"><a href=\"" . ($key == $this->_currentParent && $inKey == $this->_currentChild ? $this->_currentUrl : $inNode[2]) . "\" title=\"{$inNode[0]}\">{$inNode[0]}</a></li>";
}