1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- This manual is for GNU LibreJS (version 6.0.10.20151023, 23 October 2015),
a GNU IceCat extension to detect and block nonfree nontrivial
JavaScript on webpages.
Copyright (C) 2011 2012 2014 2015 Loic J. Duros
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
Texts. A copy of the license is included in the section entitled
"GNU Free Documentation License". -->
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
<head>
<title>GNU LibreJS 6.0.10.20151023: Setting Your JavaScript Free</title>
<meta name="description" content="GNU LibreJS 6.0.10.20151023: Setting Your JavaScript Free">
<meta name="keywords" content="GNU LibreJS 6.0.10.20151023: Setting Your JavaScript Free">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="index.html#Top" rel="up" title="Top">
<link href="LibreJS-Development-Notes.html#LibreJS-Development-Notes" rel="next" title="LibreJS Development Notes">
<link href="Free-Licenses-Detection.html#Free-Licenses-Detection" rel="prev" title="Free Licenses Detection">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.indentedblock {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
div.smalllisp {margin-left: 3.2em}
kbd {font-style:oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nocodebreak {white-space:nowrap}
span.nolinebreak {white-space:nowrap}
span.roman {font-family:serif; font-weight:normal}
span.sansserif {font-family:sans-serif; font-weight:normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
<a name="Setting-Your-JavaScript-Free"></a>
<div class="header">
<p>
Next: <a href="LibreJS-Development-Notes.html#LibreJS-Development-Notes" accesskey="n" rel="next">LibreJS Development Notes</a>, Previous: <a href="Free-Licenses-Detection.html#Free-Licenses-Detection" accesskey="p" rel="prev">Free Licenses Detection</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<hr>
<a name="Setting-Your-JavaScript-Free-1"></a>
<h2 class="chapter">7 Setting Your JavaScript Free</h2>
<p>The first step is releasing your JavaScript under a free license. If
you are already using a free library, or you’re not using any
third-party libraries, it might only take a few minutes.
</p>
<p>All JavaScript code on a web page (inline, on-page, and external) shares
a common scope. Thus, code is generally either rejected or accepted as a
whole by LibreJS. If some JavaScript code is found to be nontrivial and
nonfree, then most of the time, all the the rest is discarded as well.
</p>
<p>On your website, take a look at your HTML source. You can identify
distinct pieces of JavaScript that might be free and some other that are
nonfree.
</p>
<p><em>Tip</em>: By running LibreJS on your page, you will get a list of all the
JavaScript that was blocked. This gives you an overview of the
JavaScript in your page.
</p>
<p>Imagine a page that contains several pieces of JavaScript from various
sources:
</p><ul>
<li> On top, within the <code><head></code> tag, it includes jQuery
</li><li> Then, some JavaScript code that you have written
</li><li> At the bottom, a JavaScript-based Facebook widget
</li><li> Also, there’s some analytics tracking code
</li></ul>
<dl compact="compact">
<dt><em>JavaScript that is already free</em></dt>
<dd><p>First, you must ensure that the library is free. If the file contains
a copyright and a license notice, you won’t need to look any further.
But if there’s no mention of the license, or if it’s too brief, you’ll
have to look for a COPYING or LICENSE file within the original library’s
source package, or on the library’s official website.
</p>
</dd>
<dt><em>Your own JavaScript</em></dt>
<dd><p>The free license given to your code should be compatible with the rest
of the JavaScript on a page. A good way to check is to read up on
them: <a href="http://www.gnu.org/licenses/license-list.html">http://www.gnu.org/licenses/license-list.html</a>
</p>
</dd>
<dt><em>Nonfree JavaScript</em></dt>
<dd><p>This might be the case with an analytics tracker, social media
widgets, and code that runs ads. Removing these pieces of code from your
site is required to have the rest accepted as free. There are
often alternatives to nonfree libraries or to third-party services:
</p>
<ul>
<li> If you have used nonfree third-party code as the base to write your own
code, try to find a free alternative.
</li><li> If you’re using a third-party service such as an analytics service,
replace it with a free alternative like Piwik.
</li><li> If you can’t find free JavaScript that has already been developed,
write it yourself! Who knows, your own solution might be the start of
a brilliant project!
</li></ul>
</dd>
</dl>
<a name="JavaScript-Web-Labels"></a>
<h3 class="section">7.1 JavaScript Web Labels</h3>
<p>One way to make your website work with LibreJS is by defining a
JavaScript Web Labels table.
</p>
<p>A JavaScript Web Labels table is informative to both site visitors and
the LibreJS program. You make a Web Labels table on a new HTML page
that’s linked to from your main page. The table lists each of your
site’s JavaScript files, that file’s corresponding human-readable source
file, and the canonical url of its free license.
</p>
<p>When using a JavaScript Web Labels table for your own files, it’s
important to put a copying permission statement at the top of each source
file listed in right-most column of the Web Labels table. For info on how
properly release your code as free software, see
<a href="https://www.gnu.org/licenses/gpl-howto.html">https://www.gnu.org/licenses/gpl-howto.html</a>. Future versions of
LibreJS will require a copying permission statement or other license
notice for source files listed in a Web Labels table.
</p>
<p>More information on JavaScript Web Labels is detailed here:
<a href="https://www.gnu.org/software/librejs/free-your-javascript.html#step3">https://www.gnu.org/software/librejs/free-your-javascript.html#step3</a>
and here:
<a href="https://www.gnu.org/licenses/javascript-labels.html">https://www.gnu.org/licenses/javascript-labels.html</a>.
</p>
<a name="Specifying-multiple-licenses-for-a-single-JavaScript-file"></a>
<h4 class="subsection">7.1.1 Specifying multiple licenses for a single JavaScript file</h4>
<p>If you compile or concatenate your JavaScript into a single file, the
source files you’re combining may be released under different licenses.
You can specify multiple licenses for the file in a JavaScript Web Labels
table, like this:
</p>
<pre class="verbatim"><table id="jslicense-labels1">
<tr>
<td><a href="all.min.js">all.min.js</a></td>
<td>
<a href="http://www.gnu.org/licenses/gpl-3.0.html"
>GPL-3.0+</a>
<br />
<a href="http://www.apache.org/licenses/LICENSE-2.0"
>Apache-2.0</a>
</td>
<td>
<a href="gpl-script.js">gpl-script.js</a>
<br />
<a href="apache-script.js">apache-script.js</a>
</td>
</tr>
</table>
</pre>
<p>The <code><br /></code> tags just make the table more understandable when
looking at the rendered version of it on the license page. They aren’t
required by LibreJS.
</p>
<p>If all the licenses contained in the second column are recognized by
LibreJS to be free licenses, then LibreJS will allow the file in the
first column to be run.
</p>
<a name="Adding-a-stylized-comment-in-your-JavaScript-files-and-on-your-page"></a>
<h3 class="section">7.2 Adding a stylized comment in your JavaScript files and on your page</h3>
<p>See a “Convention for releasing free JavaScript programs” in the
JavaScript Trap <a href="http://www.gnu.org/philosophy/javascript-trap.html">http://www.gnu.org/philosophy/javascript-trap.html</a>
</p>
<p>Adding this notice will ensure LibreJS will find the JavaScript file to
be free. The <code>@licstart</code> and <code>@licend</code> lines at the
beginning and end of the stylized comment are necessary to make a clear
statement that the _entire code_ in the file is free. This means that
you must ensure that no nonfree code was carelessly appended at the end
of the file.
</p>
<p>In the main HTML page, the license notice covers JavaScript contained
in all <code><script></code> tags with on-page code and the inline
JavaScript (in event attributes such as onload, onclick, etc, …).
Since external files have their own stylized comment, they are
not covered by the notice in the main HTML page. Make sure to identify
all the licenses available. LibreJS will only ensure it matches a
notice of an allowed license once, so the order does not matter, but
the responsibility is on you to make sure all code is under the free
licenses mentioned between <code>@licstart</code> and <code>@licend</code>.
</p>
<p>You should make <em>only</em> one <code>@licstart</code> <code>@licend</code>
comment in your page, since it pertains to the entire code on page
across all <code><script></code> tags and inline html attributes.
</p>
<p>When you use the JavaScript Web Labels method, you should still include a
license notice at the top of each of your source files. This ensures that
if someone copies the file and uses it for something else, the license
remains intact.
</p>
<p>For more info on making your JavaScript LibreJS-compliant, see this web
page: <a href="https://www.gnu.org/software/librejs/free-your-javascript.html">https://www.gnu.org/software/librejs/free-your-javascript.html</a>
</p>
<hr>
<div class="header">
<p>
Next: <a href="LibreJS-Development-Notes.html#LibreJS-Development-Notes" accesskey="n" rel="next">LibreJS Development Notes</a>, Previous: <a href="Free-Licenses-Detection.html#Free-Licenses-Detection" accesskey="p" rel="prev">Free Licenses Detection</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
</body>
</html>
|