2011-03-28 14:21:28 +00:00
function Categories ( ) {
ajax . get ( 'ajax.php?action=upload_section&categoryid=' + $ ( '#categories' ) . raw ( ) . value , function ( response ) {
$ ( '#dynamic_form' ) . raw ( ) . innerHTML = response ;
2012-10-27 08:00:09 +00:00
// Evaluate the code that generates previews.
eval ( jQuery ( '#dynamic_form script.preview_code' ) . html ( ) ) ;
2011-03-28 14:21:28 +00:00
} ) ;
}
function Remaster ( ) {
2013-04-30 18:18:07 +00:00
if ( $ ( '#remaster' ) . raw ( ) . checked ) {
2013-06-17 08:01:02 +00:00
$ ( '#remaster_true' ) . gshow ( ) ;
2011-04-17 11:05:01 +00:00
} else {
2013-06-17 08:01:02 +00:00
$ ( '#remaster_true' ) . ghide ( ) ;
2011-04-17 11:05:01 +00:00
}
2013-02-22 08:00:24 +00:00
2011-03-28 14:21:28 +00:00
}
function Format ( ) {
2013-04-30 18:18:07 +00:00
if ( $ ( '#format' ) . raw ( ) . options [ $ ( '#format' ) . raw ( ) . selectedIndex ] . value == 'FLAC' ) {
2013-05-06 08:00:32 +00:00
for ( var i = 0 ; i < $ ( '#bitrate' ) . raw ( ) . options . length ; i ++ ) {
2013-04-30 18:18:07 +00:00
if ( $ ( '#bitrate' ) . raw ( ) . options [ i ] . value == 'Lossless' ) {
2011-03-28 14:21:28 +00:00
$ ( '#bitrate' ) . raw ( ) [ i ] . selected = true ;
}
}
2013-06-17 08:01:02 +00:00
$ ( '#upload_logs' ) . gshow ( ) ;
$ ( '#other_bitrate_span' ) . ghide ( ) ;
2011-03-28 14:21:28 +00:00
} else {
$ ( '#bitrate' ) . raw ( ) [ 0 ] . selected = true ;
2013-06-17 08:01:02 +00:00
$ ( '#upload_logs' ) . ghide ( ) ;
2011-03-28 14:21:28 +00:00
}
2012-06-25 08:00:10 +00:00
2013-04-30 18:18:07 +00:00
if ( $ ( '#format' ) . raw ( ) . options [ $ ( '#format' ) . raw ( ) . selectedIndex ] . value == 'AAC' ) {
2013-03-30 08:00:31 +00:00
$ ( '#format_warning' ) . raw ( ) . innerHTML = 'Lossy AAC torrents may only be uploaded when they represent exclusive content not currently available in any other format. <a href="rules.php?p=upload#r2.1.24">(2.1.24)</a>' ;
} else {
$ ( '#format_warning' ) . raw ( ) . innerHTML = '' ;
}
2011-03-28 14:21:28 +00:00
}
function Bitrate ( ) {
$ ( '#other_bitrate' ) . raw ( ) . value = '' ;
2013-04-30 18:18:07 +00:00
if ( $ ( '#bitrate' ) . raw ( ) . options [ $ ( '#bitrate' ) . raw ( ) . selectedIndex ] . value == 'Other' ) {
2013-06-17 08:01:02 +00:00
$ ( '#other_bitrate_span' ) . gshow ( ) ;
2011-03-28 14:21:28 +00:00
} else {
2013-06-17 08:01:02 +00:00
$ ( '#other_bitrate_span' ) . ghide ( ) ;
2011-03-28 14:21:28 +00:00
}
}
function AltBitrate ( ) {
2013-04-30 18:18:07 +00:00
if ( $ ( '#other_bitrate' ) . raw ( ) . value >= 320 ) {
2011-03-28 14:21:28 +00:00
$ ( '#vbr' ) . raw ( ) . disabled = true ;
$ ( '#vbr' ) . raw ( ) . checked = false ;
} else {
$ ( '#vbr' ) . raw ( ) . disabled = false ;
}
}
function add _tag ( ) {
2013-04-30 18:18:07 +00:00
if ( $ ( '#tags' ) . raw ( ) . value == "" ) {
2011-03-28 14:21:28 +00:00
$ ( '#tags' ) . raw ( ) . value = $ ( '#genre_tags' ) . raw ( ) . options [ $ ( '#genre_tags' ) . raw ( ) . selectedIndex ] . value ;
2013-04-30 18:18:07 +00:00
} else if ( $ ( '#genre_tags' ) . raw ( ) . options [ $ ( '#genre_tags' ) . raw ( ) . selectedIndex ] . value == '---' ) {
2011-03-28 14:21:28 +00:00
} else {
$ ( '#tags' ) . raw ( ) . value = $ ( '#tags' ) . raw ( ) . value + ', ' + $ ( '#genre_tags' ) . raw ( ) . options [ $ ( '#genre_tags' ) . raw ( ) . selectedIndex ] . value ;
}
}
var LogCount = 1 ;
function AddLogField ( ) {
2013-04-30 18:18:07 +00:00
if ( LogCount >= 200 ) {
2013-03-30 08:00:31 +00:00
return ;
}
var LogField = document . createElement ( "input" ) ;
LogField . type = "file" ;
LogField . id = "file" ;
LogField . name = "logfiles[]" ;
LogField . size = 50 ;
var x = $ ( '#logfields' ) . raw ( ) ;
x . appendChild ( document . createElement ( "br" ) ) ;
x . appendChild ( LogField ) ;
LogCount ++ ;
2011-03-28 14:21:28 +00:00
}
function RemoveLogField ( ) {
2013-04-30 18:18:07 +00:00
if ( LogCount == 1 ) {
2013-03-30 08:00:31 +00:00
return ;
}
var x = $ ( '#logfields' ) . raw ( ) ;
for ( i = 0 ; i < 2 ; i ++ ) {
x . removeChild ( x . lastChild ) ;
}
LogCount -- ;
2011-03-28 14:21:28 +00:00
}
2012-11-14 08:00:19 +00:00
var ExtraLogCount = 1 ;
function AddExtraLogField ( id ) {
2013-04-30 18:18:07 +00:00
if ( LogCount >= 200 ) {
2013-03-30 08:00:31 +00:00
return ;
}
var LogField = document . createElement ( "input" ) ;
LogField . type = "file" ;
LogField . id = "file_" + id ;
LogField . name = "logfiles_" + id + "[]" ;
LogField . size = 50 ;
var x = $ ( '#logfields_' + id ) . raw ( ) ;
x . appendChild ( document . createElement ( "br" ) ) ;
x . appendChild ( LogField ) ;
LogCount ++ ;
2012-11-14 08:00:19 +00:00
}
function RemoveLogField ( ) {
2013-04-30 18:18:07 +00:00
if ( LogCount == 1 ) {
2013-03-30 08:00:31 +00:00
return ;
}
var x = $ ( '#logfields' ) . raw ( ) ;
for ( i = 0 ; i < 2 ; i ++ ) {
x . removeChild ( x . lastChild ) ;
}
LogCount -- ;
2012-11-14 08:00:19 +00:00
}
2011-03-28 14:21:28 +00:00
var FormatCount = 0 ;
function AddFormat ( ) {
2013-04-30 18:18:07 +00:00
if ( FormatCount >= 10 ) {
2013-03-30 08:00:31 +00:00
return ;
}
2011-03-28 14:21:28 +00:00
FormatCount ++ ;
$ ( '#extras' ) . raw ( ) . value = FormatCount ;
2013-02-22 08:00:24 +00:00
2011-03-28 14:21:28 +00:00
var NewRow = document . createElement ( "tr" ) ;
NewRow . id = "new_torrent_row" + FormatCount ;
NewRow . setAttribute ( "style" , "border-top-width: 5px; border-left-width: 5px; border-right-width: 5px;" ) ;
2013-02-22 08:00:24 +00:00
2011-03-28 14:21:28 +00:00
var NewCell1 = document . createElement ( "td" ) ;
NewCell1 . setAttribute ( "class" , "label" ) ;
NewCell1 . innerHTML = "Extra Torrent File" ;
2013-02-22 08:00:24 +00:00
2011-03-28 14:21:28 +00:00
var NewCell2 = document . createElement ( "td" ) ;
var TorrentField = document . createElement ( "input" ) ;
TorrentField . type = "file" ;
TorrentField . id = "extra_torrent_file" + FormatCount ;
TorrentField . name = "extra_torrent_files[]" ;
TorrentField . size = 50 ;
NewCell2 . appendChild ( TorrentField ) ;
2013-02-22 08:00:24 +00:00
2011-03-28 14:21:28 +00:00
NewRow . appendChild ( NewCell1 ) ;
2013-02-22 08:00:24 +00:00
NewRow . appendChild ( NewCell2 ) ;
2011-03-28 14:21:28 +00:00
NewRow = document . createElement ( "tr" ) ;
NewRow . id = "new_format_row" + FormatCount ;
NewRow . setAttribute ( "style" , "border-left-width: 5px; border-right-width: 5px;" ) ;
NewCell1 = document . createElement ( "td" ) ;
NewCell1 . setAttribute ( "class" , "label" ) ;
NewCell1 . innerHTML = "Extra Format / Bitrate" ;
2013-02-22 08:00:24 +00:00
2011-03-28 14:21:28 +00:00
NewCell2 = document . createElement ( "td" ) ;
tmp = '<select id="releasetype" name="extra_formats[]"><option value="">---</option>' ;
2012-11-14 08:00:19 +00:00
var formats = [ "Saab" , "Volvo" , "BMW" ] ;
2013-04-30 18:18:07 +00:00
for ( var i in formats ) {
tmp += '<option value="' + formats [ i ] + '">' + formats [ i ] + "</option>\n" ;
2011-03-28 14:21:28 +00:00
}
tmp += "</select>" ;
2012-11-14 08:00:19 +00:00
var bitrates = [ "1" , "2" , "3" ] ;
2011-03-28 14:21:28 +00:00
tmp += '<select id="releasetype" name="extra_bitrates[]"><option value="">---</option>' ;
2013-04-30 18:18:07 +00:00
for ( var i in bitrates ) {
tmp += '<option value="' + bitrates [ i ] + '">' + bitrates [ i ] + "</option>\n" ;
2011-03-28 14:21:28 +00:00
}
tmp += "</select>" ;
2013-02-22 08:00:24 +00:00
2011-03-28 14:21:28 +00:00
NewCell2 . innerHTML = tmp ;
NewRow . appendChild ( NewCell1 ) ;
2013-02-22 08:00:24 +00:00
NewRow . appendChild ( NewCell2 ) ;
2011-03-28 14:21:28 +00:00
NewRow = document . createElement ( "tr" ) ;
NewRow . id = "new_description_row" + FormatCount ;
NewRow . setAttribute ( "style" , "border-bottom-width: 5px; border-left-width: 5px; border-right-width: 5px;" ) ;
NewCell1 = document . createElement ( "td" ) ;
NewCell1 . setAttribute ( "class" , "label" ) ;
NewCell1 . innerHTML = "Extra Release Description" ;
2013-02-22 08:00:24 +00:00
2011-03-28 14:21:28 +00:00
NewCell2 = document . createElement ( "td" ) ;
NewCell2 . innerHTML = '<textarea name="extra_release_desc[]" id="release_desc" cols="60" rows="4"></textarea>' ;
2013-02-22 08:00:24 +00:00
2011-03-28 14:21:28 +00:00
NewRow . appendChild ( NewCell1 ) ;
2013-02-22 08:00:24 +00:00
NewRow . appendChild ( NewCell2 ) ;
2011-03-28 14:21:28 +00:00
}
function RemoveFormat ( ) {
2013-04-30 18:18:07 +00:00
if ( FormatCount == 0 ) {
2013-03-30 08:00:31 +00:00
return ;
}
2011-03-28 14:21:28 +00:00
$ ( '#extras' ) . raw ( ) . value = FormatCount ;
2013-02-22 08:00:24 +00:00
2011-03-28 14:21:28 +00:00
var x = $ ( '#new_torrent_row' + FormatCount ) . raw ( ) ;
x . parentNode . removeChild ( x ) ;
2013-02-22 08:00:24 +00:00
2011-03-28 14:21:28 +00:00
x = $ ( '#new_format_row' + FormatCount ) . raw ( ) ;
x . parentNode . removeChild ( x ) ;
2013-02-22 08:00:24 +00:00
2011-03-28 14:21:28 +00:00
x = $ ( '#new_description_row' + FormatCount ) . raw ( ) ;
x . parentNode . removeChild ( x ) ;
2013-02-22 08:00:24 +00:00
2011-03-28 14:21:28 +00:00
FormatCount -- ;
}
var ArtistCount = 1 ;
function AddArtistField ( ) {
2013-04-30 18:18:07 +00:00
if ( ArtistCount >= 200 ) {
2013-03-30 08:00:31 +00:00
return ;
}
2011-03-28 14:21:28 +00:00
var ArtistField = document . createElement ( "input" ) ;
ArtistField . type = "text" ;
ArtistField . id = "artist" ;
ArtistField . name = "artists[]" ;
ArtistField . size = 45 ;
2013-02-22 08:00:24 +00:00
2011-03-28 14:21:28 +00:00
var ImportanceField = document . createElement ( "select" ) ;
ImportanceField . id = "importance" ;
ImportanceField . name = "importance[]" ;
ImportanceField . options [ 0 ] = new Option ( "Main" , "1" ) ;
ImportanceField . options [ 1 ] = new Option ( "Guest" , "2" ) ;
2011-11-20 08:00:18 +00:00
ImportanceField . options [ 2 ] = new Option ( "Composer" , "4" ) ;
ImportanceField . options [ 3 ] = new Option ( "Conductor" , "5" ) ;
ImportanceField . options [ 4 ] = new Option ( "DJ / Compiler" , "6" ) ;
ImportanceField . options [ 5 ] = new Option ( "Remixer" , "3" ) ;
2012-02-19 08:00:19 +00:00
ImportanceField . options [ 6 ] = new Option ( "Producer" , "7" ) ;
2013-02-22 08:00:24 +00:00
2011-03-28 14:21:28 +00:00
var x = $ ( '#artistfields' ) . raw ( ) ;
x . appendChild ( document . createElement ( "br" ) ) ;
x . appendChild ( ArtistField ) ;
2011-09-02 08:00:07 +00:00
x . appendChild ( document . createTextNode ( '\n' ) ) ;
2011-03-28 14:21:28 +00:00
x . appendChild ( ImportanceField ) ;
ArtistCount ++ ;
}
function RemoveArtistField ( ) {
2013-04-30 18:18:07 +00:00
if ( ArtistCount == 1 ) {
2013-03-30 08:00:31 +00:00
return ;
}
2011-03-28 14:21:28 +00:00
var x = $ ( '#artistfields' ) . raw ( ) ;
2013-03-30 08:00:31 +00:00
for ( i = 0 ; i < 4 ; i ++ ) {
x . removeChild ( x . lastChild ) ;
}
2011-03-28 14:21:28 +00:00
ArtistCount -- ;
}
2012-11-29 08:00:19 +00:00
function CheckVA ( ) {
if ( $ ( '#artist' ) . raw ( ) . value . toLowerCase ( ) . trim ( ) . match ( /^(va|various(\sa|a)rtis(t|ts)|various)$/ ) ) {
2013-06-17 08:01:02 +00:00
$ ( '#vawarning' ) . gshow ( ) ;
2011-03-28 14:21:28 +00:00
} else {
2013-06-17 08:01:02 +00:00
$ ( '#vawarning' ) . ghide ( ) ;
2011-03-28 14:21:28 +00:00
}
}
function CheckYear ( ) {
var media = $ ( '#media' ) . raw ( ) . options [ $ ( '#media' ) . raw ( ) . selectedIndex ] . text ;
2013-04-30 18:18:07 +00:00
if ( media == "---" || media == "Vinyl" || media == "Soundboard" || media == "Cassette" ) {
2011-03-28 14:21:28 +00:00
media = "old" ;
}
var x = $ ( '#year' ) . raw ( ) ;
2013-04-30 18:18:07 +00:00
if ( x . value < 1982 && x . value != '' && media != "old" && ! $ ( '#unknown' ) . raw ( ) . checked ) {
2013-06-17 08:01:02 +00:00
$ ( '#yearwarning' ) . gshow ( ) ;
2011-03-28 14:21:28 +00:00
$ ( '#remaster' ) . raw ( ) . checked = true ;
2013-06-17 08:01:02 +00:00
$ ( '#remaster_true' ) . gshow ( ) ;
2013-04-30 18:18:07 +00:00
} else if ( $ ( '#unknown' ) . raw ( ) . checked ) {
2011-03-28 14:21:28 +00:00
$ ( '#remaster' ) . raw ( ) . checked = true ;
2013-06-17 08:01:02 +00:00
$ ( '#yearwarning' ) . ghide ( ) ;
$ ( '#remaster_true' ) . gshow ( ) ;
2011-03-28 14:21:28 +00:00
} else {
2013-06-17 08:01:02 +00:00
$ ( '#yearwarning' ) . ghide ( ) ;
2011-03-28 14:21:28 +00:00
}
}
function ToggleUnknown ( ) {
2013-04-30 18:18:07 +00:00
if ( $ ( '#unknown' ) . raw ( ) . checked ) {
2011-03-28 14:21:28 +00:00
$ ( '#remaster_year' ) . raw ( ) . value = "" ;
$ ( '#remaster_title' ) . raw ( ) . value = "" ;
$ ( '#remaster_record_label' ) . raw ( ) . value = "" ;
$ ( '#remaster_catalogue_number' ) . raw ( ) . value = "" ;
2013-02-22 08:00:24 +00:00
2013-04-30 18:18:07 +00:00
if ( $ ( '#groupremasters' ) . raw ( ) ) {
2011-03-28 14:21:28 +00:00
$ ( '#groupremasters' ) . raw ( ) . selectedIndex = 0 ;
$ ( '#groupremasters' ) . raw ( ) . disabled = true ;
}
2013-02-22 08:00:24 +00:00
2011-03-28 14:21:28 +00:00
$ ( '#remaster_year' ) . raw ( ) . disabled = true ;
$ ( '#remaster_title' ) . raw ( ) . disabled = true ;
$ ( '#remaster_record_label' ) . raw ( ) . disabled = true ;
$ ( '#remaster_catalogue_number' ) . raw ( ) . disabled = true ;
} else {
$ ( '#remaster_year' ) . raw ( ) . disabled = false ;
$ ( '#remaster_title' ) . raw ( ) . disabled = false ;
$ ( '#remaster_record_label' ) . raw ( ) . disabled = false ;
$ ( '#remaster_catalogue_number' ) . raw ( ) . disabled = false ;
2013-02-22 08:00:24 +00:00
2013-04-30 18:18:07 +00:00
if ( $ ( '#groupremasters' ) . raw ( ) ) {
2011-03-28 14:21:28 +00:00
$ ( '#groupremasters' ) . raw ( ) . disabled = false ;
}
}
}
function GroupRemaster ( ) {
var remasters = json . decode ( $ ( '#json_remasters' ) . raw ( ) . value ) ;
var index = $ ( '#groupremasters' ) . raw ( ) . options [ $ ( '#groupremasters' ) . raw ( ) . selectedIndex ] . value ;
2013-04-30 18:18:07 +00:00
if ( index != "" ) {
2011-03-28 14:21:28 +00:00
$ ( '#remaster_year' ) . raw ( ) . value = remasters [ index ] [ 1 ] ;
$ ( '#remaster_title' ) . raw ( ) . value = remasters [ index ] [ 2 ] ;
$ ( '#remaster_record_label' ) . raw ( ) . value = remasters [ index ] [ 3 ] ;
$ ( '#remaster_catalogue_number' ) . raw ( ) . value = remasters [ index ] [ 4 ] ;
}
}