d.innerHTML = 'Something is wrong with our system. Please report this error with the URL you\'re viewing to <a href="mailto:glenn@tidbits.com">our system administrator</a>.';
s.style.display = "block";
return false;
}
url = url + "&tbtalk=" + form.getbits.value;
} else if (type == 'email') {
url = url + "&email=" + form.author_id.value;
}
new Ajax.Request(url, {
method: 'get',
onSuccess: function(transport) {
var message;
var invalid = transport.responseText.match(/bad_captcha/);
var bademail = transport.responseText.match(/bad_email/);
var general_bad = transport.responseText.match(/bad_response/);
if(invalid) {
message = 'The text you entered does not match the text in the image. Please try again.';
} else if (bademail) {
message = 'The email address you entered does not appear to be a valid address. Please re-enter';
} else if (general_bad) {
message = 'Something went wrong that we can\'t determine. Sorry.';
}
if (invalid || bademail || general_bad) {
d.innerHTML = message;
display_captcha(1, tip_recapt);
s.style.display = "block";
} else {
s.style.display = "block";
display_captcha(0, tip_recapt);
if (type == 'tip') {
d.innerHTML = '';
d.style.background = '#000000';
//Effect.Appear(d, { duration: 0.7, from: 1.0, to: 0.3 });
form.tip_title.value = '';
form.tip_text.value = '';
form.tip_link_label.value = '';
form.tip_link_url.value = '';
display_captcha(1, tip_recapt);
Effect.Appear('popup_box_thanks', { duration: 0.7, from: 0.0, to: 1.0 });
Effect.Fade('ts_innards', { duration: 0.7, from: 1.0, to: 0.4 });
} else if (type == 'comment') {
d.innerHTML = 'Your thread has been created. Please wait and you will be redirected to our discussion site.';
var yes = confirm("Are you sure you want to delete this comment?");
if (yes == false) {
return false;
}
var token_regexp = new RegExp("token" + host_prefix + "\=([^;]+)", "");
var token = document.cookie.match(token_regexp);
var url = '/short.cgi?command=delete_comment&cid=' + cid + '&token=' + escape(token[1]);
new Ajax.Request(url, {
method: 'get',
onSuccess: function(transport) {
var success = transport.responseText.match(/success/);
if (success) {
var c = 'cb_item_' + cid;
$(c).style.display = 'none';
$(c).style.textDecoration = line-through;
$(c).color = 'Gray';
} else {
alert("The system failed in deleting the comment. Tell Glenn!");
}
},
onFailure: function() {
alert("The system failed in deleting the comment. Tell Glenn!");
}
});
return false;
}
function BanUser(cer_id) {
var yes = confirm("Are you sure you want to ban this user? All comments by this user ever made will be unpublished (but not deleted from our database).");
if (yes == false) {
return false;
}
var token_regexp = new RegExp("token" + host_prefix + "\=([^;]+)", "");
var token = document.cookie.match(token_regexp);
var url = '/short.cgi?command=ban_user&cer_id=' + cer_id + '&token=' + escape(token[1]);
new Ajax.Request(url, {
method: 'get',
onSuccess: function(transport) {
var success = transport.responseText.match(/success/);
if (success) {
alert("This user's comments have all been unpublished from TidBITS. Reload the page to see his or her comments removed here.");
} else {
alert("The system failed in deleting the comment. Tell Glenn!");
}
},
onFailure: function() {
alert("The system failed in deleting the comment. Tell Glenn!");
}
});
return false;
}
function PauseUser(cid, cer_id) {
if (!cer_id) {
alert ("A user ID is missing. Please alert Glenn, as this shouldn't happen.");
return false;
}
var yes;
var action;
var cstatus = 'cb_pause_user_' + cid;
if ($(cstatus).innerHTML.match(/Resume/)) {
yes = confirm("Are you sure you want to allow this user to resume commenting?");
action = 'start';
} else {
yes = confirm("Are you sure you want to prevent this user from commenting in the future?");
action = 'pause';
}
if (yes == false) {
return false;
}
var token_regexp = new RegExp("token" + host_prefix + "\=([^;]+)", "");