Facebook Warnings and Restrictions Remover

Automatically removes profile issues, restrictions, monetization warnings, and account restriction messages from Facebook

Size

10.2 KB

Version

1.1.2

Created

Nov 5, 2025

Updated

about 1 month ago

1// ==UserScript==
2// @name		Facebook Warnings and Restrictions Remover
3// @description		Automatically removes profile issues, restrictions, monetization warnings, and account restriction messages from Facebook
4// @version		1.1.2
5// @match		https://*.facebook.com/*
6// @icon		https://static.xx.fbcdn.net/rsrc.php/yx/r/e9sqr8WnkCf.ico
7// @grant		GM.xmlhttpRequest
8// @grant		GM.getValue
9// @grant		GM.setValue
10// ==/UserScript==
11(function() {
12    'use strict';
13
14    console.log('Facebook Warnings and Restrictions Remover - Extension loaded');
15
16    // Debounce function to prevent excessive calls
17    function debounce(func, wait) {
18        let timeout;
19        return function executedFunction(...args) {
20            const later = () => {
21                clearTimeout(timeout);
22                func(...args);
23            };
24            clearTimeout(timeout);
25            timeout = setTimeout(later, wait);
26        };
27    }
28
29    // List of warning phrases to detect and remove
30    const warningPhrases = [
31        'Profile has some issues',
32        'profile has some issues',
33        'restriction',
34        'Restriction',
35        'restricted',
36        'Restricted',
37        'your account has restrictions',
38        'Your account has restrictions',
39        'account has restrictions',
40        'Account has restrictions',
41        'no longer making money',
42        'not making money',
43        'monetization',
44        'Monetization',
45        'monetization issue',
46        'Monetization issue',
47        'account restriction',
48        'Account restriction',
49        'Account Restricted',
50        'account restricted',
51        'Your account is restricted',
52        'your account is restricted',
53        'Page restricted',
54        'page restricted',
55        'Content restricted',
56        'content restricted'
57    ];
58
59    // Function to check if element contains any warning phrase
60    function containsWarningPhrase(text) {
61        if (!text) return false;
62        return warningPhrases.some(phrase => text.includes(phrase));
63    }
64
65    // Function to remove all types of warnings
66    function removeAllWarnings() {
67        console.log('Scanning for all warning types...');
68        
69        let removedCount = 0;
70
71        // Method 1: Find by text content containing warning phrases
72        const allElements = document.querySelectorAll('span, div, p, h1, h2, h3, h4, h5, h6');
73        allElements.forEach(element => {
74            const text = element.textContent;
75            if (containsWarningPhrase(text)) {
76                // Find the parent container to remove
77                let parentToRemove = element;
78                
79                // Traverse up to find the main warning container
80                for (let i = 0; i < 12; i++) {
81                    if (parentToRemove.parentElement) {
82                        const parent = parentToRemove.parentElement;
83                        parentToRemove = parent;
84                        
85                        // Check if this looks like a warning/alert container
86                        const classList = parentToRemove.className || '';
87                        const role = parentToRemove.getAttribute('role') || '';
88                        
89                        // Stop at common warning container patterns
90                        if (classList.includes('x9f619') || 
91                            classList.includes('x1ja2u2z') || 
92                            classList.includes('alert') ||
93                            classList.includes('warning') ||
94                            classList.includes('notification') ||
95                            role === 'alert' ||
96                            role === 'banner' ||
97                            parentToRemove.querySelector('a[href*="/profile_status/"]') ||
98                            parentToRemove.querySelector('a[href*="/restriction"]') ||
99                            parentToRemove.querySelector('a[href*="/monetization"]')) {
100                            break;
101                        }
102                    } else {
103                        break;
104                    }
105                }
106                
107                // Remove the warning element
108                if (parentToRemove && parentToRemove.parentElement) {
109                    // Double check it's actually a warning before removing
110                    const parentText = parentToRemove.textContent;
111                    if (containsWarningPhrase(parentText)) {
112                        console.log('Removing warning element:', {
113                            text: parentText.substring(0, 100),
114                            element: parentToRemove
115                        });
116                        parentToRemove.style.display = 'none';
117                        parentToRemove.remove();
118                        removedCount++;
119                    }
120                }
121            }
122        });
123
124        // Method 2: Find by specific links related to restrictions/issues
125        const warningLinks = document.querySelectorAll(
126            'a[href*="/profile_status/"], ' +
127            'a[href*="/restriction"], ' +
128            'a[href*="/monetization"], ' +
129            'a[href*="/support/"], ' +
130            'a[href*="/help/"]'
131        );
132        
133        warningLinks.forEach(link => {
134            const linkText = link.textContent;
135            const parentText = link.parentElement?.textContent || '';
136            
137            // Only remove if the link is part of a warning message
138            if (containsWarningPhrase(linkText) || containsWarningPhrase(parentText)) {
139                let parentToRemove = link;
140                
141                // Traverse up to find the main warning container
142                for (let i = 0; i < 12; i++) {
143                    if (parentToRemove.parentElement) {
144                        parentToRemove = parentToRemove.parentElement;
145                        
146                        // Check if this is the main container
147                        const classList = parentToRemove.className || '';
148                        if (classList.includes('x9f619') || 
149                            classList.includes('x1ja2u2z') ||
150                            classList.includes('alert') ||
151                            classList.includes('warning')) {
152                            break;
153                        }
154                    } else {
155                        break;
156                    }
157                }
158                
159                // Remove the warning element
160                if (parentToRemove && parentToRemove.parentElement) {
161                    console.log('Removing warning container via link:', parentToRemove);
162                    parentToRemove.style.display = 'none';
163                    parentToRemove.remove();
164                    removedCount++;
165                }
166            }
167        });
168
169        // Method 3: Find alert/warning role elements
170        const alertElements = document.querySelectorAll('[role="alert"], [role="banner"]');
171        alertElements.forEach(alert => {
172            const text = alert.textContent;
173            if (containsWarningPhrase(text)) {
174                console.log('Removing alert element:', alert);
175                alert.style.display = 'none';
176                alert.remove();
177                removedCount++;
178            }
179        });
180
181        // Method 4: Find elements with warning-related classes
182        const warningContainers = document.querySelectorAll(
183            '[class*="warning"], ' +
184            '[class*="alert"], ' +
185            '[class*="notification"], ' +
186            '[class*="banner"]'
187        );
188        
189        warningContainers.forEach(container => {
190            const text = container.textContent;
191            if (containsWarningPhrase(text)) {
192                console.log('Removing warning container by class:', container);
193                container.style.display = 'none';
194                container.remove();
195                removedCount++;
196            }
197        });
198
199        // Method 5: Find specific Facebook warning containers
200        const fbContainers = document.querySelectorAll('div[class*="x9f619"]');
201        fbContainers.forEach(container => {
202            const text = container.textContent;
203            if (containsWarningPhrase(text)) {
204                console.log('Removing Facebook warning container:', container);
205                container.style.display = 'none';
206                container.remove();
207                removedCount++;
208            }
209        });
210
211        if (removedCount > 0) {
212            console.log(`Successfully removed ${removedCount} warning(s) and restriction message(s)`);
213        }
214    }
215
216    // Initialize the extension
217    function init() {
218        console.log('Initializing Facebook Warnings and Restrictions Remover...');
219        
220        // Initial removal after a short delay
221        setTimeout(() => {
222            removeAllWarnings();
223        }, 1000);
224
225        // Second check after page fully loads
226        setTimeout(() => {
227            removeAllWarnings();
228        }, 3000);
229
230        // Watch for dynamically loaded content
231        const debouncedRemoval = debounce(removeAllWarnings, 500);
232        
233        const observer = new MutationObserver(debouncedRemoval);
234        
235        if (document.body) {
236            observer.observe(document.body, {
237                childList: true,
238                subtree: true
239            });
240        } else {
241            // Wait for body to be ready
242            const bodyObserver = new MutationObserver(() => {
243                if (document.body) {
244                    observer.observe(document.body, {
245                        childList: true,
246                        subtree: true
247                    });
248                    bodyObserver.disconnect();
249                    
250                    // Run initial removal after body is ready
251                    setTimeout(() => {
252                        removeAllWarnings();
253                    }, 1000);
254                }
255            });
256            bodyObserver.observe(document.documentElement, { childList: true, subtree: true });
257        }
258
259        // Periodic check every 5 seconds as a fallback
260        setInterval(() => {
261            removeAllWarnings();
262        }, 5000);
263
264        console.log('Extension initialized successfully');
265    }
266
267    // Start the extension
268    if (document.readyState === 'loading') {
269        document.addEventListener('DOMContentLoaded', init);
270    } else {
271        init();
272    }
273
274})();
Facebook Warnings and Restrictions Remover | Robomonkey