by Loic Duros
<script> var myString = "Hello World!"; alert(myString); </script>
<a href="#" onclick="alert('Hello World!')">Say Hello</a>
and the following will be executed right after the page has loaded:
<body onload="alert('Hello World!')">
LibreJS also lists these elements for you in the display panel.
Since it is impossible in general for a machine to understand what that program does, LibreJS cannot tell what that code is or whether it comes from, or whether it is free.
Scripts that are not yours, but are free
This is often the case with libraries, such as jQuery, Mootools, or Prototype, and the third-party plugins that are developed with it. LibreJS v4.7 can detect many free libraries by default, but there are too many plugins available for these libraries and you will still need to add license information to plugins. By looking at the source code or checking the upstream site, you should be able to tell what license is being used. Please ensure these licenses are free and GPL-compatible.
Scripts that are not yours and are not free
Often you can find existing free replacements for the functionality of the nonfree script. We would like to help you; write to email@example.com.
In some cases (analytics and social media sites), what the code does is give information about your users to companies. That would be a bad thing for your site to do even if it were done with free software. The right way to do analytics is with free software such as Piwik. That way you don't give information about your site's visitors to anyone.
Scripts that are yours
Step 3: Adding license information
As mentioned in the previous section, you can find a list of licenses detected as free by LibreJS in the project's documentation.
Instead of adding a license notice between @licstart and @licend, you simply add the following comments at the top and bottom of the script:
<script> // @license [magnet-link] [human readable name of the license] ... [script is here] ... // @license-end </script>
You can also use the /* */ comment format:
<script> /* @license [magnet-link] [human readable name of the license] */ ... [script is here] ... /* @license-end */ </script>
For a script released under the GPLv3 or later, this would become:
<script> // @license magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt GPL-v3-or-Later var myString = "Hello World!"; alert(myString); // @license-end </script>
After adding the correct license, this specific script will appear as free to LibreJS. Please note that the human readable string does not require a specific formatting, only the magnet link is checked. Please note that no code or comment should be added to the script after the // @license-end comment. However, whitespace is allowed.
List of magnet links for valid licenses
The following magnet links will be recognized as free licenses:
GPLv2.0 or later:
GPLv3 or later:
BSD 3 Clause:
You can also use the // @license [magnet-link] and // @license-end notation for external scripts in the same way as scripts directly embedded on a page. Please read Method 2: Specific license information for each script for information on how to do this.
<table id="jslicense-labels1"> <tr> <td><a href="/js/jquery-1.7.min.js">jquery-1.7.min.js</a></td> <td><a href="http://www.jclark.com/xml/copying.txt">Expat</a></td> <td><a href="/js/jquery-1.7.tar.gz">jquery-1.7.tar.gz</a></td> </tr> </table>
It should have the id of 'jslicense-labels1'. For each external script, you must add a table row (
LibreJS identifies the licenses for these scripts using the canonical URL in the second column. A list of the licenses currently detected along with their canonical URL is available in the GNU LibreJS documentation.
Finally, you must add a link to the new page from all the pages loading these files. Don't forget to add a "rel" attribute with "jslicense" as its value:
Updated: $Date: 2013/09/05 18:36:17 $