Skip to content

Commit

Permalink
增加样式
Browse files Browse the repository at this point in the history
  • Loading branch information
joyqi committed Oct 8, 2013
1 parent f8c05ee commit 5715153
Show file tree
Hide file tree
Showing 20 changed files with 88 additions and 66 deletions.
50 changes: 10 additions & 40 deletions admin/common-js.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,11 @@
<script type="text/javascript">
(function () {
$(document).ready(function() {
var _d = $(document);

<?php if ($notice->highlight): ?>
//增加高亮效果
$('#<?php echo $notice->highlight; ?>').effect('highlight', '#AACB36', 1000);
<?php endif; ?>

$('.typecho-list-table').tableSelectable({
checkEl : 'input[type=checkbox]',
rowEl : 'tr',
selectAllEl : '.typecho-table-select-all',
actionEl : '.dropdown-menu a'
});

$('.btn-drop').dropdownMenu({
btnEl : '.dropdown-toggle',
menuEl : '.dropdown-menu'
});

//增加淡出效果
(function () {
var p = $('.popup');
Expand All @@ -40,35 +26,19 @@
p.delay(5000).fadeOut();
}
})();

/*
//增加滚动效果,滚动到上面的一条error
(function () {
var _firstError = _d.getElement('.typecho-option .error');

if (_firstError) {
var _errorFx = new Fx.Scroll(window).toElement(_firstError.getParent('.typecho-option'));
}
})();

//禁用重复提交
(function () {
_d.getElements('input[type=submit]').removeProperty('disabled');
_d.getElements('button[type=submit]').removeProperty('disabled');

var _disable = function (e) {
e.stopPropagation();

this.setProperty('disabled', true);
this.getParent('form').submit();

return false;
};
$('a').each(function () {
var t = $(this), href = t.attr('href');

_d.getElements('input[type=submit]').addEvent('click', _disable);
_d.getElements('button[type=submit]').addEvent('click', _disable);
})();
if (/^<?php echo preg_quote($options->adminUrl, '/'); ?>.*$/.exec(href)
|| /^<?php echo substr(preg_quote(Typecho_Common::url('s', $options->index), '/'), 0, -1); ?>action\/[_a-zA-Z0-9\/]+.*$/.exec(href)) {
return;
}

t.attr('target', '_blank');
});

/*
//打开链接
(function () {

Expand Down
10 changes: 5 additions & 5 deletions admin/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -705,8 +705,8 @@ margin-top: 25px;
}

.typecho-pager ul {
line-height: 28px;
height: 28px;
line-height: 24px;
height: 24px;
float: left;
zoom: 1;
}
Expand All @@ -716,14 +716,14 @@ margin-top: 25px;
margin-right: 4px;
font-size: 15px;
float: left;
height: 28px;
line-height: 28px;
height: 24px;
line-height: 24px;
}

.typecho-pager a {
color: #333;
display: block;
height: 28px;
height: 24px;
outline: none;
padding: 0 15px;
float: left;
Expand Down
21 changes: 21 additions & 0 deletions admin/form-js.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<script>
(function () {
$(document).ready(function () {
var error = $('.typecho-option .error:first');
if (error.length > 0) {
$('html,body').scrollTop(error.offset().top);
}
$('form').submit(function () {
$('*[type=submit]', this).prop('disabled', true);
});
$('label input[type=text]').click(function (e) {
var check = $('#' + $(this).parents('label').attr('for'));
check.prop('checked', true);
return false;
});
});
})();
</script>
1 change: 1 addition & 0 deletions admin/manage-medias.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,6 @@
<?php
include 'copyright.php';
include 'common-js.php';
include 'table-js.php';
include 'footer.php';
?>
1 change: 1 addition & 0 deletions admin/manage-metas.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@
<?php
include 'copyright.php';
include 'common-js.php';
include 'table-js.php';
?>

<script type="text/javascript">
Expand Down
1 change: 1 addition & 0 deletions admin/manage-pages.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
<?php
include 'copyright.php';
include 'common-js.php';
include 'table-js.php';
?>

<?php if(!isset($request->status) || 'publish' == $request->get('status')): ?>
Expand Down
1 change: 1 addition & 0 deletions admin/manage-posts.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,5 +133,6 @@
<?php
include 'copyright.php';
include 'common-js.php';
include 'table-js.php';
include 'footer.php';
?>
1 change: 1 addition & 0 deletions admin/manage-users.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,5 +105,6 @@
<?php
include 'copyright.php';
include 'common-js.php';
include 'table-js.php';
include 'footer.php';
?>
1 change: 1 addition & 0 deletions admin/options-discussion.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@
<?php
include 'copyright.php';
include 'common-js.php';
include 'form-js.php';
include 'footer.php';
?>
1 change: 1 addition & 0 deletions admin/options-general.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@
<?php
include 'copyright.php';
include 'common-js.php';
include 'form-js.php';
include 'footer.php';
?>
17 changes: 1 addition & 16 deletions admin/options-permalink.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,7 @@
<?php
include 'copyright.php';
include 'common-js.php';
include 'form-js.php';
?>

<script type="text/javascript">
(function () {
window.addEvent('domready', function() {

$(document)
.getElement('input[name=customPattern]')
.addEvent('click', function (event) {
$('postPattern-custom').set('checked', true);
this.focus();
event.stop();
});

});
})();
</script>

<?php include 'footer.php'; ?>
1 change: 1 addition & 0 deletions admin/options-plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@
<?php
include 'copyright.php';
include 'common-js.php';
include 'form-js.php';
include 'footer.php';
?>
1 change: 1 addition & 0 deletions admin/options-reading.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@
<?php
include 'copyright.php';
include 'common-js.php';
include 'form-js.php';
include 'footer.php';
?>
1 change: 1 addition & 0 deletions admin/options-theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@
<?php
include 'copyright.php';
include 'common-js.php';
include 'form-js.php';
include 'footer.php';
?>
1 change: 1 addition & 0 deletions admin/profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
<?php
include 'copyright.php';
include 'common-js.php';
include 'form-js.php';
Typecho_Plugin::factory('admin/profile.php')->bottom();
include 'footer.php';
?>
17 changes: 17 additions & 0 deletions admin/table-js.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<script>
(function () {
$(document).ready(function () {
$('.typecho-list-table').tableSelectable({
checkEl : 'input[type=checkbox]',
rowEl : 'tr',
selectAllEl : '.typecho-table-select-all',
actionEl : '.dropdown-menu a'
});
$('.btn-drop').dropdownMenu({
btnEl : '.dropdown-toggle',
menuEl : '.dropdown-menu'
});
});
})();
</script>
16 changes: 16 additions & 0 deletions var/Typecho/Widget/Helper/Form/Element.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,22 @@ public function __construct($name = NULL, array $options = NULL, $value = NULL,
}
}

/**
* filterValue
*
* @param mixed $value
* @access protected
* @return string
*/
protected function filterValue($value)
{
if (preg_match_all('/[_0-9a-z-]+/i', $value, $matches)) {
return implode('-', $matches[0]);
}

return '';
}

/**
* 自定义初始函数
*
Expand Down
5 changes: 3 additions & 2 deletions var/Typecho/Widget/Helper/Form/Element/Checkbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,15 @@ public function input($name = NULL, array $options = NULL)
foreach ($options as $value => $label) {
$this->_options[$value] = new Typecho_Widget_Helper_Layout('input');
$item = $this->multiline();
$id = $this->name . '-' . $this->filterValue($value);

$item->addItem($this->_options[$value]->setAttribute('name', $this->name . '[]')
->setAttribute('type', 'checkbox')
->setAttribute('value', $value)
->setAttribute('id', $this->name . '-' . $value));
->setAttribute('id', $id));

$labelItem = new Typecho_Widget_Helper_Layout('label');
$item->addItem($labelItem->setAttribute('for', $this->name . '-' . $value)->html($label));
$item->addItem($labelItem->setAttribute('for', $id)->html($label));
$this->container($item);
}

Expand Down
5 changes: 3 additions & 2 deletions var/Typecho/Widget/Helper/Form/Element/Radio.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,15 @@ public function input($name = NULL, array $options = NULL)
foreach ($options as $value => $label) {
$this->_options[$value] = new Typecho_Widget_Helper_Layout('input');
$item = $this->multiline();
$id = $this->name . '-' . $this->filterValue($value);

$item->addItem($this->_options[$value]->setAttribute('name', $this->name)
->setAttribute('type', 'radio')
->setAttribute('value', $value)
->setAttribute('id', $this->name . '-' . $value));
->setAttribute('id', $id));

$labelItem = new Typecho_Widget_Helper_Layout('label');
$item->addItem($labelItem->setAttribute('for', $this->name . '-' . $value)->html($label));
$item->addItem($labelItem->setAttribute('for', $id)->html($label));
$this->container($item);
}

Expand Down
2 changes: 1 addition & 1 deletion var/Widget/Menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ public function execute()
$this->_currentParent = $key;
$this->_currentChild = $inKey;
$this->title = $title;
$this->addLink = $addLink;
$this->addLink = $addLink ? Typecho_Common::url($addLink, $adminUrl) : NULL;
}

$children[$inKey] = array(
Expand Down

0 comments on commit 5715153

Please sign in to comment.