Latest News › Forums › Site technical issues and feedback › Habbabreak V2
- This topic has 26 replies, 1 voice, and was last updated 8 years, 9 months ago by Phil the ex frog.
-
AuthorPosts
-
Phil the ex frog
Here you go Baal. Updated for the new theme.
// ==UserScript== // @name Habbabreak2 // @namespace http://habbabreak2.nil // @description Sanity helper script for Craig Murray's blog // @include https://www.craigmurray.org.uk/* // @version 1.0 // @grant GM_getValue // @grant GM_setValue // @grant GM_deleteValue // @require https://code.jquery.com/jquery-1.7.2.min.js // @license Unlicense // ==/UserScript== var styles = '<style>' + 'div#habbabreak_options_div {display:none; background-color:#fff; padding:5px; border:1px #ccc solid;}' + 'input#habbabreak_add_person_input {max-width:300px;}' + 'a#habbabreak_disable_a.disabled {color:red;} div#habbabreak_options_div a {color:#262626; background: #ffff66;}' + 'a#habbabreak_toggle_options_a.disabled, a#habbabreak_toggle_options_a:visited.disabled {color:red;}' + 'a#habbabreak_toggle_options_a.disabled:hover {color:#28B7FF;} ' + '</style>'; var boldstyle = '<style>' + 'article p>a, article p>a:hover {color:#262626; background: #ffff66;} article p {color:#262626; font-size:17px; line-height: 24px;} aside#text-10, aside#text-12, aside#archives-5, aside#categories-5{display:none;}' + 'aside a {color:#a27210;}' + '</style>'; var peopletohide = function(s) { var pth = []; var pstr = GM_getValue('var-people-to-hide'); if (pstr) { pth = pstr.split(s); pth.splice(-1,1); // remove last empty string from array } return pth; }; jQuery.expr[':'].icontains = function(a, i, m) { return jQuery(a) .text() .toUpperCase() .indexOf(m[3] .toUpperCase()) >= 0; }; $(document) .ready(function () { $('head') .append(styles); if (GM_getValue('var-option-bold')) $('head') .append(boldstyle); $('#menu-main-2') .append('<li><a href="">Habbabreak</a></li>'); 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"/> <a href="">add person</a></p>' + '<p><label><input type="checkbox" id="habbabreak_bold"/> High contrast</label></p>' + '<div><a href="">Save</a> | <a href="">Close</a> | <a href="">Disable</a></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> <a href="">remove</a></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> <a href="">remove</a></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(); }); }; });
Phil the ex frogmmmm. I’ll try again.
Phil the ex frog// ==UserScript==
// @name Habbabreak2
// @namespace http://habbabreak2.nil
// @description Sanity helper script for Craig Murray’s blog
// @include https://www.craigmurray.org.uk/*
// @version 1.0
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_deleteValue
// @require http://code.jquery.com/jquery-1.7.2.min.js
// @license Unlicense
// ==/UserScript==var styles = ‘<style>’ +
‘div#habbabreak_options_div {display:none; background-color:#fff; padding:5px; border:1px #ccc solid;}’ +
‘input#habbabreak_add_person_input {max-width:300px;}’ +
‘a#habbabreak_disable_a.disabled {color:red;} div#habbabreak_options_div a {color:#262626; background: #ffff66;}’ +
‘a#habbabreak_toggle_options_a.disabled, a#habbabreak_toggle_options_a:visited.disabled {color:red;}’ +
‘a#habbabreak_toggle_options_a.disabled:hover {color:#28B7FF;} ‘ +
‘</style>’;
var boldstyle = ‘<style>’ +
‘article p>a, article p>a:hover {color:#262626; background: #ffff66;} article p {color:#262626; font-size:17px; line-height: 24px;} aside#text-10, aside#text-12, aside#archives-5, aside#categories-5{display:none;}’ +
‘aside a {color:#a27210;}’ +
‘</style>’;
var peopletohide = function(s) {
var pth = [];
var pstr = GM_getValue(‘var-people-to-hide’);
if (pstr) {
pth = pstr.split(s);
pth.splice(-1,1); // remove last empty string from array
}
return pth;
};
jQuery.expr[‘:’].icontains = function(a, i, m) {
return jQuery(a) .text() .toUpperCase() .indexOf(m[3] .toUpperCase()) >= 0;
};
$(document) .ready(function () {
$(‘head’) .append(styles);
if (GM_getValue(‘var-option-bold’)) $(‘head’) .append(boldstyle);
$(‘#menu-main-2’) .append(‘- 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();
});
};
});Phil the ex frogDon’t think this’ll work in this comment box. The code tags don’t work as I expected.
Ba’al ZevulTYVM, Phil. I may just have enough savvy to work out what the intention is from the original code, but only just. I’ll take a look at it when I have time and let you know if I can make it work! Thanks again. Although knowing the original target’s offerings are ONLY intended to infuriate makes it easy to scroll past them – the new layout helps. .
Phil the ex frogDarth
Thanks for editing my original post. Unfortunately wordpress stripped out certain code, at minimum the ids of links, at the time of posting. So whatever magic you performed to restore the links has not saved the script.
Baal
You will need to add id attributes to the links. Maybe more. You could get these from the event functions but what a drag. I’ll post the full script somewhere else later and put a link here.
Ba’al ZevulYou are most kind, Phil. I’ll watch for developments.
Phil the ex frogFind it here: http://pastebin.com/ftQkmqbx
Phil the ex frogJust found a small but annoying bug. Sometimes, when moving to another page which has comments hidden, it needs a second click of a recent comment link to get to it. I think I can see how this can be fixed. I might do it later tonight depending on time.
Phil the ex frogBug fixed. Use this version.
Habbabreak V2.1: http://pastebin.com/kM7RDULt
Anon1This is sad. If you don’t want to read Habbabkuk’s comments then, erm, why don’t you just not read them?
Phil the ex frogAnon1, good news, the script allows you to hide comments by anyone.
Speaking for myself, some comment writers have so consistently failed to write anything that informs or interests me for such a long time that I have simply stopped reading anything they write. Have you not noticed the, erm, somewhat, erm, repetitive baiting and bickering of a few? This script just saves scrolling time.
Ba’al ZevulWhile I’m deeply grateful for your effort, Phil, I only seem to be able to download this as .txt, and I think it should be .js. Mock my ignorance by all means, but could you please outline how to get this into Firefox? I still have the old Habbabreak files in place: I’d assume yours (as .js) replaces the existing jsquery? The interweb is no help at all as anything that looks relevant goes into acronyms and Javajargon within the first sentence, and my brain is doing a good imitation of a Linux dependency snowball.
Phil the ex frogKeep your browsing even cleaner with the newer, better Habbabreak2. Now updated to hide forum posts too! h/t Anon1
Baal, there is no way to “download” the script from pastebin into Firefox (I can’t be arsed to set it up to do this on one of the script serving sites). You have to manually copy and paste. I’ll write a separate post below detailing the steps. Disable/remove your old version then follow these steps.
No need to be too grateful mate. It’s minutes of work that I have done for myself anyway.
Phil the ex frogWeed Don’t Wade with Habbabreak!
Tired of the same old same old? Is there a comment writer you simply no longer read? Let Habbabreak weed them out. Throw the chaff on the compost. Those saved seconds of scrolling soon add up. Find freedom with your virtual gardening friend Habbabreak.
Habbabreak2 v1.2: http://pastebin.com/t3zZxbZT
How To Install
Use Firefox with the Greasemonkey addon.- Click on the menu Tools>Greasemonkey>New User Script
- Enter “Habbabreak2” into the Name box. Enter “http://habbabreak2.nil” into the Namespace box. Press OK button.
- Delete everything in the new window.
- Copy the Habbabreak pastebin contents and paste into the new window. Press Save button.
How To Use
Click the new Habbabreak menu item that appears next to Invite Craig To Speak. Add the name(s) of any comment writer(s) you no longer want to see. Press the Save button.Ba’al ZevulThanks*, Phil. Ah. That makes sense, according to my hasty excursion into Java – normally it’s something NoScript has to deal with..
*No, you deserve it.
Ba’al ZevulWorks like a charm. No more Ishmael misery.
Phil the ex frogKnowing you appreciate a little pedantry and as you are using words: this is JavaScript (& jQuery). JavaScript is a web standard. It is interpreted by web browsers. JQuery is a popular library of JavaScript functionality.
Java, a JIT language, is an entirely different kettle of fish. Found in old washing machines. Not online.
Ba’al ZevulPedant. 🙂 My last serious excursion into code was Motorola 68000 machine code. These metalanguages are just confusing. I’m old and confused.
Ba’al ZevulIt’s gone! No Habbabreak option at the top of the CM page, but your script is apparently intact and enabled in ‘Manage User Scripts’, and I still have the Greasemonkey logo in Firefox. Suspect Greasemonkey may have somehow got refreshed and wiped its own script (this has happened before, when Habbabreak 1 was killed by GM). I may have a backup somewhere. Will do some digging.
Ba’al ZevulAttempting to run Habbabreak2 from its location in GM scripts returns ‘jquery undefined’ but it appears to be intact, and so does the jqery 1.7.2 file in the Habbabreak 2 folder (which is what got wiped last time). Will try a reinstall.
Ba’al ZevulPanic over – of <i>course</i> you need to turn NoScript off or allow Habbabreak permanently. Old and confused, that’s me. Move along, nothing to see, yibble, yibble.
JulianOh goody I will try this soon. Thank you Phil and anyone else who helped. Will it work with Chrome or do I have to go back to firefox? – which I am happy to do if I never have to hear from you-know-who again. Regards Julian
Phil the ex frogBaal
Noscript shouldn’t have any interation with habbabreak. Noscript addresses scripts downloaded with a page whereas habbabreak is stored locally. I think. I run noscript & habbabreak without issue. No sure what is going on. I like your ongoing <i> joke.
Julian
I am pretty certain in it’s current state this will only work with firefox. It would be a fairly trivial task to make it work on chrome too.
Phil the ex frogBaal
I’m perplexed. I have had a quick looked and there should be no need to restrict noscript operation to run habbabreak.
You said:”…or allow Habbabreak permanently”.
What do you mean? How did you allow habbabreak? Is it somehow listed as a blocked script on your version of noscript?
-
AuthorPosts