All posts by James

FAQ: Can I hide LeechBlock in Firefox’s Add-ons Manager?

The legacy version of LeechBlock included an option to hide the LeechBlock extension in Firefox’s Add-ons Manager, preventing users from easily disabling or uninstalling it. It’s no longer possible to provide this option due to restrictions on extensions that were introduced in Firefox 57.

However, there is another way to hide LeechBlock in the Add-ons Manager. Carefully follow these steps:

  • Locate your Firefox profile folder.
  • Create a new folder chrome inside your profile folder (if it doesn’t already exist).
  • Create a new file userContent.css inside that folder with the following content: .addon[name^=LeechBlock] { display: none !important; }

You will need to close all Firefox windows and restart Firefox for it to take effect.

FAQ: How can I disable safe mode on Firefox?

Completely disabling safe mode on Firefox is far from easy. You basically have to hack your Firefox installation, which requires a significant level of technical know-how. However, there are two relatively easy steps you can take to make it more difficult to start Firefox in safe mode.

Remove the Help Menu Item

You can use the userChrome browser customization file to remove the “Restart with Add-ons Disabled” menu item from the Help menus. Carefully follow these steps:

  • Locate your Firefox profile folder.
  • Create a new folder chrome inside your profile folder (if it doesn’t already exist).
  • Create a new file userChrome.css inside that folder with the following content: [label^='Restart with Add-ons Disabled'] { display: none !important; }

You will need to close all Firefox windows and restart Firefox for it to take effect.

(Credit to Metaception for suggesting this solution.)

If you also want to remove the button from the about:support and about:profiles pages, create another file userContent.css inside the same folder with the following content:

#safe-mode-box { display: none !important; }
#restart-in-safe-mode-button { display: none !important; }

If you also want to remove the “Create a New Profile” button from the about:profiles page, add the following line to userContent.css:

#create-button { display: none !important; }

Disable the Safe Mode Key

You can set the environment variable MOZ_DISABLE_SAFE_MODE_KEY (to any value) to prevent starting Firefox in safe mode by holding down the SHIFT key.

If you’re not sure how to set an environment variable, you can find guidance here.

FAQ: It’s all gone horribly wrong. How can I start over with LeechBlock?

LeechBlock for Firefox

Follow these steps to start over with LeechBlock NG:

  • Start Firefox in safe mode.
  • Go to Add-ons (Ctrl+Shift+A) and uninstall the LeechBlock extension.
  • Close all Firefox windows and restart Firefox normally (i.e., without safe mode).
  • Follow the instructions here to install the latest version of LeechBlock.

If you’re still using the legacy version of LeechBlock, you should follow these steps instead:

  • Start Firefox in safe mode.
  • Go to Add-ons (Ctrl+Shift+A) and uninstall the LeechBlock extension.
  • Close all Firefox windows and restart Firefox normally (i.e., without safe mode).
  • Enter about:config into the browser’s location bar.
  • Enter extensions.leechblock into the Filter field.
  • You should see a list of browser preferences displayed. Right-click on each preference in turn and select Reset.
  • Follow the instructions here to install the latest version of LeechBlock.

LeechBlock for Chrome

Follow these steps to start over with LeechBlock NG:

  • Right-click on the LeechBlock button LeechBlock icon and select Remove from Chrome…
  • Click the Remove button in the dialog box to confirm removal.
  • Follow the instructions here to install the latest version of LeechBlock.

FAQ: Can I use wildcards when specifying sites?

Yes. The wildcard character (*) can be used match any number of characters except forward-slashes (e.g., *.com will block all dot-com sites and * on its own will block all sites).

Note that * will also match no characters (e.g., foo*bar.com will block foobar.com).

If you want to match any number of characters including forward-slashes, use a double-wildcard (**).

If you want to match one or more characters, use a wildcard-plus (*+).

FAQ: What’s the difference between “within time periods OR after time limit” and “within time periods AND after time limit”?

This option determines how the time periods condition and the time limit condition are combined and applied.

  • If the OR option is selected, sites will be blocked when either condition is met.
  • If the AND option is selected, sites will be blocked only when both conditions are met.

Here’s an example to illustrate the difference. Suppose you’ve entered 0900-1700 as a time period and 10 minutes in every hour as a time limit.

If you select within time periods OR after time limit then the sites will be blocked entirely between 9am and 5pm and will also be blocked after browsing them for more than 10 minutes in every hour at other times of the day (i.e., before 9am and after 5pm).

If you select within time periods AND after time limit then the sites will be blocked only after browsing them for more than 10 minutes in every hour between 9am and 5pm and will not be blocked at other times of the day (i.e., before 9am and after 5pm).

Note: If you’ve left either the time periods field or the time limit field blank, then you should select within time periods OR after time limit (otherwise the sites will never be blocked).

FAQ: Can I block sites that contain specific words or phrases?

Yes — but note that this is an experimental feature (v0.7 and higher) and may not always work correctly!

The tilde prefix (~) can be used to restrict blocking to sites that contain given keywords. Within a keyword you can use an asterisk (*) to match any number of characters (except whitespace) and an underscore (_) to match whitespace. Note that the keyword matching is not case-sensitive.

So, for example, you could enter the following into the list of sites:

somesite.com
anothersite.com
~anteaters
~crypto*
~*alicious
~green_eggs_and_ham

This would result in pages on the sites somesite.com and anothersite.com being blocked only when those pages contain the complete word “anteaters” or any word beginning with “crypto” or any word ending with “alicious” or the complete phrase “green eggs and ham”.

If you want to block pages on any website that contain given keywords, you’ll need to use wildcards to specify all websites. For example:

*
~justin_bieber
~kim_kardashian

FAQ: What does the “Load list of sites from URL” field do?

The Load list of sites from URL field allows you to obtain the list of sites to block from a URL (e.g., a text file on a web server). The list will be loaded every time a new browser window is opened. This feature is useful if you have LeechBlock installed on multiple machines and want to avoid having to update the settings on each machine in turn whenever you need to change the list of the sites to block. (Note also that if you put $S in the URL it will be replaced with the number of the block set and $T will be replaced with a UTC timestamp in milliseconds. The latter can be useful for avoiding caching problems.)

Note that Firefox’s security model doesn’t allow extensions to load local files (even with the file:// protocol). As a workaround, you can use Dropbox:

  • Copy your text file with the list of sites into a Dropbox folder and share the file.
  • Copy the download link to the file into the Load list of sites from URL field, replacing www.dropbox.com with dl.dropboxusercontent.com.

If you don't understand any of this then you almost certainly don't need it! If in doubt, just leave the Load list of sites from URL field blank.

FAQ: The options for one of the block sets are all disabled and now I can’t change the settings! What happened and what can I do about it?

The options are disabled because you selected the option Prevent access to options for this block set at times when these sites are blocked and now those sites are blocked (hence the options are currently inaccessible). The purpose of this option is to allow users to prevent themselves from easily changing the settings once the sites have been blocked, but in a way that doesn’t prevent access to all LeechBlock options.

If you really need to change the settings for the block set before the blocking period has ended, you can do so as follows:

  • Enter about:support into the location bar of your Firefox browser.
  • Click the Open Folder button next to Profile Folder.
  • In the file explorer, navigate into the browser-extension-data folder and then into the leechblockng@proginosko.com folder.
  • Open the file storage.js in a text editor (e.g., Notepad).
  • Search for the keyword prevOpts# (but replace # with the number of the relevant block set). Change the value immediately following it from true to false.
  • Save the file storage.js and restart Firefox.
  • You should now be able to change the settings for that block set.

If you can’t access about:support then you need to swallow the red pill.