Firefox Speed Optimizer

Optimizes web pages for faster loading by disabling animations, blocking ads, and optimizing images

  1. // ==UserScript==
  2. // @name Firefox Speed Optimizer
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description Optimizes web pages for faster loading by disabling animations, blocking ads, and optimizing images
  6. // @author Your Name
  7. // @match *://*/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13.  
  14. // Disable animations to reduce rendering time
  15. document.documentElement.style.setProperty('animation', 'none', 'important');
  16. document.documentElement.style.setProperty('transition', 'none', 'important');
  17.  
  18. // Block unnecessary images that could slow down page load
  19. let images = document.querySelectorAll('img');
  20. images.forEach(img => {
  21. if (img.src && img.src.startsWith('data:image')) {
  22. img.src = ''; // Remove base64 images
  23. }
  24. });
  25.  
  26. // Disable background images to speed up rendering
  27. document.documentElement.style.setProperty('background-image', 'none', 'important');
  28.  
  29. // Disable web fonts (can be a heavy resource)
  30. let style = document.createElement('style');
  31. style.innerHTML = `
  32. @font-face { font-family: 'FontAwesome'; src: local('Arial'); }
  33. * { font-family: sans-serif !important; }
  34. `;
  35. document.head.appendChild(style);
  36.  
  37. // Disable lazy loading of images (if applicable) for immediate content rendering
  38. let lazyImages = document.querySelectorAll('img[loading="lazy"]');
  39. lazyImages.forEach(img => {
  40. img.setAttribute('loading', 'eager');
  41. });
  42.  
  43. // Disable any unnecessary third-party scripts (useful for speeding up non-essential pages)
  44. let scripts = document.querySelectorAll('script[src]');
  45. scripts.forEach(script => {
  46. let url = script.src.toLowerCase();
  47. if (url.includes('ads') || url.includes('tracking')) {
  48. script.remove();
  49. }
  50. });
  51.  
  52. // Enable or set a fast refresh rate for images (optional)
  53. let fastRefresh = document.querySelectorAll('img');
  54. fastRefresh.forEach(img => {
  55. img.setAttribute('decoding', 'sync');
  56. });
  57.  
  58. console.log("Page optimization complete!");
  59. })();