mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-25 04:27:22 +08:00
user torrents pagination
This commit is contained in:
@@ -3115,11 +3115,11 @@ function pager($rpp, $count, $href, $opts = array(), $pagename = "page") {
|
|||||||
$pagerarr[] = "<font class=\"gray\"><b>$text</b></font>";
|
$pagerarr[] = "<font class=\"gray\"><b>$text</b></font>";
|
||||||
}
|
}
|
||||||
$pagerstr = join(" | ", $pagerarr);
|
$pagerstr = join(" | ", $pagerarr);
|
||||||
$pagertop = "<p align=\"center\">$pager<br />$pagerstr</p>\n";
|
$pagertop = "<p align=\"center\" class='nexus-pagination'>$pager<br />$pagerstr</p>\n";
|
||||||
$pagerbottom = "<p align=\"center\">$pagerstr<br />$pager</p>\n";
|
$pagerbottom = "<p align=\"center\" class='nexus-pagination'>$pagerstr<br />$pager</p>\n";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$pagertop = "<p align=\"center\">$pager</p>\n";
|
$pagertop = "<p align=\"center\" class='nexus-pagination'>$pager</p>\n";
|
||||||
$pagerbottom = $pagertop;
|
$pagerbottom = $pagertop;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ function maketable($res, $mode = 'seeding')
|
|||||||
->keyBy('torrentid');
|
->keyBy('torrentid');
|
||||||
}
|
}
|
||||||
|
|
||||||
$ret = "<table border=\"1\" cellspacing=\"0\" cellpadding=\"5\" width=\"900px\"><tr><td class=\"colhead\" style=\"padding: 0px\">".$lang_getusertorrentlistajax['col_type']."</td><td class=\"colhead\" align=\"center\">".$lang_getusertorrentlistajax['col_name']."</td><td class=\"colhead\" align=\"center\"> ".$lang_getusertorrentlistajax['col_added']." </td>".
|
$ret = "<table border=\"1\" cellspacing=\"0\" cellpadding=\"5\" width=\"100%\"><tr><td class=\"colhead\" style=\"padding: 0px\">".$lang_getusertorrentlistajax['col_type']."</td><td class=\"colhead\" align=\"center\">".$lang_getusertorrentlistajax['col_name']."</td><td class=\"colhead\" align=\"center\">".$lang_getusertorrentlistajax['col_added']."</td>".
|
||||||
($showsize ? "<td class=\"colhead\" align=\"center\"><img class=\"size\" src=\"pic/trans.gif\" alt=\"size\" title=\"".$lang_getusertorrentlistajax['title_size']."\" /></td>" : "").($showsenum ? "<td class=\"colhead\" align=\"center\"><img class=\"seeders\" src=\"pic/trans.gif\" alt=\"seeders\" title=\"".$lang_getusertorrentlistajax['title_seeders']."\" /></td>" : "").($showlenum ? "<td class=\"colhead\" align=\"center\"><img class=\"leechers\" src=\"pic/trans.gif\" alt=\"leechers\" title=\"".$lang_getusertorrentlistajax['title_leechers']."\" /></td>" : "").($showuploaded ? "<td class=\"colhead\" align=\"center\">".$lang_getusertorrentlistajax['col_uploaded']."</td>" : "") . ($showdownloaded ? "<td class=\"colhead\" align=\"center\">".$lang_getusertorrentlistajax['col_downloaded']."</td>" : "").($showratio ? "<td class=\"colhead\" align=\"center\">".$lang_getusertorrentlistajax['col_ratio']."</td>" : "").($showsetime ? "<td class=\"colhead\" align=\"center\">".$lang_getusertorrentlistajax['col_se_time']."</td>" : "").($showletime ? "<td class=\"colhead\" align=\"center\">".$lang_getusertorrentlistajax['col_le_time']."</td>" : "").($showcotime ? "<td class=\"colhead\" align=\"center\">".$lang_getusertorrentlistajax['col_time_completed']."</td>" : "").($showanonymous ? "<td class=\"colhead\" align=\"center\">".$lang_getusertorrentlistajax['col_anonymous']."</td>" : "")."</tr>\n";
|
($showsize ? "<td class=\"colhead\" align=\"center\"><img class=\"size\" src=\"pic/trans.gif\" alt=\"size\" title=\"".$lang_getusertorrentlistajax['title_size']."\" /></td>" : "").($showsenum ? "<td class=\"colhead\" align=\"center\"><img class=\"seeders\" src=\"pic/trans.gif\" alt=\"seeders\" title=\"".$lang_getusertorrentlistajax['title_seeders']."\" /></td>" : "").($showlenum ? "<td class=\"colhead\" align=\"center\"><img class=\"leechers\" src=\"pic/trans.gif\" alt=\"leechers\" title=\"".$lang_getusertorrentlistajax['title_leechers']."\" /></td>" : "").($showuploaded ? "<td class=\"colhead\" align=\"center\">".$lang_getusertorrentlistajax['col_uploaded']."</td>" : "") . ($showdownloaded ? "<td class=\"colhead\" align=\"center\">".$lang_getusertorrentlistajax['col_downloaded']."</td>" : "").($showratio ? "<td class=\"colhead\" align=\"center\">".$lang_getusertorrentlistajax['col_ratio']."</td>" : "").($showsetime ? "<td class=\"colhead\" align=\"center\">".$lang_getusertorrentlistajax['col_se_time']."</td>" : "").($showletime ? "<td class=\"colhead\" align=\"center\">".$lang_getusertorrentlistajax['col_le_time']."</td>" : "").($showcotime ? "<td class=\"colhead\" align=\"center\">".$lang_getusertorrentlistajax['col_time_completed']."</td>" : "").($showanonymous ? "<td class=\"colhead\" align=\"center\">".$lang_getusertorrentlistajax['col_anonymous']."</td>" : "")."</tr>\n";
|
||||||
$total_size = 0;
|
$total_size = 0;
|
||||||
foreach ($results as $arr)
|
foreach ($results as $arr)
|
||||||
@@ -158,7 +158,7 @@ function maketable($res, $mode = 'seeding')
|
|||||||
else $dissmall_descr == "";
|
else $dissmall_descr == "";
|
||||||
$ret .= "<tr" . $sphighlight . "><td class=\"rowfollow nowrap\" valign=\"middle\" style='padding: 0px'>".return_category_image($arr['category'], "torrents.php?allsec=1&")."</td>\n" .
|
$ret .= "<tr" . $sphighlight . "><td class=\"rowfollow nowrap\" valign=\"middle\" style='padding: 0px'>".return_category_image($arr['category'], "torrents.php?allsec=1&")."</td>\n" .
|
||||||
"<td class=\"rowfollow\" width=\"100%\" align=\"left\"><a href=\"".htmlspecialchars("details.php?id=".$arr['torrent']."&hit=1")."\" title=\"".$nametitle."\"><b>" . $dispname . "</b></a>". $banned_torrent . $sp_torrent . $hrImg . $approvalStatusIcon .($dissmall_descr == "" ? "" : "<br />" . $dissmall_descr) . "</td>";
|
"<td class=\"rowfollow\" width=\"100%\" align=\"left\"><a href=\"".htmlspecialchars("details.php?id=".$arr['torrent']."&hit=1")."\" title=\"".$nametitle."\"><b>" . $dispname . "</b></a>". $banned_torrent . $sp_torrent . $hrImg . $approvalStatusIcon .($dissmall_descr == "" ? "" : "<br />" . $dissmall_descr) . "</td>";
|
||||||
$ret .= sprintf('<td class="rowfollow" align="center">%s<br/>%s</td>', substr($arr['added'], 0, 10), substr($arr['added'], 11));
|
$ret .= sprintf('<td class="rowfollow nowrap" align="center">%s<br/>%s</td>', substr($arr['added'], 0, 10), substr($arr['added'], 11));
|
||||||
//size
|
//size
|
||||||
if ($showsize)
|
if ($showsize)
|
||||||
$ret .= "<td class=\"rowfollow\" align=\"center\">". mksize_compact($arr['size'])."</td>";
|
$ret .= "<td class=\"rowfollow\" align=\"center\">". mksize_compact($arr['size'])."</td>";
|
||||||
@@ -205,78 +205,95 @@ function maketable($res, $mode = 'seeding')
|
|||||||
$ret .= "</table>\n";
|
$ret .= "</table>\n";
|
||||||
return [$ret, $total_size];
|
return [$ret, $total_size];
|
||||||
}
|
}
|
||||||
|
$count = 0;
|
||||||
|
$torrentlist = "";
|
||||||
switch ($type)
|
switch ($type)
|
||||||
{
|
{
|
||||||
case 'uploaded':
|
case 'uploaded':
|
||||||
{
|
{
|
||||||
// $res = sql_query("SELECT torrents.id AS torrent, torrents.name as torrentname, small_descr, seeders, leechers, anonymous, torrents.banned, torrents.approval_status, categories.name AS catname, categories.image, category, sp_state, size, torrents.hr, snatched.seedtime, snatched.uploaded FROM torrents LEFT JOIN snatched ON torrents.id = snatched.torrentid LEFT JOIN categories ON torrents.category = categories.id WHERE torrents.owner=$id AND snatched.userid=$id " . (($CURUSER["id"] != $id)?((get_user_class() < $viewanonymous_class) ? " AND anonymous = 'no'":""):"") ." ORDER BY torrents.added DESC") or sqlerr(__FILE__, __LINE__);
|
// $res = sql_query("SELECT torrents.id AS torrent, torrents.name as torrentname, small_descr, seeders, leechers, anonymous, torrents.banned, torrents.approval_status, categories.name AS catname, categories.image, category, sp_state, size, torrents.hr, snatched.seedtime, snatched.uploaded FROM torrents LEFT JOIN snatched ON torrents.id = snatched.torrentid LEFT JOIN categories ON torrents.category = categories.id WHERE torrents.owner=$id AND snatched.userid=$id " . (($CURUSER["id"] != $id)?((get_user_class() < $viewanonymous_class) ? " AND anonymous = 'no'":""):"") ." ORDER BY torrents.added DESC") or sqlerr(__FILE__, __LINE__);
|
||||||
$res = sql_query("SELECT torrents.id AS torrent, torrents.name as torrentname, small_descr, seeders, leechers, anonymous, torrents.banned, torrents.approval_status, categories.name AS catname, categories.image, category, sp_state, size, torrents.hr, torrents.added FROM torrents LEFT JOIN categories ON torrents.category = categories.id WHERE torrents.owner=$id " . (($CURUSER["id"] != $id)?((!user_can('viewanonymous')) ? " AND anonymous = 'no'":""):"") ." ORDER BY torrents.added DESC") or sqlerr(__FILE__, __LINE__);
|
// $res = sql_query("SELECT torrents.id AS torrent, torrents.name as torrentname, small_descr, seeders, leechers, anonymous, torrents.banned, torrents.approval_status, categories.name AS catname, categories.image, category, sp_state, size, torrents.hr, torrents.added FROM torrents LEFT JOIN categories ON torrents.category = categories.id WHERE torrents.owner=$id " . (($CURUSER["id"] != $id)?((!user_can('viewanonymous')) ? " AND anonymous = 'no'":""):"") ." ORDER BY torrents.id DESC") or sqlerr(__FILE__, __LINE__);
|
||||||
$count = mysql_num_rows($res);
|
$fields = "torrents.id AS torrent, torrents.name as torrentname, small_descr, seeders, leechers, anonymous, torrents.banned, torrents.approval_status, categories.name AS catname, categories.image, category, sp_state, size, torrents.hr, torrents.added";
|
||||||
if ($count > 0)
|
$tableWhere = "torrents LEFT JOIN categories ON torrents.category = categories.id WHERE torrents.owner=$id";
|
||||||
{
|
if ($CURUSER['id'] != $id && !user_can('viewanonymous')) {
|
||||||
list($torrentlist, $total_size) = maketable ( $res, 'uploaded' );
|
$tableWhere .= " AND anonymous = 'no'";
|
||||||
}
|
}
|
||||||
|
$order = "torrents.id DESC";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Current Seeding
|
// Current Seeding
|
||||||
case 'seeding':
|
case 'seeding':
|
||||||
{
|
{
|
||||||
$res = sql_query("SELECT torrent,added,snatched.uploaded,snatched.downloaded,torrents.name as torrentname, torrents.small_descr, torrents.sp_state, torrents.banned, torrents.approval_status, categories.name as catname,size,torrents.hr,image,category,seeders,leechers FROM peers LEFT JOIN torrents ON peers.torrent = torrents.id LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN snatched ON torrents.id = snatched.torrentid WHERE peers.userid=$id AND snatched.userid = $id AND peers.seeder='yes' ORDER BY torrents.added DESC") or sqlerr();
|
// $res = sql_query("SELECT torrent,added,snatched.uploaded,snatched.downloaded,torrents.name as torrentname, torrents.small_descr, torrents.sp_state, torrents.banned, torrents.approval_status, categories.name as catname,size,torrents.hr,image,category,seeders,leechers FROM peers LEFT JOIN torrents ON peers.torrent = torrents.id LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN snatched ON torrents.id = snatched.torrentid WHERE peers.userid=$id AND snatched.userid = $id AND peers.seeder='yes' ORDER BY torrents.id DESC") or sqlerr();
|
||||||
$count = mysql_num_rows($res);
|
$fields = "torrent,added,snatched.uploaded,snatched.downloaded,torrents.name as torrentname, torrents.small_descr, torrents.sp_state, torrents.banned, torrents.approval_status, categories.name as catname,size,torrents.hr,image,category,seeders,leechers";
|
||||||
if ($count > 0){
|
$tableWhere = "peers LEFT JOIN torrents ON peers.torrent = torrents.id LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN snatched ON torrents.id = snatched.torrentid WHERE peers.userid=$id AND snatched.userid = $id AND peers.seeder='yes'";
|
||||||
list($torrentlist, $total_size) = maketable ( $res, 'seeding' );
|
$order = "torrents.id DESC";
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Current Leeching
|
// Current Leeching
|
||||||
case 'leeching':
|
case 'leeching':
|
||||||
{
|
{
|
||||||
$res = sql_query("SELECT torrent,snatched.uploaded,snatched.downloaded,torrents.name as torrentname, torrents.small_descr, torrents.sp_state, torrents.banned, torrents.approval_status, categories.name as catname,size,torrents.hr,image,category,seeders,leechers, torrents.added FROM peers LEFT JOIN torrents ON peers.torrent = torrents.id LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN snatched ON torrents.id = snatched.torrentid WHERE peers.userid=$id AND snatched.userid = $id AND peers.seeder='no' ORDER BY torrents.added DESC") or sqlerr();
|
// $res = sql_query("SELECT torrent,snatched.uploaded,snatched.downloaded,torrents.name as torrentname, torrents.small_descr, torrents.sp_state, torrents.banned, torrents.approval_status, categories.name as catname,size,torrents.hr,image,category,seeders,leechers, torrents.added FROM peers LEFT JOIN torrents ON peers.torrent = torrents.id LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN snatched ON torrents.id = snatched.torrentid WHERE peers.userid=$id AND snatched.userid = $id AND peers.seeder='no' ORDER BY torrents.id DESC") or sqlerr();
|
||||||
$count = mysql_num_rows($res);
|
$fields = "torrent,snatched.uploaded,snatched.downloaded,torrents.name as torrentname, torrents.small_descr, torrents.sp_state, torrents.banned, torrents.approval_status, categories.name as catname,size,torrents.hr,image,category,seeders,leechers, torrents.added";
|
||||||
if ($count > 0){
|
$tableWhere = "peers LEFT JOIN torrents ON peers.torrent = torrents.id LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN snatched ON torrents.id = snatched.torrentid WHERE peers.userid=$id AND snatched.userid = $id AND peers.seeder='no'";
|
||||||
list($torrentlist, $total_size) = maketable ( $res, 'leeching' );
|
$order = "torrents.id DESC";
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Completed torrents
|
// Completed torrents
|
||||||
case 'completed':
|
case 'completed':
|
||||||
{
|
{
|
||||||
$res = sql_query("SELECT torrents.id AS torrent, torrents.name AS torrentname, small_descr, categories.name AS catname, torrents.banned, torrents.approval_status, categories.image, category, sp_state, size, torrents.hr, torrents.added,snatched.uploaded, snatched.seedtime, snatched.leechtime, snatched.completedat FROM torrents LEFT JOIN snatched ON torrents.id = snatched.torrentid LEFT JOIN categories on torrents.category = categories.id WHERE snatched.finished='yes' AND torrents.owner != $id AND userid=$id ORDER BY snatched.completedat DESC") or sqlerr();
|
// $res = sql_query("SELECT torrents.id AS torrent, torrents.name AS torrentname, small_descr, categories.name AS catname, torrents.banned, torrents.approval_status, categories.image, category, sp_state, size, torrents.hr, torrents.added,snatched.uploaded, snatched.seedtime, snatched.leechtime, snatched.completedat FROM torrents LEFT JOIN snatched ON torrents.id = snatched.torrentid LEFT JOIN categories on torrents.category = categories.id WHERE snatched.finished='yes' AND torrents.owner != $id AND userid=$id ORDER BY snatched.id DESC") or sqlerr();
|
||||||
$count = mysql_num_rows($res);
|
$fields = "torrents.id AS torrent, torrents.name AS torrentname, small_descr, categories.name AS catname, torrents.banned, torrents.approval_status, categories.image, category, sp_state, size, torrents.hr, torrents.added,snatched.uploaded, snatched.seedtime, snatched.leechtime, snatched.completedat";
|
||||||
if ($count > 0)
|
$tableWhere = "torrents LEFT JOIN snatched ON torrents.id = snatched.torrentid LEFT JOIN categories on torrents.category = categories.id WHERE snatched.finished='yes' AND userid=$id AND torrents.owner != $id";
|
||||||
{
|
$order = "snatched.id DESC";
|
||||||
list($torrentlist, $total_size) = maketable ( $res, 'completed' );
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Incomplete torrents
|
// Incomplete torrents
|
||||||
case 'incomplete':
|
case 'incomplete':
|
||||||
{
|
{
|
||||||
$res = sql_query("SELECT torrents.id AS torrent, torrents.name AS torrentname, small_descr, torrents.banned, torrents.approval_status, categories.name AS catname, categories.image, category, sp_state, size, torrents.hr, torrents.added,snatched.uploaded, snatched.downloaded, snatched.leechtime FROM torrents LEFT JOIN snatched ON torrents.id = snatched.torrentid LEFT JOIN categories on torrents.category = categories.id WHERE snatched.finished='no' AND userid=$id AND torrents.owner != $id ORDER BY snatched.startdat DESC") or sqlerr();
|
$res = sql_query("SELECT torrents.id AS torrent, torrents.name AS torrentname, small_descr, torrents.banned, torrents.approval_status, categories.name AS catname, categories.image, category, sp_state, size, torrents.hr, torrents.added,snatched.uploaded, snatched.downloaded, snatched.leechtime FROM torrents LEFT JOIN snatched ON torrents.id = snatched.torrentid LEFT JOIN categories on torrents.category = categories.id WHERE snatched.finished='no' AND userid=$id AND torrents.owner != $id ORDER BY snatched.id DESC") or sqlerr();
|
||||||
$count = mysql_num_rows($res);
|
$fields = "torrents.id AS torrent, torrents.name AS torrentname, small_descr, torrents.banned, torrents.approval_status, categories.name AS catname, categories.image, category, sp_state, size, torrents.hr, torrents.added,snatched.uploaded, snatched.downloaded, snatched.leechtime";
|
||||||
if ($count > 0)
|
$tableWhere = "torrents LEFT JOIN snatched ON torrents.id = snatched.torrentid LEFT JOIN categories on torrents.category = categories.id WHERE snatched.finished='no' AND userid=$id AND torrents.owner != $id";
|
||||||
{
|
$order = "snatched.id DESC";
|
||||||
list($torrentlist, $total_size) = maketable ( $res, 'incomplete' );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
$count = 0;
|
|
||||||
$torrentlist = "";
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isset($tableWhere)) {
|
||||||
|
$cacheKey = sprintf('user:%s:type:%s:total_size', $id, $type);
|
||||||
|
$page = $_GET['page'] ?? 0;
|
||||||
|
$sumSql = "select count(*) as count, sum(torrents.size) as total_size from $tableWhere limit 1";
|
||||||
|
if ($page == 0) {
|
||||||
|
$sumRes = mysql_fetch_assoc(sql_query($sumSql));
|
||||||
|
\Nexus\Database\NexusDB::cache_put($cacheKey, $sumRes);
|
||||||
|
} else {
|
||||||
|
$sumRes = \Nexus\Database\NexusDB::remember($cacheKey, 3600, function () use ($sumSql) {
|
||||||
|
return mysql_fetch_assoc(sql_query($sumSql));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
$count = $sumRes['count'];
|
||||||
|
$total_size = $sumRes['total_size'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($count > 0 && isset($tableWhere, $fields, $order))
|
||||||
|
{
|
||||||
|
$pageSize = 100;
|
||||||
|
list($pagertop, $pagerbottom, $limit) = pager($pageSize, $count, "getusertorrentlistajax.php?");
|
||||||
|
$sql = "select $fields from $tableWhere order by $order $limit";
|
||||||
|
do_log("count: $count, list sql: $sql");
|
||||||
|
$res = sql_query($sql);
|
||||||
|
list($torrentlist, $total_size_this_page) = maketable ( $res, $type);
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($total_size) && $total_size){
|
if (isset($total_size) && $total_size){
|
||||||
echo "<br /><b>" . $count . "</b>" . $lang_getusertorrentlistajax['text_record'] . add_s ( $count ) . $lang_getusertorrentlistajax['text_total_size'] . mksize($total_size) . "<br /><br />" . $torrentlist;
|
echo "<br /><b>" . $count . "</b>" . $lang_getusertorrentlistajax['text_record'] . add_s ( $count ) . $lang_getusertorrentlistajax['text_total_size'] . mksize($total_size) . $pagertop . $torrentlist . $pagerbottom;
|
||||||
} elseif ($count){
|
} elseif ($count){
|
||||||
echo "<br /><b>".$count."</b>".$lang_getusertorrentlistajax['text_record'].add_s($count)."<br /><br />".$torrentlist;
|
echo "<br /><b>".$count."</b>".$lang_getusertorrentlistajax['text_record'].add_s($count). $pagertop . $torrentlist . $pagerbottom;
|
||||||
} else {
|
} else {
|
||||||
echo $lang_getusertorrentlistajax['text_no_record'];
|
echo $lang_getusertorrentlistajax['text_no_record'];
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+10
-10
@@ -83,20 +83,20 @@ jQuery(document).ready(function () {
|
|||||||
if ("IntersectionObserver" in window) {
|
if ("IntersectionObserver" in window) {
|
||||||
const imgList = [...document.querySelectorAll('.nexus-lazy-load')]
|
const imgList = [...document.querySelectorAll('.nexus-lazy-load')]
|
||||||
var io = new IntersectionObserver((entries) =>{
|
var io = new IntersectionObserver((entries) =>{
|
||||||
entries.forEach(item => {
|
entries.forEach(entry => {
|
||||||
// isIntersecting是一个Boolean值,判断目标元素当前是否可见
|
const el = entry.target
|
||||||
if (item.isIntersecting) {
|
const intersectionRatio = entry.intersectionRatio
|
||||||
item.target.src = item.target.dataset.src
|
// console.log(`el, ${el.getAttribute('data-src')}, intersectionRatio: ${intersectionRatio}`)
|
||||||
item.target.classList.add('preview')
|
if (intersectionRatio > 0 && intersectionRatio <= 1 && !el.classList.contains('preview')) {
|
||||||
// 图片加载后即停止监听该元素
|
// console.log(`el, ${el.getAttribute('data-src')}, loadImg`)
|
||||||
io.unobserve(item.target)
|
const source = el.dataset.src
|
||||||
|
el.src = source
|
||||||
|
el.classList.add('preview')
|
||||||
}
|
}
|
||||||
|
el.onload = el.onerror = () => io.unobserve(el)
|
||||||
})
|
})
|
||||||
}, {
|
|
||||||
root: document.querySelector('body')
|
|
||||||
})
|
})
|
||||||
|
|
||||||
// observe遍历监听所有img节点
|
|
||||||
imgList.forEach(img => io.observe(img))
|
imgList.forEach(img => io.observe(img))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+18
-5
@@ -397,19 +397,19 @@ if ($user["id"] == $CURUSER["id"] || user_can('viewhistory')) {
|
|||||||
|
|
||||||
if ($user["ip"] && (user_can('torrenthistory') || $user["id"] == $CURUSER["id"])){
|
if ($user["ip"] && (user_can('torrenthistory') || $user["id"] == $CURUSER["id"])){
|
||||||
|
|
||||||
tr_small($lang_userdetails['row_uploaded_torrents'], "<a href=\"javascript: getusertorrentlistajax('".$user['id']."', 'uploaded', 'ka'); klappe_news('a')\"><img class=\"plus\" src=\"pic/trans.gif\" id=\"pica\" alt=\"Show/Hide\" title=\"".$lang_userdetails['title_show_or_hide'] ."\" /> <u>".$lang_userdetails['text_show_or_hide']."</u></a><div id=\"ka\" style=\"display: none;\"></div>", 1);
|
tr_small($lang_userdetails['row_uploaded_torrents'], "<a href=\"javascript: getusertorrentlistajax('".$user['id']."', 'uploaded', 'ka'); klappe_news('a')\"><img class=\"plus\" src=\"pic/trans.gif\" id=\"pica\" alt=\"Show/Hide\" title=\"".$lang_userdetails['title_show_or_hide'] ."\" /> <u>".$lang_userdetails['text_show_or_hide']."</u></a><div id=\"ka\" style=\"display: none;\" data-type='uploaded'></div>", 1);
|
||||||
|
|
||||||
|
|
||||||
tr_small($lang_userdetails['row_current_seeding'], "<a href=\"javascript: getusertorrentlistajax('".$user['id']."', 'seeding', 'ka1'); klappe_news('a1')\"><img class=\"plus\" src=\"pic/trans.gif\" id=\"pica1\" alt=\"Show/Hide\" title=\"".$lang_userdetails['title_show_or_hide']."\" /> <u>".$lang_userdetails['text_show_or_hide']."</u></a><div id=\"ka1\" style=\"display: none;\"></div>", 1);
|
tr_small($lang_userdetails['row_current_seeding'], "<a href=\"javascript: getusertorrentlistajax('".$user['id']."', 'seeding', 'ka1'); klappe_news('a1')\"><img class=\"plus\" src=\"pic/trans.gif\" id=\"pica1\" alt=\"Show/Hide\" title=\"".$lang_userdetails['title_show_or_hide']."\" /> <u>".$lang_userdetails['text_show_or_hide']."</u></a><div id=\"ka1\" style=\"display: none;\" data-type='seeding'></div>", 1);
|
||||||
|
|
||||||
|
|
||||||
tr_small($lang_userdetails['row_current_leeching'], "<a href=\"javascript: getusertorrentlistajax('".$user['id']."', 'leeching', 'ka2'); klappe_news('a2')\"><img class=\"plus\" src=\"pic/trans.gif\" id=\"pica2\" alt=\"Show/Hide\" title=\"".$lang_userdetails['title_show_or_hide']."\" /> <u>".$lang_userdetails['text_show_or_hide']."</u></a><div id=\"ka2\" style=\"display: none;\"></div>", 1);
|
tr_small($lang_userdetails['row_current_leeching'], "<a href=\"javascript: getusertorrentlistajax('".$user['id']."', 'leeching', 'ka2'); klappe_news('a2')\"><img class=\"plus\" src=\"pic/trans.gif\" id=\"pica2\" alt=\"Show/Hide\" title=\"".$lang_userdetails['title_show_or_hide']."\" /> <u>".$lang_userdetails['text_show_or_hide']."</u></a><div id=\"ka2\" style=\"display: none;\" data-type='leeching'></div>", 1);
|
||||||
|
|
||||||
|
|
||||||
tr_small($lang_userdetails['row_completed_torrents'], "<a href=\"javascript: getusertorrentlistajax('".$user['id']."', 'completed', 'ka3'); klappe_news('a3')\"><img class=\"plus\" src=\"pic/trans.gif\" id=\"pica3\" alt=\"Show/Hide\" title=\"".$lang_userdetails['title_show_or_hide']."\" /> <u>".$lang_userdetails['text_show_or_hide']."</u></a><div id=\"ka3\" style=\"display: none;\"></div>", 1);
|
tr_small($lang_userdetails['row_completed_torrents'], "<a href=\"javascript: getusertorrentlistajax('".$user['id']."', 'completed', 'ka3'); klappe_news('a3')\"><img class=\"plus\" src=\"pic/trans.gif\" id=\"pica3\" alt=\"Show/Hide\" title=\"".$lang_userdetails['title_show_or_hide']."\" /> <u>".$lang_userdetails['text_show_or_hide']."</u></a><div id=\"ka3\" style=\"display: none;\" data-type='completed'></div>", 1);
|
||||||
|
|
||||||
|
|
||||||
tr_small($lang_userdetails['row_incomplete_torrents'], "<a href=\"javascript: getusertorrentlistajax('".$user['id']."', 'incomplete', 'ka4'); klappe_news('a4')\"><img class=\"plus\" src=\"pic/trans.gif\" id=\"pica4\" alt=\"Show/Hide\" title=\"".$lang_userdetails['title_show_or_hide']."\" /> <u>".$lang_userdetails['text_show_or_hide']."</u></a><div id=\"ka4\" style=\"display: none;\"></div>", 1);
|
tr_small($lang_userdetails['row_incomplete_torrents'], "<a href=\"javascript: getusertorrentlistajax('".$user['id']."', 'incomplete', 'ka4'); klappe_news('a4')\"><img class=\"plus\" src=\"pic/trans.gif\" id=\"pica4\" alt=\"Show/Hide\" title=\"".$lang_userdetails['title_show_or_hide']."\" /> <u>".$lang_userdetails['text_show_or_hide']."</u></a><div id=\"ka4\" style=\"display: none;\" data-type='incomplete'></div>", 1);
|
||||||
}
|
}
|
||||||
if ($user["info"])
|
if ($user["info"])
|
||||||
print("<tr><td align=\"left\" colspan=\"2\" class=\"text\">" . format_comment($user["info"],false) . "</td></tr>\n");
|
print("<tr><td align=\"left\" colspan=\"2\" class=\"text\">" . format_comment($user["info"],false) . "</td></tr>\n");
|
||||||
@@ -620,5 +620,18 @@ JS;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
end_main_frame();
|
end_main_frame();
|
||||||
|
|
||||||
|
$paginationJs = <<<JS
|
||||||
|
jQuery("body").on("click", ".nexus-pagination a", function (e) {
|
||||||
|
e.preventDefault()
|
||||||
|
let _this = jQuery(this)
|
||||||
|
let box = _this.closest("[data-type]")
|
||||||
|
let type = box.attr("data-type");
|
||||||
|
let url = _this.attr("href") + "&userid={$user['id']}&type=" + type;
|
||||||
|
let result = ajax.gets(url);
|
||||||
|
box.html(result)
|
||||||
|
})
|
||||||
|
JS;
|
||||||
|
\Nexus\Nexus::js($paginationJs, 'footer', false);
|
||||||
stdfoot();
|
stdfoot();
|
||||||
?>
|
?>
|
||||||
|
|||||||
Reference in New Issue
Block a user