- This topic has 26 replies, 1 voice, and was last updated 8 years, 12 months ago by .
- Habbabreak
‘);
if (GM_getValue(‘var-script-disabled’)) $(‘a#habbabreak_toggle_options_a’) .addClass(‘disabled’);
var splitstring = “/c*nt^”; // DO NOT CHANGE
// Options form html
var options = ‘<div id=”habbabreak_options_div”>’ +
‘<h3>Habbabreak V2</h3><div id=”habbabreak_people_to_hide_div”></div>’ +
‘<p><input type=”input” id=”habbabreak_add_person_input” placeholder=”Loose matching eg habba will hide Habbakuk” maxlength=”20″/> add person</p>’ +
‘<p><label><input type=”checkbox” id=”habbabreak_bold”/> High contrast</label></p>’ +
‘<div>Save | Close | Disable</div>’ +
‘</div>’ ;
// Add divs to page
$(‘#main-wrapper’) .prepend(options);
// Show/hide options form
$(‘a#habbabreak_toggle_options_a’) .click(function () {
if (!$(‘#habbabreak_options_div’) .is(“:visible”)) {
$(‘#habbabreak_people_to_hide_div’) .empty();
// Display saved option values
peopletohide(splitstring).forEach(function(value) {
if (value.length > 0) {
$(‘#habbabreak_people_to_hide_div’) .append(‘<p><span>’ + value + ‘</span> remove</p>’);
}
});
if (GM_getValue(‘var-option-bold’)) $(‘#habbabreak_bold’) .attr(‘checked’, ‘checked’);
if (GM_getValue(‘var-script-disabled’)) {
$(‘#habbabreak_disable_a’) .text(‘Enable’);
$(‘a#habbabreak_disable_a’) .addClass(‘disabled’);
}
$(‘#habbabreak_options_div’) .show();
$(‘#habbabreak_add_person_input’) .focus();
} else {
$(‘#habbabreak_options_div’) .hide();
}
return false;
});
// Disable/enable script link click
$(‘a#habbabreak_disable_a’) .click(function () {
GM_setValue(‘var-script-disabled’, !GM_getValue(‘var-script-disabled’));
$(‘#habbabreak_options_div’) .hide();
return true;
});
// Add user link click
$(‘#habbabreak_options_div a#habbabreak_add_person_a’) .click(function () {
var value = $(‘#habbabreak_add_person_input’) .val() .trim();
if (value.length > 0) {
$(‘#habbabreak_people_to_hide_div’) .append(‘<p><span>’ + value + ‘</span> remove</p>’);
$(‘#habbabreak_add_person_input’) .val(”);
} else {
alert (“Habbabreak V2:\nPlease enter a name!”);
$(‘#habbabreak_add_person_input’).focus();
}
return false;
});
// Remove user link click
$(‘#habbabreak_people_to_hide_div’) .on(‘click’, ‘.remove_user’, function () {
$(this) .parents(‘p’) .remove();
return false;
});
// Close form link click
$(‘a#habbabreak_cancel_options_a’) .click(function () {
$(‘#habbabreak_options_div’) .hide();
return false;
});
// Save options link click
$(‘a#habbabreak_save_people_a’) .click(function () {
// Delete existing saved options
GM_deleteValue(‘var-people-to-hide’);
GM_deleteValue(‘var-script-disabled’);
GM_deleteValue(‘var-option-bold’);
// Save new options
var pthstr = ”;
$(‘#habbabreak_people_to_hide_div p span’) .each(function () {
pthstr += $(this) .text() + splitstring;
});
if( pthstr.length > 0 ) GM_setValue(‘var-people-to-hide’, pthstr);
GM_setValue(‘var-option-bold’, $(‘#habbabreak_bold’) .attr(‘checked’) == ‘checked’);
// Hide options window
$(‘#habbabreak_options_div’) .hide();
// Force page reload
return true;
});
// Hide comments
if (!GM_getValue(‘var-script-disabled’)) {
peopletohide(splitstring).forEach(function(value) {
var comments = $(‘header.comment-author’) .filter(function () {
return $(this).is(‘:icontains(‘ + value + ‘)’);
}).parents(‘article’) ;
comments.hide();
var recents = $(‘span.comment-author-link’) .filter(function () {
return $(this).is(‘:icontains(‘ + value + ‘)’);
}).parents(‘li’) ;
recents.hide();
});
};
});