2011-03-28 14:21:28 +00:00
|
|
|
function ChangeTo(to) {
|
2013-04-18 08:00:54 +00:00
|
|
|
if (to == "text") {
|
2013-06-17 08:01:02 +00:00
|
|
|
$('#admincommentlinks').ghide();
|
|
|
|
$('#admincomment').gshow();
|
2011-03-28 14:21:28 +00:00
|
|
|
resize('admincomment');
|
|
|
|
var buttons = document.getElementsByName('admincommentbutton');
|
2013-04-30 18:18:07 +00:00
|
|
|
for (var i = 0; i < buttons.length; i++) {
|
2011-03-28 14:21:28 +00:00
|
|
|
buttons[i].setAttribute('onclick',"ChangeTo('links'); return false;");
|
|
|
|
}
|
2013-04-18 08:00:54 +00:00
|
|
|
} else if (to == "links") {
|
2013-05-04 08:00:48 +00:00
|
|
|
ajax.post("ajax.php?action=preview","form", function(response) {
|
2011-03-28 14:21:28 +00:00
|
|
|
$('#admincommentlinks').raw().innerHTML = response;
|
2013-06-17 08:01:02 +00:00
|
|
|
$('#admincomment').ghide();
|
|
|
|
$('#admincommentlinks').gshow();
|
2011-03-28 14:21:28 +00:00
|
|
|
var buttons = document.getElementsByName('admincommentbutton');
|
2013-04-30 18:18:07 +00:00
|
|
|
for (var i = 0; i < buttons.length; i++) {
|
2011-03-28 14:21:28 +00:00
|
|
|
buttons[i].setAttribute('onclick',"ChangeTo('text'); return false;");
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function UncheckIfDisabled(checkbox) {
|
|
|
|
if (checkbox.disabled) {
|
|
|
|
checkbox.checked = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
2013-04-18 08:00:54 +00:00
|
|
|
if (!$('input[name=p_ratio]').raw()) {
|
2011-03-28 14:21:28 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
var showDownload = $('input[name=p_downloaded]').raw().checked || ($('input[name=p_uploaded]').raw().checked && $('input[name=p_ratio]').raw().checked);
|
|
|
|
if (($('input[name=p_seeding_c]').raw().checked) && ($('input[name=p_snatched_c]').raw().checked) && showDownload) {
|
|
|
|
$('input[type=checkbox][name=p_requiredratio]').raw().checked = true;
|
|
|
|
$('input[type=checkbox][name=p_requiredratio]').raw().disabled = true;
|
|
|
|
} else {
|
|
|
|
$('input[type=checkbox][name=p_requiredratio]').raw().disabled = false;
|
|
|
|
}
|
|
|
|
$('input[name=p_torrentcomments_l]').raw().disabled = !$('input[name=p_torrentcomments_c]').raw().checked;
|
|
|
|
$('input[name=p_collagecontribs_l]').raw().disabled = !$('input[name=p_collagecontribs_c]').raw().checked;
|
|
|
|
$('input[name=p_requestsfilled_list]').raw().disabled = !($('input[name=p_requestsfilled_count]').raw().checked && $('input[name=p_requestsfilled_bounty]').raw().checked);
|
|
|
|
$('input[name=p_requestsvoted_list]').raw().disabled = !($('input[name=p_requestsvoted_count]').raw().checked && $('input[name=p_requestsvoted_bounty]').raw().checked);
|
|
|
|
$('input[name=p_uploads_l]').raw().disabled = !$('input[name=p_uploads_c]').raw().checked;
|
|
|
|
$('input[name=p_uniquegroups_l]').raw().disabled = !$('input[name=p_uniquegroups_c]').raw().checked;
|
|
|
|
$('input[name=p_perfectflacs_l]').raw().disabled = !$('input[name=p_perfectflacs_c]').raw().checked;
|
|
|
|
$('input[name=p_seeding_l]').raw().disabled = !$('input[name=p_seeding_c]').raw().checked;
|
|
|
|
$('input[name=p_leeching_l]').raw().disabled = !$('input[name=p_leeching_c]').raw().checked;
|
|
|
|
$('input[name=p_snatched_l]').raw().disabled = !$('input[name=p_snatched_c]').raw().checked;
|
|
|
|
UncheckIfDisabled($('input[name=p_torrentcomments_l]').raw());
|
|
|
|
UncheckIfDisabled($('input[name=p_collagecontribs_l]').raw());
|
|
|
|
UncheckIfDisabled($('input[name=p_requestsfilled_list]').raw());
|
|
|
|
UncheckIfDisabled($('input[name=p_requestsvoted_list]').raw());
|
|
|
|
UncheckIfDisabled($('input[name=p_uploads_l]').raw());
|
|
|
|
UncheckIfDisabled($('input[name=p_uniquegroups_l]').raw());
|
|
|
|
UncheckIfDisabled($('input[name=p_perfectflacs_l]').raw());
|
|
|
|
UncheckIfDisabled($('input[name=p_seeding_l]').raw());
|
|
|
|
UncheckIfDisabled($('input[name=p_leeching_l]').raw());
|
|
|
|
UncheckIfDisabled($('input[name=p_snatched_l]').raw());
|
2013-02-22 08:00:24 +00:00
|
|
|
|
2011-03-28 14:21:28 +00:00
|
|
|
// unique groups, "Perfect" FLACs and artists added are deducible from the list of uploads
|
|
|
|
if ($('input[name=p_uploads_l]').raw().checked) {
|
|
|
|
$('input[name=p_uniquegroups_c]').raw().checked = true;
|
|
|
|
$('input[name=p_uniquegroups_l]').raw().checked = true;
|
|
|
|
$('input[name=p_uniquegroups_c]').raw().disabled = true;
|
2013-02-22 08:00:24 +00:00
|
|
|
$('input[name=p_uniquegroups_l]').raw().disabled = true;
|
2011-03-28 14:21:28 +00:00
|
|
|
$('input[name=p_perfectflacs_c]').raw().checked = true;
|
|
|
|
$('input[name=p_perfectflacs_l]').raw().checked = true;
|
|
|
|
$('input[name=p_perfectflacs_c]').raw().disabled = true;
|
2013-02-22 08:00:24 +00:00
|
|
|
$('input[name=p_perfectflacs_l]').raw().disabled = true;
|
2011-03-28 14:21:28 +00:00
|
|
|
$('input[type=checkbox][name=p_artistsadded]').raw().checked = true;
|
|
|
|
$('input[type=checkbox][name=p_artistsadded]').raw().disabled = true;
|
|
|
|
} else {
|
|
|
|
$('input[name=p_uniquegroups_c]').raw().disabled = false;
|
|
|
|
$('input[name=p_uniquegroups_l]').raw().checked = false;
|
|
|
|
$('input[name=p_uniquegroups_l]').raw().disabled = true;
|
|
|
|
$('input[name=p_perfectflacs_c]').raw().disabled = false;
|
|
|
|
$('input[type=checkbox][name=p_artistsadded]').raw().disabled = false;
|
|
|
|
}
|
|
|
|
if ($('input[name=p_collagecontribs_l]').raw().checked) {
|
|
|
|
$('input[name=p_collages_c]').raw().disabled = true;
|
|
|
|
$('input[name=p_collages_l]').raw().disabled = true;
|
|
|
|
$('input[name=p_collages_c]').raw().checked = true;
|
|
|
|
$('input[name=p_collages_l]').raw().checked = true;
|
|
|
|
} else {
|
|
|
|
$('input[name=p_collages_c]').raw().disabled = false;
|
|
|
|
$('input[name=p_collages_l]').raw().disabled = !$('input[name=p_collages_c]').raw().checked;
|
|
|
|
UncheckIfDisabled($('input[name=p_collages_l]').raw());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function ParanoiaReset(checkbox, drops) {
|
|
|
|
var selects = $('select');
|
|
|
|
for (var i = 0; i < selects.results(); i++) {
|
|
|
|
if (selects.raw(i).name.match(/^p_/)) {
|
2013-04-18 08:00:54 +00:00
|
|
|
if (drops == 0) {
|
2011-03-28 14:21:28 +00:00
|
|
|
selects.raw(i).selectedIndex = 0;
|
2013-04-18 08:00:54 +00:00
|
|
|
} else if (drops == 1) {
|
2011-03-28 14:21:28 +00:00
|
|
|
selects.raw(i).selectedIndex = selects.raw(i).options.length - 2;
|
2013-04-18 08:00:54 +00:00
|
|
|
} else if (drops == 2) {
|
2011-03-28 14:21:28 +00:00
|
|
|
selects.raw(i).selectedIndex = selects.raw(i).options.length - 1;
|
|
|
|
}
|
|
|
|
AlterParanoia();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var checkboxes = $(':checkbox');
|
|
|
|
for (var i = 0; i < checkboxes.results(); i++) {
|
|
|
|
if (checkboxes.raw(i).name.match(/^p_/) && (checkboxes.raw(i).name != 'p_lastseen')) {
|
|
|
|
if (checkbox == 3) {
|
|
|
|
checkboxes.raw(i).checked = !(checkboxes.raw(i).name.match(/_list$/) || checkboxes.raw(i).name.match(/_l$/));
|
|
|
|
} else {
|
|
|
|
checkboxes.raw(i).checked = checkbox;
|
|
|
|
}
|
2013-02-22 08:00:24 +00:00
|
|
|
AlterParanoia();
|
2011-03-28 14:21:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function ParanoiaResetOff() {
|
|
|
|
ParanoiaReset(true, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
function ParanoiaResetStats() {
|
|
|
|
ParanoiaReset(3, 0);
|
|
|
|
$('input[name=p_collages_l]').raw().checked = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
function ParanoiaResetOn() {
|
|
|
|
ParanoiaReset(false, 0);
|
|
|
|
$('input[name=p_collages_c]').raw().checked = false;
|
|
|
|
$('input[name=p_collages_l]').raw().checked = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
addDOMLoadEvent(AlterParanoia);
|
2012-03-03 08:00:28 +00:00
|
|
|
|
|
|
|
function ToggleWarningAdjust(selector) {
|
|
|
|
if (selector.options[selector.selectedIndex].value == '---') {
|
2013-06-17 08:01:02 +00:00
|
|
|
$('#ReduceWarningTR').gshow();
|
2012-03-03 08:00:28 +00:00
|
|
|
$('#ReduceWarning').raw().disabled = false;
|
|
|
|
} else {
|
2013-06-17 08:01:02 +00:00
|
|
|
$('#ReduceWarningTR').ghide();
|
2012-03-03 08:00:28 +00:00
|
|
|
$('#ReduceWarning').raw().disabled = true;
|
|
|
|
}
|
2012-11-01 08:00:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
addDOMLoadEvent(ToggleIdenticons);
|
|
|
|
function ToggleIdenticons() {
|
2013-07-28 08:00:53 +00:00
|
|
|
var disableAvatars = $('#disableavatars');
|
|
|
|
if (disableAvatars.size()) {
|
|
|
|
var selected = disableAvatars[0].selectedIndex;
|
|
|
|
if (selected == 2 || selected == 3) {
|
|
|
|
$('#identicons').gshow();
|
|
|
|
} else {
|
|
|
|
$('#identicons').ghide();
|
|
|
|
}
|
2013-04-18 08:00:54 +00:00
|
|
|
}
|
|
|
|
}
|
2013-05-14 08:00:34 +00:00
|
|
|
|
|
|
|
function userform_submit() {
|
2013-06-27 08:01:06 +00:00
|
|
|
if ($('#resetpasskey').is(':checked')) {
|
2013-06-06 08:01:03 +00:00
|
|
|
if (!confirm('Are you sure you want to reset your passkey?')) {
|
|
|
|
return false;
|
2013-05-14 08:00:34 +00:00
|
|
|
}
|
|
|
|
}
|
2013-06-06 08:01:03 +00:00
|
|
|
return formVal();
|
2013-05-14 08:00:34 +00:00
|
|
|
}
|
2013-05-29 08:00:51 +00:00
|
|
|
|
|
|
|
function togglePassKey(key) {
|
|
|
|
if ($('#passkey').raw().innerHTML == 'View') {
|
|
|
|
$('#passkey').raw().innerHTML = key;
|
|
|
|
} else {
|
|
|
|
$('#passkey').raw().innerHTML = 'View';
|
|
|
|
}
|
|
|
|
|
2013-06-17 08:01:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function commStats(userid) {
|
|
|
|
$('.user_commstats').html('Loading...');
|
|
|
|
ajax.get('ajax.php?action=community_stats&userid=' + userid, function(JSONresponse) {
|
|
|
|
var response = JSON.parse(JSONresponse) || false;
|
|
|
|
if (!response || response.status == 'failure') {
|
|
|
|
$('.user_commstats').html('An error occured');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
displayCommStats(response.response);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function displayCommStats(stats) {
|
|
|
|
var baseid = '#user_commstats_';
|
|
|
|
for (x in stats) {
|
|
|
|
if (stats[x] === false) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
switch (x) {
|
|
|
|
case 'leeching':
|
|
|
|
$(baseid + x).html(stats[x]);
|
|
|
|
break;
|
|
|
|
case 'seeding':
|
|
|
|
$(baseid + x).html(stats[x]);
|
|
|
|
break;
|
|
|
|
case 'downloaded':
|
|
|
|
$(baseid + x).html(stats[x]);
|
|
|
|
break;
|
|
|
|
case 'snatched':
|
|
|
|
$(baseid + x).html(stats[x]);
|
|
|
|
break;
|
|
|
|
case 'usnatched':
|
|
|
|
$(baseid + x).html('(' + stats[x] + ')');
|
|
|
|
break;
|
|
|
|
case 'udownloaded':
|
|
|
|
$(baseid + x).html('(' + stats[x] + ')');
|
|
|
|
break;
|
|
|
|
case 'seedingperc':
|
2013-06-20 08:01:00 +00:00
|
|
|
$(baseid + x).html('(' + stats[x] + '%)');
|
2013-06-17 08:01:02 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-07-23 08:00:41 +00:00
|
|
|
|
|
|
|
$(document).ready(function() {
|
|
|
|
$("#random_password").click(function() {
|
|
|
|
var length = 15,
|
|
|
|
charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_+-=<>?",
|
|
|
|
password = "";
|
|
|
|
for (var i = 0, n = charset.length; i < length; ++i) {
|
|
|
|
password += charset.charAt(Math.floor(Math.random() * n));
|
|
|
|
}
|
|
|
|
$('#change_password').val(password);
|
|
|
|
});
|
|
|
|
});
|