sync: 2024-06-09 20:03:47 +0000

This commit is contained in:
mosasauroidea-bot
2024-06-09 20:03:47 +00:00
parent fd026949ab
commit d7ae678ab1
22 changed files with 564 additions and 452 deletions

View File

@@ -890,7 +890,7 @@ class Text {
$RV = explode('#', $Rule);
if (count($RV) == 1) {
$Num = $RV[0];
$Str .= '<a href="rules.php?p=upload#' . urlencode(Format::undisplay_str($Num)) . '">' . 'golden#' . $Num . '</a>';
$Str .= '<a href="rules.php?p=upload#' . urlencode(Format::undisplay_str($Num)) . '">' . 'upload#' . $Num . '</a>';
} else {
$Page = $RV[0];
$Num = $RV[1];

View File

@@ -20,7 +20,6 @@ class TORRENT_FORM {
var $Containers = array();
var $Resolutions = array();
var $Processings = array();
var $Makers = array();
var $UploadForm = '';
var $Torrent = array();
@@ -41,7 +40,7 @@ class TORRENT_FORM {
$this->Torrent = $Torrent;
$this->Error = $Error;
global $UploadForm, $Categories, $Sources, $Codecs, $Containers, $Resolutions, $Processings, $Makers, $TorrentID;
global $UploadForm, $Categories, $Sources, $Codecs, $Containers, $Resolutions, $Processings, $TorrentID;
$this->UploadForm = $UploadForm;
$this->Categories = $Categories;
@@ -50,7 +49,6 @@ class TORRENT_FORM {
$this->Containers = $Containers;
$this->Resolutions = $Resolutions;
$this->Processings = $Processings;
$this->Makers = $Makers;
$this->TorrentID = $TorrentID;
$this->GenreTags = Tags::get_genre_tag();
@@ -300,6 +298,8 @@ class TORRENT_FORM {
$Subtitles = isset($Torrent['Subtitles']) ? $Torrent['Subtitles'] : null;
$Buy = isset($Torrent['Buy']) ? $Torrent['Buy'] : null;
$Diy = isset($Torrent['Diy']) ? $Torrent['Diy'] : null;
$Makers = isset($Torrent['Makers']) ? $Torrent['Makers'] : null;
$ReleaseGroups = check_perms('users_mod') ? Users::get_all_release_groups() : [Users::get_release_group(G::$LoggedUser['ID'])];
$Jinzhuan = isset($Torrent['Jinzhuan']) ? $Torrent['Jinzhuan'] : null;
$IMDBID = isset($Torrent['IMDBID']) ? $Torrent['IMDBID'] : null;
$SpecialSub = isset($Torrent['SpecialSub']) ? $Torrent['SpecialSub'] : null;
@@ -841,45 +841,45 @@ class TORRENT_FORM {
</td>
</tr>
<tr class="Form-row">
<td class="Form-label"><?= "高级视频特性" ?><span class="u-colorWarning"></span>:</td>
<td class="Form-label"><?= t('server.torrents.advanced_video_feature') ?><span class="u-colorWarning"></span>:</td>
<td class="Form-inputs Form-errorAudio">
<div class="Checkbox">
<input class="Input" type="checkbox" id="10_bit" name="10_bit" <?= EditionInfo::checkEditionInfo($RemasterTitle, EditionInfo::edition_10_bit) ? "checked" : "" ?> />
<label class="Checkbox-label" for="10_bit"><?= "10bit 色深" ?></label>
<label class="Checkbox-label" for="10_bit"><?= t('server.editioninfo.10_bit') ?></label>
</div>
<div class="Checkbox">
<input class="Input" type="checkbox" id="hdr10" name="hdr10" <?= EditionInfo::checkEditionInfo($RemasterTitle, EditionInfo::edition_hdr10) ? "checked" : "" ?> />
<label class="Checkbox-label" for="hdr10"><?= "HDR10" ?></label>
<label class="Checkbox-label" for="hdr10"><?= t('server.editioninfo.hdr10') ?></label>
</div>
<div class="Checkbox">
<input class="Input" type="checkbox" id="hdr10plus" name="hdr10plus" <?= EditionInfo::checkEditionInfo($RemasterTitle, EditionInfo::edition_hdr10plus) ? "checked" : "" ?> />
<label class="Checkbox-label" for="hdr10plus"><?= "HDR10+" ?></label>
<label class="Checkbox-label" for="hdr10plus"><?= t('server.editioninfo.hdr10plus') ?></label>
</div>
<div class="Checkbox">
<input class="Input" type="checkbox" id="dolby_vision" name="dolby_vision" <?= EditionInfo::checkEditionInfo($RemasterTitle, EditionInfo::edition_dolby_vision) ? "checked" : "" ?> />
<label class="Checkbox-label" for="dolby_vision"><?= "杜比视界" ?></label>
<label class="Checkbox-label" for="dolby_vision"><?= t('server.editioninfo.dolby_vision') ?></label>
</div>
<span id="video_warning" class="important_text"></span>
</td>
</tr>
<tr class="Form-row">
<td class="Form-label"><?= "高级音频特性" ?><span class="u-colorWarning"></span>:</td>
<td class="Form-label"><?= t('server.torrents.advanced_audio_feature') ?><span class="u-colorWarning"></span>:</td>
<td class="Form-inputs Form-errorAudio">
<div class="Checkbox hidden">
<input class="Input" type="checkbox" id="audio_51" name="audio_51" <?= false ? "checked" : "" ?> />
<label class="Checkbox-label" for="audio_51"><?= "5.1声道" ?></label>
<label class="Checkbox-label" for="audio_51"><?= t('server.editioninfo.51_surround') ?></label>
</div>
<div class="Checkbox hidden">
<input class="Input" type="checkbox" id="audio_71" name="audio_71" <?= false ? "checked" : "" ?> />
<label class="Checkbox-label" for="audio_71"><?= "7.1声道" ?></label>
<label class="Checkbox-label" for="audio_71"><?= t('server.editioninfo.71_surround') ?></label>
</div>
<div class="Checkbox">
<input class="Input" type="checkbox" id="dts_x" name="dts_x" <?= EditionInfo::checkEditionInfo($RemasterTitle, EditionInfo::edition_dts_x) ? "checked" : "" ?> />
<label class="Checkbox-label" for="dts_x"><?= "DTS:X" ?></label>
<label class="Checkbox-label" for="dts_x"><?= t('server.editioninfo.dts_x') ?></label>
</div>
<div class="Checkbox">
<input class="Input" type="checkbox" id="dolby_atmos" name="dolby_atmos" <?= EditionInfo::checkEditionInfo($RemasterTitle, EditionInfo::edition_dolby_atmos) ? "checked" : "" ?> />
<label class="Checkbox-label" for="dolby_atmos"><?= "杜比全景声" ?></label>
<label class="Checkbox-label" for="dolby_atmos"><?= t('server.editioninfo.dolby_atmos') ?></label>
</div>
<span id="audio_warning" class="important_text"></span>
</td>
@@ -1014,16 +1014,39 @@ class TORRENT_FORM {
<div class="Checkbox">
<input class="Input" type="checkbox" id="jinzhuan" name="jinzhuan" <? if ($Jinzhuan) {
echo 'checked="checked" ';
} ?><?= !$Buy && !$Diy && !check_perms("users_mod") ? "disabled" : "" ?> />
} ?><?= !$Buy && !$Diy ? "disabled" : "" ?> />
<label class="Checkbox-label" for="jinzhuan"><?= t('server.upload.jinzhuan') ?></label>
</div>
<?
if (count($ReleaseGroups) > 0) {
?>
<div class="SelectInput">
<select class="Input" id="makers" name="makers" <?= !$Buy && !$Diy ? "disabled" : "" ?>>
<option class="Select-option" value=""><?= t('server.torrents.release_group') ?></option>
<?
foreach ($ReleaseGroups as $ReleaseGroup) {
$Name = $ReleaseGroup['Name'];
$ID = $ReleaseGroup['ID'];
echo "\t\t\t\t\t\t<option value=\"$ID\"";
if ($ID == $Makers) {
echo ' selected="selected"';
}
echo ">$Name</option>\n";
}
?>
</select>
</div>
<?
}
?>
</div>
<div style="padding: 10px 0 0;"><?= t('server.upload.marks_warning') ?></div>
<div>
<strong class="how_to_toggle_container">[<a href="javascript:void(0);" onclick="$('#marks_how_to_blockquote').new_toggle();"><strong class="how_to_toggle"><?= t('server.upload.marks_how_to_toggle') ?></strong></a>]</strong>
</div>
</td>
</tr>
<tr class="Form-row">
<td class="Form-label">

View File

@@ -425,7 +425,7 @@ class Torrents {
foreach ($NotFound as $GroupID => &$GroupInfo) {
uasort($GroupInfo['Torrents'], 'Torrents::sort_torrent');
G::$Cache->cache_value($Key . $GroupID, array('ver' => CACHE::GROUP_VERSION, 'd' => $GroupInfo), 0);
G::$Cache->cache_value($Key . $GroupID, array('ver' => CACHE::GROUP_VERSION, 'd' => $GroupInfo), 3600);
}
$Found = $NotFound + $Found;
@@ -1292,11 +1292,15 @@ WHERE ud.TorrentID=? AND ui.NotifyOnDeleteDownloaded='1' AND ud.UserID NOT IN ({
if ($Data['Allow'] == '1') {
$Info[] = Format::torrent_label(t('server.torrents.allow'), 'tl_allow');
}
if ($Option['SettingTorrentTitle']['ReleaseGroup']) {
$ReleaseGroup = $Data['ReleaseGroup'] ?: self::release_group($Data);
if ($ReleaseGroup) {
$Info[] = "<span class='TorrentTitle-item is-releaseGroup'>$ReleaseGroup</span>";
}
$OfficialReleaseGroup = false;
$ReleaseGroup = Users::get_release_group_by_id($Data['Makers'])['Name'];
if (empty($ReleaseGroup)) {
$ReleaseGroup = self::release_group($Data);
} else {
$OfficialReleaseGroup = true;
}
if ($ReleaseGroup && $Option['SettingTorrentTitle']['ReleaseGroup']) {
$Info[] = "<span class='TorrentTitle-item is-releaseGroup " . ($OfficialReleaseGroup ? "bg tl_buy" : '') . "'>$ReleaseGroup</span>";
}
if (
(!empty($Data['BadFiles'])) ||
@@ -1308,12 +1312,13 @@ WHERE ud.TorrentID=? AND ui.NotifyOnDeleteDownloaded='1' AND ud.UserID NOT IN ({
) {
$Info[] = Format::torrent_label(t('server.torrents.trump'), 'tl_trumpable');
}
if ($Data['Buy'] == '1' && $Data['Diy'] == '0') {
$Info[] = Format::torrent_label(t('server.torrents.buy'), 'bg tl_buy');
}
if ($Data['Diy'] == '1') {
$Info[] = Format::torrent_label(t('server.torrents.diy'), 'bg tl_diy');
if (empty($OfficialReleaseGroup)) {
if ($Data['Buy'] == '1' && $Data['Diy'] == '0') {
$Info[] = Format::torrent_label(t('server.torrents.buy'), 'bg tl_buy');
}
if ($Data['Diy'] == '1') {
$Info[] = Format::torrent_label(t('server.torrents.diy'), 'bg tl_diy');
}
}
if (self::global_freeleech()) {
$Info[] = Format::torrent_label(t('server.torrents.fld'), 'tl_free bg torrent_discount free');
@@ -1407,8 +1412,8 @@ WHERE ud.TorrentID=? AND ui.NotifyOnDeleteDownloaded='1' AND ud.UserID NOT IN ({
foreach ($Torrents as $Torrent) {
list($TorrentID, $GroupID, $InfoHash) = $Torrent;
if($LimitTime !== null) {
G::$DB->query("
if ($LimitTime !== null) {
G::$DB->query("
INSERT INTO `freetorrents_timed`(`TorrentID`, `EndTime`)
VALUES ($TorrentID, '$LimitTime') ON DUPLICATE KEY UPDATE EndTime=VALUES(EndTime)");
}

View File

@@ -864,6 +864,31 @@ class Users {
global $HeavyInfo;
return empty($HeavyInfo['DisableAvatars']) || $HeavyInfo['DisableAvatars'] != 1;
}
public static function get_release_group(int $UserID): ?array {
foreach (CONFIG['RELEASE_GROUP_MEMBER'] as $ID => $Members) {
foreach ($Members as $Member) {
if ($Member == $UserID) {
return self::get_release_group_by_id($ID);
}
}
}
return [];
}
public static function get_all_release_groups(): ?array {
return CONFIG['RELEASE_GROUP'];
}
public static function get_release_group_by_id($ReleaseGroupID): ?array {
foreach (CONFIG['RELEASE_GROUP'] as $ReleaseGroup) {
if ($ReleaseGroup['ID'] == $ReleaseGroupID) {
return $ReleaseGroup;
}
}
return [];
}
/**
* Checks whether user has autocomplete enabled
*

View File

@@ -246,3 +246,5 @@ $CONFIG['SECONDARY_CLASS'] = [];
$CONFIG['UPLOAD_RANK_START_TIME'] = '0000-00-00 00:00:00';
$CONFIG['UPLOAD_RANK_END_TIME'] = '0000-00-00 00:00:00';
$CONFIG['UPLOAD_RANK_SHOW_END_TIME'] = '0000-00-00 00:00:00';
$CONFIG['RELEASE_GROUP'] = [];
$CONFIG['RELEASE_GROUP_MEMBER'] = [];

View File

@@ -9,10 +9,10 @@ define('FOOTER_FILE', CONFIG['SERVER_ROOT'] . '/design/publicfooter.php');
<title><?= display_str($PageTitle) ?></title>
<meta http-equiv="X-UA-Compatible" content="chrome=1; IE=edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="referrer" content="none, no-referrer, same-origin" />
<meta name="referrer" content="same-origin" />
<link rel="shortcut icon" href="favicon.ico" />
<link rel="apple-touch-icon" href="favicon.ico" />
<meta name="viewport" content="width=device-width; initial-scale=1.0;" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<? if (CONFIG['IS_DEV']) { ?>
<link rel="stylesheet" type="text/css" media="screen" href="/src/css/publicstyle/style.css" />
<? } else { ?>

View File

@@ -19,7 +19,7 @@
"lint:php:fix": "./.bin/phpcbf",
"pre-commit": "yarn lint:php:fix"
},
"license": "Unlicense",
"license": "MIT",
"dependencies": {
"classnames": "^2.3.1",
"debug": "^4.3.1",

View File

@@ -90,7 +90,7 @@ if (
// Silly hack for people who are on the old setting
$CollageCovers = isset($LoggedUser['CollageCovers']) ? $LoggedUser['CollageCovers'] : 25 * (abs($LoggedUser['HideCollage'] - 1));
View::show_header($Name, 'browse,collage,bbcode,voting,recommend', 'PageCollageTorrent');
View::show_header($Name, 'browse,collage,comments,bbcode,voting,recommend', 'PageCollageTorrent');
?>
<div class="LayoutBody">
<div class="BodyHeader">

View File

@@ -632,7 +632,7 @@ View::show_header($ThreadInfo['Title'], 'comments,subscriptions,bbcode,thumb', $
} else {
if (check_perms('site_moderate_forums')) {
?>
- <a href="forums.php?action=sticky_post&amp;threadid=<?= $ThreadID ?>&amp;postid=<?= $PostID ?>&amp;auth=<?= $LoggedUser['AuthKey'] ?>" data-tooltip="<?= t('server.forums.sticky_title') ?>" class="brackets">&#x21d5;</a>
- <a href="forums.php?action=sticky_post&amp;threadid=<?= $ThreadID ?>&amp;postid=<?= $PostID ?>&amp;auth=<?= $LoggedUser['AuthKey'] ?>" data-tooltip="<?= t('server.forums.sticky_title') ?>" class="brackets"><?= t('server.forums.sticky') ?></a>
<?
}
}

View File

@@ -8,11 +8,11 @@ function updateYearMovie($fromYear, $toYear, $interval) {
$DB->query("SELECT ID, IMDBID, DoubanID, Year from torrents_group where MOD(UNIX_TIMESTAMP(Time),$interval) = " . (date('z') + 1) % $interval . " and Year > " . $fromYear . " and Year <= " . $toYear);
$Groups = G::$DB->to_array();
foreach ($Groups as $Group) {
updateMovieInfo($Group);
updateMovieInfo2($Group);
}
}
function updateMovieInfo($Group) {
function updateMovieInfo2($Group) {
$IMDBID = $Group['IMDBID'];
$GroupID = $Group['ID'];
$DoubanID = $Group['DoubanID'];

View File

@@ -254,9 +254,10 @@ switch ($_REQUEST['action']) {
if (is_numeric($_REQUEST['id'])) {
$DB->prepared_query("
SELECT p.ID, p.Name, p.Level, p.Secondary, p.PermittedForums, p.Values, p.DisplayStaff, p.StaffGroup, COUNT(u.ID)
SELECT p.ID, p.Name, p.Level, p.Secondary, p.PermittedForums, p.Values, p.DisplayStaff, p.StaffGroup, COUNT(u.ID) + COUNT(DISTINCT l.UserID)
FROM permissions AS p
LEFT JOIN users_main AS u ON u.PermissionID = p.ID
LEFT JOIN users_levels AS l ON l.PermissionID = p.ID
WHERE p.ID = ?
GROUP BY p.ID", $_REQUEST['id']);
list($ID, $Name, $Level, $Secondary, $Forums, $Values, $DisplayStaff, $StaffGroup, $UserCount) = $DB->next_record(MYSQLI_NUM, array(5));

View File

@@ -307,12 +307,23 @@ $OverallRank = UserRank::overall_score($UploadedRank, $DownloadedRank, $UploadsR
$DB->query("select count(1) from thumb where ToUserID = $UserID");
list($ThumbCount) = $DB->next_record();
$ReleaseGroup = Users::get_release_group($UserID)
?>
<div class="LayoutBody">
<div class="BodyHeader">
<h2 class="BodyHeader-nav"><?= Users::format_username($UserID, true, true, true, false, true, false, true) ?>
<span class="floatright" id="thumb"><?= icon("Common/like") ?><?= $ThumbCount ? ' ' . $ThumbCount : '' ?></span>
</h2>
<?
if (!empty($ReleaseGroup)) {
?>
<div class="BodyHeader-subNav">
<?= t('server.user.member_of_group', ['Values' => [$ReleaseGroup['Name']]]) ?>
</div>
<?
}
?>
</div>
<div class="BodyNavLinks">
<? if (!$OwnProfile) { ?>

View File

@@ -19,11 +19,11 @@ if (!empty($_GET['letter'])) {
$Order = "Title";
$Way = "Ascending";
} else {
// What are we looking for? Let's make sure it isn't dangerous.
$Search = db_string(trim($_GET['search']));
$Type = $_GET['type'];
if (!in_array($Type, array('Title', 'Body'))) {
$Type = 'Title';
}
@@ -31,11 +31,6 @@ if (!empty($_GET['letter'])) {
// Break search string down into individual words
$Words = explode(' ', $Search);
$Type = $TypeTable[$_GET['type']];
if (!$Type) {
$Type = 'Title';
}
$Order = $OrderTable[$_GET['order']];
if (!$Order) {
$Order = 'ID';

View File

@@ -89,3 +89,7 @@ Where
overflow: visible;
border-top: var(--global-border-box);
}
.TableForumPost.sticky_post {
border: 1px, solid, var(--global-color-warning);
}

View File

@@ -24,6 +24,10 @@ TorrentTitle TorrentTitle--standalone # settings - torrent title
line-height: 1.5em;
}
.TorrentTitle-item.official_release_group {
background-color: #e80128;
}
.TorrentTitle-item.torrent_discount.free {
background-color: #0055ff;
}

View File

@@ -1,11 +1,20 @@
<svg class="icon" width="4.75em" height="1em" viewBox="0 0 57 12" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Dolby Atoms (Outline)</title>
<svg class="icon" width="4.75em" height="1em" viewBox="0 0 57 12" version="1.1"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Dolby Atmos (Outline)</title>
<g id="1.-Media" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Dolby-Atoms-(Outline)" fill="currentColor" fill-rule="nonzero">
<path d="M18.2539062,10 L19.109375,7.58007812 L22.5136719,7.58007812 L23.3691406,10 L24.4765625,10 L21.3359375,1.54492188 L20.2929688,1.54492188 L17.1464844,10 L18.2539062,10 Z M22.1972656,6.68359375 L19.4316406,6.68359375 L20.8027344,2.81054688 L20.8261719,2.81054688 L22.1972656,6.68359375 Z M27.4648438,10 L27.4648438,2.49414062 L30.1308594,2.49414062 L30.1308594,1.54492188 L23.7441406,1.54492188 L23.7441406,2.49414062 L26.4101562,2.49414062 L26.4101562,10 L27.4648438,10 Z M32.2285156,10 L32.2285156,3.46679688 L32.2636719,3.46679688 L34.9648438,10 L35.8554688,10 L38.5566406,3.46679688 L38.5917969,3.46679688 L38.5917969,10 L39.5761719,10 L39.5761719,1.54492188 L38.3574219,1.54492188 L35.4277344,8.66992188 L35.3925781,8.66992188 L32.4628906,1.54492188 L31.2441406,1.54492188 L31.2441406,10 L32.2285156,10 Z M44.7910156,10.140625 C47.1875,10.140625 48.6816406,8.45898438 48.6816406,5.77539062 L48.6816406,5.76367188 C48.6816406,3.0859375 47.1816406,1.40429688 44.7910156,1.40429688 C42.3945312,1.40429688 40.8886719,3.0859375 40.8886719,5.76367188 L40.8886719,5.77539062 C40.8886719,8.45898438 42.3886719,10.140625 44.7910156,10.140625 Z M44.7910156,9.16796875 C43.0566406,9.16796875 41.9667969,7.85546875 41.9667969,5.77539062 L41.9667969,5.76367188 C41.9667969,3.68359375 43.0625,2.37695312 44.7910156,2.37695312 C46.5136719,2.37695312 47.6035156,3.68945312 47.6035156,5.76367188 L47.6035156,5.77539062 C47.6035156,7.83789062 46.53125,9.16796875 44.7910156,9.16796875 Z M52.7597656,10.140625 C54.6933594,10.140625 55.8828125,9.19140625 55.8828125,7.69140625 L55.8828125,7.68554688 C55.8828125,6.39648438 55.15625,5.69335938 53.421875,5.3125 L52.484375,5.10742188 C51.3828125,4.8671875 50.8730469,4.43359375 50.8730469,3.7421875 L50.8730469,3.73632812 C50.8730469,2.921875 51.6113281,2.3828125 52.7421875,2.37695312 C53.8144531,2.37695312 54.5351562,2.88671875 54.6640625,3.74804688 L54.6757812,3.83007812 L55.7304688,3.83007812 L55.7246094,3.7421875 C55.6308594,2.359375 54.4238281,1.40429688 52.7714844,1.40429688 C51.03125,1.40429688 49.8007812,2.37695312 49.7949219,3.765625 L49.7949219,3.77148438 C49.7949219,5.0078125 50.5683594,5.75195312 52.2207031,6.11523438 L53.1582031,6.3203125 C54.3183594,6.578125 54.8046875,6.99414062 54.8046875,7.73828125 L54.8046875,7.74414063 C54.8046875,8.6171875 54.0371094,9.16796875 52.8183594,9.16796875 C51.59375,9.16796875 50.7734375,8.64648438 50.6503906,7.796875 L50.6386719,7.71484375 L49.5839844,7.71484375 L49.5898438,7.796875 C49.6953125,9.24414062 50.9316406,10.140625 52.7597656,10.140625 Z" id="ATMOS"></path>
<g id="Dolby-Atmos-(Outline)" fill="currentColor" fill-rule="nonzero">
<path
d="M18.2539062,10 L19.109375,7.58007812 L22.5136719,7.58007812 L23.3691406,10 L24.4765625,10 L21.3359375,1.54492188 L20.2929688,1.54492188 L17.1464844,10 L18.2539062,10 Z M22.1972656,6.68359375 L19.4316406,6.68359375 L20.8027344,2.81054688 L20.8261719,2.81054688 L22.1972656,6.68359375 Z M27.4648438,10 L27.4648438,2.49414062 L30.1308594,2.49414062 L30.1308594,1.54492188 L23.7441406,1.54492188 L23.7441406,2.49414062 L26.4101562,2.49414062 L26.4101562,10 L27.4648438,10 Z M32.2285156,10 L32.2285156,3.46679688 L32.2636719,3.46679688 L34.9648438,10 L35.8554688,10 L38.5566406,3.46679688 L38.5917969,3.46679688 L38.5917969,10 L39.5761719,10 L39.5761719,1.54492188 L38.3574219,1.54492188 L35.4277344,8.66992188 L35.3925781,8.66992188 L32.4628906,1.54492188 L31.2441406,1.54492188 L31.2441406,10 L32.2285156,10 Z M44.7910156,10.140625 C47.1875,10.140625 48.6816406,8.45898438 48.6816406,5.77539062 L48.6816406,5.76367188 C48.6816406,3.0859375 47.1816406,1.40429688 44.7910156,1.40429688 C42.3945312,1.40429688 40.8886719,3.0859375 40.8886719,5.76367188 L40.8886719,5.77539062 C40.8886719,8.45898438 42.3886719,10.140625 44.7910156,10.140625 Z M44.7910156,9.16796875 C43.0566406,9.16796875 41.9667969,7.85546875 41.9667969,5.77539062 L41.9667969,5.76367188 C41.9667969,3.68359375 43.0625,2.37695312 44.7910156,2.37695312 C46.5136719,2.37695312 47.6035156,3.68945312 47.6035156,5.76367188 L47.6035156,5.77539062 C47.6035156,7.83789062 46.53125,9.16796875 44.7910156,9.16796875 Z M52.7597656,10.140625 C54.6933594,10.140625 55.8828125,9.19140625 55.8828125,7.69140625 L55.8828125,7.68554688 C55.8828125,6.39648438 55.15625,5.69335938 53.421875,5.3125 L52.484375,5.10742188 C51.3828125,4.8671875 50.8730469,4.43359375 50.8730469,3.7421875 L50.8730469,3.73632812 C50.8730469,2.921875 51.6113281,2.3828125 52.7421875,2.37695312 C53.8144531,2.37695312 54.5351562,2.88671875 54.6640625,3.74804688 L54.6757812,3.83007812 L55.7304688,3.83007812 L55.7246094,3.7421875 C55.6308594,2.359375 54.4238281,1.40429688 52.7714844,1.40429688 C51.03125,1.40429688 49.8007812,2.37695312 49.7949219,3.765625 L49.7949219,3.77148438 C49.7949219,5.0078125 50.5683594,5.75195312 52.2207031,6.11523438 L53.1582031,6.3203125 C54.3183594,6.578125 54.8046875,6.99414062 54.8046875,7.73828125 L54.8046875,7.74414063 C54.8046875,8.6171875 54.0371094,9.16796875 52.8183594,9.16796875 C51.59375,9.16796875 50.7734375,8.64648438 50.6503906,7.796875 L50.6386719,7.71484375 L49.5839844,7.71484375 L49.5898438,7.796875 C49.6953125,9.24414062 50.9316406,10.140625 52.7597656,10.140625 Z"
id="ATMOS"></path>
<g id="Logo">
<path d="M0,6 L0,0 L1.23460208,0.0294985251 C2.04290657,0.0530973451 2.58546713,0.0943952802 2.82352941,0.15339233 C4.82214533,0.654867257 6.35570934,2.12389381 6.99238754,4.14749263 C7.2083045,4.83185841 7.26920415,5.39233038 7.23598616,6.30678466 C7.19723183,7.48672566 6.94809689,8.31268437 6.33356401,9.32153392 C5.61384083,10.4955752 4.51211073,11.3510324 3.15570934,11.7935103 C2.7183391,11.9351032 2.59100346,11.9469027 1.34532872,11.9764012 L0,12 L0,6 Z" id="Path" transform="translate(3.622235, 6.000000) scale(-1, 1) rotate(-180.000000) translate(-3.622235, -6.000000) "></path>
<path d="M13.2096886,11.8938053 C10.7570934,11.3333333 8.99100346,9.22123894 8.74740484,6.55457227 C8.58131488,4.73746313 9.22352941,2.94985251 10.5190311,1.6460177 C11.0948097,1.0619469 11.6927336,0.672566372 12.4290657,0.389380531 C13.1653979,0.112094395 13.8297578,0.01179941 15.0200692,0.01179941 L16,0.01179941 L16,6 L16,11.9882006 L14.7986159,11.9823009 C13.9570934,11.9823009 13.4754325,11.9528024 13.2096886,11.8938053 Z" id="Path" transform="translate(12.360819, 6.000000) scale(-1, 1) rotate(-180.000000) translate(-12.360819, -6.000000) "></path>
<path
d="M0,6 L0,0 L1.23460208,0.0294985251 C2.04290657,0.0530973451 2.58546713,0.0943952802 2.82352941,0.15339233 C4.82214533,0.654867257 6.35570934,2.12389381 6.99238754,4.14749263 C7.2083045,4.83185841 7.26920415,5.39233038 7.23598616,6.30678466 C7.19723183,7.48672566 6.94809689,8.31268437 6.33356401,9.32153392 C5.61384083,10.4955752 4.51211073,11.3510324 3.15570934,11.7935103 C2.7183391,11.9351032 2.59100346,11.9469027 1.34532872,11.9764012 L0,12 L0,6 Z"
id="Path"
transform="translate(3.622235, 6.000000) scale(-1, 1) rotate(-180.000000) translate(-3.622235, -6.000000) "></path>
<path
d="M13.2096886,11.8938053 C10.7570934,11.3333333 8.99100346,9.22123894 8.74740484,6.55457227 C8.58131488,4.73746313 9.22352941,2.94985251 10.5190311,1.6460177 C11.0948097,1.0619469 11.6927336,0.672566372 12.4290657,0.389380531 C13.1653979,0.112094395 13.8297578,0.01179941 15.0200692,0.01179941 L16,0.01179941 L16,6 L16,11.9882006 L14.7986159,11.9823009 C13.9570934,11.9823009 13.4754325,11.9528024 13.2096886,11.8938053 Z"
id="Path"
transform="translate(12.360819, 6.000000) scale(-1, 1) rotate(-180.000000) translate(-12.360819, -6.000000) "></path>
</g>
</g>
</g>

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

@@ -14,7 +14,7 @@ globalapp.toggleGroup = function toggleGroup(groupid, link, event) {
clickedRow = clickedRow.parentNode
}
var group_rows = clickedRow.parentNode.children
var showing = $(clickedRow).nextElementSibling().has_class('hidden')
var showing = $(clickedRow).nextElementSibling().has_class('u-hidden')
var allGroups = event.ctrlKey || event.metaKey // detect ctrl or cmd
// for dealing with Mac OS X
@@ -52,17 +52,17 @@ globalapp.toggleGroup = function toggleGroup(groupid, link, event) {
if (showing) {
// show the row depending on whether the edition it's in is collapsed or not
if (row.has_class('TableTorrent-rowCategory')) {
row.gshow()
row.remove_class('u-hidden')
showRow = $('a', row.raw()).raw().innerHTML != '+'
} else {
if (showRow) {
row.gshow()
row.remove_class('u-hidden')
} else {
row.ghide()
row.add_class('u-hidden')
}
}
} else {
row.ghide()
row.add_class('u-hidden')
}
}
}

View File

@@ -96,13 +96,13 @@ globalapp.uploadRemoveAllArtistFields = function removeAllArtistFields() {
globalapp.uploadAlterOriginal = function AlterOriginal() {
if (!$('input[name=buy]').raw().checked && !$('input[name=diy]').raw().checked) {
//$('input[name=allow]').raw().disabled = true
$('input[name=jinzhuan]').raw().disabled = true
//$('input[name=allow]').raw().checked = false
$('input[name=jinzhuan]').raw().checked = false
$('select[name=makers]').raw().disabled = true
$('select[name=makers]').raw().value = ''
} else {
//$('input[name=allow]').raw().disabled = false
$('input[name=jinzhuan]').raw().disabled = false
$('select[name=makers]').raw().disabled = false
}
}

View File

@@ -10,462 +10,462 @@ const IMDB_ID_PATTERN = /tt\d+/
const IMAGE_HOSTS = window.DATA['IMAGE_HOST_WHITELIST']
document.addEventListener('DOMContentLoaded', () => {
registerValidation()
registerValidation()
})
export function registerValidation() {
const form = document.querySelector('.FormValidation')
const form = document.querySelector('.FormValidation')
const validator = new Pristine(form, {
classTo: 'Form-errorContainer',
errorClass: 'form-invalid',
successClass: 'form-valid',
errorTextParent: 'Form-errorContainer',
errorTextTag: 'div',
errorTextClass: 'Form-errorMessage',
})
const validator = new Pristine(form, {
classTo: 'Form-errorContainer',
errorClass: 'form-invalid',
successClass: 'form-valid',
errorTextParent: 'Form-errorContainer',
errorTextTag: 'div',
errorTextClass: 'Form-errorMessage',
})
form.validator = validator
form.validator = validator
form.onsubmit = function (e) {
const valid = validator.validate()
document.querySelector('.form-invalid .Form-errorMessage')?.classList.remove('animate__animated', 'animate__flash')
if (valid) {
$('input:disabled, select:disabled').prop('disabled', false)
$('#post').addClass('is-loading').prop('disabled', true)
} else {
document.querySelector('.form-invalid').scrollIntoView()
document
.querySelector('.form-invalid .Form-errorMessage')
.classList.add('animate__animated', 'animate__flash', 'animate__repeat-3')
}
return valid
form.onsubmit = function (e) {
const valid = validator.validate()
document.querySelector('.form-invalid .Form-errorMessage')?.classList.remove('animate__animated', 'animate__flash')
if (valid) {
$('input:disabled, select:disabled').prop('disabled', false)
$('#post').addClass('is-loading').prop('disabled', true)
} else {
document.querySelector('.form-invalid').scrollIntoView()
document
.querySelector('.form-invalid .Form-errorMessage')
.classList.add('animate__animated', 'animate__flash', 'animate__repeat-3')
}
return valid
}
const { addValidator, addValidatorSelectInput } = createValidator({
validator,
})
const { addValidator, addValidatorSelectInput } = createValidator({
validator,
})
handleSelectInput({ watch: true, apply: true })
handleSelectInput({ watch: true, apply: true })
addValidatorSelectInput({
selector: `[name="releasetype"]`,
validate: validateSelectInputRequired,
messageKey: 'client.upload.releasetype_required',
})
addValidatorSelectInput({
selector: `[name="releasetype"]`,
validate: validateSelectInputRequired,
messageKey: 'client.upload.releasetype_required',
})
handleSourceAndProcessing()
addValidatorSelectInput({
selector: `[name="source"]`,
validate: validateSelectInputRequired,
messageKey: 'client.upload.source_required',
})
addValidatorSelectInput({
selector: `[name="processing"]`,
validate: validateProcessing,
messageKey: 'client.upload.processing_required',
})
handleSourceAndProcessing()
addValidatorSelectInput({
selector: `[name="source"]`,
validate: validateSelectInputRequired,
messageKey: 'client.upload.source_required',
})
addValidatorSelectInput({
selector: `[name="processing"]`,
validate: validateProcessing,
messageKey: 'client.upload.processing_required',
})
handleResolution()
handleResolution()
handleSubtitle()
addValidator({
selector: `[name="artist_ids[]"], [name="artists[]"],[name="importance[]"]`,
validate: validateArtists,
messageKey: 'client.upload.at_least_one_director',
})
addValidator({
selector: `[name="subtitles[]"], [name=subtitle_type]`,
validate: validateSubtitle,
messageKey: 'client.upload.subtitles_required',
})
addValidator({
selector: `[name="subtitles[]"], [name=subtitle_type]`,
validate: validateSubtitleWithMediainfo,
messageKey: 'client.upload.subtitles_with_mediainfo',
})
handleSubtitle()
addValidator({
selector: `[name="artist_ids[]"], [name="artists[]"],[name="importance[]"]`,
validate: validateArtists,
messageKey: 'client.upload.at_least_one_director',
})
addValidator({
selector: `[name="subtitles[]"], [name=subtitle_type]`,
validate: validateSubtitle,
messageKey: 'client.upload.subtitles_required',
})
addValidator({
selector: `[name="subtitles[]"], [name=subtitle_type]`,
validate: validateSubtitleWithMediainfo,
messageKey: 'client.upload.subtitles_with_mediainfo',
})
addValidator({
selector: `[name="file_input"]`,
validate: validateRequired,
messageKey: 'client.upload.torrent_file_required',
})
addValidator({
selector: `[name="tags"]`,
validate: validateRequired,
messageKey: 'client.upload.tag_required',
})
addValidator({
selector: `[name="imdb"]`,
validate: validateImdb,
messageKey: 'client.upload.imdb_link_required',
})
addValidator({
selector: `[name="title"]`,
validate: validateRequired,
messageKey: 'client.upload.movie_title_required',
})
addValidator({
selector: `[name="year"]`,
validate: validateRequired,
messageKey: 'client.upload.year_required',
})
addValidator({
selector: `[name="image"]`,
validate: validateRequired,
messageKey: 'client.upload.poster_required',
})
addValidator({
selector: `[name="desc"], [name="maindesc"]`,
validate: validateDesc,
messageKey: 'client.upload.movie_desc_required',
})
addValidator({
selector: `[name="file_input"]`,
validate: validateRequired,
messageKey: 'client.upload.torrent_file_required',
})
addValidator({
selector: `[name="tags"]`,
validate: validateRequired,
messageKey: 'client.upload.tag_required',
})
addValidator({
selector: `[name="imdb"]`,
validate: validateImdb,
messageKey: 'client.upload.imdb_link_required',
})
addValidator({
selector: `[name="title"]`,
validate: validateRequired,
messageKey: 'client.upload.movie_title_required',
})
addValidator({
selector: `[name="year"]`,
validate: validateRequired,
messageKey: 'client.upload.year_required',
})
addValidator({
selector: `[name="image"]`,
validate: validateRequired,
messageKey: 'client.upload.poster_required',
})
addValidator({
selector: `[name="desc"], [name="maindesc"]`,
validate: validateDesc,
messageKey: 'client.upload.movie_desc_required',
})
addValidator({
selector: `[name="mediainfo[]"]`,
validate: validateMediainfoRequired,
messageKey: 'client.upload.mediainfo_required',
})
addValidator({
selector: `[name="mediainfo[]"]`,
validate: wrap(Videoinfo.validateCompleteNameRequired),
messageKey: 'client.upload.mediainfo_complete_name_required',
})
addValidator({
selector: `[name="mediainfo[]"]`,
validate: wrap(Videoinfo.validateTableSpace),
messageKey: 'client.upload.mediainfo_table_space',
})
addValidator({
selector: `[name="mediainfo[]"]`,
validate: validateMediainfoRequired,
messageKey: 'client.upload.mediainfo_required',
})
addValidator({
selector: `[name="mediainfo[]"]`,
validate: wrap(Videoinfo.validateCompleteNameRequired),
messageKey: 'client.upload.mediainfo_complete_name_required',
})
addValidator({
selector: `[name="mediainfo[]"]`,
validate: wrap(Videoinfo.validateTableSpace),
messageKey: 'client.upload.mediainfo_table_space',
})
addValidator({
selector: `[name="mediainfo[]"]`,
validate: wrap(Videoinfo.validateMediaInfo),
messageKey: 'client.upload.mediainfo_valid_format',
})
addValidator({
selector: `[name="mediainfo[]"]`,
validate: wrap(Videoinfo.validateMediaInfo),
messageKey: 'client.upload.mediainfo_valid_format',
})
addValidator({
selector: `[name="release_desc"]`,
validate: validateDescImg3Png,
messageKey: 'client.upload.desc_img_3_png',
})
addValidator({
selector: `[name="release_desc"]`,
validate: validateDescImgHosts,
messageKey: 'client.upload.desc_img_hosts',
})
addValidator({
selector: `[name="release_desc"]`,
validate: validateDescImg3Png,
messageKey: 'client.upload.desc_img_3_png',
})
addValidator({
selector: `[name="release_desc"]`,
validate: validateDescImgHosts,
messageKey: 'client.upload.desc_img_hosts',
})
addValidatorSelectInput({
selector: `[name="codec"]`,
validate: validateSelectInputRequired,
messageKey: 'client.upload.codec_required',
})
addValidatorSelectInput({
selector: `[name="container"]`,
validate: validateSelectInputRequired,
messageKey: 'client.upload.container_required',
})
addValidatorSelectInput({
selector: `[name="resolution"]`,
validate: validateSelectInputRequired,
messageKey: 'client.upload.resolution_required',
})
addValidator({
selector: '[name=movie_edition_information], [name=remaster_title_show], [name=remaster_custom_title]',
validate: validateRemaster,
messageKey: 'client.upload.remaster_required',
})
addValidatorSelectInput({
selector: `[name="codec"]`,
validate: validateSelectInputRequired,
messageKey: 'client.upload.codec_required',
})
addValidatorSelectInput({
selector: `[name="container"]`,
validate: validateSelectInputRequired,
messageKey: 'client.upload.container_required',
})
addValidatorSelectInput({
selector: `[name="resolution"]`,
validate: validateSelectInputRequired,
messageKey: 'client.upload.resolution_required',
})
addValidator({
selector: '[name=movie_edition_information], [name=remaster_title_show], [name=remaster_custom_title]',
validate: validateRemaster,
messageKey: 'client.upload.remaster_required',
})
}
function validateRequired(value) {
if (this.type === 'radio' || this.type === 'checkbox') {
return this.pristine.self.form.querySelectorAll('input[name="' + this.getAttribute('name') + '"]:checked').length
} else {
return Boolean(value)
}
if (this.type === 'radio' || this.type === 'checkbox') {
return this.pristine.self.form.querySelectorAll('input[name="' + this.getAttribute('name') + '"]:checked').length
} else {
return Boolean(value)
}
}
function validateSelectInputRequired({ select, inputs }) {
if (SELECT_REQUIRED.includes(select.value) && !select.disabled) {
return false
} else if (
SELECT_HAS_OTHER_INPUT.includes(select.value) &&
// input.disabled无效: 因为设置disabled和validate同时发生
!inputs.every((v) => Boolean(v.value))
) {
return false
} else {
return true
}
if (SELECT_REQUIRED.includes(select.value) && !select.disabled) {
return false
} else if (
SELECT_HAS_OTHER_INPUT.includes(select.value) &&
// input.disabled无效: 因为设置disabled和validate同时发生
!inputs.every((v) => Boolean(v.value))
) {
return false
} else {
return true
}
}
function validateDesc() {
const desc = document.querySelector('[name=desc]').value
const mainDesc = document.querySelector('[name=maindesc]').value
if (desc || mainDesc) {
return true
}
return false
const desc = document.querySelector('[name=desc]').value
const mainDesc = document.querySelector('[name=maindesc]').value
if (desc || mainDesc) {
return true
}
return false
}
function validateProcessing({ select, inputs }) {
const source = document.querySelector('[name=source]').value
const source = document.querySelector('[name=source]').value
if (SOURCE_HAS_NO_PROCESSING.includes(source)) {
return true
}
if (SOURCE_HAS_NO_PROCESSING.includes(source)) {
return true
}
if (SELECT_REQUIRED.includes(select.value) && !select.disabled) {
return false
} else if (
[...DVD, ...BD].includes(source) &&
['Untouched'].includes(select.value) &&
!inputs.every((v) => Boolean(v.value))
) {
return false
} else {
return true
}
if (SELECT_REQUIRED.includes(select.value) && !select.disabled) {
return false
} else if (
[...DVD, ...BD].includes(source) &&
['Untouched'].includes(select.value) &&
!inputs.every((v) => Boolean(v.value))
) {
return false
} else {
return true
}
}
export function validateMediainfoRequired(value) {
return Boolean(value)
return Boolean(value)
}
function wrap(validate) {
return function wrapValidate(value) {
if (!value) {
return true
}
return validate(value)
return function wrapValidate(value) {
if (!value) {
return true
}
return validate(value)
}
}
export function validateDescImg3Png(value) {
if (!value) {
return false
}
const matches = value.match(/\[img=.*?png\s*]|\[img\].*?png\s*\[\/img\]/gi)
if (!matches) {
return false
}
return matches.length >= 3
if (!value) {
return false
}
const matches = value.match(/\[img=.*?png\s*]|\[img\].*?png\s*\[\/img\]/gi)
if (!matches) {
return false
}
return matches.length >= 3
}
export function validateDescImgHosts(value) {
if (!value) {
return true
if (!value) {
return true
}
const matches = [...value.matchAll(/(\[img=(.*?)]|\[img\](.*?)\[\/img\])/gi)]
const pattern = `(${IMAGE_HOSTS.join('|')})/`
let count = 0
if (matches) {
for (const match of matches) {
const img = match[2] || match[3]
if (img.match(pattern)) {
count++
}
}
const matches = [...value.matchAll(/(\[img=(.*?)]|\[img\](.*?)\[\/img\])/gi)]
const pattern = `(${IMAGE_HOSTS.join('|')})/`
let count = 0
if (matches) {
for (const match of matches) {
const img = match[2] || match[3]
if (img.match(pattern)) {
count++
}
}
}
return count >= 3
}
return count >= 3
}
export function validateDescComparison(value) {
if (!value) {
return true
}
const matches = [...value.matchAll(/\[comparison.*?\]([\s\S]*?)\[\/comparison\]/gi)]
const pattern = `(${IMAGE_HOSTS.join('|')}).*?png`
if (matches) {
for (const match of matches) {
const lines = match[1]
.replace(/\n\r/, '\n')
.split(/\n/)
.map((v) => v.trim())
.filter((v) => v.length > 0)
console.log('validate desc comparison', { lines })
const isOk = lines.every((line) => line.match(pattern))
if (!isOk) {
return false
}
}
}
if (!value) {
return true
}
const matches = [...value.matchAll(/\[comparison.*?\]([\s\S]*?)\[\/comparison\]/gi)]
const pattern = `(${IMAGE_HOSTS.join('|')}).*?png`
if (matches) {
for (const match of matches) {
const lines = match[1]
.replace(/\n\r/, '\n')
.split(/\n/)
.map((v) => v.trim())
.filter((v) => v.length > 0)
console.log('validate desc comparison', { lines })
const isOk = lines.every((line) => line.match(pattern))
if (!isOk) {
return false
}
}
}
return true
}
function validateImdb(value) {
if ((value && value.match(IMDB_ID_PATTERN)) || $('[name=no_imdb_link]').prop('checked')) {
return true
} else {
return false
}
if ((value && value.match(IMDB_ID_PATTERN)) || $('[name=no_imdb_link]').prop('checked')) {
return true
} else {
return false
}
}
function validateRemaster() {
const notMainMovie = $('[name=not_main_movie]').prop('checked')
const remasterTitleShow = $('[name=remaster_title_show]').val()
const remasterCustomTitle = $('[name=remaster_custom_title]').val()
if (notMainMovie && !(remasterTitleShow.match(/额外内容/) || remasterCustomTitle)) {
return false
}
return true
const notMainMovie = $('[name=not_main_movie]').prop('checked')
const remasterTitleShow = $('[name=remaster_title_show]').val()
const remasterCustomTitle = $('[name=remaster_custom_title]').val()
if (notMainMovie && !(remasterTitleShow.match(/额外内容/) || remasterCustomTitle)) {
return false
}
return true
}
function createValidator({ validator }) {
const form = validator.form
return {
addValidator({ selector, validate, messageKey }) {
const inputs = Array.from(form.querySelectorAll(selector))
const message = t(messageKey)
for (const input of inputs) {
validator.addValidator(input, validate, message)
}
},
const form = validator.form
return {
addValidator({ selector, validate, messageKey }) {
const inputs = Array.from(form.querySelectorAll(selector))
const message = t(messageKey)
for (const input of inputs) {
validator.addValidator(input, validate, message)
}
},
addValidatorSelectInput({ selector, validate, messageKey }) {
const message = t(messageKey)
const select = form.querySelector(selector)
if (!select) {
return
}
let inputs = []
const nextEl = select.nextElementSibling
if (nextEl) {
inputs = ['INPUT', 'SELECT'].includes(nextEl.tagName) ? [nextEl] : Array.from(nextEl.querySelectorAll('input'))
}
for (const elem of [select, ...inputs]) {
validator.addValidator(elem, () => validate({ select, inputs }), message)
}
},
}
addValidatorSelectInput({ selector, validate, messageKey }) {
const message = t(messageKey)
const select = form.querySelector(selector)
if (!select) {
return
}
let inputs = []
const nextEl = select.nextElementSibling
if (nextEl) {
inputs = ['INPUT', 'SELECT'].includes(nextEl.tagName) ? [nextEl] : Array.from(nextEl.querySelectorAll('input'))
}
for (const elem of [select, ...inputs]) {
validator.addValidator(elem, () => validate({ select, inputs }), message)
}
},
}
}
export function handleSourceAndProcessing() {
const validator = document.querySelector('.FormValidation').validator
const source = document.querySelector('[name=source]')
const processing = document.querySelector('[name=processing]')
const processingContainer = document.querySelector('#processing-container')
const processingOther = document.querySelector('[name=processing_other]')
const validator = document.querySelector('.FormValidation').validator
const source = document.querySelector('[name=source]')
const processing = document.querySelector('[name=processing]')
const processingContainer = document.querySelector('#processing-container')
const processingOther = document.querySelector('[name=processing_other]')
function handle() {
if (SOURCE_HAS_NO_PROCESSING.includes(source.value)) {
processing.value = ''
processingContainer.classList.add('hidden')
} else {
processingContainer.classList.remove('hidden')
}
// processing other
if (processing.value === 'Untouched' && [...DVD, ...BD].includes(source.value)) {
processingOther.disabled = false
processingOther.classList.remove('hidden')
const showSelector = BD.includes(source.value) ? '.bd' : '.dvd'
const hideSelector = BD.includes(source.value) ? '.dvd' : '.bd'
for (const show of processingOther.querySelectorAll(showSelector)) {
show.classList.remove('hidden')
}
for (const hide of processingOther.querySelectorAll(hideSelector)) {
hide.classList.add('hidden')
}
} else {
processingOther.classList.add('hidden')
processingOther.value = ''
processingOther.disabled = true // for validation
}
function handle() {
if (SOURCE_HAS_NO_PROCESSING.includes(source.value)) {
processing.value = ''
processingContainer.classList.add('hidden')
} else {
processingContainer.classList.remove('hidden')
}
// for ?
// handle()
// processing other
if (processing.value === 'Untouched' && [...DVD, ...BD].includes(source.value)) {
processingOther.disabled = false
processingOther.classList.remove('hidden')
const showSelector = BD.includes(source.value) ? '.bd' : '.dvd'
const hideSelector = BD.includes(source.value) ? '.dvd' : '.bd'
for (const show of processingOther.querySelectorAll(showSelector)) {
show.classList.remove('hidden')
}
for (const hide of processingOther.querySelectorAll(hideSelector)) {
hide.classList.add('hidden')
}
} else {
processingOther.classList.add('hidden')
processingOther.value = ''
processingOther.disabled = true // for validation
}
}
source.addEventListener('change', (e) => {
handle()
validator.validate(processing)
})
// for ?
// handle()
processing.addEventListener('change', (e) => {
handle()
validator.validate(source)
})
source.addEventListener('change', (e) => {
handle()
validator.validate(processing)
})
processing.addEventListener('change', (e) => {
handle()
validator.validate(source)
})
}
function handleResolution() {
document.querySelector(`[name=resolution]`).addEventListener('change', () => {
document.querySelector(`[name=resolution_width]`).value = ''
document.querySelector(`[name=resolution_height]`).value = ''
})
document.querySelector(`[name=resolution]`).addEventListener('change', () => {
document.querySelector(`[name=resolution_width]`).value = ''
document.querySelector(`[name=resolution_height]`).value = ''
})
}
function handleSubtitle() {
for (const el of document.querySelectorAll(`[name=subtitle_type]`)) {
el.addEventListener('change', (e) => {
const value = e.target.getAttribute('data-value')
const disabled = value === 'no-sub'
if (disabled) {
$('#other_subtitles').addClass('hidden')
} else {
$('#other_subtitles').removeClass('hidden')
}
for (const sub of document.querySelectorAll(`[name="subtitles[]"]`)) {
sub.disabled = disabled
if (disabled) {
sub.checked = false
}
}
})
}
for (const el of document.querySelectorAll(`[name=subtitle_type]`)) {
el.addEventListener('change', (e) => {
const value = e.target.getAttribute('data-value')
const disabled = value === 'no-sub'
if (disabled) {
$('#other_subtitles').addClass('hidden')
} else {
$('#other_subtitles').removeClass('hidden')
}
for (const sub of document.querySelectorAll(`[name="subtitles[]"]`)) {
sub.disabled = disabled
if (disabled) {
sub.checked = false
}
}
})
}
}
function validateSubtitle() {
const form = this.pristine.self.form
const subtitleType = Array.from(form.querySelectorAll(`[name="subtitle_type"]:checked`))[0]
if (!subtitleType) {
return false
const form = this.pristine.self.form
const subtitleType = Array.from(form.querySelectorAll(`[name="subtitle_type"]:checked`))[0]
if (!subtitleType) {
return false
}
const type = subtitleType.getAttribute('data-value')
if (type !== 'no-sub') {
if (Array.from(form.querySelectorAll(`[name="subtitles[]"]:checked`)).length === 0) {
return false
}
const type = subtitleType.getAttribute('data-value')
if (type !== 'no-sub') {
if (Array.from(form.querySelectorAll(`[name="subtitles[]"]:checked`)).length === 0) {
return false
}
}
return true
}
return true
}
function validateArtists() {
const artist_ids = document.querySelectorAll('[name="artist_ids[]"]')
const artists = document.querySelectorAll('[name="artists[]"]')
const importances = document.querySelectorAll('[name="importance[]"]')
let hasDirector = false
for (var i = 0; i < artist_ids.length; i++) {
if (importances[i].value == 1 && (artist_ids[i].value || artists[i].value)) {
hasDirector = true
}
}
if (hasDirector) {
return true
const artist_ids = document.querySelectorAll('[name="artist_ids[]"]')
const artists = document.querySelectorAll('[name="artists[]"]')
const importances = document.querySelectorAll('[name="importance[]"]')
let hasDirector = false
for (var i = 0; i < artist_ids.length; i++) {
if (importances[i].value == 1 && (artist_ids[i].value || artists[i].value)) {
hasDirector = true
}
}
if (hasDirector) {
return true
}
return false
return false
}
function validateSubtitleWithMediainfo() {
const checkedSubtitles = Array.from(document.querySelectorAll(`[name="subtitles[]"]:checked`))
if (checkedSubtitles.length > 0) {
return true
}
const mediainfo = document.querySelector('[name="mediainfo[]"]').value
if (!mediainfo) {
return true
}
const info = Videoinfo.convertBBCode(mediainfo)
if (!info) {
return true
}
if (info.subtitles.length > 0) {
return false
}
const checkedSubtitles = Array.from(document.querySelectorAll(`[name="subtitles[]"]:checked`))
if (checkedSubtitles.length > 0) {
return true
}
const mediainfo = document.querySelector('[name="mediainfo[]"]').value
if (!mediainfo) {
return true
}
const info = Videoinfo.convertBBCode(mediainfo)
if (!info) {
return true
}
if (info.subtitles.length > 0) {
return false
}
return true
}
/*
@@ -475,24 +475,24 @@ function validateSubtitleWithMediainfo() {
* </div>
*/
export function handleSelectInput({ watch, apply }) {
function toggleVisible(select, other) {
if (SELECT_HAS_OTHER_INPUT.includes(select.value)) {
other.classList.remove('hidden')
other.disabled = false // for validation
} else {
other.classList.add('hidden')
other.disabled = true
}
function toggleVisible(select, other) {
if (SELECT_HAS_OTHER_INPUT.includes(select.value)) {
other.classList.remove('hidden')
other.disabled = false // for validation
} else if (other != null) {
other.classList.add('hidden')
other.disabled = true
}
}
for (const selectInput of Array.from(document.querySelectorAll('.SelectInput'))) {
const select = selectInput.querySelector('select')
const input = select.nextElementSibling
if (watch) {
select.addEventListener('change', (e) => toggleVisible(select, input))
}
if (apply) {
toggleVisible(select, input)
}
for (const selectInput of Array.from(document.querySelectorAll('.SelectInput'))) {
const select = selectInput.querySelector('select')
const input = select.nextElementSibling
if (watch) {
select.addEventListener('change', (e) => toggleVisible(select, input))
}
if (apply) {
toggleVisible(select, input)
}
}
}

View File

@@ -5029,6 +5029,18 @@ server.torrents.additional_slots: |-
Additional slots
server.torrents.advanced: |-
Advanced
server.torrents.advanced_video_feature: |-
Advanced video feature
server.torrents.advanced_audio_feature: |-
Advanced audio feature
server.editioninfo.51_surround: |-
5.1 surround
server.editioninfo.71_surround: |-
7.1 surround
server.torrents.release_group: |-
Release group
server.user.member_of_group: |-
A member of %s
server.torrents.album_votes: |-
Album Votes
server.torrents.all: |-

View File

@@ -4948,6 +4948,18 @@ server.torrents.additional_slots: |-
额外的特许槽位
server.torrents.advanced: |-
高级
server.torrents.advanced_video_feature: |-
高级视频特性
server.torrents.advanced_audio_feature: |-
高级音频特性
server.editioninfo.51_surround: |-
5.1 声道
server.editioninfo.71_surround: |-
7.1 声道
server.torrents.release_group: |-
制作组
server.user.member_of_group: |-
%s 小组的一员
server.torrents.album_votes: |-
影片投票
server.torrents.all: |-