Oups I forgot to tell the goal of the script:
The script parse the HTML of the site, find the SCRIPT and change the content of the script before it run.
checkForBadJavascripts
reacts to any script element being added, including those you add with addJS_node
while the check is running. That's why the recursion is infinite. To solve this you need to first ensure a script contains the offending text to replace and only in that case replace it and add the script back.
checkForBadJavascripts
reacts to any script element being added, including those you add withaddJS_node
while the check is running. That's why the recursion is infinite. To solve this you need to first ensure a script contains the offending text to replace and only in that case replace it and add the script back.
Thanks a lot for the quick reply,
I see your other reply on Stack Overflow too, I will give it a try tomorrow I'm so happy to have a clue about what happen :smiley:
I don't understand all but with the help of Google I should be able to advance, worst case I will ask for some clarification if I see I can't understand.
As soon as I will have completed this script I will follow a basic course on JS on the web to do better than "tweaking" and undestand the basic of JS. In the long run it should save me lot of time instead of learning only by observation and trail/error.
I really like JS but I'm not the most disciplined guy :wink: but I see that I lost to much time tring to figure the basic of JS just by looking at codes without basic knowledge.
Thanks again and I will give you some news about how it turn ! :smirk:
Thanks a lot ! :mrgreen:
It worked, I was not 100% sure to understand since my knowledge in JS is limited but I've been successful with your help and I understand to why the recursion was infinite.
I just changed my target string with checkForBadJavascripts for one that was removed by the replaceTargetJavascript function. It helped me to progress with my "project" to customize the Tiny editor from JustPasteit for my own taste.
I have almost resolved all my other issue but I have a small problem that I'd like to have a little help:
I need to remove "invalid elements" list in TinyMCE options to be able to use font-size & font-family tag.
I tried numerous ways to bypass the setting via the API, there is commands to do that but they are buggy so they are not able to override the initial settings.
I found a way to do it, it's "dirty" but it almost work, I downloaded the tinymce.min.js from the CDN and found 2 references to "invalid_element
" inside so I renamed those reference to z_invalid_element
blocked the original with AdBlock hoping everything would work (being able to save my document with font-size & font-family tag.)
I was not able to see the complete WYSIWYG editor I was only seeing the HTML source with the "doctored tinymce.min.js," but I've edited manually the HTML with fonts tags and it saved properly without striping the font tags. :smile:
I would really appreciate if you could look at the source of https://cdn.tinymce.com/4/tinymce.min.js and telling me what I should put instead of invalid_element
to bypass the option without affecting tinyMCE WYSIWYG editor ?
I've uploaded the tinymce.min.js file here if you want to take a look https://nopaste.me/view/437362cb or you can download it from https://cdn.tinymce.com/4/tinymce.min.js
I used this script to inject tinymce.min.js file: and blocked the original one with AdBlock to test and later I will block it from the script.
// ==UserScript==
// @name JustPaste.It tinymce.min.js Unlocked
// @namespace Mikhoul
// @include https://justpaste.it/*
// @version 1
// @run-at document-start
// @grant GM_addStyle
// ==/UserScript==
var script = document.createElement("script");
script.type="text/javascript";
script.src = "https://dl.dropboxusercontent.com/s/cnrt392y32szrar/tinymce.min.js"; /* My tinyMCE modded version */
document.head.appendChild(script);
Regards
Thanks a lot ! :mrgreen:
It worked, I was not 100% sure to understand since my knowledge in JS is limited but I've been successful with your help and I understand to why the recursion was infinite.
I just changed my target string with checkForBadJavascripts for one that was removed by the replaceTargetJavascript function. It helped me to progress with my "project" to customize the Tiny editor from JustPasteit for my own taste.
I have almost resolved all my other issue but I have a small problem that I'd like to have a little help:
I need to remove "invalid elements" list in TinyMCE options to be able to use font-size & font-family tag.
I tried numerous ways to bypass the setting via the API, there is commands to do that but they are buggy so they are not able to override the initial settings.
I found a way to do it, it's "dirty" but it almost work, I downloaded the tinymce.min.js from the CDN and found 2 references to "invalid_element
" inside so I renamed those reference to z_invalid_element
blocked the original with AdBlock hoping everything would work (being able to save my document with font-size & font-family tag.)
I was not able to see the complete WYSIWYG editor I was only seeing the HTML source with the "doctored tinymce.min.js," but I've edited manually the HTML with fonts tags and it saved properly without striping the font tags. :smile:
I would really appreciate if you could look at the source of https://cdn.tinymce.com/4/tinymce.min.js and telling me what I should put instead of invalid_element
to bypass the option without affecting tinyMCE WYSIWYG editor ?
I've uploaded the tinymce.min.js file here if you want to take a look https://nopaste.me/view/437362cb or you can download it from https://cdn.tinymce.com/4/tinymce.min.js
I used this script to inject tinymce.min.js file: and blocked the original one with AdBlock to test and later I will block it from the script.
// ==UserScript==
// @name JustPaste.It tinymce.min.js Unlocked
// @namespace Mikhoul
// @include https://justpaste.it/*
// @version 1
// @run-at document-start
// @grant GM_addStyle
// ==/UserScript==
var script = document.createElement("script");
script.type="text/javascript";
script.src = "https://dl.dropboxusercontent.com/s/cnrt392y32szrar/tinymce.min.js"; /* My tinyMCE modded version */
document.head.appendChild(script);
Regards
Sorry I made a mistake about my last request for help, forget about it for now I will try to resolve it by myself and comeback if I'm really stuck to ask for some hints.
Thanks again for the help, you helped me a lot with the hint :smiley:
Need Help debugging a script.
I'm newbie to JS/Greasemonkey and have some difficulty debugging this script:
It throw me in the console: "too much recursion"
Then point to: https://greasyfork.org/scripts/12317-checkforbadjavascripts-js/code/checkForBadJavascriptsjs.js file
The last error "ReferenceError: initTinyMCE is not defined" seem to be caused because of the first 2 errors.
From here: http://stackoverflow.com/questions/11200509/how-to-alter-this-javascript-with-greasemonkey everything should work fine, I don't see why I have those 2 "too much recursion" errors ????