function ChangeCategory(catid) { if(catid == 1) { $('#split_releasetype').show(); $('#split_artist').show(); $('#split_year').show(); } else if(catid == 4 || catid == 6) { $('#split_releasetype').hide(); $('#split_year').show(); $('#split_artist').hide(); } else { $('#split_releasetype').hide(); $('#split_artist').hide(); $('#split_year').hide(); } } function ArtistManager() { var GroupID = window.location.search.match(/[?&]id=(\d+)/); if(typeof GroupID == 'undefined') { return; } else { GroupID = GroupID[1]; } var ArtistList; if(!(ArtistList = $('#artist_list').raw())) { return false; } else if($('#artistmanager').raw()) { $('#artistmanager').toggle(); $('#artist_list').toggle(); } else { MainArtistCount = 0; var elArtistManager = document.createElement('div'); elArtistManager.id = 'artistmanager'; var elArtistList = ArtistList.cloneNode(true); elArtistList.id = 'artistmanager_list'; for(var i=0; i StartBox ? 1 : -1); var checked = obj.checked; for(var i = StartBox; i != EndBox; i += Dir) { var key, importance = obj.value.substr(0,1), id = obj.value.substr(2); $('#artistmanager_box'+i).raw().checked = checked; } StartBox = Number(obj.id.substr(17)); } function ArtistManagerSubmit() { var Selection = new Array(); var MainSelectionCount = 0; for(var i = 0, boxes = $('[name="artistmanager_box"]'); boxes.raw(i); i++) { if(boxes.raw(i).checked) { Selection.push(boxes.raw(i).value); if(boxes.raw(i).value.substr(0,1) == '1') { MainSelectionCount++; } } } if(Selection.length == 0 || ($('#manager_action').raw().value == 'delete' && !confirm('Are you sure you want to delete '+Selection.length+' artists from this group?'))) { return; } $('#artists_selection').raw().value = Selection.join(','); if((($('#artists_importance').raw().value != 1 && $('#artists_importance').raw().value != 4 && $('#artists_importance').raw().value != 6) || $('#manager_action').raw().value == 'delete') && MainSelectionCount == MainArtistCount) { if(!$('.error_message').raw()) { error_message('All groups need to have at least one main artist, composer, or DJ.'); } $('.error_message').raw().scrollIntoView(); return; } $('#artistmanager_form').raw().submit(); } function ArtistManagerDelete() { $('#manager_action').raw().value = 'delete'; ArtistManagerSubmit(); $('#manager_action').raw().value = 'manage'; } function Vote(amount, requestid) { if(typeof amount == 'undefined') { amount = parseInt($('#amount').raw().value); } if(amount == 0) { amount = 20 * 1024 * 1024; } var index; var votecount; if(!requestid) { requestid = $('#requestid').raw().value; votecount = $('#votecount').raw(); index = false; } else { votecount = $('#vote_count_' + requestid).raw(); bounty = $('#bounty_' + requestid).raw(); index = true; } ajax.get('requests.php?action=takevote&id=' + requestid + '&auth=' + $('#auth').raw().value + '&amount=' + amount, function (response) { 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') { //No increment } else if (response == 'success') { votecount.innerHTML = (parseInt(votecount.innerHTML)) + 1; } if($('#total_bounty').results() > 0) { totalBounty = parseInt($('#total_bounty').raw().value); totalBounty += (amount * (1 - $('#request_tax').raw().value)); $('#total_bounty').raw().value = totalBounty; $('#formatted_bounty').raw().innerHTML = get_size(totalBounty); save_message("Your vote of " + get_size(amount) + ", adding a " + get_size(amount * (1 - $('#request_tax').raw().value)) + " bounty, has been added"); $('#button').raw().disabled = true; } else { save_message("Your vote of " + get_size(amount) + " has been added"); } } ); } var voteLock = false; function DownVoteGroup(groupid, authkey) { if (voteLock) { return; } voteLock = true; ajax.get('ajax.php?action=votefavorite&do=vote&groupid='+groupid+'&vote=down'+'&auth='+authkey, function (response) { if (response == 'noaction') { //No increment } else if (response == 'success') { $('#totalvotes').raw().innerHTML = (parseInt($('#totalvotes').raw().innerHTML)) + 1; } } ); $('#vote_message').hide(); $('#unvote_message').show(); $('#upvoted').hide(); $('#downvoted').show(); voteLock = false; } function UpVoteGroup(groupid, authkey) { if (voteLock) { return; } voteLock = true; ajax.get('ajax.php?action=votefavorite&do=vote&groupid='+groupid+'&vote=up'+'&auth='+authkey, function (response) { if (response == 'noaction') { //No increment } else if (response == 'success') { // Increment both the upvote count and the total votes count $('#upvotes').raw().innerHTML = (parseInt($('#upvotes').raw().innerHTML)) + 1; $('#totalvotes').raw().innerHTML = (parseInt($('#totalvotes').raw().innerHTML)) + 1; } } ); $('#vote_message').hide(); $('#unvote_message').show(); $('#upvoted').show(); $('#downvoted').hide(); voteLock = false; } function UnvoteGroup(groupid, authkey) { if (voteLock) { return; } voteLock = true; ajax.get('ajax.php?action=votefavorite&do=unvote&groupid='+groupid+'&auth='+authkey, function (response) { if (response == 'noaction') { //No increment } else if (response == 'success-down') { $('#totalvotes').raw().innerHTML = (parseInt($('#totalvotes').raw().innerHTML)) - 1; } else if (response == 'success-up') { $('#totalvotes').raw().innerHTML = (parseInt($('#totalvotes').raw().innerHTML)) - 1; $('#upvotes').raw().innerHTML = (parseInt($('#upvotes').raw().innerHTML)) - 1; } } ); $('#vote_message').show(); $('#unvote_message').hide(); $('#upvoted').hide(); $('#downvoted').hide(); voteLock = false; }