mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-20 21:33:54 -07:00
Vote button code improvements (#1146)
* Vote button code improvements * Updated * Update viewtopic_attach.tpl
This commit is contained in:
parent
d9094d1524
commit
2c46a01fdb
3 changed files with 19 additions and 21 deletions
|
@ -1476,7 +1476,7 @@ CREATE TABLE IF NOT EXISTS `bb_thx`
|
|||
`topic_id` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`user_id` MEDIUMINT(8) NOT NULL DEFAULT '0',
|
||||
`time` INT(11) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`topic_id`)
|
||||
PRIMARY KEY (`topic_id`, `user_id`)
|
||||
)
|
||||
ENGINE = MyISAM
|
||||
DEFAULT CHARSET = utf8;
|
||||
|
|
|
@ -33,8 +33,6 @@ switch ($mode) {
|
|||
$columns = 'topic_id, user_id, time';
|
||||
$values = "$topic_id, {$userdata['user_id']}, " . TIMENOW;
|
||||
DB()->query('INSERT IGNORE INTO ' . BB_THX . " ($columns) VALUES ($values)");
|
||||
|
||||
$this->response['html'] = '<b>' . profile_url($userdata) . ' <i>(' . bb_date(TIMENOW) . ')</i></b>';
|
||||
break;
|
||||
|
||||
case 'get':
|
||||
|
|
|
@ -400,7 +400,19 @@ $('#tor-filelist-btn').click(function(){
|
|||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
BB.thx_btn_clicked = false;
|
||||
$(function () {
|
||||
$thx_head = $('#thx-block').find('.sp-head');
|
||||
$thx_btn = $('#thx-btn');
|
||||
close_thx_list();
|
||||
|
||||
$thx_btn.one('click', function () {
|
||||
ajax.thx('add');
|
||||
$(this).prop({disabled: true});
|
||||
});
|
||||
$thx_head.one('click', function () {
|
||||
ajax.thx('get');
|
||||
});
|
||||
});
|
||||
|
||||
ajax.thx = function (mode) {
|
||||
ajax.exec({
|
||||
|
@ -411,31 +423,19 @@ $('#tor-filelist-btn').click(function(){
|
|||
}
|
||||
ajax.callback.thx = function (data) {
|
||||
if (data.mode === 'add') {
|
||||
$('#thx-btn').hide().after('<h2 style="color: green;">{$lang['THANKS_GRATITUDE']}!<h2>');
|
||||
BB.thx_btn_clicked = true;
|
||||
$thx_btn.hide().after('<h2 style="color: green;">{$lang['THANKS_GRATITUDE']}!<h2>');
|
||||
open_thx_list();
|
||||
} else {
|
||||
$('#thx-list').html(data.html);
|
||||
}
|
||||
$('#thx-list').html(data.html);
|
||||
open_thx_list();
|
||||
}
|
||||
$(function () {
|
||||
$thx_head = $('#thx-block').find('.sp-head');
|
||||
close_thx_list();
|
||||
$('#thx-btn').one('click', function () {
|
||||
ajax.thx('add');
|
||||
$(this).prop({disabled: true});
|
||||
});
|
||||
$thx_head.one('click', function () {
|
||||
if (!BB.thx_btn_clicked) {
|
||||
ajax.thx('get');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function thx_is_visible() {
|
||||
return $('#thx-list').is(':visible');
|
||||
}
|
||||
|
||||
function open_thx_list() {
|
||||
ajax.thx('get');
|
||||
if (!thx_is_visible()) {
|
||||
$thx_head.click();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue