AdvancedProfanityFilter
AdvancedProfanityFilter copied to clipboard
real time imput
I think this is tons of waste codes if extension block only loaded text. And hard to use. I have this function in 120 lines lmao... long time searching for real time profanity for text what i write friend.
This extension can do real-time input, but it goes out of its way to NOT do that. Since this extension is first and foremost a profanity filter, its strange to type out profanity that you want filtered. I could add an option to allow real-time filtering on input.
The main reason that filtering input is blocked is if you are editing a shared page, say Wikipedia that contains a word you have filtered. If you edit the page and save it, you'll end up submitting whatever changes you wanted as well as any filtered words anywhere in the document. It can also be a problem where you paste something in and expect it to be an exact copy, but find that the filter ran on the pasted text.
You can see an example of live filtering in the Options page > Test tab.
I'm not quite sure what else you are looking for here, but if you have another question let me know. I don't think evaluating a project based on line count is really valuable in this case, as the code is formatted to be more human-readable and gets packaged with webpack for deployment anyway.
This extension can do real-time input, but it goes out of its way to NOT do that. Since this extension is first and foremost a profanity filter, its strange to type out profanity that you want filtered. I could add an option to allow real-time filtering on input.
The main reason that filtering input is blocked is if you are editing a shared page, say Wikipedia that contains a word you have filtered. If you edit the page and save it, you'll end up submitting whatever changes you wanted as well as any filtered words anywhere in the document. It can also be a problem where you paste something in and expect it to be an exact copy, but find that the filter ran on the pasted text.
You can see an example of live filtering in the Options page > Test tab.
I'm not quite sure what else you are looking for here, but if you have another question let me know. I don't think evaluating a project based on line count is really valuable in this case, as the code is formatted to be more human-readable and gets packaged with webpack for deployment anyway.
RLY? And can send me clear script with this function please? I need my own filter for facebook, bcs this idiot block 30 days for all.. Hate facebook. using my AIO extension but i have problem edit in live time text Need something easy to edit what chage word=>safeword, can you help me please?
What are you looking for exactly? I could add the option for the extension to allow filtering real-time text if that's what you mean. If you're looking for a simple script though, I don't think I can get you anything simpler than the bookmarklet version of this filter.
I have my own browser extension, I'm just looking for how to write a script which, immediately after writing if it detects a bad word, would rewrite the word according to the list that will be set in the script. I've tested a lot of scripts but nothing works live and inerhtml freezes the browser. Because elemement has no selectors, just <span data-text="true">replace this text</span>
co přesně hledáš? Mohl bych přidat možnost pro rozšíření umožňující filtrování textu v reálném čase, pokud máte na mysli toto. Pokud však hledáte jednoduchý skript, nemyslím si, že vám mohu nabídnout nic jednoduššího než bookmarkletovou verzi tohoto filtru.
Friend i tested my codes and FB have big problem... If you change text real time, after post he will show still original ... im feal dumb from this .
Sorry, I don't have time until probably this weekend to look into this. Best of luck!
Sorry, I don't have time until probably this weekend to look into this. Best of luck!
no stress banned 30 days for nothing :D Have time
I did a test with this extension, and it actually seems to work pretty well. For a new post in Facebook it seems to work perfectly. For a comment or a chat in messenger, any time you type a word that is in the filter list it does filter it, but then moves the cursor back to the beginning of the text, which I could definitely see being very annoying. I don't really think there is anything else to do from the extension side because it seems to be up to the site to decide how to handle that. One way you could work around that is to write out all the text you want to say in notepad/another place, then paste it into the comment/chat box in Facebook and it will filter it.
Taking that workaround a step further, you could do the same thing right now with Advanced Profanity Filter's Options page > Test tab. Essentially just use it as a middle-man where you compose your message, copy it into the Test area and then actually submit the filtered results.
If you're interested in adding this functionality to your extension, I'm afraid I won't be able to be much help. I've got a lot on my plate, and am barely keep up with time to maintain this extension. If you're interested in using this extension though, I'm happy to add an option to allow filtering on input (that will be disabled by default). Let me know if you have any other questions, or if you would be interested in me adding that option here.
This is exactly what I said, the problem is that you need to delete the original element and replace it with a new one, it changes every time you press it, so after sending the text is not changed, try running the script after sending and you will find that nothing has changed.
po 20. 12. 2021 v 7:58 odesílatel Richard Frost @.***> napsal:
I did a test with this extension, and it actually seems to work pretty well. For a new post in Facebook it seems to work perfectly. For a comment or a chat in messenger, any time you type a word that is in the filter list it does filter it, but then moves the cursor back to the beginning of the text, which I could definitely see being very annoying. I don't really think there is anything else to do from the extension side because it seems to be up to the site to decide how to handle that. One way you could work around that is to write out all the text you want to say in notepad/another place, then paste it into the comment/chat box in Facebook and it will filter it.
Taking that workaround a step further, you could do the same thing right now with Advanced Profanity Filter's Options page > Test tab. Essentially just use it as a middle-man where you compose your message, copy it into the Test area and then actually submit the filtered results.
If you're interested in adding this functionality to your extension, I'm afraid I won't be able to be much help. I've got a lot on my plate, and am barely keep up with time to maintain this extension. If you're interested in using this extension though, I'm happy to add an option to allow filtering on input (that will be disabled by default). Let me know if you have any other questions, or if you would be interested in me adding that option here.
— Reply to this email directly, view it on GitHub https://github.com/richardfrost/AdvancedProfanityFilter/issues/359#issuecomment-997647557, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALPRTKOLSNYWT7KOYZ7ZYL3UR3H2JANCNFSM5JRA5R6A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you modified the open/close state.Message ID: @.***>
SORRY FOXED MESS:
This is exactly what I said, the problem is that you need to delete the original element and replace it with a new one, it changes every time you press it, so after sending the text is not changed, try turning off the script after sending and you find that nothing has changed.
po 20. 12. 2021 v 7:58 odesílatel Richard Frost @.***> napsal:
I did a test with this extension, and it actually seems to work pretty well. For a new post in Facebook it seems to work perfectly. For a comment or a chat in messenger, any time you type a word that is in the filter list it does filter it, but then moves the cursor back to the beginning of the text, which I could definitely see being very annoying. I don't really think there is anything else to do from the extension side because it seems to be up to the site to decide how to handle that. One way you could work around that is to write out all the text you want to say in notepad/another place, then paste it into the comment/chat box in Facebook and it will filter it.
Taking that workaround a step further, you could do the same thing right now with Advanced Profanity Filter's Options page > Test tab. Essentially just use it as a middle-man where you compose your message, copy it into the Test area and then actually submit the filtered results.
If you're interested in adding this functionality to your extension, I'm afraid I won't be able to be much help. I've got a lot on my plate, and am barely keep up with time to maintain this extension. If you're interested in using this extension though, I'm happy to add an option to allow filtering on input (that will be disabled by default). Let me know if you have any other questions, or if you would be interested in me adding that option here.
— Reply to this email directly, view it on GitHub https://github.com/richardfrost/AdvancedProfanityFilter/issues/359#issuecomment-997647557, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALPRTKOLSNYWT7KOYZ7ZYL3UR3H2JANCNFSM5JRA5R6A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you modified the open/close state.Message ID: @.***>
Sorry for the delay here. Just took some time of for the holidays.
Anyway, I just double checked, and my test where I allow the extension to modify input fields does in fact change the contents of the SPAN. If I am using the filter to substitute "cat" -> "dog", it does work on Facebook to adjust it. If I literally type "What's up cat" it will replace the input field with "What's up dog" but then move the cursor back to the beginning of the line. You can then press "End" to navigate back and start typing again, but its really jarring. This doesn't happen on a new post, but does seem to happen on comments and in Facebook messenger.
So, like I mentioned earlier, the extension can do it, but you'd probably want to type out everything somewhere else and then paste it in if you'd like to filter it. And at that point, I think it would be easier/better to just type out your intended post in Options page > Test tab if you wanted to use this extension. If you are looking to add this functionality to your own extension, you can reference what I have here as a starting point if that would help. On my test build, I adjusted the Page class (src/page.ts) to allow the filter to modify input fields:
export default class Page {
xpathDocText: string;
xpathNodeText: string;
static readonly disabledProtocols = new RegExp('(^chrome:|^about:|^[a-zA-Z]+-extension:)', 'i');
static readonly forbiddenNodeRegExp = new RegExp('^\s*(<[a-z].+?\/?>|{.+?:.+?;.*}|https?:\/\/[^\s]+$)');
static readonly forbiddenTags = ['SCRIPT', 'STYLE', 'INPUT', 'TEXTAREA', 'IFRAME', 'LINK'];
static readonly forbiddenTagsAllowInput = ['SCRIPT', 'STYLE', 'IFRAME', 'LINK'];
// Returns true if a node should *not* be altered in any way
static isForbiddenNodeSAVE(node: any): boolean {
if (node.isContentEditable) { return true; }
// Check if parentNode is a forbidden tag
if (
node.parentNode
&& (
node.parentNode.isContentEditable
|| Page.forbiddenTags.includes(node.parentNode.nodeName)
)
) { return true; }
// Check if node is a forbidden tag
return Page.forbiddenTags.includes(node.nodeName);
}
// static isForbiddenNodeAllowInput(node: any): boolean {
static isForbiddenNode(node: any): boolean {
// Check if parentNode is a forbidden tag
if (
node.parentNode
&& Page.forbiddenTagsAllowInput.includes(node.parentNode.nodeName)
) { return true; }
// Check if node is a forbidden tag
return Page.forbiddenTagsAllowInput.includes(node.nodeName);
}
}
[image: image.png] Yes, the problem with the return cursor is that the original span is updated and returned. As I have some time, I will try to inject a duplicate for writing what would contain the function, see for yourself what I did :) There is no problem injecting anything, the problem is with callback, facebook blocks all possible externally added types of functions.
st 5. 1. 2022 v 18:52 odesílatel Richard Frost @.***> napsal:
Sorry for the delay here. Just took some time of for the holidays.
Anyway, I just double checked, and my test where I allow the extension to modify input fields does in fact change the contents of the SPAN. If I am using the filter to substitute "cat" -> "dog", it does work on Facebook to adjust it. If I literally type "What's up cat" it will replace the input field with "What's up dog" but then move the cursor back to the beginning of the line. You can then press "End" to navigate back and start typing again, but its really jarring. This doesn't happen on a new post, but does seem to happen on comments and in Facebook messenger.
So, like I mentioned earlier, the extension can do it, but you'd probably want to type out everything somewhere else and then paste it in if you'd like to filter it. And at that point, I think it would be easier/better to just type out your intended post in Options page > Test tab if you wanted to use this extension. If you are looking to add this functionality to your own extension, you can reference what I have here as a starting point if that would help. On my test build, I adjusted the Page class (src/page.ts) to allow the filter to modify input fields:
export default class Page { xpathDocText: string; xpathNodeText: string;
static readonly disabledProtocols = new RegExp('(^chrome:|^about:|^[a-zA-Z]+-extension:)', 'i'); static readonly forbiddenNodeRegExp = new RegExp('^\s*(<[a-z].+?/?>|{.+?:.+?;.*}|https?://[^\s]+$)'); static readonly forbiddenTags = ['SCRIPT', 'STYLE', 'INPUT', 'TEXTAREA', 'IFRAME', 'LINK']; static readonly forbiddenTagsAllowInput = ['SCRIPT', 'STYLE', 'IFRAME', 'LINK'];
// Returns true if a node should not be altered in any way static isForbiddenNodeSAVE(node: any): boolean { if (node.isContentEditable) { return true; }
// Check if parentNode is a forbidden tag if ( node.parentNode && ( node.parentNode.isContentEditable || Page.forbiddenTags.includes(node.parentNode.nodeName) ) ) { return true; } // Check if node is a forbidden tag return Page.forbiddenTags.includes(node.nodeName);}
// static isForbiddenNodeAllowInput(node: any): boolean { static isForbiddenNode(node: any): boolean { // Check if parentNode is a forbidden tag if ( node.parentNode && Page.forbiddenTagsAllowInput.includes(node.parentNode.nodeName) ) { return true; }
// Check if node is a forbidden tag return Page.forbiddenTagsAllowInput.includes(node.nodeName);}}
— Reply to this email directly, view it on GitHub https://github.com/richardfrost/AdvancedProfanityFilter/issues/359#issuecomment-1005944946, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALPRTKKP34ER2KQVKSZIUEDUUSAOZANCNFSM5JRA5R6A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you modified the open/close state.Message ID: @.*** com>
I'm not sure where I can see what you did, but I hope you can get it working the way you want.