The GPL is a copyright license that belongs to a category of license commonly called "copyleft" licenses. The defining characteristic of a copyleft license is that a work derived from a copyleft-licensed work must be licensed under that copyleft license as a whole. For the GPL, if your work includes a single piece that is licensed under the GPL, then the entire combined work must be licensed under the GPL whenever you choose to distribute it.
When you distribute a combined work the includes GPL components, you must license the entire work under the GPL. When you do so, your obligations for the new work include:
- making the human-readable source code of your application available whenever the application is available, and
- permitting anyone who receives a copy to make derivative works based on your code and release it under the GPL.
Note that I've said "whenever the application is available" and "anyone who receives a copy." Only people who have been given a copy of your application have a right to the source code and permission to create derivatives. If the application is only available to company employees and not the general public, then no one in the general public has the right to see the source code of your application. Also, the company employees might not either, because they've only been given access to the application as agents of the company. Per the GPL FAQ:
Is making and using multiple copies within one organization or company “distribution”?
No, in that case the organization is just making the copies for itself. As a consequence, a company or other organization can develop a modified version and install that version through its own facilities, without giving the staff permission to release that modified version to outsiders.
But you've said that you want to include some elements on websites, which I assume are public-facing. In that case, for those public-facing works, you will need to make the source publicly available. You ask:
I had to "publish" my code. I don't know what that means, since the JavaScript code is visible to anyone.
Very true -- Web applications are already sent to the user in source form. Some things to consider, however, are:
You must make it clear that that your application is licensed under the GPL. Making the source available satisfies requirement #1 above, but the user might not know that requirement #2 (permission to prepare derivatives under the GPL) is in effect unless you prominently state (e.g., in a footer, About page, etc.) that the work is licensed under the GPLv3 and include a copy of the license.
According to the GPLv3, your source code must be in "the preferred form of the work for making modifications to it." You cannot minify or obfuscate the source code when satisfying the requirement of source code availability. If you wish to minify your application's source (e.g., for performance reasons) then you must separately make the original source available to anyone who receives the minified source.
If your website work is made up of lots of discrete files, it could be a big pain to download all of the pieces. You might make the whole source available as a single zipped file. A complex website with iframed resources, scripts, styles, and image resources could be quite difficult to gather up manually. In addition to being courteous, I'd be a little concerned that forcing users to gather up all the pieces could be viewed as intentionally impeding the ability to access the source, but I don't really know to what degree that concern has legal merit.