I came across this userscript which works in Google Chrome.
I want to use it as Google Chrome extension as this will give me experience to convert many other codes f
In Google Chrome, userscripts are extensions. The script gets packaged as a content script, and the extension manifest.json
gets automatically generated.
To move towards a "full fledged" extension:
First organize your script, source file(s) and explicitly create the manifest.json
as shown in this answer.
You do not need to alter that userscript's code, at this point, but you will want to transfer the values of the @include
and @run-at
directives to the manifest.json
file you will generate. Refer to the example in that linked answer.
Read the Content Scripts page and note how the manifest can be used to easily add CSS, jQuery, your userscript (AKA content script), etc.
Content scripts are 1 of the 3 main tools available to Chrome extensions. The other 2 are the background page and UI pages. Learn more about those starting with the extension-development Overview.
Finally, you can package your extension as explained in this answer.