Empty commit

This commit is contained in:
Git 2013-04-18 08:00:54 +00:00
parent fec9c0ca19
commit 792f5077cb
29 changed files with 1714 additions and 1200 deletions

View File

@ -21,20 +21,20 @@ public static function get_artists($GroupIDs) {
global $Cache, $DB;
$Results = array();
$DBs = array();
foreach($GroupIDs as $GroupID) {
if(!is_number($GroupID)) {
foreach ($GroupIDs as $GroupID) {
if (!is_number($GroupID)) {
continue;
}
$Artists = $Cache->get_value('groups_artists_'.$GroupID);
if(is_array($Artists)) {
if (is_array($Artists)) {
$Results[$GroupID] = $Artists;
} else {
$DBs[] = $GroupID;
}
}
if(count($DBs) > 0) {
if (count($DBs) > 0) {
$IDs = implode(',', $DBs);
if(empty($IDs)) {
if (empty($IDs)) {
$IDs = "null";
}
$DB->query("SELECT ta.GroupID,
@ -48,12 +48,12 @@ public static function get_artists($GroupIDs) {
ORDER BY ta.GroupID ASC,
ta.Importance ASC,
aa.Name ASC;");
while(list($GroupID,$ArtistID,$ArtistName,$ArtistImportance,$AliasID) = $DB->next_record(MYSQLI_BOTH, false)) {
while (list($GroupID,$ArtistID,$ArtistName,$ArtistImportance,$AliasID) = $DB->next_record(MYSQLI_BOTH, false)) {
$Results[$GroupID][$ArtistImportance][] = array('id' => $ArtistID, 'name' => $ArtistName, 'aliasid' => $AliasID);
$New[$GroupID][$ArtistImportance][] = array('id' => $ArtistID, 'name' => $ArtistName, 'aliasid' => $AliasID);
}
foreach($DBs as $GroupID) {
if(isset($New[$GroupID])) {
foreach ($DBs as $GroupID) {
if (isset($New[$GroupID])) {
$Cache->cache_value('groups_artists_'.$GroupID, $New[$GroupID]);
}
else {
@ -61,7 +61,7 @@ public static function get_artists($GroupIDs) {
}
}
$Missing = array_diff($GroupIDs, array_keys($Results));
if(!empty($Missing)) {
if (!empty($Missing)) {
$Results += array_fill_keys($Missing, array());
}
}
@ -91,7 +91,7 @@ public static function get_artist($GroupID) {
* @param $Escape if true, output will be escaped. Think carefully before setting it false.
*/
public static function display_artists($Artists, $MakeLink = true, $IncludeHyphen = true, $Escape = true) {
if(!empty($Artists)) {
if (!empty($Artists)) {
$ampersand = ($Escape) ? ' & ' : ' & ';
$link = '';
@ -105,7 +105,7 @@ public static function display_artists($Artists, $MakeLink = true, $IncludeHyphe
return '';
}
// Various Composers is not needed and is ugly and should die
switch(count($Composers)) {
switch (count($Composers)) {
case 0:
break;
case 1:
@ -122,7 +122,7 @@ public static function display_artists($Artists, $MakeLink = true, $IncludeHyphe
$ComposerStr = $link;
switch(count($MainArtists)) {
switch (count($MainArtists)) {
case 0:
break;
case 1:
@ -135,8 +135,8 @@ public static function display_artists($Artists, $MakeLink = true, $IncludeHyphe
$link .= 'Various Artists';
}
/*if(!empty($Guests) && (count($MainArtists) + count($Composers) > 0) && (count($MainArtists) + count($Composers) + count($Conductors) < 3)) {
switch(count($Guests)) {
/*if (!empty($Guests) && (count($MainArtists) + count($Composers) > 0) && (count($MainArtists) + count($Composers) + count($Conductors) < 3)) {
switch (count($Guests)) {
case 1:
$link .= ' with '.Artists::display_artist($Guests[0], $MakeLink, $Escape);
break;
@ -149,7 +149,7 @@ public static function display_artists($Artists, $MakeLink = true, $IncludeHyphe
if ((count($Conductors) > 0) && (count($MainArtists) + count($Composers) > 0) && (count($Composers) < 3 || count($MainArtists) > 0)) {
$link .= ' under ';
}
switch(count($Conductors)) {
switch (count($Conductors)) {
case 0:
break;
case 1:
@ -169,7 +169,7 @@ public static function display_artists($Artists, $MakeLink = true, $IncludeHyphe
}
// DJs override everything else
switch(count($DJs)) {
switch (count($DJs)) {
case 0:
break;
case 1:
@ -246,7 +246,7 @@ public static function delete_artist($ArtistID) {
$Cache->delete_value('artist_groups_'.$ArtistID);
// Record in log
if(!empty($LoggedUser['Username'])) {
if (!empty($LoggedUser['Username'])) {
$Username = $LoggedUser['Username'];
} else {
$Username = 'System';

View File

@ -21,12 +21,12 @@ class Format {
'freeleech' => 'tl_free',
'neutral leech' => 'tl_free tl_neutral',
'personal freeleech' => 'tl_free tl_personal',
'personal freeleech'=> 'tl_free tl_personal',
'reported' => 'tl_reported',
'bad tags' => 'tl_reported tl_bad_tags',
'bad folders' => 'tl_reported tl_bad_folders',
'bad file names' => 'tl_reported tl_bad_file_names',
'bad file names'=> 'tl_reported tl_bad_file_names',
'cassette approved' => 'tl_approved tl_cassete',
'lossy master approved' => 'tl_approved tl_lossy_master',

View File

@ -222,14 +222,14 @@ function contains($Substring, $String) {
/**
* Checks if URL points to a whatimg thumbnail.
*/
function has_whatimg_thumb($Url){
function has_whatimg_thumb($Url) {
return contains("_thumb", $Url);
}
/**
* Cleans up imgur URL if it already has a modifier attached to the end of it.
*/
function clean_imgur_url($Url){
function clean_imgur_url($Url) {
$Extension = pathinfo($Url, PATHINFO_EXTENSION);
$Full = preg_replace('/\.[^.]*$/', '', $Url);
$Base = substr($Full, 0, strrpos($Full, '/'));
@ -240,5 +240,5 @@ function clean_imgur_url($Url){
$Path = substr($Path, 0, -1);
}
}
return $Base . "/" . $Path . "." . $Extension;
return $Base . '/' . $Path . '.' . $Extension;
}

View File

@ -93,7 +93,7 @@ public static function send_pm($ToID,$FromID,$Subject,$Body,$ConvID='') {
$DB->query("SELECT Username FROM users_main WHERE ID = '$FromID'");
list($SenderName) = $DB->next_record();
foreach($ToID as $ID) {
foreach ($ToID as $ID) {
$DB->query("SELECT COUNT(ConvID) FROM pm_conversations_users WHERE UnRead = '1' and UserID='$ID' AND InInbox = '1'");
list($UnRead) = $DB->next_record();
$Cache->cache_value('inbox_new_'.$ID, $UnRead);
@ -396,7 +396,7 @@ public static function sanitize_tag($Str) {
*/
public static function display_array($Array, $Escape = array()) {
foreach ($Array as $Key => $Val) {
if((!is_array($Escape) && $Escape == true) || !in_array($Key, $Escape)) {
if ((!is_array($Escape) && $Escape == true) || !in_array($Key, $Escape)) {
$Array[$Key] = display_str($Val);
}
}
@ -416,19 +416,20 @@ public static function is_new_torrent(&$Data) {
public static function display_recommend($ID, $Type, $Hide = true) {
global $DB, $LoggedUser;
if($Hide) {
if ($Hide) {
$Hide = 'style="display: none;"';
}
?>
<div id="recommendation_div" data-id="<?=$ID?>" data-type="<?=$Type?>" <?=$Hide?> class="center">
<div style="display: inline-block;" >
<strong>Recommend to: </strong><select id="friend" name="friend">
<option value="0" selected="selected">Choose Friend</option>
<div style="display: inline-block;">
<strong>Recommend to:</strong>
<select id="friend" name="friend">
<option value="0" selected="selected">Choose friend</option>
</select>
<input type="text" id="recommendation_note" placeholder="Add note..."/>
<button id="send_recommendation" disabled>Send</button>
<input type="text" id="recommendation_note" placeholder="Add note..." />
<button id="send_recommendation" disabled="disabled">Send</button>
</div>
<div class="new" id="recommendation_status"><br/></div>
<div class="new" id="recommendation_status"><br /></div>
</div>
<?
}

View File

@ -54,7 +54,7 @@ class Tags
*
* @param string $TagList A string of tags separated by a space
* @param boolean $Merge Merge the tag list with the Class' tags
* Eg, compilations and soundtracks are skipped, so false
* E.g., compilations and soundtracks are skipped, so false
*/
public function __construct($TagList, $Merge = true) {
$this->Tags = array_filter(explode(' ', str_replace('_', '.', $TagList)));

View File

@ -149,7 +149,7 @@ class TEXTAREA_PREVIEW extends TEXTAREA_PREVIEW_SUPER
*
* It's important to have the right IDs as they make the JS function properly.
*/
public function __construct ($Name, $ID = '', $Value='', $Cols=50, $Rows=10,
public function __construct ($Name, $ID = '', $Value = '', $Cols = 50, $Rows = 10,
$Preview = true, $Buttons = true, $Buffer = false,
array $ExtraAttributes = array()
) {

View File

@ -53,12 +53,12 @@ public static function geoip($IP) {
} else {
$Long = Tools::ip_to_unsigned($IP);
}
if(!$Long || $Long == 2130706433) { // No need to check cc for 127.0.0.1
if (!$Long || $Long == 2130706433) { // No need to check cc for 127.0.0.1
return false;
}
global $DB;
$DB->query("SELECT EndIP,Code FROM geoip_country WHERE $Long >= StartIP ORDER BY StartIP DESC LIMIT 1");
if((!list($EndIP,$Country) = $DB->next_record()) || $EndIP < $Long) {
if ((!list($EndIP,$Country) = $DB->next_record()) || $EndIP < $Long) {
$Country = '?';
}
$IPs[$IP] = $Country;
@ -110,12 +110,12 @@ public static function get_host_by_ajax($IP) {
public static function lookup_ip($IP) {
//TODO: use the $Cache
$Output = explode(' ',shell_exec('host -W 1 '.escapeshellarg($IP)));
if(count($Output) == 1 && empty($Output[0])) {
if (count($Output) == 1 && empty($Output[0])) {
//No output at all implies the command failed
return '';
}
if(count($Output) != 5) {
if (count($Output) != 5) {
return false;
} else {
return trim($Output[4]);
@ -152,7 +152,7 @@ public static function get_country_code_by_ajax($IP) {
*/
public static function disable_users($UserIDs, $AdminComment, $BanReason = 1) {
global $Cache, $DB;
if(!is_array($UserIDs)) {
if (!is_array($UserIDs)) {
$UserIDs = array($UserIDs);
}
$DB->query("UPDATE users_info AS i JOIN users_main AS m ON m.ID=i.UserID
@ -184,9 +184,9 @@ public static function disable_users($UserIDs, $AdminComment, $BanReason = 1) {
// Remove the users from the tracker.
$DB->query("SELECT torrent_pass FROM users_main WHERE ID in (".implode(", ",$UserIDs).")");
$PassKeys = $DB->collect('torrent_pass');
$Concat = "";
foreach($PassKeys as $PassKey) {
if(strlen($Concat) > 3950) { // Ocelot's read buffer is 4 KiB and anything exceeding it is truncated
$Concat = '';
foreach ($PassKeys as $PassKey) {
if (strlen($Concat) > 3950) { // Ocelot's read buffer is 4 KiB and anything exceeding it is truncated
Tracker::update_tracker('remove_users', array('passkeys' => $Concat));
$Concat = $PassKey;
} else {
@ -209,7 +209,7 @@ public static function warn_user($UserID, $Duration, $Reason) {
$DB->query("SELECT Warned FROM users_info
WHERE UserID=".$UserID."
AND Warned <> '0000-00-00 00:00:00'");
if($DB->record_count() > 0) {
if ($DB->record_count() > 0) {
//User was already warned, appending new warning to old.
list($OldDate) = $DB->next_record();
$NewExpDate = date('Y-m-d H:i:s', strtotime($OldDate) + $Duration);

View File

@ -57,7 +57,7 @@ function checked($Checked) {
$SiteOptions = array();
}
View::show_header($Username.' > Settings','user,jquery,jquery-ui,release_sort,password_validate,validate,push_settings');
View::show_header($Username.' > Settings','user,jquery,jquery-ui,release_sort,password_validate,validate,push_settings,cssgallery');
@ -90,9 +90,19 @@ function checked($Checked) {
<? foreach ($Stylesheets as $Style) { ?>
<option value="<?=$Style['ID']?>"<? if ($Style['ID'] == $StyleID) { ?> selected="selected"<? } ?>><?=$Style['ProperName']?></option>
<? } ?>
</select>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- Or -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</select>&nbsp;&nbsp;
<a href="#" id="toggle_css_gallery" class="brackets">Show gallery</a>
&nbsp;&nbsp;&nbsp;&nbsp;- Or -&nbsp;&nbsp;&nbsp;&nbsp;
External CSS: <input type="text" size="40" name="styleurl" id="styleurl" value="<?=display_str($StyleURL)?>" />
<div id="css_gallery">
<? foreach ($Stylesheets as $Style) { ?>
<div class="preview_wrapper">
<div class="preview_overlay"></div>
<div class="preview_frame_wrapper"><iframe class="preview_frame" src="user.php?action=stylesheetgallery&amp;name=<?= $Style['Name'] ?>" width="588%" height="588%"></iframe></div>
<p class="preview_name"><input type="radio" name="stylesheet_gallery" value="<?= $Style['ID'] ?>" /> <?= $Style["ProperName"] ?></p>
</div>
<? } ?>
</div>
</td>
</tr>
<? if (check_perms('site_advanced_search')) { ?>

View File

@ -14,6 +14,9 @@
}
switch ($_REQUEST['action']) {
case 'stylesheetgallery':
include('stylesheetgallery.php');
break;
case 'notify':
include('notify_edit.php');
break;

View File

@ -0,0 +1,331 @@
<?
if (!isset($_GET['name'])) {
if (!isset($Err)) {
error(404);
}
} else {
$Name = false;
foreach ($Stylesheets as $Stylesheet) {
if ($Stylesheet["Name"] === $_GET['name'])
$Name = $_GET['name'];
}
if (!$Name) {
error(404);
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Stylesheet Gallery</title>
<meta http-equiv="X-UA-Compatible" content="chrome=1;IE=edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="static/styles/global.css" rel="stylesheet" type="text/css" />
<link href="static/styles/<?= $Name ?>/style.css" title="<?= $Name ?>" rel="stylesheet" type="text/css" media="screen" />
</head>
<body id="user" style="overflow:hidden;">
<div id="wrapper">
<h1 class="hidden">Gazelle</h1>
<div id="header">
<div id="logo"><a href="#"></a></div>
<div id="userinfo">
<ul id="userinfo_username">
<li id="nav_userinfo"><a href="#" class="username">Gazelle</a></li>
<li id="nav_useredit" class="brackets"><a href="#">Edit</a></li>
<li id="nav_logout" class="brackets"><a href="#">Logout</a></li>
</ul>
<ul id="userinfo_major">
<li id="nav_upload" class="brackets"><a href="#">Upload</a></li>
<li id="nav_invite" class="brackets"><a href="#">Invite ()</a></li>
<li id="nav_donate" class="brackets"><a href="#">Donate</a></li>
</ul>
<ul id="userinfo_stats">
<li id="stats_seeding"><a href="#">Up</a>: <span class="stat" title="300.00000 MB">300.00 MB</span></li>
<li id="stats_leeching"><a href="#">Down</a>: <span class="stat" title="0.00000 B">0.00 B</span></li>
<li id="stats_ratio">Ratio: <span class="stat"><span class="r99" title="Infinite"></span></span></li>
<li id="stats_required"><a href="#">Required</a>: <span class="stat" title="0.00000">0.00</span></li>
</ul>
<ul id="userinfo_minor">
<li id="nav_inbox"><a onmousedown="Stats('inbox');" href="#">Inbox</a></li>
<li id="nav_staffinbox"><a onmousedown="Stats('staffpm');" href="#">Staff Inbox</a></li>
<li id="nav_uploaded"><a onmousedown="Stats('uploads');" href="#">Uploads</a></li>
<li id="nav_bookmarks"><a onmousedown="Stats('bookmarks');" href="#">Bookmarks</a></li>
<li id="nav_notifications" ><a onmousedown="Stats('notifications');" href="#">Notifications</a></li>
<li id="nav_subscriptions"><a onmousedown="Stats('subscriptions');" href="#">Subscriptions</a></li>
<li id="nav_comments"><a onmousedown="Stats('comments');" href="#">Comments</a></li>
<li id="nav_friends"><a onmousedown="Stats('friends');" href="#">Friends</a></li>
</ul>
</div>
<div id="menu">
<h4 class="hidden">Site Menu</h4>
<ul>
<li id="nav_index"><a href="#">Home</a></li>
<li id="nav_torrents"><a href="#">Torrents</a></li>
<li id="nav_collages"><a href="#">Collages</a></li>
<li id="nav_requests"><a href="#">Requests</a></li>
<li id="nav_forums"><a href="#">Forums</a></li>
<li id="nav_irc"><a href="#">IRC</a></li>
<li id="nav_top10"><a href="#">Top 10</a></li>
<li id="nav_rules"><a href="#">Rules</a></li>
<li id="nav_wiki"><a href="#">Wiki</a></li>
<li id="nav_staff"><a href="#">Staff</a></li>
</ul>
</div>
<div id="alerts">
<div class="alertbar blend"><a href="#">New Announcement!</a></div>
</div>
<div id="searchbars">
<ul>
<li id="searchbar_torrents">
<span class="hidden">Torrents: </span>
<form class="search_form" name="torrents" action="" method="get">
<input
id="torrentssearch"
accesskey="t"
spellcheck="false"
onfocus="if (this.value == 'Torrents') this.value='';"
onblur="if (this.value == '') this.value='Torrents';"
value="Torrents" type="text" name="searchstr" size="17"
/>
</form>
</li>
<li id="searchbar_artists">
<span class="hidden">Artist: </span>
<form class="search_form" name="artists" action="" method="get">
<script type="text/javascript" src="static/functions/autocomplete.js?v=1362029969"></script>
<input id="artistsearch" value="Artists" type="text" name="artistname" size="17"/>
<ul id="artistcomplete" style="visibility: hidden;"><li/></ul>
</form>
</li>
<li id="searchbar_requests">
<span class="hidden">Requests: </span>
<form class="search_form" name="requests" action="" method="get">
<input id="requestssearch" value="Requests" type="text" name="search" size="17"/>
</form>
</li>
<li id="searchbar_forums">
<span class="hidden">Forums: </span>
<form class="search_form" name="forums" action="" method="get">
<input value="search" type="hidden" name="action" />
<input id="forumssearch" value="Forums" type="text" name="search" size="17"/>
</form>
</li>
<li id="searchbar_log">
<span class="hidden">Log: </span>
<form class="search_form" name="log" action="" method="get">
<input id="logsearch" value="Log" type="text" name="search" size="17"/>
</form>
</li>
<li id="searchbar_users">
<span class="hidden">Users: </span>
<form class="search_form" name="users" action="" method="get">
<input type="hidden" name="action" value="search" />
<input id="userssearch" value="Users" type="text" name="search" size="20"/>
</form>
</li>
</ul>
</div>
</div>
<div id="content">
<div class="thin">
<h2>Forums</h2>
<div class="forum_list">
<h3>Site</h3>
<table class="forum_index">
<tbody>
<tr class="colhead">
<td style="width:2%;"></td>
<td style="width:25%;">Forum</td>
<td>Last post</td>
<td style="width:7%;">Topics</td>
<td style="width:7%;">Posts</td>
</tr>
<tr class="rowb">
<td title="Unread" class="unread"></td>
<td>
<h4 class="min_padding">
<a href="#">Announcements</a>
</h4>
</td>
<td>
<span class="last_topic" style="float:left;">
<a title="New Site Announcements" href="#">New Site Announcements</a>
</span>
<span title="Jump to last read" class="last_read" style="float: left;">
<a href="#"></a>
</span>
<span class="last_poster" style="float:right;">by <a href="#">Rippy</a> <span title="Aug 14 1992, 18:35" class="time">Just now</span></span>
</td>
<td>385</td>
<td>95,197</td>
</tr>
<tr class="rowa">
<td title="Read" class="read"></td>
<td>
<h4 class="min_padding">
<a href="#">What.CD</a>
</h4>
</td>
<td>
<span class="last_topic" style="float:left;">
<a title="Dear Mortals, you have violated the rule..." href="#">Dear Mortals, you have violated the rule...</a>
</span>
<span class="last_poster" style="float:right;">by <a href="#">Drone</a> <span title="Sep 9 1992, 10:55" class="time">3 mins ago</span></span>
</td>
<td>2,624</td>
<td>110,432</td>
</tr>
</tbody>
</table>
<h3>Community</h3>
<table class="forum_index">
<tbody><tr class="colhead">
<td style="width:2%;"></td>
<td style="width:25%;">Forum</td>
<td>Last post</td>
<td style="width:7%;">Topics</td>
<td style="width:7%;">Posts</td>
</tr>
<tr class="rowb">
<td title="Unread" class="unread"></td>
<td>
<h4 class="min_padding">
<a href="#">The Lounge</a>
</h4>
</td>
<td>
<span class="last_topic" style="float:left;">
<a title="Last stand against Drone?" href="#">Last stand against Drone?</a>
</span>
<span title="Jump to last read" class="last_read" style="float: left;">
<a href="#"></a>
</span>
<span class="last_poster" style="float:right;">by <a href="#">Ajax</a> <span class="time">Just now</span></span>
</td>
<td>37,531</td>
<td>1,545,089</td>
</tr>
<tr class="rowa">
<td title="Unread" class="unread"></td>
<td>
<h4 class="min_padding">
<a href="#">The Lounge +1</a>
</h4>
</td>
<td>
<span class="last_topic" style="float:left;">
<a title="No fun allowed" href="#">No fun allowed</a>
</span>
<span class="last_poster" style="float:right;">by <a href="#">Drone</a> <span class="time">10 mins ago</span></span>
</td>
<td>424</td>
<td>490,163</td>
</tr>
<tr class="rowb">
<td title="Read" class="read"></td>
<td>
<h4 class="min_padding">
<a href="#">The Library</a>
</h4>
</td>
<td>
<span class="last_topic" style="float:left;">
<a title="List of forbidden literature" href="#">List of forbidden literature</a>
</span>
<span class="last_poster" style="float:right;">by <a href="#">Drone</a> <span class="time">7 hours ago</span></span>
</td>
<td>424</td>
<td>490,163</td>
</tr>
<tr class="rowa">
<td title="Read" class="read"></td>
<td>
<h4 class="min_padding">
<a href="#">Concerts, Events & Meets</a>
</h4>
</td>
<td>
<span class="last_topic" style="float:left;">
<a title="[Region] The Void" href="#">[Region] The Void</a>
</span>
<span class="last_poster" style="float:right;">by <a href="#">Drone</a> <span class="time">25 mins ago</span></span>
</td>
<td>305</td>
<td>15,231</td>
</tr>
<tr class="rowb">
<td title="Unread" class="unread"></td>
<td>
<h4 class="min_padding">
<a href="#">Technology</a>
</h4>
</td>
<td>
<span class="last_topic" style="float:left;">
<a title="How did Drone take over the site?" href="#">How did Drone take over the site?</a>
</span>
<span title="Jump to last read" class="last_read" style="float: left;">
<a href="#"></a>
</span>
<span class="last_poster" style="float:right;">by <a href="#">Etheryte</a> <span class="time">5 mins ago</span></span>
</td>
<td>25,031</td>
<td>386,278</td>
</tr>
</tbody>
</table>
<h3>Music</h3>
<table class="forum_index">
<tbody>
<tr class="colhead">
<td style="width:2%;"></td>
<td style="width:25%;">Forum</td>
<td>Last post</td>
<td style="width:7%;">Topics</td>
<td style="width:7%;">Posts</td>
</tr>
<tr class="rowb">
<td title="Unread" class="unread"></td>
<td>
<h4 class="min_padding">
<a href="#">Music</a>
</h4>
</td>
<td>
<span class="last_topic" style="float:left;">
<a title="Where did all the non-drone threads go?" href="#">Where did all the non-drone threads go?</a>
</span>
<span title="Jump to last read" class="last_read" style="float: left;">
<a href="#"></a>
</span>
<span class="last_poster" style="float:right;">by <a href="#">Ananke</a> <span class="time">1 min ago</span></span>
</td>
<td>22,564</td>
<td>608,253</td>
</tr>
<tr class="rowa">
<td title="Unead" class="unread"></td>
<td>
<h4 class="min_padding">
<a href="#">Vanity House</a>
</h4>
</td>
<td>
<span class="last_topic" style="float:left;">
<a title="Drone - Drone [EP] (drone, noise)" href="#">Drone - Drone [EP] (drone, noise)</a>
</span>
<span class="last_poster" style="float:right;">by <a href="#">Drone</a> <span class="time">Just now</span></span>
</td>
<td>3,948</td>
<td>24,269</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</body>
</html>

View File

@ -200,37 +200,38 @@
?>
</h2>
<div class="linkbox">
<br /><br />
<?
if($ViewingOwn) {
if(($UserSubscriptions = $Cache->get_value('subscriptions_user_'.$LoggedUser['ID'])) === false) {
if ($ViewingOwn) {
if (($UserSubscriptions = $Cache->get_value('subscriptions_user_'.$LoggedUser['ID'])) === false) {
$DB->query("SELECT TopicID FROM users_subscriptions WHERE UserID = '$LoggedUser[ID]'");
$UserSubscriptions = $DB->collect(0);
$Cache->cache_value('subscriptions_user_'.$LoggedUser['ID'],$UserSubscriptions,0);
$DB->set_query_id($Posts);
}
if(!$ShowUnread){ ?>
<br /><br />
<? if($ShowGrouped) { ?>
if (!$ShowUnread) {
if ($ShowGrouped) { ?>
<a href="userhistory.php?action=posts&amp;userid=<?=$UserID?>&amp;showunread=0&amp;group=0" class="brackets">Show all posts</a>&nbsp;&nbsp;&nbsp;
<? } else { ?>
<? } else { ?>
<a href="userhistory.php?action=posts&amp;userid=<?=$UserID?>&amp;showunread=0&amp;group=1" class="brackets">Show all posts (grouped)</a>&nbsp;&nbsp;&nbsp;
<? } ?>
<? } ?>
<a href="userhistory.php?action=posts&amp;userid=<?=$UserID?>&amp;showunread=1&amp;group=1" class="brackets">Only display posts with unread replies (grouped)</a>&nbsp;&nbsp;&nbsp;
<? } else { ?>
<br /><br />
<a href="userhistory.php?action=posts&amp;userid=<?=$UserID?>&amp;showunread=0&amp;group=0" class="brackets">Show all posts</a>&nbsp;&nbsp;&nbsp;
<?
if(!$ShowGrouped) {
?><a href="userhistory.php?action=posts&amp;userid=<?=$UserID?>&amp;showunread=1&amp;group=1" class="brackets">Only display posts with unread replies (grouped)</a>&nbsp;&nbsp;&nbsp;<?
}
else {
?><a href="userhistory.php?action=posts&amp;userid=<?=$UserID?>&amp;showunread=1&amp;group=0" class="brackets">Only display posts with unread replies</a>&nbsp;&nbsp;&nbsp;<?
}
<? if (!$ShowGrouped) { ?>
<a href="userhistory.php?action=posts&amp;userid=<?=$UserID?>&amp;showunread=1&amp;group=1" class="brackets">Only display posts with unread replies (grouped)</a>&nbsp;&nbsp;&nbsp;
<? } else { ?>
<a href="userhistory.php?action=posts&amp;userid=<?=$UserID?>&amp;showunread=1&amp;group=0" class="brackets">Only display posts with unread replies</a>&nbsp;&nbsp;&nbsp;
<? }
}
?>
<a href="userhistory.php?action=subscriptions" class="brackets">Go to subscriptions</a>
<?
} else {
?>
<a href="forums.php?action=search&amp;type=body&amp;user=<?=$Username?>" class="brackets">Search</a>
<?
}
?>
</div>

View File

@ -18,13 +18,15 @@ function editOrdering() {
var elems = $('#torrents_tables table').objects;
for(i in elems) {
var elemID = elems[i].id;
if(elemID == undefined) { continue; }
if(elemID.indexOf('torrents_') == 0) {
if (elemID == undefined) {
continue;
}
if (elemID.indexOf('torrents_') == 0) {
$('#'+elemID).show();
dragObjects[elemID] = new dragObject(elemID, elemID+'_handle', startDrag, moveDrag, endDrag);
var classes = elems[i].className.split(' ');
for(var j=0; classes.length; j++) {
if(classes[j].indexOf('releases_') == 0) {
if (classes[j].indexOf('releases_') == 0) {
$('.'+classes[j].replace('_table', '')).hide();
$('.artist_editcol').show();
$('.artist_normalcol').hide();
@ -46,17 +48,23 @@ function saveOrdering() {
for(i in elems) {
var elemID = elems[i].id;
var releaseType = null;
if(elemID == undefined) { continue; }
if(elemID.indexOf('torrents_') == 0) {
if (elemID == undefined) {
continue;
}
if (elemID.indexOf('torrents_') == 0) {
var classes = elems[i].className.split(' ');
for(var j=0; classes.length; j++) {
if(classes[j] == null) { break; }
if(classes[j].indexOf('releases_') == 0) {
if (classes[j] == null) {
break;
}
if (classes[j].indexOf('releases_') == 0) {
releaseType = classes[j].split('_')[1];
}
}
}
if(releaseType != null) { releaseTypes += '"' + releaseType + '":' + ($('#releases_' + releaseType + '_defaultopen').raw().checked ? 1 : 0) + ","; }
if (releaseType != null) {
releaseTypes += '"' + releaseType + '":' + ($('#releases_' + releaseType + '_defaultopen').raw().checked ? 1 : 0) + ",";
}
}
releaseTypes = releaseTypes.substring(0, releaseTypes.length-1) + '}';
var postData = new Array();
@ -70,17 +78,23 @@ function saveOrderingCallback(response) {
//Show/hide
var releaseTypes = json.decode(response);
for(releaseType in releaseTypes) {
if(releaseTypes[releaseType] == 1) { setShow(releaseType, true); }
else { setShow(releaseType, false); }
if (releaseTypes[releaseType] == 1) {
setShow(releaseType, true);
} else {
setShow(releaseType, false);
}
}
//Ordering in linkbox
var prevOrderedLink = null;
for(releaseType in releaseTypes) {
var elem = $('#torrents_' + releaseType + '_anchorlink').raw();
if(elem == undefined) { continue; }
if(prevOrderedLink == null) { prevOrderedLink = elem; }
else {
if (elem == undefined) {
continue;
}
if (prevOrderedLink == null) {
prevOrderedLink = elem;
} else {
prevOrderedLink.parentNode.insertBefore(elem, prevOrderedLink.nextSibling);
prevOrderedLink = elem;
}
@ -90,23 +104,33 @@ function saveOrderingCallback(response) {
var elems = $('#torrents_tables table').objects;
for(i in elems) {
var elemID = elems[i].id;
if(elemID == undefined) { continue; }
if(elemID.indexOf('torrents_') == 0) {
if (elemID == undefined) {
continue;
}
if (elemID.indexOf('torrents_') == 0) {
var classes = elems[i].className.split(' ');
var empty = false;
for(var j=0; classes.length; j++) {
if(classes[j] == null) { break; }
if(classes[j].indexOf('releases_') == 0) {
if (classes[j] == null) {
break;
}
if (classes[j].indexOf('releases_') == 0) {
$('.artist_editcol').hide();
$('.artist_normalcol').show();
}
if(classes[j].indexOf('empty') == 0) { empty = true; }
if (classes[j].indexOf('empty') == 0) {
empty = true;
}
}
if (empty) {
$('#'+elemID).hide();
}
if(empty) { $('#'+elemID).hide(); }
}
}
for(i in dragObjects) { dragObjects[i].StopListening(); }
for(i in dragObjects) {
dragObjects[i].StopListening();
}
dragObjects = null;
$('#savinglayout').hide();
@ -122,30 +146,32 @@ function saveOrderingCallback(response) {
}
function setDefaultShow(id, show) {
if(id == 'all') {
if (id == 'all') {
var elems = $('#torrents_tables table').objects;
for(i in elems) {
var elemID = elems[i].id;
var releaseType = null;
if(elemID == undefined) { continue; }
if(elemID.indexOf('torrents_') == 0) {
if (elemID == undefined) {
continue;
}
if (elemID.indexOf('torrents_') == 0) {
var classes = elems[i].className.split(' ');
for(var j=0; classes.length; j++) {
if(classes[j] == null) { break; }
if(classes[j].indexOf('releases_') == 0) {
if (classes[j] == null) {
break;
}
if (classes[j].indexOf('releases_') == 0) {
releaseType = classes[j].split('_')[1];
}
}
}
setDefaultShow(releaseType, show);
}
}
else if(show) {
} else if (show) {
$('#releases_'+id+'_openlink').hide();
$('#releases_'+id+'_closedlink').show();
$('#releases_'+id+'_defaultopen').raw().checked = 'checked';
}
else {
} else {
$('#releases_'+id+'_openlink').show();
$('#releases_'+id+'_closedlink').hide();
$('#releases_'+id+'_defaultopen').raw().checked = '';
@ -153,12 +179,11 @@ function setDefaultShow(id, show) {
}
function setShow(id, show) {
if(show) {
if (show) {
$('#releases_'+id+'_viewlink').hide();
$('#releases_'+id+'_hidelink').show();
$('.releases_'+id).show();
}
else {
} else {
$('#releases_'+id+'_viewlink').show();
$('#releases_'+id+'_hidelink').hide();
$('.releases_'+id).hide();
@ -183,7 +208,7 @@ function startDrag(element) {
}
function moveDrag(element) {
if(
if (
(element.offsetTop > (dragObjectPlaceholder.offsetTop + parseInt(dragObjectPlaceholder.style.height))) ||
((element.offsetTop + parseInt(dragObjectPlaceholder.style.height)) < dragObjectPlaceholder.offsetTop)
) {
@ -192,21 +217,27 @@ function moveDrag(element) {
for(var i=0; i < elems.length; i++) {
elem = elems[i];
if(elem == element || elem.nodeName != 'TABLE') { continue; }
if (elem == element || elem.nodeName != 'TABLE') {
continue;
}
if((element.offsetTop > dragObjectPlaceholder.offsetTop) && (elem.offsetTop - element.offsetTop) > parseInt(element.style.height)) {
if ((element.offsetTop > dragObjectPlaceholder.offsetTop) && (elem.offsetTop - element.offsetTop) > parseInt(element.style.height)) {
bestItem = elem;
break;
}
else if((element.offsetTop < dragObjectPlaceholder.offsetTop) && (elem.offsetTop + parseInt(element.style.height)) > element.offsetTop) {
} else if ((element.offsetTop < dragObjectPlaceholder.offsetTop) && (elem.offsetTop + parseInt(element.style.height)) > element.offsetTop) {
bestItem = elem;
break;
}
}
if(bestItem == dragObjectPlaceholder) { return; }
if (bestItem == dragObjectPlaceholder) {
return;
}
if(bestItem != 'END') { element.parentNode.insertBefore(dragObjectPlaceholder, element.parentNode.childNodes[i]); }
else { element.parentNode.appendChild(dragObjectPlaceholder); }
if (bestItem != 'END') {
element.parentNode.insertBefore(dragObjectPlaceholder, element.parentNode.childNodes[i]);
} else {
element.parentNode.appendChild(dragObjectPlaceholder);
}
}
}
@ -223,19 +254,29 @@ function endDrag(element) {
//Slightly modified from: http://www.switchonthecode.com/tutorials/javascript-draggable-elements
function addEvent(element, eventName, callback) {
if(element.addEventListener) { element.addEventListener(eventName, callback, false); }
else if(element.attachEvent) { element.attachEvent("on" + eventName, callback); }
if (element.addEventListener) {
element.addEventListener(eventName, callback, false);
} else if (element.attachEvent) {
element.attachEvent("on" + eventName, callback);
}
}
function removeEvent(element, eventName, callback) {
if(element.removeEventListener) { element.removeEventListener(eventName, callback, false); }
else if(element.detachEvent) { element.detachEvent("on" + eventName, callback); }
if (element.removeEventListener) {
element.removeEventListener(eventName, callback, false);
} else if (element.detachEvent) {
element.detachEvent("on" + eventName, callback);
}
}
function cancelEvent(e) {
e = e ? e : window.event;
if(e.stopPropagation) { e.stopPropagation(); }
if(e.preventDefault) { e.preventDefault(); }
if (e.stopPropagation) {
e.stopPropagation();
}
if (e.preventDefault) {
e.preventDefault();
}
e.cancelBubble = true;
e.cancel = true;
e.returnValue = false;
@ -248,50 +289,75 @@ function Position(x, y) {
this.Add = function(val) {
var newPos = new Position(this.X, this.Y);
if(val != null) {
if(!isNaN(val.X)) { newPos.X += val.X; }
if(!isNaN(val.Y)) { newPos.Y += val.Y; }
if (val != null) {
if (!isNaN(val.X)) {
newPos.X += val.X;
}
if (!isNaN(val.Y)) {
newPos.Y += val.Y;
}
}
return newPos;
}
this.Subtract = function(val) {
var newPos = new Position(this.X, this.Y);
if(val != null) {
if(!isNaN(val.X)) { newPos.X -= val.X; }
if(!isNaN(val.Y)) { newPos.Y -= val.Y; }
if (val != null) {
if (!isNaN(val.X)) {
newPos.X -= val.X;
}
if (!isNaN(val.Y)) {
newPos.Y -= val.Y;
}
}
return newPos;
}
this.Check = function() {
var newPos = new Position(this.X, this.Y);
if(isNaN(newPos.X)) { newPos.X = 0; }
if(isNaN(newPos.Y)) { newPos.Y = 0; }
if (isNaN(newPos.X)) {
newPos.X = 0;
}
if (isNaN(newPos.Y)) {
newPos.Y = 0;
}
return newPos;
}
this.Apply = function(element, horizontal, vertical) {
if(!isNaN(this.X) && horizontal) { element.style.left = this.X + 'px'; }
if(!isNaN(this.Y) && vertical) { element.style.top = this.Y + 'px'; }
if (!isNaN(this.X) && horizontal) {
element.style.left = this.X + 'px';
}
if (!isNaN(this.Y) && vertical) {
element.style.top = this.Y + 'px';
}
}
}
function absoluteCursorPostion(eventObj) {
eventObj = eventObj ? eventObj : window.event;
if(isNaN(window.scrollX)) {
if (isNaN(window.scrollX)) {
return new Position(eventObj.clientX + document.documentElement.scrollLeft + document.body.scrollLeft, eventObj.clientY + document.documentElement.scrollTop + document.body.scrollTop);
} else {
return new Position(eventObj.clientX + window.scrollX, eventObj.clientY + window.scrollY);
}
else { return new Position(eventObj.clientX + window.scrollX, eventObj.clientY + window.scrollY); }
}
function dragObject(element, handlerElement, startCallback, moveCallback, endCallback) {
if(typeof(element) == "string") { element = $('#' + element).raw(); }
if(element == null) { return; }
if (typeof(element) == "string") {
element = $('#' + element).raw();
}
if (element == null) {
return;
}
if(typeof(handlerElement) == "string") { handlerElement = $('#' + handlerElement).raw(); }
if(handlerElement == null) { handlerElement = element; }
if (typeof(handlerElement) == "string") {
handlerElement = $('#' + handlerElement).raw();
}
if (handlerElement == null) {
handlerElement = element;
}
var cursorStartPos = null;
var elementStartPos = null;
@ -300,14 +366,18 @@ function dragObject(element, handlerElement, startCallback, moveCallback, endCal
var disposed = false;
function dragStart(eventObj) {
if(dragging || !listening || disposed) { return; }
if (dragging || !listening || disposed) {
return;
}
dragging = true;
cursorStartPos = absoluteCursorPostion(eventObj);
elementStartPos = new Position(parseInt(element.offsetLeft), parseInt(element.offsetTop));
elementStartPos = elementStartPos.Check();
if(startCallback != null) { startCallback(element); }
if (startCallback != null) {
startCallback(element);
}
addEvent(document, "mousemove", dragGo);
addEvent(document, "mouseup", dragStopHook);
@ -316,24 +386,32 @@ function dragObject(element, handlerElement, startCallback, moveCallback, endCal
}
function dragGo(eventObj) {
if(!dragging || disposed) { return; }
if (!dragging || disposed) {
return;
}
var newPos = absoluteCursorPostion(eventObj);
newPos = newPos.Add(elementStartPos).Subtract(cursorStartPos);
newPos.Apply(element, false, true);
if(moveCallback != null) { moveCallback(element); }
if (moveCallback != null) {
moveCallback(element);
}
return cancelEvent(eventObj);
}
function dragStop() {
if(!dragging || disposed) { return; }
if (!dragging || disposed) {
return;
}
removeEvent(document, "mousemove", dragGo);
removeEvent(document, "mouseup", dragStopHook);
cursorStartPos = null;
elementStartPos = null;
if(endCallback != null) { endCallback(element); }
if (endCallback != null) {
endCallback(element);
}
dragging = false;
}
@ -343,7 +421,9 @@ function dragObject(element, handlerElement, startCallback, moveCallback, endCal
}
this.Dispose = function() {
if(disposed) { return; }
if (disposed) {
return;
}
this.StopListening(true);
element = null;
handlerElement = null
@ -354,16 +434,22 @@ function dragObject(element, handlerElement, startCallback, moveCallback, endCal
}
this.StartListening = function() {
if(listening || disposed) { return; }
if (listening || disposed) {
return;
}
listening = true;
addEvent(handlerElement, "mousedown", dragStart);
}
this.StopListening = function(stopCurrentDragging) {
if(!listening || disposed) { return; }
if (!listening || disposed) {
return;
}
removeEvent(handlerElement, "mousedown", dragStart);
listening = false;
if(stopCurrentDragging && dragging) { dragStop(); }
if (stopCurrentDragging && dragging) {
dragStop();
}
}
}

View File

@ -4,14 +4,13 @@ var postid;
function QuoteJump(event, post) {
var button = event.button;
var hash = "#post" + post;
if(button == 0) {
if($(hash).raw() != null) {
if (button == 0) {
if ($(hash).raw() != null) {
window.location.hash = hash;
}
else {
} else {
window.open("forums.php?action=viewthread&postid="+post, '_self');
}
} else if(button == 1) {
} else if (button == 1) {
window.open("forums.php?action=viewthread&postid="+post, '_window');
}
}
@ -38,7 +37,7 @@ function Quote(post, user, link) {
function Edit_Form(post,key) {
postid = post;
//If no edit is already going underway or a previous edit was finished, make the necessary dom changes.
if(!$('#editbox' + postid).objects[0] || $('#editbox' + postid + '.hidden').objects[0]) {
if (!$('#editbox' + postid).objects[0] || $('#editbox' + postid + '.hidden').objects[0]) {
$('#reply_box').hide();
if (location.href.match(/torrents\.php/) ||
location.href.match(/artist\.php/)) {
@ -180,17 +179,19 @@ function Quick_Edit() {
function Newthread_Preview(mode) {
$('#newthreadpreviewbutton').toggle();
$('#newthreadeditbutton').toggle();
if(mode) { // Preview
if (mode) { // Preview
ajax.post("ajax.php?action=preview","newthreadform", function(response){
$('#contentpreview').raw().innerHTML = response;
});
$('#newthreadtitle').raw().innerHTML = $('#title').raw().value;
var pollanswers = $('#answer_block').raw();
if(pollanswers && pollanswers.children.length > 4) {
if (pollanswers && pollanswers.children.length > 4) {
pollanswers = pollanswers.children;
$('#pollquestion').raw().innerHTML = $('#pollquestionfield').raw().value;
for(var i=0; i<pollanswers.length; i+=2) {
if(!pollanswers[i].value) { continue; }
if (!pollanswers[i].value) {
continue;
}
var el = document.createElement('input');
el.id = 'answer_'+(i+1);
el.type = 'radio';
@ -203,7 +204,7 @@ function Newthread_Preview(mode) {
$('#pollanswers').raw().appendChild(el);
$('#pollanswers').raw().appendChild(document.createElement('br'));
}
if($('#pollanswers').raw().children.length > 4) {
if ($('#pollanswers').raw().children.length > 4) {
$('#pollpreview').show();
}
}
@ -211,7 +212,7 @@ function Newthread_Preview(mode) {
$('#pollpreview').hide();
$('#newthreadtitle').raw().innerHTML = 'New Topic';
var pollanswers = $('#pollanswers').raw();
if(pollanswers) {
if (pollanswers) {
var el = document.createElement('div');
el.id = 'pollanswers';
pollanswers.parentNode.replaceChild(el, pollanswers);

View File

@ -0,0 +1,44 @@
(function($) {
$(document).ready(function () {
// If the custom stylesheet field is empty, select the current style from the previews
if (!$('input#styleurl').val()){
$('input[name="stylesheet_gallery"][value="'+$('select#stylesheet').val()+'"]').click();
}
// If an overlay is clicked, select the right item in the dropdown and clear the custom CSS field
$('div.preview_overlay').click(function() {
var radiobutton = $(this).parent().find('input');
radiobutton.prop('checked', true);
$('select#stylesheet').val(radiobutton.attr('value'));
$('input#styleurl').val('');
})
// If the input is clicked, redirect it to the overlay click event
$('input[name="stylesheet_gallery"]').change(function() {
$(this).parent().parent().find('div.preview_overlay').click();
})
// If the dropdown is changed, select the appropriate item in gallery, clear the custom CSS field
$('select#stylesheet').change(function() {
$('input[name="stylesheet_gallery"][value="'+$(this).val()+'"]').prop('checked', true);
$('input#styleurl').val('');
})
// If the custom CSS field is changed, clear radio buttons
$('input#styleurl').keydown(function() {
$('input[name="stylesheet_gallery"]').each(function() {
$(this).prop('checked', false);
})
})
// If the input is empty, select appropriate gallery item again by the dropdown
$('input#styleurl').keyup(function() {
if (!$(this).val()){
$('select#stylesheet').change();
}
})
// Allow the CSS gallery to be expanded/contracted
$('#toggle_css_gallery').click(function (e) {
e.preventDefault();
$('#css_gallery').slideToggle(function () {
$('#toggle_css_gallery').text($(this).is(':visible') ? 'Hide gallery' : 'Show gallery');
});
});
});
})(jQuery);

View File

@ -29,16 +29,16 @@
// Attach to document as lastfm_expand links are added dynamically when fetching the data.
$(document).on('click', "#lastfm_expand", function () {
// Make hidden entries visible and remove the expand button.
if ( $(this).attr("href") == "#sharedartists" ){
if ( $(this).attr("href") == "#sharedartists" ) {
sharedArtists = sharedArtists.replace(/\ class="hidden"/g,"");
sharedArtists = sharedArtists.replace(/<li>\[<a\ href=\"#sharedartists.*\]<\/li>/,"");
} else if ( $(this).attr("href") == "#topartists" ){
} else if ( $(this).attr("href") == "#topartists" ) {
topArtists = topArtists.replace(/\ class="hidden"/g,"");
topArtists = topArtists.replace(/<li>\[<a\ href=\"#topartists.*\]<\/li>/,"");
} else if ( $(this).attr("href") == "#topalbums" ){
} else if ( $(this).attr("href") == "#topalbums" ) {
topAlbums = topAlbums.replace(/\ class="hidden"/g,"");
topAlbums = topAlbums.replace(/<li>\[<a\ href=\"#topalbums.*\]<\/li>/,"");
} else if ( $(this).attr("href") == "#toptracks" ){
} else if ( $(this).attr("href") == "#toptracks" ) {
topTracks = topTracks.replace(/\ class="hidden"/g,"");
topTracks = topTracks.replace(/<li>\[<a\ href=\"#toptracks.*\]<\/li>/,"");
}
@ -46,7 +46,7 @@
});
// Allow expanding or collapsing the Last.fm data.
$("#lastfm_expand").on('click', function () {
if(expanded == false){
if (expanded == false) {
expanded = true;
$(this).html("Show less info");
} else {
@ -58,7 +58,7 @@
// Hide the reload button until data is expanded.
$("#lastfm_reload_container").addClass("hidden");
// Allow reloading the data manually.
$.urlParam = function(name){
$.urlParam = function(name) {
var results = new RegExp('[\\?&amp;]' + name + '=([^&amp;#]*)').exec(window.location.href);
return results[1] || 0;
}
@ -99,25 +99,25 @@
html += '<li id="lastfm_loading">Loading...</li>';
div.html(html);
// If the data isn't expanded hide most of the info.
if( expanded == false ){
if ( expanded == false ) {
$("#lastfm_stats").children(":not(.lastfm_essential)").addClass("hidden");
$("#lastfm_reload_container").addClass("hidden");
} else {
$("#lastfm_reload_container").removeClass("hidden");
}
// Once all requests are completed, remove the loading message.
if(tasteometer && lastPlayedTrack && sharedArtists && topArtists && topAlbums && topTracks){
if (tasteometer && lastPlayedTrack && sharedArtists && topArtists && topAlbums && topTracks) {
$('#lastfm_loading').remove();
}
}
// Escape ampersands with url code to avoid breaking the search links
function escapeAmpUrl(input){
function escapeAmpUrl(input) {
return input.replace(/&/g,"%26");
}
// Escape ampersands with html code to avoid breaking the search links
function escapeHtml(input){
function escapeHtml(input) {
return input.replace(/&/g,"&#38;").replace(/</g,"&#60;");
}
@ -125,7 +125,7 @@
// Functions for fetching the required data are as follows.
// Also gets the data for shared artists as they're bundled.
function getTasteometer(div) {
if ($("#lastfm_stats").attr("data-uid")){
if ($("#lastfm_stats").attr("data-uid")) {
//Own profile, don't show tasteometer and shared artists.
tasteometer = " ";
sharedArtists = " ";
@ -134,12 +134,12 @@
// Two separate elements are received from one Last.fm API call.
var tasteometerHtml = "";
var sharedArtistsHtml = "";
if ( response ){
if ( response ) {
json = JSON.parse(response);
if (json != null && json['error']) {
console.log("Tasteometer: " + json['message']);
// Specified non-existant username for Last.fm, remove Last.fm box from page.
if (json['error'] == "7" ){
if (json['error'] == "7" ) {
tasteometer = " ";
sharedArtists = " ";
}
@ -157,7 +157,7 @@
compatibility = "Unknown";
tasteometerHtml += compatibility;
} else {
if (compatibility < 50){
if (compatibility < 50) {
background = 'rgb(255, '+Math.floor(255*compatibility/50)+', 0)'
} else {
background = 'rgb('+Math.floor((1-(compatibility-50)/50)*255)+', 255, 0)'
@ -171,14 +171,14 @@
</li>';
}
// Only print shared artists if there are any
if (j['artists']['matches'] != 0){
if (j['artists']['matches'] != 0) {
sharedArtistsHtml += '<li>Shared artists:</li><li><ul class="nobullet">';
var k = initialCount;
if (a.length < 3) k = a.length;
for (var i = 0; i < k; i++) {
sharedArtistsHtml += '<li><a href="artist.php?artistname=' + escapeAmpUrl(a[i]['name']) + '">' + escapeHtml(a[i]['name']) + '</a></li>'
}
if ( a.length > 3 ){
if ( a.length > 3 ) {
for (i = 3; i < a.length; i++) {
sharedArtistsHtml += '<li class="hidden"><a href="artist.php?artistname=' + escapeAmpUrl(a[i]['name']) + '">' + escapeHtml(a[i]['name']) + '</a></li>'
}
@ -206,13 +206,12 @@
function getLastPlayedTrack(div) {
$.get('user.php?action=lastfm_last_played_track&username=' + username, function (response) {
var html = "";
if ( response ){
if ( response ) {
var json = JSON.parse(response);
if (json != null && json['error']) {
console.log("Last played track: " + json['message']);
lastPlayedTrack = " ";
}
else if (json == null) {
} else if (json == null) {
// No last played track available.
// Allow removing the loading message regardless.
lastPlayedTrack = " ";
@ -234,13 +233,12 @@
function getTopArtists(div) {
$.get('user.php?action=lastfm_top_artists&username=' + username, function (response) {
var html;
if ( response ){
if ( response ) {
var json = JSON.parse(response);
if (json != null && json['error']) {
console.log("Top artists: " + json['message']);
topArtists = " ";
}
else if (json == null) {
} else if (json == null) {
console.log("Error: json == null");
topArtists = " ";
} else if ( json['topartists']['total']==0 ) {
@ -257,7 +255,7 @@
for (var i = 0; i < k; i++) {
html += '<li><a href="artist.php?artistname=' + escapeAmpUrl(j[i]['name']) + '">' + escapeHtml(j[i]['name']) + '</a></li>'
}
if ( j.length>3 ){
if ( j.length > 3 ) {
for (i = 3; i < j.length; i++) {
html += '<li class="hidden"><a href="artist.php?artistname=' + escapeAmpUrl(j[i]['name']) + '">' + escapeHtml(j[i]['name']) + '</a></li>'
}
@ -277,13 +275,12 @@
function getTopAlbums(div) {
$.get('user.php?action=lastfm_top_albums&username=' + username, function (response) {
var html;
if ( response ){
if ( response ) {
var json = JSON.parse(response);
if (json != null && json['error']) {
console.log("Top albums: " + json['message']);
topAlbums = " ";
}
else if (json == null) {
} else if (json == null) {
console.log("Error: json == null");
topAlbums = " ";
} else if ( json['topalbums']['total']==0 ) {
@ -300,7 +297,7 @@
for (var i = 0; i < k; i++) {
html += '<li><a href="artist.php?artistname=' + escapeAmpUrl(j[i]['artist']['name']) + '">' + escapeHtml(j[i]['artist']['name']) + '</a> - <a href="torrents.php?searchstr=' + escapeAmpUrl(j[i]['name']) + '">' + escapeHtml(j[i]['name']) + '</a></li>'
}
if ( j.length>3 ){
if ( j.length>3 ) {
for (i = 3; i < j.length; i++) {
html += '<li class="hidden"><a href="artist.php?artistname=' + escapeAmpUrl(j[i]['artist']['name']) + '">' + escapeHtml(j[i]['artist']['name']) + '</a> - <a href="torrents.php?searchstr=' + escapeAmpUrl(j[i]['name']) + '">' + escapeHtml(j[i]['name']) + '</a></li>'
}
@ -320,13 +317,12 @@
function getTopTracks(div) {
$.get('user.php?action=lastfm_top_tracks&username=' + username, function (response) {
var html;
if ( response ){
if ( response ) {
var json = JSON.parse(response);
if (json != null && json['error']) {
console.log("Toptracks: " + json['message']);
topTracks = " ";
}
else if (json == null) {
} else if (json == null) {
console.log("Error: json == null");
topTracks = " ";
} else if ( json['toptracks']['total']==0 ) {
@ -343,7 +339,7 @@
for (var i = 0; i < k; i++) {
html += '<li><a href="artist.php?artistname=' + escapeAmpUrl(j[i]['artist']['name']) + '">' + escapeHtml(j[i]['artist']['name']) + '</a> - <a href="torrents.php?artistname=' + escapeAmpUrl(j[i]['artist']['name']) + '&filelist=' + escapeAmpUrl(j[i]['name']) + '">' + escapeHtml(j[i]['name']) + '</a></li>'
}
if ( j.length>3 ){
if ( j.length>3 ) {
for (i = 3; i < j.length; i++) {
html += '<li class="hidden"><a href="artist.php?artistname=' + escapeAmpUrl(j[i]['artist']['name']) + '">' + escapeHtml(j[i]['artist']['name']) + '</a> - <a href="torrents.php?artistname=' + escapeAmpUrl(j[i]['artist']['name']) + '&filelist=' + escapeAmpUrl(j[i]['name']) + '">' + escapeHtml(j[i]['name']) + '</a></li>'
}

View File

@ -30,7 +30,7 @@ $(document).ready(function() {
$("#musicbrainz_button").click(function() {
var $album = $("#title").val();
var $artist = $("#artist").val();
if($artist.length > 0 || $album.length > 0) {
if ($artist.length > 0 || $album.length > 0) {
jQuery('#results1').empty();
jQuery('#results2').empty();
jQuery('#results1').show();
@ -45,13 +45,12 @@ $(document).ready(function() {
success: showReleaseGroups
});
}
else { alert("Please fill out artist and/or album fields.");}
} else { alert("Please fill out artist and/or album fields.");}
});
$("#results1").click(function(event) {
var $id = event.target.id;
if($id != "results1") {
if ($id != "results1") {
jQuery('#results1').hide();
jQuery('#results2').empty();
jQuery('#results2').show();
@ -62,11 +61,12 @@ $(document).ready(function() {
dataType: "xml",
success: showReleases
});
}
});
}
});
$("#results2").click(function(event) {
var $id = event.target.id;
if($id != "mb" && $id != "results2") {
if ($id != "mb" && $id != "results2") {
jQuery('#results2').empty();
jQuery('#results2').show();
@ -77,11 +77,11 @@ $(document).ready(function() {
success: populateForm
});
}
});
});
$("#popup_back").click(function(event) {
var $id = event.target.id;
if($id == "back" ) {
if ($id == "back" ) {
jQuery('#results2').hide();
jQuery('#results1').show();
jQuery('#popup_back').empty();
@ -90,33 +90,30 @@ $(document).ready(function() {
});
$("#remaster").click(function(event) {
if($("#remaster").attr("checked") && $searched == true) {
if ($("#remaster").attr("checked") && $searched == true) {
populateEditionsForm();
}
else if($searched == true) {
} else if ($searched == true) {
depopulateEditionsForm();
}
});
});
});
/**
* Shows the release groups
* @param xml
*/
function showReleaseGroups(xml)
{
function showReleaseGroups(xml) {
var $count = $(xml).find("release-group-list").attr("count");
if($count == 0 ) {
if ($count == 0 ) {
alert("Could not find on MusicBrainz");
}
else {
} else {
jQuery('#popup_title').text("Choose Release Group");
openPopup();
}
$(xml).find("release-group").each(function()
{
$(xml).find("release-group").each(function() {
var $title = $(this).find("title:first").text();
var $artist = $(this).find("name:first").text();
var $type = $(this).attr("type");
@ -137,11 +134,10 @@ function showReleases(xml) {
$release_type = $(xml).find("release-group").attr("type");
$release_group_id = $(xml).find("release-group").attr("id");
jQuery('#popup_title').html("Choose Release " + "<a href='https://musicbrainz.org/release-group/"
+ $release_group_id + "'target=_new>(View on MusicBrainz)</a>");
jQuery('#popup_back').html("<a href='#null' id='back'>[Go Back]</a>");
+ $release_group_id + "' target='_new' class='brackets'>View on MusicBrainz</a>");
jQuery('#popup_back').html("<a href='#null' id='back' class='brackets'>Go back</a>");
$(xml).find("release").each(function()
{
$(xml).find("release").each(function() {
var $release_id = $(this).attr("id");
var $title = $(this).find("title").text();
var $status = $(this).find("status").text();
@ -154,43 +150,47 @@ function showReleases(xml) {
$format = $(this).find("format").text();
$(this).find("track-list").each(function() {
$tracks = $(this).attr("count");
}); }); });
});
});
});
var $result = $title + " [Year: " + $year + ", Format: " + $format + ", Tracks: " + $tracks + ", Country: " + $country + "]";
$("<a href='#null'>" + $result + "</a>").attr("id", $release_id).appendTo("#results2");
$("<a href='https://musicbrainz.org/release/" + $release_id +"' target=_new> (View on MB)</a>" + "<p/>").attr("id", "mb").appendTo("#results2");
$("<a href='https://musicbrainz.org/release/" + $release_id +"' target='_new' class='brackets'>View on MusicBrainz</a>" + "<p/>").attr("id", "mb").appendTo("#results2");
});
parseTags(xml);
}
/**
/**
* Parses the tags to the gazelle conventions
* @param xml
*/
function parseTags(xml) {
function parseTags(xml) {
$tags = "";
$(xml).find("tag").each(function() {
$tag = cleanTag($(this).find("name").text());
if(isValidTag($tag)) {
if (isValidTag($tag)) {
$tags += "," + $tag;
}
});
if($tags.charAt(0) == ',') {
if ($tags.charAt(0) == ',') {
$tags = $tags.substring(1);
}
}
}
function cleanTag($t) {
function cleanTag($t) {
$t = $t.replace(/ +(?= )/g,',');
$t = $t.replace('-','.');
$t = $t.replace(' ','.');
return $t;
}
/**
}
/**
* Populates the upload form
* @param xml
*/
function populateForm(xml) {
function populateForm(xml) {
closePopup();
var $release_id = $(xml).find("release").attr("id");
@ -218,16 +218,17 @@ function showReleases(xml) {
$("#catalogue_number").val($catalog_number);
$("#tags").val($tags);
$("#releasetype").val(getReleaseType());
var $amazon_link = "";
if($asin.length > 0) {
if ($asin.length > 0) {
$amazin_link = "[url=http://amazon.com/exec/obidos/ASIN/" + $asin + "]Amazon[/url]" + "\n";
}
var $country_text = "";
if($country.length > 0) {
if ($country.length > 0) {
$country_text = "Country: " + $country + "\n";
}
var $barcode_text = "";
if($barcode.length > 0) {
if ($barcode.length > 0) {
$barcode_text = "Barcode: " + $barcode + "\n";
}
var $description = $amazon_link +
@ -236,13 +237,13 @@ function showReleases(xml) {
$barcode_text +
"Tracks: " + $track_count + "\n" + "\n" +
"Track List:" + "\n";
for (var i=0; i < $track_titles.length; i++) {
for (var i = 0; i < $track_titles.length; i++) {
$description = $description + "[#]" + $track_titles[i] + "\n";
};
$("#album_desc").val($description);
}
}
function populateEditionsForm() {
function populateEditionsForm() {
$('#remaster_true').show();
$("#record_label").val("");
$("#catalogue_number").val("");
@ -251,16 +252,16 @@ function showReleases(xml) {
$("#remaster_catalogue_number").val($catalog_number);
}
function depopulateEditionsForm() {
function depopulateEditionsForm() {
$("#record_label").val($record_label);
$("#catalogue_number").val($catalog_number);
$("#remaster_year").val("");
$("#remaster_record_label").val("");
$("#remaster_catalogue_number").val("");
}
}
function closeEditionsForm() {
if($("#remaster").attr("checked")) {
function closeEditionsForm() {
if ($("#remaster").attr("checked")) {
$('#remaster_true').hide();
}
@ -270,14 +271,15 @@ function showReleases(xml) {
$("#remaster_catalogue_number").val("");
}
/**
}
/**
* Gets the release type
* @returns value of type
*/
function getReleaseType() {
function getReleaseType() {
var $value;
switch($release_type) {
switch ($release_type) {
case "Album":
$value = 1;
break;
@ -307,29 +309,29 @@ function showReleases(xml) {
break;
}
return $value;
}
/**
}
/**
* Enables the musicbrainz button only when the "Music" type is selected and a format isn't being uploaded
*/
function enableMusicBrainzButton() {
function enableMusicBrainzButton() {
if ($('#categories').is(':disabled') == false) {
$("#categories").click(function() {
if($("#categories").val() != 0 ) {
if ($("#categories").val() != 0 ) {
$("#musicbrainz_button").attr("disabled", "disabled");
}
else {
} else {
$("#musicbrainz_button").removeAttr("disabled");
}
});
}
else {
} else {
$("#musicbrainz_button").attr("disabled", "disabled");
}
}
/**
*Clears fields in the upload form
}
/**
* Clears fields in the upload form
*/
function clear() {
function clear() {
closeEditionsForm();
$("#artist").val("");
$("#title").val("");
@ -344,13 +346,13 @@ function showReleases(xml) {
$("#remaster_catalogue_number").val("");
}
/**
/**
* Loads the popup
* @returns
*/
function openPopup(){
function openPopup() {
centerPopup();
if($popup_state==0){
if ($popup_state == 0) {
$("#popup_background").css({
"opacity": "0.7"
});
@ -358,26 +360,26 @@ function showReleases(xml) {
$("#musicbrainz_popup").fadeIn("fast");
$popup_state = 1;
}
}
}
/**
/**
* Closes the popup
* @returns
*/
function closePopup(){
if($popup_state==1){
function closePopup() {
if ($popup_state == 1) {
$("#popup_background").fadeOut("fast");
$("#musicbrainz_popup").fadeOut("fast");
jQuery('#popup_back').html("");
$popup_state = 0;
}
}
}
/**
/**
* Centers the popup on the screen
* @returns
*/
function centerPopup(){
function centerPopup() {
//TODO Center dynamically based on scroll position
var windowWidth = document.documentElement.clientWidth;
@ -395,34 +397,31 @@ function showReleases(xml) {
$("#popup_background").css({
"height": windowHeight
});
}
}
/**
/**
* Controls the popup state based on user input
* @returns
*/
function controlPopup() {
$("#popup_close").click(function(){
function controlPopup() {
$("#popup_close").click(function() {
closePopup();
});
$(document).keypress(function(e){
if(e.keyCode==27 && $popup_state==1){
$(document).keypress(function(e) {
if (e.keyCode == 27 && $popup_state == 1) {
closePopup();
}
});
}
}
function loadCSS() {
function loadCSS() {
var $link = document.createElement('link')
$link.href = 'static/styles/musicbrainz.css';
$link.rel = 'stylesheet';
$link.type = 'text/css';
document.body.appendChild($link);
$link = null;
}
}
} ) ( jQuery );

View File

@ -22,7 +22,7 @@ var password2;
$("#new_pass_1").keyup(function() {
password1 = $("#new_pass_1").val();
if(password1.length != old) {
if (password1.length != old) {
disableSubmit();
calculateComplexity(password1);
old = password1.length;
@ -34,10 +34,9 @@ $("#new_pass_1").change(function() {
password1 = $("#new_pass_1").val();
password2 = $("#new_pass_2").val();
if(password1.length == 0 && password2.length==0) {
if (password1.length == 0 && password2.length == 0) {
enableSubmit();
}
else if(getStrong() == true) {
} else if (getStrong() == true) {
validatePassword(password1);
}
@ -46,7 +45,7 @@ $("#new_pass_1").change(function() {
$("#new_pass_1").focus(function() {
password1 = $("#new_pass_1").val();
password2 = $("#new_pass_2").val();
if(password1.length > 0) {
if (password1.length > 0) {
checkMatching(password1, password2);
}
});
@ -59,7 +58,7 @@ $("#new_pass_2").keyup(function() {
$("#new_pass_1").blur(function() {
password1 = $("#new_pass_1").val();
password2 = $("#new_pass_2").val();
if(password1.length == 0 && password2.length==0) {
if (password1.length == 0 && password2.length == 0) {
enableSubmit();
}
});
@ -67,7 +66,7 @@ $("#new_pass_1").blur(function() {
});
function validatePassword(password) {
if(isUserPage()) {
if (isUserPage()) {
$.ajax({
type: 'POST',
dataType: 'text',
@ -75,7 +74,7 @@ function validatePassword(password) {
data: 'password=' + password,
async: false,
success: function(value) {
if(value == 'false') {
if (value == 'false') {
setStatus(COMMON);
}
}
@ -87,7 +86,7 @@ function calculateComplexity(password) {
var length = password.length;
var username;
if(isUserPage()) {
if (isUserPage()) {
username = $(".username").text();
}
else {
@ -96,31 +95,31 @@ function calculateComplexity(password) {
var irckey;
if(isUserPage()) {
if (isUserPage()) {
irckey = $("#irckey").val();
}
if(length >= 8) {
if (length >= 8) {
setStatus(WEAK);
}
if(length >= 8 && isStrongPassword(password)) {
if (length >= 8 && isStrongPassword(password)) {
setStatus(STRONG);
}
if(length > 0 && length < 8) {
if (length > 0 && length < 8) {
setStatus(SHORT);
}
if(length == 0) {
if (length == 0) {
setStatus(CLEAR);
}
if(isUserPage()) {
if(irckey.length > 0){
if(password.toLowerCase() == irckey.toLowerCase()) {
if (isUserPage()) {
if (irckey.length > 0){
if (password.toLowerCase() == irckey.toLowerCase()) {
setStatus(MATCH_IRCKEY);
}
}
}
if(username.length > 0) {
if(password.toLowerCase() == username.toLowerCase()) {
if (username.length > 0) {
if (password.toLowerCase() == username.toLowerCase()) {
setStatus(MATCH_USERNAME);
}
}
@ -131,21 +130,18 @@ function isStrongPassword(password) {
}
function checkMatching(password1, password2) {
if(password2.length > 0) {
if(password1 == password2 && getStrong() == true) {
if (password2.length > 0) {
if (password1 == password2 && getStrong() == true) {
$("#pass_match").text("Passwords match").css("color", "green");
enableSubmit();
}
else if(getStrong() == true) {
} else if (getStrong() == true) {
$("#pass_match").text("Passwords do not match").css("color", "red");
disableSubmit();
}
else{
} else {
$("#pass_match").text("Password isn't strong").css("color", "red");
disableSubmit();
}
}
else {
} else {
$("#pass_match").text("");
}
}
@ -155,31 +151,31 @@ function getStrong() {
}
function setStatus(strength) {
if(strength == WEAK) {
if (strength == WEAK) {
disableSubmit();
$("#pass_strength").text("Weak").css("color", "red");
}
if(strength == STRONG) {
if (strength == STRONG) {
disableSubmit();
$("#pass_strength").text("Strong").css("color", "green");
}
if(strength == SHORT) {
if (strength == SHORT) {
disableSubmit();
$("#pass_strength").text("Too Short").css("color", "red");
}
if(strength == MATCH_IRCKEY) {
if (strength == MATCH_IRCKEY) {
disableSubmit();
$("#pass_strength").text("Password cannot match IRC Key").css("color", "red");
}
if(strength == MATCH_USERNAME) {
if (strength == MATCH_USERNAME) {
disableSubmit();
$("#pass_strength").text("Password cannot match Username").css("color", "red");
}
if(strength == COMMON) {
if (strength == COMMON) {
disableSubmit();
$("#pass_strength").text("Password is too common").css("color", "red");
}
if(strength == CLEAR) {
if (strength == CLEAR) {
$("#pass_strength").text("");
}
}

View File

@ -11,18 +11,14 @@
if($(this).val() == TOASTY) {
$('#pushservice_title').text("Device ID");
}
else if($(this).val() == PUSHOVER) {
} else if($(this).val() == PUSHOVER) {
$('#pushservice_title').text("User Key");
}
else {
} else {
$('#pushservice_title').text("API Key");
}
}
else {
} else {
$('#pushsettings').hide(500);
}
});
});
}(jQuery));
}(jQuery));

View File

@ -41,8 +41,7 @@
});
$("#recommendation_note").keypress(function(e) {
state = $("#send_recommendation").attr("disabled");
if (typeof state === 'undefined' && e.keyCode == 13)
{
if (typeof state === 'undefined' && e.keyCode == 13) {
e.preventDefault();
send_recommendation();
}

View File

@ -1,15 +1,14 @@
function Vote(amount, requestid) {
if(typeof amount == 'undefined') {
if (typeof amount == 'undefined') {
amount = parseInt($('#amount').raw().value);
}
if(amount == 0) {
if (amount == 0) {
amount = 20 * 1024 * 1024;
}
var index;
var votecount;
if(!requestid) {
if (!requestid) {
requestid = $('#requestid').raw().value;
votecount = $('#votecount').raw();
index = false;
@ -24,14 +23,14 @@ function Vote(amount, requestid) {
download = $('#current_downloaded').raw().value;
rr = $('#current_rr').raw().value;
if (amount > .3*(upload - rr * download)) {
if(!confirm('This vote is more than 30% of your buffer. Please confirm that you wish to place this large a vote.')) {
if (!confirm('This vote is more than 30% of your buffer. Please confirm that you wish to place this large a vote.')) {
return false;
}
}
}
ajax.get('requests.php?action=takevote&id=' + requestid + '&auth=' + authkey + '&amount=' + amount, function (response) {
if(response == 'bankrupt') {
if (response == 'bankrupt') {
error_message("You do not have sufficient upload credit to add " + get_size(amount) + " to this request");
return;
} else if (response == 'dupesuccess') {
@ -40,7 +39,7 @@ function Vote(amount, requestid) {
votecount.innerHTML = (parseInt(votecount.innerHTML)) + 1;
}
if($('#total_bounty').results() > 0) {
if ($('#total_bounty').results() > 0) {
totalBounty = parseInt($('#total_bounty').raw().value);
totalBounty += (amount * (1 - $('#request_tax').raw().value));
$('#total_bounty').raw().value = totalBounty;
@ -58,11 +57,11 @@ function Vote(amount, requestid) {
function Calculate() {
var mul = (($('#unit').raw().options[$('#unit').raw().selectedIndex].value == 'mb') ? (1024*1024) : (1024*1024*1024));
var amt = Math.floor($('#amount_box').raw().value * mul);
if(amt > $('#current_uploaded').raw().value) {
if (amt > $('#current_uploaded').raw().value) {
$('#new_uploaded').raw().innerHTML = "You can't afford that request!";
$('#new_bounty').raw().innerHTML = "0.00 MB";
$('#button').raw().disabled = true;
} else if(isNaN($('#amount_box').raw().value)
} else if (isNaN($('#amount_box').raw().value)
|| (window.location.search.indexOf('action=new') != -1 && $('#amount_box').raw().value*mul < 100*1024*1024)
|| (window.location.search.indexOf('action=view') != -1 && $('#amount_box').raw().value*mul < 20*1024*1024)) {
$('#new_uploaded').raw().innerHTML = get_size(($('#current_uploaded').raw().value));
@ -79,7 +78,9 @@ function Calculate() {
function AddArtistField() {
var ArtistCount = document.getElementsByName("artists[]").length;
if (ArtistCount >= 200) { return; }
if (ArtistCount >= 200) {
return;
}
var ArtistField = document.createElement("input");
ArtistField.type = "text";
ArtistField.id = "artist";
@ -110,7 +111,7 @@ function RemoveArtistField() {
if (ArtistCount == 1) { return; }
var x = $('#artistfields').raw();
while(x.lastChild.tagName != "INPUT") {
while (x.lastChild.tagName != "INPUT") {
x.removeChild(x.lastChild);
}
x.removeChild(x.lastChild);
@ -120,7 +121,7 @@ function RemoveArtistField() {
function Categories() {
var cat = $('#categories').raw().options[$('#categories').raw().selectedIndex].value;
if(cat == "Music") {
if (cat == "Music") {
$('#artist_tr').show();
$('#releasetypes_tr').show();
$('#formats_tr').show();
@ -129,7 +130,7 @@ function Categories() {
ToggleLogCue();
$('#year_tr').show();
$('#cataloguenumber_tr').show();
} else if(cat == "Audiobooks" || cat == "Comedy") {
} else if (cat == "Audiobooks" || cat == "Comedy") {
$('#year_tr').show();
$('#artist_tr').hide();
$('#releasetypes_tr').hide();
@ -164,12 +165,12 @@ function Toggle(id, disable) {
var master = $('#toggle_' + id).raw().checked;
for (var x in arr) {
arr[x].checked = master;
if(disable == 1) {
if (disable == 1) {
arr[x].disabled = master;
}
}
if(id == "formats") {
if (id == "formats") {
ToggleLogCue();
}
}
@ -178,11 +179,11 @@ function ToggleLogCue() {
var formats = document.getElementsByName('formats[]');
var flac = false;
if(formats[1].checked) {
if (formats[1].checked) {
flac = true;
}
if(flac) {
if (flac) {
$('#logcue_tr').show();
} else {
$('#logcue_tr').hide();
@ -191,7 +192,7 @@ function ToggleLogCue() {
}
function ToggleLogScore() {
if($('#needlog').raw().checked) {
if ($('#needlog').raw().checked) {
$('#minlogscore_span').show();
} else {
$('#minlogscore_span').hide();

View File

@ -1,7 +1,7 @@
"use strict";
/* Prototypes */
if(!String.prototype.trim) {
if (!String.prototype.trim) {
String.prototype.trim = function () {
return this.replace(/^\s+|\s+$/g,'');
};
@ -43,7 +43,7 @@ function function_exists(function_name) {
function html_entity_decode(str) {
var el = document.createElement("div");
el.innerHTML = str;
for(var i = 0, ret = ''; i < el.childNodes.length; i++) {
for (var i = 0, ret = ''; i < el.childNodes.length; i++) {
ret += el.childNodes[i].nodeValue;
}
return ret;
@ -51,7 +51,7 @@ function html_entity_decode(str) {
function get_size(size) {
var steps = 0;
while(size>=1024) {
while (size>=1024) {
steps++;
size=size/1024;
}
@ -97,20 +97,20 @@ function get_ratio_color(ratio) {
}
function ratio(dividend, divisor, color) {
if(!color) {
if (!color) {
color = true;
}
if(divisor == 0 && dividend == 0) {
if (divisor == 0 && dividend == 0) {
return '--';
} else if(divisor == 0) {
} else if (divisor == 0) {
return '<span class="r99">∞</span>';
} else if(dividend == 0 && divisor > 0) {
} else if (dividend == 0 && divisor > 0) {
return '<span class="r00">-∞</span>';
}
var rat = ((dividend/divisor)-0.005).toFixed(2); //Subtract .005 to floor to 2 decimals
if(color) {
if (color) {
var col = get_ratio_color(rat);
if(col) {
if (col) {
rat = '<span class="'+col+'">'+rat+'</span>';
}
}
@ -165,7 +165,7 @@ var util = function (selector, context) {
util.fn = util.prototype = {
objects: new Array(),
init: function (selector, context) {
if(typeof(selector) == 'object') {
if (typeof(selector) == 'object') {
this.objects[0] = selector;
} else {
this.objects = Sizzle(selector, context);

View File

@ -1,5 +1,5 @@
function ChangeTo(to) {
if(to == "text") {
if (to == "text") {
$('#admincommentlinks').hide();
$('#admincomment').show();
resize('admincomment');
@ -7,7 +7,7 @@ function ChangeTo(to) {
for(var i = 0; i < buttons.length; i++) {
buttons[i].setAttribute('onclick',"ChangeTo('links'); return false;");
}
} else if(to == "links") {
} else if (to == "links") {
ajax.post("ajax.php?action=preview","form", function(response){
$('#admincommentlinks').raw().innerHTML = response;
$('#admincomment').hide();
@ -30,7 +30,7 @@ function AlterParanoia() {
// Required Ratio is almost deducible from downloaded, the count of seeding and the count of snatched
// we will "warn" the user by automatically checking the required ratio box when they are
// revealing that information elsewhere
if(!$('input[name=p_ratio]').raw()) {
if (!$('input[name=p_ratio]').raw()) {
return;
}
var showDownload = $('input[name=p_downloaded]').raw().checked || ($('input[name=p_uploaded]').raw().checked && $('input[name=p_ratio]').raw().checked);
@ -96,11 +96,11 @@ function ParanoiaReset(checkbox, drops) {
var selects = $('select');
for (var i = 0; i < selects.results(); i++) {
if (selects.raw(i).name.match(/^p_/)) {
if(drops == 0) {
if (drops == 0) {
selects.raw(i).selectedIndex = 0;
} else if(drops == 1) {
} else if (drops == 1) {
selects.raw(i).selectedIndex = selects.raw(i).options.length - 2;
} else if(drops == 2) {
} else if (drops == 2) {
selects.raw(i).selectedIndex = selects.raw(i).options.length - 1;
}
AlterParanoia();
@ -149,10 +149,9 @@ function ToggleWarningAdjust(selector) {
addDOMLoadEvent(ToggleIdenticons);
function ToggleIdenticons() {
var selected = $('#disableavatars').raw().selectedIndex;
if(selected == 2 || selected == 3) {
if (selected == 2 || selected == 3) {
$('#identicons').show();
}
else {
} else {
$('#identicons').hide();
}
}

View File

@ -470,3 +470,54 @@ tr.torrent .bookmark>a:after {
width: 100%;
overflow: hidden;
}
/* Stylesheet gallery in user profile editing */
#css_gallery {
display: none;
overflow: hidden;
}
.preview_wrapper{
position: relative;
display: inline-block;
width: 29%;
height: 120px;
margin: 10px;
overflow: hidden;
}
.preview_overlay {
width: 100%;
height: 80px;
position: absolute;
background: transparent;
z-index: 1;
right: 0;
left: 0;
cursor: pointer;
/* IE 8 */
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
/* IE 5-7 */
filter: alpha(opacity=0);
/* Netscape */
-moz-opacity: 0;
/* Safari 1.x */
-khtml-opacity: 0;
/* Good browsers */
opacity: 0;
}
.preview_frame_wrapper {
width: 100%;
height: 80px;
overflow: hidden;
}
.preview_frame {
-ms-zoom: 0.17;
-moz-transform: scale(0.17);
-moz-transform-origin: 0 0;
-o-transform: scale(0.17);
-o-transform-origin: 0 0;
-webkit-transform: scale(0.17);
-webkit-transform-origin: 0 0;
}
.preview_name {
text-align: center;
margin-top: 10px;
}